getAddPiecesResult
getAddPiecesResult(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/warm-storage/submission-result.ts:75
Check on chain whether an add pieces submission landed, without the SP or any transaction hash.
FWSS records each used add pieces nonce, so this works whichever transaction carried the call,
including a replace-by-fee replacement whose hash was never seen. If added is false, resubmitting
the same extraData is safe: FWSS rejects a reused nonce, so the pieces can never be added twice.
Do not sign new extra data for the same pieces while the original could still land.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client |
Client<Transport, Chain> |
The client to use to read the nonce. |
options |
OptionsType |
getAddPiecesResult.OptionsType |
Returns
Section titled “Returns”The result getAddPiecesResult.OutputType
Throws
Section titled “Throws”Errors getAddPiecesResult.ErrorType
Example
Section titled “Example”import { getAddPiecesResult } from '@filoz/synapse-core/warm-storage'
import { createPublicClient, http } from 'viem'
import { calibration } from '@filoz/synapse-core/chains'
const client = createPublicClient({
chain: calibration,
transport: http(),
})
// `extraData` and `pieceCount` were persisted from `addPieces` before a crash
const result = await getAddPiecesResult(client, {
payer: '0x0000000000000000000000000000000000000000',
extraData: '0x...',
pieceCount: 2,
})
if (result.added) {
console.log(result.dataSetId, result.pieceIds)
}