UNPKG

@ledgerhq/coin-aptos

Version:
54 lines 2.02 kB
import { makeAccountBridgeReceive, makeScanAccounts, getSerializedAddressParameters, makeSync, updateTransaction, } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper"; import resolver from "../signer"; import { assignToAccountRaw, assignFromAccountRaw } from "./serialization"; import getTransactionStatus from "./getTransactionStatus"; import estimateMaxSpendable from "./estimateMaxSpendable"; import prepareTransaction from "./prepareTransaction"; import { getAccountShape } from "./synchronisation"; import buildSignOperation from "./signOperation"; import broadcast from "./broadcast"; import createTransaction from "../logic/createTransaction"; import { hydrate, preloadWithValidators } from "../preload"; function makePreload() { return (currency) => preloadWithValidators(currency); } function buildCurrencyBridge(signerContext) { const getAddress = resolver(signerContext); const scanAccounts = makeScanAccounts({ getAccountShape, getAddressFn: getAddressWrapper(getAddress), }); return { preload: makePreload(), hydrate, scanAccounts, }; } const sync = makeSync({ getAccountShape }); function buildAccountBridge(signerContext) { const getAddress = resolver(signerContext); const receive = makeAccountBridgeReceive(getAddressWrapper(getAddress)); const signOperation = buildSignOperation(signerContext); return { estimateMaxSpendable, createTransaction, updateTransaction, getTransactionStatus, getSerializedAddressParameters, prepareTransaction, sync, receive, signOperation, broadcast, assignToAccountRaw, assignFromAccountRaw, }; } export function createBridges(signerContext) { return { currencyBridge: buildCurrencyBridge(signerContext), accountBridge: buildAccountBridge(signerContext), }; } //# sourceMappingURL=index.js.map