forked from TbLtzk/Centaurus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstellarRemote_getBalance.js
More file actions
35 lines (31 loc) · 991 Bytes
/
Copy pathstellarRemote_getBalance.js
File metadata and controls
35 lines (31 loc) · 991 Bytes
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
// open the containing folder in command line and type 'node stellarRemote_getBalance.js' <enter>
// if it does not work type 'npm install' <enter> and try again
var Remote = require('stellar-lib').Remote;
var stellarAddress = 'gEux6NhrybVLuvgaYrgThTk4d3Kmd3s4NP'; // funktioniert nicht mit alias
var remote = new Remote({
// see the API Reference for available options
trusted: true,
local_signing: true,
local_fee: true,
fee_cushion: 1.5,
servers: [
{
host: 'live.stellar.org'
, port: 9001
, secure: true
}
]
});
remote.connect(function() {
console.log('remote connected')
request = remote.requestAccountInfo(stellarAddress)
request.on('success', function(res){
console.log('You have ' + res.account_data.Balance/1000000 + ' (STR)')
});
request.on('error', function(res){
console.log('Could not retrieve account info:')
console.log(res.remote.error_message)
console.log(res)
});
request.request();
});