> For the complete documentation index, see [llms.txt](/llms.txt)

# @mysten/zksend

Migrate @mysten/zksend to 2.0 with client extension pattern and simplified API



This package now exports a client extension that integrates with Sui clients through the Core API.
Use `SuiGrpcClient` for most applications.

## Breaking changes [#breaking-changes]

* **Client extension**: The zkSend SDK is now a client extension (`client.$extend(zksend())`)
* **Non-contract links removed**: Only contract-based links are now supported. The `contract` option
  no longer accepts `null`
* **`isContractLink` removed**: The `isContractLink` option has been removed from `ZkSendLink`
* **`calculateGas` removed**: The `calculateGas` option has been removed from
  `CreateZkSendLinkOptions`
* **Data fetching helpers removed**: `getAssetsFromTransaction`, `isOwner`, and `ownedAfterChange`
  are no longer exported

## Migration [#migration]

Update your code to use the client extension:

```diff
- import { ZkSendLinkBuilder, ZkSendLink } from '@mysten/zksend';
+ import { zksend } from '@mysten/zksend';
+ import { SuiGrpcClient } from '@mysten/sui/grpc';

+ const client = new SuiGrpcClient({
+   baseUrl: 'https://fullnode.testnet.sui.io:443',
+   network: 'testnet',
+ }).$extend(zksend());
```

### Creating a link builder [#creating-a-link-builder]

```diff
- const builder = new ZkSendLinkBuilder({
-   client,
-   sender: address,
-   network: 'testnet',
- });
+ const link = client.zksend.linkBuilder({
+   sender: address,
+ });
```

### Loading a link [#loading-a-link]

```diff
- const link = new ZkSendLink({
-   client,
-   keypair,
-   network: 'testnet',
- });
+ const link = await client.zksend.loadLink({
+   address: linkAddress,
+   // or: keypair: linkKeypair,
+ });
```

### Loading from URL [#loading-from-url]

```diff
- const link = await ZkSendLink.fromUrl(url, {
-   client,
-   network: 'testnet',
- });
+ const link = await client.zksend.loadLinkFromUrl(url);
```

## Complete example [#complete-example]

```ts
import { zksend } from '@mysten/zksend';
import { SuiGrpcClient } from '@mysten/sui/grpc';

// Create client with zkSend extension
const client = new SuiGrpcClient({
	baseUrl: 'https://fullnode.testnet.sui.io:443',
	network: 'testnet',
}).$extend(zksend());

// Create a new link
const linkBuilder = client.zksend.linkBuilder({
	sender: myAddress,
});

// Add assets to the link
linkBuilder.addClaimableMist(1_000_000_000n); // 1 SUI

// Create the transaction and get the claim URL
const tx = await linkBuilder.createSendTransaction();
const linkUrl = linkBuilder.getLink();

// Later, load an existing link
const existingLink = await client.zksend.loadLinkFromUrl(linkUrl);
const assets = existingLink.assets;
```
