UNPKG

@ledgerhq/coin-tron

Version:
54 lines 2.09 kB
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper"; import { getSerializedAddressParameters, updateTransaction, makeAccountBridgeReceive, makeScanAccounts, } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import signerGetAddress from "../signer"; import broadcast from "./broadcast"; import createTransaction from "./createTransaction"; import estimateMaxSpendable from "./estimateMaxSpendable"; import getTransactionStatus from "./getTransactionStatus"; import { hydrate, preload } from "./preload"; import { prepareTransaction } from "./prepareTransaction"; import { assignFromAccountRaw, assignToAccountRaw, fromOperationExtraRaw, toOperationExtraRaw, } from "./serialization"; import { buildSignOperation } from "./signOperation"; import { getAccountShape, sync } from "./synchronization"; import tronCoinConfig from "../config"; function buildCurrencyBridge(signerContext) { const getAddress = signerGetAddress(signerContext); const scanAccounts = makeScanAccounts({ getAccountShape, getAddressFn: getAddressWrapper(getAddress), }); return { preload, hydrate, scanAccounts, }; } function buildAccountBridge(signerContext) { const getAddress = signerGetAddress(signerContext); const receive = makeAccountBridgeReceive(getAddressWrapper(getAddress)); const signOperation = buildSignOperation(signerContext); return { estimateMaxSpendable, createTransaction, updateTransaction, getTransactionStatus, prepareTransaction, sync, receive, signOperation, broadcast, assignFromAccountRaw, assignToAccountRaw, fromOperationExtraRaw, toOperationExtraRaw, getSerializedAddressParameters, }; } export function createBridges(signerContext, coinConfig) { tronCoinConfig.setCoinConfig(coinConfig); return { currencyBridge: buildCurrencyBridge(signerContext), accountBridge: buildAccountBridge(signerContext), }; } //# sourceMappingURL=index.js.map