abortable
abortable<
T>(promise,signal):Promise<T>
Defined in: packages/synapse-core/src/utils/abort.ts:32
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, such as viem’s waitForTransactionReceipt, and to get a plain AbortError from contract
reads on a withSignal client, which viem wraps 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, { dataSetId: 1n }), signal)