The Xpring SDK for Python.
Install
pip install xpring
API
Wallet
Construct
You can construct a Wallet from its seed. If you do not have your own wallet yet, you can generate one with some free XRP on the testnet.
import xpring
seed = 'sEdSKaCy2JT7JaM7v95H9SxkhP9wS2r'
wallet = xpring.Wallet.from_seed(seed)
print(wallet.public_key.hex())
# ed01fa53fa5a7e77798f882ece20b1abc00bb358a9e55a202d0d0676bd0ce37a63
print(wallet.private_key.hex())
# b4c4e046826bd26190d09715fc31f4e6a728204eadd112905b08b14b7f15c4f3
Sign / Verify
A Wallet can sign and verify arbitrary bytes, but you’ll generally want to leave these low-level responsibilities to the Client.
message = bytes.fromhex('DEADBEEF')
signature = wallet.sign(message)
wallet.verify(message, signature)
# True
Client
Client is the gateway into the XRP Ledger.
Construct
Client is constructed with the URL of a Xpring server. You may use the one operated by Ripple for the XRP testnet.
url = 'grpc.xpring.tech:80'
client = xpring.Client.from_url(url)
Balance
address = 'r3v29rxf54cave7ooQE6eE7G5VFXofKZT7'
client.get_balance(address)
# 1000000000
Develop
Dependencies
The protocol buffers and definitions file are in submodules:
git submodule update --init
Use Poetry to install dependencies, build the protocol buffers, and copy the definitions file:
poetry install
poetry run invoke prebuild
Tasks
There are several Invoke tasks:
poetry run invoke ${task}
test: Pytest with coverage and doctests.
lint: Mypy, Pylint, and Pydocstyle.
serve: Serve the docs locally and rebuild them on file changes.
Metadata
Release files for xpring 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xpring-0.1.0.tar.gz | 20.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xpring-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.9 kB
Release files / xpring-0.1.0.tar.gz
| Download URL | xpring-0.1.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e0327f5cba109a1d85ff1396822986ad3f7102cd6bcc68e7e803f24d0445aed
|
|
BLAKE2b-256 checksum How to use checksums |
f7c76912b152eaffb3a32b61feb3b9245a4289d9e57845b8eb41ee0db5b50042
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.3 CPython/3.7.1 Linux/5.3.0-29-generic
|
Release files / xpring-0.1.0-py3-none-any.whl
| Download URL | xpring-0.1.0-py3-none-any.whl |
|---|---|
| Size | 47.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe28037abd84db505438d18f99e3e70decb4e5a32a430d8da82521820e384206
|
|
BLAKE2b-256 checksum How to use checksums |
dbdcef09553255ba18fa1de5f10c8fca92fa5e4ddd2fe2805c9b02ff82d62b28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.3 CPython/3.7.1 Linux/5.3.0-29-generic
|