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.17.0.tar.gz
(170.0 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.17.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da64d20c0eb14b1b1e39bbe82b878a03e71c076f71345ff2faf5ca87f11fa431 |
|
MD5 | 231a22025ba4ddcf2b352910eda028cd |
|
BLAKE2b-256 | cd9a404121d3b17fa5dd682010a9b3415c8c4235ad9154f85095ff255a7131e9 |
Close
Hashes for solders-0.17.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da0d8ff4e21b3acebb4c5b3ca097659c54358cb97df087fa9fdf717710425759 |
|
MD5 | 1fc65ed4e0edb2312d21f29f8fda5fe4 |
|
BLAKE2b-256 | e4c166a332c1483034518b94e2404c26a3c7681d02584350d9e7be6259d11c03 |
Close
Hashes for solders-0.17.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3d1559134569bbf69a8fe86509e8bf94e6a73c8de796d8de4b29aaae78f0a7a |
|
MD5 | 1d91e33fb493347c4509354a74a7e281 |
|
BLAKE2b-256 | 07302f9d3943da174b161fbcaa62f73c2b8e4ce5c59df24369e6aaa78e541ae0 |
Close
Hashes for solders-0.17.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5002c1785ad301815d49a771ebd540bba15a8b30efbcef2f43456731e36a7df1 |
|
MD5 | 906e0f9e7457b1fe85cc8f7c6643aa74 |
|
BLAKE2b-256 | c29704e16496563c2f71597a6f5bb36c35d0aa8f83562142dedf362bdf89a1f0 |
Close
Hashes for solders-0.17.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eab2565dc01ac1474bcb83d43a65e4e38c16cbe762650f77d8d075fae75ee832 |
|
MD5 | 9c3c19b28c1e82befdc256feedc6d241 |
|
BLAKE2b-256 | 4bf3a3c5310b54e88911962a99a6fe5f555a5a8177764a71be1442496487927f |
Close
Hashes for solders-0.17.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7ba319d05bdd5802b781326d9cbe70b9af05f935714d38b6595a51154d070b2 |
|
MD5 | d42d3222ac6078815a555382a27ba8f8 |
|
BLAKE2b-256 | 2d81d667f84ebf8becfc04ab15a1a9ffa78ee49dea49e2a79d041464f3caeea8 |
Close
Hashes for solders-0.17.0-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af069840d7aaafecfa819ab05ba13df1d1fb718650dab0e989bbb7c34b63b839 |
|
MD5 | a35cca3fc4df76383a342073fb6009ba |
|
BLAKE2b-256 | f2dafde534d186367061bf67b497732f500ca515af28fc37982f76d7c64563e1 |
Close
Hashes for solders-0.17.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2222c20300a3b339d0c30cc85a38cb76b9341529c943f8f6e84e37b6c4cf7c3f |
|
MD5 | c053b7a374deb8548c1b51484cabd349 |
|
BLAKE2b-256 | b1b2bf27aba42a7258b174f108a6ae727f20093c2219d68d68c7b1ee5e46d85b |