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
Add Python demo #20
Open
thejohnfreeman
wants to merge
8
commits into
xpring-eng:master
Choose a base branch
from
thejohnfreeman:python
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Python demo #20
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8907b9f
Add Python demo
thejohnfreeman 3342b22
Fix style
thejohnfreeman 2699efc
Add CircleCI step for Python demo
thejohnfreeman 26aab38
Add Python demo to README
thejohnfreeman fb317d1
Update RPC server URL
thejohnfreeman b0a798c
Install gmp on MacOS for xpring-py
thejohnfreeman 739d7d1
Update xpring-py to 0.5.0
thejohnfreeman efbd2c2
Merge branch 'master' into python
keefertaylor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,34 @@ | ||
import time | ||
|
||
import xpring | ||
|
||
url = 'test.xrp.xpring.io: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.5.0", 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does
xpring
come from?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I publish this package to PyPI: https://pypi.org/project/xpring/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a Python implementation of serialization, signing, and gRPC for XRPL. No calls to JavaScript.