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