solpyb
Pythonic Bridge to Solana Programs.
Overview
The project simplifies executing and getting responses from Solana Programs (a.k.a Smart Contracts), that are running on the Solana Blockchain.
Setup
pip install solpyb
A Simple Example
import asyncio
from solpyb import SolBase, load_wallet
class MyProgram(SolBase):
slope: float
intercept: float
contract = MyProgram(
program_id="64ZdvpvU73ig1NVd36xNGqpy5JyAN2kCnVoF7M4wJ53e", payer=load_wallet()
)
if asyncio.run(contract([10.5, 20.7, 30.8, 40.12, 50.20, 60.0])):
print(f"slope: {contract.slope} intercept {contract.intercept}")
(This script is complete, it should run "as is")
What's going on here:
- "64ZdvpvU73ig1NVd36xNGqpy5JyAN2kCnVoF7M4wJ53e" is a Solana Program (a.k.a Smart Contract) that performs a Linear regression on set of points and returns the slope and intercept as floats.
- load_wallet() loads the default wallet keys (
.config/solana/id.json), as the payer for the transaction. - MyProgram class implement a Pythonic wrapper class. Calling the call creates a transaction on chain and result is returned,
- SolBase populates
slopeandinterceptwith the values returned from the Blockchain.
Metadata
Release files for solpyb 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| solpyb-0.0.2.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| solpyb-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.2 kB
Release files / solpyb-0.0.2.tar.gz
| Download URL | solpyb-0.0.2.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21844d74e4daeefcd75e6d43540105764b6c375fd422954a9d623c8a1d2e0a77
|
|
BLAKE2b-256 checksum How to use checksums |
d22bca6d52bab0210661147439057aff27f9b09434b37575259d503a889cc39b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / solpyb-0.0.2-py3-none-any.whl
| Download URL | solpyb-0.0.2-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07f19447283e7d88d9cb26aea6ee537bed03a2e6e9d5545e296aa8fedb316125
|
|
BLAKE2b-256 checksum How to use checksums |
addc6e5a780bcbd3905a42070ada0fd0f0613df810c80ebefbd57f22bea786cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|