Skip to content

waitForAddPieces

waitForAddPieces(options): Promise<OutputType>

Defined in: packages/synapse-core/src/sp/wait-for-receipt.ts:186

Wait for an add pieces transaction on chain, following replace-by-fee replacements.

Uses viem’s waitForTransactionReceipt on the hash the SP returned, so a sped-up or repriced replacement resolves with its own hash in confirmedTxHash. If the wait times out, it checks the nonce FWSS records before failing, in case a replacement landed unnoticed.

For recovery after a crash, call getAddPiecesResult with the persisted extraData instead: after a replacement the original hash can no longer be looked up.

Parameter Type Description
options OptionsType waitForAddPieces.OptionsType

Promise<OutputType>

The outcome waitForAddPieces.OutputType

const result = await SP.addPieces(client, options)
const { dataSetId, pieceIds, confirmedTxHash } = await SP.waitForAddPieces({ client, ...result })

Errors waitForAddPieces.ErrorType. TransactionNotAppliedError when the landed transaction reverted or was a cancellation.