@mysten/docs 0.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/README.md +24 -0
- package/dist/bcs/index.md +358 -0
- package/dist/bcs/llms-index.md +4 -0
- package/dist/codegen/index.md +441 -0
- package/dist/codegen/llms-index.md +4 -0
- package/dist/dapp-kit/actions/connect-wallet.md +69 -0
- package/dist/dapp-kit/actions/disconnect-wallet.md +38 -0
- package/dist/dapp-kit/actions/sign-and-execute-transaction.md +96 -0
- package/dist/dapp-kit/actions/sign-personal-message.md +58 -0
- package/dist/dapp-kit/actions/sign-transaction.md +65 -0
- package/dist/dapp-kit/actions/switch-account.md +37 -0
- package/dist/dapp-kit/actions/switch-network.md +37 -0
- package/dist/dapp-kit/dapp-kit-instance.md +162 -0
- package/dist/dapp-kit/getting-started/create-dapp.md +151 -0
- package/dist/dapp-kit/getting-started/next-js.md +162 -0
- package/dist/dapp-kit/getting-started/react.md +172 -0
- package/dist/dapp-kit/getting-started/vue.md +193 -0
- package/dist/dapp-kit/index.md +70 -0
- package/dist/dapp-kit/llms-index.md +26 -0
- package/dist/dapp-kit/react/components/connect-button.md +42 -0
- package/dist/dapp-kit/react/components/connect-modal.md +51 -0
- package/dist/dapp-kit/react/components/index.md +13 -0
- package/dist/dapp-kit/react/dapp-kit-provider.md +86 -0
- package/dist/dapp-kit/react/hooks/index.md +25 -0
- package/dist/dapp-kit/react/hooks/use-current-account.md +33 -0
- package/dist/dapp-kit/react/hooks/use-current-client.md +36 -0
- package/dist/dapp-kit/react/hooks/use-current-network.md +28 -0
- package/dist/dapp-kit/react/hooks/use-current-wallet.md +36 -0
- package/dist/dapp-kit/react/hooks/use-dapp-kit.md +100 -0
- package/dist/dapp-kit/react/hooks/use-wallet-connection.md +48 -0
- package/dist/dapp-kit/react/hooks/use-wallets.md +33 -0
- package/dist/dapp-kit/state.md +169 -0
- package/dist/dapp-kit/theming.md +196 -0
- package/dist/dapp-kit/web-components/connect-button.md +89 -0
- package/dist/dapp-kit/web-components/connect-modal.md +177 -0
- package/dist/kiosk/advanced-examples.md +101 -0
- package/dist/kiosk/from-v1.md +320 -0
- package/dist/kiosk/index.md +22 -0
- package/dist/kiosk/kiosk-client/introduction.md +52 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/examples.md +119 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/kiosk-transaction.md +103 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/managing.md +235 -0
- package/dist/kiosk/kiosk-client/kiosk-transaction/purchasing.md +110 -0
- package/dist/kiosk/kiosk-client/querying.md +237 -0
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/introduction.md +79 -0
- package/dist/kiosk/kiosk-client/transfer-policy-transaction/using-the-manager.md +115 -0
- package/dist/kiosk/llms-index.md +8 -0
- package/dist/llms-index.md +125 -0
- package/dist/payment-kit/getting-started.md +256 -0
- package/dist/payment-kit/index.md +132 -0
- package/dist/payment-kit/llms-index.md +8 -0
- package/dist/payment-kit/payment-kit-sdk.md +747 -0
- package/dist/payment-kit/payment-processing.md +372 -0
- package/dist/payment-kit/registry-management.md +529 -0
- package/dist/seal/index.md +85 -0
- package/dist/seal/llms-index.md +4 -0
- package/dist/slush-wallet/dapp.md +95 -0
- package/dist/slush-wallet/deep-linking.md +465 -0
- package/dist/slush-wallet/index.md +7 -0
- package/dist/slush-wallet/llms-index.md +6 -0
- package/dist/sui/bcs.md +134 -0
- package/dist/sui/clients/core.md +606 -0
- package/dist/sui/clients/graphql.md +101 -0
- package/dist/sui/clients/grpc.md +155 -0
- package/dist/sui/clients/index.md +95 -0
- package/dist/sui/clients/json-rpc.md +239 -0
- package/dist/sui/cryptography/keypairs.md +267 -0
- package/dist/sui/cryptography/multisig.md +194 -0
- package/dist/sui/cryptography/passkey.md +111 -0
- package/dist/sui/cryptography/webcrypto-signer.md +81 -0
- package/dist/sui/executors.md +148 -0
- package/dist/sui/faucet.md +26 -0
- package/dist/sui/hello-sui.md +115 -0
- package/dist/sui/index.md +53 -0
- package/dist/sui/install.md +61 -0
- package/dist/sui/llm-docs.md +32 -0
- package/dist/sui/llms-index.md +44 -0
- package/dist/sui/migrations/0.38.md +58 -0
- package/dist/sui/migrations/sui-1.0.md +455 -0
- package/dist/sui/migrations/sui-2.0/agent-prompt.md +42 -0
- package/dist/sui/migrations/sui-2.0/dapp-kit.md +350 -0
- package/dist/sui/migrations/sui-2.0/deepbook-v3.md +33 -0
- package/dist/sui/migrations/sui-2.0/index.md +158 -0
- package/dist/sui/migrations/sui-2.0/json-rpc-migration.md +386 -0
- package/dist/sui/migrations/sui-2.0/kiosk.md +120 -0
- package/dist/sui/migrations/sui-2.0/sdk-maintainers.md +90 -0
- package/dist/sui/migrations/sui-2.0/seal.md +14 -0
- package/dist/sui/migrations/sui-2.0/sui.md +341 -0
- package/dist/sui/migrations/sui-2.0/suins.md +43 -0
- package/dist/sui/migrations/sui-2.0/wallet-builders.md +66 -0
- package/dist/sui/migrations/sui-2.0/walrus.md +41 -0
- package/dist/sui/migrations/sui-2.0/zksend.md +95 -0
- package/dist/sui/plugins.md +258 -0
- package/dist/sui/sdk-building.md +344 -0
- package/dist/sui/transaction-building/basics.md +299 -0
- package/dist/sui/transaction-building/gas.md +62 -0
- package/dist/sui/transaction-building/intents.md +62 -0
- package/dist/sui/transaction-building/offline.md +73 -0
- package/dist/sui/transaction-building/sponsored-transactions.md +22 -0
- package/dist/sui/utils/derived_objects.md +59 -0
- package/dist/sui/utils/index.md +52 -0
- package/dist/sui/zklogin.md +83 -0
- package/dist/walrus/index.md +527 -0
- package/dist/walrus/llms-index.md +4 -0
- package/dist/zksend/index.md +27 -0
- package/dist/zksend/link-builder.md +192 -0
- package/dist/zksend/llms-index.md +5 -0
- package/package.json +66 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Querying
|
|
2
|
+
|
|
3
|
+
> Query kiosk contents, items, and transfer policies
|
|
4
|
+
|
|
5
|
+
You can use `client.kiosk` to query kiosk data. It helps you get owned kiosks for an address, as
|
|
6
|
+
well as fetching all the contents of a specified kiosk.
|
|
7
|
+
|
|
8
|
+
## Querying owned kiosks
|
|
9
|
+
|
|
10
|
+
Querying owned kiosks returns a list of `kioskOwnerCaps`, as well as a list of the `kioskIds`.
|
|
11
|
+
|
|
12
|
+
`KioskOwnerCap` is important in this case, as it is used for managing an owned kiosk, as well as
|
|
13
|
+
purchasing.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
const address = '0xAddress';
|
|
17
|
+
// You can perform actions, like querying the owned kiosks for an address.
|
|
18
|
+
const { kioskOwnerCaps, kioskIds } = await client.kiosk.getOwnedKiosks({ address });
|
|
19
|
+
console.log(kioskOwnerCaps);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* An example response for an address that owns two kiosks (one of which is personal)
|
|
23
|
+
[
|
|
24
|
+
{
|
|
25
|
+
isPersonal: true,
|
|
26
|
+
digest: '9mstxLa87E3VEewQ62EEQDKb7ZH2irrEXeMetQjQHzXz',
|
|
27
|
+
version: '18',
|
|
28
|
+
objectId: '0x5d4df1b8da5e1b6bafbb4b7dc5c73e532324d82c86e331f71bf1ea5dff18dccc',
|
|
29
|
+
kioskId: '0x8453fc71611ce8ff73efcca42ed241dcaf7dc65411b56a7be42e6a0bc3d72c13'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
isPersonal: false,
|
|
33
|
+
digest: '8fsKgCh5c2ycPKMVUqUz2H6D9WkPjRHmGP454z67afJh',
|
|
34
|
+
version: '15',
|
|
35
|
+
objectId: '0x84f5a9a1379d73eceae03d0578637936e208daa809e04ec07a8085c798a980fd',
|
|
36
|
+
kioskId: '0xf8c826aae52bc576768032ce496b7fc349f9003603ed1541c8033fc5c2dd2d2c'
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
*/
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Querying kiosk content
|
|
43
|
+
|
|
44
|
+
You can follow the sample to query a kiosk's contents. We recommend saving the `items` structure
|
|
45
|
+
(`KioskItem`), as it's useful when you're trying to purchase from one.
|
|
46
|
+
|
|
47
|
+
`listing` field only applies on items that are listed for sale.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const id = `0xKioskId`;
|
|
51
|
+
|
|
52
|
+
// You can perform actions, like querying a kiosk's contents.
|
|
53
|
+
const res = await client.kiosk.getKiosk({
|
|
54
|
+
id,
|
|
55
|
+
options: {
|
|
56
|
+
withKioskFields: true, // this flag also returns the `kiosk` object in the response, which includes the base setup
|
|
57
|
+
withListingPrices: true, // This flag enables / disables the fetching of the listing prices.
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
console.log(res);
|
|
61
|
+
/**
|
|
62
|
+
* An example response of an existing kiosk
|
|
63
|
+
*
|
|
64
|
+
{
|
|
65
|
+
items: [
|
|
66
|
+
{
|
|
67
|
+
objectId: '0xf65e88a33466763cabd11b7c2a57938cf4fa707c6cf767cb428894e14caf1537',
|
|
68
|
+
type: '0xd12f8e0fdae3f5d88d2fc4af2e869ea503491e2d8da5f3136320b65bdcf70ab3::hero::Hero',
|
|
69
|
+
isLocked: false,
|
|
70
|
+
kioskId: '0x6d45df1942c11048a9182e3f732262e6e3c95ddd2e5f338c565f531717c2617f',
|
|
71
|
+
listing: undefined,
|
|
72
|
+
data: {
|
|
73
|
+
objectId: '0xf65e88a33466763cabd11b7c2a57938cf4fa707c6cf767cb428894e14caf1537',
|
|
74
|
+
version: '18',
|
|
75
|
+
digest: 'As9fkLEP4QVChhYuGemB185xyyzWG4hspSa3UZ6TWR8b',
|
|
76
|
+
display: { data: null, error: null },
|
|
77
|
+
content: {
|
|
78
|
+
dataType: 'moveObject',
|
|
79
|
+
type: '0xd12f8e0fdae3f5d88d2fc4af2e869ea503491e2d8da5f3136320b65bdcf70ab3::hero::Hero',
|
|
80
|
+
hasPublicTransfer: true,
|
|
81
|
+
fields: {
|
|
82
|
+
id: {
|
|
83
|
+
id: '0xf65e88a33466763cabd11b7c2a57938cf4fa707c6cf767cb428894e14caf1537'
|
|
84
|
+
},
|
|
85
|
+
level: 3
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
objectId: '0x34def97cb8c357fcfdf22f72421d4f6f01706662acf7be1afb6e7391d5491372',
|
|
92
|
+
type: '0xd12f8e0fdae3f5d88d2fc4af2e869ea503491e2d8da5f3136320b65bdcf70ab3::hero::Hero',
|
|
93
|
+
isLocked: true,
|
|
94
|
+
kioskId: '0x6d45df1942c11048a9182e3f732262e6e3c95ddd2e5f338c565f531717c2617f',
|
|
95
|
+
listing: undefined,
|
|
96
|
+
data: {
|
|
97
|
+
objectId: '0x34def97cb8c357fcfdf22f72421d4f6f01706662acf7be1afb6e7391d5491372',
|
|
98
|
+
version: '15',
|
|
99
|
+
digest: 'J1MdmHUCXJEKd86rkmMwWASMV86wGkVS9P6SFPyRaKVV',
|
|
100
|
+
display: { data: null, error: null },
|
|
101
|
+
content: {
|
|
102
|
+
dataType: 'moveObject',
|
|
103
|
+
type: '0xd12f8e0fdae3f5d88d2fc4af2e869ea503491e2d8da5f3136320b65bdcf70ab3::hero::Hero',
|
|
104
|
+
hasPublicTransfer: true,
|
|
105
|
+
fields: {
|
|
106
|
+
id: {
|
|
107
|
+
id: '0x34def97cb8c357fcfdf22f72421d4f6f01706662acf7be1afb6e7391d5491372'
|
|
108
|
+
},
|
|
109
|
+
level: 1
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
itemIds: [
|
|
116
|
+
'0xf65e88a33466763cabd11b7c2a57938cf4fa707c6cf767cb428894e14caf1537',
|
|
117
|
+
'0x34def97cb8c357fcfdf22f72421d4f6f01706662acf7be1afb6e7391d5491372'
|
|
118
|
+
],
|
|
119
|
+
listingIds: [],
|
|
120
|
+
extensions: [],
|
|
121
|
+
kiosk: {
|
|
122
|
+
id: '6d45df1942c11048a9182e3f732262e6e3c95ddd2e5f338c565f531717c2617f',
|
|
123
|
+
profits: '100000',
|
|
124
|
+
owner: '96300f8d9064f954f99db2d7fbe2ad0c5e4344f0e22392330285d399498cfaf3',
|
|
125
|
+
itemCount: 2,
|
|
126
|
+
allowExtensions: false
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
*/
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Query kiosk extension
|
|
133
|
+
|
|
134
|
+
Queries an extension's data. Returns `null` if there's no extension with that type installed.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
// The type of the custom extension.
|
|
138
|
+
const type = '0xAddress::custom_extension::ACustomExtensionType';
|
|
139
|
+
|
|
140
|
+
const extension = await client.kiosk.getKioskExtension({
|
|
141
|
+
kioskId: '0xAKioskId',
|
|
142
|
+
type,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
console.log(extension);
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* An example output of the response
|
|
149
|
+
{
|
|
150
|
+
objectId: 'extensionObjectId',
|
|
151
|
+
type: '0xAddress::custom_extension::ACustomExtensionType',
|
|
152
|
+
isEnabled: true,
|
|
153
|
+
permissions: "3",
|
|
154
|
+
storageId: '0xExampleStorageId',
|
|
155
|
+
storageSize: "0",
|
|
156
|
+
}
|
|
157
|
+
*/
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Querying transfer policy for type
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
const itemType = '0xAddress::hero::Hero';
|
|
164
|
+
// You can perform actions, like querying transfer policy for type.
|
|
165
|
+
const policies = await client.kiosk.getTransferPolicies({ type: itemType });
|
|
166
|
+
console.log(policies);
|
|
167
|
+
|
|
168
|
+
/* An example output of the response
|
|
169
|
+
[
|
|
170
|
+
{
|
|
171
|
+
id: '0x074847055fe4ea9a7f51eeaf095c05875509403059115af121cfea9b8de355de',
|
|
172
|
+
type: '0x2::transfer_policy::TransferPolicy<0x85926b03d56e49bedfca558fc6a2540d43bdfb5c218190d63b571f33afe255f8::hero::Hero>',
|
|
173
|
+
owner: { Shared: { initial_shared_version: 5 } },
|
|
174
|
+
rules: [
|
|
175
|
+
'a82212d931d3bc7c3401552d935abced7b7fd41d4f57a99f0f47b9196b2f57f5::kiosk_lock_rule::Rule',
|
|
176
|
+
'a82212d931d3bc7c3401552d935abced7b7fd41d4f57a99f0f47b9196b2f57f5::floor_price_rule::Rule',
|
|
177
|
+
'a82212d931d3bc7c3401552d935abced7b7fd41d4f57a99f0f47b9196b2f57f5::royalty_rule::Rule',
|
|
178
|
+
'a82212d931d3bc7c3401552d935abced7b7fd41d4f57a99f0f47b9196b2f57f5::personal_kiosk_rule::Rule'
|
|
179
|
+
],
|
|
180
|
+
balance: '20000'
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
*/
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Get owned transfer policies
|
|
187
|
+
|
|
188
|
+
Queries to find all the owned transfer policies. Useful to manage transfer policies, and can be
|
|
189
|
+
combined with `TransferPolicyTransaction` to easily add or remove rules and withdraw profits.
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
// The address that owns the transfer policies.
|
|
193
|
+
const address = '0xAddress';
|
|
194
|
+
// You can perform actions, like querying the owned transfer policies for an address.
|
|
195
|
+
const policies = await client.kiosk.getOwnedTransferPolicies({ address });
|
|
196
|
+
console.log(policies);
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* An example output of the response
|
|
200
|
+
[
|
|
201
|
+
{
|
|
202
|
+
policyId: '0x6b6eca8df6e70ea6447e639ef26b519039b5e9123642258eea1b3c781e94faca',
|
|
203
|
+
policyCapId: '0x34a4794d4ad6578ac345d23ca0f7a4632ca88de297daaf24a1cdbc91e1547be4',
|
|
204
|
+
type: '0xbe01d0594bedbce45c0e08c7374b03bf822e9b73cd7d555bf39c39bbf09d23a9::hero::Hero'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
policyId: '0x87ac2dd80011ed2de9c7916a19145ff520959acd3d8c3dbd100aa74b34155a0a',
|
|
208
|
+
policyCapId: '0x858edda13c5c9086b2491eafed39e0ea58511268bb90d90464a2d7b5ed3f3880',
|
|
209
|
+
type: '0xbe01d0594bedbce45c0e08c7374b03bf822e9b73cd7d555bf39c39bbf09d23a9::hero::Villain'
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
*/
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Get owned transfer policies by type
|
|
216
|
+
|
|
217
|
+
Queries to find all the owned transfer policies for a specific type. Useful to manage transfer
|
|
218
|
+
policies, and can be combined with
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
// The address that owns the transfer policies.
|
|
222
|
+
const address = '0xAddress';
|
|
223
|
+
// The type of the transfer policy.
|
|
224
|
+
const type = '0xbe01d0594bedbce45c0e08c7374b03bf822e9b73cd7d555bf39c39bbf09d23a9::hero::Hero';
|
|
225
|
+
|
|
226
|
+
// We can query by type.
|
|
227
|
+
const policies = await client.kiosk.getOwnedTransferPoliciesByType({ address, type });
|
|
228
|
+
|
|
229
|
+
// An example output of the response
|
|
230
|
+
// [
|
|
231
|
+
// {
|
|
232
|
+
// policyId: '0x6b6eca8df6e70ea6447e639ef26b519039b5e9123642258eea1b3c781e94faca',
|
|
233
|
+
// policyCapId: '0x34a4794d4ad6578ac345d23ca0f7a4632ca88de297daaf24a1cdbc91e1547be4',
|
|
234
|
+
// type: '0xbe01d0594bedbce45c0e08c7374b03bf822e9b73cd7d555bf39c39bbf09d23a9::hero::Hero'
|
|
235
|
+
// }
|
|
236
|
+
// ]
|
|
237
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# TransferPolicyTransaction
|
|
2
|
+
|
|
3
|
+
> Create and manage transfer policies for kiosk items
|
|
4
|
+
|
|
5
|
+
`TransferPolicyTransaction` is the client to build transactions that involve transfer policy
|
|
6
|
+
management. It's used similar to `KioskTransaction`, and helps in crafting transactions to manage a
|
|
7
|
+
transfer policy.
|
|
8
|
+
|
|
9
|
+
You need to instantiate it once in every Programmable Transaction Block (PTB) that you're building.
|
|
10
|
+
|
|
11
|
+
Similar to `KioskTransaction`, you can either create a new transfer policy, or use an existing one.
|
|
12
|
+
|
|
13
|
+
## Using an existing transfer policy
|
|
14
|
+
|
|
15
|
+
If you have already retrieved a transfer policy from `client.kiosk.getOwnedTransferPolicies()`, or
|
|
16
|
+
`client.kiosk.getOwnedTransferPoliciesByType()`, you can pass a `TransferPolicyCap` result when
|
|
17
|
+
instantiating.
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// You could have more than one cap, since we can create more than one transfer policy.
|
|
21
|
+
const heroPolicyCaps = await client.kiosk.getOwnedTransferPoliciesByType({
|
|
22
|
+
type: `${packageId}::hero::Hero`,
|
|
23
|
+
address: '0xConnectedAddress',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const tx = new Transaction();
|
|
27
|
+
// You can choose to use any of the caps you have. For this example, use the first one.
|
|
28
|
+
const tpTx = new TransferPolicyTransaction({
|
|
29
|
+
kioskClient: client.kiosk,
|
|
30
|
+
transaction: tx,
|
|
31
|
+
cap: heroPolicyCaps[0],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// A demonstration of using all the available rule add/remove functions.
|
|
35
|
+
// You can chain these commands.
|
|
36
|
+
tpTx
|
|
37
|
+
.addFloorPriceRule(10n)
|
|
38
|
+
.addLockRule()
|
|
39
|
+
.addRoyaltyRule(percentageToBasisPoints(10), 0)
|
|
40
|
+
.addPersonalKioskRule();
|
|
41
|
+
// .removeFloorPriceRule()
|
|
42
|
+
// .removeLockRule()
|
|
43
|
+
// .removeRoyaltyRule()
|
|
44
|
+
// .removePersonalKioskRule()
|
|
45
|
+
|
|
46
|
+
// Sign and execute transaction.
|
|
47
|
+
await signAndExecuteTransaction({ tx: tx });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Creating a new transfer policy
|
|
51
|
+
|
|
52
|
+
If you don't have an existing transfer policy, you can create a new one. You can also attach rules
|
|
53
|
+
in the same PTB.
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const publisher = '0xPackagePublisherObject';
|
|
57
|
+
const tx = new Transaction();
|
|
58
|
+
|
|
59
|
+
const tpTx = new TransferPolicyTransaction({ kioskClient: client.kiosk, transaction: tx });
|
|
60
|
+
|
|
61
|
+
// This is an async call, as the SDK protects from accidentally creating
|
|
62
|
+
// a second transfer policy.
|
|
63
|
+
// You can skip this check by passing `skipCheck: true`.
|
|
64
|
+
await tpTx.create({
|
|
65
|
+
type: `${heroPackageId}::hero::Hero`,
|
|
66
|
+
publisher,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
tpTx
|
|
70
|
+
.addLockRule()
|
|
71
|
+
.addFloorPriceRule(1000n)
|
|
72
|
+
.addRoyaltyRule(percentageToBasisPoints(10), 100)
|
|
73
|
+
.addPersonalKioskRule()
|
|
74
|
+
// Transfers the `TransferPolicyCap` to the user and shares the transfer policy.
|
|
75
|
+
.shareAndTransferCap('address_to_transfer_cap_to');
|
|
76
|
+
|
|
77
|
+
// Sign and execute transaction.
|
|
78
|
+
await signAndExecuteTransaction({ tx: tx });
|
|
79
|
+
```
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Using the manager
|
|
2
|
+
|
|
3
|
+
> Use the TransferPolicyTransaction manager for policy rules
|
|
4
|
+
|
|
5
|
+
# How to use
|
|
6
|
+
|
|
7
|
+
After following the introduction steps on how to initialize a transfer policy transaction you can
|
|
8
|
+
call any of the available functions to prepare your Programmable Transaction Block (PTB).
|
|
9
|
+
|
|
10
|
+
## Available functions
|
|
11
|
+
|
|
12
|
+
### Withdraw profits
|
|
13
|
+
|
|
14
|
+
`withdraw(address: string, amount?: string | bigint)`
|
|
15
|
+
|
|
16
|
+
After setting up the manager, you can withdraw profits from the specified transfer policy.
|
|
17
|
+
|
|
18
|
+
`amount` is optional. Leave empty to withdraw all profits.
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// ... tp transaction is initialized and policy is set.
|
|
22
|
+
// Withdraw 10 SUI from the policy. Leave last parameter empty to withdraw all profits.
|
|
23
|
+
tpTx.withdraw('address_to_transfer_coin', 10_000_000_000n);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Add/Remove rules
|
|
27
|
+
|
|
28
|
+
> You can chain the actions when you're calling them, to add multiple rules.
|
|
29
|
+
|
|
30
|
+
After setting up the transaction, you can add any of the supported rules to the policy.
|
|
31
|
+
|
|
32
|
+
#### Royalty rule
|
|
33
|
+
|
|
34
|
+
`addRoyaltyRule(percentageBps: number | string, minAmount: number | string)`
|
|
35
|
+
|
|
36
|
+
You can add the royalty rule like the following example.
|
|
37
|
+
|
|
38
|
+
`percentageToBasisPoints` is a helper to convert a percentage (0.00-100%) to basis points.
|
|
39
|
+
|
|
40
|
+
Use `minAmount` to set a minimum amount per transaction, so that the royalty paid is
|
|
41
|
+
**MAX(percentageBps, minAmount)**. Use 0 for no minimum amount.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// ... tp transaction is initialized and policy is set.
|
|
45
|
+
tpTx.addRoyaltyRule(percentageToBasisPoints(30), 1_000_000_000);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can remove the rule by calling:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
tpTx.removeRoyaltyRule();
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Kiosk lock rule
|
|
55
|
+
|
|
56
|
+
`addLockRule()`
|
|
57
|
+
|
|
58
|
+
You can add the kiosk lock rule like the following example.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
// ... tp transaction is initialized and policy is set.
|
|
62
|
+
tpTx.addLockRule();
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You can remove the rule by calling:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
tpTx.removeLockRule();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Personal kiosk rule
|
|
72
|
+
|
|
73
|
+
`addPersonalKioskRule()`
|
|
74
|
+
|
|
75
|
+
You can add the kiosk lock rule like the following example.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// ... tp transaction is initialized and policy is set.
|
|
79
|
+
tpTx.addPersonalKioskRule();
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You can remove the rule by calling:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
tpTx.removePersonalKioskRule();
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Floor price rule
|
|
89
|
+
|
|
90
|
+
`addFloorPriceRule(minPrice: string | bigint)`
|
|
91
|
+
|
|
92
|
+
You can add the floor price rule like the following example:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// ... tp transaction is initialized and policy is set.
|
|
96
|
+
tpTx.addFloorPriceRule(10_000_000_000n); // sets 10 SUI as the floor price.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
You can remove the rule by calling:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
tpTx.removeFloorPriceRule();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Updating rules
|
|
106
|
+
|
|
107
|
+
If you want to update a rule, call the `remove...` function, and then call `add` again with the new
|
|
108
|
+
settings.
|
|
109
|
+
|
|
110
|
+
Example:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
// ... tp transaction is initialized and policy is set.
|
|
114
|
+
tpTx.removeRoyaltyRule().addRoyaltyRule(percentageToBasisPoints(20), 1_000_000_000);
|
|
115
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Kiosk
|
|
2
|
+
> Interact with on-chain commerce applications
|
|
3
|
+
|
|
4
|
+
- [Kiosk SDK](./index.md): TypeScript SDK for interacting with Sui Kiosk on-chain commerce
|
|
5
|
+
- [Kiosk Client](./kiosk-client/introduction.md): Introduction to the KioskClient for querying and managing kiosks
|
|
6
|
+
- [Querying](./kiosk-client/querying.md): Query kiosk contents, items, and transfer policies
|
|
7
|
+
- [Advanced Examples](./advanced-examples.md): Advanced Kiosk SDK usage patterns and examples
|
|
8
|
+
- [Migrating from Kiosk SDK V1](./from-v1.md): Migrate from Kiosk SDK v1 to the current version
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Sui TypeScript SDK Documentation
|
|
2
|
+
> Reference documentation for the @mysten/* TypeScript SDK packages for the Sui blockchain.
|
|
3
|
+
|
|
4
|
+
## BCS
|
|
5
|
+
> Encoding and decoding Sui objects
|
|
6
|
+
|
|
7
|
+
- [BCS - Binary Canonical Serialization](./bcs/index.md): Encode and decode Sui Move types with Binary Canonical Serialization
|
|
8
|
+
|
|
9
|
+
## TypeScript Codegen
|
|
10
|
+
> Generate type-safe TypeScript code from Sui Move packages
|
|
11
|
+
|
|
12
|
+
- [Sui TypeScript Codegen](./codegen/index.md): Generate type-safe TypeScript bindings from on-chain Sui Move packages
|
|
13
|
+
|
|
14
|
+
## dApp Kit
|
|
15
|
+
> Build Sui dApps with @mysten/dapp-kit-core and @mysten/dapp-kit-react
|
|
16
|
+
|
|
17
|
+
- [Sui dApp Kit](./dapp-kit/index.md): Build Sui dApps with framework-agnostic core and React bindings
|
|
18
|
+
- [@mysten/create-dapp](./dapp-kit/getting-started/create-dapp.md): Create a Sui dApp with one command
|
|
19
|
+
- [React](./dapp-kit/getting-started/react.md): Set up dApp Kit in a React application
|
|
20
|
+
- [Next.js](./dapp-kit/getting-started/next-js.md): Set up dApp Kit in a Next.js application
|
|
21
|
+
- [Vue](./dapp-kit/getting-started/vue.md): Set up dApp Kit in a Vue application
|
|
22
|
+
- [DApp Kit Instance](./dapp-kit/dapp-kit-instance.md): Create and configure a DAppKit instance for wallet and client management
|
|
23
|
+
- [State](./dapp-kit/state.md): Access and subscribe to wallet connection state in dApp Kit
|
|
24
|
+
- [Connect Wallet](./dapp-kit/actions/connect-wallet.md): Programmatically connect to a Sui wallet
|
|
25
|
+
- [Disconnect Wallet](./dapp-kit/actions/disconnect-wallet.md): Programmatically disconnect from a Sui wallet
|
|
26
|
+
- [Sign and Execute Transaction](./dapp-kit/actions/sign-and-execute-transaction.md): Sign and execute a transaction using the connected wallet
|
|
27
|
+
- [Sign Personal Message](./dapp-kit/actions/sign-personal-message.md): Sign an arbitrary message with the connected wallet
|
|
28
|
+
- [Sign Transaction](./dapp-kit/actions/sign-transaction.md): Sign a transaction without executing it
|
|
29
|
+
- [Switch Account](./dapp-kit/actions/switch-account.md): Switch the active account in the connected wallet
|
|
30
|
+
- [Switch Network](./dapp-kit/actions/switch-network.md): Switch the active network for the dApp Kit instance
|
|
31
|
+
- [DAppKitProvider](./dapp-kit/react/dapp-kit-provider.md): React context provider for dApp Kit configuration
|
|
32
|
+
- [React Hooks](./dapp-kit/react/hooks/index.md): React hooks for accessing dApp Kit state and actions
|
|
33
|
+
- [useDAppKit](./dapp-kit/react/hooks/use-dapp-kit.md): React hook to access the full dApp Kit instance
|
|
34
|
+
- [React Components](./dapp-kit/react/components/index.md): Pre-built React UI components for wallet interaction
|
|
35
|
+
- [Connect Button](./dapp-kit/react/components/connect-button.md): React button component for wallet connection
|
|
36
|
+
- [Connect Modal](./dapp-kit/react/components/connect-modal.md): React modal component for wallet selection
|
|
37
|
+
- [Connect Button](./dapp-kit/web-components/connect-button.md): Framework-agnostic web component for wallet connection
|
|
38
|
+
- [Connect Modal](./dapp-kit/web-components/connect-modal.md): Framework-agnostic web component for wallet selection
|
|
39
|
+
- [Theming](./dapp-kit/theming.md): Customize the appearance of dApp Kit UI components
|
|
40
|
+
|
|
41
|
+
## Kiosk
|
|
42
|
+
> Interact with on-chain commerce applications
|
|
43
|
+
|
|
44
|
+
- [Kiosk SDK](./kiosk/index.md): TypeScript SDK for interacting with Sui Kiosk on-chain commerce
|
|
45
|
+
- [Kiosk Client](./kiosk/kiosk-client/introduction.md): Introduction to the KioskClient for querying and managing kiosks
|
|
46
|
+
- [Querying](./kiosk/kiosk-client/querying.md): Query kiosk contents, items, and transfer policies
|
|
47
|
+
- [Advanced Examples](./kiosk/advanced-examples.md): Advanced Kiosk SDK usage patterns and examples
|
|
48
|
+
- [Migrating from Kiosk SDK V1](./kiosk/from-v1.md): Migrate from Kiosk SDK v1 to the current version
|
|
49
|
+
|
|
50
|
+
## Payment Kit
|
|
51
|
+
> Accept payments in any coin type on Sui
|
|
52
|
+
|
|
53
|
+
- [Payment Kit](./payment-kit/index.md): Accept payments in any coin type on Sui
|
|
54
|
+
- [Getting Started](./payment-kit/getting-started.md): Install and set up Payment Kit for your Sui dApp
|
|
55
|
+
- [Payment Kit SDK](./payment-kit/payment-kit-sdk.md): Payment Kit SDK API reference and configuration
|
|
56
|
+
- [Payment Processing](./payment-kit/payment-processing.md): Process payments and handle transaction results
|
|
57
|
+
- [Registry Management](./payment-kit/registry-management.md): Manage payment registries and accepted coin types
|
|
58
|
+
|
|
59
|
+
## Seal
|
|
60
|
+
> Use Seal, a decentralized secrets management service that secures your data using threshold encryption and on-chain access control.
|
|
61
|
+
|
|
62
|
+
- [Seal SDK](./seal/index.md): Decentralized secrets management with threshold encryption on Sui
|
|
63
|
+
|
|
64
|
+
## Slush Wallet
|
|
65
|
+
> Slush Wallet Integration
|
|
66
|
+
|
|
67
|
+
- [Slush Wallet Integration](./slush-wallet/index.md): Integrate Slush Wallet into your Sui dApp
|
|
68
|
+
- [dApp Integration](./slush-wallet/dapp.md): Connect your dApp to Slush Wallet
|
|
69
|
+
- [Deep Linking](./slush-wallet/deep-linking.md): Deep linking configuration for Slush Wallet
|
|
70
|
+
|
|
71
|
+
## Sui SDK
|
|
72
|
+
> TypeScript interfaces for Sui
|
|
73
|
+
|
|
74
|
+
- [Sui TypeScript SDK Quick Start](./sui/index.md): TypeScript SDK for building on the Sui blockchain
|
|
75
|
+
- [Install Sui TypeScript SDK](./sui/install.md): Install the @mysten/sui package and configure your project
|
|
76
|
+
- [LLM Documentation](./sui/llm-docs.md): Give AI agents access to Sui SDK documentation in your project
|
|
77
|
+
- [Hello Sui](./sui/hello-sui.md): Build your first Sui application with the TypeScript SDK
|
|
78
|
+
- [Faucet](./sui/faucet.md): Request test SUI tokens from the faucet
|
|
79
|
+
- [Sui Clients](./sui/clients/index.md): Choose and configure gRPC, GraphQL, or JSON-RPC clients
|
|
80
|
+
- [Core API](./sui/clients/core.md): Transport-agnostic Core API shared by all Sui clients
|
|
81
|
+
- [SuiGrpcClient](./sui/clients/grpc.md): Connect to Sui via gRPC with SuiGrpcClient
|
|
82
|
+
- [SuiGraphQLClient](./sui/clients/graphql.md): Connect to Sui via GraphQL with SuiGraphQLClient
|
|
83
|
+
- [SuiJsonRpcClient](./sui/clients/json-rpc.md): Connect to Sui via JSON-RPC with SuiJsonRpcClient
|
|
84
|
+
- [Sui Programmable Transaction Basics](./sui/transaction-building/basics.md): Construct programmable transaction blocks with the Transaction API
|
|
85
|
+
- [Paying for Sui Transactions with Gas Coins](./sui/transaction-building/gas.md): Configure gas budget, price, and coin selection for transactions
|
|
86
|
+
- [Transaction Intents](./sui/transaction-building/intents.md): Use high-level intents to simplify transaction building
|
|
87
|
+
- [Building Offline](./sui/transaction-building/offline.md): Build transactions without a network connection
|
|
88
|
+
- [Sponsored Transactions](./sui/transaction-building/sponsored-transactions.md): Pay gas fees on behalf of other users with sponsored transactions
|
|
89
|
+
- [Key pairs](./sui/cryptography/keypairs.md): Create and manage Ed25519, Secp256k1, and Secp256r1 keypairs
|
|
90
|
+
- [Multi-Signature Transactions](./sui/cryptography/multisig.md): Create multi-signature transactions with multiple signers
|
|
91
|
+
- [Passkey](./sui/cryptography/passkey.md): Use WebAuthn passkeys for Sui transaction signing
|
|
92
|
+
- [Web Crypto Signer](./sui/cryptography/webcrypto-signer.md): Sign transactions using the Web Crypto API
|
|
93
|
+
- [The `@mysten/sui/utils` package](./sui/utils/index.md): Utility functions for addresses, coins, and common operations
|
|
94
|
+
- [Derived Objects](./sui/utils/derived_objects.md): Compute derived object IDs from parent objects
|
|
95
|
+
- [BCS](./sui/bcs.md): Binary Canonical Serialization for encoding Sui Move types
|
|
96
|
+
- [ZkLogin](./sui/zklogin.md): Zero-knowledge authentication with OAuth providers on Sui
|
|
97
|
+
- [Transaction Executors](./sui/executors.md): Manage transaction execution with queuing and parallel strategies
|
|
98
|
+
- [Transaction Plugins](./sui/plugins.md): Extend transaction building with reusable plugins
|
|
99
|
+
- [Building SDKs](./sui/sdk-building.md): Build custom SDKs on top of the Sui TypeScript SDK
|
|
100
|
+
- [Migrate to 2.0](./sui/migrations/sui-2.0/index.md): Migration guide for Sui TypeScript SDK 2.0
|
|
101
|
+
- [Agent Migration Prompt](./sui/migrations/sui-2.0/agent-prompt.md): AI agent prompt for automated SDK 2.0 migration
|
|
102
|
+
- [@mysten/sui](./sui/migrations/sui-2.0/sui.md): Migrate @mysten/sui from 1.x to 2.0
|
|
103
|
+
- [Migrating from JSON-RPC](./sui/migrations/sui-2.0/json-rpc-migration.md): Migrate from JSON-RPC to the new Core API
|
|
104
|
+
- [@mysten/dapp-kit](./sui/migrations/sui-2.0/dapp-kit.md): Migrate @mysten/dapp-kit to 2.0
|
|
105
|
+
- [@mysten/kiosk](./sui/migrations/sui-2.0/kiosk.md): Migrate @mysten/kiosk to 2.0
|
|
106
|
+
- [@mysten/zksend](./sui/migrations/sui-2.0/zksend.md): Migrate @mysten/zksend to 2.0
|
|
107
|
+
- [@mysten/suins](./sui/migrations/sui-2.0/suins.md): Migrate @mysten/suins to 2.0
|
|
108
|
+
- [@mysten/deepbook-v3](./sui/migrations/sui-2.0/deepbook-v3.md): Migrate @mysten/deepbook-v3 to 2.0
|
|
109
|
+
- [@mysten/walrus](./sui/migrations/sui-2.0/walrus.md): Migrate @mysten/walrus to 2.0
|
|
110
|
+
- [@mysten/seal](./sui/migrations/sui-2.0/seal.md): Migrate @mysten/seal to 2.0
|
|
111
|
+
- [Wallet Builders](./sui/migrations/sui-2.0/wallet-builders.md): Migration guide for wallet extension developers
|
|
112
|
+
- [SDK Maintainers](./sui/migrations/sui-2.0/sdk-maintainers.md): Migration guide for SDK maintainers and library authors
|
|
113
|
+
- [Migrate to 1.0](./sui/migrations/sui-1.0.md): Migrate to Sui TypeScript SDK 1.0
|
|
114
|
+
- [Migrate to 0.38.0](./sui/migrations/0.38.md): Migrate from SDK version 0.37 to 0.38
|
|
115
|
+
|
|
116
|
+
## Walrus
|
|
117
|
+
> Publish and Read blobs directly from walrus storage nodes
|
|
118
|
+
|
|
119
|
+
- [Walrus SDK](./walrus/index.md): Store and retrieve blobs on Walrus decentralized storage
|
|
120
|
+
|
|
121
|
+
## ZkSend
|
|
122
|
+
> Send Sui with a link
|
|
123
|
+
|
|
124
|
+
- [zkSend SDK](./zksend/index.md): Send Sui assets via shareable links with zkSend
|
|
125
|
+
- [Creating zkSend Links](./zksend/link-builder.md): Create and customize zkSend claim links
|