API Task
This Dynamic Oracle implementation allows your smart contract to execute a pre deployed Truebit API Task, providing off-chain computation with on-chain guarantees.
3
5
Call _requestExecution
bytes memory payload = abi.encode(
'Your Namespace', // namespace - identifies the API collection
'Your Taskname', // taskname - specific API task to execute
'GET', // HTTP method
'/store/order/{orderId}', // API endpoint path
100000, // executionTimeout - max time for execution
false, // async - whether to run asynchronously
orderId // orderId - the parameter for the API call
);
// Submit the execution request to the Truebit network
uint256 wtExecutionId = _requestExecution(
"request(namespace,taskname,method,path,executionTimeout,async,params(orderId:uint256))",
payload,
DOTypes.ExecutionType.API
);Grant Permissions
User Contract Permission
truebit auth grant <namespace_to_grant> <address_grantee>Truebit Verify Hub Access
truebit auth grant <namespace_to_grant> <truebit_hub_address>Last updated
Was this helpful?