abortable
abortable<
T>(promise,signal):Promise<T>
Defined in: packages/synapse-core/src/utils/abort.ts:33
Reject with iso-web’s AbortError when the signal aborts, otherwise settle like the promise.
The underlying work is not cancelled, only the wait for it. Use it to cancel waits that take no
signal, and to get a plain AbortError from calls on a client scoped with viem’s
client.scope({ signal }). Those reject with the signal’s reason, and contract reads wrap it in
ContractFunctionExecutionError.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
promise |
Promise<T> |
signal |
AbortSignal | undefined |
Returns
Section titled “Returns”Promise<T>
Example
Section titled “Example”import { abortable } from '@filoz/synapse-core/utils'
import { getPdpDataSet } from '@filoz/synapse-core/warm-storage'
const dataSet = await abortable(getPdpDataSet(client.scope({ signal }), { dataSetId: 1n }), signal)