AsyncToolChecker wraps action-status polling logic.
Track long-running actions triggered by tool execution
AsyncToolChecker wraps action-status polling logic.
new AsyncToolChecker({ coreApiProvider })
checkcheck({ toolName, protocol, descriptor }): Promise<AwaitActionResult>
const result = await checker.check({
toolName: 'swap',
protocol: 'lifi',
descriptor: { txHash: '0x...' },
})
if (result.isError) {
console.error(result.error)
} else {
console.log(result.response.pollStatus)
}
subscribesubscribe(
params,
{
onStatusChange,
onError,
},
{
interval,
retryThreshold,
maxRetries,
maxDuration,
},
): { unsubscribe(): void }
const sub = checker.subscribe(
{
toolName: 'bridge',
protocol: 'lifi',
descriptor: { txHash: '0x...' },
},
{
onStatusChange: ({ current }) => console.log(current.pollStatus),
onError: (error) => console.error(error),
},
{
interval: 5,
retryThreshold: 30,
maxRetries: 5,
maxDuration: 600,
},
)
sub.unsubscribe()