@bithomp/xrpl-api 3.5.0 → 3.6.0
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/client.js +3 -2
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +3 -1
- package/lib/ledger/transaction.js +4 -4
- package/lib/models/account_info.js +1 -1
- package/lib/models/index.d.ts +2 -1
- package/lib/models/index.js +3 -1
- package/lib/parse/ledger/amount.js +3 -0
- package/lib/parse/ledger/batch-flags.d.ts +5 -0
- package/lib/parse/ledger/batch-flags.js +8 -0
- package/lib/parse/ledger/global-flags.d.ts +4 -0
- package/lib/parse/ledger/global-flags.js +8 -0
- package/lib/parse/ledger/ledger.js +35 -1
- package/lib/parse/ledger/tx-account-set-flags.d.ts +4 -0
- package/lib/parse/ledger/tx-account-set-flags.js +42 -0
- package/lib/parse/ledger/tx-amm-clawback-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-amm-clawback-flags.js +8 -0
- package/lib/parse/ledger/tx-amm-deposit-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-amm-deposit-flags.js +8 -0
- package/lib/parse/ledger/tx-amm-withdraw-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-amm-withdraw-flags.js +8 -0
- package/lib/parse/ledger/tx-batch-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-batch-flags.js +8 -0
- package/lib/parse/ledger/tx-global-flags.d.ts +5 -0
- package/lib/parse/ledger/tx-global-flags.js +8 -0
- package/lib/parse/ledger/tx-mptoken-authorize-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-mptoken-authorize-flags.js +8 -0
- package/lib/parse/ledger/tx-mptoken-issuance-create-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-mptoken-issuance-create-flags.js +8 -0
- package/lib/parse/ledger/tx-mptoken-issuance-set-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-mptoken-issuance-set-flags.js +8 -0
- package/lib/parse/ledger/tx-nftoken-mint-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-nftoken-mint-flags.js +8 -0
- package/lib/parse/ledger/tx-nftoken-offer-create-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-nftoken-offer-create-flags.js +8 -0
- package/lib/parse/ledger/tx-offer-create-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-offer-create-flags.js +8 -0
- package/lib/parse/ledger/tx-payment-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-payment-flags.js +8 -0
- package/lib/parse/ledger/tx-trust-set-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-trust-set-flags.js +8 -0
- package/lib/parse/ledger/tx-uritoken-mint-flags.d.ts +6 -0
- package/lib/parse/ledger/tx-uritoken-mint-flags.js +8 -0
- package/lib/parse/outcome/emitted_txns.d.ts +1 -1
- package/lib/parse/outcome/emitted_txns.js +6 -5
- package/lib/parse/outcome.js +9 -9
- package/lib/parse/specification/account-delete.d.ts +1 -1
- package/lib/parse/specification/account-delete.js +3 -1
- package/lib/parse/specification/amendment.d.ts +1 -1
- package/lib/parse/specification/amendment.js +3 -1
- package/lib/parse/specification/amm-bid.d.ts +1 -1
- package/lib/parse/specification/amm-bid.js +3 -1
- package/lib/parse/specification/amm-clawback.d.ts +1 -1
- package/lib/parse/specification/amm-clawback.js +3 -3
- package/lib/parse/specification/amm-create.d.ts +1 -1
- package/lib/parse/specification/amm-create.js +3 -1
- package/lib/parse/specification/amm-delete.d.ts +1 -1
- package/lib/parse/specification/amm-delete.js +3 -1
- package/lib/parse/specification/amm-deposit.d.ts +1 -1
- package/lib/parse/specification/amm-deposit.js +3 -3
- package/lib/parse/specification/amm-vote.d.ts +1 -1
- package/lib/parse/specification/amm-vote.js +3 -1
- package/lib/parse/specification/amm-withdraw.d.ts +1 -1
- package/lib/parse/specification/amm-withdraw.js +3 -3
- package/lib/parse/specification/batch.d.ts +4 -0
- package/lib/parse/specification/batch.js +83 -0
- package/lib/parse/specification/check-cancel.d.ts +1 -1
- package/lib/parse/specification/check-cancel.js +3 -1
- package/lib/parse/specification/check-cash.d.ts +1 -1
- package/lib/parse/specification/check-cash.js +3 -1
- package/lib/parse/specification/check-create.d.ts +1 -1
- package/lib/parse/specification/check-create.js +3 -1
- package/lib/parse/specification/clawback.d.ts +1 -1
- package/lib/parse/specification/clawback.js +3 -1
- package/lib/parse/specification/credential-accept.d.ts +2 -1
- package/lib/parse/specification/credential-accept.js +3 -1
- package/lib/parse/specification/credential-create.d.ts +2 -1
- package/lib/parse/specification/credential-create.js +3 -1
- package/lib/parse/specification/credential-delete.d.ts +2 -1
- package/lib/parse/specification/credential-delete.js +4 -2
- package/lib/parse/specification/delegate-set.d.ts +1 -1
- package/lib/parse/specification/delegate-set.js +3 -1
- package/lib/parse/specification/deposit-preauth.d.ts +1 -1
- package/lib/parse/specification/deposit-preauth.js +12 -1
- package/lib/parse/specification/did-delete.d.ts +1 -1
- package/lib/parse/specification/did-delete.js +3 -1
- package/lib/parse/specification/did-set.d.ts +1 -1
- package/lib/parse/specification/did-set.js +3 -1
- package/lib/parse/specification/escrow-cancel.d.ts +1 -1
- package/lib/parse/specification/escrow-cancel.js +3 -1
- package/lib/parse/specification/escrow-create.d.ts +1 -1
- package/lib/parse/specification/escrow-create.js +3 -1
- package/lib/parse/specification/escrow-finish.d.ts +1 -1
- package/lib/parse/specification/escrow-finish.js +3 -1
- package/lib/parse/specification/fee-update.d.ts +1 -1
- package/lib/parse/specification/fee-update.js +3 -1
- package/lib/parse/specification/genesis-mint.d.ts +1 -1
- package/lib/parse/specification/genesis-mint.js +3 -1
- package/lib/parse/specification/mptoken-authorize.d.ts +1 -1
- package/lib/parse/specification/mptoken-authorize.js +3 -3
- package/lib/parse/specification/mptoken-issuance-create.d.ts +1 -1
- package/lib/parse/specification/mptoken-issuance-create.js +3 -3
- package/lib/parse/specification/mptoken-issuance-destroy.d.ts +1 -1
- package/lib/parse/specification/mptoken-issuance-destroy.js +3 -1
- package/lib/parse/specification/mptoken-issuance-set.d.ts +1 -1
- package/lib/parse/specification/mptoken-issuance-set.js +3 -3
- package/lib/parse/specification/nftoken-accept-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-accept-offer.js +3 -3
- package/lib/parse/specification/nftoken-burn.d.ts +1 -1
- package/lib/parse/specification/nftoken-burn.js +3 -3
- package/lib/parse/specification/nftoken-cancel-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-cancel-offer.js +3 -3
- package/lib/parse/specification/nftoken-create-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-create-offer.js +3 -5
- package/lib/parse/specification/nftoken-mint.d.ts +1 -1
- package/lib/parse/specification/nftoken-mint.js +3 -3
- package/lib/parse/specification/nftoken-modify.d.ts +1 -1
- package/lib/parse/specification/nftoken-modify.js +3 -3
- package/lib/parse/specification/offer-cancel.d.ts +1 -1
- package/lib/parse/specification/offer-cancel.js +3 -1
- package/lib/parse/specification/offer-create.d.ts +1 -1
- package/lib/parse/specification/offer-create.js +6 -6
- package/lib/parse/specification/oracle-delete.d.ts +1 -1
- package/lib/parse/specification/oracle-delete.js +3 -1
- package/lib/parse/specification/oracle-set.d.ts +1 -1
- package/lib/parse/specification/oracle-set.js +3 -1
- package/lib/parse/specification/payment-channel-claim.d.ts +1 -1
- package/lib/parse/specification/payment-channel-claim.js +3 -1
- package/lib/parse/specification/payment-channel-create.d.ts +1 -1
- package/lib/parse/specification/payment-channel-create.js +3 -1
- package/lib/parse/specification/payment-channel-fund.d.ts +1 -1
- package/lib/parse/specification/payment-channel-fund.js +3 -1
- package/lib/parse/specification/payment.d.ts +1 -1
- package/lib/parse/specification/payment.js +8 -3
- package/lib/parse/specification/remit.d.ts +1 -1
- package/lib/parse/specification/remit.js +3 -1
- package/lib/parse/specification/set-remarks.d.ts +1 -1
- package/lib/parse/specification/set-remarks.js +3 -1
- package/lib/parse/specification/settings.d.ts +2 -1
- package/lib/parse/specification/settings.js +3 -1
- package/lib/parse/specification/ticket-create.d.ts +1 -1
- package/lib/parse/specification/ticket-create.js +3 -1
- package/lib/parse/specification/trust-set.d.ts +1 -1
- package/lib/parse/specification/trust-set.js +6 -1
- package/lib/parse/specification/unrecognized.d.ts +1 -1
- package/lib/parse/specification/unrecognized.js +3 -1
- package/lib/parse/specification/uritoken-burn.d.ts +1 -1
- package/lib/parse/specification/uritoken-burn.js +3 -1
- package/lib/parse/specification/uritoken-buy.d.ts +1 -1
- package/lib/parse/specification/uritoken-buy.js +3 -1
- package/lib/parse/specification/uritoken-cancel-sell-offer.d.ts +1 -1
- package/lib/parse/specification/uritoken-cancel-sell-offer.js +3 -1
- package/lib/parse/specification/uritoken-create-sell-offer.d.ts +1 -1
- package/lib/parse/specification/uritoken-create-sell-offer.js +3 -1
- package/lib/parse/specification/uritoken-mint.d.ts +1 -1
- package/lib/parse/specification/uritoken-mint.js +3 -3
- package/lib/parse/transaction.d.ts +118 -1
- package/lib/parse/transaction.js +8 -4
- package/lib/types/amm.d.ts +8 -7
- package/lib/types/amm.js +46 -6
- package/lib/types/batch.d.ts +21 -0
- package/lib/types/batch.js +26 -0
- package/lib/types/credentials.d.ts +1 -1
- package/lib/types/deposits.d.ts +6 -0
- package/lib/types/global.d.ts +19 -0
- package/lib/types/global.js +28 -0
- package/lib/types/mptokens.d.ts +7 -3
- package/lib/types/mptokens.js +44 -0
- package/lib/types/nftokens.d.ts +5 -2
- package/lib/types/nftokens.js +30 -0
- package/lib/types/offers.d.ts +3 -1
- package/lib/types/offers.js +16 -0
- package/lib/types/payments.d.ts +13 -0
- package/lib/types/payments.js +23 -0
- package/lib/types/specification.d.ts +2 -0
- package/lib/types/trustlines.d.ts +21 -1
- package/lib/types/trustlines.js +26 -1
- package/lib/types/uritokens.d.ts +3 -1
- package/lib/types/uritokens.js +16 -0
- package/package.json +7 -7
package/lib/client.js
CHANGED
|
@@ -21,11 +21,12 @@ exports.disconnect = disconnect;
|
|
|
21
21
|
exports.getNativeCurrency = getNativeCurrency;
|
|
22
22
|
exports.findConnection = findConnection;
|
|
23
23
|
const connection_1 = require("./connection");
|
|
24
|
+
const common_1 = require("./common");
|
|
24
25
|
__exportStar(require("./ledger"), exports);
|
|
25
26
|
exports.feeCushion = 1.3;
|
|
26
27
|
let clientConnections = [];
|
|
27
28
|
let loadBalancing = false;
|
|
28
|
-
let nativeCurrency =
|
|
29
|
+
let nativeCurrency = common_1.MAINNET_NATIVE_CURRENCY;
|
|
29
30
|
function setup(servers, options = {}) {
|
|
30
31
|
exports.logger = options.logger;
|
|
31
32
|
exports.logger?.debug({
|
|
@@ -72,7 +73,7 @@ async function disconnect() {
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
function getNativeCurrency() {
|
|
75
|
-
return nativeCurrency ||
|
|
76
|
+
return nativeCurrency || common_1.MAINNET_NATIVE_CURRENCY;
|
|
76
77
|
}
|
|
77
78
|
function findConnection(type, url, strongFilter, hash, networkID) {
|
|
78
79
|
if (!strongFilter) {
|
package/lib/common/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as errors from "./errors";
|
|
|
2
2
|
import sha512Half from "./sha512Half";
|
|
3
3
|
export * from "./utils";
|
|
4
4
|
export { errors, sha512Half };
|
|
5
|
+
export declare const MAINNET_NATIVE_CURRENCY = "XRP";
|
|
6
|
+
export declare const XAHAU_NATIVE_CURRENCY = "XAH";
|
|
5
7
|
export declare const dropsInXRP = 1000000;
|
|
6
8
|
export declare const ACCOUNT_ZERO = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";
|
|
7
9
|
export declare const BLACKHOLE_ACCOUNTS: string[];
|
package/lib/common/index.js
CHANGED
|
@@ -39,12 +39,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.BLACKHOLE_ACCOUNTS = exports.ACCOUNT_ZERO = exports.dropsInXRP = exports.sha512Half = exports.errors = void 0;
|
|
42
|
+
exports.BLACKHOLE_ACCOUNTS = exports.ACCOUNT_ZERO = exports.dropsInXRP = exports.XAHAU_NATIVE_CURRENCY = exports.MAINNET_NATIVE_CURRENCY = exports.sha512Half = exports.errors = void 0;
|
|
43
43
|
const errors = __importStar(require("./errors"));
|
|
44
44
|
exports.errors = errors;
|
|
45
45
|
const sha512Half_1 = __importDefault(require("./sha512Half"));
|
|
46
46
|
exports.sha512Half = sha512Half_1.default;
|
|
47
47
|
__exportStar(require("./utils"), exports);
|
|
48
|
+
exports.MAINNET_NATIVE_CURRENCY = "XRP";
|
|
49
|
+
exports.XAHAU_NATIVE_CURRENCY = "XAH";
|
|
48
50
|
exports.dropsInXRP = 1000000;
|
|
49
51
|
exports.ACCOUNT_ZERO = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";
|
|
50
52
|
exports.BLACKHOLE_ACCOUNTS = [
|
|
@@ -88,13 +88,13 @@ async function getTransaction(transaction, options = {}) {
|
|
|
88
88
|
const result = response?.result;
|
|
89
89
|
if (typeof result === "object") {
|
|
90
90
|
if (formatted === true) {
|
|
91
|
-
return (0, transaction_1.getTxDetails)(result, options.includeRawTransaction === true,
|
|
91
|
+
return (0, transaction_1.getTxDetails)(result, options.includeRawTransaction === true, Client.getNativeCurrency(), options.definitions);
|
|
92
92
|
}
|
|
93
93
|
if (options.balanceChanges === true && typeof result.meta === "object") {
|
|
94
94
|
result.balanceChanges = xrpl.getBalanceChanges(result.meta);
|
|
95
95
|
}
|
|
96
96
|
if (options.specification === true) {
|
|
97
|
-
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction,
|
|
97
|
+
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction, Client.getNativeCurrency(), options.definitions);
|
|
98
98
|
result.specification = details.specification;
|
|
99
99
|
result.outcome = details.outcome;
|
|
100
100
|
if (details.rawTransaction) {
|
|
@@ -171,13 +171,13 @@ async function getTransactionByCTID(ctid, options = {}) {
|
|
|
171
171
|
ledgerTx.ctid = ctid;
|
|
172
172
|
const result = (0, transaction_1.ledgerTxToTx)(ledgerTx, ledgerIndex, ledger.close_time);
|
|
173
173
|
if (formatted === true) {
|
|
174
|
-
return (0, transaction_1.getTxDetails)(result, options.includeRawTransaction === true,
|
|
174
|
+
return (0, transaction_1.getTxDetails)(result, options.includeRawTransaction === true, Client.getNativeCurrency(), options.definitions);
|
|
175
175
|
}
|
|
176
176
|
if (options.balanceChanges === true && typeof result.meta === "object") {
|
|
177
177
|
result.balanceChanges = xrpl.getBalanceChanges(result.meta);
|
|
178
178
|
}
|
|
179
179
|
if (options.specification === true) {
|
|
180
|
-
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction,
|
|
180
|
+
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction, Client.getNativeCurrency(), options.definitions);
|
|
181
181
|
result.specification = details.specification;
|
|
182
182
|
result.outcome = details.outcome;
|
|
183
183
|
if (details.rawTransaction) {
|
|
@@ -47,7 +47,7 @@ exports.XahauAccountRootFlagsKeys = {
|
|
|
47
47
|
};
|
|
48
48
|
function getAccountRootFlagsKeys() {
|
|
49
49
|
const nativeCurrency = (0, client_1.getNativeCurrency)();
|
|
50
|
-
if (nativeCurrency ===
|
|
50
|
+
if (nativeCurrency === common_1.XAHAU_NATIVE_CURRENCY) {
|
|
51
51
|
return exports.XahauAccountRootFlagsKeys;
|
|
52
52
|
}
|
|
53
53
|
else {
|
package/lib/models/index.d.ts
CHANGED
|
@@ -32,4 +32,5 @@ import parseNFTokenCreateOffer from "../parse/specification/nftoken-create-offer
|
|
|
32
32
|
import parseURITokenFlags from "../parse/ledger/uritoken-flags";
|
|
33
33
|
import parseTrustlineFlags from "../parse/ledger/trustline-flags";
|
|
34
34
|
import parseOfferFlags from "../parse/ledger/offer-flags";
|
|
35
|
-
|
|
35
|
+
import parseCredentialFlags from "../parse/ledger/credential-flags";
|
|
36
|
+
export { parseNFTokenMint, parseNFTokenBurn, parseNFTokenFlags, parseNFTOfferFlags, parseNFTokenAcceptOffer, parseNFTokenCancelOffer, parseNFTokenCreateOffer, parseURITokenFlags, parseTrustlineFlags, parseOfferFlags, parseCredentialFlags, };
|
package/lib/models/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.parseOfferFlags = exports.parseTrustlineFlags = exports.parseURITokenFlags = exports.parseNFTokenCreateOffer = exports.parseNFTokenCancelOffer = exports.parseNFTokenAcceptOffer = exports.parseNFTOfferFlags = exports.parseNFTokenFlags = exports.parseNFTokenBurn = exports.parseNFTokenMint = exports.parseMPTokenChanges = exports.parseMPTokenIssuanceChanges = exports.parseOrderbookChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseFinalBalances = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
|
|
20
|
+
exports.parseCredentialFlags = exports.parseOfferFlags = exports.parseTrustlineFlags = exports.parseURITokenFlags = exports.parseNFTokenCreateOffer = exports.parseNFTokenCancelOffer = exports.parseNFTokenAcceptOffer = exports.parseNFTOfferFlags = exports.parseNFTokenFlags = exports.parseNFTokenBurn = exports.parseNFTokenMint = exports.parseMPTokenChanges = exports.parseMPTokenIssuanceChanges = exports.parseOrderbookChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseFinalBalances = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
|
|
21
21
|
__exportStar(require("./account_info"), exports);
|
|
22
22
|
__exportStar(require("./account_nfts"), exports);
|
|
23
23
|
__exportStar(require("./account_object"), exports);
|
|
@@ -74,3 +74,5 @@ const trustline_flags_1 = __importDefault(require("../parse/ledger/trustline-fla
|
|
|
74
74
|
exports.parseTrustlineFlags = trustline_flags_1.default;
|
|
75
75
|
const offer_flags_1 = __importDefault(require("../parse/ledger/offer-flags"));
|
|
76
76
|
exports.parseOfferFlags = offer_flags_1.default;
|
|
77
|
+
const credential_flags_1 = __importDefault(require("../parse/ledger/credential-flags"));
|
|
78
|
+
exports.parseCredentialFlags = credential_flags_1.default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const batch_1 = require("../../types/batch");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseBatchFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, batch_1.BatchFlagsKeys, options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseBatchFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseGlobalFlags = parseGlobalFlags;
|
|
4
|
+
const global_1 = require("../../types/global");
|
|
5
|
+
const flags_1 = require("./flags");
|
|
6
|
+
function parseGlobalFlags(value, options = {}) {
|
|
7
|
+
return (0, flags_1.parseFlags)(value, (0, global_1.getTxGlobalFlagsKeys)(), options);
|
|
8
|
+
}
|
|
@@ -1,10 +1,44 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.parseLedger = parseLedger;
|
|
7
40
|
const lodash_1 = __importDefault(require("lodash"));
|
|
41
|
+
const Client = __importStar(require("../../client"));
|
|
8
42
|
const common_1 = require("../../common");
|
|
9
43
|
const models_1 = require("../../models");
|
|
10
44
|
const transaction_1 = require("../transaction");
|
|
@@ -13,7 +47,7 @@ function parseTransactionWrapper(ledgerIndex, includeRawTransaction, tx) {
|
|
|
13
47
|
meta: tx.metaData,
|
|
14
48
|
ledger_index: ledgerIndex,
|
|
15
49
|
});
|
|
16
|
-
const result = (0, transaction_1.parseTransaction)(transaction, includeRawTransaction);
|
|
50
|
+
const result = (0, transaction_1.parseTransaction)(transaction, includeRawTransaction, Client.getNativeCurrency());
|
|
17
51
|
if (!result.outcome) {
|
|
18
52
|
result.outcome = {};
|
|
19
53
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const xrpl_1 = require("xrpl");
|
|
4
|
+
const global_1 = require("../../types/global");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
function parseTxAccountSetFlags(value, options = {}) {
|
|
7
|
+
const flags = {};
|
|
8
|
+
if (value & global_1.GlobalFlags.tfFullyCanonicalSig) {
|
|
9
|
+
flags.fullyCanonicalSig = true;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
flags.fullyCanonicalSig = false;
|
|
13
|
+
}
|
|
14
|
+
if (options.nativeCurrency === common_1.MAINNET_NATIVE_CURRENCY) {
|
|
15
|
+
if (value & global_1.GlobalFlags.tfInnerBatchTxn) {
|
|
16
|
+
flags.innerBatchTxn = true;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
flags.innerBatchTxn = false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (value & xrpl_1.AccountSetTfFlags.tfRequireDestTag) {
|
|
23
|
+
flags.requireDestTag = true;
|
|
24
|
+
}
|
|
25
|
+
else if (value & xrpl_1.AccountSetTfFlags.tfOptionalDestTag) {
|
|
26
|
+
flags.requireDestTag = false;
|
|
27
|
+
}
|
|
28
|
+
if (value & xrpl_1.AccountSetTfFlags.tfRequireAuth) {
|
|
29
|
+
flags.requireAuth = true;
|
|
30
|
+
}
|
|
31
|
+
else if (value & xrpl_1.AccountSetTfFlags.tfOptionalAuth) {
|
|
32
|
+
flags.requireAuth = false;
|
|
33
|
+
}
|
|
34
|
+
if (value & xrpl_1.AccountSetTfFlags.tfDisallowXRP) {
|
|
35
|
+
flags.disallowXRP = true;
|
|
36
|
+
}
|
|
37
|
+
else if (value & xrpl_1.AccountSetTfFlags.tfAllowXRP) {
|
|
38
|
+
flags.disallowXRP = false;
|
|
39
|
+
}
|
|
40
|
+
return flags;
|
|
41
|
+
}
|
|
42
|
+
exports.default = parseTxAccountSetFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const amm_1 = require("../../types/amm");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxAmmClawbackFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, amm_1.getAMMClawbackFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxAmmClawbackFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const amm_1 = require("../../types/amm");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxAmmDepositFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, amm_1.getAMMDepositFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxAmmDepositFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const amm_1 = require("../../types/amm");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxAmmWithdrawFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, amm_1.getAMMWithdrawFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxAmmWithdrawFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const batch_1 = require("../../types/batch");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxBatchFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, batch_1.getBatchFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxBatchFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseTxGlobalFlags = parseTxGlobalFlags;
|
|
4
|
+
const global_1 = require("../../types/global");
|
|
5
|
+
const flags_1 = require("./flags");
|
|
6
|
+
function parseTxGlobalFlags(value, options = {}) {
|
|
7
|
+
return (0, flags_1.parseFlags)(value, (0, global_1.getTxGlobalFlagsKeys)(options.nativeCurrency), options);
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MPTokenAuthorizeFlagsKeysInterface } from "../../types/mptokens";
|
|
2
|
+
declare function parseTxMPTokenAuthorizeFlags(value: number, options?: {
|
|
3
|
+
excludeFalse?: boolean;
|
|
4
|
+
nativeCurrency?: string;
|
|
5
|
+
}): MPTokenAuthorizeFlagsKeysInterface;
|
|
6
|
+
export default parseTxMPTokenAuthorizeFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mptokens_1 = require("../../types/mptokens");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxMPTokenAuthorizeFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, mptokens_1.getMPTokenAuthorizeFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxMPTokenAuthorizeFlags;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MPTokenIssuanceCreateFlagsKeysInterface } from "../../types/mptokens";
|
|
2
|
+
declare function parseTxMPTokenIssuanceCreateFlags(value: number, options?: {
|
|
3
|
+
excludeFalse?: boolean;
|
|
4
|
+
nativeCurrency?: string;
|
|
5
|
+
}): MPTokenIssuanceCreateFlagsKeysInterface;
|
|
6
|
+
export default parseTxMPTokenIssuanceCreateFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mptokens_1 = require("../../types/mptokens");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxMPTokenIssuanceCreateFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, mptokens_1.getMPTokenIssuanceCreateFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxMPTokenIssuanceCreateFlags;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MPTokenIssuanceSetFlagsKeysInterface } from "../../types/mptokens";
|
|
2
|
+
declare function parseTxMPTokenIssuanceSetFlags(value: number, options?: {
|
|
3
|
+
excludeFalse?: boolean;
|
|
4
|
+
nativeCurrency?: string;
|
|
5
|
+
}): MPTokenIssuanceSetFlagsKeysInterface;
|
|
6
|
+
export default parseTxMPTokenIssuanceSetFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mptokens_1 = require("../../types/mptokens");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxMPTokenIssuanceSetFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, mptokens_1.getMPTokenIssuanceSetFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxMPTokenIssuanceSetFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const nftokens_1 = require("../../types/nftokens");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxNFTokenMintFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, nftokens_1.getNFTokenMintFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxNFTokenMintFlags;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NFTokenOfferFlagsKeysInterface } from "../../types/nftokens";
|
|
2
|
+
declare function parseTxNFTOfferCreateFlags(value: number, options?: {
|
|
3
|
+
excludeFalse?: boolean;
|
|
4
|
+
nativeCurrency?: string;
|
|
5
|
+
}): NFTokenOfferFlagsKeysInterface;
|
|
6
|
+
export default parseTxNFTOfferCreateFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const nftokens_1 = require("../../types/nftokens");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxNFTOfferCreateFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, nftokens_1.getNFTokenOfferCreateFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxNFTOfferCreateFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const offers_1 = require("../../types/offers");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxOfferCreateFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, offers_1.getOfferCreateFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxOfferCreateFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const payments_1 = require("../../types/payments");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxPaymentFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, payments_1.getPaymentFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxPaymentFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const trustlines_1 = require("../../types/trustlines");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxTrustSetFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, trustlines_1.getTrustSetFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxTrustSetFlags;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const uritokens_1 = require("../../types/uritokens");
|
|
4
|
+
const flags_1 = require("./flags");
|
|
5
|
+
function parseTxURITokenMintFlags(value, options = {}) {
|
|
6
|
+
return (0, flags_1.parseFlags)(value, (0, uritokens_1.getURITokenMintFlagsKeys)(options.nativeCurrency), options);
|
|
7
|
+
}
|
|
8
|
+
exports.default = parseTxURITokenMintFlags;
|
|
@@ -5,5 +5,5 @@ interface FormattedEmittedTxnInterface {
|
|
|
5
5
|
specification: FormattedSpecification;
|
|
6
6
|
tx: any;
|
|
7
7
|
}
|
|
8
|
-
export declare function parseEmittedTxns(tx: any, definitions?: XrplDefinitionsBase): FormattedEmittedTxnInterface[] | undefined;
|
|
8
|
+
export declare function parseEmittedTxns(tx: any, nativeCurrency: string, definitions?: XrplDefinitionsBase): FormattedEmittedTxnInterface[] | undefined;
|
|
9
9
|
export {};
|
|
@@ -4,13 +4,14 @@ exports.parseEmittedTxns = parseEmittedTxns;
|
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
5
|
const wallet_1 = require("../../wallet");
|
|
6
6
|
const transaction_1 = require("../../parse/transaction");
|
|
7
|
-
function parseEmittedTxns(tx, definitions) {
|
|
8
|
-
return new EmittedTxns(tx, definitions).call();
|
|
7
|
+
function parseEmittedTxns(tx, nativeCurrency, definitions) {
|
|
8
|
+
return new EmittedTxns(tx, nativeCurrency, definitions).call();
|
|
9
9
|
}
|
|
10
10
|
class EmittedTxns {
|
|
11
|
-
constructor(tx, definitions) {
|
|
12
|
-
this.tx = tx;
|
|
11
|
+
constructor(tx, nativeCurrency, definitions) {
|
|
13
12
|
this.emittedTxns = [];
|
|
13
|
+
this.tx = tx;
|
|
14
|
+
this.nativeCurrency = nativeCurrency;
|
|
14
15
|
this.definitions = definitions;
|
|
15
16
|
}
|
|
16
17
|
call() {
|
|
@@ -46,7 +47,7 @@ class EmittedTxns {
|
|
|
46
47
|
}
|
|
47
48
|
this.emittedTxns.push((0, common_1.removeUndefined)({
|
|
48
49
|
id,
|
|
49
|
-
specification: (0, transaction_1.parseTransaction)(tx, false).specification,
|
|
50
|
+
specification: (0, transaction_1.parseTransaction)(tx, false, this.nativeCurrency, this.definitions).specification,
|
|
50
51
|
tx,
|
|
51
52
|
}));
|
|
52
53
|
}
|
package/lib/parse/outcome.js
CHANGED
|
@@ -146,16 +146,16 @@ function getURITokenSellOfferChanges(tx) {
|
|
|
146
146
|
return Object.keys(uritokenSellOfferChanges).length > 0 ? uritokenSellOfferChanges : undefined;
|
|
147
147
|
}
|
|
148
148
|
function getHooksExecutions(tx, nativeCurrency) {
|
|
149
|
-
if (nativeCurrency !==
|
|
149
|
+
if (nativeCurrency !== common_1.XAHAU_NATIVE_CURRENCY) {
|
|
150
150
|
return undefined;
|
|
151
151
|
}
|
|
152
152
|
return (0, index_1.parseHooksExecutions)(tx);
|
|
153
153
|
}
|
|
154
154
|
function getEmittedTxns(tx, nativeCurrency, definitions) {
|
|
155
|
-
if (nativeCurrency !==
|
|
155
|
+
if (nativeCurrency !== common_1.XAHAU_NATIVE_CURRENCY) {
|
|
156
156
|
return undefined;
|
|
157
157
|
}
|
|
158
|
-
return (0, index_1.parseEmittedTxns)(tx, definitions);
|
|
158
|
+
return (0, index_1.parseEmittedTxns)(tx, nativeCurrency, definitions);
|
|
159
159
|
}
|
|
160
160
|
function getAmmChanges(tx) {
|
|
161
161
|
if (!AMM_TYPES.includes(tx.TransactionType)) {
|
|
@@ -179,7 +179,7 @@ function getOracleChanges(tx) {
|
|
|
179
179
|
return oracleChanges ? (0, common_1.removeUndefined)(oracleChanges) : undefined;
|
|
180
180
|
}
|
|
181
181
|
function getUNLReportChanges(tx, nativeCurrency) {
|
|
182
|
-
if (nativeCurrency !==
|
|
182
|
+
if (nativeCurrency !== common_1.XAHAU_NATIVE_CURRENCY) {
|
|
183
183
|
return undefined;
|
|
184
184
|
}
|
|
185
185
|
if (!UNL_REPORT_TYPES.includes(tx.TransactionType)) {
|
|
@@ -188,7 +188,7 @@ function getUNLReportChanges(tx, nativeCurrency) {
|
|
|
188
188
|
return (0, index_1.parseUNLReportChanges)(tx);
|
|
189
189
|
}
|
|
190
190
|
function getMPTokenChanges(tx, nativeCurrency) {
|
|
191
|
-
if (nativeCurrency !==
|
|
191
|
+
if (nativeCurrency !== common_1.MAINNET_NATIVE_CURRENCY) {
|
|
192
192
|
return undefined;
|
|
193
193
|
}
|
|
194
194
|
if (!MPTOKEN_TYPES.includes(tx.TransactionType)) {
|
|
@@ -198,14 +198,14 @@ function getMPTokenChanges(tx, nativeCurrency) {
|
|
|
198
198
|
return Object.keys(mptokenChanges).length > 0 ? mptokenChanges : undefined;
|
|
199
199
|
}
|
|
200
200
|
function getMPTokenIssuanceChanges(tx, nativeCurrency) {
|
|
201
|
-
if (nativeCurrency !==
|
|
201
|
+
if (nativeCurrency !== common_1.MAINNET_NATIVE_CURRENCY) {
|
|
202
202
|
return undefined;
|
|
203
203
|
}
|
|
204
204
|
const mptokenIssuanceChanges = (0, index_1.parseMPTokenIssuanceChanges)(tx);
|
|
205
205
|
return Object.keys(mptokenIssuanceChanges).length > 0 ? mptokenIssuanceChanges : undefined;
|
|
206
206
|
}
|
|
207
207
|
function getCredentialChanges(tx, nativeCurrency) {
|
|
208
|
-
if (nativeCurrency !==
|
|
208
|
+
if (nativeCurrency !== common_1.MAINNET_NATIVE_CURRENCY) {
|
|
209
209
|
return undefined;
|
|
210
210
|
}
|
|
211
211
|
if (!CREDENTIAL_TYPES.includes(tx.TransactionType)) {
|
|
@@ -214,7 +214,7 @@ function getCredentialChanges(tx, nativeCurrency) {
|
|
|
214
214
|
return (0, index_1.parseCredentialChanges)(tx.meta);
|
|
215
215
|
}
|
|
216
216
|
function getDelegateChanges(tx, nativeCurrency) {
|
|
217
|
-
if (nativeCurrency !==
|
|
217
|
+
if (nativeCurrency !== common_1.MAINNET_NATIVE_CURRENCY) {
|
|
218
218
|
return undefined;
|
|
219
219
|
}
|
|
220
220
|
if (!DELEGATE_TYPES.includes(tx.TransactionType)) {
|
|
@@ -223,7 +223,7 @@ function getDelegateChanges(tx, nativeCurrency) {
|
|
|
223
223
|
return (0, index_1.parseDelegateChanges)(tx.meta);
|
|
224
224
|
}
|
|
225
225
|
function getRemarksChanges(tx, nativeCurrency) {
|
|
226
|
-
if (nativeCurrency !==
|
|
226
|
+
if (nativeCurrency !== common_1.XAHAU_NATIVE_CURRENCY) {
|
|
227
227
|
return undefined;
|
|
228
228
|
}
|
|
229
229
|
if (!REMARKS_TYPES.includes(tx.TransactionType)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AccountDelete } from "xrpl";
|
|
2
2
|
import { FormattedAccountDeleteSpecification } from "../../types/account";
|
|
3
|
-
declare function parseAccountDelete(tx: AccountDelete): FormattedAccountDeleteSpecification;
|
|
3
|
+
declare function parseAccountDelete(tx: AccountDelete, nativeCurrency?: string): FormattedAccountDeleteSpecification;
|
|
4
4
|
export default parseAccountDelete;
|