@bithomp/xrpl-api 3.1.8 → 3.1.10
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/connection.js
CHANGED
|
@@ -59,7 +59,6 @@ class Connection extends events_1.EventEmitter {
|
|
|
59
59
|
});
|
|
60
60
|
await this.removeClient();
|
|
61
61
|
this.client = new xrpl_1.Client(this.url, (0, common_1.removeUndefined)({ timeout: this.timeout, connectionTimeout: this.connectionTimeout }));
|
|
62
|
-
this.client.apiVersion = this.apiVersion;
|
|
63
62
|
this.setupEmitter();
|
|
64
63
|
await this.client.connection.connect();
|
|
65
64
|
await this.updateServerInfo();
|
|
@@ -89,7 +88,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
89
88
|
return this.updateSubscriptions(request);
|
|
90
89
|
}
|
|
91
90
|
const waitTime = (0, utils_1.getTimestamp)() + RECONNECT_TIMEOUT;
|
|
92
|
-
while (
|
|
91
|
+
while (!this.client || !this.isConnected()) {
|
|
93
92
|
await (0, utils_1.sleep)(100);
|
|
94
93
|
if (this.shutdown) {
|
|
95
94
|
return { error: "shutdownConnection", error_message: "Connection is shutdown.", status: "error" };
|
package/lib/ledger/account_tx.js
CHANGED
|
@@ -107,28 +107,29 @@ async function getTransactions(account, options = { limit: DEFAULT_LIMIT }) {
|
|
|
107
107
|
async function findTransactions(account, options = { limit: DEFAULT_LIMIT, timeout: 15000 }) {
|
|
108
108
|
let transactions = [];
|
|
109
109
|
let accountTransactionsError = null;
|
|
110
|
-
const formatted = options.legacy === true || options.formatted === true;
|
|
111
110
|
const timeStart = new Date();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
const loadOptions = { ...options };
|
|
112
|
+
const formatted = loadOptions.legacy === true || loadOptions.formatted === true;
|
|
113
|
+
loadOptions.binary = false;
|
|
114
|
+
applyLimitOptions(loadOptions);
|
|
115
|
+
await applyStartTxOptions(loadOptions);
|
|
116
|
+
while (transactions.length !== loadOptions.limit) {
|
|
116
117
|
const currentTime = new Date();
|
|
117
|
-
if (
|
|
118
|
+
if (loadOptions.timeout && currentTime.getTime() - timeStart.getTime() > loadOptions.timeout) {
|
|
118
119
|
break;
|
|
119
120
|
}
|
|
120
|
-
let limit =
|
|
121
|
-
if (transactions.length === 0 &&
|
|
121
|
+
let limit = loadOptions.limit;
|
|
122
|
+
if (transactions.length === 0 && loadOptions.startTxHash) {
|
|
122
123
|
limit += LIMIT_INCREASE_COUNT;
|
|
123
124
|
}
|
|
124
|
-
if (
|
|
125
|
+
if (loadOptions.sourceTag || loadOptions.destinationTag) {
|
|
125
126
|
limit += LIMIT_INCREASE_COUNT;
|
|
126
127
|
}
|
|
127
128
|
if (limit > MAX_LIMIT) {
|
|
128
129
|
limit = MAX_LIMIT;
|
|
129
130
|
}
|
|
130
131
|
const accountTransactions = await getTransactions(account, {
|
|
131
|
-
...
|
|
132
|
+
...loadOptions,
|
|
132
133
|
...{ balanceChanges: false, specification: false, limit },
|
|
133
134
|
});
|
|
134
135
|
if (!accountTransactions || accountTransactions.error) {
|
|
@@ -136,16 +137,16 @@ async function findTransactions(account, options = { limit: DEFAULT_LIMIT, timeo
|
|
|
136
137
|
break;
|
|
137
138
|
}
|
|
138
139
|
let newTransactions = accountTransactions.transactions;
|
|
139
|
-
|
|
140
|
+
loadOptions.marker = accountTransactions.marker;
|
|
140
141
|
newTransactions = newTransactions
|
|
141
|
-
.filter(lodash_1.default.partial(filterHelperTransactions, account,
|
|
142
|
-
.filter(lodash_1.default.partial(filterHelperStartTx,
|
|
143
|
-
if (formatted !== true && (
|
|
142
|
+
.filter(lodash_1.default.partial(filterHelperTransactions, account, loadOptions))
|
|
143
|
+
.filter(lodash_1.default.partial(filterHelperStartTx, loadOptions));
|
|
144
|
+
if (formatted !== true && (loadOptions.balanceChanges === true || loadOptions.specification === true)) {
|
|
144
145
|
for (const newTransaction of newTransactions) {
|
|
145
|
-
if (
|
|
146
|
+
if (loadOptions.balanceChanges === true) {
|
|
146
147
|
newTransaction.balanceChanges = (0, xrpl_1.getBalanceChanges)(newTransaction.meta);
|
|
147
148
|
}
|
|
148
|
-
if (
|
|
149
|
+
if (loadOptions.specification === true) {
|
|
149
150
|
const details = (0, transaction_1.getAccountTxDetails)(newTransaction, true);
|
|
150
151
|
newTransaction.specification = details.specification;
|
|
151
152
|
newTransaction.outcome = details.outcome;
|
|
@@ -154,23 +155,23 @@ async function findTransactions(account, options = { limit: DEFAULT_LIMIT, timeo
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
transactions = transactions.concat(newTransactions);
|
|
157
|
-
transactions = transactions.slice(0,
|
|
158
|
-
if (
|
|
158
|
+
transactions = transactions.slice(0, loadOptions.limit);
|
|
159
|
+
if (loadOptions.marker === undefined) {
|
|
159
160
|
break;
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
if (accountTransactionsError && transactions.length === 0) {
|
|
163
164
|
return accountTransactionsError;
|
|
164
165
|
}
|
|
165
|
-
if (
|
|
166
|
+
if (loadOptions.marker && transactions.length === 0) {
|
|
166
167
|
return {
|
|
167
168
|
status: "timeout",
|
|
168
169
|
error: "searchTimeout",
|
|
169
|
-
marker:
|
|
170
|
+
marker: loadOptions.marker,
|
|
170
171
|
};
|
|
171
172
|
}
|
|
172
173
|
if (formatted === true) {
|
|
173
|
-
transactions = transactions.map((transaction) => (0, transaction_1.getAccountTxDetails)(transaction,
|
|
174
|
+
transactions = transactions.map((transaction) => (0, transaction_1.getAccountTxDetails)(transaction, loadOptions.includeRawTransactions === true));
|
|
174
175
|
}
|
|
175
176
|
return transactions;
|
|
176
177
|
}
|
|
@@ -43,7 +43,7 @@ function parsePayment(tx) {
|
|
|
43
43
|
assert.ok(tx.TransactionType === "Payment");
|
|
44
44
|
const source = {
|
|
45
45
|
address: tx.Account,
|
|
46
|
-
maxAmount: (0, utils_1.removeGenericCounterparty)((0, amount_1.default)(tx.SendMax || tx.Amount), tx.Account),
|
|
46
|
+
maxAmount: (0, utils_1.removeGenericCounterparty)((0, amount_1.default)(tx.SendMax || tx.DeliverMax || tx.Amount), tx.Account),
|
|
47
47
|
tag: tx.SourceTag,
|
|
48
48
|
};
|
|
49
49
|
const destination = {
|
package/lib/parse/transaction.js
CHANGED
|
@@ -158,6 +158,7 @@ function parseTransaction(tx, includeRawTransaction, nativeCurrency, definitions
|
|
|
158
158
|
type: type,
|
|
159
159
|
address: (0, account_1.parseAccount)(tx.Account),
|
|
160
160
|
sequence: tx.Sequence,
|
|
161
|
+
ticketSequence: tx.TicketSequence,
|
|
161
162
|
id: tx.hash,
|
|
162
163
|
ctid: tx.ctid,
|
|
163
164
|
specification: (0, common_1.removeUndefined)(specification),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bithomp/xrpl-api",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.10",
|
|
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",
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/chai": "^4.3.19",
|
|
66
66
|
"@types/chai-as-promised": "^7.1.8",
|
|
67
|
-
"@types/lodash": "^4.17.
|
|
68
|
-
"@types/mocha": "^10.0.
|
|
67
|
+
"@types/lodash": "^4.17.10",
|
|
68
|
+
"@types/mocha": "^10.0.9",
|
|
69
69
|
"@types/nconf": "^0.10.7",
|
|
70
70
|
"@types/node": "^20.14.15",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
72
|
-
"@typescript-eslint/parser": "^8.
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
|
72
|
+
"@typescript-eslint/parser": "^8.9.0",
|
|
73
73
|
"chai": "^4.5.0",
|
|
74
74
|
"chai-as-promised": "^7.1.2",
|
|
75
75
|
"eslint": "^8.57.0",
|
|
76
76
|
"eslint-config-prettier": "^9.1.0",
|
|
77
77
|
"eslint-plugin-chai-friendly": "^1.0.1",
|
|
78
|
-
"eslint-plugin-import": "^2.
|
|
79
|
-
"eslint-plugin-n": "^17.
|
|
78
|
+
"eslint-plugin-import": "^2.31.0",
|
|
79
|
+
"eslint-plugin-n": "^17.11.1",
|
|
80
80
|
"eslint-plugin-promise": "^7.1.0",
|
|
81
81
|
"mocha": "^10.7.3",
|
|
82
82
|
"nconf": "^0.12.1",
|