Documentation Index
Fetch the complete documentation index at: https://docs.peaq.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Receive status updates during submission/finalization.
from peaq_robot import PeaqRobot
from peaq_robot.types import TxOptions, ConfirmationMode, TransactionStatusCallback
import asyncio
def on_status(s: TransactionStatusCallback):
print(s.model_dump())
sdk = PeaqRobot()
res = sdk.store.add_data(
"FINAL_CB", {"ok": True},
tx_options=TxOptions(mode=ConfirmationMode.FINAL),
on_status=on_status,
)
final_receipt = asyncio.run(res.finalize)
Possible status: BROADCAST, IN_BLOCK, FINALIZED.
Sample callback prints (abridged):
{'status': 'TransactionStatus.BROADCAST', 'hash': '0x3b7f...e1', 'total_confirmations': 0}
{'status': 'TransactionStatus.IN_BLOCK', 'hash': '0x3b7f...e1', 'total_confirmations': 1}
{'status': 'TransactionStatus.FINALIZED', 'hash': '0x3b7f...e1', 'total_confirmations': 10}