No project description provided
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file xpring-0.1.0.tar.gz
.
File metadata
- Download URL: xpring-0.1.0.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.1 Linux/5.3.0-29-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0327f5cba109a1d85ff1396822986ad3f7102cd6bcc68e7e803f24d0445aed |
|
MD5 | 9de5c87552d3ec1a50b4b1056fa0856c |
|
BLAKE2b-256 | f7c76912b152eaffb3a32b61feb3b9245a4289d9e57845b8eb41ee0db5b50042 |
File details
Details for the file xpring-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: xpring-0.1.0-py3-none-any.whl
- Upload date:
- Size: 47.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.1 Linux/5.3.0-29-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe28037abd84db505438d18f99e3e70decb4e5a32a430d8da82521820e384206 |
|
MD5 | 1878e1fb716bb25402f3c9006edad79a |
|
BLAKE2b-256 | dbdcef09553255ba18fa1de5f10c8fca92fa5e4ddd2fe2805c9b02ff82d62b28 |