-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgetsellprice.js
52 lines (46 loc) · 891 Bytes
/
getsellprice.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
var Remote = require('ripple-lib').Remote;
var CURRENCY = process.argv[2];
var ISSUER = process.argv[3];
var remote = new Remote({
trace: true,
trusted: true,
local_signing: true,
// local_fee: true,
// fee_cushion: 1.5,
servers: [{
host: 's1.ripple.com'
, port: 443
, secure: true
}]
});
remote.connect(function() {
var request = remote.request_book_offers({
gets: {
'currency':CURRENCY,
'issuer': ISSUER
},
pays: {
'currency':'XRP'
},
limit: 1
});
var dc=0;
request.on('success',function(msg){
console.log('Success! ');
remote.disconnect();
dc=1;
});
request.on('error',function(msg){
console.log('Something went wrong. ');
remote.disconnect();
dc=1;
});
request.request();
setTimeout(function() {
if (dc==0){
setTimeout(function() {
remote.disconnect();
}, (45 * 1000));
}
},(5*1000));
});