-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
58 lines (31 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require('dotenv').config();
const xrpl = require("xrpl");
const fs = require('node:fs/promises');
const xrpl_client = {
client: new xrpl.Client( process.env.PUBLIC_SERVER ),
accounts: process.env.XRPL_ACCOUNTS.split(','),
async accountInfo(){
for( const element of this.accounts ){
const response = await this.client.request({
"command": "account_info",
"account": element,
"ledger_index": "validated"
});
await fs.writeFile(`./json/${element}.json`, JSON.stringify(response));
console.log(`${element}.json file written`);
}
},
async closeConnection(){
await this.client.disconnect();
},
async openConnection(){
await this.client.connect();
},
};
xrpl_client.openConnection().then(()=>{
xrpl_client.accountInfo().then(()=>{
xrpl_client.closeConnection().then(()=>{
console.log("Connection closed");
});
});
});