File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,37 @@ Finally, a convenient CLI is provided to demonstrate example usage:
22
22
23
23
- [ xrpl_cli] ( xrpl_cli/ )
24
24
25
+ ## Usage
26
+
27
+ ### JSONRPC Client example
28
+
29
+ ``` rust
30
+ let client = Client :: new ();
31
+
32
+ let account = env :: var (" XRPL_ACCOUNT_ADDRESS" ). expect (" account not defined" );
33
+
34
+ let req = AccountTxRequest :: new (& account ). limit (5 );
35
+ let resp = client . call (req ). await ;
36
+
37
+ dbg! (& resp );
38
+ ```
39
+
40
+ ### WebSocket Client example
41
+
42
+ ``` rust
43
+ let mut client = Client :: connect (DEFAULT_WS_URL )
44
+ . await
45
+ . expect (" cannot connect" );
46
+
47
+ let req = AccountInfoRequest :: new (" r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59" ). strict (true );
48
+
49
+ client . call (req ). await . expect (" cannot send request" );
50
+
51
+ if let Some (msg ) = client . messages. next (). await {
52
+ dbg! (& msg );
53
+ }
54
+ ```
55
+
25
56
26
57
## Links
27
58
You can’t perform that action at this time.
0 commit comments