UNPKG

@ledgerhq/coin-mina

Version:
50 lines 1.89 kB
import { makeAccountBridgeReceive, getSerializedAddressParameters, updateTransaction, makeScanAccounts, } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper"; import resolver from "../signer/getAddress"; import { sync, getAccountShape } from "./synchronisation"; import { setCoinConfig } from "../config"; import broadcast from "./broadcast"; import { createTransaction } from "./createTransaction"; import estimateMaxSpendable from "./estimateMaxSpendable"; import getTransactionStatus from "./getTransactionStatus"; import { prepareTransaction } from "./prepareTransaction"; import buildSignOperation from "./signOperation"; import makeCliTools from "./cli-transaction"; export { makeCliTools }; 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=index.js.map