UNPKG

@ledgerhq/coin-ton

Version:
48 lines 1.81 kB
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper"; import { getSerializedAddressParameters, makeAccountBridgeReceive, makeScanAccounts, updateTransaction, } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import broadcast from "../broadcast"; import { setCoinConfig } from "../config"; import createTransaction from "../createTransaction"; import estimateMaxSpendable from "../estimateMaxSpendable"; import getTransactionStatus from "../getTransactionStatus"; import resolver from "../hw-getAddress"; import prepareTransaction from "../prepareTransaction"; import { buildSignOperation } from "../signOperation"; import { getAccountShape, sync } from "../synchronisation"; export function buildCurrencyBridge(signerContext) { const getAddress = resolver(signerContext); const scanAccounts = makeScanAccounts({ getAccountShape, getAddressFn: getAddress, }); return { preload: async () => Promise.resolve({}), hydrate: () => { }, scanAccounts, }; } export function buildAccountBridge(signerContext) { const getAddress = resolver(signerContext); const receive = makeAccountBridgeReceive(getAddressWrapper(getAddress)); const signOperation = buildSignOperation(signerContext); return { estimateMaxSpendable, createTransaction, updateTransaction, getTransactionStatus, prepareTransaction, sync, receive, signOperation, broadcast, getSerializedAddressParameters, }; } export function createBridges(signerContext, coinConfig) { setCoinConfig(coinConfig); return { currencyBridge: buildCurrencyBridge(signerContext), accountBridge: buildAccountBridge(signerContext), }; } //# sourceMappingURL=js.js.map