This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
476f6e9
commit fc7f573
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Python Demo | ||
|
||
 | ||
|
||
Demonstrates [xpring-py](https://github.com/thejohnfreeman/xpring-py). | ||
|
||
``` | ||
$ poetry install | ||
$ poetry run python main.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import time | ||
|
||
import xpring | ||
|
||
|
||
url = '3.14.64.116:50051' | ||
seed = 'ss9unxUg8VgvDjWrogKGVDiRRz97n' | ||
recipient = 'rNJDvXkaBRwJYdeEcx9pchE2SecMkH3FLz' | ||
amount = '10' | ||
|
||
print(f'Using rippled node located at: {url}') | ||
client = xpring.Client.from_url(url) | ||
|
||
wallet = xpring.Wallet.from_seed(seed) | ||
address = wallet.address | ||
|
||
print(f'Retrieving balance for {address}') | ||
balance = client.get_balance(address) | ||
print(f'Balance was {balance} drops!') | ||
|
||
print('Sending:') | ||
print(f'- Drops: {amount}') | ||
print(f'- To: {recipient}') | ||
print(f'- From: {address}') | ||
signed_transaction = client.send(wallet, recipient, amount) | ||
client.submit(signed_transaction) | ||
|
||
txid = signed_transaction['hash'] | ||
print('Hash for transaction:') | ||
print(txid) | ||
|
||
time.sleep(5) | ||
transaction_status = client.get_transaction_status(txid) | ||
print('Result for transaction is:') | ||
print(transaction_status.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[tool.poetry] | ||
name = "xpring-demo" | ||
version = "1.0.0" | ||
description = "Demonstration of xpring-py" | ||
authors = ["Xpring Engineering"] | ||
license = "MIT" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.6" | ||
xpring = {version = "^0.4.3", extras = ["py"]} | ||
|
||
[tool.poetry.dev-dependencies] | ||
|
||
[build-system] | ||
requires = ["poetry>=0.12"] | ||
build-backend = "poetry.masonry.api" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.