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.20.0.tar.gz
(178.7 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.20.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 101324104f015848b06320845ff78007c01d254b53f67021e2684856ba52f226 |
|
MD5 | df671579dbe648c31308e237db874ddb |
|
BLAKE2b-256 | 1e9421350c400b4572901993dda3d3204b5fb1c129358bfaf8c2021bc073c255 |
Close
Hashes for solders-0.20.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 423d097d023df2e28c0dbc212fe95ae59d8258e48a3fe8c70321e9a6b357ac8a |
|
MD5 | 3bff3540954a6af682de5bacab049d19 |
|
BLAKE2b-256 | 6ad9881355c561ac2df5cbef4f91892e9dc147c6f7a40926987b50fa51c4c2a3 |
Close
Hashes for solders-0.20.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fed83b871174ab4a13814786ae085f2b97f8a3a4e0c020b0869cdebca9ecaf29 |
|
MD5 | a05aa585999ab8020e019aafb4cdbc01 |
|
BLAKE2b-256 | 9a752edd23e49ac06d98757bf76364fad264cedda5f3fdd4250e6bb421b764d6 |
Close
Hashes for solders-0.20.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 647882d676e943e9829cffd9d1f07cb413421317be01fe39b4c5bd08afe991c3 |
|
MD5 | 608058affb35d2976fb465ed1b601341 |
|
BLAKE2b-256 | 7cf1960c186c81cb282e88f931bda4bfaacc22b633df8de4fa63678391761fa0 |
Close
Hashes for solders-0.20.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b3c344b9ba20fc2f9a3cb99e15edeb816398b96adf0af38a8ab8874ac06cc34 |
|
MD5 | 4155e468f91c00d42cf0f80d0ddeff63 |
|
BLAKE2b-256 | 2a71dacca843c08b54b5c252e79dbcf00b330377ba6fb4602cfef4828f406217 |
Close
Hashes for solders-0.20.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53569cc6050b7a5aafc5a0518710d002ab8e2d3b1c538f7f52fb2b28372ebc69 |
|
MD5 | 54c5fd34cb6a9d32006384bd2be321d1 |
|
BLAKE2b-256 | 8a4af86c131221c0295b2abf6e3346575359c4e39cfb756f3cd831b778ae7668 |
Close
Hashes for solders-0.20.0-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b93d89ac04b2ca114d592fd72c1f12320da11cce12554ebd4f6eee226fec797e |
|
MD5 | fab40de3fbec193efe62aba2dc368a20 |
|
BLAKE2b-256 | 75832b59455b1c1e3da94b6688adfffc3b0ee55d40f516e027269ee7bd83fada |
Close
Hashes for solders-0.20.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f28d8ee017b1a9d01b74b21865bc52ed6ec4dde24dde2907d8764d0e6f4d0937 |
|
MD5 | 425b58feecf6daff6a5078e29d57ca7d |
|
BLAKE2b-256 | 2e691bced96bb268dab68577eaf74ec2a945756391db57f82c0853ce1dddb683 |