@ledgerhq/coin-aptos
Version:
Ledger Aptos Coin integration
13 lines • 695 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateAmount = void 0;
const getCoinAndAmounts_1 = require("./getCoinAndAmounts");
function calculateAmount(sender, address, amount_in, amount_out) {
const is_sender = (0, getCoinAndAmounts_1.compareAddress)(sender, address);
// LL negates the amount for SEND transactions
// to show positive amount on the send transaction (ex: in "cancel" tx, when amount will be returned to our account)
// we need to make it negative
return is_sender ? amount_out.minus(amount_in) : amount_in.minus(amount_out);
}
exports.calculateAmount = calculateAmount;
//# sourceMappingURL=calculateAmount.js.map