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

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.2.0.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

xpring-0.2.0-py3-none-any.whl (59.5 kB view details)

Uploaded Python 3

File details

Details for the file xpring-0.2.0.tar.gz.

File metadata

  • Download URL: xpring-0.2.0.tar.gz
  • Upload date:
  • Size: 31.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

Hashes for xpring-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d9f8d1077dce6c930c2aa3003b10e5360214131a8da9362830eca19caa33d581
MD5 52de22446860acd6e69478c8beee929d
BLAKE2b-256 2178554788225136b7529065167018dd1164788c4e59a323e427fe7e1080b2db

See more details on using hashes here.

File details

Details for the file xpring-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: xpring-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 59.5 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

Hashes for xpring-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d89a4f3cd6e4b872abd9ee5464cc5f9ce414020f2ddfc4a243913b254421ef1a
MD5 15ae3a321e416db9fd7a08f6b40b07a4
BLAKE2b-256 b651546273fc52d80a32ea5dd12ea02f669ff51aa5b9d03850f6ddd0ba00d5d5

See more details on using hashes here.

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