@ledgerhq/coin-hedera
Version:
Ledger Hedera Coin integration
48 lines • 1.81 kB
JavaScript
import { getSerializedAddressParameters, makeScanAccounts, makeSync, updateTransaction, } from "@ledgerhq/coin-framework/bridge/jsHelpers";
import resolver from "../signer/index";
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
import { getTransactionStatus } from "./getTransactionStatus";
import { estimateMaxSpendable } from "./estimateMaxSpendable";
import { prepareTransaction } from "./prepareTransaction";
import { createTransaction } from "./createTransaction";
import { getAccountShape, buildIterateResult } from "./synchronisation";
import { buildSignOperation } from "./signOperation";
import { broadcast } from "./broadcast";
import { receive } from "./receive";
function buildCurrencyBridge(signerContext) {
const getAddress = resolver(signerContext);
const scanAccounts = makeScanAccounts({
getAccountShape,
buildIterateResult,
getAddressFn: getAddressWrapper(getAddress),
});
return {
preload: () => Promise.resolve({}),
hydrate: () => { },
scanAccounts,
};
}
const sync = makeSync({ getAccountShape });
function buildAccountBridge(signerContext) {
const getAddress = resolver(signerContext);
const signOperation = buildSignOperation(signerContext);
return {
estimateMaxSpendable,
createTransaction,
updateTransaction,
getTransactionStatus,
prepareTransaction,
sync,
receive: receive(getAddressWrapper(getAddress)),
signOperation,
broadcast,
getSerializedAddressParameters,
};
}
export function createBridges(signerContext) {
return {
currencyBridge: buildCurrencyBridge(signerContext),
accountBridge: buildAccountBridge(signerContext),
};
}
//# sourceMappingURL=index.js.map