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.3.tar.gz (62.5 kB view details)

Uploaded Source

Built Distribution

solana-0.18.3-py3-none-any.whl (77.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: solana-0.18.3.tar.gz
  • Upload date:
  • Size: 62.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.1 Linux/5.4.72-microsoft-standard-WSL2

File hashes

Hashes for solana-0.18.3.tar.gz
Algorithm Hash digest
SHA256 59a664e7008f9a385447e6e870b241df4954dc2b889cc278de96047d6b09d181
MD5 d006563b1bf1ef628010b17910a6229b
BLAKE2b-256 bc2bcadf2bab474e31d90efc0935801bf9536b10d482d3d1053e2c16bc9f91be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: solana-0.18.3-py3-none-any.whl
  • Upload date:
  • Size: 77.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.1 Linux/5.4.72-microsoft-standard-WSL2

File hashes

Hashes for solana-0.18.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a7778f477e4c2d880f6ce181830fcc2bc78a93e69abb645d49c77ba2a8105afe
MD5 859b438bbaa4913fba9d063f4d23476a
BLAKE2b-256 68e7c600da362e30b378f379218ae50941213fb024517f1a7bfa4e4f20e026ea

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