UNPKG

@ledgerhq/coin-hedera

Version:
60 lines 2.36 kB
import getAddressWrapper from "@ledgerhq/ledger-wallet-framework/bridge/getAddressWrapper"; import { getSerializedAddressParameters, makeScanAccounts, makeSync, updateTransaction, } from "@ledgerhq/ledger-wallet-framework/bridge/jsHelpers"; import hederaCoinConfig from "../config"; import { getPreloadStrategy, hydrate, preload } from "../preload"; import resolver from "../signer/index"; import { broadcast } from "./broadcast"; import { createTransaction } from "./createTransaction"; import { estimateMaxSpendable } from "./estimateMaxSpendable"; import { getTransactionStatus } from "./getTransactionStatus"; import { prepareTransaction } from "./prepareTransaction"; import { receive } from "./receive"; import { assignFromAccountRaw, assignToAccountRaw } from "./serialization"; import { buildSignOperation } from "./signOperation"; import { getAccountShape, buildIterateResult, postSync } from "./synchronisation"; import { validateAddress } from "./validateAddress"; function buildCurrencyBridge(signerContext) { const getAddress = resolver(signerContext); const scanAccounts = makeScanAccounts({ getAccountShape, buildIterateResult, getAddressFn: getAddressWrapper(getAddress), }); return { preload, hydrate, getPreloadStrategy, scanAccounts, }; } const sync = makeSync({ getAccountShape, postSync, shouldMergeOps: false }); function buildAccountBridge(signerContext) { const getAddress = resolver(signerContext); const signOperation = buildSignOperation(signerContext); return { estimateMaxSpendable, createTransaction, updateTransaction, getTransactionStatus, prepareTransaction, assignToAccountRaw, assignFromAccountRaw, sync, receive: receive(getAddressWrapper(getAddress)), signOperation, signRawOperation: () => { throw new Error("signRawOperation is not supported"); }, broadcast, getSerializedAddressParameters, validateAddress, }; } export function createBridges(signerContext, coinConfig) { hederaCoinConfig.setCoinConfig(coinConfig); return { currencyBridge: buildCurrencyBridge(signerContext), accountBridge: buildAccountBridge(signerContext), }; } //# sourceMappingURL=index.js.map