UNPKG

@ledgerhq/coin-cardano

Version:
58 lines 2.33 kB
import { getSerializedAddressParameters, updateTransaction, makeAccountBridgeReceive, makeScanAccounts, makeSync, } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper"; import { assignToAccountRaw, assignFromAccountRaw } from "../serialization"; import { estimateMaxSpendable } from "../estimateMaxSpendable"; import { getTransactionStatus } from "../getTransactionStatus/getTransactionStatus"; import { prepareTransaction } from "../prepareTransaction"; import { createTransaction } from "../createTransaction"; import { makeGetAccountShape } from "../synchronisation"; import { buildSignOperation } from "../signOperation"; import { postSyncPatch } from "../postSyncPatch"; import { broadcast } from "../broadcast"; import resolver from "../hw-getAddress"; import cardanoCoinConfig from "../config"; export function buildCurrencyBridge(signerContext) { const getAddress = resolver(signerContext); const scanAccounts = makeScanAccounts({ getAccountShape: makeGetAccountShape(signerContext), getAddressFn: getAddressWrapper(getAddress), }); return { scanAccounts, preload: async () => ({}), hydrate: () => { }, }; } export function buildAccountBridge(signerContext) { const sync = makeSync({ getAccountShape: makeGetAccountShape(signerContext), postSync: postSyncPatch, }); const getAddress = resolver(signerContext); const receive = makeAccountBridgeReceive(getAddressWrapper(getAddress)); return { estimateMaxSpendable, createTransaction, updateTransaction, getTransactionStatus, prepareTransaction, sync, receive, signOperation: buildSignOperation(signerContext), signRawOperation: () => { throw new Error("signRawOperation is not supported"); }, broadcast, assignToAccountRaw, assignFromAccountRaw, getSerializedAddressParameters, }; } export function createBridges(signerContext, coinConfig) { cardanoCoinConfig.setCoinConfig(coinConfig); return { currencyBridge: buildCurrencyBridge(signerContext), accountBridge: buildAccountBridge(signerContext), }; } //# sourceMappingURL=index.js.map