@bithomp/xrpl-api 3.2.7 → 3.2.8
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/ledger/account_tx.js +4 -6
- package/lib/ledger/transaction.js +4 -6
- package/lib/models/transaction.d.ts +4 -4
- package/lib/parse/specification/oracle-set.js +0 -2
- package/lib/parse/specification/unrecognized.d.ts +3 -0
- package/lib/parse/specification/unrecognized.js +20 -0
- package/lib/parse/transaction.d.ts +3 -2
- package/lib/parse/transaction.js +3 -8
- package/lib/types/unrecognized.d.ts +5 -0
- package/lib/types/unrecognized.js +2 -0
- package/package.json +1 -1
package/lib/ledger/account_tx.js
CHANGED
|
@@ -101,11 +101,10 @@ async function getTransactions(account, options = { limit: DEFAULT_LIMIT }) {
|
|
|
101
101
|
transaction.balanceChanges = (0, xrpl_1.getBalanceChanges)(transaction.meta);
|
|
102
102
|
}
|
|
103
103
|
if (options.specification === true) {
|
|
104
|
-
const
|
|
105
|
-
const details = (0, transaction_1.getAccountTxDetails)(transaction, includeRawTransaction);
|
|
104
|
+
const details = (0, transaction_1.getAccountTxDetails)(transaction, options.includeRawTransactions);
|
|
106
105
|
transaction.specification = details.specification;
|
|
107
106
|
transaction.outcome = details.outcome;
|
|
108
|
-
if (
|
|
107
|
+
if (details.rawTransaction) {
|
|
109
108
|
transaction.rawTransaction = details.rawTransaction;
|
|
110
109
|
}
|
|
111
110
|
}
|
|
@@ -166,11 +165,10 @@ async function findTransactions(account, options = { limit: DEFAULT_LIMIT, timeo
|
|
|
166
165
|
newTransaction.balanceChanges = (0, xrpl_1.getBalanceChanges)(newTransaction.meta);
|
|
167
166
|
}
|
|
168
167
|
if (loadOptions.specification === true) {
|
|
169
|
-
const
|
|
170
|
-
const details = (0, transaction_1.getAccountTxDetails)(newTransaction, includeRawTransaction);
|
|
168
|
+
const details = (0, transaction_1.getAccountTxDetails)(newTransaction, options.includeRawTransactions);
|
|
171
169
|
newTransaction.specification = details.specification;
|
|
172
170
|
newTransaction.outcome = details.outcome;
|
|
173
|
-
if (
|
|
171
|
+
if (details.rawTransaction) {
|
|
174
172
|
newTransaction.rawTransaction = details.rawTransaction;
|
|
175
173
|
}
|
|
176
174
|
}
|
|
@@ -93,11 +93,10 @@ async function getTransaction(transaction, options = {}) {
|
|
|
93
93
|
result.balanceChanges = xrpl.getBalanceChanges(result.meta);
|
|
94
94
|
}
|
|
95
95
|
if (options.specification === true) {
|
|
96
|
-
const
|
|
97
|
-
const details = (0, transaction_1.getTxDetails)(result, includeRawTransaction, undefined, options.definitions);
|
|
96
|
+
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction, undefined, options.definitions);
|
|
98
97
|
result.specification = details.specification;
|
|
99
98
|
result.outcome = details.outcome;
|
|
100
|
-
if (
|
|
99
|
+
if (details.rawTransaction) {
|
|
101
100
|
result.rawTransaction = details.rawTransaction;
|
|
102
101
|
}
|
|
103
102
|
}
|
|
@@ -168,11 +167,10 @@ async function getTransactionByCTID(ctid, options = {}) {
|
|
|
168
167
|
result.balanceChanges = xrpl.getBalanceChanges(result.meta);
|
|
169
168
|
}
|
|
170
169
|
if (options.specification === true) {
|
|
171
|
-
const
|
|
172
|
-
const details = (0, transaction_1.getTxDetails)(result, includeRawTransaction, undefined, options.definitions);
|
|
170
|
+
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction, undefined, options.definitions);
|
|
173
171
|
result.specification = details.specification;
|
|
174
172
|
result.outcome = details.outcome;
|
|
175
|
-
if (
|
|
173
|
+
if (details.rawTransaction) {
|
|
176
174
|
result.rawTransaction = details.rawTransaction;
|
|
177
175
|
}
|
|
178
176
|
}
|
|
@@ -33,10 +33,10 @@ export interface AccountPaymentParamsInterface {
|
|
|
33
33
|
lastLedgerSequence?: number;
|
|
34
34
|
networkID?: number;
|
|
35
35
|
}
|
|
36
|
-
export declare function getTxDetails(tx: TransactionResponse, includeRawTransaction
|
|
37
|
-
export declare function getAccountTxDetails(tx: AccountTransaction, includeRawTransaction
|
|
38
|
-
export declare function getLedgerTxDetails(tx: LedgerTransaction, ledgerIndex: number, closeTime: number, includeRawTransaction
|
|
39
|
-
export declare function getStreamTxDetails(tx: StreamTransaction, includeRawTransaction
|
|
36
|
+
export declare function getTxDetails(tx: TransactionResponse, includeRawTransaction?: boolean, nativeCurrency?: string, definitions?: XrplDefinitionsBase): FormattedTransaction;
|
|
37
|
+
export declare function getAccountTxDetails(tx: AccountTransaction, includeRawTransaction?: boolean, nativeCurrency?: string): FormattedTransaction;
|
|
38
|
+
export declare function getLedgerTxDetails(tx: LedgerTransaction, ledgerIndex: number, closeTime: number, includeRawTransaction?: boolean, nativeCurrency?: string, definitions?: XrplDefinitionsBase): FormattedTransaction;
|
|
39
|
+
export declare function getStreamTxDetails(tx: StreamTransaction, includeRawTransaction?: boolean, nativeCurrency?: string, definitions?: XrplDefinitionsBase): FormattedTransaction;
|
|
40
40
|
export declare function accountTxToTx(accountTx: AccountTransaction): TransactionResponse;
|
|
41
41
|
export declare function ledgerTxToTx(ledgerTx: LedgerTransaction, ledgerIndex: number, closeTime: number): TransactionResponse;
|
|
42
42
|
export declare function streamTxToTx(streamTx: StreamTransaction): TransactionResponse;
|
|
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const assert = __importStar(require("assert"));
|
|
37
37
|
const common_1 = require("../../common");
|
|
38
|
-
const emit_details_1 = require("../ledger/emit_details");
|
|
39
38
|
const memos_1 = require("../ledger/memos");
|
|
40
39
|
const account_1 = require("../ledger/account");
|
|
41
40
|
const oracle_changes_1 = require("../outcome/oracle_changes");
|
|
@@ -53,7 +52,6 @@ function parseDidSet(tx) {
|
|
|
53
52
|
assetClass: tx.AssetClass,
|
|
54
53
|
lastUpdateTime: tx.LastUpdateTime,
|
|
55
54
|
priceDataSeries: tx.PriceDataSeries ? tx.PriceDataSeries.map(oracle_changes_1.parsePriceDataSeries) : undefined,
|
|
56
|
-
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
57
55
|
memos: (0, memos_1.parseMemos)(tx),
|
|
58
56
|
});
|
|
59
57
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const common_1 = require("../../common");
|
|
4
|
+
const emit_details_1 = require("../ledger/emit_details");
|
|
5
|
+
const memos_1 = require("../ledger/memos");
|
|
6
|
+
const account_1 = require("../ledger/account");
|
|
7
|
+
function unrecognizedParser(tx) {
|
|
8
|
+
const source = (0, common_1.removeUndefined)({
|
|
9
|
+
address: (0, account_1.parseAccount)(tx.Account),
|
|
10
|
+
tag: tx.SourceTag,
|
|
11
|
+
});
|
|
12
|
+
return (0, common_1.removeUndefined)({
|
|
13
|
+
UNAVAILABLE: "Unrecognized transaction type.",
|
|
14
|
+
SEE_RAW_TRANSACTION: "Since this type is unrecognized, `rawTransaction` is may included in this response.",
|
|
15
|
+
source: Object.keys(source).length > 0 ? source : undefined,
|
|
16
|
+
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
17
|
+
memos: (0, memos_1.parseMemos)(tx),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.default = unrecognizedParser;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { XrplDefinitionsBase } from "ripple-binary-codec";
|
|
2
2
|
import { Outcome } from "../types/outcome";
|
|
3
|
+
import { FormattedUnrecognizedParserSpecification } from "../types/unrecognized";
|
|
3
4
|
import { FormattedAccountDeleteSpecification } from "../types/account";
|
|
4
5
|
import { FormattedSettingsSpecification } from "../types/settings";
|
|
5
6
|
import { FormattedCheckCancelSpecification, FormattedCheckCashSpecification, FormattedCheckCreateSpecification } from "../types/checks";
|
|
@@ -25,7 +26,7 @@ import { FormattedGenesisMintSpecification } from "../types/genesis_mint";
|
|
|
25
26
|
import { FormattedAmendmentSpecification } from "../types/amendments";
|
|
26
27
|
import { FormattedFeeUpdateSpecification } from "../types/fees";
|
|
27
28
|
declare function parseTransactionType(type: string): string;
|
|
28
|
-
export type FormattedSpecification = FormattedSettingsSpecification | FormattedAccountDeleteSpecification | FormattedCheckCancelSpecification | FormattedCheckCashSpecification | FormattedCheckCreateSpecification | FormattedDepositPreauthSpecification | FormattedEscrowCancelSpecification | FormattedEscrowCreateSpecification | FormattedEscrowFinishSpecification | FormattedOfferCancelSpecification | FormattedOfferCreateSpecification | FormattedPaymentSpecification | FormattedPaymentChannelClaimSpecification | FormattedPaymentChannelCreateSpecification | FormattedPaymentChannelFundSpecification | FormattedTicketCreateSpecification | FormattedTrustlineSpecification | FormattedNFTokenBurnSpecification | FormattedNFTokenMintSpecification | FormattedNFTokenCancelOfferSpecification | FormattedNFTokenCreateOfferSpecification | FormattedNFTokenAcceptOfferSpecification | FormattedURITokenBurnSpecification | FormattedURITokenBuySpecification | FormattedURITokenCreateSellOfferSpecification | FormattedURITokenCancelSellOfferSpecification | FormattedURITokenMintSpecification | FormattedImportSpecification | FormattedInvokeSpecification | FormattedUNLReportSpecification | FormattedRemitsSpecification | FormattedClawbackSpecification | FormattedAmmBidSpecification | FormattedAmmCreateSpecification | FormattedAmmDeleteSpecification | FormattedAmmDepositSpecification | FormattedAmmWithdrawSpecification | FormattedAmmVoteSpecification | FormattedAmmClawbackSpecification | FormattedGenesisMintSpecification | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification | FormattedDIDSetSpecification | FormattedDIDDeleteSpecification | FormattedOracleSetSpecification | FormattedOracleDeleteSpecification | FormattedMPTokenIssuanceCreateSpecification | FormattedMPTokenAuthorizeSpecification | FormattedMPTokenIssuanceSetSpecification | FormattedMPTokenIssuanceDestroySpecification;
|
|
29
|
+
export type FormattedSpecification = FormattedUnrecognizedParserSpecification | FormattedSettingsSpecification | FormattedAccountDeleteSpecification | FormattedCheckCancelSpecification | FormattedCheckCashSpecification | FormattedCheckCreateSpecification | FormattedDepositPreauthSpecification | FormattedEscrowCancelSpecification | FormattedEscrowCreateSpecification | FormattedEscrowFinishSpecification | FormattedOfferCancelSpecification | FormattedOfferCreateSpecification | FormattedPaymentSpecification | FormattedPaymentChannelClaimSpecification | FormattedPaymentChannelCreateSpecification | FormattedPaymentChannelFundSpecification | FormattedTicketCreateSpecification | FormattedTrustlineSpecification | FormattedNFTokenBurnSpecification | FormattedNFTokenMintSpecification | FormattedNFTokenCancelOfferSpecification | FormattedNFTokenCreateOfferSpecification | FormattedNFTokenAcceptOfferSpecification | FormattedURITokenBurnSpecification | FormattedURITokenBuySpecification | FormattedURITokenCreateSellOfferSpecification | FormattedURITokenCancelSellOfferSpecification | FormattedURITokenMintSpecification | FormattedImportSpecification | FormattedInvokeSpecification | FormattedUNLReportSpecification | FormattedRemitsSpecification | FormattedClawbackSpecification | FormattedAmmBidSpecification | FormattedAmmCreateSpecification | FormattedAmmDeleteSpecification | FormattedAmmDepositSpecification | FormattedAmmWithdrawSpecification | FormattedAmmVoteSpecification | FormattedAmmClawbackSpecification | FormattedGenesisMintSpecification | FormattedAmendmentSpecification | FormattedFeeUpdateSpecification | FormattedDIDSetSpecification | FormattedDIDDeleteSpecification | FormattedOracleSetSpecification | FormattedOracleDeleteSpecification | FormattedMPTokenIssuanceCreateSpecification | FormattedMPTokenAuthorizeSpecification | FormattedMPTokenIssuanceSetSpecification | FormattedMPTokenIssuanceDestroySpecification;
|
|
29
30
|
export interface FormattedTransaction {
|
|
30
31
|
type: string;
|
|
31
32
|
address: string;
|
|
@@ -35,5 +36,5 @@ export interface FormattedTransaction {
|
|
|
35
36
|
outcome?: Outcome;
|
|
36
37
|
rawTransaction?: string;
|
|
37
38
|
}
|
|
38
|
-
declare function parseTransaction(tx: any, includeRawTransaction
|
|
39
|
+
declare function parseTransaction(tx: any, includeRawTransaction?: boolean, nativeCurrency?: string, definitions?: XrplDefinitionsBase): FormattedTransaction;
|
|
39
40
|
export { parseTransactionType, parseTransaction };
|
package/lib/parse/transaction.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.parseTransaction = parseTransaction;
|
|
|
8
8
|
const common_1 = require("../common");
|
|
9
9
|
const account_1 = require("./ledger/account");
|
|
10
10
|
const outcome_1 = require("./outcome");
|
|
11
|
+
const unrecognized_1 = __importDefault(require("./specification/unrecognized"));
|
|
11
12
|
const settings_1 = __importDefault(require("./specification/settings"));
|
|
12
13
|
const account_delete_1 = __importDefault(require("./specification/account-delete"));
|
|
13
14
|
const check_cancel_1 = __importDefault(require("./specification/check-cancel"));
|
|
@@ -167,12 +168,6 @@ const parserTypeFunc = {
|
|
|
167
168
|
amendment: amendment_1.default,
|
|
168
169
|
feeUpdate: fee_update_1.default,
|
|
169
170
|
};
|
|
170
|
-
function unrecognizedParser(_tx) {
|
|
171
|
-
return {
|
|
172
|
-
UNAVAILABLE: "Unrecognized transaction type.",
|
|
173
|
-
SEE_RAW_TRANSACTION: "Since this type is unrecognized, `rawTransaction` is included in this response.",
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
171
|
function parseTransaction(tx, includeRawTransaction, nativeCurrency, definitions) {
|
|
177
172
|
let universalTx = tx;
|
|
178
173
|
if (universalTx.tx_json) {
|
|
@@ -180,8 +175,8 @@ function parseTransaction(tx, includeRawTransaction, nativeCurrency, definitions
|
|
|
180
175
|
}
|
|
181
176
|
const type = parseTransactionType(universalTx.TransactionType);
|
|
182
177
|
const parser = parserTypeFunc[type];
|
|
183
|
-
const specification = parser ? parser(universalTx) :
|
|
184
|
-
if (!parser) {
|
|
178
|
+
const specification = parser ? parser(universalTx) : (0, unrecognized_1.default)(universalTx);
|
|
179
|
+
if (!parser && includeRawTransaction !== false) {
|
|
185
180
|
includeRawTransaction = true;
|
|
186
181
|
}
|
|
187
182
|
const outcome = (0, outcome_1.parseOutcome)(universalTx, nativeCurrency, definitions);
|