AI
Transaction Execution
thirdweb AI can either auto execute transactions or prepare them for signing.
- Auto Execute: The API will auto execute the transaction. Requires wallet authentication.
- Prepare for Signing: The API will only prepare the transaction for signing. The user will need to sign the transaction manually.
Requirements:
- The context object must be set with:
from
set to the wallet address to execute the transaction fromauto_execute_transaction
set totrue
- (Optional)
chain_ids
set to the chain IDs to execute the transaction on
- The API must be called with either:
- your
x-secret-key
header for server wallet authentication - OR a
Authorization
header with a valid wallet JWT for user wallet authentication
- your
Model behavior:
If all the requirements are met, the transaction will be executed automatically and the model will return a message with the transaction ID.
It will also include an actions
array with a monitor_transaction
action. This action can be used to monitor the transaction status and get the transaction receipt via the thirdweb API.
POST
/ai/chat
When the auto_execute
parameter is set to false
or omitted, the API will prepare the transaction for signing and return the transaction data in the actions
array as a 'sign_transaction' action type.
POST
/ai/chat