# abortable

> **abortable**\<`T`\>(`promise`, `signal`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`T`\>

Defined in: [packages/synapse-core/src/utils/abort.ts:32](https://github.com/FilOzone/synapse-sdk/blob/5989c4b03ed2fe4cf8b1ef29efe1d4ff1ad4c7bc/packages/synapse-core/src/utils/abort.ts#L32)

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](/reference/filoz/synapse-core/utils/functions/withsignal/) client, which viem wraps in `ContractFunctionExecutionError`.

## Type Parameters

| Type Parameter |
| ------ |
| <a id="type-parameter-t"></a> `T` |

## Parameters

| Parameter | Type |
| ------ | ------ |
| `promise` | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`T`\> |
| `signal` | [`AbortSignal`](https://developer.mozilla.org/docs/Web/API/AbortSignal) \| `undefined` |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`T`\>

## Example

```ts
import { abortable } from '@filoz/synapse-core/utils'
import { getPdpDataSet } from '@filoz/synapse-core/warm-storage'

const dataSet = await abortable(getPdpDataSet(client, { dataSetId: 1n }), signal)
```