@bithomp/xrpl-api 3.1.3 → 3.1.5
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/base58.js +2 -2
- package/lib/connection.js +19 -16
- package/lib/ledger/account_info.d.ts +5 -1
- package/lib/ledger/account_info.js +6 -1
- package/lib/ledger/account_objects.d.ts +2 -0
- package/lib/ledger/account_objects.js +14 -9
- package/lib/ledger/currency.js +1 -1
- package/lib/ledger/gateway_balances.d.ts +4 -1
- package/lib/ledger/gateway_balances.js +7 -1
- package/lib/ledger/transaction.js +4 -4
- package/lib/models/gateway_balances.d.ts +19 -0
- package/lib/models/gateway_balances.js +2 -0
- package/lib/parse/ledger/account-info.d.ts +3 -0
- package/lib/parse/ledger/account-info.js +15 -0
- package/lib/parse/ledger/gateway-balances.d.ts +3 -0
- package/lib/parse/ledger/gateway-balances.js +31 -0
- package/lib/parse/ledger/import.js +1 -1
- package/lib/parse/outcome/emitted_txns.js +1 -1
- package/lib/types/account.d.ts +8 -0
- package/lib/types/gateway_balances.d.ts +11 -0
- package/lib/types/gateway_balances.js +2 -0
- package/lib/types/index.d.ts +8 -6
- package/lib/types/index.js +8 -6
- package/lib/validator.js +2 -2
- package/lib/wallet.js +1 -1
- package/package.json +7 -7
package/lib/base58.js
CHANGED
|
@@ -15,7 +15,7 @@ function decode(value) {
|
|
|
15
15
|
try {
|
|
16
16
|
return Buffer.from(base58.decode(value));
|
|
17
17
|
}
|
|
18
|
-
catch (
|
|
18
|
+
catch (_err) {
|
|
19
19
|
}
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
@@ -26,7 +26,7 @@ function encode(buffer) {
|
|
|
26
26
|
try {
|
|
27
27
|
return base58.encode(buffer);
|
|
28
28
|
}
|
|
29
|
-
catch (
|
|
29
|
+
catch (_err) {
|
|
30
30
|
}
|
|
31
31
|
return null;
|
|
32
32
|
}
|
package/lib/connection.js
CHANGED
|
@@ -61,7 +61,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
61
61
|
this.client = new xrpl_1.Client(this.url, (0, common_1.removeUndefined)({ timeout: this.timeout, connectionTimeout: this.connectionTimeout }));
|
|
62
62
|
this.client.apiVersion = this.apiVersion;
|
|
63
63
|
this.setupEmitter();
|
|
64
|
-
await this.client.connect();
|
|
64
|
+
await this.client.connection.connect();
|
|
65
65
|
await this.updateServerInfo();
|
|
66
66
|
await this.subscribe();
|
|
67
67
|
}
|
|
@@ -92,7 +92,10 @@ class Connection extends events_1.EventEmitter {
|
|
|
92
92
|
return { error: "Not connected" };
|
|
93
93
|
}
|
|
94
94
|
const startDate = new Date();
|
|
95
|
-
|
|
95
|
+
if (this.apiVersion && !request.hasOwnProperty("api_version") && exports.DEFAULT_API_VERSION !== this.apiVersion) {
|
|
96
|
+
request.api_version = this.apiVersion;
|
|
97
|
+
}
|
|
98
|
+
const response = await this.client.connection.request(request);
|
|
96
99
|
const endDate = new Date();
|
|
97
100
|
this.updateLatency(endDate.getTime() - startDate.getTime());
|
|
98
101
|
return response;
|
|
@@ -137,7 +140,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
137
140
|
if (!this.client) {
|
|
138
141
|
return false;
|
|
139
142
|
}
|
|
140
|
-
return this.client.isConnected();
|
|
143
|
+
return this.client.connection.isConnected();
|
|
141
144
|
}
|
|
142
145
|
getOnlinePeriodMs() {
|
|
143
146
|
if (this.isConnected()) {
|
|
@@ -207,19 +210,19 @@ class Connection extends events_1.EventEmitter {
|
|
|
207
210
|
async removeClient() {
|
|
208
211
|
try {
|
|
209
212
|
if (this.client) {
|
|
210
|
-
await this.client.disconnect();
|
|
211
|
-
this.client.removeAllListeners();
|
|
213
|
+
await this.client.connection.disconnect();
|
|
214
|
+
this.client.connection.removeAllListeners();
|
|
212
215
|
this.client = undefined;
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
|
-
catch (
|
|
218
|
+
catch (_err) {
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
setupEmitter() {
|
|
219
222
|
if (!this.client) {
|
|
220
223
|
return;
|
|
221
224
|
}
|
|
222
|
-
this.client.on("connected", () => {
|
|
225
|
+
this.client.connection.on("connected", () => {
|
|
223
226
|
this.logger?.debug({
|
|
224
227
|
service: "Bithomp::XRPL::Connection",
|
|
225
228
|
emit: "connected",
|
|
@@ -228,7 +231,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
228
231
|
this.emit("connected");
|
|
229
232
|
this.onlineSince = new Date().getTime();
|
|
230
233
|
});
|
|
231
|
-
this.client.on("disconnected", (code) => {
|
|
234
|
+
this.client.connection.on("disconnected", (code) => {
|
|
232
235
|
this.logger?.debug({
|
|
233
236
|
service: "Bithomp::XRPL::Connection",
|
|
234
237
|
emit: "disconnected",
|
|
@@ -240,7 +243,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
240
243
|
this.streamsSubscribed = false;
|
|
241
244
|
this.emit("disconnected", code);
|
|
242
245
|
});
|
|
243
|
-
this.client.on("error", (source, message, error) => {
|
|
246
|
+
this.client.connection.on("error", (source, message, error) => {
|
|
244
247
|
try {
|
|
245
248
|
this.logger?.error({
|
|
246
249
|
service: "Bithomp::XRPL::Connection",
|
|
@@ -260,23 +263,23 @@ class Connection extends events_1.EventEmitter {
|
|
|
260
263
|
}
|
|
261
264
|
this.connectionValidation();
|
|
262
265
|
});
|
|
263
|
-
this.client.on("ledgerClosed", (ledgerStream) => {
|
|
266
|
+
this.client.connection.on("ledgerClosed", (ledgerStream) => {
|
|
264
267
|
this.onLedgerClosed(ledgerStream);
|
|
265
268
|
this.emit("ledgerClosed", ledgerStream);
|
|
266
269
|
});
|
|
267
|
-
this.client.on("transaction", (transactionStream) => {
|
|
270
|
+
this.client.connection.on("transaction", (transactionStream) => {
|
|
268
271
|
this.emit("transaction", transactionStream);
|
|
269
272
|
});
|
|
270
|
-
this.client.on("validationReceived", (validation) => {
|
|
273
|
+
this.client.connection.on("validationReceived", (validation) => {
|
|
271
274
|
this.emit("validationReceived", validation);
|
|
272
275
|
});
|
|
273
|
-
this.client.on("peerStatusChange", (status) => {
|
|
276
|
+
this.client.connection.on("peerStatusChange", (status) => {
|
|
274
277
|
this.emit("peerStatusChange", status);
|
|
275
278
|
});
|
|
276
|
-
this.client.on("consensusPhase", (consensus) => {
|
|
279
|
+
this.client.connection.on("consensusPhase", (consensus) => {
|
|
277
280
|
this.emit("consensusPhase", consensus);
|
|
278
281
|
});
|
|
279
|
-
this.client.on("path_find", (path) => {
|
|
282
|
+
this.client.connection.on("path_find", (path) => {
|
|
280
283
|
this.emit("path_find", path);
|
|
281
284
|
});
|
|
282
285
|
}
|
|
@@ -427,7 +430,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
427
430
|
}
|
|
428
431
|
}
|
|
429
432
|
}
|
|
430
|
-
catch (
|
|
433
|
+
catch (_err) {
|
|
431
434
|
}
|
|
432
435
|
this.serverInfoUpdating = false;
|
|
433
436
|
}
|
|
@@ -2,11 +2,15 @@ import { Connection } from "../connection";
|
|
|
2
2
|
import { LedgerIndex } from "../models/ledger";
|
|
3
3
|
import { AccountInfoResponse, AccountInfoDataResponse } from "../models/account_info";
|
|
4
4
|
import { ErrorResponse } from "../models/base_model";
|
|
5
|
+
import { FormattedAccountInfoData } from "../types";
|
|
5
6
|
export interface GetAccountInfoOptions {
|
|
6
7
|
ledgerIndex?: LedgerIndex;
|
|
7
8
|
signerLists?: boolean;
|
|
8
9
|
connection?: Connection;
|
|
9
10
|
}
|
|
10
11
|
export declare function getAccountInfo(account: string, options?: GetAccountInfoOptions): Promise<AccountInfoResponse | ErrorResponse>;
|
|
11
|
-
export
|
|
12
|
+
export interface GetAccountInfoDataOptions extends GetAccountInfoOptions {
|
|
13
|
+
formatted?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function getAccountInfoData(account: string, options?: GetAccountInfoDataOptions): Promise<AccountInfoDataResponse | FormattedAccountInfoData | ErrorResponse>;
|
|
12
16
|
export declare function isActivated(account: string): Promise<boolean>;
|
|
@@ -27,6 +27,7 @@ exports.getAccountInfo = getAccountInfo;
|
|
|
27
27
|
exports.getAccountInfoData = getAccountInfoData;
|
|
28
28
|
exports.isActivated = isActivated;
|
|
29
29
|
const Client = __importStar(require("../client"));
|
|
30
|
+
const account_info_1 = require("../parse/ledger/account-info");
|
|
30
31
|
async function getAccountInfo(account, options = {}) {
|
|
31
32
|
const connection = options.connection || Client.findConnection();
|
|
32
33
|
if (!connection) {
|
|
@@ -70,11 +71,15 @@ async function getAccountInfo(account, options = {}) {
|
|
|
70
71
|
return result;
|
|
71
72
|
}
|
|
72
73
|
async function getAccountInfoData(account, options = {}) {
|
|
74
|
+
const formatted = options.formatted === true;
|
|
73
75
|
const response = await getAccountInfo(account, options);
|
|
74
76
|
if ("error" in response) {
|
|
75
77
|
return response;
|
|
76
78
|
}
|
|
77
|
-
|
|
79
|
+
if (formatted) {
|
|
80
|
+
return (0, account_info_1.parseAccountInfoData)(response);
|
|
81
|
+
}
|
|
82
|
+
return response.account_data;
|
|
78
83
|
}
|
|
79
84
|
async function isActivated(account) {
|
|
80
85
|
const response = await getAccountInfo(account);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Connection } from "../connection";
|
|
1
2
|
import { AccountObjectType, AccountObjects, AccountNFTObjectsResponse, AccountURITokensObjectsResponse } from "../models/account_object";
|
|
2
3
|
import { AccountLinesResponse } from "../models/account_lines";
|
|
3
4
|
import { ErrorResponse } from "../models/base_model";
|
|
@@ -8,6 +9,7 @@ export interface GetAccountObjectsOptions {
|
|
|
8
9
|
ledgerIndex?: LedgerIndex;
|
|
9
10
|
limit?: number;
|
|
10
11
|
marker?: string;
|
|
12
|
+
connection?: Connection;
|
|
11
13
|
}
|
|
12
14
|
export declare function getAccountObjects(account: string, options?: GetAccountObjectsOptions): Promise<AccountObjects | ErrorResponse>;
|
|
13
15
|
export interface GetAccountAllObjectsOptions extends GetAccountObjectsOptions {
|
|
@@ -37,7 +37,7 @@ const OBJECTS_LIMIT_MIN = 10;
|
|
|
37
37
|
async function getAccountObjects(account, options = {}) {
|
|
38
38
|
const { hash, marker } = (0, utils_1.parseMarker)(options.marker);
|
|
39
39
|
options.marker = marker;
|
|
40
|
-
const connection = Client.findConnection("account_objects", undefined, undefined, hash);
|
|
40
|
+
const connection = options.connection || Client.findConnection("account_objects", undefined, undefined, hash);
|
|
41
41
|
if (!connection) {
|
|
42
42
|
throw new Error("There is no connection");
|
|
43
43
|
}
|
|
@@ -77,27 +77,29 @@ async function getAccountObjects(account, options = {}) {
|
|
|
77
77
|
return result;
|
|
78
78
|
}
|
|
79
79
|
async function getAccountAllObjects(account, options = {}) {
|
|
80
|
+
const loadOptions = { ...options };
|
|
81
|
+
loadOptions.connection = loadOptions.connection || Client.findConnection("account_objects", undefined, undefined);
|
|
80
82
|
const timeStart = new Date();
|
|
81
|
-
const limit =
|
|
83
|
+
const limit = loadOptions.limit;
|
|
82
84
|
let response;
|
|
83
85
|
const accountObjects = [];
|
|
84
86
|
while (true) {
|
|
85
87
|
const currentTime = new Date();
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
+
if (loadOptions.timeout && currentTime.getTime() - timeStart.getTime() > loadOptions.timeout) {
|
|
89
|
+
loadOptions.timeout = currentTime.getTime() - timeStart.getTime();
|
|
88
90
|
break;
|
|
89
91
|
}
|
|
90
|
-
if (
|
|
92
|
+
if (loadOptions.limit && limit) {
|
|
91
93
|
const left = limit - accountObjects.length;
|
|
92
94
|
const parts = Math.floor(left / OBJECTS_LIMIT_MAX);
|
|
93
95
|
if (parts === 0) {
|
|
94
|
-
|
|
96
|
+
loadOptions.limit = left;
|
|
95
97
|
}
|
|
96
98
|
else {
|
|
97
|
-
|
|
99
|
+
loadOptions.limit = left - OBJECTS_LIMIT_MIN;
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
|
-
response = await getAccountObjects(account,
|
|
102
|
+
response = await getAccountObjects(account, loadOptions);
|
|
101
103
|
if (response.error) {
|
|
102
104
|
return response;
|
|
103
105
|
}
|
|
@@ -107,7 +109,7 @@ async function getAccountAllObjects(account, options = {}) {
|
|
|
107
109
|
break;
|
|
108
110
|
}
|
|
109
111
|
if (response.marker) {
|
|
110
|
-
|
|
112
|
+
loadOptions.marker = response.marker;
|
|
111
113
|
}
|
|
112
114
|
else {
|
|
113
115
|
break;
|
|
@@ -125,6 +127,9 @@ async function getAccountAllObjects(account, options = {}) {
|
|
|
125
127
|
};
|
|
126
128
|
}
|
|
127
129
|
response.account_objects = accountObjects;
|
|
130
|
+
if (!options.hasOwnProperty("limit")) {
|
|
131
|
+
delete response.limit;
|
|
132
|
+
}
|
|
128
133
|
return response;
|
|
129
134
|
}
|
|
130
135
|
async function getAccountLinesObjects(account, options = {}) {
|
package/lib/ledger/currency.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Trustline } from "../models/account_lines";
|
|
2
2
|
import { LedgerIndex } from "../models/ledger";
|
|
3
3
|
import { ErrorResponse } from "../models/base_model";
|
|
4
|
+
import { GatewayBalances } from "../models/gateway_balances";
|
|
5
|
+
import { FormattedGatewayBalances } from "../types";
|
|
4
6
|
export interface GetBalanceSheetOptions {
|
|
5
7
|
ledgerIndex?: LedgerIndex;
|
|
6
8
|
hotwallet?: string;
|
|
7
9
|
strict?: boolean;
|
|
10
|
+
formatted?: boolean;
|
|
8
11
|
}
|
|
9
|
-
export declare function getBalanceSheet(account: string, options?: GetBalanceSheetOptions): Promise<
|
|
12
|
+
export declare function getBalanceSheet(account: string, options?: GetBalanceSheetOptions): Promise<GatewayBalances | FormattedGatewayBalances | ErrorResponse>;
|
|
10
13
|
export interface ObligationTrustline extends Trustline {
|
|
11
14
|
obligation?: boolean;
|
|
12
15
|
}
|
|
@@ -31,7 +31,9 @@ exports.getAccountObligations = getAccountObligations;
|
|
|
31
31
|
const lodash_1 = __importDefault(require("lodash"));
|
|
32
32
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
33
33
|
const Client = __importStar(require("../client"));
|
|
34
|
+
const gateway_balances_1 = require("../parse/ledger/gateway-balances");
|
|
34
35
|
async function getBalanceSheet(account, options = {}) {
|
|
36
|
+
const formatted = options.formatted === true;
|
|
35
37
|
const connection = Client.findConnection("gateway_balances");
|
|
36
38
|
if (!connection) {
|
|
37
39
|
throw new Error("There is no connection");
|
|
@@ -61,7 +63,11 @@ async function getBalanceSheet(account, options = {}) {
|
|
|
61
63
|
validated,
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
|
-
|
|
66
|
+
const result = response.result;
|
|
67
|
+
if (formatted) {
|
|
68
|
+
return (0, gateway_balances_1.parseGatewayBalances)(result);
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
65
71
|
}
|
|
66
72
|
async function getAccountObligations(account) {
|
|
67
73
|
const response = (await getBalanceSheet(account));
|
|
@@ -235,7 +235,7 @@ async function getAccountPaymentParams(account, connection) {
|
|
|
235
235
|
});
|
|
236
236
|
const sequencePromise = new Promise(async (resolve, rejects) => {
|
|
237
237
|
try {
|
|
238
|
-
const accountData = await Client.getAccountInfoData(account, { connection });
|
|
238
|
+
const accountData = (await Client.getAccountInfoData(account, { connection }));
|
|
239
239
|
if (!accountData) {
|
|
240
240
|
return rejects(new Error("Account not found"));
|
|
241
241
|
}
|
|
@@ -256,7 +256,7 @@ async function getAccountPaymentParams(account, connection) {
|
|
|
256
256
|
}
|
|
257
257
|
resolve(undefined);
|
|
258
258
|
}
|
|
259
|
-
catch (
|
|
259
|
+
catch (_err) {
|
|
260
260
|
resolve(undefined);
|
|
261
261
|
}
|
|
262
262
|
});
|
|
@@ -306,7 +306,7 @@ async function getTxSubmitParams(account, tx, definitions, connection, skip) {
|
|
|
306
306
|
if (skip?.sequence !== true) {
|
|
307
307
|
sequencePromise = new Promise(async (resolve, rejects) => {
|
|
308
308
|
try {
|
|
309
|
-
const accountData = await Client.getAccountInfoData(account, { connection });
|
|
309
|
+
const accountData = (await Client.getAccountInfoData(account, { connection }));
|
|
310
310
|
if (!accountData) {
|
|
311
311
|
return rejects(new Error("Account not found"));
|
|
312
312
|
}
|
|
@@ -329,7 +329,7 @@ async function getTxSubmitParams(account, tx, definitions, connection, skip) {
|
|
|
329
329
|
}
|
|
330
330
|
resolve(undefined);
|
|
331
331
|
}
|
|
332
|
-
catch (
|
|
332
|
+
catch (_err) {
|
|
333
333
|
resolve(undefined);
|
|
334
334
|
}
|
|
335
335
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface GatewayBalance {
|
|
2
|
+
currency: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export interface GatewayBalances {
|
|
6
|
+
account: string;
|
|
7
|
+
obligations?: {
|
|
8
|
+
[currency: string]: string;
|
|
9
|
+
};
|
|
10
|
+
balances?: {
|
|
11
|
+
[address: string]: GatewayBalance[];
|
|
12
|
+
};
|
|
13
|
+
assets?: {
|
|
14
|
+
[address: string]: GatewayBalance[];
|
|
15
|
+
};
|
|
16
|
+
ledger_hash?: string;
|
|
17
|
+
ledger_current_index?: number;
|
|
18
|
+
ledger_index?: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseAccountInfoData = parseAccountInfoData;
|
|
4
|
+
const common_1 = require("../../common");
|
|
5
|
+
function parseAccountInfoData(response) {
|
|
6
|
+
const data = response.account_data;
|
|
7
|
+
return (0, common_1.removeUndefined)({
|
|
8
|
+
sequence: data.Sequence,
|
|
9
|
+
xrpBalance: (0, common_1.dropsToXrp)(data.Balance),
|
|
10
|
+
ownerCount: data.OwnerCount,
|
|
11
|
+
previousInitiatedTransactionID: data.AccountTxnID,
|
|
12
|
+
previousAffectingTransactionID: data.PreviousTxnID,
|
|
13
|
+
previousAffectingTransactionLedgerVersion: data.PreviousTxnLgrSeq,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseGatewayBalances = parseGatewayBalances;
|
|
4
|
+
function parseGatewayBalances(balanceSheet) {
|
|
5
|
+
const result = {};
|
|
6
|
+
if (typeof balanceSheet.balances === "object") {
|
|
7
|
+
Object.entries(balanceSheet.balances).forEach((entry) => {
|
|
8
|
+
const [counterparty, balances] = entry;
|
|
9
|
+
balances.forEach((balance) => {
|
|
10
|
+
if (!result.balances) {
|
|
11
|
+
result.balances = [];
|
|
12
|
+
}
|
|
13
|
+
result.balances.push(Object.assign({ counterparty }, balance));
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (typeof balanceSheet.assets === "object") {
|
|
18
|
+
Object.entries(balanceSheet.assets).forEach(([counterparty, assets]) => {
|
|
19
|
+
assets.forEach((balance) => {
|
|
20
|
+
if (!result.assets) {
|
|
21
|
+
result.assets = [];
|
|
22
|
+
}
|
|
23
|
+
result.assets.push(Object.assign({ counterparty }, balance));
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (typeof balanceSheet.obligations === "object") {
|
|
28
|
+
result.obligations = Object.entries(balanceSheet.obligations).map(([currency, value]) => ({ currency, value }));
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
package/lib/types/account.d.ts
CHANGED
|
@@ -13,3 +13,11 @@ export type FormattedDestinationAddress = {
|
|
|
13
13
|
address: string;
|
|
14
14
|
tag?: number;
|
|
15
15
|
};
|
|
16
|
+
export type FormattedAccountInfoData = {
|
|
17
|
+
sequence: number;
|
|
18
|
+
xrpBalance: string;
|
|
19
|
+
ownerCount: number;
|
|
20
|
+
previousInitiatedTransactionID?: string;
|
|
21
|
+
previousAffectingTransactionID: string;
|
|
22
|
+
previousAffectingTransactionLedgerVersion: number;
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormattedIssuedCurrency } from "./amounts";
|
|
2
|
+
type FormattedGatewayBalanceObligations = {
|
|
3
|
+
currency: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export type FormattedGatewayBalances = {
|
|
7
|
+
balances?: FormattedIssuedCurrency[];
|
|
8
|
+
assets?: FormattedIssuedCurrency[];
|
|
9
|
+
obligations?: FormattedGatewayBalanceObligations[];
|
|
10
|
+
};
|
|
11
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
export * from "./account";
|
|
1
2
|
export * from "./adjustments";
|
|
3
|
+
export * from "./amendments";
|
|
2
4
|
export * from "./amounts";
|
|
5
|
+
export * from "./amm";
|
|
6
|
+
export * from "./checks";
|
|
7
|
+
export * from "./deposits";
|
|
8
|
+
export * from "./escrows";
|
|
9
|
+
export * from "./fees";
|
|
10
|
+
export * from "./gateway_balances";
|
|
3
11
|
export * from "./ledger";
|
|
4
12
|
export * from "./ledger_data";
|
|
5
13
|
export * from "./ledger_entries";
|
|
6
14
|
export * from "./memos";
|
|
7
|
-
export * from "./checks";
|
|
8
|
-
export * from "./deposits";
|
|
9
|
-
export * from "./escrows";
|
|
10
15
|
export * from "./offers";
|
|
11
16
|
export * from "./queue_data";
|
|
12
17
|
export * from "./settings";
|
|
@@ -15,11 +20,8 @@ export * from "./transactions";
|
|
|
15
20
|
export * from "./trustlines";
|
|
16
21
|
export * from "./nftokens";
|
|
17
22
|
export * from "./uritokens";
|
|
18
|
-
export * from "./amendments";
|
|
19
|
-
export * from "./fees";
|
|
20
23
|
export * from "./import";
|
|
21
24
|
export * from "./invoke";
|
|
22
25
|
export * from "./unl_reports";
|
|
23
26
|
export * from "./remits";
|
|
24
27
|
export * from "./hooks";
|
|
25
|
-
export * from "./amm";
|
package/lib/types/index.js
CHANGED
|
@@ -14,15 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account"), exports);
|
|
17
18
|
__exportStar(require("./adjustments"), exports);
|
|
19
|
+
__exportStar(require("./amendments"), exports);
|
|
18
20
|
__exportStar(require("./amounts"), exports);
|
|
21
|
+
__exportStar(require("./amm"), exports);
|
|
22
|
+
__exportStar(require("./checks"), exports);
|
|
23
|
+
__exportStar(require("./deposits"), exports);
|
|
24
|
+
__exportStar(require("./escrows"), exports);
|
|
25
|
+
__exportStar(require("./fees"), exports);
|
|
26
|
+
__exportStar(require("./gateway_balances"), exports);
|
|
19
27
|
__exportStar(require("./ledger"), exports);
|
|
20
28
|
__exportStar(require("./ledger_data"), exports);
|
|
21
29
|
__exportStar(require("./ledger_entries"), exports);
|
|
22
30
|
__exportStar(require("./memos"), exports);
|
|
23
|
-
__exportStar(require("./checks"), exports);
|
|
24
|
-
__exportStar(require("./deposits"), exports);
|
|
25
|
-
__exportStar(require("./escrows"), exports);
|
|
26
31
|
__exportStar(require("./offers"), exports);
|
|
27
32
|
__exportStar(require("./queue_data"), exports);
|
|
28
33
|
__exportStar(require("./settings"), exports);
|
|
@@ -31,11 +36,8 @@ __exportStar(require("./transactions"), exports);
|
|
|
31
36
|
__exportStar(require("./trustlines"), exports);
|
|
32
37
|
__exportStar(require("./nftokens"), exports);
|
|
33
38
|
__exportStar(require("./uritokens"), exports);
|
|
34
|
-
__exportStar(require("./amendments"), exports);
|
|
35
|
-
__exportStar(require("./fees"), exports);
|
|
36
39
|
__exportStar(require("./import"), exports);
|
|
37
40
|
__exportStar(require("./invoke"), exports);
|
|
38
41
|
__exportStar(require("./unl_reports"), exports);
|
|
39
42
|
__exportStar(require("./remits"), exports);
|
|
40
43
|
__exportStar(require("./hooks"), exports);
|
|
41
|
-
__exportStar(require("./amm"), exports);
|
package/lib/validator.js
CHANGED
|
@@ -92,7 +92,7 @@ function sign(message, secret) {
|
|
|
92
92
|
const decoded = ripple_address_codec_1.codec.decode(secret, { versions: [0x20] });
|
|
93
93
|
secret = VALIDATOR_HEX_PREFIX_ED25519 + (0, utils_1.bytesToHex)(decoded.bytes.buffer);
|
|
94
94
|
}
|
|
95
|
-
catch (
|
|
95
|
+
catch (_err) {
|
|
96
96
|
}
|
|
97
97
|
return rippleKeypairs.sign(message.toString("hex"), secret).toUpperCase();
|
|
98
98
|
}
|
|
@@ -107,7 +107,7 @@ function verify(message, signature, publicKey) {
|
|
|
107
107
|
try {
|
|
108
108
|
return rippleKeypairs.verify(message.toString("hex"), signature, publicKey);
|
|
109
109
|
}
|
|
110
|
-
catch (
|
|
110
|
+
catch (_err) {
|
|
111
111
|
}
|
|
112
112
|
return false;
|
|
113
113
|
}
|
package/lib/wallet.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bithomp/xrpl-api",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
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,7 +52,7 @@
|
|
|
52
52
|
"lib/**/*"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"axios": "^1.7.
|
|
55
|
+
"axios": "^1.7.7",
|
|
56
56
|
"base-x": "^5.0.0",
|
|
57
57
|
"bignumber.js": "^9.1.2",
|
|
58
58
|
"elliptic": "^6.5.7",
|
|
@@ -62,25 +62,25 @@
|
|
|
62
62
|
"xrpl": "^4.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@types/chai": "^4.3.
|
|
65
|
+
"@types/chai": "^4.3.19",
|
|
66
66
|
"@types/chai-as-promised": "^7.1.8",
|
|
67
67
|
"@types/lodash": "^4.17.7",
|
|
68
68
|
"@types/mocha": "^10.0.7",
|
|
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.4.0",
|
|
72
|
+
"@typescript-eslint/parser": "^8.4.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.
|
|
78
|
+
"eslint-plugin-import": "^2.30.0",
|
|
79
79
|
"eslint-plugin-n": "^17.10.2",
|
|
80
80
|
"eslint-plugin-promise": "^7.1.0",
|
|
81
81
|
"mocha": "^10.7.3",
|
|
82
82
|
"nconf": "^0.12.1",
|
|
83
|
-
"ts-jest": "^29.2.
|
|
83
|
+
"ts-jest": "^29.2.5",
|
|
84
84
|
"ts-node": "^10.9.2",
|
|
85
85
|
"typescript": "^5.4.5"
|
|
86
86
|
}
|