@mysten/kiosk 1.2.2 → 1.2.3
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 +9 -0
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/docs/advanced-examples.md +1 -1
- package/docs/from-v1.md +1 -1
- package/docs/index.md +5 -5
- package/docs/kiosk-client/introduction.md +6 -6
- package/docs/kiosk-client/kiosk-transaction/examples.md +3 -3
- package/docs/kiosk-client/kiosk-transaction/kiosk-transaction.md +1 -1
- package/docs/kiosk-client/kiosk-transaction/managing.md +11 -11
- package/docs/kiosk-client/kiosk-transaction/purchasing.md +1 -1
- package/docs/kiosk-client/querying.md +1 -1
- package/docs/kiosk-client/transfer-policy-transaction/introduction.md +1 -1
- package/docs/kiosk-client/transfer-policy-transaction/using-the-manager.md +1 -3
- package/docs/llms-index.md +9 -6
- package/package.json +2 -2
- package/src/contracts/utils/index.ts +4 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mysten/kiosk
|
|
2
2
|
|
|
3
|
+
## 1.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c96956e: Regenerate generated Move types against the latest contract sources. The generated
|
|
8
|
+
`utils/index.ts` `GetOptions` / `GetManyOptions` are now exported as type aliases (intersection)
|
|
9
|
+
instead of interfaces. SuiNS gains `SubnamePrunedEvent`, `pruneExpiredSubname`, and
|
|
10
|
+
`pruneExpiredSubnames`.
|
|
11
|
+
|
|
3
12
|
## 1.2.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["SUI_FRAMEWORK_ADDRESS","val"],"sources":["../../../src/contracts/utils/index.ts"],"sourcesContent":["import {\n\tbcs,\n\ttype BcsType,\n\ttype TypeTag,\n\tTypeTagSerializer,\n\tBcsStruct,\n\tBcsEnum,\n\tBcsTuple,\n} from '@mysten/sui/bcs';\nimport { normalizeSuiAddress } from '@mysten/sui/utils';\nimport { type TransactionArgument, isArgument } from '@mysten/sui/transactions';\nimport { type ClientWithCoreApi, type SuiClientTypes } from '@mysten/sui/client';\n\nconst MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');\nconst SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');\n\nexport type RawTransactionArgument<T> = T | TransactionArgument;\n\nexport
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["SUI_FRAMEWORK_ADDRESS","val"],"sources":["../../../src/contracts/utils/index.ts"],"sourcesContent":["import {\n\tbcs,\n\ttype BcsType,\n\ttype TypeTag,\n\tTypeTagSerializer,\n\tBcsStruct,\n\tBcsEnum,\n\tBcsTuple,\n} from '@mysten/sui/bcs';\nimport { normalizeSuiAddress } from '@mysten/sui/utils';\nimport { type TransactionArgument, isArgument } from '@mysten/sui/transactions';\nimport { type ClientWithCoreApi, type SuiClientTypes } from '@mysten/sui/client';\n\nconst MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');\nconst SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');\n\nexport type RawTransactionArgument<T> = T | TransactionArgument;\n\nexport type GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =\n\tSuiClientTypes.GetObjectOptions<Include> & { client: ClientWithCoreApi };\n\nexport type GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =\n\tSuiClientTypes.GetObjectsOptions<Include> & { client: ClientWithCoreApi };\n\nexport function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {\n\tconst parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;\n\n\tif ('u8' in parsedTag) {\n\t\treturn bcs.U8;\n\t} else if ('u16' in parsedTag) {\n\t\treturn bcs.U16;\n\t} else if ('u32' in parsedTag) {\n\t\treturn bcs.U32;\n\t} else if ('u64' in parsedTag) {\n\t\treturn bcs.U64;\n\t} else if ('u128' in parsedTag) {\n\t\treturn bcs.U128;\n\t} else if ('u256' in parsedTag) {\n\t\treturn bcs.U256;\n\t} else if ('address' in parsedTag) {\n\t\treturn bcs.Address;\n\t} else if ('bool' in parsedTag) {\n\t\treturn bcs.Bool;\n\t} else if ('vector' in parsedTag) {\n\t\tconst type = getPureBcsSchema(parsedTag.vector);\n\t\treturn type ? bcs.vector(type) : null;\n\t} else if ('struct' in parsedTag) {\n\t\tconst structTag = parsedTag.struct;\n\t\tconst pkg = normalizeSuiAddress(structTag.address);\n\n\t\tif (pkg === MOVE_STDLIB_ADDRESS) {\n\t\t\tif (\n\t\t\t\t(structTag.module === 'ascii' || structTag.module === 'string') &&\n\t\t\t\tstructTag.name === 'String'\n\t\t\t) {\n\t\t\t\treturn bcs.String;\n\t\t\t}\n\n\t\t\tif (structTag.module === 'option' && structTag.name === 'Option') {\n\t\t\t\tconst type = getPureBcsSchema(structTag.typeParams[0]);\n\t\t\t\treturn type ? bcs.option(type) : null;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tpkg === SUI_FRAMEWORK_ADDRESS &&\n\t\t\tstructTag.module === 'object' &&\n\t\t\t(structTag.name === 'ID' || structTag.name === 'UID')\n\t\t) {\n\t\t\treturn bcs.Address;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function normalizeMoveArguments(\n\targs: unknown[] | object,\n\targTypes: readonly (string | null)[],\n\tparameterNames?: string[],\n) {\n\tconst argLen = Array.isArray(args) ? args.length : Object.keys(args).length;\n\tif (parameterNames && argLen !== parameterNames.length) {\n\t\tthrow new Error(\n\t\t\t`Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,\n\t\t);\n\t}\n\n\tconst normalizedArgs: TransactionArgument[] = [];\n\n\tlet index = 0;\n\tfor (const [i, argType] of argTypes.entries()) {\n\t\tif (argType === '0x2::clock::Clock') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.clock());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::random::Random') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.random());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::deny_list::DenyList') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.denyList());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x3::sui_system::SuiSystemState') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.system());\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet arg;\n\t\tif (Array.isArray(args)) {\n\t\t\tif (index >= args.length) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\targ = args[index];\n\t\t} else {\n\t\t\tif (!parameterNames) {\n\t\t\t\tthrow new Error(`Expected arguments to be passed as an array`);\n\t\t\t}\n\t\t\tconst name = parameterNames[index];\n\t\t\targ = args[name as keyof typeof args];\n\n\t\t\tif (arg === undefined) {\n\t\t\t\tthrow new Error(`Parameter ${name} is required`);\n\t\t\t}\n\t\t}\n\n\t\tindex += 1;\n\n\t\tif (typeof arg === 'function' || isArgument(arg)) {\n\t\t\tnormalizedArgs.push(arg as TransactionArgument);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst type = argTypes[i];\n\t\tconst bcsType = type === null ? null : getPureBcsSchema(type);\n\n\t\tif (bcsType) {\n\t\t\tconst bytes = bcsType.serialize(arg as never);\n\t\t\tnormalizedArgs.push((tx) => tx.pure(bytes));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (typeof arg === 'string') {\n\t\t\tnormalizedArgs.push((tx) => tx.object(arg));\n\t\t\tcontinue;\n\t\t}\n\n\t\tthrow new Error(`Invalid argument ${stringify(arg)} for type ${type}`);\n\t}\n\n\treturn normalizedArgs;\n}\n\nexport class MoveStruct<\n\tT extends Record<string, BcsType<any>>,\n\tconst Name extends string = string,\n> extends BcsStruct<T, Name> {\n\tasync get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tobjectId,\n\t\t...options\n\t}: GetOptions<Include>): Promise<\n\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t}\n\t> {\n\t\tconst [res] = await this.getMany<Include>({\n\t\t\t...options,\n\t\t\tobjectIds: [objectId],\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tasync getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tclient,\n\t\t...options\n\t}: GetManyOptions<Include>): Promise<\n\t\tArray<\n\t\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t\t}\n\t\t>\n\t> {\n\t\tconst response = (await client.core.getObjects({\n\t\t\t...options,\n\t\t\tinclude: {\n\t\t\t\t...options.include,\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t})) as SuiClientTypes.GetObjectsResponse<Include & { content: true }>;\n\n\t\treturn response.objects.map((obj) => {\n\t\t\tif (obj instanceof Error) {\n\t\t\t\tthrow obj;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...obj,\n\t\t\t\tjson: this.parse(obj.content),\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport class MoveEnum<\n\tT extends Record<string, BcsType<any> | null>,\n\tconst Name extends string,\n> extends BcsEnum<T, Name> {}\n\nexport class MoveTuple<\n\tconst T extends readonly BcsType<any>[],\n\tconst Name extends string,\n> extends BcsTuple<T, Name> {}\n\nfunction stringify(val: unknown) {\n\tif (typeof val === 'object') {\n\t\treturn JSON.stringify(val, (val: unknown) => val);\n\t}\n\tif (typeof val === 'bigint') {\n\t\treturn val.toString();\n\t}\n\n\treturn val;\n}\n"],"mappings":";;;;;AAaA,MAAM,sBAAsB,oBAAoB,MAAM;AACtD,MAAMA,0BAAwB,oBAAoB,MAAM;AAUxD,SAAgB,iBAAiB,SAAgD;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G,WAOF;AASD,UARkB,MAAM,OAAO,KAAK,WAAW;GAC9C,GAAG;GACH,SAAS;IACR,GAAG,QAAQ;IACX,SAAS;IACT;GACD,CAAC,EAEc,QAAQ,KAAK,QAAQ;AACpC,OAAI,eAAe,MAClB,OAAM;AAGP,UAAO;IACN,GAAG;IACH,MAAM,KAAK,MAAM,IAAI,QAAQ;IAC7B;IACA;;;AAcJ,SAAS,UAAU,KAAc;AAChC,KAAI,OAAO,QAAQ,SAClB,QAAO,KAAK,UAAU,MAAM,UAAiBC,MAAI;AAElD,KAAI,OAAO,QAAQ,SAClB,QAAO,IAAI,UAAU;AAGtB,QAAO"}
|
package/docs/from-v1.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Migrating from Kiosk SDK V1
|
|
2
2
|
|
|
3
|
-
> Migrate from Kiosk SDK v1 to the current version
|
|
3
|
+
> Migrate from Kiosk SDK v1 to the current version with the builder-pattern API.
|
|
4
4
|
|
|
5
5
|
The original version of Kiosk SDK provided basic experimentation with the Kiosk API. The new version
|
|
6
6
|
of the SDK (0.7+) provides a more robust experience for building kiosk/transfer policy transactions.
|
package/docs/index.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Kiosk SDK
|
|
2
2
|
|
|
3
|
-
> TypeScript SDK for interacting with Sui Kiosk
|
|
3
|
+
> TypeScript SDK for interacting with Sui Kiosk onchain commerce.
|
|
4
4
|
|
|
5
|
-
Kiosk SDK is a tool to interact with Sui
|
|
6
|
-
build transactions to interact, and extend Kiosk to support custom rules.
|
|
5
|
+
Kiosk SDK is a tool to interact with Sui and Mysten Kiosk. You can use it to query kiosk related
|
|
6
|
+
data, build transactions to interact, and extend Kiosk to support custom rules.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -14,9 +14,9 @@ npm i @mysten/kiosk
|
|
|
14
14
|
## About
|
|
15
15
|
|
|
16
16
|
The Kiosk SDK exports a client extension that integrates with Sui clients. Add it to your client
|
|
17
|
-
using `$extend(kiosk())` to access kiosk functionality
|
|
17
|
+
using `$extend(kiosk())` to access kiosk functionality through `client.kiosk`.
|
|
18
18
|
|
|
19
|
-
>
|
|
19
|
+
> The Kiosk SDK requires `SuiJsonRpcClient` or `SuiGraphQLClient`. It does not work with
|
|
20
20
|
> `SuiGrpcClient` because it uses event queries that are not available in gRPC.
|
|
21
21
|
|
|
22
22
|
- [Read more about setting up the Kiosk client extension](/kiosk/kiosk-client/introduction)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Kiosk Client
|
|
2
2
|
|
|
3
|
-
> Introduction to the KioskClient for querying and managing kiosks
|
|
3
|
+
> Introduction to the KioskClient extension for querying and managing kiosks on Sui.
|
|
4
4
|
|
|
5
5
|
The Kiosk SDK exports a client extension that provides all Kiosk functionality.
|
|
6
6
|
|
|
7
|
-
> We recommend you keep only one client instance throughout your
|
|
7
|
+
> We recommend you keep only one client instance throughout your app or script. For example, in
|
|
8
8
|
> React, you'd use a context to provide the client.
|
|
9
9
|
|
|
10
|
-
>
|
|
10
|
+
> The Kiosk SDK requires `SuiJsonRpcClient` or `SuiGraphQLClient`. It does not work with
|
|
11
11
|
> `SuiGrpcClient` because it uses event queries that are not available in gRPC.
|
|
12
12
|
|
|
13
13
|
## Setting up the kiosk extension
|
|
@@ -15,8 +15,8 @@ The Kiosk SDK exports a client extension that provides all Kiosk functionality.
|
|
|
15
15
|
Add the kiosk extension to your Sui client using `$extend()`. The extension currently supports
|
|
16
16
|
`mainnet` and `testnet`. See the next section for usage on other networks.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
require constantly changing the package IDs).
|
|
18
|
+
Mysten Kiosk rules and extensions are not supported in Devnet due to network wipes (that would
|
|
19
|
+
require constantly changing the package IDs).
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
const client = new SuiJsonRpcClient({
|
|
@@ -28,7 +28,7 @@ const client = new SuiJsonRpcClient({
|
|
|
28
28
|
const { kioskOwnerCaps } = await client.kiosk.getOwnedKiosks({ address: '0x...' });
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
### Using the kiosk extension on
|
|
31
|
+
### Using the kiosk extension on Devnet or Localnet
|
|
32
32
|
|
|
33
33
|
To use all the functionality of Kiosk SDK outside of `mainnet` and `testnet`, pass the `packageIds`
|
|
34
34
|
for the rules and extensions you want to use.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Examples
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Practical code examples for kiosk transactions including minting, listing, and purchasing.
|
|
4
4
|
|
|
5
|
-
The following
|
|
5
|
+
The following app-focused examples demonstrate how to use the SDK to interact with Kiosk.
|
|
6
6
|
|
|
7
7
|
## Minting into Kiosk example
|
|
8
8
|
|
|
9
|
-
For every scenario using Kiosk in
|
|
9
|
+
For every scenario using Kiosk in apps, the user who has connected their wallet either has at least
|
|
10
10
|
one kiosk already or you must create it for them.
|
|
11
11
|
|
|
12
12
|
The SDK supports the scenario of `silently` creating the kiosk, as part of our Programmable
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# KioskTransaction
|
|
2
2
|
|
|
3
|
-
> Build kiosk transactions for listing, purchasing, and managing items
|
|
3
|
+
> Build kiosk transactions for listing, purchasing, and managing items on Sui.
|
|
4
4
|
|
|
5
5
|
`KioskTransaction` is the client to build transactions that involve Kiosk. It's used similar to
|
|
6
6
|
`Transaction`, and helps in building a transaction.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Managing Owned Kiosk
|
|
2
2
|
|
|
3
|
-
> Manage kiosk items
|
|
3
|
+
> Manage kiosk items by placing, listing, delisting, and withdrawing using the Kiosk SDK.
|
|
4
4
|
|
|
5
5
|
The kiosk extension (`client.kiosk`) helps in managing a kiosk.
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ create a `KioskTransaction`.
|
|
|
9
9
|
|
|
10
10
|
## Available functions
|
|
11
11
|
|
|
12
|
-
### take
|
|
12
|
+
### `take`
|
|
13
13
|
|
|
14
14
|
Removes an item from the Kiosk and returns a `TransactionArgument` to use it in a different
|
|
15
15
|
Programmable Transaction Block (PTB) call.
|
|
@@ -37,7 +37,7 @@ kioskTx.finalize();
|
|
|
37
37
|
await signAndExecuteTransaction({ tx: tx });
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
### transfer
|
|
40
|
+
### `transfer`
|
|
41
41
|
|
|
42
42
|
Similar to `take`, but transfers the item to an address internally.
|
|
43
43
|
|
|
@@ -61,7 +61,7 @@ kioskTx
|
|
|
61
61
|
await signAndExecuteTransaction({ tx: tx });
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
### place
|
|
64
|
+
### `place`
|
|
65
65
|
|
|
66
66
|
Places an item in the kiosk.
|
|
67
67
|
|
|
@@ -83,7 +83,7 @@ kioskTx
|
|
|
83
83
|
await signAndExecuteTransaction({ tx: tx });
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
### list
|
|
86
|
+
### `list`
|
|
87
87
|
|
|
88
88
|
Lists an item for sale (the item must be in the kiosk).
|
|
89
89
|
|
|
@@ -106,7 +106,7 @@ kioskTx
|
|
|
106
106
|
await signAndExecuteTransaction({ tx: tx });
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
### placeAndList
|
|
109
|
+
### `placeAndList`
|
|
110
110
|
|
|
111
111
|
List an item for sale by first placing it in the kiosk (places the item and lists it for sale). It's
|
|
112
112
|
a short hand for `place()` and `list()`.
|
|
@@ -130,7 +130,7 @@ kioskTx
|
|
|
130
130
|
await signAndExecuteTransaction({ tx: tx });
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
### delist
|
|
133
|
+
### `delist`
|
|
134
134
|
|
|
135
135
|
Removes the listing, keeping the item placed in the kiosk.
|
|
136
136
|
|
|
@@ -152,7 +152,7 @@ kioskTx
|
|
|
152
152
|
await signAndExecuteTransaction({ tx: tx });
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
### withdraw
|
|
155
|
+
### `withdraw`
|
|
156
156
|
|
|
157
157
|
Withdraw (all or specific amount) from a kiosk.
|
|
158
158
|
|
|
@@ -168,7 +168,7 @@ kioskTx.withdraw('address_to_transfer_funds', 100000n).finalize();
|
|
|
168
168
|
await signAndExecuteTransaction({ tx: tx });
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
### borrowTx (callback)
|
|
171
|
+
### `borrowTx` (callback)
|
|
172
172
|
|
|
173
173
|
Borrows an item from a kiosk. This function follows the `callback` approach, similar to the
|
|
174
174
|
ownerCap. The return of the item happens automatically after the execution of the callback.
|
|
@@ -199,10 +199,10 @@ kioskTx
|
|
|
199
199
|
await signAndExecuteTransaction({ tx: tx });
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
### borrow / return
|
|
202
|
+
### `borrow` / `return`
|
|
203
203
|
|
|
204
204
|
Similar to `borrowTx`, borrows an item from the kiosk, but returns two transaction arguments: `item`
|
|
205
|
-
|
|
205
|
+
and `promise`. You can use the `item` in your PTBs, but you must always call the `return()` function
|
|
206
206
|
with the `item` and the `Promise`.
|
|
207
207
|
|
|
208
208
|
```typescript
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Purchasing from a kiosk
|
|
2
2
|
|
|
3
|
-
> Purchase items from kiosks with transfer policy resolution
|
|
3
|
+
> Purchase items from kiosks with automatic transfer policy rule resolution.
|
|
4
4
|
|
|
5
5
|
One of the base functionalities of the SDK is a seamless purchasing flow, allowing for ease of rules
|
|
6
6
|
resolving (hiding away the calls). The SDK supports all four rules by default, and works for
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Querying
|
|
2
2
|
|
|
3
|
-
> Query kiosk contents, items, and transfer policies
|
|
3
|
+
> Query kiosk contents, owned kiosks, items, and transfer policies using the Kiosk SDK.
|
|
4
4
|
|
|
5
5
|
You can use `client.kiosk` to query kiosk data. It helps you get owned kiosks for an address, as
|
|
6
6
|
well as fetching all the contents of a specified kiosk.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TransferPolicyTransaction
|
|
2
2
|
|
|
3
|
-
> Create and manage transfer policies for kiosk items
|
|
3
|
+
> Create and manage transfer policies for kiosk items using the Kiosk SDK.
|
|
4
4
|
|
|
5
5
|
`TransferPolicyTransaction` is the client to build transactions that involve transfer policy
|
|
6
6
|
management. It's used similar to `KioskTransaction`, and helps in crafting transactions to manage a
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Using the manager
|
|
2
2
|
|
|
3
|
-
> Use the TransferPolicyTransaction manager
|
|
4
|
-
|
|
5
|
-
# How to use
|
|
3
|
+
> Use the TransferPolicyTransaction manager to add rules and withdraw profits.
|
|
6
4
|
|
|
7
5
|
After following the introduction steps on how to initialize a transfer policy transaction you can
|
|
8
6
|
call any of the available functions to prepare your Programmable Transaction Block (PTB).
|
package/docs/llms-index.md
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
> Interact with on-chain commerce applications
|
|
4
4
|
|
|
5
|
-
- [Kiosk SDK](..md): TypeScript SDK for interacting with Sui Kiosk
|
|
6
|
-
- [Kiosk Client](./kiosk-client/introduction.md): Introduction to the KioskClient for
|
|
7
|
-
managing kiosks
|
|
8
|
-
- [Querying](./kiosk-client/querying.md): Query kiosk contents, items, and transfer
|
|
9
|
-
|
|
10
|
-
- [
|
|
5
|
+
- [Kiosk SDK](..md): TypeScript SDK for interacting with Sui Kiosk onchain commerce.
|
|
6
|
+
- [Kiosk Client](./kiosk-client/introduction.md): Introduction to the KioskClient extension for
|
|
7
|
+
querying and managing kiosks on Sui.
|
|
8
|
+
- [Querying](./kiosk-client/querying.md): Query kiosk contents, owned kiosks, items, and transfer
|
|
9
|
+
policies using the Kiosk SDK.
|
|
10
|
+
- [Advanced Examples](./advanced-examples.md): Advanced Kiosk SDK usage patterns and code examples
|
|
11
|
+
for complex scenarios.
|
|
12
|
+
- [Migrating from Kiosk SDK V1](./from-v1.md): Migrate from Kiosk SDK v1 to the current version with
|
|
13
|
+
the builder-pattern API.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@mysten/kiosk",
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "Sui Kiosk library",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.3",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.mjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"vite": "^8.0.5",
|
|
44
44
|
"vitest": "^4.0.17",
|
|
45
45
|
"wait-on": "^9.0.3",
|
|
46
|
-
"@mysten/codegen": "^0.
|
|
46
|
+
"@mysten/codegen": "^0.10.0",
|
|
47
47
|
"@mysten/sui": "^2.16.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -16,17 +16,11 @@ const SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');
|
|
|
16
16
|
|
|
17
17
|
export type RawTransactionArgument<T> = T | TransactionArgument;
|
|
18
18
|
|
|
19
|
-
export
|
|
20
|
-
Include
|
|
21
|
-
> extends SuiClientTypes.GetObjectOptions<Include> {
|
|
22
|
-
client: ClientWithCoreApi;
|
|
23
|
-
}
|
|
19
|
+
export type GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =
|
|
20
|
+
SuiClientTypes.GetObjectOptions<Include> & { client: ClientWithCoreApi };
|
|
24
21
|
|
|
25
|
-
export
|
|
26
|
-
Include
|
|
27
|
-
> extends SuiClientTypes.GetObjectsOptions<Include> {
|
|
28
|
-
client: ClientWithCoreApi;
|
|
29
|
-
}
|
|
22
|
+
export type GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =
|
|
23
|
+
SuiClientTypes.GetObjectsOptions<Include> & { client: ClientWithCoreApi };
|
|
30
24
|
|
|
31
25
|
export function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {
|
|
32
26
|
const parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;
|