@ledgerhq/coin-algorand
Version:
Ledger Algorand Coin integration
61 lines • 2.42 kB
JavaScript
import { getSerializedAddressParameters, makeAccountBridgeReceive, makeScanAccounts, updateTransaction, } from "@ledgerhq/coin-framework/bridge/jsHelpers";
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
import { estimateMaxSpendable } from "../estimateMaxSpendable";
import formatters from "../formatters";
import { getTransactionStatus } from "../getTransactionStatus";
import { getAccountShape, sync } from "../synchronization";
import { prepareTransaction } from "../prepareTransaction";
import { createTransaction } from "../createTransaction";
import { buildSignOperation } from "../signOperation";
import { initAccount } from "../initAccount";
import { broadcast } from "../broadcast";
import resolver from "../hw-getAddress";
import { assignFromAccountRaw, assignToAccountRaw, fromOperationExtraRaw, toOperationExtraRaw, } from "../serialization";
import { validateAddress } from "../validateAddress";
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 {
createTransaction,
updateTransaction,
prepareTransaction,
getTransactionStatus,
sync,
receive,
assignToAccountRaw,
assignFromAccountRaw,
initAccount,
signOperation,
signRawOperation: () => {
throw new Error("signRawOperation is not supported");
},
broadcast,
estimateMaxSpendable,
fromOperationExtraRaw,
toOperationExtraRaw,
formatAccountSpecifics: formatters.formatAccountSpecifics,
formatOperationSpecifics: formatters.formatOperationSpecifics,
getSerializedAddressParameters,
validateAddress,
};
}
export function createBridges(signerContext) {
return {
currencyBridge: buildCurrencyBridge(signerContext),
accountBridge: buildAccountBridge(signerContext),
};
}
//# sourceMappingURL=js.js.map