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.bankrunmodule is an alternative tosolana-test-validatorthat'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:
soldersdoesn't have functions to actually interact with the RPC server (thoughsolana-pydoes use the RPC code fromsolders).soldersdoesn't provide SPL Token and SPL Memo clients.solana-pymay not have support for all the RPC requests and responses provided bysolders.solana-pydoesn't have anything like thebankruntesting 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 developto 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.22.0.tar.gz
(178.8 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.22.0-cp37-abi3-win_amd64.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 16732f4a43437121bdbb494e626db3737a33c6ba94b16016c35c34a23d5a2775 |
|
| MD5 | 84de31e5890317d1e954648684aa8e18 |
|
| BLAKE2b-256 | 9acf7b9d2e111e9e12b5ed3f4d7597c359418cb113f824844acac92213b2572e |
Close
Hashes for solders-0.22.0-cp37-abi3-musllinux_1_2_x86_64.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 4ca64741a5a24c42813a89a0e75f7735a51bf56e01850a887f9428e33cd62ad0 |
|
| MD5 | f12413e91cb94efd09cb3029f00c312e |
|
| BLAKE2b-256 | bc060ed28593a08bea22ce45617e9c747452bdab18c606a7467d210d932556b0 |
Close
Hashes for solders-0.22.0-cp37-abi3-musllinux_1_2_i686.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 786eb2b39a5f894998a7a46d8d959175a0027a0c643d06b514a702730042d380 |
|
| MD5 | a24307f07dfed77420844666f519fe04 |
|
| BLAKE2b-256 | 741747e18bfc9477883e5984ef09f619706bfcc0b605ce0fe1fc082d81921fce |
Close
Hashes for solders-0.22.0-cp37-abi3-manylinux_2_28_aarch64.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 80e92568ec7e55045d97d201fe43b21d76ee92583810e1fec6e633f00cdb0df3 |
|
| MD5 | 63852e4eafd7d98e5bc934c0357f9638 |
|
| BLAKE2b-256 | a37d2e61e00a4ad489ab900bbc8f4d2995f0560492f3ad1f0888c0def0c54cef |
Close
Hashes for solders-0.22.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | cef27fae7b9356ce19f96f58ed01235ddc15e3a276862fcf67902678f16c18e7 |
|
| MD5 | afe6fcf2ef8ef50e890b7f0d3fe16010 |
|
| BLAKE2b-256 | 9ff5ed357038be255d52e0b037412fa03b4287cc375bf681fe527cc7835d0e55 |
Close
Hashes for solders-0.22.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 3b390d62847e8d0dda69f31b53bde8731a586a7f6670630aa30804cc0ab52016 |
|
| MD5 | b495cc7bd7bad81908f117aef0981d65 |
|
| BLAKE2b-256 | a62f10fef0a58fc64e2bb7074fe6f093ad3222669993ca59bafbd138f7ee9b77 |
Close
Hashes for solders-0.22.0-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 81bf7943e1b3a31a6375e8a2e788a0a35b36357197eef281cce740bd705265c2 |
|
| MD5 | 60659c4655d51973c99c13f1e05a6a83 |
|
| BLAKE2b-256 | a4172a7122455bc8b1e4c5772df88052a869307dce33291181cc574f67635005 |
Close
Hashes for solders-0.22.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | f03a49ee921b233c37c1ac54ed3764b935602ba95c543d5b0b81ce41ead0b8dd |
|
| MD5 | e62d07a64edb0fe4e58d9d6fdd08b1c2 |
|
| BLAKE2b-256 | 632e4bfa1002052443d99f7b693f54b204061632db1945cde55c56aa286ff838 |