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:
fromset to the wallet address to execute the transaction fromauto_execute_transactionset totrue- (Optional)
chain_idsset to the chain IDs to execute the transaction on
- The API must be called with either:
- your
x-secret-keyheader for server wallet authentication - OR a
Authorizationheader 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/chatWhen 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