@bithomp/xrpl-api 3.8.3 → 3.8.11

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.
Files changed (29) hide show
  1. package/lib/parse/ledger/destination.d.ts +1 -0
  2. package/lib/parse/ledger/destination.js +8 -0
  3. package/lib/parse/ledger/tx-sponsorship-set-flags.d.ts +6 -0
  4. package/lib/parse/ledger/tx-sponsorship-set-flags.js +8 -0
  5. package/lib/parse/mptoken_normalize.d.ts +1 -0
  6. package/lib/parse/mptoken_normalize.js +19 -0
  7. package/lib/parse/outcome/balance_changes.d.ts +2 -0
  8. package/lib/parse/outcome/balance_changes.js +114 -5
  9. package/lib/parse/outcome/index.d.ts +1 -0
  10. package/lib/parse/outcome/index.js +3 -1
  11. package/lib/parse/outcome/mptoken_changes.js +8 -0
  12. package/lib/parse/outcome/mptoken_issuance_changes.js +19 -3
  13. package/lib/parse/outcome/sponsorship_changes.d.ts +17 -0
  14. package/lib/parse/outcome/sponsorship_changes.js +66 -0
  15. package/lib/parse/outcome.js +10 -0
  16. package/lib/parse/specification/confidential-mpt-clawback.d.ts +3 -0
  17. package/lib/parse/specification/confidential-mpt-clawback.js +61 -0
  18. package/lib/parse/specification/confidential-mpt-convert-back.d.ts +3 -0
  19. package/lib/parse/specification/confidential-mpt-convert-back.js +64 -0
  20. package/lib/parse/specification/confidential-mpt-convert.d.ts +3 -0
  21. package/lib/parse/specification/confidential-mpt-convert.js +63 -0
  22. package/lib/parse/specification/sponsorship-set.d.ts +3 -0
  23. package/lib/parse/specification/sponsorship-set.js +67 -0
  24. package/lib/parse/transaction.d.ts +8 -0
  25. package/lib/parse/transaction.js +12 -0
  26. package/lib/types/mptokens.d.ts +22 -0
  27. package/lib/types/sponsorship.d.ts +34 -0
  28. package/lib/types/sponsorship.js +34 -0
  29. package/package.json +11 -11
@@ -1,2 +1,3 @@
1
1
  import { FormattedDestinationAddress } from "../../types/account";
2
2
  export declare function parseDestination(tx: any): FormattedDestinationAddress | undefined;
3
+ export declare function parseAddress(tx: any, field?: string): FormattedDestinationAddress | undefined;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseDestination = parseDestination;
4
+ exports.parseAddress = parseAddress;
4
5
  const common_1 = require("../../common");
5
6
  function parseDestination(tx) {
6
7
  if (tx && tx.Destination) {
@@ -10,3 +11,10 @@ function parseDestination(tx) {
10
11
  });
11
12
  }
12
13
  }
14
+ function parseAddress(tx, field = "Destination") {
15
+ if (tx && tx[field]) {
16
+ return (0, common_1.removeUndefined)({
17
+ address: tx[field],
18
+ });
19
+ }
20
+ }
@@ -0,0 +1,6 @@
1
+ import { SponsorshipSetFlagsKeysInterface } from "../../types/sponsorship";
2
+ declare function parseTxSponsorshipSetFlags(value: number, options?: {
3
+ excludeFalse?: boolean;
4
+ nativeCurrency?: string;
5
+ }): SponsorshipSetFlagsKeysInterface;
6
+ export default parseTxSponsorshipSetFlags;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sponsorship_1 = require("../../types/sponsorship");
4
+ const flags_1 = require("./flags");
5
+ function parseTxSponsorshipSetFlags(value, options = {}) {
6
+ return (0, flags_1.parseFlags)(value, (0, sponsorship_1.getSponsorshipSetFlagsKeys)(options.nativeCurrency), options);
7
+ }
8
+ exports.default = parseTxSponsorshipSetFlags;
@@ -2,4 +2,5 @@ export declare function normalizeMPTokensPreviousFields(meta: any, tx: any): voi
2
2
  export declare function normalizeMPTokensPreviousFieldsEscrowCreate(meta: any): void;
3
3
  export declare function normalizeMPTokensPreviousFieldsEscrowFinish(meta: any): void;
4
4
  export declare function normalizeMPTokensPreviousFieldsEscrowCancel(meta: any): void;
5
+ export declare function normalizeMPTokensPreviousFieldsConfidentialMPTConvert(meta: any): void;
5
6
  export declare function normalizeMPTokensPreviousFieldsTransfer(meta: any, tx: any): void;
@@ -4,6 +4,7 @@ exports.normalizeMPTokensPreviousFields = normalizeMPTokensPreviousFields;
4
4
  exports.normalizeMPTokensPreviousFieldsEscrowCreate = normalizeMPTokensPreviousFieldsEscrowCreate;
5
5
  exports.normalizeMPTokensPreviousFieldsEscrowFinish = normalizeMPTokensPreviousFieldsEscrowFinish;
6
6
  exports.normalizeMPTokensPreviousFieldsEscrowCancel = normalizeMPTokensPreviousFieldsEscrowCancel;
7
+ exports.normalizeMPTokensPreviousFieldsConfidentialMPTConvert = normalizeMPTokensPreviousFieldsConfidentialMPTConvert;
7
8
  exports.normalizeMPTokensPreviousFieldsTransfer = normalizeMPTokensPreviousFieldsTransfer;
8
9
  const TRANSFER_TRANSACTION_TYPES = ["Payment", "CheckCash", "EscrowFinish", "Clawback", "AMMClawback"];
9
10
  function normalizeMPTokensPreviousFields(meta, tx) {
@@ -19,6 +20,9 @@ function normalizeMPTokensPreviousFields(meta, tx) {
19
20
  else if (tx.TransactionType === "EscrowCancel") {
20
21
  normalizeMPTokensPreviousFieldsEscrowCancel(meta);
21
22
  }
23
+ else if (tx.TransactionType === "ConfidentialMPTConvert") {
24
+ normalizeMPTokensPreviousFieldsConfidentialMPTConvert(meta);
25
+ }
22
26
  else if (TRANSFER_TRANSACTION_TYPES.includes(tx.TransactionType)) {
23
27
  normalizeMPTokensPreviousFieldsTransfer(meta, tx);
24
28
  }
@@ -175,6 +179,21 @@ function normalizeMPTokensPreviousFieldsEscrowCancel(meta) {
175
179
  }
176
180
  }
177
181
  }
182
+ function normalizeMPTokensPreviousFieldsConfidentialMPTConvert(meta) {
183
+ const confidentialMPTConvertNode = meta.AffectedNodes.find((node) => {
184
+ const modifiedNode = node.ModifiedNode;
185
+ return modifiedNode && modifiedNode.LedgerEntryType === "MPTokenIssuance";
186
+ });
187
+ if (!confidentialMPTConvertNode) {
188
+ return;
189
+ }
190
+ const prevFields = confidentialMPTConvertNode.ModifiedNode.PreviousFields;
191
+ if (prevFields && prevFields.ConfidentialOutstandingAmount === undefined) {
192
+ if (prevFields.ConfidentialOutstandingAmount === undefined) {
193
+ prevFields.ConfidentialOutstandingAmount = "0";
194
+ }
195
+ }
196
+ }
178
197
  function normalizeMPTokensPreviousFieldsTransfer(meta, tx) {
179
198
  if (tx.Destination === undefined) {
180
199
  return;
@@ -16,6 +16,8 @@ export interface BalanceChanges {
16
16
  interface ParseBalanceChangesOptions {
17
17
  adjustBalancesForNativeEscrow?: boolean;
18
18
  adjustBalancesForPaymentChannel?: boolean;
19
+ adjustBalancesForConfidentialMPTConvert?: boolean;
20
+ adjustBalancesForSponsorship?: boolean;
19
21
  }
20
22
  declare function parseBalanceChanges(metadata: TransactionMetadata, nativeCurrency?: string, tx?: any, options?: ParseBalanceChangesOptions): BalanceChanges;
21
23
  declare function parseFinalBalances(metadata: TransactionMetadata, nativeCurrency?: string): BalanceChanges;
@@ -14,8 +14,10 @@ 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
16
  const channel_changes_1 = require("./channel_changes");
17
+ const sponsorship_changes_1 = require("./sponsorship_changes");
17
18
  const ESCROW_TYPES = ["EscrowFinish", "EscrowCreate", "EscrowCancel"];
18
19
  const PAYMENT_CHANNEL_TYPES = ["PaymentChannelClaim", "PaymentChannelCreate", "PaymentChannelFund"];
20
+ const CONFIDENTIAL_MPT_CONVERT_TYPES = ["ConfidentialMPTConvert", "ConfidentialMPTConvertBack"];
19
21
  function groupByAddress(balanceChanges) {
20
22
  const grouped = lodash_1.default.groupBy(balanceChanges, function (node) {
21
23
  return node.address;
@@ -297,6 +299,101 @@ function adjustBalancesForPaymentChannel(balanceChanges, metadata, nativeCurrenc
297
299
  }
298
300
  }
299
301
  }
302
+ function adjustBalancesForConfidentialMPTConvert(balanceChanges, tx) {
303
+ const amount = tx.MPTAmount;
304
+ const mptIssuanceID = tx.MPTokenIssuanceID;
305
+ if (!amount || !mptIssuanceID) {
306
+ return;
307
+ }
308
+ const holder = tx.Account;
309
+ if (!holder) {
310
+ return;
311
+ }
312
+ const holderChanges = balanceChanges[holder];
313
+ if (!holderChanges) {
314
+ return;
315
+ }
316
+ const holderChange = holderChanges.find((c) => c.mpt_issuance_id === mptIssuanceID);
317
+ if (!holderChange) {
318
+ return;
319
+ }
320
+ if (tx.TransactionType === "ConfidentialMPTConvertBack") {
321
+ adjustBalancesChanges(balanceChanges, holder, [{ value: `-${amount}`, mpt_issuance_id: mptIssuanceID }]);
322
+ }
323
+ else {
324
+ adjustBalancesChanges(balanceChanges, holder, [{ value: `${amount}`, mpt_issuance_id: mptIssuanceID }]);
325
+ }
326
+ }
327
+ function adjustBalancesForConfidentialMPTClawback(balanceChanges, tx) {
328
+ const amount = tx.MPTAmount;
329
+ const mptIssuanceID = tx.MPTokenIssuanceID;
330
+ if (!amount || !mptIssuanceID) {
331
+ return;
332
+ }
333
+ const issuer = tx.Account;
334
+ const holder = tx.Holder;
335
+ if (!issuer || !holder) {
336
+ return;
337
+ }
338
+ const issuerChanges = balanceChanges[issuer];
339
+ if (!issuerChanges) {
340
+ return;
341
+ }
342
+ const issuerChange = issuerChanges.find((c) => c.mpt_issuance_id === mptIssuanceID);
343
+ if (!issuerChange) {
344
+ return;
345
+ }
346
+ adjustBalancesChanges(balanceChanges, holder, [{ value: `-${amount}`, mpt_issuance_id: mptIssuanceID }]);
347
+ }
348
+ function adjustBalancesForSponsorship(balanceChanges, metadata, nativeCurrency, tx) {
349
+ const sponsorshipChanges = (0, sponsorship_changes_1.parseSponsorshipChanges)(metadata);
350
+ if (!sponsorshipChanges || sponsorshipChanges.length === 0) {
351
+ return;
352
+ }
353
+ for (const sponsorshipChange of sponsorshipChanges) {
354
+ const owner = sponsorshipChange.owner?.address;
355
+ const sponsee = sponsorshipChange.sponsee?.address;
356
+ if (!owner || !sponsee) {
357
+ return;
358
+ }
359
+ if (sponsorshipChange.status === "created") {
360
+ if (sponsorshipChange.feeAmount) {
361
+ adjustBalancesChanges(balanceChanges, owner, [
362
+ { currency: sponsorshipChange.feeAmount.currency, value: `${sponsorshipChange.feeAmount.value}` },
363
+ ]);
364
+ }
365
+ }
366
+ else if (sponsorshipChange.status === "modified") {
367
+ if (tx.Account === owner) {
368
+ if (sponsorshipChange.feeAmountChange) {
369
+ adjustBalancesChanges(balanceChanges, owner, [
370
+ {
371
+ currency: sponsorshipChange.feeAmountChange.currency,
372
+ value: `${sponsorshipChange.feeAmountChange.value}`,
373
+ },
374
+ ]);
375
+ }
376
+ }
377
+ else {
378
+ if (sponsorshipChange.feeAmountChange) {
379
+ adjustBalancesChanges(balanceChanges, owner, [
380
+ {
381
+ currency: sponsorshipChange.feeAmountChange.currency,
382
+ value: sponsorshipChange.feeAmountChange.value,
383
+ },
384
+ ]);
385
+ }
386
+ }
387
+ }
388
+ else if (sponsorshipChange.status === "deleted") {
389
+ if (sponsorshipChange.feeAmount) {
390
+ adjustBalancesChanges(balanceChanges, owner, [
391
+ { currency: sponsorshipChange.feeAmount.currency, value: `-${sponsorshipChange.feeAmount.value}` },
392
+ ]);
393
+ }
394
+ }
395
+ }
396
+ }
300
397
  function adjustBalancesChanges(balanceChanges, address, changes) {
301
398
  const existingChanges = balanceChanges[address] || [];
302
399
  const change = existingChanges.find((c) => c.currency === changes[0].currency && c.issuer === changes[0].issuer);
@@ -325,12 +422,24 @@ function parseBalanceChanges(metadata, nativeCurrency, tx, options) {
325
422
  (0, mptoken_normalize_1.normalizeMPTokensPreviousFields)(metadata, tx);
326
423
  }
327
424
  const balanceChanges = parseQuantities(metadata, computeBalanceChange, nativeCurrency);
328
- if (tx && tx.TransactionType && options) {
329
- if (options.adjustBalancesForNativeEscrow && ESCROW_TYPES.includes(tx.TransactionType)) {
330
- adjustBalancesForNativeEscrow(balanceChanges, metadata, nativeCurrency, tx);
425
+ if (tx && tx.TransactionType) {
426
+ if (options) {
427
+ if (options.adjustBalancesForNativeEscrow && ESCROW_TYPES.includes(tx.TransactionType)) {
428
+ adjustBalancesForNativeEscrow(balanceChanges, metadata, nativeCurrency, tx);
429
+ }
430
+ else if (options.adjustBalancesForPaymentChannel && PAYMENT_CHANNEL_TYPES.includes(tx.TransactionType)) {
431
+ adjustBalancesForPaymentChannel(balanceChanges, metadata, nativeCurrency, tx);
432
+ }
433
+ else if (options.adjustBalancesForConfidentialMPTConvert &&
434
+ CONFIDENTIAL_MPT_CONVERT_TYPES.includes(tx.TransactionType)) {
435
+ adjustBalancesForConfidentialMPTConvert(balanceChanges, tx);
436
+ }
437
+ if (options.adjustBalancesForSponsorship && nativeCurrency === common_1.MAINNET_NATIVE_CURRENCY) {
438
+ adjustBalancesForSponsorship(balanceChanges, metadata, nativeCurrency, tx);
439
+ }
331
440
  }
332
- else if (options.adjustBalancesForPaymentChannel && PAYMENT_CHANNEL_TYPES.includes(tx.TransactionType)) {
333
- adjustBalancesForPaymentChannel(balanceChanges, metadata, nativeCurrency, tx);
441
+ if (tx.TransactionType === "ConfidentialMPTClawback") {
442
+ adjustBalancesForConfidentialMPTClawback(balanceChanges, tx);
334
443
  }
335
444
  }
336
445
  return balanceChanges;
@@ -20,6 +20,7 @@ export { parseMPTokenIssuanceChanges } from "./mptoken_issuance_changes";
20
20
  export { parseMPTokenChanges } from "./mptoken_changes";
21
21
  export { parseCredentialChanges } from "./credential_changes";
22
22
  export { parseDelegateChanges } from "./delegate_changes";
23
+ export { parseSponsorshipChanges } from "./sponsorship_changes";
23
24
  export { parseRemarksChanges } from "./remarks_changes";
24
25
  export { parseAmendmentChanges } from "./amendment_changes";
25
26
  export { parseCronChanges } from "./cron_changes";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseAccountSettingChanges = exports.parseCronChanges = exports.parseAmendmentChanges = exports.parseRemarksChanges = exports.parseDelegateChanges = exports.parseCredentialChanges = exports.parseMPTokenChanges = exports.parseMPTokenIssuanceChanges = exports.parseDeliveredAmount = exports.parseOracleChanges = exports.parseDIDChanges = exports.parseAmmChanges = exports.parseUNLReportChanges = exports.parseEscrowChanges = exports.parseEmittedTxns = exports.parseHooksExecutions = exports.parseOrderbookChanges = exports.parseCheckChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
3
+ exports.parseAccountSettingChanges = exports.parseCronChanges = exports.parseAmendmentChanges = exports.parseRemarksChanges = exports.parseSponsorshipChanges = exports.parseDelegateChanges = exports.parseCredentialChanges = exports.parseMPTokenChanges = exports.parseMPTokenIssuanceChanges = exports.parseDeliveredAmount = exports.parseOracleChanges = exports.parseDIDChanges = exports.parseAmmChanges = exports.parseUNLReportChanges = exports.parseEscrowChanges = exports.parseEmittedTxns = exports.parseHooksExecutions = exports.parseOrderbookChanges = exports.parseCheckChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
4
4
  var affected_objects_1 = require("./affected_objects");
5
5
  Object.defineProperty(exports, "parseAffectedObjects", { enumerable: true, get: function () { return affected_objects_1.parseAffectedObjects; } });
6
6
  var nftoken_changes_1 = require("./nftoken_changes");
@@ -45,6 +45,8 @@ var credential_changes_1 = require("./credential_changes");
45
45
  Object.defineProperty(exports, "parseCredentialChanges", { enumerable: true, get: function () { return credential_changes_1.parseCredentialChanges; } });
46
46
  var delegate_changes_1 = require("./delegate_changes");
47
47
  Object.defineProperty(exports, "parseDelegateChanges", { enumerable: true, get: function () { return delegate_changes_1.parseDelegateChanges; } });
48
+ var sponsorship_changes_1 = require("./sponsorship_changes");
49
+ Object.defineProperty(exports, "parseSponsorshipChanges", { enumerable: true, get: function () { return sponsorship_changes_1.parseSponsorshipChanges; } });
48
50
  var remarks_changes_1 = require("./remarks_changes");
49
51
  Object.defineProperty(exports, "parseRemarksChanges", { enumerable: true, get: function () { return remarks_changes_1.parseRemarksChanges; } });
50
52
  var amendment_changes_1 = require("./amendment_changes");
@@ -51,6 +51,9 @@ class MPTokenChanges {
51
51
  account,
52
52
  amount: node.NewFields.MPTAmount || "0",
53
53
  lockedAmount: node.NewFields.LockedAmount,
54
+ confidentialBalanceVersion: node.NewFields.ConfidentialBalanceVersion,
55
+ confidentialBalanceInbox: node.NewFields.ConfidentialBalanceInbox,
56
+ confidentialBalanceSpending: node.NewFields.ConfidentialBalanceSpending,
54
57
  });
55
58
  }
56
59
  if (affectedNode.ModifiedNode) {
@@ -90,6 +93,9 @@ class MPTokenChanges {
90
93
  account,
91
94
  amount: node.FinalFields.MPTAmount || "0",
92
95
  lockedAmount: node.FinalFields.LockedAmount,
96
+ confidentialBalanceVersion: node.FinalFields.ConfidentialBalanceVersion,
97
+ confidentialBalanceInbox: node.FinalFields.ConfidentialBalanceInbox,
98
+ confidentialBalanceSpending: node.FinalFields.ConfidentialBalanceSpending,
93
99
  amountChange,
94
100
  lockedAmountChange,
95
101
  flagsChange,
@@ -105,6 +111,8 @@ class MPTokenChanges {
105
111
  account,
106
112
  amount: node.FinalFields.MPTAmount,
107
113
  lockedAmount: node.FinalFields.LockedAmount,
114
+ confidentialBalanceInbox: node.FinalFields.ConfidentialBalanceInbox,
115
+ confidentialBalanceSpending: node.FinalFields.ConfidentialBalanceSpending,
108
116
  });
109
117
  }
110
118
  }
@@ -50,6 +50,7 @@ class MPTokenIssuanceChanges {
50
50
  transferFee: node.NewFields.TransferFee,
51
51
  maximumAmount: node.NewFields.MaximumAmount,
52
52
  outstandingAmount: node.NewFields.OutstandingAmount,
53
+ confidentialOutstandingAmount: node.NewFields.ConfidentialOutstandingAmount,
53
54
  lockedAmount: node.NewFields.LockedAmount,
54
55
  metadata: node.NewFields.Metadata,
55
56
  scale: node.NewFields.AssetScale,
@@ -57,9 +58,21 @@ class MPTokenIssuanceChanges {
57
58
  }
58
59
  if (affectedNode.ModifiedNode) {
59
60
  const mptIssuanceID = (0, mptoken_1.buildMPTokenIssuanceID)(node.FinalFields.Sequence, node.FinalFields.Issuer);
60
- let outstandingAmountChange = new bignumber_js_1.default(node.FinalFields.OutstandingAmount ?? 0)
61
- .minus(node.PreviousFields.OutstandingAmount ?? 0)
62
- .toString();
61
+ let confidentialOutstandingAmountChange;
62
+ let outstandingAmountChange;
63
+ if (node.PreviousFields.hasOwnProperty("ConfidentialOutstandingAmount")) {
64
+ confidentialOutstandingAmountChange = new bignumber_js_1.default(node.FinalFields.ConfidentialOutstandingAmount ?? 0)
65
+ .minus(node.PreviousFields.ConfidentialOutstandingAmount ?? 0)
66
+ .toString();
67
+ }
68
+ else {
69
+ outstandingAmountChange = new bignumber_js_1.default(node.FinalFields.OutstandingAmount ?? 0)
70
+ .minus(node.PreviousFields.OutstandingAmount ?? 0)
71
+ .toString();
72
+ }
73
+ if (confidentialOutstandingAmountChange === "0") {
74
+ confidentialOutstandingAmountChange = undefined;
75
+ }
63
76
  if (outstandingAmountChange === "0") {
64
77
  outstandingAmountChange = undefined;
65
78
  }
@@ -89,10 +102,12 @@ class MPTokenIssuanceChanges {
89
102
  transferFee: node.FinalFields.TransferFee,
90
103
  maximumAmount: node.FinalFields.MaximumAmount,
91
104
  outstandingAmount: node.FinalFields.OutstandingAmount,
105
+ confidentialOutstandingAmount: node.FinalFields.ConfidentialOutstandingAmount,
92
106
  lockedAmount,
93
107
  metadata: node.FinalFields.Metadata,
94
108
  scale: node.FinalFields.AssetScale,
95
109
  outstandingAmountChange,
110
+ confidentialOutstandingAmountChange,
96
111
  lockedAmountChange,
97
112
  flagsChange,
98
113
  });
@@ -108,6 +123,7 @@ class MPTokenIssuanceChanges {
108
123
  transferFee: node.FinalFields.TransferFee,
109
124
  maximumAmount: node.FinalFields.MaximumAmount,
110
125
  outstandingAmount: node.FinalFields.OutstandingAmount,
126
+ confidentialOutstandingAmount: node.FinalFields.ConfidentialOutstandingAmount,
111
127
  lockedAmount: node.FinalFields.LockedAmount,
112
128
  metadata: node.FinalFields.Metadata,
113
129
  scale: node.FinalFields.AssetScale,
@@ -0,0 +1,17 @@
1
+ import { TransactionMetadata } from "xrpl";
2
+ import { FormattedSourceAddress, FormattedDestinationAddress } from "../../types/account";
3
+ import { IssuedCurrencyAmount } from "../../types/amounts";
4
+ interface FormattedSponsorshipSummaryInterface {
5
+ status?: "created" | "modified" | "deleted";
6
+ sponsorshipID: string;
7
+ owner?: FormattedSourceAddress;
8
+ sponsee?: FormattedDestinationAddress;
9
+ feeAmountDrops: string;
10
+ feeAmount: IssuedCurrencyAmount;
11
+ feeAmountChangeDrops?: string;
12
+ feeAmountChange?: IssuedCurrencyAmount;
13
+ previousTxnLgrSeq?: number;
14
+ previousTxnID?: string;
15
+ }
16
+ declare function parseSponsorshipChanges(metadata: TransactionMetadata): FormattedSponsorshipSummaryInterface[] | undefined;
17
+ export { parseSponsorshipChanges };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseSponsorshipChanges = parseSponsorshipChanges;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const amount_1 = __importDefault(require("../ledger/amount"));
9
+ const utils_1 = require("../utils");
10
+ function parseSponsorshipStatus(node) {
11
+ if (node.diffType === "CreatedNode") {
12
+ return "created";
13
+ }
14
+ if (node.diffType === "ModifiedNode") {
15
+ return "modified";
16
+ }
17
+ if (node.diffType === "DeletedNode") {
18
+ return "deleted";
19
+ }
20
+ return undefined;
21
+ }
22
+ function summarizeSponsorship(node) {
23
+ const final = node.diffType === "CreatedNode" ? node.newFields : node.finalFields;
24
+ const prev = node.previousFields;
25
+ const summary = {
26
+ status: parseSponsorshipStatus(node),
27
+ sponsorshipID: node.ledgerIndex,
28
+ owner: { address: final.Owner },
29
+ sponsee: { address: final.Sponsee },
30
+ feeAmountDrops: new bignumber_js_1.default(final.FeeAmount || 0).toString(10),
31
+ feeAmount: (0, amount_1.default)(final.FeeAmount),
32
+ };
33
+ if (prev.FeeAmount) {
34
+ summary.feeAmountChangeDrops = new bignumber_js_1.default(final.FeeAmount || 0)
35
+ .minus(new bignumber_js_1.default(prev.FeeAmount || 0))
36
+ .toString(10);
37
+ summary.feeAmountChange = (0, amount_1.default)(prev.FeeAmount);
38
+ summary.feeAmountChange.value = new bignumber_js_1.default(summary.feeAmount?.value || 0)
39
+ .minus(new bignumber_js_1.default(summary.feeAmountChange.value))
40
+ .toString(10);
41
+ }
42
+ if (node.PreviousTxnID) {
43
+ summary.previousTxnID = node.PreviousTxnID;
44
+ }
45
+ if (node.PreviousTxnLgrSeq) {
46
+ summary.previousTxnLgrSeq = node.PreviousTxnLgrSeq;
47
+ }
48
+ return summary;
49
+ }
50
+ function parseSponsorshipChanges(metadata) {
51
+ if (!metadata || !metadata.AffectedNodes) {
52
+ return undefined;
53
+ }
54
+ const affectedNodes = metadata.AffectedNodes.filter((affectedNode) => {
55
+ const node = affectedNode.CreatedNode || affectedNode.ModifiedNode || affectedNode.DeletedNode;
56
+ return node.LedgerEntryType === "Sponsorship";
57
+ });
58
+ if (affectedNodes.length === 0) {
59
+ return undefined;
60
+ }
61
+ const sponsorshipChanges = affectedNodes.map((affectedNode) => {
62
+ const normalizedNode = (0, utils_1.normalizeNode)(affectedNode);
63
+ return summarizeSponsorship(normalizedNode);
64
+ });
65
+ return sponsorshipChanges;
66
+ }
@@ -33,6 +33,9 @@ const MPTOKEN_TYPES = [
33
33
  "MPTokenAuthorize",
34
34
  "MPTokenIssuanceSet",
35
35
  "MPTokenIssuanceDestroy",
36
+ "ConfidentialMPTConvert",
37
+ "ConfidentialMPTConvertBack",
38
+ "ConfidentialMPTClawback",
36
39
  "Payment",
37
40
  "Clawback",
38
41
  "EscrowFinish",
@@ -75,6 +78,7 @@ function parseOutcome(tx, nativeCurrency, definitions) {
75
78
  mptokenChanges: getMPTokenChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
76
79
  credentialChanges: getCredentialChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
77
80
  delegateChanges: getDelegateChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
81
+ sponsorshipChanges: getSponsorshipChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
78
82
  remarksChanges: getRemarksChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
79
83
  cronChanges: getCronChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
80
84
  unlReportChanges: getUNLReportChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
@@ -244,6 +248,12 @@ function getDelegateChanges(tx, nativeCurrency) {
244
248
  }
245
249
  return (0, index_1.parseDelegateChanges)(tx.meta);
246
250
  }
251
+ function getSponsorshipChanges(tx, nativeCurrency) {
252
+ if (nativeCurrency !== common_1.MAINNET_NATIVE_CURRENCY) {
253
+ return undefined;
254
+ }
255
+ return (0, index_1.parseSponsorshipChanges)(tx.meta);
256
+ }
247
257
  function getRemarksChanges(tx, nativeCurrency) {
248
258
  if (nativeCurrency !== common_1.XAHAU_NATIVE_CURRENCY) {
249
259
  return undefined;
@@ -0,0 +1,3 @@
1
+ import { FormattedConfidentialMPTClawbackSpecification } from "../../types/mptokens";
2
+ declare function parseConfidentialMPTClawback(tx: any, nativeCurrency?: string): FormattedConfidentialMPTClawbackSpecification;
3
+ export default parseConfidentialMPTClawback;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const assert = __importStar(require("assert"));
37
+ const common_1 = require("../../common");
38
+ const tx_global_flags_1 = require("../ledger/tx-global-flags");
39
+ const memos_1 = require("../ledger/memos");
40
+ const signers_1 = require("../ledger/signers");
41
+ const regular_key_1 = require("../ledger/regular-key");
42
+ const delegate_1 = require("../ledger/delegate");
43
+ const source_1 = require("../ledger/source");
44
+ function parseConfidentialMPTClawback(tx, nativeCurrency) {
45
+ assert.ok(tx.TransactionType === "ConfidentialMPTClawback");
46
+ return (0, common_1.removeUndefined)({
47
+ signers: (0, signers_1.parseSigners)(tx),
48
+ signer: (0, regular_key_1.parseSignerRegularKey)(tx),
49
+ delegate: (0, delegate_1.parseDelegate)(tx),
50
+ source: (0, source_1.parseSource)(tx),
51
+ holder: tx.Holder,
52
+ amount: {
53
+ value: tx.MPTAmount,
54
+ mpt_issuance_id: tx.MPTokenIssuanceID,
55
+ },
56
+ zkProof: tx.ZKProof,
57
+ flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
58
+ memos: (0, memos_1.parseMemos)(tx),
59
+ });
60
+ }
61
+ exports.default = parseConfidentialMPTClawback;
@@ -0,0 +1,3 @@
1
+ import { FormattedConfidentialMPTConvertBackSpecification } from "../../types/mptokens";
2
+ declare function parseConfidentialMPTConvertBack(tx: any, nativeCurrency?: string): FormattedConfidentialMPTConvertBackSpecification;
3
+ export default parseConfidentialMPTConvertBack;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const assert = __importStar(require("assert"));
37
+ const common_1 = require("../../common");
38
+ const tx_global_flags_1 = require("../ledger/tx-global-flags");
39
+ const memos_1 = require("../ledger/memos");
40
+ const signers_1 = require("../ledger/signers");
41
+ const regular_key_1 = require("../ledger/regular-key");
42
+ const delegate_1 = require("../ledger/delegate");
43
+ const source_1 = require("../ledger/source");
44
+ function parseConfidentialMPTConvertBack(tx, nativeCurrency) {
45
+ assert.ok(tx.TransactionType === "ConfidentialMPTConvertBack");
46
+ return (0, common_1.removeUndefined)({
47
+ signers: (0, signers_1.parseSigners)(tx),
48
+ signer: (0, regular_key_1.parseSignerRegularKey)(tx),
49
+ delegate: (0, delegate_1.parseDelegate)(tx),
50
+ source: (0, source_1.parseSource)(tx),
51
+ balanceCommitment: tx.BalanceCommitment,
52
+ blindingFactor: tx.BlindingFactor,
53
+ holderEncryptedAmount: tx.HolderEncryptedAmount,
54
+ issuerEncryptedAmount: tx.IssuerEncryptedAmount,
55
+ amount: {
56
+ value: tx.MPTAmount,
57
+ mpt_issuance_id: tx.MPTokenIssuanceID,
58
+ },
59
+ zkProof: tx.ZKProof,
60
+ flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
61
+ memos: (0, memos_1.parseMemos)(tx),
62
+ });
63
+ }
64
+ exports.default = parseConfidentialMPTConvertBack;
@@ -0,0 +1,3 @@
1
+ import { FormattedConfidentialMPTConvertSpecification } from "../../types/mptokens";
2
+ declare function parseConfidentialMPTConvert(tx: any, nativeCurrency?: string): FormattedConfidentialMPTConvertSpecification;
3
+ export default parseConfidentialMPTConvert;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const assert = __importStar(require("assert"));
37
+ const common_1 = require("../../common");
38
+ const tx_global_flags_1 = require("../ledger/tx-global-flags");
39
+ const memos_1 = require("../ledger/memos");
40
+ const signers_1 = require("../ledger/signers");
41
+ const regular_key_1 = require("../ledger/regular-key");
42
+ const delegate_1 = require("../ledger/delegate");
43
+ const source_1 = require("../ledger/source");
44
+ function parseConfidentialMPTConvert(tx, nativeCurrency) {
45
+ assert.ok(tx.TransactionType === "ConfidentialMPTConvert");
46
+ return (0, common_1.removeUndefined)({
47
+ signers: (0, signers_1.parseSigners)(tx),
48
+ signer: (0, regular_key_1.parseSignerRegularKey)(tx),
49
+ delegate: (0, delegate_1.parseDelegate)(tx),
50
+ source: (0, source_1.parseSource)(tx),
51
+ holderEncryptedAmount: tx.HolderEncryptedAmount,
52
+ holderEncryptionKey: tx.HolderEncryptionKey,
53
+ issuerEncryptedAmount: tx.IssuerEncryptedAmount,
54
+ amount: {
55
+ value: tx.MPTAmount,
56
+ mpt_issuance_id: tx.MPTokenIssuanceID,
57
+ },
58
+ zkProof: tx.ZKProof,
59
+ flags: (0, common_1.emptyObjectToUndefined)((0, tx_global_flags_1.parseTxGlobalFlags)(tx.Flags, { nativeCurrency })),
60
+ memos: (0, memos_1.parseMemos)(tx),
61
+ });
62
+ }
63
+ exports.default = parseConfidentialMPTConvert;
@@ -0,0 +1,3 @@
1
+ import { FormattedSponsorshipSetSpecification } from "../../types/sponsorship";
2
+ declare function parseSponsorshipSet(tx: any, nativeCurrency?: string): FormattedSponsorshipSetSpecification;
3
+ export default parseSponsorshipSet;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const assert = __importStar(require("assert"));
40
+ const common_1 = require("../../common");
41
+ const amount_1 = __importDefault(require("../ledger/amount"));
42
+ const emit_details_1 = require("../ledger/emit_details");
43
+ const tx_sponsorship_set_flags_1 = __importDefault(require("../ledger/tx-sponsorship-set-flags"));
44
+ const memos_1 = require("../ledger/memos");
45
+ const signers_1 = require("../ledger/signers");
46
+ const regular_key_1 = require("../ledger/regular-key");
47
+ const delegate_1 = require("../ledger/delegate");
48
+ const source_1 = require("../ledger/source");
49
+ const destination_1 = require("../ledger/destination");
50
+ function parseSponsorshipSet(tx, nativeCurrency) {
51
+ assert.ok(tx.TransactionType === "SponsorshipSet");
52
+ return (0, common_1.removeUndefined)({
53
+ signers: (0, signers_1.parseSigners)(tx),
54
+ signer: (0, regular_key_1.parseSignerRegularKey)(tx),
55
+ delegate: (0, delegate_1.parseDelegate)(tx),
56
+ source: (0, source_1.parseSource)(tx),
57
+ counterpartySponsor: (0, destination_1.parseAddress)(tx, "CounterpartySponsor"),
58
+ feeAmountDelta: (0, amount_1.default)(tx.FeeAmountDelta),
59
+ maxFee: (0, amount_1.default)(tx.MaxFee),
60
+ remainingOwnerCountDelta: tx.RemainingOwnerCountDelta,
61
+ sponsee: (0, destination_1.parseAddress)(tx, "Sponsee"),
62
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
63
+ flags: (0, tx_sponsorship_set_flags_1.default)(tx.Flags, { nativeCurrency }),
64
+ memos: (0, memos_1.parseMemos)(tx),
65
+ });
66
+ }
67
+ exports.default = parseSponsorshipSet;
@@ -77,6 +77,9 @@ import parseMPTokenIssuanceCreate from "./specification/mptoken-issuance-create"
77
77
  import parseMPTokenAuthorize from "./specification/mptoken-authorize";
78
78
  import parseMPTokenIssuanceSet from "./specification/mptoken-issuance-set";
79
79
  import parseMPTokenIssuanceDestroy from "./specification/mptoken-issuance-destroy";
80
+ import parseConfidentialMPTConvert from "./specification/confidential-mpt-convert";
81
+ import parseConfidentialMPTConvertBack from "./specification/confidential-mpt-convert-back";
82
+ import parseConfidentialMPTClawback from "./specification/confidential-mpt-clawback";
80
83
  import parseDelegateSet from "./specification/delegate-set";
81
84
  import parseSetRemarks from "./specification/set-remarks";
82
85
  import parseCredentialCreate from "./specification/credential-create";
@@ -87,6 +90,7 @@ import parseGenesisMint from "./specification/genesis-mint";
87
90
  import parseBatch from "./specification/batch";
88
91
  import parseCron from "./specification/cron";
89
92
  import parseCronSet from "./specification/cron-set";
93
+ import parseSponsorshipSet from "./specification/sponsorship-set";
90
94
  import parseAmendment from "./specification/amendment";
91
95
  import parseFeeUpdate from "./specification/fee-update";
92
96
  import parseUNLModify from "./specification/unl-modify";
@@ -140,6 +144,9 @@ export declare const parserTypeFunc: {
140
144
  MPTokenAuthorize: typeof parseMPTokenAuthorize;
141
145
  MPTokenIssuanceSet: typeof parseMPTokenIssuanceSet;
142
146
  MPTokenIssuanceDestroy: typeof parseMPTokenIssuanceDestroy;
147
+ ConfidentialMPTConvert: typeof parseConfidentialMPTConvert;
148
+ ConfidentialMPTConvertBack: typeof parseConfidentialMPTConvertBack;
149
+ ConfidentialMPTClawback: typeof parseConfidentialMPTClawback;
143
150
  CredentialCreate: typeof parseCredentialCreate;
144
151
  CredentialAccept: typeof parseCredentialAccept;
145
152
  CredentialDelete: typeof parseCredentialDelete;
@@ -150,6 +157,7 @@ export declare const parserTypeFunc: {
150
157
  Batch: typeof parseBatch;
151
158
  Cron: typeof parseCron;
152
159
  CronSet: typeof parseCronSet;
160
+ SponsorshipSet: typeof parseSponsorshipSet;
153
161
  amendment: typeof parseAmendment;
154
162
  feeUpdate: typeof parseFeeUpdate;
155
163
  UNLModify: typeof parseUNLModify;
@@ -58,6 +58,9 @@ const mptoken_issuance_create_1 = __importDefault(require("./specification/mptok
58
58
  const mptoken_authorize_1 = __importDefault(require("./specification/mptoken-authorize"));
59
59
  const mptoken_issuance_set_1 = __importDefault(require("./specification/mptoken-issuance-set"));
60
60
  const mptoken_issuance_destroy_1 = __importDefault(require("./specification/mptoken-issuance-destroy"));
61
+ const confidential_mpt_convert_1 = __importDefault(require("./specification/confidential-mpt-convert"));
62
+ const confidential_mpt_convert_back_1 = __importDefault(require("./specification/confidential-mpt-convert-back"));
63
+ const confidential_mpt_clawback_1 = __importDefault(require("./specification/confidential-mpt-clawback"));
61
64
  const delegate_set_1 = __importDefault(require("./specification/delegate-set"));
62
65
  const set_remarks_1 = __importDefault(require("./specification/set-remarks"));
63
66
  const credential_create_1 = __importDefault(require("./specification/credential-create"));
@@ -68,6 +71,7 @@ const genesis_mint_1 = __importDefault(require("./specification/genesis-mint"));
68
71
  const batch_1 = __importDefault(require("./specification/batch"));
69
72
  const cron_1 = __importDefault(require("./specification/cron"));
70
73
  const cron_set_1 = __importDefault(require("./specification/cron-set"));
74
+ const sponsorship_set_1 = __importDefault(require("./specification/sponsorship-set"));
71
75
  const amendment_1 = __importDefault(require("./specification/amendment"));
72
76
  const fee_update_1 = __importDefault(require("./specification/fee-update"));
73
77
  const unl_modify_1 = __importDefault(require("./specification/unl-modify"));
@@ -122,6 +126,9 @@ const transactionTypeToType = {
122
126
  MPTokenAuthorize: "MPTokenAuthorize",
123
127
  MPTokenIssuanceSet: "MPTokenIssuanceSet",
124
128
  MPTokenIssuanceDestroy: "MPTokenIssuanceDestroy",
129
+ ConfidentialMPTConvert: "ConfidentialMPTConvert",
130
+ ConfidentialMPTConvertBack: "ConfidentialMPTConvertBack",
131
+ ConfidentialMPTClawback: "ConfidentialMPTClawback",
125
132
  CredentialCreate: "CredentialCreate",
126
133
  CredentialAccept: "CredentialAccept",
127
134
  CredentialDelete: "CredentialDelete",
@@ -132,6 +139,7 @@ const transactionTypeToType = {
132
139
  Batch: "Batch",
133
140
  Cron: "Cron",
134
141
  CronSet: "CronSet",
142
+ SponsorshipSet: "SponsorshipSet",
135
143
  EnableAmendment: "amendment",
136
144
  SetFee: "feeUpdate",
137
145
  UNLModify: "UNLModify",
@@ -188,6 +196,9 @@ exports.parserTypeFunc = {
188
196
  MPTokenAuthorize: mptoken_authorize_1.default,
189
197
  MPTokenIssuanceSet: mptoken_issuance_set_1.default,
190
198
  MPTokenIssuanceDestroy: mptoken_issuance_destroy_1.default,
199
+ ConfidentialMPTConvert: confidential_mpt_convert_1.default,
200
+ ConfidentialMPTConvertBack: confidential_mpt_convert_back_1.default,
201
+ ConfidentialMPTClawback: confidential_mpt_clawback_1.default,
191
202
  CredentialCreate: credential_create_1.default,
192
203
  CredentialAccept: credential_accept_1.default,
193
204
  CredentialDelete: credential_delete_1.default,
@@ -198,6 +209,7 @@ exports.parserTypeFunc = {
198
209
  Batch: batch_1.default,
199
210
  Cron: cron_1.default,
200
211
  CronSet: cron_set_1.default,
212
+ SponsorshipSet: sponsorship_set_1.default,
201
213
  amendment: amendment_1.default,
202
214
  feeUpdate: fee_update_1.default,
203
215
  UNLModify: unl_modify_1.default,
@@ -1,6 +1,7 @@
1
1
  import { MPTokenIssuanceCreateFlags, MPTokenIssuanceSetFlags, MPTokenAuthorizeFlags } from "xrpl";
2
2
  import { FormattedBaseSpecification } from "./specification";
3
3
  import { TxGlobalFlagsKeysInterface } from "./global";
4
+ import { Amount } from "./amounts";
4
5
  export declare const MPTokenIssuanceFlagsKeys: {
5
6
  locked: number;
6
7
  canLock: MPTokenIssuanceCreateFlags;
@@ -74,6 +75,27 @@ export type FormattedMPTokenIssuanceSetSpecification = {
74
75
  holder?: string;
75
76
  mptIssuanceID?: string;
76
77
  } & FormattedBaseSpecification;
78
+ export type FormattedConfidentialMPTConvertSpecification = {
79
+ holderEncryptedAmount?: string;
80
+ holderEncryptionKey?: string;
81
+ issuerEncryptedAmount?: string;
82
+ amount?: Amount;
83
+ mptIssuanceID?: string;
84
+ zkProof?: string;
85
+ } & FormattedBaseSpecification;
86
+ export type FormattedConfidentialMPTConvertBackSpecification = {
87
+ balanceCommitment?: string;
88
+ blindingFactor?: string;
89
+ holderEncryptedAmount?: string;
90
+ issuerEncryptedAmount?: string;
91
+ amount?: Amount;
92
+ mptIssuanceID?: string;
93
+ zkProof?: string;
94
+ } & FormattedBaseSpecification;
95
+ export type FormattedConfidentialMPTClawbackSpecification = {
96
+ holder?: string;
97
+ zkProof?: string;
98
+ } & FormattedBaseSpecification;
77
99
  export declare const MPTokenFlagsKeys: {
78
100
  locked: number;
79
101
  authorized: number;
@@ -0,0 +1,34 @@
1
+ import { FormattedBaseSpecification } from "./specification";
2
+ import { FormattedAmount } from "./amounts";
3
+ import { FormattedDestinationAddress } from "./account";
4
+ import { TxGlobalFlagsKeysInterface } from "./global";
5
+ export declare enum SponsorshipSetFlags {
6
+ tfSponsorshipSetRequireSignForFee = 65536,
7
+ tfSponsorshipClearRequireSignForFee = 131072,
8
+ tfSponsorshipSetRequireSignForReserve = 262144,
9
+ tfSponsorshipClearRequireSignForReserve = 524288,
10
+ tfDeleteObject = 1048576
11
+ }
12
+ export declare const SponsorshipSetFlagsKeys: {
13
+ setRequireSignForFee: SponsorshipSetFlags;
14
+ clearRequireSignForFee: SponsorshipSetFlags;
15
+ setRequireSignForReserve: SponsorshipSetFlags;
16
+ clearRequireSignForReserve: SponsorshipSetFlags;
17
+ deleteObject: SponsorshipSetFlags;
18
+ };
19
+ export declare function getSponsorshipSetFlagsKeys(nativeCurrency?: string): Record<string, number>;
20
+ export interface SponsorshipSetFlagsKeysInterface extends TxGlobalFlagsKeysInterface {
21
+ setRequireSignForFee: boolean;
22
+ clearRequireSignForFee: boolean;
23
+ setRequireSignForReserve: boolean;
24
+ clearRequireSignForReserve: boolean;
25
+ deleteObject: boolean;
26
+ }
27
+ export type FormattedSponsorshipSetSpecification = {
28
+ CounterpartySponsor?: FormattedDestinationAddress;
29
+ feeAmountDelta?: FormattedAmount;
30
+ maxFee?: FormattedAmount;
31
+ remainingOwnerCountDelta?: number;
32
+ Sponsee?: FormattedDestinationAddress;
33
+ flags: SponsorshipSetFlagsKeysInterface;
34
+ } & FormattedBaseSpecification;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SponsorshipSetFlagsKeys = exports.SponsorshipSetFlags = void 0;
4
+ exports.getSponsorshipSetFlagsKeys = getSponsorshipSetFlagsKeys;
5
+ const global_1 = require("./global");
6
+ const common_1 = require("../common");
7
+ var SponsorshipSetFlags;
8
+ (function (SponsorshipSetFlags) {
9
+ SponsorshipSetFlags[SponsorshipSetFlags["tfSponsorshipSetRequireSignForFee"] = 65536] = "tfSponsorshipSetRequireSignForFee";
10
+ SponsorshipSetFlags[SponsorshipSetFlags["tfSponsorshipClearRequireSignForFee"] = 131072] = "tfSponsorshipClearRequireSignForFee";
11
+ SponsorshipSetFlags[SponsorshipSetFlags["tfSponsorshipSetRequireSignForReserve"] = 262144] = "tfSponsorshipSetRequireSignForReserve";
12
+ SponsorshipSetFlags[SponsorshipSetFlags["tfSponsorshipClearRequireSignForReserve"] = 524288] = "tfSponsorshipClearRequireSignForReserve";
13
+ SponsorshipSetFlags[SponsorshipSetFlags["tfDeleteObject"] = 1048576] = "tfDeleteObject";
14
+ })(SponsorshipSetFlags || (exports.SponsorshipSetFlags = SponsorshipSetFlags = {}));
15
+ exports.SponsorshipSetFlagsKeys = {
16
+ setRequireSignForFee: SponsorshipSetFlags.tfSponsorshipSetRequireSignForFee,
17
+ clearRequireSignForFee: SponsorshipSetFlags.tfSponsorshipClearRequireSignForFee,
18
+ setRequireSignForReserve: SponsorshipSetFlags.tfSponsorshipSetRequireSignForReserve,
19
+ clearRequireSignForReserve: SponsorshipSetFlags.tfSponsorshipClearRequireSignForReserve,
20
+ deleteObject: SponsorshipSetFlags.tfDeleteObject,
21
+ };
22
+ const nativeCurrencySponsorshipSetFlags = {};
23
+ function getSponsorshipSetFlagsKeys(nativeCurrency) {
24
+ if (!nativeCurrency) {
25
+ nativeCurrency = common_1.MAINNET_NATIVE_CURRENCY;
26
+ }
27
+ if (!nativeCurrencySponsorshipSetFlags[nativeCurrency]) {
28
+ nativeCurrencySponsorshipSetFlags[nativeCurrency] = {
29
+ ...(0, global_1.getTxGlobalFlagsKeys)(nativeCurrency),
30
+ ...exports.SponsorshipSetFlagsKeys,
31
+ };
32
+ }
33
+ return nativeCurrencySponsorshipSetFlags[nativeCurrency];
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.8.3",
3
+ "version": "3.8.11",
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",
@@ -52,14 +52,14 @@
52
52
  ],
53
53
  "dependencies": {
54
54
  "@noble/ed25519": "^3.1.0",
55
- "@noble/hashes": "^2.2.0",
55
+ "@noble/hashes": "^2.3.0",
56
56
  "@noble/secp256k1": "^3.1.0",
57
- "axios": "^1.18.1",
57
+ "axios": "^1.19.0",
58
58
  "base-x": "^5.0.1",
59
59
  "bignumber.js": "^11.1.5",
60
60
  "lodash": "^4.18.1",
61
61
  "ripple-address-codec": "5.0.1",
62
- "ripple-binary-codec": "2.8.0",
62
+ "ripple-binary-codec": "2.9.0",
63
63
  "ripple-keypairs": "3.0.0",
64
64
  "xrpl": "5.0.0"
65
65
  },
@@ -67,23 +67,23 @@
67
67
  "@eslint/eslintrc": "^3.3.6",
68
68
  "@types/chai": "^5.2.3",
69
69
  "@types/chai-as-promised": "^8.0.2",
70
- "@types/lodash": "^4.17.24",
70
+ "@types/lodash": "^4.17.25",
71
71
  "@types/mocha": "^10.0.10",
72
72
  "@types/nconf": "^0.10.7",
73
- "@types/node": "^25.9.5",
74
- "@typescript-eslint/eslint-plugin": "^8.64.0",
75
- "@typescript-eslint/parser": "^8.64.0",
73
+ "@types/node": "^26.2.0",
74
+ "@typescript-eslint/eslint-plugin": "^8.67.0",
75
+ "@typescript-eslint/parser": "^8.67.0",
76
76
  "chai": "^6.2.2",
77
77
  "chai-as-promised": "^8.0.2",
78
78
  "eslint": "^9.39.5",
79
79
  "eslint-config-prettier": "^10.1.8",
80
80
  "eslint-plugin-chai-friendly": "^1.2.1",
81
81
  "eslint-plugin-import": "^2.32.0",
82
- "eslint-plugin-n": "^18.2.2",
82
+ "eslint-plugin-n": "^18.3.0",
83
83
  "eslint-plugin-promise": "^7.3.0",
84
- "mocha": "^11.7.6",
84
+ "mocha": "^11.8.0",
85
85
  "nconf": "^0.13.0",
86
- "ts-jest": "^29.4.11",
86
+ "ts-jest": "^29.4.12",
87
87
  "ts-node": "^10.9.2",
88
88
  "typescript": "^6.0.3"
89
89
  }