@ledgerhq/coin-hedera
Version:
Ledger Hedera Coin integration
42 lines • 1.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toTransactionRaw = exports.fromTransactionRaw = exports.formatTransaction = void 0;
const formatters_1 = require("@ledgerhq/coin-framework/formatters");
const serialization_1 = require("@ledgerhq/coin-framework/serialization");
const index_1 = require("@ledgerhq/coin-framework/account/index");
const index_2 = require("@ledgerhq/coin-framework/currencies/index");
function formatTransaction(transaction, account) {
const amount = (0, index_2.formatCurrencyUnit)((0, index_1.getAccountCurrency)(account).units[0], transaction.amount, {
showCode: true,
disableRounding: true,
});
return `SEND ${amount}\nTO ${transaction.recipient}`;
}
exports.formatTransaction = formatTransaction;
function fromTransactionRaw(tr) {
const common = (0, serialization_1.fromTransactionCommonRaw)(tr);
return {
...common,
family: tr.family,
memo: tr.memo,
};
}
exports.fromTransactionRaw = fromTransactionRaw;
function toTransactionRaw(t) {
const common = (0, serialization_1.toTransactionCommonRaw)(t);
return {
...common,
family: t.family,
memo: t.memo,
};
}
exports.toTransactionRaw = toTransactionRaw;
exports.default = {
formatTransaction,
fromTransactionRaw,
toTransactionRaw,
fromTransactionStatusRaw: serialization_1.fromTransactionStatusRawCommon,
toTransactionStatusRaw: serialization_1.toTransactionStatusRawCommon,
formatTransactionStatus: formatters_1.formatTransactionStatus,
};
//# sourceMappingURL=transaction.js.map