Skip to main content

No project description provided

Project description

alkahest-py

build

  1. install uv & the rust toolchain. install maturin with uv tool install maturin

  2. 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
  1. build alkahest-py
cd alkahest-py
uv run maturin build
  1. generate docs via cargo doc --open

usage

  1. 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 (or uv pip install ...). your exact file might be different by system, but should be in the same directory.

  2. 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())
  1. see the cargo doc generated 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


Download files

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

Source Distribution

alkahest_py-0.1.0.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alkahest_py-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Hashes for alkahest_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da647dbd9ed7b2d8634571f9402a794176523528e7cdf1b54b59a675d2832cc8
MD5 c8d4ba33dd48700e0121c7d1693e38cc
BLAKE2b-256 0a4271bad6e4ebcc6900c759b713547285bdd6a4ddae69c017220ba9a54a7fe2

See more details on using hashes here.

File details

Details for the file alkahest_py-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for alkahest_py-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4e90b1491b603cc7169429011bf326d06f9bb54aea87908f5c1c40523a76919
MD5 8566babc62cc163a187f2a38c7c2cb9c
BLAKE2b-256 9caedf826ae3413fc1168ed26fbf4dd5c5a733b26d670b1b0a6444d4d30dec36

See more details on using hashes here.

Supported by

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