Skip to main content

xpring

The Xpring SDK for Python.

Build status: Linux and OSX Build status: Windows Documentation status Latest PyPI version Python versions supported

Install

pip install xpring[py]

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.private_key.hex())
# b4c4e046826bd26190d09715fc31f4e6a728204eadd112905b08b14b7f15c4f3
print(wallet.public_key.hex())
# ed01fa53fa5a7e77798f882ece20b1abc00bb358a9e55a202d0d0676bd0ce37a63
print(wallet.account_id.hex())
# d28b177e48d9a8d057e70f7e464b498367281b98
print(wallet.address)
# rLUEXYuLiQptky37CqLcm9USQpPiz5rkpD

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)

Account

address = 'r3v29rxf54cave7ooQE6eE7G5VFXofKZT7'
client.get_account_info(address)
# Account(
#   balance=1000000000,
#   sequence=1,
#   previous_txn_id='7029D77041446B8E6BF3B3302DE7F90CEB9CF4C16AED54B7F81C2EC7A2B3D1BA',
#   previous_txn_lgr_seq=4402909,
# )

Balance

address = 'r3v29rxf54cave7ooQE6eE7G5VFXofKZT7'
client.get_balance(address)
# 1000000000

Fee

client.get_fee()
# 12

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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xpring 0.2.0
File Size Uploaded
xpring-0.2.0.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xpring 0.2.0
File Interpreter ABI Platform
xpring-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 90.6 kB

Release files / xpring-0.2.0.tar.gz

Download URL xpring-0.2.0.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d9f8d1077dce6c930c2aa3003b10e5360214131a8da9362830eca19caa33d581
BLAKE2b-256 checksum
How to use checksums
2178554788225136b7529065167018dd1164788c4e59a323e427fe7e1080b2db
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.2.0-py3-none-any.whl

Download URL xpring-0.2.0-py3-none-any.whl
Size 59.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d89a4f3cd6e4b872abd9ee5464cc5f9ce414020f2ddfc4a243913b254421ef1a
BLAKE2b-256 checksum
How to use checksums
b651546273fc52d80a32ea5dd12ea02f669ff51aa5b9d03850f6ddd0ba00d5d5
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 history Release notifications | RSS feed

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page