@bithomp/xrpl-api
Version:
A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger
29 lines (28 loc) • 1.11 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseSourceWithAmount = parseSourceWithAmount;
exports.parseSource = parseSource;
const common_1 = require("../../common");
const amount_1 = __importDefault(require("./amount"));
const account_1 = require("./account");
const utils_1 = require("../utils");
function parseSourceWithAmount(tx) {
if (tx && (tx.Account || tx.Account === "")) {
return (0, common_1.removeUndefined)({
address: (0, account_1.parseAccount)(tx.Account),
maxAmount: (0, utils_1.removeGenericCounterparty)((0, amount_1.default)(tx.SendMax || tx.DeliverMax || tx.Amount), tx.Account),
tag: tx.SourceTag,
});
}
}
function parseSource(tx) {
if (tx && (tx.Account || tx.Account === "")) {
return (0, common_1.removeUndefined)({
address: (0, account_1.parseAccount)(tx.Account),
tag: tx.SourceTag,
});
}
}
;