-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructions.txt
35 lines (27 loc) · 1.24 KB
/
instructions.txt
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
Send arbitrary requests with Rm.req(request,[op1 a;op2 b]):
Rm.req("account_info",["account" Rm.account.address;"strict" true])
To get prices:
Rm.book_offers("USD","rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B","BTC","rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B")
#the reply is automatically stored (and also written to a text file)
tg=Rm.getnum(Rm.find("value",Rm.find("TakerGets")[1])[1]) #parse takergets USD
tp=Rm.getnum(Rm.find("value",Rm.find("TakerPays")[1])[1]) #parse takerpays BTC
price=tg/tp #USD per BTC
To send 1 XRP and then 1 GDW:
Rm.setaccount("rrr","sss")
Rm.submit(1000000,"rrrecipient")
Rm.submit(1,"GDW","rGDWKWni6exeneJdNbEZ3nVX3Rrw5VG1p1","rrrecipient")
If there is an error:
print(Rm.sto.reply) #to see what rippled said
To trade:
Rm.OfferCreate(1,Rm.Cur("CAD","r3ADD8kXSUKHd6zTCKfnKT3zV9EZHjzp1S"),5,Rm.Cur("CNY","rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK"))
To communicate with an instance of ripple-rest load rest.jl, modify the acc and url variables and then check balances with:
balance()
balance("BTC")
balance("USD","rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B")
Trustlines with:
reply=trustlines()
print(json(reply))
Traverse transactions given an initial hash through:
reply=notifications("hash")
notifications(reply["previous_hash"])
notifications(reply["next_hash"])