@bithomp/xrpl-api 3.6.18 → 3.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/common/utils.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export declare function xrpToDrops(xrp: BigNumber.Value): string;
|
|
|
11
11
|
export declare function removeUndefined<T extends object>(obj: T): T;
|
|
12
12
|
export declare function emptyObjectToUndefined<T extends object>(obj: T): T | undefined;
|
|
13
13
|
export declare function getConstructorName(object: object): string | undefined;
|
|
14
|
+
export declare function isClioResponse(response: any): boolean;
|
package/lib/common/utils.js
CHANGED
|
@@ -14,6 +14,7 @@ exports.xrpToDrops = xrpToDrops;
|
|
|
14
14
|
exports.removeUndefined = removeUndefined;
|
|
15
15
|
exports.emptyObjectToUndefined = emptyObjectToUndefined;
|
|
16
16
|
exports.getConstructorName = getConstructorName;
|
|
17
|
+
exports.isClioResponse = isClioResponse;
|
|
17
18
|
const lodash_1 = __importDefault(require("lodash"));
|
|
18
19
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
19
20
|
const errors_1 = require("./errors");
|
|
@@ -138,3 +139,9 @@ function getConstructorName(object) {
|
|
|
138
139
|
}
|
|
139
140
|
return undefined;
|
|
140
141
|
}
|
|
142
|
+
function isClioResponse(response) {
|
|
143
|
+
if (!response || !response.warnings) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
return response.warnings?.some((w) => w.id === 2001);
|
|
147
|
+
}
|
|
@@ -39,17 +39,19 @@ exports.isActivated = isActivated;
|
|
|
39
39
|
const Client = __importStar(require("../client"));
|
|
40
40
|
const account_info_1 = require("../parse/ledger/account-info");
|
|
41
41
|
const common_1 = require("../common");
|
|
42
|
+
const utils_1 = require("../common/utils");
|
|
42
43
|
async function getAccountInfo(account, options = {}) {
|
|
43
44
|
const connection = options.connection || Client.findConnection();
|
|
44
45
|
if (!connection) {
|
|
45
46
|
throw new Error("There is no connection");
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
+
const request = {
|
|
48
49
|
command: "account_info",
|
|
49
50
|
account,
|
|
50
51
|
ledger_index: options.ledgerIndex || "validated",
|
|
51
52
|
signer_lists: !!options.signerLists,
|
|
52
|
-
}
|
|
53
|
+
};
|
|
54
|
+
const response = await connection.request(request);
|
|
53
55
|
if (!response) {
|
|
54
56
|
return {
|
|
55
57
|
account,
|
|
@@ -80,6 +82,11 @@ async function getAccountInfo(account, options = {}) {
|
|
|
80
82
|
if (result.signer_lists) {
|
|
81
83
|
result.account_data.signer_lists = result.signer_lists.slice();
|
|
82
84
|
}
|
|
85
|
+
if (request.signer_lists === true && (0, utils_1.isClioResponse)(response)) {
|
|
86
|
+
if (result.account_data.signer_lists === undefined) {
|
|
87
|
+
result.account_data.signer_lists = [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
83
90
|
return result;
|
|
84
91
|
}
|
|
85
92
|
async function getAccountInfoData(account, options = {}) {
|
package/lib/ledger/account_tx.js
CHANGED
|
@@ -207,7 +207,7 @@ async function findTransactionsExt(account, options = { limit: DEFAULT_LIMIT, ti
|
|
|
207
207
|
if (newTransactions.length > 0) {
|
|
208
208
|
const transactionsToTake = loadOptions.limit - transactions.length;
|
|
209
209
|
if (transactionsToTake !== newTransactions.length) {
|
|
210
|
-
const isClio =
|
|
210
|
+
const isClio = (0, utils_1.isClioResponse)(accountTransactions);
|
|
211
211
|
let markerTransaction = null;
|
|
212
212
|
if (isClio) {
|
|
213
213
|
markerTransaction = newTransactions[transactionsToTake - 1];
|
package/lib/ledger/ledger.d.ts
CHANGED
package/lib/ledger/ledger.js
CHANGED
|
@@ -44,19 +44,28 @@ async function getLedger(options = {}) {
|
|
|
44
44
|
if (!connection) {
|
|
45
45
|
throw new Error("There is no connection");
|
|
46
46
|
}
|
|
47
|
-
if (!connection.isLedgerIndexAvailable(options.ledgerIndex)) {
|
|
47
|
+
if (options.ledgerIndex && !connection.isLedgerIndexAvailable(options.ledgerIndex)) {
|
|
48
48
|
return {
|
|
49
49
|
status: "error",
|
|
50
50
|
error: "lgrNotFound",
|
|
51
51
|
error_message: "ledger number is out of available range",
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const request = {
|
|
55
55
|
command: "ledger",
|
|
56
|
-
ledger_index: options.ledgerIndex || "validated",
|
|
57
56
|
transactions: !!options.transactions,
|
|
58
57
|
expand: !!options.expand,
|
|
59
|
-
}
|
|
58
|
+
};
|
|
59
|
+
if (options.ledgerHash) {
|
|
60
|
+
request.ledger_hash = options.ledgerHash;
|
|
61
|
+
}
|
|
62
|
+
else if (options.ledgerIndex) {
|
|
63
|
+
request.ledger_index = options.ledgerIndex;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
request.ledger_index = "validated";
|
|
67
|
+
}
|
|
68
|
+
const response = await connection.request(request);
|
|
60
69
|
if (response.error) {
|
|
61
70
|
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
62
71
|
return (0, utils_1.removeUndefined)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bithomp/xrpl-api",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.20",
|
|
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",
|
|
@@ -18,9 +18,8 @@
|
|
|
18
18
|
"rippled",
|
|
19
19
|
"clio",
|
|
20
20
|
"xrp",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"xls35",
|
|
21
|
+
"nftoken",
|
|
22
|
+
"mptoken",
|
|
24
23
|
"unl",
|
|
25
24
|
"bithomp",
|
|
26
25
|
"xahau",
|
|
@@ -64,14 +63,14 @@
|
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@eslint/eslintrc": "^3.3.1",
|
|
67
|
-
"@types/chai": "^5.2.
|
|
66
|
+
"@types/chai": "^5.2.3",
|
|
68
67
|
"@types/chai-as-promised": "^8.0.2",
|
|
69
68
|
"@types/lodash": "^4.17.20",
|
|
70
69
|
"@types/mocha": "^10.0.10",
|
|
71
70
|
"@types/nconf": "^0.10.7",
|
|
72
71
|
"@types/node": "^22.15.21",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
74
|
-
"@typescript-eslint/parser": "^8.46.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
73
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
75
74
|
"chai": "^6.2.0",
|
|
76
75
|
"chai-as-promised": "^8.0.2",
|
|
77
76
|
"eslint": "^9.38.0",
|