@ledgerhq/coin-algorand
Version:
Ledger Algorand Coin integration
40 lines • 1.79 kB
JavaScript
import { rejectBalanceOptions } from "@ledgerhq/coin-module-framework/api/getBalance/rejectBalanceOptions";
import { craftTransactionData } from "@ledgerhq/coin-module-framework/logic/craftTransactionData";
import coinConfig from "../config";
import { broadcast, combine, craftApiTransaction, estimateFees, getBalance, getBlockInfo, lastBlock, listOperations, validateIntent, } from "../logic";
import { validateAddress } from "../validateAddress";
export function createApi(config) {
coinConfig.setCoinConfig(() => ({ ...config, status: { type: "active" } }));
return {
broadcast,
combine,
craftTransaction: craftApiTransaction,
estimateFees: (_transactionIntent) => estimateFees(),
getBalance: (address, options) => rejectBalanceOptions(() => getBalance(address), options),
getBlockInfo,
lastBlock,
listOperations,
validateIntent,
getBlock(_height) {
throw new Error("getBlock is not supported for Algorand");
},
getNextSequence(_address) {
throw new Error("getNextSequence is not applicable for Algorand");
},
getStakes(_address, _cursor) {
throw new Error("getStakes is not supported for Algorand");
},
getRewards(_address, _cursor) {
throw new Error("getRewards is not supported for Algorand");
},
getValidators(_cursor) {
throw new Error("getValidators is not supported for Algorand");
},
craftRawTransaction: (_transaction, _sender, _publicKey, _sequence) => {
throw new Error("craftRawTransaction is not supported for Algorand");
},
validateAddress,
craftTransactionData,
};
}
//# sourceMappingURL=index.js.map