Skip to content

registerProvider

registerProvider(client, options): Promise<`0x${string}`>

Defined in: packages/synapse-core/src/sp-registry/register-provider.ts:106

Register a new service provider in the Service Provider Registry

Registers a new service provider with the specified information and PDP offering. Requires a registration fee to be paid (typically 5 FIL).

Parameter Type Description
client Client<Transport, Chain, Account> The viem client with account to use for the transaction.
options OptionsType registerProvider.OptionsType

Promise<`0x${string}`>

The transaction hash registerProvider.OutputType

Errors registerProvider.ErrorType

import { registerProvider } from '@filoz/synapse-core/sp-registry'
import { createWalletClient, http, parseEther } 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 hash = await registerProvider(client, {
  payee: account.address,
  name: 'My Storage Provider',
  description: 'High-performance storage service',
  pdpOffering: {
    serviceURL: 'https://provider.example.com',
    minPieceSizeInBytes: 1024n,
    maxPieceSizeInBytes: 1073741824n,
    storagePricePerTibPerDay: parseEther('0.1'),
    minProvingPeriodInEpochs: 2880n,
    location: 'us-east',
    paymentTokenAddress: '0x0000000000000000000000000000000000000000',
  },
  capabilities: { region: 'us-east', tier: 'premium' },
})

console.log(hash)