This repository was archived by the owner on Jan 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +61
-0
lines changed Expand file tree Collapse file tree 4 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Python Demo
2
+
3
+ ![ screenshot of demo in terminal] ( ./python-demo.png )
4
+
5
+ Demonstrates [ xpring-py] ( https://github.com/thejohnfreeman/xpring-py ) .
6
+
7
+ ```
8
+ $ poetry install
9
+ $ poetry run python main.py
10
+ ```
Original file line number Diff line number Diff line change
1
+ import time
2
+
3
+ import xpring
4
+
5
+
6
+ url = '3.14.64.116:50051'
7
+ seed = 'ss9unxUg8VgvDjWrogKGVDiRRz97n'
8
+ recipient = 'rNJDvXkaBRwJYdeEcx9pchE2SecMkH3FLz'
9
+ amount = '10'
10
+
11
+ print (f'Using rippled node located at: { url } ' )
12
+ client = xpring .Client .from_url (url )
13
+
14
+ wallet = xpring .Wallet .from_seed (seed )
15
+ address = wallet .address
16
+
17
+ print (f'Retrieving balance for { address } ' )
18
+ balance = client .get_balance (address )
19
+ print (f'Balance was { balance } drops!' )
20
+
21
+ print ('Sending:' )
22
+ print (f'- Drops: { amount } ' )
23
+ print (f'- To: { recipient } ' )
24
+ print (f'- From: { address } ' )
25
+ signed_transaction = client .send (wallet , recipient , amount )
26
+ client .submit (signed_transaction )
27
+
28
+ txid = signed_transaction ['hash' ]
29
+ print ('Hash for transaction:' )
30
+ print (txid )
31
+
32
+ time .sleep (5 )
33
+ transaction_status = client .get_transaction_status (txid )
34
+ print ('Result for transaction is:' )
35
+ print (transaction_status .name )
Original file line number Diff line number Diff line change
1
+ [tool .poetry ]
2
+ name = " xpring-demo"
3
+ version = " 1.0.0"
4
+ description = " Demonstration of xpring-py"
5
+ authors = [" Xpring Engineering" ]
6
+ license = " MIT"
7
+
8
+ [tool .poetry .dependencies ]
9
+ python = " ^3.6"
10
+ xpring = {version = " ^0.4.3" , extras = [" py" ]}
11
+
12
+ [tool .poetry .dev-dependencies ]
13
+
14
+ [build-system ]
15
+ requires = [" poetry>=0.12" ]
16
+ build-backend = " poetry.masonry.api"
You can’t perform that action at this time.
0 commit comments