UNPKG

zumokit

Version:

ZumoKit is a Wallet as a Service SDK

52 lines (51 loc) 2.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Transaction = void 0; var decimal_js_1 = require("decimal.js"); var TransactionCryptoProperties_1 = require("./TransactionCryptoProperties"); var TransactionFiatProperties_1 = require("./TransactionFiatProperties"); var TransactionCardProperties_1 = require("./TransactionCardProperties"); var Exchange_1 = require("./Exchange"); var TransactionAmount_1 = require("./TransactionAmount"); var InternalTransaction_1 = require("./InternalTransaction"); var CustodyOrder_1 = require("./CustodyOrder"); /** Transaction details. */ var Transaction = /** @class */ (function () { /** @internal */ function Transaction(json) { this.json = json; this.id = json.id; this.type = json.type; this.currencyCode = json.currencyCode; this.direction = json.direction; this.network = json.network; this.status = json.status; this.amount = json.amount ? new decimal_js_1.Decimal(json.amount) : null; this.fee = json.fee ? new decimal_js_1.Decimal(json.fee) : null; this.nonce = json.nonce; this.senders = json.senders.map(function (senderJson) { return new TransactionAmount_1.TransactionAmount(senderJson); }); this.recipients = json.recipients.map(function (recipientJson) { return new TransactionAmount_1.TransactionAmount(recipientJson); }); this.internalTransactions = json.internalTransactions.map(function (internalTransactionJson) { return new InternalTransaction_1.InternalTransaction(internalTransactionJson); }); this.custodyOrder = json.custodyOrder ? new CustodyOrder_1.CustodyOrder(json.custodyOrder) : null; this.cryptoProperties = json.cryptoProperties ? new TransactionCryptoProperties_1.TransactionCryptoProperties(json.cryptoProperties) : null; this.fiatProperties = json.fiatProperties ? new TransactionFiatProperties_1.TransactionFiatProperties(json.fiatProperties) : null; this.cardProperties = json.cardProperties ? new TransactionCardProperties_1.TransactionCardProperties(json.cardProperties) : null; this.exchange = json.exchange ? new Exchange_1.Exchange(json.exchange) : null; this.metadata = json.metadata ? JSON.parse(json.metadata) : null; this.submittedAt = json.submittedAt; this.confirmedAt = json.confirmedAt; this.timestamp = json.timestamp; } return Transaction; }()); exports.Transaction = Transaction;