@mysten/kiosk 0.5.3 → 0.7.0

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +2 -287
  3. package/dist/client/kiosk-client.d.ts +64 -0
  4. package/dist/client/kiosk-transaction.d.ts +207 -0
  5. package/dist/client/tp-transaction.d.ts +112 -0
  6. package/dist/constants.d.ts +30 -4
  7. package/dist/index.d.ts +3 -6
  8. package/dist/index.js +1247 -257
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +1230 -223
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/query/kiosk.d.ts +2 -1
  13. package/dist/query/transfer-policy.d.ts +17 -1
  14. package/dist/tx/kiosk.d.ts +7 -23
  15. package/dist/tx/personal-kiosk.d.ts +7 -0
  16. package/dist/tx/rules/attach.d.ts +7 -0
  17. package/dist/tx/rules/resolve.d.ts +15 -0
  18. package/dist/tx/transfer-policy.d.ts +13 -16
  19. package/dist/types/index.d.ts +22 -4
  20. package/dist/types/kiosk.d.ts +30 -1
  21. package/dist/types/transfer-policy.d.ts +27 -1
  22. package/dist/utils.d.ts +32 -18
  23. package/package.json +12 -4
  24. package/src/bcs.ts +1 -0
  25. package/src/client/kiosk-client.ts +156 -0
  26. package/src/client/kiosk-transaction.ts +512 -0
  27. package/src/client/tp-transaction.ts +350 -0
  28. package/src/constants.ts +113 -6
  29. package/src/index.ts +3 -6
  30. package/src/query/kiosk.ts +51 -18
  31. package/src/query/transfer-policy.ts +82 -2
  32. package/src/tx/kiosk.ts +18 -146
  33. package/src/tx/personal-kiosk.ts +35 -0
  34. package/src/tx/rules/attach.ts +74 -0
  35. package/src/tx/rules/resolve.ts +87 -0
  36. package/src/tx/transfer-policy.ts +40 -78
  37. package/src/types/index.ts +25 -4
  38. package/src/types/kiosk.ts +26 -1
  39. package/src/types/transfer-policy.ts +35 -1
  40. package/src/utils.ts +141 -33
  41. package/dist/tx/rules.d.ts +0 -19
  42. package/dist/types/env.d.ts +0 -12
  43. package/src/tx/rules.ts +0 -58
  44. package/src/types/env.ts +0 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @mysten/kiosk
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5ee8c24f1: Introduces BREAKING CHANGES. Migration guide and explanation: https://sui-typescript-docs.vercel.app/kiosk/from-v1
8
+
9
+ ## 0.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - fd8589806: Remove uses of deprecated imports from @mysten/sui.js
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [fd8589806]
18
+ - @mysten/sui.js@0.42.0
19
+
3
20
  ## 0.5.3
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -1,293 +1,8 @@
1
1
  # Kiosk SDK
2
2
 
3
- > **This package is still in active development. Use at your own risk**.
4
-
5
3
  This Kiosk SDK library provides different utilities to interact/create/manage a
6
4
  [Kiosk](https://github.com/MystenLabs/sui/tree/main/kiosk).
7
5
 
8
- ## Installation
9
-
10
- To install, add `@mysten/kiosk` package to your project
11
-
12
- ```
13
- npm i @mysten/kiosk
14
- ```
15
-
16
- You can also use your preferred package manager, such as yarn or pnpm.
17
-
18
- ## Examples
19
-
20
- Here are some indicative examples on how to use the kiosk SDK.
21
-
22
- <details>
23
- <summary>Find the kiosks owned by an address</summary>
24
-
25
- ```typescript
26
- import { getOwnedKiosks } from '@mysten/kiosk';
27
- import { SuiClient } from '@mysten/sui.js/client';
28
-
29
- const client = new SuiClient(
30
- url: 'https://fullnode.testnet.sui.io:443',
31
- );
32
-
33
-
34
- // You could use these to fetch the contents for each kiosk, or use the `kioskOwnerCap` data for other actions.
35
- const getUserKiosks = async () => {
36
- const address = `0xAddress`;
37
- const { data } = await getOwnedKiosks(client, address);
38
- console.log(data); // kioskOwnerCaps:[], kioskIds: []
39
- };
40
- ```
41
-
42
- </details>
43
-
44
- <details>
45
- <summary>Getting the listings & items by the kiosk's ID</summary>
46
-
47
- ```typescript
48
- import { fetchKiosk } from '@mysten/kiosk';
49
- import { SuiClient } from '@mysten/sui.js/client';
50
-
51
- const client = new SuiClient(
52
- url: 'https://fullnode.testnet.sui.io:443',
53
- );
54
-
55
- const getKiosk = async () => {
56
- const kioskAddress = `0xSomeKioskAddress`;
57
-
58
- const { data } = await fetchKiosk(
59
- client,
60
- kioskAddress,
61
- {}, // empty pagination, currently disabled.
62
- { withListingPrices: true, withKioskFields: true },
63
- );
64
-
65
- console.log(data); // { items: [], itemIds: [], listingIds: [], kiosk: {...} }
66
- };
67
- ```
68
-
69
- </details>
70
-
71
- <details>
72
- <summary>Purchasing an item (currently supports royalty rule, kiosk_lock_rule, no rules, (combination works too))</summary>
73
-
74
- ```typescript
75
- import { queryTransferPolicy, purchaseAndResolvePolicies, place, testnetEnvironment } from '@mysten/kiosk';
76
- import { SuiClient } from '@mysten/sui.js/client';
77
-
78
- const client = new SuiClient(
79
- url: 'https://fullnode.testnet.sui.io:443',
80
- );
81
-
82
- // the kiosk we're purchasing from
83
- const kioskId = `0xSomeKioskAddress`;
84
- // a sample item retrieved from `fetchKiosk` function (or hard-coded)
85
- const item = {
86
- isLocked: false,
87
- objectId: "0xb892d61a9992a10c9453efcdbd14ca9720d7dc1000a2048224209c9e544ed223"
88
- type: "0x52852c4ba80040395b259c641e70b702426a58990ff73cecf5afd31954429090::test::TestItem",
89
- listing: {
90
- isExclusive: false,
91
- listingId: "0x368b512ff2514dbea814f26ec9a3d41198c00e8ed778099961e9ed22a9f0032b",
92
- price: "20000000000" // in MIST
93
- }
94
- }
95
- const ownedKiosk = `0xMyKioskAddress`;
96
- const ownedKioskCap = `0xMyKioskOwnerCap`;
97
-
98
- const purchaseItem = async (item, kioskId) => {
99
-
100
- // fetch the policy of the item (could be an array, if there's more than one transfer policy)
101
- const policies = await queryTransferPolicy(client, item.type);
102
- // selecting the first one for simplicity.
103
- const policyId = policy[0]?.id;
104
- // initialize tx block.
105
- const tx = new TransactionBlock();
106
-
107
- // Both are required if you there is a `kiosk_lock_rule`.
108
- // Optional otherwise. Function will throw an error if there's a kiosk_lock_rule and these are missing.
109
- const extraParams = {
110
- ownedKiosk,
111
- ownedKioskCap
112
- }
113
- // Define the environment.
114
- // To use a custom package address for rules, you could call:
115
- // const environment = customEnvironment('<PackageAddress>');
116
- const environment = testnetEnvironment;
117
-
118
- // Extra params. Optional, but required if the user tries to resolve a `kiosk_lock_rule`.
119
- // Purchases the item. Supports `kiosk_lock_rule`, `royalty_rule` (accepts combination too).
120
- const result = purchaseAndResolvePolicies(tx, item.type, item.listing.price, kioskId, item.objectId, policy[0], environment, extraParams);
121
-
122
- // result = {item: <the_purchased_item>, canTransfer: true/false // depending on whether there was a kiosk lock rule }
123
- // if the item didn't have a kiosk_lock_rule, we need to do something with it.
124
- // for e..g place it in our own kiosk. (demonstrated below)
125
- if(result.canTransfer) place(tx, item.type, ownedKiosk, ownedKioskCap , result.item);
126
-
127
- // ...finally, sign PTB & execute it.
128
-
129
- };
130
- ```
131
-
132
- </details>
133
-
134
- <details>
135
- <summary>Create a kiosk, share it and get transfer the `kioskOwnerCap` to the wallet's address</summary>
136
-
137
- ```typescript
138
- import { createKioskAndShare } from '@mysten/kiosk';
139
- import { TransactionBlock } from '@mysten/sui.js/transactions';
140
-
141
- const createKiosk = async () => {
142
- const accountAddress = '0xSomeSuiAddress';
143
-
144
- const tx = new TransactionBlock();
145
- const kiosk_cap = createKioskAndShare(tx);
146
-
147
- tx.transferObjects([kiosk_cap], tx.pure(accountAddress, 'address'));
148
-
149
- // ... continue to sign and execute the transaction
150
- // ...
151
- };
152
- ```
153
-
154
- </details>
155
-
156
- <details>
157
- <summary>Place an item and list it for sale in the kiosk</summary>
158
-
159
- ```typescript
160
- import { placeAndList } from '@mysten/kiosk';
161
- import { TransactionBlock } from '@mysten/sui.js/transactions';
162
-
163
- const placeAndListToKiosk = async () => {
164
- const kiosk = 'SomeKioskId';
165
- const kioskCap = 'KioskCapObjectId';
166
- const itemType = '0xItemAddr::some:ItemType';
167
- const item = 'SomeItemId';
168
- const price = '100000';
169
-
170
- const tx = new TransactionBlock();
171
-
172
- placeAndList(tx, itemType, kiosk, kioskCap, item, price);
173
-
174
- // ... continue to sign and execute the transaction
175
- // ...
176
- };
177
- ```
178
-
179
- </details>
180
-
181
- <details>
182
- <summary>Withdraw profits from your kiosk</summary>
183
-
184
- ```typescript
185
- import { withdrawFromKiosk } from '@mysten/kiosk';
186
- import { TransactionBlock } from '@mysten/sui.js/transactions';
187
-
188
- const withdraw = async () => {
189
- const kiosk = 'SomeKioskId';
190
- const kioskCap = 'KioskCapObjectId';
191
- const address = '0xSomeAddressThatReceivesTheFunds';
192
- const amount = '100000';
193
-
194
- const tx = new TransactionBlock();
195
-
196
- withdrawFromKiosk(tx, kiosk, kioskCap, amount);
197
-
198
- // transfer the Coin to self or any other address.
199
- tx.transferObjects([coin], tx.pure(address, 'address'));
200
-
201
- // ... continue to sign and execute the transaction
202
- // ...
203
- };
204
- ```
205
-
206
- </details>
207
-
208
- <details>
209
-
210
- <summary>Create a Transfer Policy for a Type</summary>
211
-
212
- You can create a TransferPolicy only for packages for which you own the `publisher` object.
213
-
214
- As a best practice, you should use a single Transfer policy per type (T). If you use more than one
215
- policy for a type, and the rules for each differ, anyone that meets the conditions for any of the
216
- attached policies can purchase an asset from a kiosk. You can't specify which policy applies to a
217
- specific asset for the type when there is more than one policy attached. When someone meets the
218
- conditions that are easiest to meet, they are allowed to purchase and transfer the asset.
219
-
220
- Before you create a transfer policy, you can use the `queryTransferpolicy` function to check the
221
- transfer policy associated with a type. This is similar to the `purchaseAndResolvePolicies` example
222
- above.
223
-
224
- ```typescript
225
- import { createTransferPolicy } from '@mysten/kiosk';
226
- import { TransactionBlock } from '@mysten/sui.js';
227
-
228
- const createPolicyForType = async () => {
229
- const type = 'SomePackageId::type::MyType'; // the Type for which we're creating a Transfer Policy.
230
- const publisher = 'publisherObjectId'; // the publisher object id that you got when claiming the package that defines the Type.
231
- const address = 'AddressToReceiveTheCap';
232
-
233
- const tx = new TransactionBlock();
234
- // create transfer policy
235
- let transferPolicyCap = createTransferPolicy(tx, type, publisher);
236
- // transfer the Cap to the address.
237
- tx.transferObjects([transferPolicyCap], tx.pure(address, 'address'));
238
-
239
- // ... continue to sign and execute the transaction
240
- // ...
241
- };
242
- ```
243
-
244
- </details>
245
-
246
- <details>
247
-
248
- <summary>Attach Royalty and Lock rules to a Transfer policy</summary>
249
-
250
- ```typescript
251
- import {
252
- createTransferPolicy,
253
- attachKioskLockRule,
254
- attachRoyaltyRule,
255
- testnetEnvironment,
256
- percentageToBasisPoints,
257
- } from '@mysten/kiosk';
258
- import { TransactionBlock } from '@mysten/sui.js';
259
-
260
- // Attaches a royalty rule of 1% or 0.1 SUI (whichever is bigger)
261
- // as well as a kiosk lock, making the objects trade-able only from/to a kiosk.
262
- const attachStrongRoyalties = async () => {
263
- const type = 'SomePackageId::type::MyType'; // the Type for which we're attaching rules.
264
- const policyId = 'policyObjectId'; // the transfer Policy ID that was created for that Type.
265
- const transferPolicyCap = 'transferPolicyCapId'; // the transferPolicyCap for that policy.
266
-
267
- // royalties configuration.
268
- const percentage = 2.55; // 2.55%
269
- const minAmount = 100_000_000; // 0.1 SUI.
270
-
271
- // the environment on which we're referecing the rules package.
272
- // use `mainnetEnvironment` for mainnet.
273
- const enviroment = testnetEnvironment;
274
-
275
- const tx = new TransactionBlock();
276
-
277
- attachKioskLockRule(tx, type, policyId, policyCapId, enviroment);
278
- attachRoyaltyRule(
279
- tx,
280
- type,
281
- policyId,
282
- policyCapId,
283
- percentageToBasisPoints(percentage),
284
- minAmount,
285
- enviroment,
286
- );
287
-
288
- // ... continue to sign and execute the transaction
289
- // ...
290
- };
291
- ```
6
+ [You can read the documentation and see examples by clicking here.](https://sui-typescript-docs.vercel.app/kiosk)
292
7
 
293
- </details>
8
+ [If you are migrating from `0.6.x`, you can follow these instructions](https://sui-typescript-docs.vercel.app/kiosk/from-v1)
@@ -0,0 +1,64 @@
1
+ import { type SuiClient } from '@mysten/sui.js/client';
2
+ import { type BaseRulePackageIds, type TransferPolicyRule } from '../constants';
3
+ import { Network, type FetchKioskOptions, type KioskClientOptions, type KioskData, type OwnedKiosks } from '../types';
4
+ /**
5
+ * A Client that allows you to interact with kiosk.
6
+ * Offers utilities to query kiosk, craft transactions to edit your own kiosk,
7
+ * purchase, manage transfer policies, create new kiosks etc.
8
+ * If you pass packageIds, all functionality will be managed using these packages.
9
+ */
10
+ export declare class KioskClient {
11
+ client: SuiClient;
12
+ network: Network;
13
+ rules: TransferPolicyRule[];
14
+ packageIds?: BaseRulePackageIds;
15
+ constructor(options: KioskClientOptions);
16
+ /**
17
+ * Get an addresses's owned kiosks.
18
+ * @param address The address for which we want to retrieve the kiosks.
19
+ * @returns An Object containing all the `kioskOwnerCap` objects as well as the kioskIds.
20
+ */
21
+ getOwnedKiosks({ address }: {
22
+ address: string;
23
+ }): Promise<OwnedKiosks>;
24
+ /**
25
+ * Fetches the kiosk contents.
26
+ * @param kioskId The ID of the kiosk to fetch.
27
+ * @param options Optioal
28
+ * @returns
29
+ */
30
+ getKiosk({ id, options }: {
31
+ id: string;
32
+ options?: FetchKioskOptions;
33
+ }): Promise<KioskData>;
34
+ /**
35
+ * Query the Transfer Policy(ies) for type `T`.
36
+ * @param type The Type we're querying for (E.g `0xMyAddress::hero::Hero`)
37
+ */
38
+ getTransferPolicies({ type }: {
39
+ type: string;
40
+ }): Promise<import("../types").TransferPolicy[]>;
41
+ /**
42
+ * Query all the owned transfer policies for an address.
43
+ * Returns `TransferPolicyCap` which uncludes `policyId, policyCapId, type`.
44
+ * @param address The address we're searching the owned transfer policies for.
45
+ */
46
+ getOwnedTransferPolicies({ address }: {
47
+ address: string;
48
+ }): Promise<import("../types").TransferPolicyCap[] | undefined>;
49
+ /**
50
+ * Query the Transfer Policy Cap for type `T`, owned by `address`
51
+ * @param type The Type `T` for the object
52
+ * @param address The address that owns the cap.
53
+ */
54
+ getOwnedTransferPoliciesByType({ type, address }: {
55
+ type: string;
56
+ address: string;
57
+ }): Promise<import("../types").TransferPolicyCap[]>;
58
+ addRuleResolver(rule: TransferPolicyRule): void;
59
+ /**
60
+ * A convenient helper to get the packageIds for our supported ruleset,
61
+ * based on `kioskClient` configuration.
62
+ */
63
+ getRulePackageId(rule: 'kioskLockRulePackageId' | 'royaltyRulePackageId' | 'personalKioskRulePackageId' | 'floorPriceRulePackageId'): string;
64
+ }
@@ -0,0 +1,207 @@
1
+ import { type TransactionArgument, type TransactionBlock } from '@mysten/sui.js/transactions';
2
+ import { ItemId, ItemReference, ItemValue, KioskOwnerCap, ObjectArgument, Price, PurchaseOptions } from '../types';
3
+ import { type KioskClient } from './kiosk-client';
4
+ export type KioskTransactionParams = {
5
+ /** The TransactionBlock for this run */
6
+ transactionBlock: TransactionBlock;
7
+ /**
8
+ * You can create a new KioskClient by calling `new KioskClient()`
9
+ */
10
+ kioskClient: KioskClient;
11
+ /**
12
+ * You can optionally pass in the `cap` as returned
13
+ * from `kioskClient.getOwnedKiosks` when initializing the client
14
+ * Otherwise, you can set it by calling `kioskTransaction.setCap()`
15
+ */
16
+ cap?: KioskOwnerCap;
17
+ };
18
+ /**
19
+ * A helper for building transactions that involve kiosk.
20
+ */
21
+ export declare class KioskTransaction {
22
+ #private;
23
+ transactionBlock: TransactionBlock;
24
+ kioskClient: KioskClient;
25
+ kiosk?: TransactionArgument;
26
+ kioskCap?: TransactionArgument;
27
+ constructor({ transactionBlock, kioskClient, cap }: KioskTransactionParams);
28
+ /**
29
+ * Creates a kiosk and saves `kiosk` and `kioskOwnerCap` in state.
30
+ * Helpful if we want to chain some actions before sharing + transferring the cap to the specified address.
31
+ * @param borrow If true, the `kioskOwnerCap` is borrowed from the `PersonalKioskCap` to be used in next transactions.
32
+ */
33
+ create(): this;
34
+ /**
35
+ * Creates a personal kiosk & shares it.
36
+ * The `PersonalKioskCap` is transferred to the signer.
37
+ * @param borrow If true, the `kioskOwnerCap` is borrowed from the `PersonalKioskCap` to be used in next transactions.
38
+ */
39
+ createPersonal(borrow?: boolean): this;
40
+ /**
41
+ * Converts a kiosk to a Personal (Soulbound) Kiosk.
42
+ * Requires initialization by either calling `ktxb.create()` or `ktxb.setCap()`.
43
+ */
44
+ convertToPersonal(borrow?: boolean): this;
45
+ /**
46
+ * Single function way to create a kiosk, share it and transfer the cap to the specified address.
47
+ */
48
+ createAndShare(address: string): void;
49
+ /**
50
+ * Shares the kiosk.
51
+ */
52
+ share(): void;
53
+ /**
54
+ * Should be called only after `create` is called.
55
+ * It shares the kiosk & transfers the cap to the specified address.
56
+ */
57
+ shareAndTransferCap(address: string): void;
58
+ /**
59
+ * A function to borrow an item from a kiosk & execute any function with it.
60
+ * Example: You could borrow a Fren out of a kiosk, attach an accessory (or mix), and return it.
61
+ */
62
+ borrowTx({ itemType, itemId }: ItemId, callback: (item: TransactionArgument) => void): void;
63
+ /**
64
+ * Borrows an item from the kiosk.
65
+ * This will fail if the item is listed for sale.
66
+ *
67
+ * Requires calling `return`.
68
+ */
69
+ borrow({ itemType, itemId }: ItemId): [TransactionArgument, TransactionArgument];
70
+ /**
71
+ * Returns the item back to the kiosk.
72
+ * Accepts the parameters returned from the `borrow` function.
73
+ */
74
+ return({ itemType, item, promise }: ItemValue & {
75
+ promise: TransactionArgument;
76
+ }): this;
77
+ /**
78
+ * A function to withdraw from kiosk
79
+ * @param address Where to trasnfer the coin.
80
+ * @param amount The amount we aim to withdraw.
81
+ */
82
+ withdraw(address: string, amount?: string | bigint | number): this;
83
+ /**
84
+ * A function to place an item in the kiosk.
85
+ * @param itemType The type `T` of the item
86
+ * @param item The ID or Transaction Argument of the item
87
+ */
88
+ place({ itemType, item }: ItemReference): this;
89
+ /**
90
+ * A function to place an item in the kiosk and list it for sale in one transaction.
91
+ * @param itemType The type `T` of the item
92
+ * @param item The ID or Transaction Argument of the item
93
+ * @param price The price in MIST
94
+ */
95
+ placeAndList({ itemType, item, price }: ItemReference & Price): this;
96
+ /**
97
+ * A function to list an item in the kiosk.
98
+ * @param itemType The type `T` of the item
99
+ * @param itemId The ID of the item
100
+ * @param price The price in MIST
101
+ */
102
+ list({ itemType, itemId, price }: ItemId & {
103
+ price: string | bigint;
104
+ }): this;
105
+ /**
106
+ * A function to delist an item from the kiosk.
107
+ * @param itemType The type `T` of the item
108
+ * @param itemId The ID of the item
109
+ */
110
+ delist({ itemType, itemId }: ItemId): this;
111
+ /**
112
+ * A function to take an item from the kiosk. The transaction won't succeed if the item is listed or locked.
113
+
114
+ * @param itemType The type `T` of the item
115
+ * @param itemId The ID of the item
116
+ */
117
+ take({ itemType, itemId }: ItemId): TransactionArgument;
118
+ /**
119
+ * Transfer a non-locked/non-listed item to an address.
120
+ *
121
+ * @param itemType The type `T` of the item
122
+ * @param itemId The ID of the item
123
+ * @param address The destination address
124
+ */
125
+ transfer({ itemType, itemId, address }: ItemId & {
126
+ address: string;
127
+ }): this;
128
+ /**
129
+ * A function to take lock an item in the kiosk.
130
+
131
+ * @param itemType The type `T` of the item
132
+ * @param itemId The ID of the item
133
+ * @param policy The Policy ID or Transaction Argument for item T
134
+ */
135
+ lock({ itemType, itemId, policy }: ItemId & {
136
+ policy: ObjectArgument;
137
+ }): this;
138
+ /**
139
+ * Purchase an item from a seller's kiosk.
140
+ * Returns [item, transferRequest]
141
+ * Can be called like: `const [item, transferRequest] = kioskTx.purchase({...})`
142
+ * @param itemType The type `T` of the item
143
+ * @param itemId The ID of the item
144
+ * @param price The price in MIST
145
+ * @param sellerKiosk The kiosk which is selling the item. Can be an id or an object argument.
146
+ */
147
+ purchase({ itemType, itemId, price, sellerKiosk, }: ItemId & Price & {
148
+ sellerKiosk: ObjectArgument;
149
+ }): [TransactionArgument, TransactionArgument];
150
+ /**
151
+ * A function to purchase and resolve a transfer policy.
152
+ * If the transfer policy has the `lock` rule, the item is locked in the kiosk.
153
+ * Otherwise, the item is placed in the kiosk.
154
+ * @param itemType The type of the item
155
+ * @param itemId The id of the item
156
+ * @param price The price of the specified item
157
+ * @param sellerKiosk The kiosk which is selling the item. Can be an id or an object argument.
158
+ * @param extraArgs Used to pass arguments for custom rule resolvers.
159
+ */
160
+ purchaseAndResolve({ itemType, itemId, price, sellerKiosk, extraArgs, }: ItemId & Price & {
161
+ sellerKiosk: ObjectArgument;
162
+ } & PurchaseOptions): Promise<this>;
163
+ /**
164
+ * A function to setup the client using an existing `ownerCap`,
165
+ * as return from the `kioskClient.getOwnedKiosks` function.
166
+ * @param cap `KioskOwnerCap` object as returned from `getOwnedKiosks` SDK call.
167
+ */
168
+ setCap(cap: KioskOwnerCap): this | undefined;
169
+ /**
170
+ * A function that ends up the kiosk building txb & returns the `kioskOwnerCap` back to the
171
+ * `PersonalKioskCap`, in case we are operating on a personal kiosk.
172
+ * It will also share the `kiosk` if it's not shared, and finalize the transfer of the personal cap if it's pending.
173
+ */
174
+ finalize(): void;
175
+ setKioskCap(cap: TransactionArgument): this;
176
+ setKiosk(kiosk: TransactionArgument): this;
177
+ getKiosk(): {
178
+ kind: "Input";
179
+ index: number;
180
+ type?: "object" | "pure" | undefined;
181
+ value?: any;
182
+ } | {
183
+ kind: "GasCoin";
184
+ } | {
185
+ kind: "Result";
186
+ index: number;
187
+ } | {
188
+ kind: "NestedResult";
189
+ index: number;
190
+ resultIndex: number;
191
+ };
192
+ getKioskCap(): {
193
+ kind: "Input";
194
+ index: number;
195
+ type?: "object" | "pure" | undefined;
196
+ value?: any;
197
+ } | {
198
+ kind: "GasCoin";
199
+ } | {
200
+ kind: "Result";
201
+ index: number;
202
+ } | {
203
+ kind: "NestedResult";
204
+ index: number;
205
+ resultIndex: number;
206
+ };
207
+ }