Python bindings for Solana Rust tools
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.18.1.tar.gz
(170.0 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.18.1-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1587231b57a94e29df3945fa2582817cdb1c935c7cc3b446140ae4154912d1e6 |
|
MD5 | fc58476d6a3a3f075a843ba3aa6b83eb |
|
BLAKE2b-256 | ab3b3f65c9959f30985a9f439565218be692b87adc7d1e15b46c7b4411af51c0 |
Close
Hashes for solders-0.18.1-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02788caa3b82e846944a37f86dc673b6c9d80108679f44109f6c7acfd98808ec |
|
MD5 | 45c8cb21ce97a4e73afb896c0f5a4d73 |
|
BLAKE2b-256 | b3a05f4cd7def78a3ed9740731076688bc84851356928dcf94fd77faa595afe9 |
Close
Hashes for solders-0.18.1-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b6bd026bdfce27daacefa405f0e46f44f9e8dd7e60fd36d23278b08a0f40482 |
|
MD5 | 461cfb53305eb8be180f9c947b93bfb5 |
|
BLAKE2b-256 | 2606030f8f30d3bfb8a5a8f6443b39db7b106e58ffa39eb3c742be7dc0322c3d |
Close
Hashes for solders-0.18.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3da01fcfcfd2154ff41328a3b7a32db655f8aace4ca146a7bf779c6088866daf |
|
MD5 | d2acf85368b33b676ff64dd6f2944793 |
|
BLAKE2b-256 | 8b3d242cbe61fbf8a3781a226c3d2f3d483227c76ae4f41d86342cf855795f5b |
Close
Hashes for solders-0.18.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b78482deeed583b473e70314336d26562b5f2f14fa777a83b9406835eb3e988 |
|
MD5 | a7ef5eb46d9b1e0f5e3bc0911cad8420 |
|
BLAKE2b-256 | d13e4a96f70067daf3333911e4cb0e652b34b1052d52961a93e0233e050e2314 |
Close
Hashes for solders-0.18.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a92ee08cd1de84463b83551810981c25dcca4aa42ab57b8ba823d62dbab9d202 |
|
MD5 | 7ea5e2c176ba7d2502b7cd020019192a |
|
BLAKE2b-256 | 35218a026441c2cdd8213e2f50bf54003b0f4138ba1ea82632b08dd70c9d21cb |
Close
Hashes for solders-0.18.1-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d2503693d0fb0efd37e3f921277327ff664bd04fff551346fad565dd8b9185a |
|
MD5 | 249e3db9dc56c42c174644eb432473cb |
|
BLAKE2b-256 | 32554932b517116525d7f8f2e2b999d757fe7ef3bea5219b90919d84a8d75d4c |
Close
Hashes for solders-0.18.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b20230838626fad26d5bdaf8ebe3db3b660ef9f56cc271feca8970d464ea11f |
|
MD5 | 2604e5a19754cb2da630603570912f87 |
|
BLAKE2b-256 | 9c20eec29b8ce0ca5ae412c43148b03acbe63eaef65ea18548c71f4ee6e64696 |