@ledgerhq/coin-near
Version:
53 lines • 2.02 kB
JavaScript
import { getSerializedAddressParameters, makeAccountBridgeReceive, updateTransaction, makeScanAccounts, } from "@ledgerhq/coin-framework/bridge/jsHelpers";
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
import { assignToAccountRaw, assignFromAccountRaw } from "../serialization";
import { preload, hydrate, getPreloadStrategy } from "../preload";
import { getTransactionStatus } from "../getTransactionStatus";
import { estimateMaxSpendable } from "../estimateMaxSpendable";
import { sync, getAccountShape } from "../synchronisation";
import { prepareTransaction } from "../prepareTransaction";
import { setCoinConfig } from "../config";
import { createTransaction } from "../createTransaction";
import { buildSignOperation } from "../signOperation";
import { broadcast } from "../broadcast";
import resolver from "../hw-getAddress";
export function buildCurrencyBridge(signerContext) {
const getAddress = resolver(signerContext);
const scanAccounts = makeScanAccounts({
getAccountShape,
getAddressFn: getAddress,
});
return {
preload,
hydrate,
getPreloadStrategy,
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,
assignToAccountRaw,
assignFromAccountRaw,
getSerializedAddressParameters,
};
}
export function createBridges(signerContext, coinConfig) {
setCoinConfig(coinConfig);
return {
currencyBridge: buildCurrencyBridge(signerContext),
accountBridge: buildAccountBridge(signerContext),
};
}
//# sourceMappingURL=js.js.map