@mysten/zksend 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mysten/zksend
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9e067cf: Validate the new per-package release flow end-to-end across every public @mysten package.
8
+ No functional changes — empty patch bump to force the orchestrator to dispatch every
9
+ release-<pkg>.yml workflow with `dry_run=false` so each package publishes via OIDC trusted
10
+ publishing.
11
+ - Updated dependencies [9e067cf]
12
+ - @mysten/sui@2.16.1
13
+ - @mysten/utils@0.3.2
14
+ - @mysten/wallet-standard@0.20.2
15
+ - @mysten/window-wallet-core@0.1.5
16
+
3
17
  ## 1.1.0
4
18
 
5
19
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten/zksend",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Create claimable links for transferring coins and NFTs",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Mysten Labs <build@mystenlabs.com>",
@@ -31,24 +31,25 @@
31
31
  "devDependencies": {
32
32
  "@types/node": "^25.0.8",
33
33
  "typescript": "^5.9.3",
34
- "vitest": "^4.0.17",
35
- "@mysten/sui": "^2.16.0"
34
+ "vitest": "^4.0.17"
36
35
  },
37
36
  "dependencies": {
38
37
  "mitt": "^3.0.1",
39
38
  "nanostores": "^1.1.0",
40
39
  "valibot": "^1.2.0",
41
- "@mysten/utils": "^0.3.1",
42
- "@mysten/wallet-standard": "^0.20.1",
43
- "@mysten/window-wallet-core": "^0.1.4"
40
+ "@mysten/wallet-standard": "^0.20.2",
41
+ "@mysten/window-wallet-core": "^0.1.5",
42
+ "@mysten/utils": "^0.3.2"
44
43
  },
45
44
  "peerDependencies": {
46
- "@mysten/sui": "^2.16.0"
45
+ "@mysten/sui": "^2.16.1"
47
46
  },
48
47
  "scripts": {
49
48
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
50
49
  "build": "rm -rf dist && tsc --noEmit && tsdown",
51
- "build:docs": "tsx ../docs/scripts/build-docs.ts",
50
+ "build:docs": "node ../docs/scripts/build-docs.ts",
51
+ "test": "pnpm test:typecheck",
52
+ "test:typecheck": "tsc -b ./test",
52
53
  "prettier:check": "prettier -c --ignore-unknown .",
53
54
  "prettier:fix": "prettier -w --ignore-unknown .",
54
55
  "oxlint:check": "oxlint .",
@@ -1,69 +0,0 @@
1
- # Composable Claims
2
-
3
- > Claim a zkSend link and use the assets in the same transaction
4
-
5
- By default, `link.claimAssets(address)` builds a claim transaction that transfers every asset to the
6
- recipient and submits it via a Mysten-hosted sponsor. If you want to _use_ a claimed object in the
7
- same transaction — for example, inserting a claimed NFT into another on-chain object, staking a
8
- claimed coin, or depositing into a vault — use `link.claimFlow()` to compose the claim into your own
9
- transaction.
10
-
11
- ## How it works
12
-
13
- `link.claimFlow()` returns three transaction thunks:
14
-
15
- - **`init`** — adds the `init_claim` (or `reclaim`) move call that creates the claim proof.
16
- - **`assets`** — an array of claimable assets. Each `asset.argument` is a lazy
17
- `TransactionObjectArgument` that emits the backing `claim<T>` move call the first time it's used.
18
- - **`finalize`** — consumes the claim proof. Must be added after every asset is claimed.
19
-
20
- ```ts
21
- const tx = new Transaction();
22
- tx.setSender(claimLink.keypair!.toSuiAddress());
23
-
24
- const { init, assets, finalize } = claimLink.claimFlow();
25
-
26
- tx.add(init);
27
-
28
- for (const asset of assets) {
29
- if (asset.type === `${PACKAGE_ID}::record::Record`) {
30
- // Insert the claimed record directly into the recipient's player object
31
- tx.moveCall({
32
- target: `${PACKAGE_ID}::player::add_record`,
33
- arguments: [tx.object(playerId), asset.argument],
34
- });
35
- } else {
36
- tx.transferObjects([asset.argument], recipient);
37
- }
38
- }
39
-
40
- tx.add(finalize);
41
- ```
42
-
43
- Every asset in the returned list must be claimed somewhere in the transaction — assets that are
44
- never used won't create a `claim<T>` command and the transaction will fail. If you only want the
45
- default claim-and-transfer behavior, use `link.createClaimTransaction(address)` instead.
46
-
47
- ## Sponsorship
48
-
49
- `link.claimAssets(address)` uses a sponsorship flow so the claimer does not need gas to claim the
50
- assets, but it only accepts the standard `init_claim` → `claim<T>` → transfer → `finalize` shape.
51
- Transactions built with `claimFlow()` may include extra move calls, so the default sponsor may
52
- reject them.
53
-
54
- Apps using `claimFlow()` are responsible for their own gas and sponsorship. The ephemeral link
55
- keypair is still the transaction sender (it authorizes the claim), so the typical pattern is dual
56
- signing: the link keypair signs as sender and your app's sponsor signs for gas.
57
-
58
- ```ts
59
- tx.setGasOwner(sponsorAddress);
60
- const txBytes = await tx.build({ client });
61
-
62
- const linkSig = await claimLink.keypair!.signTransaction(txBytes);
63
- const sponsorSig = await sponsor.signTransaction(txBytes);
64
-
65
- const result = await client.core.executeTransaction({
66
- transaction: txBytes,
67
- signatures: [linkSig.signature, sponsorSig.signature],
68
- });
69
- ```
package/docs/index.md DELETED
@@ -1,26 +0,0 @@
1
- # zkSend SDK
2
-
3
- > Send Sui assets via shareable links with zkSend
4
-
5
- The zkSend SDK provides tools for interacting with the zkSend primitive. It provides functionality
6
- to create your own zkSend Claim Links, with support for any publicly transferrable asset.
7
-
8
- ## Installation
9
-
10
- ```sh npm2yarn
11
- npm i @mysten/zksend @mysten/sui
12
- ```
13
-
14
- ## Setup
15
-
16
- To use the zkSend SDK, create a Sui client and extend it with the zkSend extension:
17
-
18
- ```ts
19
- const client = new SuiGrpcClient({
20
- network: 'mainnet',
21
- baseUrl: 'https://fullnode.mainnet.sui.io:443',
22
- }).$extend(zksend());
23
- ```
24
-
25
- The zkSend SDK supports mainnet and testnet networks. The extension automatically configures the
26
- correct contract IDs based on the client's network.
@@ -1,191 +0,0 @@
1
- # Creating zkSend Links
2
-
3
- > Create and customize zkSend claim links
4
-
5
- > **Warning:** Products and services that incorporate zkSend links may be subject to financial
6
- > regulations, including obtaining money transmitter licenses in jurisdictions where you provide
7
- > your services. It is the developer's responsibility to ensure compliance with all relevant laws
8
- > and obtain any necessary licenses. The information provided by Mysten Labs is not legal advice,
9
- > and developers should consult with a qualified legal professional to address their specific
10
- > circumstances.
11
-
12
- ## Limitations
13
-
14
- - zkSend only supports Mainnet and Testnet at this time.
15
- - Objects within links must be publicly transferrable.
16
-
17
- ## Create a link
18
-
19
- You can start creating your own zkSend link using the `linkBuilder` method on the zkSend client
20
- extension:
21
-
22
- ```ts
23
- const client = new SuiGrpcClient({
24
- network: 'mainnet',
25
- baseUrl: 'https://fullnode.mainnet.sui.io:443',
26
- }).$extend(zksend());
27
-
28
- const link = client.zksend.linkBuilder({
29
- sender: '0x...',
30
- });
31
- ```
32
-
33
- #### Adding SUI to the link
34
-
35
- You can add SUI to the link by calling `link.addClaimableMist()`. This method takes the following
36
- params:
37
-
38
- - **`amount`** (required) - The amount of MIST (the base unit of SUI) to add to the link.
39
-
40
- #### Adding non-SUI coins to the link
41
-
42
- You can add non-SUI coins to the link by calling `link.addClaimableBalance()`. This method takes the
43
- following params:
44
-
45
- - **`coinType`** (required) - The coin type of the coin to add to the link (e.g. `0x2::sui::SUI`).
46
- - **`amount`** (required) - The amount of the coin to add to the link. Represented in the base unit
47
- of the coin.
48
-
49
- The SDK will automatically perform the necessary coin management logic to transfer the defined
50
- amount, such as merging and splitting coin objects.
51
-
52
- #### Adding objects to the link
53
-
54
- You can add a publicly-transferrable object to the link by calling `link.addClaimableObject()`. This
55
- method takes the following params:
56
-
57
- - **`id`** (required) - The ID of the object. This must be owned by the `sender` you configured when
58
- creating the link.
59
-
60
- #### Adding objects created in the same transaction
61
-
62
- You can create objects to add to links in the same transaction the link is created in by using
63
- `link.addClaimableObjectRef()`
64
-
65
- - **`ref`** (required) - The reference to the object you want to add to the link.
66
- - **`type`** (required) - The move type of the object you are adding
67
-
68
- ```ts
69
- const tx = new Transaction();
70
-
71
- const link = client.zksend.linkBuilder({
72
- sender: '0x...',
73
- });
74
-
75
- const newObject = tx.moveCall({
76
- target: `${PACKAGE_ID}::your_module::mint`,
77
- });
78
-
79
- link.addClaimableObjectRef({
80
- ref: newObject,
81
- type: `${PACKAGE_ID}::your_module::YourType`,
82
- });
83
-
84
- // Adds the link creation transactions to the transaction
85
- link.createSendTransaction({
86
- transaction: tx,
87
- });
88
- ```
89
-
90
- #### Getting the link URL
91
-
92
- At any time, you can get the URL for the link by calling `link.getLink()`.
93
-
94
- ## Submitting the link transaction
95
-
96
- Once you have built your zkSend link, you need to execute a transaction to transfer assets and make
97
- the link claimable.
98
-
99
- You can call the `link.createSendTransaction()` method, which returns a `Transaction` object that
100
- you can sign and submit to the blockchain.
101
-
102
- ```ts
103
- const tx = await link.createSendTransaction();
104
-
105
- const { bytes, signature } = tx.sign({ client, signer: keypair });
106
-
107
- const result = await client.executeTransactionBlock({
108
- transactionBlock: bytes,
109
- signature,
110
- });
111
- ```
112
-
113
- If you have a keypair you would like to send the transaction with, you can use the `create` method
114
- as shorthand for creating the send transaction, signing it, and submitting it to the blockchain.
115
-
116
- ```ts
117
- await link.create({
118
- signer: yourKeypair,
119
- // Wait until the new link is ready to be indexed so it is claimable
120
- waitForTransaction: true,
121
- });
122
- ```
123
-
124
- ## Claiming a link
125
-
126
- To claim a link via the SDK you can use the `loadLinkFromUrl` method:
127
-
128
- ```ts
129
- // Load a link instance from a URL
130
- const link = await client.zksend.loadLinkFromUrl('https://zksend.com/claim#$abc...');
131
-
132
- // list what claimable assets the link has
133
- const { nfts, balances } = link.assets;
134
-
135
- // claim all the assets from the link
136
- await link.claimAssets(addressOfClaimer);
137
- ```
138
-
139
- ## Regenerating links
140
-
141
- If you lose a link you've created, you can re-generate the link (this can only done from the address
142
- that originally created the link):
143
-
144
- ```ts
145
- // url will be the new link url
146
- const { url, transaction } = await link.createRegenerateTransaction(addressOfLinkCreator);
147
-
148
- // Execute the transaction to regenerate the link
149
- const result = await client.signAndExecuteTransaction({
150
- transaction,
151
- signer: keypair,
152
- });
153
-
154
- // Check transaction status
155
- if (result.$kind === 'FailedTransaction') {
156
- throw new Error(`Link regeneration failed: ${result.FailedTransaction.status.error?.message}`);
157
- }
158
- ```
159
-
160
- ## Bulk link creation
161
-
162
- To create multiple links in a single transaction, you can use `client.zksend.createLinks`:
163
-
164
- ```ts
165
- const links = [];
166
-
167
- for (let i = 0; i < 10; i++) {
168
- const link = client.zksend.linkBuilder({
169
- sender: keypair.toSuiAddress(),
170
- });
171
-
172
- link.addClaimableMist(100n);
173
- links.push(link);
174
- }
175
-
176
- const urls = links.map((link) => link.getLink());
177
-
178
- const tx = await client.zksend.createLinks({
179
- links,
180
- });
181
-
182
- const result = await client.signAndExecuteTransaction({
183
- transaction: tx,
184
- signer: keypair,
185
- });
186
-
187
- // Check transaction status
188
- if (result.$kind === 'FailedTransaction') {
189
- throw new Error(`Link creation failed: ${result.FailedTransaction.status.error?.message}`);
190
- }
191
- ```
@@ -1,8 +0,0 @@
1
- # ZkSend
2
-
3
- > Send Sui with a link
4
-
5
- - [zkSend SDK](..md): Send Sui assets via shareable links with zkSend
6
- - [Creating zkSend Links](./link-builder.md): Create and customize zkSend claim links
7
- - [Composable Claims](./composable-claim.md): Claim a zkSend link and use the assets in the same
8
- transaction