Skip to main content

Solana Python API

Project description

Actions Status PyPI version PyPI pyversions Codecov License: MIT Code style: black

Solana.py

Solana Python API built on the JSON RPC API.

Python version of solana-web3.js for interacting with Solana.

Read the Documentation.

Quickstart

Installation

pip install solana

General Usage

import solana

API Client

from solana.rpc.api import Client

http_client = Client("https://api.devnet.solana.com")

Async API Client

import asyncio
from solana.rpc.async_api import AsyncClient

async def main():
    async with AsyncClient("https://api.devnet.solana.com") as client:
        res = await client.is_connected()
    print(res)  # True

    # Alternatively, close the client explicitly instead of using a context manager:
    client = AsyncClient("https://api.devnet.solana.com")
    res = await client.is_connected()
    print(res)  # True
    await client.close()

asyncio.run(main())

Development

Setup

  1. Install poetry
  2. Install dev dependencies:
poetry install
  1. Activate the poetry shell.
poetry shell

Lint

make lint

Tests

# All tests
make tests
# Unit tests only
make unit-tests
# Integration tests only
make int-tests

Start a Solana Localnet

Install docker.

# Update/pull latest docker image
make update-localnet
# Start localnet instance
make start-localnet

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solana-0.18.2.tar.gz (62.5 kB view details)

Uploaded Source

Built Distribution

solana-0.18.2-py3-none-any.whl (76.9 kB view details)

Uploaded Python 3

File details

Details for the file solana-0.18.2.tar.gz.

File metadata

  • Download URL: solana-0.18.2.tar.gz
  • Upload date:
  • Size: 62.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.7.9 Darwin/20.6.0

File hashes

Hashes for solana-0.18.2.tar.gz
Algorithm Hash digest
SHA256 0431bd10cbe92d82a0c102e9f736483afc06ffbb6af18b81b06aec0c5e029813
MD5 d4a8933140a7de032446dfe40ae56a1d
BLAKE2b-256 c3cf129477a6a7e425d86f116978842427659046b8966931a4dd85106afb2cfc

See more details on using hashes here.

File details

Details for the file solana-0.18.2-py3-none-any.whl.

File metadata

  • Download URL: solana-0.18.2-py3-none-any.whl
  • Upload date:
  • Size: 76.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.7.9 Darwin/20.6.0

File hashes

Hashes for solana-0.18.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c0550915db89261ed78335ee5728341e7094444a6442529d9c9407e364185456
MD5 734cdeadf4a791e9e42a9892f7e9e9ea
BLAKE2b-256 91c39d673ce1d0ed877122a2a2b419b26e4c3e128f2ea7638da6455ec47da021

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page