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.0.tar.gz
(171.1 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.18.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40cc86dccee766c05ccd594a66761b44248907bfbfa85956bbbc9fb504dde7cd |
|
MD5 | 2ca2ff997d1f163fe998e146f15ad6a2 |
|
BLAKE2b-256 | d40cecc82b50cddade13e9280e5b008f174bb489fcd6d45e64bddd1b4d0eabcc |
Close
Hashes for solders-0.18.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 632ba10040d3fac819363abb3cbbd3a5974e8c9800b897ca9641efe9b36b4975 |
|
MD5 | 586288f5123e595985e1b028ae88287e |
|
BLAKE2b-256 | 40bad717a36b6fc2005df8d9bf143aab8b02d89e99092ea9d89d11c9bca8a60d |
Close
Hashes for solders-0.18.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3260b9d3c469818d9229a667621b4714863fa35ca2709a1c6e224efc21e516cc |
|
MD5 | 9ae1834a1edda63b3425b1b8e21f6671 |
|
BLAKE2b-256 | 5baaa147d22fad29911c87a722a2751e903070cb534eb8e2cbc6ddb32d5ad3a6 |
Close
Hashes for solders-0.18.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a29449f6827d2a220bed2873f4a485f000e01ddc9f58ba19771c5d53fa4fe28d |
|
MD5 | a903bf24906cde433c695e43172bed3c |
|
BLAKE2b-256 | 0d262067b9d5d07094c99a8f6e8bb5d28e782f12b33fca350ee17c3e9b12efe0 |
Close
Hashes for solders-0.18.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07c700ad784754609cffe2fd4177124c359d5353ba1d2d8b6d4e8ae59957aa7d |
|
MD5 | fdb4d8c9dbf355a57cbec56395882174 |
|
BLAKE2b-256 | 3d0a9d47afa0f41d4dc6ee520c6941752a77376db6c035c236606454e5164efd |
Close
Hashes for solders-0.18.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90be96a432d8580ff52eed6098b4be12c064829588304f8f2a79d9adfd2b789d |
|
MD5 | aaba34ee6c59f4e133c0c5521a8486e0 |
|
BLAKE2b-256 | 099f4e20618a7ddc5a037984262e0c7916b0aedaec905f090ebacb3e48b85fa1 |
Close
Hashes for solders-0.18.0-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b7c9cafffa570652aaabf5d3ccc987ea18c9470718631e4881ca679823b18ae |
|
MD5 | 699dbed143d070388e6a5ba356eab639 |
|
BLAKE2b-256 | 82128c82103c968487eca6991294284369b3cf1b3317b08268979d604319c095 |
Close
Hashes for solders-0.18.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd30c9a2b1967975b2d05895cc4a3ef701c9e686a1d156e131a6c97d4b1decd5 |
|
MD5 | 5c6bf85161344238305d893aa0b47f28 |
|
BLAKE2b-256 | fe709edbe8758be8bcd16070298f89ab81acde533fcd5a0c48b33acb11b19b07 |