@pioneer-platform/ripple-network 8.1.37
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/index.d.ts +25 -0
- package/lib/index.js +471 -0
- package/package.json +32 -0
- package/tsconfig.json +13 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const TAG = " | thorchain-api | ";
|
|
2
|
+
declare const prettyjson: any;
|
|
3
|
+
declare const Axios: any;
|
|
4
|
+
declare const https: any;
|
|
5
|
+
declare const axios: any;
|
|
6
|
+
declare const axiosRetry: any;
|
|
7
|
+
declare const xrpl: any;
|
|
8
|
+
declare const log: any;
|
|
9
|
+
declare let URL_THORNODE: string;
|
|
10
|
+
declare let BASE_THOR: number;
|
|
11
|
+
/**********************************
|
|
12
|
+
// Module
|
|
13
|
+
//**********************************/
|
|
14
|
+
declare let client: {
|
|
15
|
+
connect: () => any;
|
|
16
|
+
request: (arg0: {
|
|
17
|
+
command: string;
|
|
18
|
+
account: string;
|
|
19
|
+
ledger_index: string;
|
|
20
|
+
}) => any;
|
|
21
|
+
};
|
|
22
|
+
/**********************************
|
|
23
|
+
// Lib
|
|
24
|
+
//**********************************/
|
|
25
|
+
declare let get_balance: (address: string) => Promise<number>;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/*
|
|
39
|
+
const thorMainnetClient: CosmosSDKClient = new CosmosSDKClient({
|
|
40
|
+
server: 'http://104.248.96.152:1317',
|
|
41
|
+
chainId: 'thorchain',
|
|
42
|
+
prefix: 'thor',
|
|
43
|
+
derive_path: "44'/931'/0'/0/0",
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
get nodes
|
|
48
|
+
curl https://testnet-seed.thorchain.info
|
|
49
|
+
|
|
50
|
+
//testnet
|
|
51
|
+
https://main.d3mbd42yfy75lz.amplifyapp.com/#/nodes
|
|
52
|
+
|
|
53
|
+
*/
|
|
54
|
+
var TAG = " | thorchain-api | ";
|
|
55
|
+
var prettyjson = require('prettyjson');
|
|
56
|
+
require("dotenv").config({ path: '../../../.env' });
|
|
57
|
+
var Axios = require('axios');
|
|
58
|
+
var https = require('https');
|
|
59
|
+
var axios = Axios.create({
|
|
60
|
+
httpsAgent: new https.Agent({
|
|
61
|
+
rejectUnauthorized: false
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
var axiosRetry = require('axios-retry');
|
|
65
|
+
axiosRetry(axios, {
|
|
66
|
+
retries: 3,
|
|
67
|
+
retryDelay: function (retryCount) {
|
|
68
|
+
console.log("retry attempt: ".concat(retryCount));
|
|
69
|
+
return retryCount * 2000; // time interval between retries
|
|
70
|
+
},
|
|
71
|
+
retryCondition: function (error) {
|
|
72
|
+
console.error(error);
|
|
73
|
+
// if retry condition is not specified, by default idempotent requests are retried
|
|
74
|
+
return error.response.status === 503;
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
var xrpl = require("xrpl");
|
|
78
|
+
var log = require('@pioneer-platform/loggerdog')();
|
|
79
|
+
var URL_THORNODE = process.env['URL_THORNODE'] || 'https://thornode.ninerealms.com';
|
|
80
|
+
//let URL_MIDGARD = process.env['URL_THORNODE'] || 'https://testnet.midgard.thorchain.info/v2'
|
|
81
|
+
var BASE_THOR = 100000000;
|
|
82
|
+
/**********************************
|
|
83
|
+
// Module
|
|
84
|
+
//**********************************/
|
|
85
|
+
var client;
|
|
86
|
+
module.exports = {
|
|
87
|
+
init: function (url, settings) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
client = new xrpl.Client("wss://s.altnet.rippletest.net:51233");
|
|
93
|
+
return [4 /*yield*/, client.connect()];
|
|
94
|
+
case 1:
|
|
95
|
+
_a.sent();
|
|
96
|
+
return [2 /*return*/, true];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
isOnline: function () {
|
|
102
|
+
return true;
|
|
103
|
+
},
|
|
104
|
+
// info:function () {
|
|
105
|
+
// return get_node_info_verbose();
|
|
106
|
+
// },
|
|
107
|
+
getBalance: function (address) {
|
|
108
|
+
return get_balance(address);
|
|
109
|
+
},
|
|
110
|
+
// getAccount:function (address:string) {
|
|
111
|
+
// return get_account_info(address);
|
|
112
|
+
// },
|
|
113
|
+
// getLastBlock:function () {
|
|
114
|
+
// return get_last_block();
|
|
115
|
+
// },
|
|
116
|
+
// getBlockHeight:function () {
|
|
117
|
+
// return get_block_height();
|
|
118
|
+
// },
|
|
119
|
+
// getAccountInfo:function (address:string) {
|
|
120
|
+
// return get_account_info(address);
|
|
121
|
+
// },
|
|
122
|
+
// txs: function (address:string) {
|
|
123
|
+
// return get_txs_by_address(address);
|
|
124
|
+
// },
|
|
125
|
+
// getTransaction: function (txid:string) {
|
|
126
|
+
// return get_transaction(txid);
|
|
127
|
+
// },
|
|
128
|
+
// transaction: function (txid:string) {
|
|
129
|
+
// return get_transaction(txid);
|
|
130
|
+
// },
|
|
131
|
+
// broadcast: function (tx:string) {
|
|
132
|
+
// return broadcast_transaction(tx);
|
|
133
|
+
// },
|
|
134
|
+
};
|
|
135
|
+
/**********************************
|
|
136
|
+
// Lib
|
|
137
|
+
//**********************************/
|
|
138
|
+
// let get_last_block = async function(){
|
|
139
|
+
// let tag = TAG + " | get_last_block | "
|
|
140
|
+
// try{
|
|
141
|
+
//
|
|
142
|
+
// let lastBlock = await axios({method:'GET',url: URL_THORNODE+'/blocks/latest'})
|
|
143
|
+
// log.debug(tag,"lastBlock: ",lastBlock.data)
|
|
144
|
+
//
|
|
145
|
+
// return lastBlock.data.block
|
|
146
|
+
// }catch(e){
|
|
147
|
+
// log.error(tag,"e: ",e)
|
|
148
|
+
// throw e
|
|
149
|
+
// }
|
|
150
|
+
// }
|
|
151
|
+
//
|
|
152
|
+
// let get_block_height = async function(){
|
|
153
|
+
// let tag = TAG + " | get_block_height | "
|
|
154
|
+
// try{
|
|
155
|
+
//
|
|
156
|
+
// let lastBlock = await axios({method:'GET',url: URL_THORNODE+'/blocks/latest'})
|
|
157
|
+
// log.debug(tag,"lastBlock: ",lastBlock.data)
|
|
158
|
+
//
|
|
159
|
+
// return lastBlock.data.block.header.height
|
|
160
|
+
// }catch(e){
|
|
161
|
+
// log.error(tag,"e: ",e)
|
|
162
|
+
// throw e
|
|
163
|
+
// }
|
|
164
|
+
// }
|
|
165
|
+
//
|
|
166
|
+
// let get_transaction = async function(txid:string){
|
|
167
|
+
// let tag = TAG + " | get_transaction | "
|
|
168
|
+
// try{
|
|
169
|
+
// let txInfo = await axios({method:'GET',url: URL_THORNODE+'/txs/'+txid})
|
|
170
|
+
// log.debug(tag,"txInfo: ",txInfo.data)
|
|
171
|
+
// return txInfo.data
|
|
172
|
+
// }catch(e){
|
|
173
|
+
// // log.error(tag,e.response.data)
|
|
174
|
+
// // log.error(tag,e.response.data.error)
|
|
175
|
+
// if(e.response.status === 404){
|
|
176
|
+
// let output:any = {}
|
|
177
|
+
// output.success = false
|
|
178
|
+
// output.error = e.response.data.error
|
|
179
|
+
// return output
|
|
180
|
+
// } else {
|
|
181
|
+
// throw Error(e)
|
|
182
|
+
// }
|
|
183
|
+
// }
|
|
184
|
+
// }
|
|
185
|
+
//
|
|
186
|
+
// let broadcast_transaction = async function(tx:string){
|
|
187
|
+
// let tag = TAG + " | broadcast_transaction | "
|
|
188
|
+
// let output:any = {}
|
|
189
|
+
// try{
|
|
190
|
+
// log.debug(tag,"CHECKPOINT 1")
|
|
191
|
+
//
|
|
192
|
+
// output.success = false
|
|
193
|
+
//
|
|
194
|
+
//
|
|
195
|
+
// try{
|
|
196
|
+
// // let payload = {
|
|
197
|
+
// // // "tx_bytes": btoa(tx),
|
|
198
|
+
// // // "tx_bytes":broadcastTx,
|
|
199
|
+
// // "tx_bytes":tx,
|
|
200
|
+
// // "mode": "BROADCAST_MODE_SYNC"
|
|
201
|
+
// // }
|
|
202
|
+
// //
|
|
203
|
+
// // let urlRemote = URL_THORNODE+ '/cosmos/tx/v1beta1/txs'
|
|
204
|
+
// // // let urlRemote = URL_GAIAD+ '/txs'
|
|
205
|
+
// // log.info(tag,"urlRemote: ",urlRemote)
|
|
206
|
+
// // let result2 = await axios({
|
|
207
|
+
// // url: urlRemote,
|
|
208
|
+
// // headers: {
|
|
209
|
+
// // 'api-key': process.env['NOW_NODES_API'],
|
|
210
|
+
// // 'Content-Type': 'application/json'
|
|
211
|
+
// // },
|
|
212
|
+
// // method: 'POST',
|
|
213
|
+
// // data: payload,
|
|
214
|
+
// // })
|
|
215
|
+
// // log.info(tag,'** Broadcast ** REMOTE: result: ', result2.data)
|
|
216
|
+
// // log.info(tag,'** Broadcast ** REMOTE: result: ', JSON.stringify(result2.data))
|
|
217
|
+
// // if(result2.data.txhash) output.txid = result2.data.txhash
|
|
218
|
+
//
|
|
219
|
+
// //push to seed
|
|
220
|
+
// let urlRemote = URL_THORNODE+ '/txs'
|
|
221
|
+
// log.debug(tag,"urlRemote: ",urlRemote)
|
|
222
|
+
// let result2 = await axios({
|
|
223
|
+
// url: urlRemote,
|
|
224
|
+
// method: 'POST',
|
|
225
|
+
// data: tx,
|
|
226
|
+
// })
|
|
227
|
+
// log.debug(tag,'** Broadcast ** REMOTE: result: ', result2.data)
|
|
228
|
+
// if(result2 && result2.data && result2.data.txhash) output.txid = result2.data.txhash
|
|
229
|
+
//
|
|
230
|
+
// //verify success
|
|
231
|
+
// if(result2.data.raw_log && result2.data.raw_log !== '[]'){
|
|
232
|
+
// let logSend = result2.data.raw_log
|
|
233
|
+
// log.info(tag,"logSend: ",logSend)
|
|
234
|
+
// output.success = false
|
|
235
|
+
// output.error = logSend
|
|
236
|
+
// } else {
|
|
237
|
+
// output.success = true
|
|
238
|
+
// }
|
|
239
|
+
// output.height = result2.height
|
|
240
|
+
// output.gas_wanted = result2.gas_wanted
|
|
241
|
+
// output.gas_used = result2.gas_used
|
|
242
|
+
// output.raw = result2.data
|
|
243
|
+
//
|
|
244
|
+
// }catch(e){
|
|
245
|
+
// //log.error(tag,"failed second broadcast e: ",e.response)
|
|
246
|
+
// log.error(tag,e)
|
|
247
|
+
// log.error(tag,e.response)
|
|
248
|
+
// log.error(tag,e.response.data)
|
|
249
|
+
// log.error(tag,e.response.data.error)
|
|
250
|
+
// log.error(tag,e.response.data.error.indexOf('RPC error -32603 - Internal error: Tx already exists in cache'))
|
|
251
|
+
// //throw e
|
|
252
|
+
//
|
|
253
|
+
// output.success = false
|
|
254
|
+
// output.error = e.response.data.error
|
|
255
|
+
//
|
|
256
|
+
// }
|
|
257
|
+
// return output
|
|
258
|
+
// }catch(e){
|
|
259
|
+
//
|
|
260
|
+
// console.error(tag,"throw error: ",e)
|
|
261
|
+
// return output
|
|
262
|
+
//
|
|
263
|
+
// }
|
|
264
|
+
// }
|
|
265
|
+
//
|
|
266
|
+
// let get_account_info = async function(address:string){
|
|
267
|
+
// let tag = TAG + " | get_account_info | "
|
|
268
|
+
// try{
|
|
269
|
+
// //
|
|
270
|
+
// console.log("URL ",URL_THORNODE+'/auth/accounts/'+address)
|
|
271
|
+
// let txInfo = await axios({method:'GET',url: URL_THORNODE+'/auth/accounts/'+address})
|
|
272
|
+
// log.debug(tag,"txInfo: ",txInfo.data)
|
|
273
|
+
//
|
|
274
|
+
// return txInfo.data
|
|
275
|
+
// }catch(e){
|
|
276
|
+
// log.error(tag,"e: ",e)
|
|
277
|
+
// throw e
|
|
278
|
+
// }
|
|
279
|
+
// }
|
|
280
|
+
//
|
|
281
|
+
// let normalize_tx = function(tx:any,address?:string){
|
|
282
|
+
// let tag = TAG + " | normalize_tx | "
|
|
283
|
+
// try{
|
|
284
|
+
// let output:any = {}
|
|
285
|
+
//
|
|
286
|
+
// let sender
|
|
287
|
+
// let receiver
|
|
288
|
+
// let memo
|
|
289
|
+
// let amount
|
|
290
|
+
//
|
|
291
|
+
// let rawlog = JSON.parse(tx.raw_log)
|
|
292
|
+
// rawlog = rawlog
|
|
293
|
+
// //log.debug("rawlog: ",rawlog)
|
|
294
|
+
//
|
|
295
|
+
// //txTypes
|
|
296
|
+
// let txTypes = [
|
|
297
|
+
// 'send',
|
|
298
|
+
// 'receive',
|
|
299
|
+
// 'governence',
|
|
300
|
+
// 'swap',
|
|
301
|
+
// 'other'
|
|
302
|
+
// ]
|
|
303
|
+
//
|
|
304
|
+
// for(let i = 0; i < rawlog.length; i++){
|
|
305
|
+
// let txEvents = rawlog[i]
|
|
306
|
+
//
|
|
307
|
+
// //log.debug(tag,"txEvents: ",txEvents)
|
|
308
|
+
// txEvents = txEvents.events
|
|
309
|
+
//
|
|
310
|
+
// for(let j = 0; j < txEvents.length; j++){
|
|
311
|
+
// let event = txEvents[j]
|
|
312
|
+
//
|
|
313
|
+
// //
|
|
314
|
+
// //log.debug(tag,"event: ",event)
|
|
315
|
+
// //log.debug(tag,"attributes: ",prettyjson.render(event.attributes))
|
|
316
|
+
//
|
|
317
|
+
// //detect event type
|
|
318
|
+
// log.debug(tag,"type: ",event.type)
|
|
319
|
+
// switch(event.type) {
|
|
320
|
+
// case 'message':
|
|
321
|
+
// // ignore
|
|
322
|
+
// break;
|
|
323
|
+
// case 'transfer':
|
|
324
|
+
// log.debug(tag,"attributes: ",event.attributes)
|
|
325
|
+
// for(let k = 0; k < event.attributes.length; k++){
|
|
326
|
+
// let attribute = event.attributes[k]
|
|
327
|
+
// if(attribute.key === 'recipient'){
|
|
328
|
+
// receiver = attribute.value
|
|
329
|
+
// output.receiver = receiver
|
|
330
|
+
// if(receiver === address) output.type = txTypes[1]
|
|
331
|
+
// }
|
|
332
|
+
// if(attribute.key === 'sender'){
|
|
333
|
+
// sender = attribute.value
|
|
334
|
+
// output.sender = sender
|
|
335
|
+
// if(sender === address) output.type = txTypes[0]
|
|
336
|
+
// }
|
|
337
|
+
// if(attribute.key === 'amount'){
|
|
338
|
+
// amount = attribute.value
|
|
339
|
+
// amount = amount.replace('rune','')
|
|
340
|
+
// output.amount = amount / 100000000
|
|
341
|
+
// }
|
|
342
|
+
// }
|
|
343
|
+
// break;
|
|
344
|
+
// default:
|
|
345
|
+
// // code block
|
|
346
|
+
// }
|
|
347
|
+
// }
|
|
348
|
+
//
|
|
349
|
+
// // console.log("log: ",prettyjson.render(log))
|
|
350
|
+
// }
|
|
351
|
+
//
|
|
352
|
+
// return output
|
|
353
|
+
// }catch(e){
|
|
354
|
+
// log.error(tag,"e: ",e)
|
|
355
|
+
// throw e
|
|
356
|
+
// }
|
|
357
|
+
// }
|
|
358
|
+
//
|
|
359
|
+
// let get_txs_by_address = async function(address:string){
|
|
360
|
+
// let tag = TAG + " | get_txs_by_address | "
|
|
361
|
+
// try{
|
|
362
|
+
// let output:any = []
|
|
363
|
+
//
|
|
364
|
+
// //sends
|
|
365
|
+
// let url = URL_THORNODE+ '/txs?message.sender='+address
|
|
366
|
+
// log.debug(tag,"url: ",url)
|
|
367
|
+
// let resultSends = await axios({
|
|
368
|
+
// url: url,
|
|
369
|
+
// method: 'GET'
|
|
370
|
+
// })
|
|
371
|
+
// let sends = resultSends.data
|
|
372
|
+
// log.debug('sends: ', sends)
|
|
373
|
+
// if(!sends.txs) sends.txs = []
|
|
374
|
+
// // TODO//pagnation
|
|
375
|
+
// for(let i = 0; i < sends?.txs.length; i++ ){
|
|
376
|
+
// let tx = sends.txs[i]
|
|
377
|
+
//
|
|
378
|
+
// //pretty json
|
|
379
|
+
//
|
|
380
|
+
// //normalize
|
|
381
|
+
// tx = normalize_tx(tx,address)
|
|
382
|
+
// output.push(tx)
|
|
383
|
+
// }
|
|
384
|
+
//
|
|
385
|
+
// //receives
|
|
386
|
+
// url = URL_THORNODE+ '/txs?transfer.recipient='+address
|
|
387
|
+
// console.log("URL_THORNODE: ",url)
|
|
388
|
+
// let resultRecieves = await axios({
|
|
389
|
+
// url: url,
|
|
390
|
+
// method: 'GET'
|
|
391
|
+
// })
|
|
392
|
+
// let receives = resultRecieves.data
|
|
393
|
+
// if(!receives.txs) receives.txs = []
|
|
394
|
+
// log.debug('receives: ', receives)
|
|
395
|
+
//
|
|
396
|
+
// for(let i = 0; i < receives?.txs.length; i++ ){
|
|
397
|
+
// let tx = receives.txs[i]
|
|
398
|
+
// //normalize
|
|
399
|
+
// tx = normalize_tx(tx,address)
|
|
400
|
+
// output.push(tx)
|
|
401
|
+
// }
|
|
402
|
+
//
|
|
403
|
+
//
|
|
404
|
+
// return output
|
|
405
|
+
// }catch(e){
|
|
406
|
+
// log.error(tag,"e: ",e)
|
|
407
|
+
// throw e
|
|
408
|
+
// }
|
|
409
|
+
// }
|
|
410
|
+
var get_balance = function (address) {
|
|
411
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
412
|
+
var tag, output, response, e_1;
|
|
413
|
+
return __generator(this, function (_a) {
|
|
414
|
+
switch (_a.label) {
|
|
415
|
+
case 0:
|
|
416
|
+
tag = TAG + " | get_balance | ";
|
|
417
|
+
_a.label = 1;
|
|
418
|
+
case 1:
|
|
419
|
+
_a.trys.push([1, 3, , 4]);
|
|
420
|
+
output = 0;
|
|
421
|
+
return [4 /*yield*/, client.request({
|
|
422
|
+
"command": "account_info",
|
|
423
|
+
"account": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
|
|
424
|
+
"ledger_index": "validated"
|
|
425
|
+
})];
|
|
426
|
+
case 2:
|
|
427
|
+
response = _a.sent();
|
|
428
|
+
console.log(response);
|
|
429
|
+
return [2 /*return*/, output];
|
|
430
|
+
case 3:
|
|
431
|
+
e_1 = _a.sent();
|
|
432
|
+
log.error(tag, "e: ", e_1);
|
|
433
|
+
throw e_1;
|
|
434
|
+
case 4: return [2 /*return*/];
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
// let get_node_info_verbose = async function(){
|
|
440
|
+
// let tag = TAG + " | get_node_info | "
|
|
441
|
+
// try{
|
|
442
|
+
// let output:any = {}
|
|
443
|
+
//
|
|
444
|
+
// //get syncing status
|
|
445
|
+
// let syncInfo = await axios({method:'GET',url: URL_THORNODE+'/syncing'})
|
|
446
|
+
// log.debug(tag,"syncInfo: ",syncInfo.data)
|
|
447
|
+
//
|
|
448
|
+
// output.isSyncing = syncInfo.data
|
|
449
|
+
//
|
|
450
|
+
// //gaiad abci_info
|
|
451
|
+
// let nodeInfo = await axios({method:'GET',url: URL_THORNODE+'/node_info'})
|
|
452
|
+
// log.debug(tag,"nodeInfo: ",nodeInfo.data)
|
|
453
|
+
// output = nodeInfo.data
|
|
454
|
+
//
|
|
455
|
+
// // let network = await axios({method:'GET',url: URL_THORNODE+'/network'})
|
|
456
|
+
// // log.debug(tag,"nodeInfo: ",network.data)
|
|
457
|
+
// // output.network = network.data
|
|
458
|
+
//
|
|
459
|
+
//
|
|
460
|
+
// let lastBlock = await axios({method:'GET',url: URL_THORNODE+'/blocks/latest'})
|
|
461
|
+
// log.debug(tag,"lastBlock: ",lastBlock.data)
|
|
462
|
+
//
|
|
463
|
+
// //let height
|
|
464
|
+
// output.height = lastBlock.data.block.header.height
|
|
465
|
+
//
|
|
466
|
+
// return output
|
|
467
|
+
// }catch(e){
|
|
468
|
+
// log.error(tag,"e: ",e)
|
|
469
|
+
// throw e
|
|
470
|
+
// }
|
|
471
|
+
// }
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pioneer-platform/ripple-network",
|
|
3
|
+
"version": "8.1.37",
|
|
4
|
+
"main": "./lib/index.js",
|
|
5
|
+
"types": "./lib/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"create": "npm run build && npm run test",
|
|
8
|
+
"build": "tsc -p .",
|
|
9
|
+
"test": "npm run build && node __tests__/test-module.js",
|
|
10
|
+
"prepublish": "rm -R lib && npm run build",
|
|
11
|
+
"refresh": "rm -rf ./node_modules ./package-lock.json && npm install"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@pioneer-platform/loggerdog": "^8.1.17",
|
|
15
|
+
"axios-retry": "^3.3.1",
|
|
16
|
+
"bech32": "^1.1.4",
|
|
17
|
+
"bip32": "^2.0.5",
|
|
18
|
+
"bip39": "^3.0.2",
|
|
19
|
+
"bitcoinjs-lib": "^5.1.10",
|
|
20
|
+
"coininfo": "^5.1.0",
|
|
21
|
+
"cosmos-client": "^0.40.0-rc1",
|
|
22
|
+
"crypto-js": "^3.3.0",
|
|
23
|
+
"dotenv": "^8.2.0",
|
|
24
|
+
"hdkey": "^1.1.2",
|
|
25
|
+
"prettyjson": "^1.2.1",
|
|
26
|
+
"secp256k1": "^3.8.0",
|
|
27
|
+
"ts-node": "^8.10.2",
|
|
28
|
+
"typescript": "^3.9.5",
|
|
29
|
+
"xrpl": "^2.5.0"
|
|
30
|
+
},
|
|
31
|
+
"gitHead": "d0e74ea447175d6d7e9697793093f9155f0dab38"
|
|
32
|
+
}
|
package/tsconfig.json
ADDED