Skip to main content

No project description provided

Project description

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xpring-0.1.0.tar.gz (20.1 kB view hashes)

Uploaded Source

Built Distribution

xpring-0.1.0-py3-none-any.whl (47.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page