This release is a pre-release and may not be stable for production use.
Quick Start
Ape ecosystem plugin for Solana.
It adds the solana ecosystem, its networks, providers, transactions, and keyfile-backed accounts.
Dependencies
- python3 version 3.10 up to 3.13.
Installation
via ape
ape plugins install solana
via pip
pip install ape-solana
via setuptools
git clone https://github.com/ApeWorX/ape-solana.git
cd ape-solana
python3 setup.py install
Quick Usage
Networks
| Network | Default provider | Other providers |
|---|---|---|
solana:local |
litesvm |
solana (solana-test-validator on :8899) |
solana:devnet |
solana |
|
solana:testnet |
solana |
|
solana:mainnet |
solana |
litesvm is an in-process Solana VM, so solana:local needs no validator.
The solana provider talks JSON-RPC and verifies the cluster's genesis hash on connect.
Set your own RPC in ape-config.yaml:
solana:
mainnet:
uri: https://my-rpc.example.com
commitment: finalized
Accounts
Solana accounts live in encrypted keyfiles, the same format and UX as ape accounts:
ape solana accounts generate alice
ape solana accounts import bob # base58, hex, or JSON array
ape solana accounts import carol --use-mnemonic # m/44'/501'/0'/0' by default
ape solana accounts import dave --keypair-file ~/.config/solana/id.json
ape solana accounts list
ape solana accounts export alice
ape solana airdrop --network solana:local --account alice --sol 5
Unlock non-interactively with the APE_SOLANA_ACCOUNTS_<alias>_PASSPHRASE environment variable.
Transfers and transactions
from ape import accounts, networks
from solders.system_program import TransferParams, transfer
alice = accounts.load("alice")
bob = accounts.load("bob")
with networks.solana.local.use_provider("litesvm"):
alice.request_airdrop(10 * 10**9)
receipt = alice.transfer(bob, 1_000_000)
receipt.show_program_logs()
instruction = transfer(
TransferParams(from_pubkey=alice.pubkey, to_pubkey=bob.pubkey, lamports=1_000_000)
)
txn = networks.solana.create_transaction(instructions=[instruction])
receipt = alice.call(txn)
Accounts also sign solders Transaction and VersionedTransaction objects directly:
signed_transaction = alice.sign_transaction(unsigned_transaction)
assert alice.check_signature(signed_transaction)
Messages
signature = alice.sign_message("gm")
assert alice.check_signature("gm", signature)
print(signature) # base58
Not yet supported
- Program deployment and Anchor IDL-based program calls (
ContractInstance, events). - Read-only calls (
simulateTransaction) and log queries. - Building v0 transactions with address lookup tables (signing them already works).
- Test accounts and snapshots on
solana:local. - Launching
solana-test-validatorautomatically.
Development
This project is in development and should be considered an alpha. Things might not be in their final state and breaking changes may occur. Comments, questions, criticisms and pull requests are welcomed.
Metadata
Release files for ape-solana 0.0.1a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ape_solana-0.0.1a0.tar.gz | 30.7 kB | Without provenance | Details for ape_solana-0.0.1a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ape_solana-0.0.1a0-py3-none-any.whl | Python 3 | none | any | Details for ape_solana-0.0.1a0-py3-none-any.whl |
Total release size: 56.4 kB
Release files / ape_solana-0.0.1a0.tar.gz
| Download URL | ape_solana-0.0.1a0.tar.gz |
|---|---|
| Size | 30.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f95f08f629594268a630f7f6bdc795469d614ba849311d82ef07cabb9f40a6f7
|
|
BLAKE2b-256 checksum How to use checksums |
413a65ea21950b4d8ddf93e5b28e328c0cd31279fab74ba934d825ffa161ef6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / ape_solana-0.0.1a0-py3-none-any.whl
| Download URL | ape_solana-0.0.1a0-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dc017e18b99052c355c1715cac7b0f1ae4416c566a9c92553cf2a598d283bd8
|
|
BLAKE2b-256 checksum How to use checksums |
63392b56425175905df39e2b11cad4d52678cef4c20196cd71fdc2fc140e112b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for ape-solana 0.0.1a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.