@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
42 lines (35 loc) • 982 B
text/typescript
import type { CommonDeviceTransactionField } from "@ledgerhq/ledger-wallet-framework/transaction/common";
import type { AccountLike, Account } from "@ledgerhq/types-live";
import type { Transaction, TransactionStatus } from "./types";
async function getDeviceTransactionConfig({
transaction: { tag },
status: { amount, estimatedFees },
}: {
account: AccountLike;
parentAccount: Account | null | undefined;
transaction: Transaction;
status: TransactionStatus;
}): Promise<Array<CommonDeviceTransactionField>> {
const fields: Array<CommonDeviceTransactionField> = [];
if (!amount.isZero()) {
fields.push({
type: "amount",
label: "Amount",
});
}
if (!estimatedFees.isZero()) {
fields.push({
type: "fees",
label: "Fees",
});
}
if (typeof tag === "number") {
fields.push({
type: "text",
label: "Tag",
value: String(tag),
});
}
return fields;
}
export default getDeviceTransactionConfig;