@mysten/docs 0.1.17 → 0.1.18
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/dist/llms-index.md
CHANGED
|
@@ -124,3 +124,4 @@
|
|
|
124
124
|
|
|
125
125
|
- [zkSend SDK](./zksend.md): Send Sui assets via shareable links with zkSend
|
|
126
126
|
- [Creating zkSend Links](./zksend/link-builder.md): Create and customize zkSend claim links
|
|
127
|
+
- [Composable Claims](./zksend/composable-claim.md): Claim a zkSend link and use the assets in the same transaction
|
package/dist/sui/utils/index.md
CHANGED
|
@@ -31,6 +31,13 @@ You can use the following helpers to format various values:
|
|
|
31
31
|
- `normalizeSuiNSName`
|
|
32
32
|
- `normalizeSuiNSName`
|
|
33
33
|
|
|
34
|
+
## Parsers
|
|
35
|
+
|
|
36
|
+
You can use the following helpers to parse decimal strings into smallest-unit bigints:
|
|
37
|
+
|
|
38
|
+
- `parseToUnits`: Parse a decimal string into a `bigint`, given a coin's `decimals`
|
|
39
|
+
- `parseToMist`: Parse a SUI decimal string into MIST (9 decimals)
|
|
40
|
+
|
|
34
41
|
## Validators
|
|
35
42
|
|
|
36
43
|
You can use the following helpers to validate the format of various values (this only validates that
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
|
|
22
|
+
const tx = new Transaction();
|
|
23
|
+
tx.setSender(claimLink.keypair!.toSuiAddress());
|
|
24
|
+
|
|
25
|
+
const { init, assets, finalize } = claimLink.claimFlow();
|
|
26
|
+
|
|
27
|
+
tx.add(init);
|
|
28
|
+
|
|
29
|
+
for (const asset of assets) {
|
|
30
|
+
if (asset.type === `${PACKAGE_ID}::record::Record`) {
|
|
31
|
+
// Insert the claimed record directly into the recipient's player object
|
|
32
|
+
tx.moveCall({
|
|
33
|
+
target: `${PACKAGE_ID}::player::add_record`,
|
|
34
|
+
arguments: [tx.object(playerId), asset.argument],
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
tx.transferObjects([asset.argument], recipient);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
tx.add(finalize);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Every asset in the returned list must be claimed somewhere in the transaction — assets that are
|
|
45
|
+
never used won't create a `claim<T>` command and the transaction will fail. If you only want the
|
|
46
|
+
default claim-and-transfer behavior, use `link.createClaimTransaction(address)` instead.
|
|
47
|
+
|
|
48
|
+
## Sponsorship
|
|
49
|
+
|
|
50
|
+
`link.claimAssets(address)` uses a sponsorship flow so the claimer does not need gas to claim the
|
|
51
|
+
assets, but it only accepts the standard `init_claim` → `claim<T>` → transfer → `finalize` shape.
|
|
52
|
+
Transactions built with `claimFlow()` may include extra move calls, so the default sponsor may
|
|
53
|
+
reject them.
|
|
54
|
+
|
|
55
|
+
Apps using `claimFlow()` are responsible for their own gas and sponsorship. The ephemeral link
|
|
56
|
+
keypair is still the transaction sender (it authorizes the claim), so the typical pattern is dual
|
|
57
|
+
signing: the link keypair signs as sender and your app's sponsor signs for gas.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
tx.setGasOwner(sponsorAddress);
|
|
61
|
+
const txBytes = await tx.build({ client });
|
|
62
|
+
|
|
63
|
+
const linkSig = await claimLink.keypair!.signTransaction(txBytes);
|
|
64
|
+
const sponsorSig = await sponsor.signTransaction(txBytes);
|
|
65
|
+
|
|
66
|
+
const result = await client.core.executeTransaction({
|
|
67
|
+
transaction: txBytes,
|
|
68
|
+
signatures: [linkSig.signature, sponsorSig.signature],
|
|
69
|
+
});
|
|
70
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mysten/docs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "LLM-friendly documentation for the Sui TypeScript SDK ecosystem",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"@mysten/dapp-kit": "1.0.4",
|
|
31
31
|
"@mysten/dapp-kit-core": "1.3.0",
|
|
32
32
|
"@mysten/dapp-kit-react": "2.0.1",
|
|
33
|
-
"@mysten/deepbook-v3": "1.3.
|
|
33
|
+
"@mysten/deepbook-v3": "1.3.1",
|
|
34
34
|
"@mysten/enoki": "1.0.4",
|
|
35
35
|
"@mysten/enoki-connect": "1.0.2",
|
|
36
|
-
"@mysten/kiosk": "1.2.
|
|
37
|
-
"@mysten/payment-kit": "0.1.
|
|
36
|
+
"@mysten/kiosk": "1.2.2",
|
|
37
|
+
"@mysten/payment-kit": "0.1.7",
|
|
38
38
|
"@mysten/seal": "1.1.1",
|
|
39
39
|
"@mysten/signers": "1.0.2",
|
|
40
40
|
"@mysten/slush-wallet": "1.0.3",
|
|
41
|
-
"@mysten/sui": "2.
|
|
42
|
-
"@mysten/suins": "1.0.
|
|
41
|
+
"@mysten/sui": "2.16.0",
|
|
42
|
+
"@mysten/suins": "1.0.5",
|
|
43
43
|
"@mysten/utils": "0.3.1",
|
|
44
44
|
"@mysten/wallet-standard": "0.20.1",
|
|
45
|
-
"@mysten/walrus": "1.1.
|
|
46
|
-
"@mysten/zksend": "1.0
|
|
45
|
+
"@mysten/walrus": "1.1.2",
|
|
46
|
+
"@mysten/zksend": "1.1.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@tailwindcss/postcss": "^4.1.18",
|