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.16.0.tar.gz
(166.8 kB
view hashes)
Built Distributions
Close
Hashes for solders-0.16.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80441e0c5ffb23d9c277a1177db44bc50ee7ee8d0fd7598ef4e48a0723246668 |
|
MD5 | c8274f8ab7df6cc966ee385185fadcc8 |
|
BLAKE2b-256 | e540aaa2ad57bd9800288463f3c76eb003054898602f53d7351536b15e625c0a |
Close
Hashes for solders-0.16.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47574cdf74921a383bbb774b8d56bab313b18299f2872bef0e242d75c466db3d |
|
MD5 | 0c7776ae85c422aa19e1b3f65d19325a |
|
BLAKE2b-256 | ac5d79fae1436ee4b3fcf5ac9f7a12a4156955fd2728dbe1be186478afe28d2e |
Close
Hashes for solders-0.16.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8f2b6d0a60f1ffe9436ca88cc40837b400c3d227842911066a95a18a369ef17 |
|
MD5 | d5c836110280466f55d5d60fafc5866b |
|
BLAKE2b-256 | 35ba0358d81264549a4cd030a5055edb9336e413299e8983d380b7946c69c6a7 |
Close
Hashes for solders-0.16.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9cd4c0d630aba7c0b9fc47a718da50e37238c41fd9be73c81ce0a7fe9bbfe45 |
|
MD5 | 0fe12708d8f2416740fa3ec61df974d1 |
|
BLAKE2b-256 | 088bec079f54647c273e6412ad122ab56e04b08be19421ef63fc2ee79bb6037e |
Close
Hashes for solders-0.16.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b2704ccb5e4e2e5a6ca4f4fda8bb1de37a67a7a60f61eb7bc245d9a23943a8b |
|
MD5 | f7f4e3c10437723ce120a69f7c72b596 |
|
BLAKE2b-256 | 18fdf91a400760a0f06a72b5e046de7111101f38a3fd32985f510697160bafb6 |
Close
Hashes for solders-0.16.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dada5d50b52508f3d750f89e553e7dcd64c83a37a0e1483acec8c8613f75ba9 |
|
MD5 | aa56213ed6b4c659fed438e289f8e8b5 |
|
BLAKE2b-256 | f65f06c5d7d1f02a57842929785707ee0140e9562b3bad9172c314e474e67454 |
Close
Hashes for solders-0.16.0-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd0e3c4970e25788161e37dc5f1798509514d9d6c92c1c8db431d8cd5621f5a5 |
|
MD5 | e4bcc39e691cc79cee2b3447408ba099 |
|
BLAKE2b-256 | 07fb5cfb281871a438f921b16f7472fe07b308258492275b06cfb69b7688cc1e |
Close
Hashes for solders-0.16.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc6d68751184a0b69b675352ac60b8c01f92942ae0decaa3da559af274ef1fc5 |
|
MD5 | 50a6d59e35e9b6a593db92f1089e85c9 |
|
BLAKE2b-256 | a6c2ad0155d4a6afb7cace10b2438bbdb00e11f70861090d9c243c7e87999204 |