Python binding to the Solana Rust SDK
Project description
Solders
solders
is a high-performance Python toolkit for Solana, written in Rust. It provides robust solutions to the following problems:
- Core SDK stuff: keypairs, pubkeys, signing and serializing transactions - that sort of thing.
- RPC stuff: building requests and parsing responses (no networking stuff - if you want help with that, solana-py is your friend).
- Integration testing stuff: the
solders.bankrun
module is an alternative tosolana-test-validator
that's much more convenient and much faster. It's based on solana-program-test if you know that is.
What about solana-py?
solders
and solana-py
are good friends. solana-py
uses solders
under the hood extensively in its
core API and RPC API. The main differences are:
solders
doesn't have functions to actually interact with the RPC server (thoughsolana-py
does use the RPC code fromsolders
).solders
doesn't provide SPL Token and SPL Memo clients.solana-py
may not have support for all the RPC requests and responses provided bysolders
.solana-py
doesn't have anything like thebankrun
testing kit.
Since solana-py
uses solders
under the hood and they don't duplicate each other's features, you should just use whichever library you need.
Installation
pip install solders
Note: Requires Python >= 3.7.
Example Usage
>>> from solders.message import Message
>>> from solders.keypair import Keypair
>>> from solders.instruction import Instruction
>>> from solders.hash import Hash
>>> from solders.transaction import Transaction
>>> from solders.pubkey import Pubkey
>>> program_id = Pubkey.default()
>>> arbitrary_instruction_data = bytes([1])
>>> accounts = []
>>> instruction = Instruction(program_id, arbitrary_instruction_data, accounts)
>>> payer = Keypair()
>>> message = Message([instruction], payer.pubkey())
>>> blockhash = Hash.default() # replace with a real blockhash
>>> tx = Transaction([payer], message, blockhash)
Development
Setup
- Install poetry
- Install dev dependencies:
poetry install
- Activate the poetry shell:
poetry shell
Testing
- Run
maturin develop
to compile the Rust code. - Run
make fmt
,make lint
, andmake test
.
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
solders-0.15.0.tar.gz
(162.0 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.15.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8968847f24e6de40a3c976f7809cc6ea746d46c621ede7d115aefb807cf409a4 |
|
MD5 | 2b9d685a2d53e5ab84bc4909565b7cac |
|
BLAKE2b-256 | f8ed2149da6e73472214d6e41e3f2d12792a37877703f195755fde33f5ec2321 |
Close
Hashes for solders-0.15.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 725c9fe0ac89250321f868feb08a2678bbf679e24fa72321e27f71c38bd70794 |
|
MD5 | 7906e08072da8832cd9957ec4e67c8b4 |
|
BLAKE2b-256 | 7ab0bff77d7a7f99e348611afa6378b7eddb7ff112ab45f9b3f60542159b7af6 |
Close
Hashes for solders-0.15.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48e260f2782d76598378484e6680da40f8a55d3017d2e65983dc5ff58a6b523f |
|
MD5 | 6764c1202ebf47d0fb9ea4b44081386e |
|
BLAKE2b-256 | 3cb93e579df6ebbff176116e8497626a0580df784c92ab118a3f6a465419ed76 |
Close
Hashes for solders-0.15.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0276a77b4fde41cd6bd45856005e9808b855bba97991916484ea5ba29cfa338c |
|
MD5 | 0036518cecc1c80118c853a86c8b4021 |
|
BLAKE2b-256 | f26c267db3603306c765401a850626457ac9b0a5409b19b3b819dac42b94416f |
Close
Hashes for solders-0.15.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e71b75e0ce163e8100d9d204fbdff4e3b61982db1063c58134bb418d16cda264 |
|
MD5 | ca189905b0cf15c0ab57e0837e86a57f |
|
BLAKE2b-256 | 4f1ff0d8692b2201e1b29cb5d23a3a62fe4c33fcf1958f35ddfdbc5499171d54 |
Close
Hashes for solders-0.15.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4ab857637d73dfeba2db6b0421b61047d51840cf99c910aa498c950a35e2cc0 |
|
MD5 | 55fc4e0f24a08f90d857ddb6f0911552 |
|
BLAKE2b-256 | 3411987f14abdc94aacbfe55e6aa3552547825219631079d84a3eb137201f1da |
Close
Hashes for solders-0.15.0-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8395a6887bf275d2d38e1f8581020e0258c605be344c8baf0a95442e1a79a8ea |
|
MD5 | 452f56ba35c11cc94ebd43bcc55f9292 |
|
BLAKE2b-256 | 9a4a1368b03915918b513c592cd4e614502394566d260658c4b51feb2e06e4b1 |
Close
Hashes for solders-0.15.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d015bf49625a7fe90744e3597fa0e4c4d7cd317576f46792bf078e397a141599 |
|
MD5 | b0df100a79c7e3ae7f4e796ab6298108 |
|
BLAKE2b-256 | bad434492be8706ef1dd2463dd853e5a89f54685a6f66dc9807d9624dbadbdf4 |