An SDK for interacting with the Kadena Blockchain
Project description
To Use
from kadena_sdk import KadenaSdk, KeyPair
# Create your keypair and setup the SDK with the endpoint you desire in life.
key_pair = KeyPair(type='json',
priv_key='5e8b125c89ed409f2cfcc6e863e8aafd60b9d80a4d2333a12592f7a961a62bf8',
pub_key='ad273a54460305767e2e36f41d1a5fe78c48474a6e3bc18624d53fbbbb5974bb')
# base_url will default to https://api.testnet.chainweb.com
# KeyPair isn't required, but no sigs will be included in any local/send calls
kadena = KadenaSdk(base_url='https://api.chainweb.com',
key_pair=key_pair)
# Very open ended: Work directly with the payload.
payload = kadena.build_exec_payload(
'(format "{}" [(read-msg "test")])',
env_data={'test': 'hello'}
)
# SDK works with whichever chains you choose!
chain_ids = ['0', '1']
# Commands is a dictionary where each key is the chain id and the value
# is the command to be sent
cmds = kadena.build_command(payload, chain_ids)
# You can use local or send to dirty read or commit respectively.
# These are the /local and /send endpoints.
res = kadena.local(cmds)
# Responses are in a dictionary with keys being the chains
# that were interacted with
print(res['0'].json())
# You can also listen to commands. This is a blocking command.
# Pass in the transaction id and the chain you want to listen on.
kadena.listen('tx_id', '0')
## Lastly, if you want to just run some pact code, you can do so
res = kadena.run_pact(
'(format "Test {}" [(read-msg "test")])',
env_data={'test': 'hello'}
)
To Build and Deploy
python3 -m build
python3 -m twine upload dist/*
To Test
pytest
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
kadena_sdk-2.0.4.tar.gz
(7.5 kB
view details)
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 kadena_sdk-2.0.4.tar.gz.
File metadata
- Download URL: kadena_sdk-2.0.4.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2142b0680144d5af97f4281e77d5c5f6baab466fe276cd4bf37a98b9b5ad162b
|
|
| MD5 |
51c108412f3afc8dd216df0801199f30
|
|
| BLAKE2b-256 |
9ff8630cb46550d39f74d29955b2c595bd480fcb58dc158a46ed9b6fc80a708b
|
File details
Details for the file kadena_sdk-2.0.4-py3-none-any.whl.
File metadata
- Download URL: kadena_sdk-2.0.4-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed9528d321cdb045fb2dd7ead5ad50fa230295f7988431dd7ebeeb70d50d9ad7
|
|
| MD5 |
3cdc3e39f3aea922519270f7c6126d60
|
|
| BLAKE2b-256 |
1660fda88ed82c0450a26a01cbeb9edbb5ceacd10c57d6821b80decd70a19bb7
|