Skip to content

schedulePieceDeletions

schedulePieceDeletions(client, options): Promise<OutputType>

Defined in: packages/synapse-core/src/sp/schedule-piece-deletion.ts:148

Schedule piece deletions in one transaction.

Call the Service Provider API to schedule the piece deletion.

Parameter Type Description
client Client<Transport, Chain, Account> The client to use to schedule the piece deletion.
options OptionsType schedulePieceDeletions.OptionsType

Promise<OutputType>

Schedule piece deletions operation hash schedulePieceDeletions.OutputType

Errors schedulePieceDeletions.ErrorType

import { schedulePieceDeletions } from '@filoz/synapse-core/sp'
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { calibration } from '@filoz/synapse-core/chains'

const account = privateKeyToAccount('0x...')
const client = createWalletClient({
  account,
  chain: calibration,
  transport: http(),
})

const result = await schedulePieceDeletions(client, {
  pieceIds: [1n, 2n],
  dataSetId: 1n,
  clientDataSetId: 1n,
  serviceURL: 'https://pdp.example.com',
})

console.log(result.hash)