# SPRegistryService

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:38](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L38)

## Constructors

### Constructor

```ts
new SPRegistryService(provider, registryAddress): SPRegistryService;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:46](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L46)

Constructor for SPRegistryService

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `provider` | `Provider` |
| `registryAddress` | `string` |

#### Returns

`SPRegistryService`

## Methods

### activeProviderCount()

```ts
activeProviderCount(): Promise<number>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:317](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L317)

Get number of active providers

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`number`\>

Active provider count

***

### addPDPProduct()

```ts
addPDPProduct(
   signer, 
   pdpOffering, 
capabilities): Promise<TransactionResponse>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:332](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L332)

Add PDP product to provider

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `signer` | `Signer` | Provider's signer |
| `pdpOffering` | [`PDPOffering`](/reference/filoz/synapse-sdk/spregistry/interfaces/pdpoffering/) | PDP offering details |
| `capabilities` | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `string`\> | Optional capability keys |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TransactionResponse`\>

Transaction response

***

### getActiveProvidersByProductType()

```ts
getActiveProvidersByProductType(productType): Promise<ProviderInfo[]>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:254](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L254)

Get active providers by product type (handles pagination internally)

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `productType` | `0` | Product type to filter by |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`ProviderInfo`](/reference/filoz/synapse-sdk/synapse/interfaces/providerinfo/)[]\>

List of providers with specified product type

***

### getAllActiveProviders()

```ts
getAllActiveProviders(): Promise<ProviderInfo[]>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:222](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L222)

Get all active providers (handles pagination internally)

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`ProviderInfo`](/reference/filoz/synapse-sdk/synapse/interfaces/providerinfo/)[]\>

List of all active providers

***

### getPDPService()

```ts
getPDPService(providerId): Promise<
  | PDPServiceInfo
| null>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:391](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L391)

Get PDP service info for a provider

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `providerId` | `number` | Provider ID |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<
  \| [`PDPServiceInfo`](/reference/filoz/synapse-sdk/spregistry/interfaces/pdpserviceinfo/)
  \| `null`\>

PDP service info or null if not found

***

### getProvider()

```ts
getProvider(providerId): Promise<
  | ProviderInfo
| null>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:161](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L161)

Get provider information by ID

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `providerId` | `number` | Provider ID |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<
  \| [`ProviderInfo`](/reference/filoz/synapse-sdk/synapse/interfaces/providerinfo/)
  \| `null`\>

Provider info with decoded products

***

### getProviderByAddress()

```ts
getProviderByAddress(address): Promise<
  | ProviderInfo
| null>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:188](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L188)

Get provider information by address

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `address` | `string` | Provider address |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<
  \| [`ProviderInfo`](/reference/filoz/synapse-sdk/synapse/interfaces/providerinfo/)
  \| `null`\>

Provider info with decoded products

***

### getProviderCount()

```ts
getProviderCount(): Promise<number>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:307](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L307)

Get total number of providers

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`number`\>

Total provider count

***

### getProviderIdByAddress()

```ts
getProviderIdByAddress(address): Promise<number>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:212](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L212)

Get provider ID by address

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `address` | `string` | Provider address |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`number`\>

Provider ID (0 if not found)

***

### getProviders()

```ts
getProviders(providerIds): Promise<ProviderInfo[]>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:431](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L431)

Get multiple providers by IDs using Multicall3 for efficiency

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `providerIds` | `number`[] | Array of provider IDs |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`ProviderInfo`](/reference/filoz/synapse-sdk/synapse/interfaces/providerinfo/)[]\>

Array of provider info

***

### isProviderActive()

```ts
isProviderActive(providerId): Promise<boolean>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:288](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L288)

Check if provider is active

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `providerId` | `number` | Provider ID |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\>

Whether provider is active

***

### isRegisteredProvider()

```ts
isRegisteredProvider(address): Promise<boolean>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:298](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L298)

Check if address is a registered provider

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `address` | `string` | Address to check |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\>

Whether address is registered

***

### providerHasProduct()

```ts
providerHasProduct(providerId, productType): Promise<boolean>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:419](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L419)

Check if provider has a specific product type

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `providerId` | `number` | Provider ID |
| `productType` | `0` | Product type to check |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\>

Whether provider has the product

***

### registerProvider()

```ts
registerProvider(signer, info): Promise<TransactionResponse>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:103](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L103)

Register as a new service provider with optional PDP product

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `signer` | `Signer` | Signer to register as provider |
| `info` | [`ProviderRegistrationInfo`](/reference/filoz/synapse-sdk/spregistry/interfaces/providerregistrationinfo/) | Provider registration information |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TransactionResponse`\>

Transaction response containing the provider ID

#### Example

```typescript
const tx = await spRegistry.registerProvider(signer, {
  payee: '0x...', // Address that will receive payments
  name: 'My Storage Provider',
  description: 'High-performance storage service',
  pdpOffering: {
    serviceURL: 'https://provider.example.com',
    minPieceSizeInBytes: SIZE_CONSTANTS.KiB,
    maxPieceSizeInBytes: SIZE_CONSTANTS.GiB,
    // ... other PDP fields
  },
  capabilities: { 'region': 'us-east', 'tier': 'premium' }
})

// Wait for transaction and get provider ID from event
const receipt = await tx.wait()
const event = receipt.logs.find(log =>
  log.topics[0] === ethers.id('ProviderRegistered(uint256,address,address)')
)
const providerId = event ? parseInt(event.topics[1], 16) : null
```

***

### removeProduct()

```ts
removeProduct(signer, productType): Promise<TransactionResponse>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:381](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L381)

Remove product from provider

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `signer` | `Signer` | Provider's signer |
| `productType` | `0` | Type of product to remove |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TransactionResponse`\>

Transaction response

***

### removeProvider()

```ts
removeProvider(signer): Promise<TransactionResponse>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:149](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L149)

Remove provider registration

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `signer` | `Signer` | Provider's signer |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TransactionResponse`\>

Transaction response

***

### updatePDPProduct()

```ts
updatePDPProduct(
   signer, 
   pdpOffering, 
capabilities): Promise<TransactionResponse>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:357](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L357)

Update PDP product with capabilities

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `signer` | `Signer` | Provider's signer |
| `pdpOffering` | [`PDPOffering`](/reference/filoz/synapse-sdk/spregistry/interfaces/pdpoffering/) | Updated PDP offering |
| `capabilities` | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `string`\> | Updated capability key-value pairs |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TransactionResponse`\>

Transaction response

***

### updateProviderInfo()

```ts
updateProviderInfo(
   signer, 
   name, 
description): Promise<TransactionResponse>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:135](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L135)

Update provider information

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `signer` | `Signer` | Provider's signer |
| `name` | `string` | New name |
| `description` | `string` | New description |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TransactionResponse`\>

Transaction response

***

### create()

```ts
static create(provider, registryAddress): Promise<SPRegistryService>;
```

Defined in: [packages/synapse-sdk/src/sp-registry/service.ts:54](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-sdk/src/sp-registry/service.ts#L54)

Create a new SPRegistryService instance

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `provider` | `Provider` |
| `registryAddress` | `string` |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`SPRegistryService`\>