@@ -29,13 +29,15 @@ A `client.arkiv.*` approach is in line with web3.py's module pattern.
2929It clearly communicates that arkiv is a module extension just like eth, net, etc.
3030
3131## Hello World
32+
33+ ### Synchronous API
3234Here's a "Hello World!" example showing how to use the Python Arkiv SDK:
3335
3436``` python
3537from arkiv import Arkiv
3638
37- # Create Arkiv client with default settings:
38- # - starting and connecting to a containerized Arkiv node
39+ # Create Arkiv client with default settings:
40+ # - starting and connecting to a containerized Arkiv node
3941# - creating a funded default account
4042client = Arkiv()
4143print (f " Client: { client} , connected: { client.is_connected()} " )
@@ -46,7 +48,7 @@ print(f"Balance: {client.from_wei(client.eth.get_balance(client.eth.default_acco
4648entity_key, tx_hash = client.arkiv.create_entity(
4749 payload = b " Hello World!" ,
4850 annotations = {" type" : " greeting" , " version" : 1 },
49- btl = 1000
51+ btl = 1000
5052)
5153
5254# Check and print entity key
@@ -62,6 +64,33 @@ client.arkiv.delete_entity(entity_key)
6264print (" Entity deleted" )
6365```
6466
67+ ### Asynchronous API
68+ For async/await support, use ` AsyncArkiv ` :
69+
70+ ``` python
71+ import asyncio
72+ from arkiv import AsyncArkiv
73+
74+ async def main ():
75+ # Create async client with default settings
76+ async with AsyncArkiv() as client:
77+ # Create entity with data and annotations
78+ entity_key, tx_hash = await client.arkiv.create_entity(
79+ payload = b " Hello Async World!" ,
80+ annotations = {" type" : " greeting" , " version" : 1 },
81+ btl = 1000
82+ )
83+
84+ # Get entity and check existence
85+ entity = await client.arkiv.get_entity(entity_key)
86+ exists = await client.arkiv.entity_exists(entity_key)
87+
88+ # Clean up - delete entity
89+ await client.arkiv.delete_entity(entity_key)
90+
91+ asyncio.run(main())
92+ ```
93+
6594### Web3 Standard Support
6695``` python
6796from web3 import HTTPProvider
0 commit comments