UNPKG

@ledgerhq/coin-internet_computer

Version:
50 lines 1.9 kB
import { getSerializedAddressParameters, makeAccountBridgeReceive, makeScanAccounts, makeSync, updateTransaction, } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import resolver from "../signer"; import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper"; import { getTransactionStatus } from "./getTransactionStatus"; import { estimateMaxSpendable } from "./estimateMaxSpendable"; import { prepareTransaction } from "./prepareTransaction"; import { createTransaction } from "./createTransaction"; import { getAccountShape } from "./bridgeHelpers/account"; import { buildSignOperation } from "./signOperation"; import { broadcast } from "./broadcast"; function buildCurrencyBridge(signerContext) { const getAddress = resolver(signerContext); const scanAccounts = makeScanAccounts({ getAccountShape, getAddressFn: getAddressWrapper(getAddress), }); return { preload: () => Promise.resolve({}), 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, prepareTransaction, sync, receive, signOperation, signRawOperation: () => { throw new Error("signRawOperation is not supported"); }, broadcast, getSerializedAddressParameters, }; } export function createBridges(signerContext) { return { currencyBridge: buildCurrencyBridge(signerContext), accountBridge: buildAccountBridge(signerContext), }; } //# sourceMappingURL=index.js.map