Metadata-Version: 2.4
Name: ape-solana
Version: 0.0.1a0
Summary: ape-solana: Ape Ecosystem Plugin for Solana
Home-page: https://github.com/ApeWorX/ape-solana
Author: ApeWorX Ltd.
Author-email: admin@apeworx.io
License: Apache-2.0
Keywords: solana
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10,<4
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click
Requires-Dist: eth-ape<0.9,>=0.8.54
Requires-Dist: eth-account
Requires-Dist: eth-keyfile
Requires-Dist: requests
Requires-Dist: solders<0.30,>=0.29.0
Provides-Extra: test
Requires-Dist: pytest>=6.0; extra == "test"
Requires-Dist: pytest-xdist; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-mock; extra == "test"
Provides-Extra: lint
Requires-Dist: black<26,>=25.1.0; extra == "lint"
Requires-Dist: mypy<2,>=1.15.0; extra == "lint"
Requires-Dist: types-setuptools; extra == "lint"
Requires-Dist: types-requests; extra == "lint"
Requires-Dist: flake8<8,>=7.1.2; extra == "lint"
Requires-Dist: flake8-breakpoint<2,>=1.1.0; extra == "lint"
Requires-Dist: flake8-print<6,>=5.0.0; extra == "lint"
Requires-Dist: flake8-pydantic; extra == "lint"
Requires-Dist: flake8-type-checking; extra == "lint"
Requires-Dist: isort<7,>=6.0.0; extra == "lint"
Requires-Dist: mdformat>=0.7.22; extra == "lint"
Requires-Dist: mdformat-gfm>=0.3.5; extra == "lint"
Requires-Dist: mdformat-frontmatter>=0.4.1; extra == "lint"
Requires-Dist: mdformat-pyproject>=0.0.2; extra == "lint"
Provides-Extra: release
Requires-Dist: setuptools>=75.6.0; extra == "release"
Requires-Dist: wheel; extra == "release"
Requires-Dist: twine; extra == "release"
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-mock; extra == "dev"
Requires-Dist: black<26,>=25.1.0; extra == "dev"
Requires-Dist: mypy<2,>=1.15.0; extra == "dev"
Requires-Dist: types-setuptools; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: flake8<8,>=7.1.2; extra == "dev"
Requires-Dist: flake8-breakpoint<2,>=1.1.0; extra == "dev"
Requires-Dist: flake8-print<6,>=5.0.0; extra == "dev"
Requires-Dist: flake8-pydantic; extra == "dev"
Requires-Dist: flake8-type-checking; extra == "dev"
Requires-Dist: isort<7,>=6.0.0; extra == "dev"
Requires-Dist: mdformat>=0.7.22; extra == "dev"
Requires-Dist: mdformat-gfm>=0.3.5; extra == "dev"
Requires-Dist: mdformat-frontmatter>=0.4.1; extra == "dev"
Requires-Dist: mdformat-pyproject>=0.0.2; extra == "dev"
Requires-Dist: setuptools>=75.6.0; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: commitizen; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pytest-watch; extra == "dev"
Requires-Dist: IPython; extra == "dev"
Requires-Dist: ipdb; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Quick Start

Ape ecosystem plugin for [Solana](https://solana.com).
It adds the `solana` ecosystem, its networks, providers, transactions, and keyfile-backed accounts.

## Dependencies

- [python3](https://www.python.org/downloads) version 3.10 up to 3.13.

## Installation

### via `ape`

```bash
ape plugins install solana
```

### via `pip`

```bash
pip install ape-solana
```

### via `setuptools`

```bash
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`:

```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`:

```bash
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

```python
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:

```python
signed_transaction = alice.sign_transaction(unsigned_transaction)
assert alice.check_signature(signed_transaction)
```

### Messages

```python
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-validator` automatically.

## 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.
