No project description provided
Project description
alkahest-py
build
-
install uv & the rust toolchain. install maturin with
uv tool install maturin -
clone this repo and https://github.com/coophive/alkahest-rs into parallel directories
mkdir alkahest-sdks && cd alkahest-sdks
git clone https://github.com/coophive/alkahest-rs
git clone https://github.com/coophive/alkahest-py
- build alkahest-py
cd alkahest-py
uv run maturin build
- generate docs via
cargo doc --open
usage
-
install into any python project via the wheel, e.g.
pip install path-to-alkahest-py/target/wheels/alkahest_py-0.1.0-cp313-cp313-macosx_11_0_arm64.whl(oruv pip install ...). your exact file might be different by system, but should be in the same directory. -
import the module and create an AlkahestClient instance
from alkahest_py import AlkahestClient
client = AlkahestClient(
"0xprivatekey",
"https://rpc_url.com"
)
async def main():
hash = await client.erc20.approve(
{"address": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "value": 100},
"escrow",
)
print(hash)
if __name__ == "__main__":
asyncio.run(main())
- see the
cargo docgenerated docs for API details. most functions are in the submodules Erc20Client, Erc721Client etc. the alkahest-rs docs will probably be more useful than the alkahest-py docs, since many rust types get wrangled into python strings. FixedBytes<32> and Address are strings starting with "0x" in python, but Bytes is python bytes (b"..."). structs (ArbiterData, Erc20Data) are dictionaries with item names matching the struct's fields. ApprovalPurpose can be "escrow" or "payment".
note that ArbiterData ({"arbiter": "0x...", "demand": b"..."}) expects demand as abi encoded bytes. for arbiters that aren't explicitly supported, you'll have to manually encode the Solidity struct, e.g. with eth_abi. passing a dictionary matching the solidity struct's format isn't supported.
see alkahest_py/test.py for a usage example.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alkahest_py-0.1.0.tar.gz.
File metadata
- Download URL: alkahest_py-0.1.0.tar.gz
- Upload date:
- Size: 33.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da647dbd9ed7b2d8634571f9402a794176523528e7cdf1b54b59a675d2832cc8
|
|
| MD5 |
c8d4ba33dd48700e0121c7d1693e38cc
|
|
| BLAKE2b-256 |
0a4271bad6e4ebcc6900c759b713547285bdd6a4ddae69c017220ba9a54a7fe2
|
File details
Details for the file alkahest_py-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: alkahest_py-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e90b1491b603cc7169429011bf326d06f9bb54aea87908f5c1c40523a76919
|
|
| MD5 |
8566babc62cc163a187f2a38c7c2cb9c
|
|
| BLAKE2b-256 |
9caedf826ae3413fc1168ed26fbf4dd5c5a733b26d670b1b0a6444d4d30dec36
|