# waitForCreateDataSetAddPieces

> **waitForCreateDataSetAddPieces**(`options`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/sp/namespaces/waitforcreatedatasetaddpieces/type-aliases/outputtype/)\>

Defined in: [packages/synapse-core/src/sp/wait-for-receipt.ts:279](https://github.com/FilOzone/synapse-sdk/blob/840d7b2c6263846ac51b7558000e62dd68d33a44/packages/synapse-core/src/sp/wait-for-receipt.ts#L279)

Wait for a create data set and add pieces transaction on chain, following replace-by-fee replacements.

See [waitForAddPieces](/reference/filoz/synapse-core/sp/functions/waitforaddpieces/). For recovery after a crash, call `getCreateDataSetAndAddPiecesResult`.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `options` | [`OptionsType`](/reference/filoz/synapse-core/sp/namespaces/waitforcreatedatasetaddpieces/type-aliases/optionstype/) | [waitForCreateDataSetAddPieces.OptionsType](/reference/filoz/synapse-core/sp/namespaces/waitforcreatedatasetaddpieces/type-aliases/optionstype/) |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/sp/namespaces/waitforcreatedatasetaddpieces/type-aliases/outputtype/)\>

The outcome [waitForCreateDataSetAddPieces.OutputType](/reference/filoz/synapse-core/sp/namespaces/waitforcreatedatasetaddpieces/type-aliases/outputtype/)

## Example

```ts
const result = await SP.createDataSetAndAddPieces(client, options)
const { dataSetId, pieceIds } = await SP.waitForCreateDataSetAddPieces({ client, ...result })
```

## Throws

Errors [waitForCreateDataSetAddPieces.ErrorType](/reference/filoz/synapse-core/sp/namespaces/waitforcreatedatasetaddpieces/type-aliases/errortype/)