# SDK Maintainers

> Migration guide for SDK maintainers and library authors upgrading to 2.0.

# Upgrading SDKs to @mysten/sui@2.0.0

This guide covers the key breaking changes for SDK maintainers building on top of `@mysten/sui`.

For comprehensive SDK development patterns, see the [Building SDKs guide](/sui/sdk-building).

## Use `ClientWithCoreApi`

Accept `ClientWithCoreApi` instead of `SuiClient` to support all 3 Sui clients (JSON-RPC, GraphQL,
gRPC):

```diff
- import { SuiClient } from '@mysten/sui/client';
+ import type { ClientWithCoreApi } from '@mysten/sui/client';

-   client: SuiClient;
+   client: ClientWithCoreApi;
}
```

## Access data through `client.core` methods

All data access methods are namespaced under `client.core`:

```diff
- const result = await this.client.getObject({ objectId });
+ const result = await this.client.core.getObject({ objectId });

- const result = await this.client.getOwnedObjects({ owner });
+ const result = await this.client.core.listOwnedObjects({ owner });
```

| v1.x Method                      | v2.0 Method                       |
| -------------------------------- | --------------------------------- |
| `client.getObject()`             | `client.core.getObject()`         |
| `client.getOwnedObjects()`       | `client.core.listOwnedObjects()`  |
| `client.getDynamicFieldObject()` | `client.core.getDynamicField()`   |
| `client.getDynamicFields()`      | `client.core.listDynamicFields()` |
| `client.multiGetObjects()`       | `client.core.getObjects()`        |

See the [Core API documentation](/sui/clients/core) for all available methods.

## Use peer dependencies

Declare `@mysten/*` packages as peer dependencies:

```json
{
	"peerDependencies": {
		"@mysten/sui": "^2.0.0"
	},
	"devDependencies": {
		"@mysten/sui": "^2.0.0"
	}
}
```

## Client extensions

v2.0 introduces client extensions that let users add your SDK to any Sui client:

```typescript

	return {
		name: 'mySDK',
		register: (client: ClientWithCoreApi) => {
			return new MySDKClient({ client });
		},
	};
}

// Users can then extend any client
const client = new SuiGrpcClient({ ... }).$extend(mySDK());
await client.mySDK.doSomething();
```

See the [Building SDKs guide](/sui/sdk-building#client-extensions) for the complete extension
pattern.

## Code generation

Use [`@mysten/codegen`](/codegen) to generate type-safe TypeScript bindings from your Move packages.
See the [codegen documentation](/codegen) for setup instructions.

For complete SDK development patterns including client extensions, transaction thunks, and best
practices, see the [Building SDKs guide](/sui/sdk-building).