waitForFlushReceipt
waitForFlushReceipt(
client,result,options?):Promise<OutputType>
Defined in: packages/synapse-core/src/sp/create-piece-batcher.ts:573
Wait for a flushed batch to land on chain and get its piece IDs.
Follows replace-by-fee replacements with waitForAddPieces. A flush that created the data set already waited for its transaction, so its outcome is returned without waiting again.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client |
Client<Transport, Chain> |
The client to wait with. |
result |
FlushResult |
The flush result, from PieceBatcher.flush or any piece’s result. |
options |
OptionsType |
waitForFlushReceipt.OptionsType |
Returns
Section titled “Returns”The outcome waitForFlushReceipt.OutputType. pieceIds[batchIndex] is a piece’s ID.
Throws
Section titled “Throws”Errors waitForFlushReceipt.ErrorType
Example
Section titled “Example”import { createPieceBatcher, waitForFlushReceipt } from '@filoz/synapse-core/sp'
const batcher = createPieceBatcher(client, { dataSet })
const result = await batcher.upload({ data: file })
const { pieceIds } = await waitForFlushReceipt(client, result)
const pieceId = pieceIds[result.batchIndex]