Skip to content

useUploadPieces

useUploadPieces(props?): UseMutationResult<{ confirmations: object[]; failed: object[]; pieces: object[]; }, Error, UseUploadPiecesVariables, unknown>

Defined in: synapse-react/src/warm-storage/use-upload-pieces.ts:106

Upload files to an existing data set with synapse-core only (SP.uploadPieces).

Each file is streamed to the data set’s provider, which computes its PieceCID. All parked pieces are added to the data set in one signed add-pieces request, and the hook waits for the transaction to be confirmed. Files that fail are returned in failed; the others are still added.

Signs with sessionKey when given, otherwise with the connected wallet.

ParameterTypeDescription
props?UseUploadPiecesPropsThe props to use. UseUploadPiecesProps

UseMutationResult<{ confirmations: object[]; failed: object[]; pieces: object[]; }, Error, UseUploadPiecesVariables, unknown>

The upload mutation. UseUploadPiecesResult