UNPKG

@bithomp/xrpl-api

Version:

A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger

26 lines (25 loc) 777 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const common_1 = require("../../common"); const client_1 = require("../../client"); function parseAmount(amount) { if (typeof amount === "string") { return { currency: (0, client_1.getNativeCurrency)(), value: (0, common_1.dropsToXrp)(amount), }; } if (amount && "value" in amount && "currency" in amount && "issuer" in amount) { return { issuer: amount.issuer, currency: amount.currency, value: amount.value, counterparty: amount.issuer, }; } if (amount && typeof amount === "object") { return { ...amount }; } return amount; } exports.default = parseAmount;