UNPKG

@ledgerhq/coin-aptos

Version:
37 lines 1.68 kB
import coinConfig from "../config"; import { AptosAPI } from "../network"; import { combine } from "../logic/combine"; import { craftTransaction } from "../logic/craftTransaction"; import { getBalances } from "../logic/getBalances"; export function createApi(config) { coinConfig.setCoinConfig(() => ({ ...config, status: { type: "active" } })); const client = new AptosAPI(config.aptosSettings); return { broadcast: (tx) => client.broadcast(tx), combine: (tx, signature, pubkey) => combine(tx, signature, pubkey), craftTransaction: (transactionIntent, _customFees) => craftTransaction(client, transactionIntent), craftRawTransaction: (_transaction, _sender, _publicKey, _sequence) => { throw new Error("craftRawTransaction is not supported"); }, estimateFees: (transactionIntent) => client.estimateFees(transactionIntent), getBalance: (address) => getBalances(client, address), lastBlock: () => client.getLastBlock(), listOperations: (address, pagination) => client.listOperations(address, pagination.minHeight), getBlock(_height) { throw new Error("getBlock is not supported"); }, getBlockInfo(_height) { throw new Error("getBlockInfo is not supported"); }, getStakes(_address, _cursor) { throw new Error("getStakes is not supported"); }, getRewards(_address, _cursor) { throw new Error("getRewards is not supported"); }, getValidators(_cursor) { throw new Error("getValidators is not supported"); }, }; } //# sourceMappingURL=index.js.map