@bithomp/xrpl-api 3.6.15 → 3.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.js +7 -0
- package/lib/parse/ledger/tx-account-set-flags.js +0 -6
- package/lib/parse/outcome/balance_changes.d.ts +1 -0
- package/lib/parse/outcome/balance_changes.js +46 -2
- package/lib/parse/outcome/channel_changes.js +2 -2
- package/lib/parse/specification/account-delete.js +1 -1
- package/lib/parse/specification/check-cancel.js +1 -1
- package/lib/parse/specification/check-cash.js +1 -1
- package/lib/parse/specification/check-create.js +1 -1
- package/lib/parse/specification/clawback.js +1 -1
- package/lib/parse/specification/deposit-preauth.js +1 -1
- package/lib/parse/specification/escrow-cancel.js +1 -1
- package/lib/parse/specification/escrow-create.js +1 -1
- package/lib/parse/specification/escrow-finish.js +1 -1
- package/lib/parse/specification/genesis-mint.js +1 -1
- package/lib/parse/specification/offer-cancel.js +4 -3
- package/lib/parse/specification/payment-channel-claim.js +1 -1
- package/lib/parse/specification/payment-channel-create.js +1 -1
- package/lib/parse/specification/payment-channel-fund.js +1 -1
- package/lib/parse/specification/remit.d.ts +1 -1
- package/lib/parse/specification/remit.js +1 -3
- package/lib/parse/specification/set-remarks.d.ts +1 -1
- package/lib/parse/specification/set-remarks.js +1 -3
- package/lib/parse/specification/ticket-create.js +1 -1
- package/lib/parse/specification/unrecognized.js +1 -1
- package/lib/parse/specification/uritoken-burn.d.ts +1 -1
- package/lib/parse/specification/uritoken-burn.js +1 -3
- package/lib/parse/specification/uritoken-buy.d.ts +1 -1
- package/lib/parse/specification/uritoken-buy.js +1 -3
- package/lib/parse/specification/uritoken-cancel-sell-offer.d.ts +1 -1
- package/lib/parse/specification/uritoken-cancel-sell-offer.js +1 -3
- package/lib/parse/specification/uritoken-create-sell-offer.d.ts +1 -1
- package/lib/parse/specification/uritoken-create-sell-offer.js +1 -3
- package/lib/types/global.d.ts +2 -7
- package/lib/types/global.js +1 -3
- package/package.json +3 -3
package/lib/common/utils.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ export declare function parseMarker(marker?: any): any;
|
|
|
9
9
|
export declare function dropsToXrp(drops: BigNumber.Value): string;
|
|
10
10
|
export declare function xrpToDrops(xrp: BigNumber.Value): string;
|
|
11
11
|
export declare function removeUndefined<T extends object>(obj: T): T;
|
|
12
|
+
export declare function emptyObjectToUndefined<T extends object>(obj: T): T | undefined;
|
|
12
13
|
export declare function getConstructorName(object: object): string | undefined;
|
package/lib/common/utils.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.parseMarker = parseMarker;
|
|
|
12
12
|
exports.dropsToXrp = dropsToXrp;
|
|
13
13
|
exports.xrpToDrops = xrpToDrops;
|
|
14
14
|
exports.removeUndefined = removeUndefined;
|
|
15
|
+
exports.emptyObjectToUndefined = emptyObjectToUndefined;
|
|
15
16
|
exports.getConstructorName = getConstructorName;
|
|
16
17
|
const lodash_1 = __importDefault(require("lodash"));
|
|
17
18
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
@@ -116,6 +117,12 @@ function xrpToDrops(xrp) {
|
|
|
116
117
|
function removeUndefined(obj) {
|
|
117
118
|
return lodash_1.default.omitBy(obj, (value) => value == null);
|
|
118
119
|
}
|
|
120
|
+
function emptyObjectToUndefined(obj) {
|
|
121
|
+
if (lodash_1.default.isEmpty(obj)) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
return obj;
|
|
125
|
+
}
|
|
119
126
|
function getConstructorName(object) {
|
|
120
127
|
if (object.constructor.name) {
|
|
121
128
|
return object.constructor.name;
|
|
@@ -5,12 +5,6 @@ const global_1 = require("../../types/global");
|
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
6
|
function parseTxAccountSetFlags(value, options = {}) {
|
|
7
7
|
const flags = {};
|
|
8
|
-
if (value & global_1.GlobalFlags.tfFullyCanonicalSig) {
|
|
9
|
-
flags.fullyCanonicalSig = true;
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
flags.fullyCanonicalSig = false;
|
|
13
|
-
}
|
|
14
8
|
if (options.nativeCurrency === common_1.MAINNET_NATIVE_CURRENCY) {
|
|
15
9
|
if (value & global_1.GlobalFlags.tfInnerBatchTxn) {
|
|
16
10
|
flags.innerBatchTxn = true;
|
|
@@ -15,6 +15,7 @@ export interface BalanceChanges {
|
|
|
15
15
|
}
|
|
16
16
|
interface ParseBalanceChangesOptions {
|
|
17
17
|
adjustBalancesForNativeEscrow?: boolean;
|
|
18
|
+
adjustBalancesForPaymentChannel?: boolean;
|
|
18
19
|
}
|
|
19
20
|
declare function parseBalanceChanges(metadata: TransactionMetadata, nativeCurrency?: string, tx?: any, options?: ParseBalanceChangesOptions): BalanceChanges;
|
|
20
21
|
declare function parseFinalBalances(metadata: TransactionMetadata, nativeCurrency?: string): {
|
|
@@ -13,7 +13,9 @@ const utils_1 = require("../utils");
|
|
|
13
13
|
const mptoken_1 = require("../../models/mptoken");
|
|
14
14
|
const mptoken_normalize_1 = require("../mptoken_normalize");
|
|
15
15
|
const amount_1 = __importDefault(require("../ledger/amount"));
|
|
16
|
+
const channel_changes_1 = require("./channel_changes");
|
|
16
17
|
const ESCROW_TYPES = ["EscrowFinish", "EscrowCreate", "EscrowCancel"];
|
|
18
|
+
const PAYMENT_CHANNEL_TYPES = ["PaymentChannelClaim", "PaymentChannelCreate", "PaymentChannelFund"];
|
|
17
19
|
function groupByAddress(balanceChanges) {
|
|
18
20
|
const grouped = lodash_1.default.groupBy(balanceChanges, function (node) {
|
|
19
21
|
return node.address;
|
|
@@ -217,6 +219,45 @@ function adjustBalancesForNativeEscrow(balanceChanges, metadata, nativeCurrency,
|
|
|
217
219
|
adjustBalancesChanges(balanceChanges, source, [{ currency: amount.currency, value: `-${amount.value}` }]);
|
|
218
220
|
}
|
|
219
221
|
}
|
|
222
|
+
function adjustBalancesForPaymentChannel(balanceChanges, metadata, nativeCurrency, tx) {
|
|
223
|
+
const channelChanges = (0, channel_changes_1.parseChannelChanges)(metadata);
|
|
224
|
+
if (!channelChanges) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (!channelChanges.source?.address) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (tx.TransactionType === "PaymentChannelCreate") {
|
|
231
|
+
adjustBalancesChanges(balanceChanges, channelChanges.source.address, [
|
|
232
|
+
{ currency: channelChanges.amount.currency, value: channelChanges.amount.value },
|
|
233
|
+
]);
|
|
234
|
+
}
|
|
235
|
+
else if (tx.TransactionType === "PaymentChannelFund") {
|
|
236
|
+
if (channelChanges.amountChange) {
|
|
237
|
+
adjustBalancesChanges(balanceChanges, channelChanges.source.address, [
|
|
238
|
+
{ currency: channelChanges.amountChange.currency, value: channelChanges.amountChange.value },
|
|
239
|
+
]);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
else if (tx.TransactionType === "PaymentChannelClaim") {
|
|
243
|
+
if (tx.Account === channelChanges.source.address && channelChanges.amountChange) {
|
|
244
|
+
adjustBalancesChanges(balanceChanges, channelChanges.source.address, [
|
|
245
|
+
{ currency: channelChanges.amountChange.currency, value: channelChanges.amountChange.value },
|
|
246
|
+
]);
|
|
247
|
+
}
|
|
248
|
+
else if (channelChanges.status === "deleted") {
|
|
249
|
+
const unlockedAmount = new bignumber_js_1.default(channelChanges.amount.value).minus(new bignumber_js_1.default(channelChanges?.balance?.value || "0"));
|
|
250
|
+
adjustBalancesChanges(balanceChanges, channelChanges.source.address, [
|
|
251
|
+
{ currency: channelChanges.amount.currency, value: `-${unlockedAmount.toString()}` },
|
|
252
|
+
]);
|
|
253
|
+
}
|
|
254
|
+
else if (channelChanges.balanceChange) {
|
|
255
|
+
adjustBalancesChanges(balanceChanges, channelChanges.source.address, [
|
|
256
|
+
{ currency: channelChanges.balanceChange.currency, value: channelChanges.balanceChange.value },
|
|
257
|
+
]);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
220
261
|
function adjustBalancesChanges(balanceChanges, address, changes) {
|
|
221
262
|
const existingChanges = balanceChanges[address] || [];
|
|
222
263
|
const change = existingChanges.find((c) => c.currency === changes[0].currency && c.issuer === changes[0].issuer);
|
|
@@ -242,10 +283,13 @@ function parseBalanceChanges(metadata, nativeCurrency, tx, options) {
|
|
|
242
283
|
(0, mptoken_normalize_1.normalizeMPTokensPreviousFields)(metadata, tx);
|
|
243
284
|
}
|
|
244
285
|
const balanceChanges = parseQuantities(metadata, computeBalanceChange, nativeCurrency);
|
|
245
|
-
if (tx &&
|
|
246
|
-
if (
|
|
286
|
+
if (tx && tx.TransactionType && options) {
|
|
287
|
+
if (options.adjustBalancesForNativeEscrow && ESCROW_TYPES.includes(tx.TransactionType)) {
|
|
247
288
|
adjustBalancesForNativeEscrow(balanceChanges, metadata, nativeCurrency, tx);
|
|
248
289
|
}
|
|
290
|
+
else if (options.adjustBalancesForPaymentChannel && PAYMENT_CHANNEL_TYPES.includes(tx.TransactionType)) {
|
|
291
|
+
adjustBalancesForPaymentChannel(balanceChanges, metadata, nativeCurrency, tx);
|
|
292
|
+
}
|
|
249
293
|
}
|
|
250
294
|
return balanceChanges;
|
|
251
295
|
}
|
|
@@ -39,8 +39,8 @@ function summarizePaymentChannel(node) {
|
|
|
39
39
|
if (prev.Amount) {
|
|
40
40
|
summary.channelAmountChangeDrops = new bignumber_js_1.default(final.Amount).minus(new bignumber_js_1.default(prev.Amount || 0)).toString(10);
|
|
41
41
|
summary.amountChange = (0, amount_1.default)(prev.Amount);
|
|
42
|
-
summary.amountChange.value = new bignumber_js_1.default(summary.
|
|
43
|
-
.minus(new bignumber_js_1.default(summary.
|
|
42
|
+
summary.amountChange.value = new bignumber_js_1.default(summary.amount.value)
|
|
43
|
+
.minus(new bignumber_js_1.default(summary.amountChange.value))
|
|
44
44
|
.toString(10);
|
|
45
45
|
}
|
|
46
46
|
if (prev.Balance) {
|
|
@@ -52,7 +52,7 @@ function parseAccountDelete(tx, nativeCurrency) {
|
|
|
52
52
|
source: (0, source_1.parseSource)(tx),
|
|
53
53
|
destination: (0, destination_1.parseDestination)(tx),
|
|
54
54
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
55
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
55
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
56
56
|
memos: (0, memos_1.parseMemos)(tx),
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -51,7 +51,7 @@ function parseCheckCancel(tx, nativeCurrency) {
|
|
|
51
51
|
source: (0, source_1.parseSource)(tx),
|
|
52
52
|
checkID: tx.CheckID,
|
|
53
53
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
54
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
54
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
55
55
|
memos: (0, memos_1.parseMemos)(tx),
|
|
56
56
|
});
|
|
57
57
|
}
|
|
@@ -57,7 +57,7 @@ function parseCheckCash(tx, nativeCurrency) {
|
|
|
57
57
|
amount: tx.Amount && (0, amount_1.default)(tx.Amount),
|
|
58
58
|
deliverMin: tx.DeliverMin && (0, amount_1.default)(tx.DeliverMin),
|
|
59
59
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
60
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
60
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
61
61
|
memos: (0, memos_1.parseMemos)(tx),
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -60,7 +60,7 @@ function parseCheckCreate(tx, nativeCurrency) {
|
|
|
60
60
|
expiration: tx.Expiration && (0, utils_1.parseTimestamp)(tx.Expiration),
|
|
61
61
|
invoiceID: tx.InvoiceID,
|
|
62
62
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
63
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
63
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
64
64
|
memos: (0, memos_1.parseMemos)(tx),
|
|
65
65
|
});
|
|
66
66
|
}
|
|
@@ -55,7 +55,7 @@ function parseClawback(tx, nativeCurrency) {
|
|
|
55
55
|
source: (0, source_1.parseSource)(tx),
|
|
56
56
|
amount: tx.Amount ? (0, amount_1.default)(tx.Amount) : undefined,
|
|
57
57
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
58
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
58
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
59
59
|
memos: (0, memos_1.parseMemos)(tx),
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -61,7 +61,7 @@ function parseDepositPreauth(tx, nativeCurrency) {
|
|
|
61
61
|
authorizeCredentials: tx.AuthorizeCredentials ? tx.AuthorizeCredentials.map(parseCredentials) : undefined,
|
|
62
62
|
unauthorizeCredentials: tx.UnauthorizeCredentials ? tx.UnauthorizeCredentials.map(parseCredentials) : undefined,
|
|
63
63
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
64
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
64
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
65
65
|
memos: (0, memos_1.parseMemos)(tx),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -52,7 +52,7 @@ function parseEscrowCancel(tx, nativeCurrency) {
|
|
|
52
52
|
owner: tx.Owner,
|
|
53
53
|
escrowSequence: tx.OfferSequence,
|
|
54
54
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
55
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
55
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
56
56
|
memos: (0, memos_1.parseMemos)(tx),
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -57,7 +57,7 @@ function parseEscrowCreation(tx, nativeCurrency) {
|
|
|
57
57
|
allowCancelAfter: (0, utils_1.parseTimestamp)(tx.CancelAfter),
|
|
58
58
|
allowExecuteAfter: (0, utils_1.parseTimestamp)(tx.FinishAfter),
|
|
59
59
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
60
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
60
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
61
61
|
memos: (0, memos_1.parseMemos)(tx),
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -54,7 +54,7 @@ function parseEscrowFinish(tx, nativeCurrency) {
|
|
|
54
54
|
condition: tx.Condition,
|
|
55
55
|
fulfillment: tx.Fulfillment,
|
|
56
56
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
57
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
57
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
58
58
|
memos: (0, memos_1.parseMemos)(tx),
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -46,7 +46,7 @@ function parseGenesisMint(tx, nativeCurrency) {
|
|
|
46
46
|
source: (0, source_1.parseSource)(tx),
|
|
47
47
|
genesisMints: (0, genesis_mints_1.parseGenesisMints)(tx),
|
|
48
48
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
49
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
49
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
50
50
|
memos: (0, memos_1.parseMemos)(tx),
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const assert = __importStar(require("assert"));
|
|
37
|
+
const common_1 = require("../../common");
|
|
37
38
|
const tx_global_flags_1 = require("../ledger/tx-global-flags");
|
|
38
39
|
const memos_1 = require("../ledger/memos");
|
|
39
40
|
const emit_details_1 = require("../ledger/emit_details");
|
|
@@ -43,15 +44,15 @@ const delegate_1 = require("../ledger/delegate");
|
|
|
43
44
|
const source_1 = require("../ledger/source");
|
|
44
45
|
function parseOfferCancel(tx, nativeCurrency) {
|
|
45
46
|
assert.ok(tx.TransactionType === "OfferCancel");
|
|
46
|
-
return {
|
|
47
|
+
return (0, common_1.removeUndefined)({
|
|
47
48
|
signers: (0, signers_1.parseSigners)(tx),
|
|
48
49
|
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
49
50
|
delegate: (0, delegate_1.parseDelegate)(tx),
|
|
50
51
|
source: (0, source_1.parseSource)(tx),
|
|
51
52
|
orderSequence: tx.OfferSequence,
|
|
52
53
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
53
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
54
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
54
55
|
memos: (0, memos_1.parseMemos)(tx),
|
|
55
|
-
};
|
|
56
|
+
});
|
|
56
57
|
}
|
|
57
58
|
exports.default = parseOfferCancel;
|
|
@@ -60,7 +60,7 @@ function parsePaymentChannelClaim(tx, nativeCurrency) {
|
|
|
60
60
|
renew: Boolean(tx.Flags & xrpl_1.PaymentChannelClaimFlags.tfRenew) || undefined,
|
|
61
61
|
close: Boolean(tx.Flags & xrpl_1.PaymentChannelClaimFlags.tfClose) || undefined,
|
|
62
62
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
63
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
63
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
64
64
|
memos: (0, memos_1.parseMemos)(tx),
|
|
65
65
|
});
|
|
66
66
|
}
|
|
@@ -61,7 +61,7 @@ function parsePaymentChannelCreate(tx, nativeCurrency) {
|
|
|
61
61
|
publicKey: tx.PublicKey,
|
|
62
62
|
cancelAfter: tx.CancelAfter && (0, utils_1.parseTimestamp)(tx.CancelAfter),
|
|
63
63
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
64
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
64
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
65
65
|
memos: (0, memos_1.parseMemos)(tx),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -58,7 +58,7 @@ function parsePaymentChannelFund(tx, nativeCurrency) {
|
|
|
58
58
|
amount: (0, amount_1.default)(tx.Amount),
|
|
59
59
|
expiration: tx.Expiration && (0, utils_1.parseTimestamp)(tx.Expiration),
|
|
60
60
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
61
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
61
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
62
62
|
memos: (0, memos_1.parseMemos)(tx),
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
const assert = __importStar(require("assert"));
|
|
40
40
|
const common_1 = require("../../common");
|
|
41
41
|
const emit_details_1 = require("../ledger/emit_details");
|
|
42
|
-
const tx_global_flags_1 = require("../ledger/tx-global-flags");
|
|
43
42
|
const memos_1 = require("../ledger/memos");
|
|
44
43
|
const signers_1 = require("../ledger/signers");
|
|
45
44
|
const regular_key_1 = require("../ledger/regular-key");
|
|
@@ -71,7 +70,7 @@ function parseMintURIToken(mintURIToken) {
|
|
|
71
70
|
digest: mintURIToken.Digest,
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
|
-
function parseRemit(tx
|
|
73
|
+
function parseRemit(tx) {
|
|
75
74
|
assert.ok(tx.TransactionType === "Remit");
|
|
76
75
|
return (0, common_1.removeUndefined)({
|
|
77
76
|
signers: (0, signers_1.parseSigners)(tx),
|
|
@@ -85,7 +84,6 @@ function parseRemit(tx, nativeCurrency) {
|
|
|
85
84
|
inform: tx.Inform,
|
|
86
85
|
invoiceID: tx.InvoiceID,
|
|
87
86
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
88
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
89
87
|
memos: (0, memos_1.parseMemos)(tx),
|
|
90
88
|
});
|
|
91
89
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormattedSetRemarksSpecification } from "../../types/remarks";
|
|
2
|
-
declare function parseSetRemarks(tx: any
|
|
2
|
+
declare function parseSetRemarks(tx: any): FormattedSetRemarksSpecification;
|
|
3
3
|
export default parseSetRemarks;
|
|
@@ -36,13 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const assert = __importStar(require("assert"));
|
|
37
37
|
const common_1 = require("../../common");
|
|
38
38
|
const emit_details_1 = require("../ledger/emit_details");
|
|
39
|
-
const tx_global_flags_1 = require("../ledger/tx-global-flags");
|
|
40
39
|
const memos_1 = require("../ledger/memos");
|
|
41
40
|
const signers_1 = require("../ledger/signers");
|
|
42
41
|
const regular_key_1 = require("../ledger/regular-key");
|
|
43
42
|
const source_1 = require("../ledger/source");
|
|
44
43
|
const remarks_1 = require("../ledger/remarks");
|
|
45
|
-
function parseSetRemarks(tx
|
|
44
|
+
function parseSetRemarks(tx) {
|
|
46
45
|
assert.ok(tx.TransactionType === "SetRemarks");
|
|
47
46
|
return (0, common_1.removeUndefined)({
|
|
48
47
|
objectID: tx.ObjectID,
|
|
@@ -51,7 +50,6 @@ function parseSetRemarks(tx, nativeCurrency) {
|
|
|
51
50
|
signers: (0, signers_1.parseSigners)(tx),
|
|
52
51
|
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
53
52
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
54
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
55
53
|
memos: (0, memos_1.parseMemos)(tx),
|
|
56
54
|
});
|
|
57
55
|
}
|
|
@@ -51,7 +51,7 @@ function parseTicketCreate(tx, nativeCurrency) {
|
|
|
51
51
|
source: (0, source_1.parseSource)(tx),
|
|
52
52
|
ticketCount: tx.TicketCount,
|
|
53
53
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
54
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
54
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
55
55
|
memos: (0, memos_1.parseMemos)(tx),
|
|
56
56
|
});
|
|
57
57
|
}
|
|
@@ -17,7 +17,7 @@ function unrecognizedParser(tx, nativeCurrency) {
|
|
|
17
17
|
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
18
18
|
delegate: (0, delegate_1.parseDelegate)(tx),
|
|
19
19
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
20
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
20
|
+
flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
|
|
21
21
|
memos: (0, memos_1.parseMemos)(tx),
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormattedURITokenBurnSpecification } from "../../types/uritokens";
|
|
2
|
-
declare function parseURITokenBurn(tx: any
|
|
2
|
+
declare function parseURITokenBurn(tx: any): FormattedURITokenBurnSpecification;
|
|
3
3
|
export default parseURITokenBurn;
|
|
@@ -36,12 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const assert = __importStar(require("assert"));
|
|
37
37
|
const common_1 = require("../../common");
|
|
38
38
|
const emit_details_1 = require("../ledger/emit_details");
|
|
39
|
-
const tx_global_flags_1 = require("../ledger/tx-global-flags");
|
|
40
39
|
const memos_1 = require("../ledger/memos");
|
|
41
40
|
const signers_1 = require("../ledger/signers");
|
|
42
41
|
const regular_key_1 = require("../ledger/regular-key");
|
|
43
42
|
const source_1 = require("../ledger/source");
|
|
44
|
-
function parseURITokenBurn(tx
|
|
43
|
+
function parseURITokenBurn(tx) {
|
|
45
44
|
assert.ok(tx.TransactionType === "URITokenBurn");
|
|
46
45
|
return (0, common_1.removeUndefined)({
|
|
47
46
|
uritokenID: tx.URITokenID,
|
|
@@ -49,7 +48,6 @@ function parseURITokenBurn(tx, nativeCurrency) {
|
|
|
49
48
|
signers: (0, signers_1.parseSigners)(tx),
|
|
50
49
|
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
51
50
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
52
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
53
51
|
memos: (0, memos_1.parseMemos)(tx),
|
|
54
52
|
});
|
|
55
53
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormattedURITokenBuySpecification } from "../../types/uritokens";
|
|
2
|
-
declare function parseURITokenBuy(tx: any
|
|
2
|
+
declare function parseURITokenBuy(tx: any): FormattedURITokenBuySpecification;
|
|
3
3
|
export default parseURITokenBuy;
|
|
@@ -36,12 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const assert = __importStar(require("assert"));
|
|
37
37
|
const common_1 = require("../../common");
|
|
38
38
|
const emit_details_1 = require("../ledger/emit_details");
|
|
39
|
-
const tx_global_flags_1 = require("../ledger/tx-global-flags");
|
|
40
39
|
const memos_1 = require("../ledger/memos");
|
|
41
40
|
const signers_1 = require("../ledger/signers");
|
|
42
41
|
const regular_key_1 = require("../ledger/regular-key");
|
|
43
42
|
const source_1 = require("../ledger/source");
|
|
44
|
-
function parseURITokenBuy(tx
|
|
43
|
+
function parseURITokenBuy(tx) {
|
|
45
44
|
assert.ok(tx.TransactionType === "URITokenBuy");
|
|
46
45
|
return (0, common_1.removeUndefined)({
|
|
47
46
|
uritokenID: tx.URITokenID,
|
|
@@ -50,7 +49,6 @@ function parseURITokenBuy(tx, nativeCurrency) {
|
|
|
50
49
|
signers: (0, signers_1.parseSigners)(tx),
|
|
51
50
|
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
52
51
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
53
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
54
52
|
memos: (0, memos_1.parseMemos)(tx),
|
|
55
53
|
});
|
|
56
54
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormattedURITokenCancelSellOfferSpecification } from "../../types/uritokens";
|
|
2
|
-
declare function parseURITokenCancelSellOffer(tx: any
|
|
2
|
+
declare function parseURITokenCancelSellOffer(tx: any): FormattedURITokenCancelSellOfferSpecification;
|
|
3
3
|
export default parseURITokenCancelSellOffer;
|
|
@@ -36,12 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const assert = __importStar(require("assert"));
|
|
37
37
|
const common_1 = require("../../common");
|
|
38
38
|
const emit_details_1 = require("../ledger/emit_details");
|
|
39
|
-
const tx_global_flags_1 = require("../ledger/tx-global-flags");
|
|
40
39
|
const memos_1 = require("../ledger/memos");
|
|
41
40
|
const signers_1 = require("../ledger/signers");
|
|
42
41
|
const regular_key_1 = require("../ledger/regular-key");
|
|
43
42
|
const source_1 = require("../ledger/source");
|
|
44
|
-
function parseURITokenCancelSellOffer(tx
|
|
43
|
+
function parseURITokenCancelSellOffer(tx) {
|
|
45
44
|
assert.ok(tx.TransactionType === "URITokenCancelSellOffer");
|
|
46
45
|
return (0, common_1.removeUndefined)({
|
|
47
46
|
uritokenID: tx.URITokenID,
|
|
@@ -49,7 +48,6 @@ function parseURITokenCancelSellOffer(tx, nativeCurrency) {
|
|
|
49
48
|
source: (0, source_1.parseSource)(tx),
|
|
50
49
|
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
51
50
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
52
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
53
51
|
memos: (0, memos_1.parseMemos)(tx),
|
|
54
52
|
});
|
|
55
53
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormattedURITokenCreateSellOfferSpecification } from "../../types/uritokens";
|
|
2
|
-
declare function parseURITokenCreateSellOffer(tx: any
|
|
2
|
+
declare function parseURITokenCreateSellOffer(tx: any): FormattedURITokenCreateSellOfferSpecification;
|
|
3
3
|
export default parseURITokenCreateSellOffer;
|
|
@@ -36,13 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const assert = __importStar(require("assert"));
|
|
37
37
|
const common_1 = require("../../common");
|
|
38
38
|
const emit_details_1 = require("../ledger/emit_details");
|
|
39
|
-
const tx_global_flags_1 = require("../ledger/tx-global-flags");
|
|
40
39
|
const memos_1 = require("../ledger/memos");
|
|
41
40
|
const signers_1 = require("../ledger/signers");
|
|
42
41
|
const regular_key_1 = require("../ledger/regular-key");
|
|
43
42
|
const source_1 = require("../ledger/source");
|
|
44
43
|
const destination_1 = require("../ledger/destination");
|
|
45
|
-
function parseURITokenCreateSellOffer(tx
|
|
44
|
+
function parseURITokenCreateSellOffer(tx) {
|
|
46
45
|
assert.ok(tx.TransactionType === "URITokenCreateSellOffer");
|
|
47
46
|
return (0, common_1.removeUndefined)({
|
|
48
47
|
uritokenID: tx.URITokenID,
|
|
@@ -52,7 +51,6 @@ function parseURITokenCreateSellOffer(tx, nativeCurrency) {
|
|
|
52
51
|
signers: (0, signers_1.parseSigners)(tx),
|
|
53
52
|
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
54
53
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
55
|
-
flags: (0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency }),
|
|
56
54
|
memos: (0, memos_1.parseMemos)(tx),
|
|
57
55
|
});
|
|
58
56
|
}
|
package/lib/types/global.d.ts
CHANGED
|
@@ -6,14 +6,9 @@ export interface TxGlobalFlagsKeysInterface {
|
|
|
6
6
|
fullyCanonicalSig?: boolean;
|
|
7
7
|
innerBatchTxn?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare const TxGlobalFlagsKeys: {
|
|
10
|
-
fullyCanonicalSig: GlobalFlags;
|
|
11
|
-
};
|
|
9
|
+
export declare const TxGlobalFlagsKeys: {};
|
|
12
10
|
export declare const XRPLTxGlobalFlagsKeys: {
|
|
13
11
|
innerBatchTxn: GlobalFlags;
|
|
14
|
-
fullyCanonicalSig: GlobalFlags;
|
|
15
|
-
};
|
|
16
|
-
export declare const XahauTxGlobalFlagsKeys: {
|
|
17
|
-
fullyCanonicalSig: GlobalFlags;
|
|
18
12
|
};
|
|
13
|
+
export declare const XahauTxGlobalFlagsKeys: {};
|
|
19
14
|
export declare function getTxGlobalFlagsKeys(nativeCurrency?: string): Record<string, number>;
|
package/lib/types/global.js
CHANGED
|
@@ -8,9 +8,7 @@ var GlobalFlags;
|
|
|
8
8
|
GlobalFlags[GlobalFlags["tfFullyCanonicalSig"] = 2147483648] = "tfFullyCanonicalSig";
|
|
9
9
|
GlobalFlags[GlobalFlags["tfInnerBatchTxn"] = 1073741824] = "tfInnerBatchTxn";
|
|
10
10
|
})(GlobalFlags || (exports.GlobalFlags = GlobalFlags = {}));
|
|
11
|
-
exports.TxGlobalFlagsKeys = {
|
|
12
|
-
fullyCanonicalSig: GlobalFlags.tfFullyCanonicalSig,
|
|
13
|
-
};
|
|
11
|
+
exports.TxGlobalFlagsKeys = {};
|
|
14
12
|
exports.XRPLTxGlobalFlagsKeys = {
|
|
15
13
|
...exports.TxGlobalFlagsKeys,
|
|
16
14
|
innerBatchTxn: GlobalFlags.tfInnerBatchTxn,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bithomp/xrpl-api",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.17",
|
|
4
4
|
"description": "A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
44
44
|
"lint": "eslint",
|
|
45
45
|
"prepare": "npm run build",
|
|
46
|
-
"
|
|
46
|
+
"prepublishOnly": "npm test && npm run lint",
|
|
47
47
|
"preversion": "npm run lint",
|
|
48
48
|
"version": "npm run format && git add -A src",
|
|
49
49
|
"postversion": "git push && git push --tags"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@typescript-eslint/parser": "^8.46.1",
|
|
75
75
|
"chai": "^6.2.0",
|
|
76
76
|
"chai-as-promised": "^8.0.2",
|
|
77
|
-
"eslint": "^9.
|
|
77
|
+
"eslint": "^9.38.0",
|
|
78
78
|
"eslint-config-prettier": "^10.1.8",
|
|
79
79
|
"eslint-plugin-chai-friendly": "^1.1.0",
|
|
80
80
|
"eslint-plugin-import": "^2.32.0",
|