@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
54 lines • 1.84 kB
JavaScript
import BigNumber from "bignumber.js";
export function createTransaction(account) {
const currency = account.type === "TokenAccount" ? account.token.parentCurrency : account.currency;
switch (currency.family) {
case "xrp":
case "ripple":
return {
family: currency.family,
amount: BigNumber(0),
recipient: "",
fees: null,
tag: undefined,
feeCustomUnit: null, // NOTE: XRP does not use custom units for fees anymore
};
case "stellar":
return {
family: currency.family,
amount: new BigNumber(0),
fees: null,
recipient: "",
memoValue: null,
memoType: null,
useAllAmount: false,
mode: "send",
assetReference: "",
assetOwner: "",
networkInfo: null,
};
case "tezos":
// note: default transaction for tezos, mode will be set by UI (send, stake, unstake)
return {
family: currency.family,
amount: new BigNumber(0),
fees: null,
recipient: "",
useAllAmount: false,
mode: "send",
networkInfo: null,
};
case "evm": {
return {
mode: "send-eip1559",
family: currency.family,
amount: new BigNumber(0),
recipient: "",
useAllAmount: false,
feesStrategy: "medium",
};
}
default:
throw new Error(`Unsupported currency family: ${currency.family}`);
}
}
//# sourceMappingURL=createTransaction.js.map