UNPKG

@ledgerhq/coin-multiversx

Version:
56 lines 2.22 kB
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper"; import { getSerializedAddressParameters, updateTransaction, makeAccountBridgeReceive, makeScanAccounts, } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import { broadcast } from "../broadcast"; import { createTransaction } from "../createTransaction"; import { estimateMaxSpendable } from "../estimateMaxSpendable"; import formatters from "../formatters"; import { getTransactionStatus } from "../getTransactionStatus"; import resolver from "../hw-getAddress"; import { getPreloadStrategy, hydrate, preload } from "../preload"; import { prepareTransaction } from "../prepareTransaction"; import { assignFromAccountRaw, assignToAccountRaw, fromOperationExtraRaw, toOperationExtraRaw, } from "../serialization"; import { buildSignOperation } from "../signOperation"; import { getAccountShape, sync } from "../synchronisation"; export function buildCurrencyBridge(signerContext) { const getAddress = resolver(signerContext); const scanAccounts = makeScanAccounts({ getAccountShape, getAddressFn: getAddress, }); return { getPreloadStrategy, preload, 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, assignFromAccountRaw, assignToAccountRaw, fromOperationExtraRaw, toOperationExtraRaw, formatAccountSpecifics: formatters.formatAccountSpecifics, formatOperationSpecifics: formatters.formatOperationSpecifics, getSerializedAddressParameters, }; } export function createBridges(signerContext) { return { currencyBridge: buildCurrencyBridge(signerContext), accountBridge: buildAccountBridge(signerContext), }; } //# sourceMappingURL=js.js.map