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.1.tar.gz
(161.9 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.15.1-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb393a1826382e87ec41e01d7125d8457fe19b8ac7480395633e76ba48a5a9a1 |
|
MD5 | 781e925c326b0f294a9c6ae0bffd69e3 |
|
BLAKE2b-256 | b4ffddffd486a194403090b069ef37c60c0d76937219a16f8a5dc7efbc3cbc95 |
Close
Hashes for solders-0.15.1-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d69c69aaac94006e9315bf820dab1bd0c179acecc85b9cab4475fa3230b82c2 |
|
MD5 | 06b1dd25ffea57e5dc4fca517bc285c3 |
|
BLAKE2b-256 | 79e4c8ab13d83b453c8272afe4ebaee4a0e6b30aeac8ab47fc3a535de8df4d78 |
Close
Hashes for solders-0.15.1-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 506b2d6560b19df4bd33d547801af3554a6c9c34fc46270e6a6bffbaccf529bc |
|
MD5 | ab8d33a08730a85557f21572a643c07a |
|
BLAKE2b-256 | 703125faa964593a288fc149294c0632df813d628cf213dc278b0e41e8e9a95e |
Close
Hashes for solders-0.15.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd2a720ee52884727798b7f944b4fa7be4280ff705e6a790b87947c5f74b4d66 |
|
MD5 | 2500f1e2a431f805a1009040d8f9400b |
|
BLAKE2b-256 | 2778974ac685cbd91f9c4ebbb9ab8d7c7139c94e07acc3ebbd05ddbc17287312 |
Close
Hashes for solders-0.15.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cb35a2b092303a7a7ba7de797f95f24ad1abf13b28e17c7668970a413958b0d |
|
MD5 | bdf31376fc1bf7cef6e8206555717413 |
|
BLAKE2b-256 | bc6f7abb3ddde5fd8ad8b67bcbed012ffdac2277571db7614875ab2f00caf144 |
Close
Hashes for solders-0.15.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6c0d4e403e708e56c2c12e3debb7a9ae0e278ccd08e67c659c1de1156977525 |
|
MD5 | 7b03f3491f5e37a902c869e802f5eabd |
|
BLAKE2b-256 | c23b67edb91a13fcf2c49c91a6383ba8e4f1cabecf02f6dbeebb7ba1940c0379 |
Close
Hashes for solders-0.15.1-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0117d671d090593f6c482b8f51405684e2aa5ab7eef82e57d30fd243eea73335 |
|
MD5 | 8f63a8f46560f8790720f820fe4ca454 |
|
BLAKE2b-256 | 8c66d872135a1d88706a68ce02c0f136fe4e8b353c9d11091abf423ff91dc577 |
Close
Hashes for solders-0.15.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23a410024fbce8b57a759342714e9ae5f9eda78fe2f0c648ed601ec4cd2f9deb |
|
MD5 | 714ab3c72d788c339de0c1b96dfe15fb |
|
BLAKE2b-256 | 32ff3621ad1a72c3145422b53a4362b109ba39bc0bdd3fd7f5d84cf7b1c1832e |