@pioneer-platform/ripple-network 8.11.18 → 8.12.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +29 -0
- package/lib/index.d.ts +9 -1
- package/lib/index.js +87 -11
- package/package.json +7 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @pioneer-platform/ripple-network@8.
|
|
3
|
+
> @pioneer-platform/ripple-network@8.12.0 build /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/modules/coins/ripple/ripple-network
|
|
4
4
|
> tsc -p .
|
|
5
5
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @pioneer-platform/ripple-network
|
|
2
2
|
|
|
3
|
+
## 8.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat(monorepo): production release preparation with strict TypeScript and enhanced swap functionality
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @pioneer-platform/pioneer-nodes@8.31.0
|
|
13
|
+
|
|
14
|
+
## 8.11.21
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- @pioneer-platform/pioneer-nodes@8.30.4
|
|
19
|
+
|
|
20
|
+
## 8.11.20
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- chore: chore: - Services (discovery-service, watchtower)
|
|
25
|
+
|
|
26
|
+
## 8.11.19
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- fa09397: chore: - Services (discovery-service, watchtower)
|
|
31
|
+
|
|
3
32
|
## 8.11.18
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ declare const axiosLib: any;
|
|
|
3
3
|
declare const Axios: any;
|
|
4
4
|
declare const https: any;
|
|
5
5
|
declare const log: any;
|
|
6
|
-
declare const
|
|
6
|
+
declare const blockbooks: any;
|
|
7
|
+
declare const getXrpNode: () => any;
|
|
8
|
+
declare const URL_NODE: any;
|
|
7
9
|
declare const axios: any;
|
|
8
10
|
/**********************************
|
|
9
11
|
// Implementation Functions
|
|
@@ -11,6 +13,12 @@ declare const axios: any;
|
|
|
11
13
|
declare let broadcast_transaction: (tx: string) => Promise<any>;
|
|
12
14
|
declare let get_account_info: (address: string) => Promise<any>;
|
|
13
15
|
declare let get_balance: (address: string) => Promise<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Get a specific transaction by hash
|
|
18
|
+
* @param txHash - Transaction hash
|
|
19
|
+
* @returns Transaction details with ledger information
|
|
20
|
+
*/
|
|
21
|
+
declare let get_transaction: (txHash: string) => Promise<any>;
|
|
14
22
|
/**
|
|
15
23
|
* Get transaction history for XRP address
|
|
16
24
|
* @param address - XRP address (rXXXXXX...)
|
package/lib/index.js
CHANGED
|
@@ -51,8 +51,22 @@ var axiosLib = require('axios');
|
|
|
51
51
|
var Axios = axiosLib.default || axiosLib;
|
|
52
52
|
var https = require('https');
|
|
53
53
|
var log = require('@pioneer-platform/loggerdog')();
|
|
54
|
-
//
|
|
55
|
-
var
|
|
54
|
+
// Import node configuration from pioneer-nodes (centralized architecture)
|
|
55
|
+
var blockbooks = require('@pioneer-platform/pioneer-nodes').blockbooks;
|
|
56
|
+
// Get XRP node from pioneer-nodes
|
|
57
|
+
var getXrpNode = function () {
|
|
58
|
+
var xrpNode = blockbooks.find(function (n) { return n.symbol === 'XRP'; });
|
|
59
|
+
if (!xrpNode) {
|
|
60
|
+
throw new Error('XRP node not configured in pioneer-nodes');
|
|
61
|
+
}
|
|
62
|
+
// Replace {API_KEY} placeholder with actual API key from env
|
|
63
|
+
var apiKey = process.env.NOW_NODES_API || process.env.NOWNODES_API_KEY;
|
|
64
|
+
if (!apiKey) {
|
|
65
|
+
throw new Error('NOW_NODES_API environment variable is required');
|
|
66
|
+
}
|
|
67
|
+
return xrpNode.service.replace('{API_KEY}', apiKey);
|
|
68
|
+
};
|
|
69
|
+
var URL_NODE = getXrpNode();
|
|
56
70
|
// Create axios instance - API key will be added per request
|
|
57
71
|
var axios = Axios.create({
|
|
58
72
|
httpsAgent: new https.Agent({
|
|
@@ -77,12 +91,13 @@ module.exports = {
|
|
|
77
91
|
_b.label = 1;
|
|
78
92
|
case 1:
|
|
79
93
|
_b.trys.push([1, 3, , 4]);
|
|
80
|
-
NOWNODES_API_KEY = process.env
|
|
94
|
+
NOWNODES_API_KEY = process.env.NOW_NODES_API || process.env.NOWNODES_API_KEY;
|
|
81
95
|
if (!NOWNODES_API_KEY) {
|
|
82
96
|
throw new Error("NOW_NODES_API environment variable is required");
|
|
83
97
|
}
|
|
84
98
|
log.info(tag, "Initializing Ripple network with NowNodes...");
|
|
85
99
|
log.info(tag, "HTTP Endpoint:", URL_NODE);
|
|
100
|
+
log.info(tag, "Using centralized node config from pioneer-nodes");
|
|
86
101
|
// For now, let's skip WebSocket connection and use HTTP-only mode
|
|
87
102
|
// This is because NowNodes WebSocket might have different authentication requirements
|
|
88
103
|
log.info(tag, "Using HTTP-only mode for NowNodes compatibility");
|
|
@@ -144,6 +159,9 @@ module.exports = {
|
|
|
144
159
|
getTransactions: function (address, options) {
|
|
145
160
|
return get_transactions(address, options);
|
|
146
161
|
},
|
|
162
|
+
getTransaction: function (txHash) {
|
|
163
|
+
return get_transaction(txHash);
|
|
164
|
+
},
|
|
147
165
|
getBlockHeight: function () {
|
|
148
166
|
return get_block_height();
|
|
149
167
|
},
|
|
@@ -358,6 +376,64 @@ var get_balance = function (address) {
|
|
|
358
376
|
});
|
|
359
377
|
});
|
|
360
378
|
};
|
|
379
|
+
/**
|
|
380
|
+
* Get a specific transaction by hash
|
|
381
|
+
* @param txHash - Transaction hash
|
|
382
|
+
* @returns Transaction details with ledger information
|
|
383
|
+
*/
|
|
384
|
+
var get_transaction = function (txHash) {
|
|
385
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
386
|
+
var tag, NOWNODES_API_KEY, response, error, errorMsg, e_5;
|
|
387
|
+
return __generator(this, function (_a) {
|
|
388
|
+
switch (_a.label) {
|
|
389
|
+
case 0:
|
|
390
|
+
tag = TAG + " | get_transaction | ";
|
|
391
|
+
_a.label = 1;
|
|
392
|
+
case 1:
|
|
393
|
+
_a.trys.push([1, 3, , 4]);
|
|
394
|
+
log.debug(tag, "Getting transaction:", txHash);
|
|
395
|
+
NOWNODES_API_KEY = process.env['NOW_NODES_API'];
|
|
396
|
+
return [4 /*yield*/, axios({
|
|
397
|
+
url: URL_NODE,
|
|
398
|
+
method: 'POST',
|
|
399
|
+
data: {
|
|
400
|
+
"method": "tx",
|
|
401
|
+
"params": [{
|
|
402
|
+
"transaction": txHash,
|
|
403
|
+
"binary": false
|
|
404
|
+
}]
|
|
405
|
+
},
|
|
406
|
+
headers: {
|
|
407
|
+
'Content-Type': 'application/json',
|
|
408
|
+
'api-key': NOWNODES_API_KEY
|
|
409
|
+
}
|
|
410
|
+
})];
|
|
411
|
+
case 2:
|
|
412
|
+
response = _a.sent();
|
|
413
|
+
log.debug(tag, "Transaction response:", response.data);
|
|
414
|
+
// Check for error in response
|
|
415
|
+
if (response.data && response.data.result && response.data.result.error) {
|
|
416
|
+
error = response.data.result.error;
|
|
417
|
+
errorMsg = response.data.result.error_message || error;
|
|
418
|
+
if (error === 'txnNotFound') {
|
|
419
|
+
log.debug(tag, 'Transaction not found:', txHash);
|
|
420
|
+
return [2 /*return*/, null];
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
throw new Error("XRP API error: ".concat(errorMsg));
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
// Return the transaction result
|
|
427
|
+
return [2 /*return*/, response.data.result];
|
|
428
|
+
case 3:
|
|
429
|
+
e_5 = _a.sent();
|
|
430
|
+
log.error(tag, 'Failed to fetch XRP transaction:', e_5.message);
|
|
431
|
+
throw e_5;
|
|
432
|
+
case 4: return [2 /*return*/];
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
};
|
|
361
437
|
/**
|
|
362
438
|
* Get transaction history for XRP address
|
|
363
439
|
* @param address - XRP address (rXXXXXX...)
|
|
@@ -366,7 +442,7 @@ var get_balance = function (address) {
|
|
|
366
442
|
*/
|
|
367
443
|
var get_transactions = function (address_1) {
|
|
368
444
|
return __awaiter(this, arguments, void 0, function (address, options) {
|
|
369
|
-
var tag, limit, NOWNODES_API_KEY, params, response, error, errorCode, errorMsg, transactions,
|
|
445
|
+
var tag, limit, NOWNODES_API_KEY, params, response, error, errorCode, errorMsg, transactions, e_6;
|
|
370
446
|
var _a, _b;
|
|
371
447
|
if (options === void 0) { options = {}; }
|
|
372
448
|
return __generator(this, function (_c) {
|
|
@@ -426,9 +502,9 @@ var get_transactions = function (address_1) {
|
|
|
426
502
|
log.info(tag, "Fetched ".concat(transactions.length, " XRP transactions"));
|
|
427
503
|
return [2 /*return*/, transactions];
|
|
428
504
|
case 3:
|
|
429
|
-
|
|
430
|
-
log.error(tag, 'Failed to fetch XRP transactions:',
|
|
431
|
-
throw
|
|
505
|
+
e_6 = _c.sent();
|
|
506
|
+
log.error(tag, 'Failed to fetch XRP transactions:', e_6.message);
|
|
507
|
+
throw e_6;
|
|
432
508
|
case 4: return [2 /*return*/];
|
|
433
509
|
}
|
|
434
510
|
});
|
|
@@ -440,7 +516,7 @@ var get_transactions = function (address_1) {
|
|
|
440
516
|
*/
|
|
441
517
|
var get_block_height = function () {
|
|
442
518
|
return __awaiter(this, void 0, void 0, function () {
|
|
443
|
-
var tag, NOWNODES_API_KEY, response, ledgerIndex,
|
|
519
|
+
var tag, NOWNODES_API_KEY, response, ledgerIndex, e_7;
|
|
444
520
|
var _a, _b, _c, _d, _e;
|
|
445
521
|
return __generator(this, function (_f) {
|
|
446
522
|
switch (_f.label) {
|
|
@@ -475,9 +551,9 @@ var get_block_height = function () {
|
|
|
475
551
|
log.debug(tag, "Current ledger index:", ledgerIndex);
|
|
476
552
|
return [2 /*return*/, parseInt(ledgerIndex)];
|
|
477
553
|
case 3:
|
|
478
|
-
|
|
479
|
-
log.error(tag, "Error getting ledger index:",
|
|
480
|
-
throw
|
|
554
|
+
e_7 = _f.sent();
|
|
555
|
+
log.error(tag, "Error getting ledger index:", e_7.message);
|
|
556
|
+
throw e_7;
|
|
481
557
|
case 4: return [2 /*return*/];
|
|
482
558
|
}
|
|
483
559
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/ripple-network",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"description": "Pioneer Platform Ripple Network module with NowNodes integration",
|
|
@@ -17,9 +17,14 @@
|
|
|
17
17
|
"prettyjson": "^1.2.1",
|
|
18
18
|
"ts-node": "^10.9.0",
|
|
19
19
|
"typescript": "^5.0.4",
|
|
20
|
-
"@pioneer-platform/loggerdog": "8.11.0"
|
|
20
|
+
"@pioneer-platform/loggerdog": "8.11.0",
|
|
21
|
+
"@pioneer-platform/pioneer-nodes": "8.31.0"
|
|
21
22
|
},
|
|
22
23
|
"gitHead": "aeae28273014ab69b42f22abec159c6693a56c40",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^18.16.0",
|
|
26
|
+
"typescript": "^5.0.4"
|
|
27
|
+
},
|
|
23
28
|
"scripts": {
|
|
24
29
|
"create": "pnpm run build && pnpm run test",
|
|
25
30
|
"build": "tsc -p .",
|