@mysten/kiosk 0.14.5 → 1.0.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.
- package/CHANGELOG.md +112 -2
- package/dist/client/kiosk-client.d.mts +126 -0
- package/dist/client/kiosk-client.d.mts.map +1 -0
- package/dist/client/kiosk-client.mjs +124 -0
- package/dist/client/kiosk-client.mjs.map +1 -0
- package/dist/client/kiosk-transaction.d.mts +236 -0
- package/dist/client/kiosk-transaction.d.mts.map +1 -0
- package/dist/client/kiosk-transaction.mjs +472 -0
- package/dist/client/kiosk-transaction.mjs.map +1 -0
- package/dist/client/tp-transaction.d.mts +139 -0
- package/dist/client/tp-transaction.d.mts.map +1 -0
- package/dist/client/tp-transaction.mjs +273 -0
- package/dist/client/tp-transaction.mjs.map +1 -0
- package/dist/constants.d.mts +42 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +62 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/contracts/0x2/bag.mjs +19 -0
- package/dist/contracts/0x2/bag.mjs.map +1 -0
- package/dist/contracts/0x2/balance.mjs +20 -0
- package/dist/contracts/0x2/balance.mjs.map +1 -0
- package/dist/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs +16 -0
- package/dist/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs.map +1 -0
- package/dist/contracts/0x2/kiosk.mjs +244 -0
- package/dist/contracts/0x2/kiosk.mjs.map +1 -0
- package/dist/contracts/0x2/kiosk_extension.mjs +25 -0
- package/dist/contracts/0x2/kiosk_extension.mjs.map +1 -0
- package/dist/contracts/0x2/transfer_policy.mjs +99 -0
- package/dist/contracts/0x2/transfer_policy.mjs.map +1 -0
- package/dist/contracts/0x2/vec_set.mjs +18 -0
- package/dist/contracts/0x2/vec_set.mjs.map +1 -0
- package/dist/contracts/kiosk/deps/sui/kiosk.mjs +98 -0
- package/dist/contracts/kiosk/deps/sui/kiosk.mjs.map +1 -0
- package/dist/contracts/kiosk/floor_price_rule.mjs +70 -0
- package/dist/contracts/kiosk/floor_price_rule.mjs.map +1 -0
- package/dist/contracts/kiosk/kiosk_lock_rule.mjs +72 -0
- package/dist/contracts/kiosk/kiosk_lock_rule.mjs.map +1 -0
- package/dist/contracts/kiosk/personal_kiosk.mjs +102 -0
- package/dist/contracts/kiosk/personal_kiosk.mjs.map +1 -0
- package/dist/contracts/kiosk/personal_kiosk_rule.mjs +66 -0
- package/dist/contracts/kiosk/personal_kiosk_rule.mjs.map +1 -0
- package/dist/contracts/kiosk/royalty_rule.mjs +115 -0
- package/dist/contracts/kiosk/royalty_rule.mjs.map +1 -0
- package/dist/contracts/utils/index.mjs +118 -0
- package/dist/contracts/utils/index.mjs.map +1 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +9 -0
- package/dist/query/client-utils.mjs +30 -0
- package/dist/query/client-utils.mjs.map +1 -0
- package/dist/query/kiosk.mjs +154 -0
- package/dist/query/kiosk.mjs.map +1 -0
- package/dist/query/transfer-policy.mjs +110 -0
- package/dist/query/transfer-policy.mjs.map +1 -0
- package/dist/tx/kiosk.mjs +20 -0
- package/dist/tx/kiosk.mjs.map +1 -0
- package/dist/tx/rules/resolve.mjs +114 -0
- package/dist/tx/rules/resolve.mjs.map +1 -0
- package/dist/tx/transfer-policy.mjs +38 -0
- package/dist/tx/transfer-policy.mjs.map +1 -0
- package/dist/types/index.d.mts +23 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/kiosk.d.mts +165 -0
- package/dist/types/kiosk.d.mts.map +1 -0
- package/dist/types/kiosk.mjs +21 -0
- package/dist/types/kiosk.mjs.map +1 -0
- package/dist/types/transfer-policy.d.mts +56 -0
- package/dist/types/transfer-policy.d.mts.map +1 -0
- package/dist/types/transfer-policy.mjs +19 -0
- package/dist/types/transfer-policy.mjs.map +1 -0
- package/dist/utils.d.mts +45 -0
- package/dist/utils.d.mts.map +1 -0
- package/dist/utils.mjs +156 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +31 -20
- package/src/client/kiosk-client.ts +42 -5
- package/src/client/kiosk-transaction.ts +144 -65
- package/src/client/tp-transaction.ts +149 -95
- package/src/constants.ts +19 -24
- package/src/contracts/0x2/accumulator.ts +24 -0
- package/src/contracts/0x2/accumulator_metadata.ts +38 -0
- package/src/contracts/0x2/accumulator_settlement.ts +14 -0
- package/src/contracts/0x2/address.ts +145 -0
- package/src/contracts/0x2/address_alias.ts +92 -0
- package/src/contracts/0x2/authenticator_state.ts +44 -0
- package/src/contracts/0x2/bag.ts +192 -0
- package/src/contracts/0x2/balance.ts +269 -0
- package/src/contracts/0x2/bcs.ts +495 -0
- package/src/contracts/0x2/bls12381.ts +717 -0
- package/src/contracts/0x2/borrow.ts +99 -0
- package/src/contracts/0x2/clock.ts +30 -0
- package/src/contracts/0x2/coin.ts +977 -0
- package/src/contracts/0x2/coin_registry.ts +874 -0
- package/src/contracts/0x2/config.ts +30 -0
- package/src/contracts/0x2/deny_list.ts +55 -0
- package/src/contracts/0x2/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.ts +12 -0
- package/src/contracts/0x2/derived_object.ts +95 -0
- package/src/contracts/0x2/display.ts +258 -0
- package/src/contracts/0x2/dynamic_field.ts +171 -0
- package/src/contracts/0x2/dynamic_object_field.ts +167 -0
- package/src/contracts/0x2/ecdsa_k1.ts +65 -0
- package/src/contracts/0x2/ecdsa_r1.ts +49 -0
- package/src/contracts/0x2/ecvrf.ts +29 -0
- package/src/contracts/0x2/ed25519.ts +25 -0
- package/src/contracts/0x2/event.ts +42 -0
- package/src/contracts/0x2/funds_accumulator.ts +86 -0
- package/src/contracts/0x2/groth16.ts +171 -0
- package/src/contracts/0x2/group_ops.ts +49 -0
- package/src/contracts/0x2/hash.ts +37 -0
- package/src/contracts/0x2/hex.ts +37 -0
- package/src/contracts/0x2/hmac.ts +21 -0
- package/src/contracts/0x2/kiosk.ts +797 -0
- package/src/contracts/0x2/kiosk_extension.ts +270 -0
- package/src/contracts/0x2/linked_table.ts +354 -0
- package/src/contracts/0x2/math.ts +117 -0
- package/src/contracts/0x2/nitro_attestation.ts +186 -0
- package/src/contracts/0x2/object.ts +249 -0
- package/src/contracts/0x2/object_bag.ts +210 -0
- package/src/contracts/0x2/object_table.ts +200 -0
- package/src/contracts/0x2/package.ts +414 -0
- package/src/contracts/0x2/party.ts +37 -0
- package/src/contracts/0x2/pay.ts +153 -0
- package/src/contracts/0x2/poseidon.ts +21 -0
- package/src/contracts/0x2/priority_queue.ts +139 -0
- package/src/contracts/0x2/random.ts +294 -0
- package/src/contracts/0x2/sui.ts +29 -0
- package/src/contracts/0x2/table.ts +200 -0
- package/src/contracts/0x2/table_vec.ts +232 -0
- package/src/contracts/0x2/token.ts +873 -0
- package/src/contracts/0x2/transfer.ts +216 -0
- package/src/contracts/0x2/transfer_policy.ts +400 -0
- package/src/contracts/0x2/tx_context.ts +129 -0
- package/src/contracts/0x2/types.ts +24 -0
- package/src/contracts/0x2/url.ts +77 -0
- package/src/contracts/0x2/vdf.ts +45 -0
- package/src/contracts/0x2/vec_map.ts +401 -0
- package/src/contracts/0x2/vec_set.ts +211 -0
- package/src/contracts/0x2/versioned.ts +153 -0
- package/src/contracts/0x2/zklogin_verified_id.ts +172 -0
- package/src/contracts/0x2/zklogin_verified_issuer.ts +99 -0
- package/src/contracts/kiosk/deps/sui/kiosk.ts +94 -0
- package/src/contracts/kiosk/deps/sui/object.ts +15 -0
- package/src/contracts/kiosk/floor_price_rule.ts +92 -0
- package/src/contracts/kiosk/kiosk_lock_rule.ts +97 -0
- package/src/contracts/kiosk/personal_kiosk.ts +295 -0
- package/src/contracts/kiosk/personal_kiosk_rule.ts +89 -0
- package/src/contracts/kiosk/royalty_rule.ts +144 -0
- package/src/contracts/kiosk/witness_rule.ts +92 -0
- package/src/contracts/utils/index.ts +234 -0
- package/src/query/client-utils.ts +51 -0
- package/src/query/kiosk.ts +128 -100
- package/src/query/transfer-policy.ts +112 -78
- package/src/tx/kiosk.ts +7 -231
- package/src/tx/rules/resolve.ts +97 -48
- package/src/tx/transfer-policy.ts +25 -86
- package/src/types/index.ts +3 -14
- package/src/types/kiosk.ts +10 -12
- package/src/types/transfer-policy.ts +4 -4
- package/src/utils.ts +90 -128
- package/dist/cjs/bcs.d.ts +0 -23
- package/dist/cjs/bcs.js +0 -50
- package/dist/cjs/bcs.js.map +0 -7
- package/dist/cjs/client/kiosk-client.d.ts +0 -76
- package/dist/cjs/client/kiosk-client.js +0 -123
- package/dist/cjs/client/kiosk-client.js.map +0 -7
- package/dist/cjs/client/kiosk-transaction.d.ts +0 -186
- package/dist/cjs/client/kiosk-transaction.js +0 -462
- package/dist/cjs/client/kiosk-transaction.js.map +0 -7
- package/dist/cjs/client/tp-transaction.d.ts +0 -114
- package/dist/cjs/client/tp-transaction.js +0 -307
- package/dist/cjs/client/tp-transaction.js.map +0 -7
- package/dist/cjs/constants.d.ts +0 -31
- package/dist/cjs/constants.js +0 -102
- package/dist/cjs/constants.js.map +0 -7
- package/dist/cjs/index.d.ts +0 -6
- package/dist/cjs/index.js +0 -24
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/package.json +0 -5
- package/dist/cjs/query/kiosk.d.ts +0 -8
- package/dist/cjs/query/kiosk.js +0 -181
- package/dist/cjs/query/kiosk.js.map +0 -7
- package/dist/cjs/query/transfer-policy.d.ts +0 -29
- package/dist/cjs/query/transfer-policy.js +0 -92
- package/dist/cjs/query/transfer-policy.js.map +0 -7
- package/dist/cjs/tx/kiosk.d.ts +0 -71
- package/dist/cjs/tx/kiosk.js +0 -130
- package/dist/cjs/tx/kiosk.js.map +0 -7
- package/dist/cjs/tx/personal-kiosk.d.ts +0 -7
- package/dist/cjs/tx/personal-kiosk.js +0 -38
- package/dist/cjs/tx/personal-kiosk.js.map +0 -7
- package/dist/cjs/tx/rules/attach.d.ts +0 -7
- package/dist/cjs/tx/rules/attach.js +0 -62
- package/dist/cjs/tx/rules/attach.js.map +0 -7
- package/dist/cjs/tx/rules/resolve.d.ts +0 -15
- package/dist/cjs/tx/rules/resolve.js +0 -109
- package/dist/cjs/tx/rules/resolve.js.map +0 -7
- package/dist/cjs/tx/transfer-policy.d.ts +0 -29
- package/dist/cjs/tx/transfer-policy.js +0 -78
- package/dist/cjs/tx/transfer-policy.js.map +0 -7
- package/dist/cjs/types/index.d.ts +0 -27
- package/dist/cjs/types/index.js +0 -33
- package/dist/cjs/types/index.js.map +0 -7
- package/dist/cjs/types/kiosk.d.ts +0 -160
- package/dist/cjs/types/kiosk.js +0 -37
- package/dist/cjs/types/kiosk.js.map +0 -7
- package/dist/cjs/types/transfer-policy.d.ts +0 -53
- package/dist/cjs/types/transfer-policy.js +0 -35
- package/dist/cjs/types/transfer-policy.js.map +0 -7
- package/dist/cjs/utils.d.ts +0 -51
- package/dist/cjs/utils.js +0 -198
- package/dist/cjs/utils.js.map +0 -7
- package/dist/esm/bcs.d.ts +0 -23
- package/dist/esm/bcs.js +0 -35
- package/dist/esm/bcs.js.map +0 -7
- package/dist/esm/client/kiosk-client.d.ts +0 -76
- package/dist/esm/client/kiosk-client.js +0 -114
- package/dist/esm/client/kiosk-client.js.map +0 -7
- package/dist/esm/client/kiosk-transaction.d.ts +0 -186
- package/dist/esm/client/kiosk-transaction.js +0 -432
- package/dist/esm/client/kiosk-transaction.js.map +0 -7
- package/dist/esm/client/tp-transaction.d.ts +0 -114
- package/dist/esm/client/tp-transaction.js +0 -298
- package/dist/esm/client/tp-transaction.js.map +0 -7
- package/dist/esm/constants.d.ts +0 -31
- package/dist/esm/constants.js +0 -87
- package/dist/esm/constants.js.map +0 -7
- package/dist/esm/index.d.ts +0 -6
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/package.json +0 -5
- package/dist/esm/query/kiosk.d.ts +0 -8
- package/dist/esm/query/kiosk.js +0 -169
- package/dist/esm/query/kiosk.js.map +0 -7
- package/dist/esm/query/transfer-policy.d.ts +0 -29
- package/dist/esm/query/transfer-policy.js +0 -76
- package/dist/esm/query/transfer-policy.js.map +0 -7
- package/dist/esm/tx/kiosk.d.ts +0 -71
- package/dist/esm/tx/kiosk.js +0 -110
- package/dist/esm/tx/kiosk.js.map +0 -7
- package/dist/esm/tx/personal-kiosk.d.ts +0 -7
- package/dist/esm/tx/personal-kiosk.js +0 -18
- package/dist/esm/tx/personal-kiosk.js.map +0 -7
- package/dist/esm/tx/rules/attach.d.ts +0 -7
- package/dist/esm/tx/rules/attach.js +0 -42
- package/dist/esm/tx/rules/attach.js.map +0 -7
- package/dist/esm/tx/rules/resolve.d.ts +0 -15
- package/dist/esm/tx/rules/resolve.js +0 -89
- package/dist/esm/tx/rules/resolve.js.map +0 -7
- package/dist/esm/tx/transfer-policy.d.ts +0 -29
- package/dist/esm/tx/transfer-policy.js +0 -58
- package/dist/esm/tx/transfer-policy.js.map +0 -7
- package/dist/esm/types/index.d.ts +0 -27
- package/dist/esm/types/index.js +0 -12
- package/dist/esm/types/index.js.map +0 -7
- package/dist/esm/types/kiosk.d.ts +0 -160
- package/dist/esm/types/kiosk.js +0 -17
- package/dist/esm/types/kiosk.js.map +0 -7
- package/dist/esm/types/transfer-policy.d.ts +0 -53
- package/dist/esm/types/transfer-policy.js +0 -15
- package/dist/esm/types/transfer-policy.js.map +0 -7
- package/dist/esm/utils.d.ts +0 -51
- package/dist/esm/utils.js +0 -183
- package/dist/esm/utils.js.map +0 -7
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/bcs.ts +0 -39
- package/src/tx/personal-kiosk.ts +0 -34
- package/src/tx/rules/attach.ts +0 -73
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
3
|
-
import { normalizeSuiAddress } from "@mysten/sui/utils";
|
|
4
|
-
import { lock } from "../kiosk.js";
|
|
5
|
-
async function resolveRoyaltyRule(params) {
|
|
6
|
-
const {
|
|
7
|
-
kioskClient,
|
|
8
|
-
transaction: tx,
|
|
9
|
-
itemType,
|
|
10
|
-
price,
|
|
11
|
-
packageId,
|
|
12
|
-
transferRequest,
|
|
13
|
-
policyId
|
|
14
|
-
} = params;
|
|
15
|
-
const feeTx = new Transaction();
|
|
16
|
-
feeTx.moveCall({
|
|
17
|
-
target: `${packageId}::royalty_rule::fee_amount`,
|
|
18
|
-
typeArguments: [itemType],
|
|
19
|
-
arguments: [feeTx.object(policyId), feeTx.pure.u64(price || "0")]
|
|
20
|
-
});
|
|
21
|
-
const policyObj = tx.object(policyId);
|
|
22
|
-
const { results } = await kioskClient.client.devInspectTransactionBlock({
|
|
23
|
-
sender: tx.getData().sender || normalizeSuiAddress("0x0"),
|
|
24
|
-
transactionBlock: feeTx
|
|
25
|
-
});
|
|
26
|
-
let amount = null;
|
|
27
|
-
if (results) {
|
|
28
|
-
const returnedAmount = results?.[0].returnValues?.[0]?.[0];
|
|
29
|
-
if (returnedAmount) {
|
|
30
|
-
amount = BigInt(bcs.U64.parse(new Uint8Array(returnedAmount)));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (!amount) {
|
|
34
|
-
[amount] = tx.moveCall({
|
|
35
|
-
target: `${packageId}::royalty_rule::fee_amount`,
|
|
36
|
-
typeArguments: [itemType],
|
|
37
|
-
arguments: [policyObj, tx.pure.u64(price || "0")]
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
const feeCoin = tx.splitCoins(tx.gas, [amount]);
|
|
41
|
-
tx.moveCall({
|
|
42
|
-
target: `${packageId}::royalty_rule::pay`,
|
|
43
|
-
typeArguments: [itemType],
|
|
44
|
-
arguments: [policyObj, transferRequest, feeCoin]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
function resolveKioskLockRule(params) {
|
|
48
|
-
const {
|
|
49
|
-
transaction: tx,
|
|
50
|
-
packageId,
|
|
51
|
-
itemType,
|
|
52
|
-
kiosk,
|
|
53
|
-
kioskCap,
|
|
54
|
-
policyId,
|
|
55
|
-
purchasedItem,
|
|
56
|
-
transferRequest
|
|
57
|
-
} = params;
|
|
58
|
-
if (!kiosk || !kioskCap) throw new Error("Missing Owned Kiosk or Owned Kiosk Cap");
|
|
59
|
-
lock(tx, itemType, kiosk, kioskCap, policyId, purchasedItem);
|
|
60
|
-
tx.moveCall({
|
|
61
|
-
target: `${packageId}::kiosk_lock_rule::prove`,
|
|
62
|
-
typeArguments: [itemType],
|
|
63
|
-
arguments: [transferRequest, tx.object(kiosk)]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function resolvePersonalKioskRule(params) {
|
|
67
|
-
const { transaction: tx, packageId, itemType, kiosk, transferRequest } = params;
|
|
68
|
-
if (!kiosk) throw new Error("Missing owned Kiosk.");
|
|
69
|
-
tx.moveCall({
|
|
70
|
-
target: `${packageId}::personal_kiosk_rule::prove`,
|
|
71
|
-
typeArguments: [itemType],
|
|
72
|
-
arguments: [tx.object(kiosk), transferRequest]
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function resolveFloorPriceRule(params) {
|
|
76
|
-
const { transaction: tx, packageId, itemType, policyId, transferRequest } = params;
|
|
77
|
-
tx.moveCall({
|
|
78
|
-
target: `${packageId}::floor_price_rule::prove`,
|
|
79
|
-
typeArguments: [itemType],
|
|
80
|
-
arguments: [tx.object(policyId), transferRequest]
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
export {
|
|
84
|
-
resolveFloorPriceRule,
|
|
85
|
-
resolveKioskLockRule,
|
|
86
|
-
resolvePersonalKioskRule,
|
|
87
|
-
resolveRoyaltyRule
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=resolve.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/tx/rules/resolve.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs } from '@mysten/sui/bcs';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { normalizeSuiAddress } from '@mysten/sui/utils';\n\nimport type { RuleResolvingParams } from '../../types/index.js';\nimport { lock } from '../kiosk.js';\n\n/**\n * A helper to resolve the royalty rule.\n */\nexport async function resolveRoyaltyRule(params: RuleResolvingParams) {\n\tconst {\n\t\tkioskClient,\n\t\ttransaction: tx,\n\t\titemType,\n\t\tprice,\n\t\tpackageId,\n\t\ttransferRequest,\n\t\tpolicyId,\n\t} = params;\n\n\t// We attempt to resolve the fee amount outside of the PTB so that the split amount is known before the transaction is sent.\n\t// This improves the display of the transaction within the wallet.\n\n\tconst feeTx = new Transaction();\n\n\t// calculates the amount\n\tfeeTx.moveCall({\n\t\ttarget: `${packageId}::royalty_rule::fee_amount`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [feeTx.object(policyId), feeTx.pure.u64(price || '0')],\n\t});\n\n\tconst policyObj = tx.object(policyId);\n\n\tconst { results } = await kioskClient.client.devInspectTransactionBlock({\n\t\tsender: tx.getData().sender || normalizeSuiAddress('0x0'),\n\t\ttransactionBlock: feeTx,\n\t});\n\n\tlet amount: TransactionArgument | bigint | null = null;\n\tif (results) {\n\t\tconst returnedAmount = results?.[0].returnValues?.[0]?.[0];\n\t\tif (returnedAmount) {\n\t\t\tamount = BigInt(bcs.U64.parse(new Uint8Array(returnedAmount as number[])));\n\t\t}\n\t}\n\n\t// We were not able to calculate the amount outside of the transaction, so fall back to resolving it within the PTB\n\tif (!amount) {\n\t\t[amount] = tx.moveCall({\n\t\t\ttarget: `${packageId}::royalty_rule::fee_amount`,\n\t\t\ttypeArguments: [itemType],\n\t\t\targuments: [policyObj, tx.pure.u64(price || '0')],\n\t\t});\n\t}\n\n\t// splits the coin.\n\tconst feeCoin = tx.splitCoins(tx.gas, [amount]);\n\n\t// pays the policy\n\ttx.moveCall({\n\t\ttarget: `${packageId}::royalty_rule::pay`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [policyObj, transferRequest, feeCoin],\n\t});\n}\n\nexport function resolveKioskLockRule(params: RuleResolvingParams) {\n\tconst {\n\t\ttransaction: tx,\n\t\tpackageId,\n\t\titemType,\n\t\tkiosk,\n\t\tkioskCap,\n\t\tpolicyId,\n\t\tpurchasedItem,\n\t\ttransferRequest,\n\t} = params;\n\n\tif (!kiosk || !kioskCap) throw new Error('Missing Owned Kiosk or Owned Kiosk Cap');\n\n\tlock(tx, itemType, kiosk, kioskCap, policyId, purchasedItem);\n\n\t// proves that the item is locked in the kiosk to the TP.\n\ttx.moveCall({\n\t\ttarget: `${packageId}::kiosk_lock_rule::prove`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [transferRequest, tx.object(kiosk)],\n\t});\n}\n\n/**\n * A helper to resolve the personalKioskRule.\n * @param params\n */\nexport function resolvePersonalKioskRule(params: RuleResolvingParams) {\n\tconst { transaction: tx, packageId, itemType, kiosk, transferRequest } = params;\n\n\tif (!kiosk) throw new Error('Missing owned Kiosk.');\n\n\t// proves that the destination kiosk is personal.\n\ttx.moveCall({\n\t\ttarget: `${packageId}::personal_kiosk_rule::prove`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [tx.object(kiosk), transferRequest],\n\t});\n}\n\n/**\n * Resolves the floor price rule.\n */\nexport function resolveFloorPriceRule(params: RuleResolvingParams) {\n\tconst { transaction: tx, packageId, itemType, policyId, transferRequest } = params;\n\n\t// proves that the destination kiosk is personal\n\ttx.moveCall({\n\t\ttarget: `${packageId}::floor_price_rule::prove`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [tx.object(policyId), transferRequest],\n\t});\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,WAAW;AAEpB,SAAS,mBAAmB;AAC5B,SAAS,2BAA2B;AAGpC,SAAS,YAAY;AAKrB,eAAsB,mBAAmB,QAA6B;AACrE,QAAM;AAAA,IACL;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAKJ,QAAM,QAAQ,IAAI,YAAY;AAG9B,QAAM,SAAS;AAAA,IACd,QAAQ,GAAG,SAAS;AAAA,IACpB,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,MAAM,OAAO,QAAQ,GAAG,MAAM,KAAK,IAAI,SAAS,GAAG,CAAC;AAAA,EACjE,CAAC;AAED,QAAM,YAAY,GAAG,OAAO,QAAQ;AAEpC,QAAM,EAAE,QAAQ,IAAI,MAAM,YAAY,OAAO,2BAA2B;AAAA,IACvE,QAAQ,GAAG,QAAQ,EAAE,UAAU,oBAAoB,KAAK;AAAA,IACxD,kBAAkB;AAAA,EACnB,CAAC;AAED,MAAI,SAA8C;AAClD,MAAI,SAAS;AACZ,UAAM,iBAAiB,UAAU,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC;AACzD,QAAI,gBAAgB;AACnB,eAAS,OAAO,IAAI,IAAI,MAAM,IAAI,WAAW,cAA0B,CAAC,CAAC;AAAA,IAC1E;AAAA,EACD;AAGA,MAAI,CAAC,QAAQ;AACZ,KAAC,MAAM,IAAI,GAAG,SAAS;AAAA,MACtB,QAAQ,GAAG,SAAS;AAAA,MACpB,eAAe,CAAC,QAAQ;AAAA,MACxB,WAAW,CAAC,WAAW,GAAG,KAAK,IAAI,SAAS,GAAG,CAAC;AAAA,IACjD,CAAC;AAAA,EACF;AAGA,QAAM,UAAU,GAAG,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;AAG9C,KAAG,SAAS;AAAA,IACX,QAAQ,GAAG,SAAS;AAAA,IACpB,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,WAAW,iBAAiB,OAAO;AAAA,EAChD,CAAC;AACF;AAEO,SAAS,qBAAqB,QAA6B;AACjE,QAAM;AAAA,IACL,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,MAAI,CAAC,SAAS,CAAC,SAAU,OAAM,IAAI,MAAM,wCAAwC;AAEjF,OAAK,IAAI,UAAU,OAAO,UAAU,UAAU,aAAa;AAG3D,KAAG,SAAS;AAAA,IACX,QAAQ,GAAG,SAAS;AAAA,IACpB,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,iBAAiB,GAAG,OAAO,KAAK,CAAC;AAAA,EAC9C,CAAC;AACF;AAMO,SAAS,yBAAyB,QAA6B;AACrE,QAAM,EAAE,aAAa,IAAI,WAAW,UAAU,OAAO,gBAAgB,IAAI;AAEzE,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,sBAAsB;AAGlD,KAAG,SAAS;AAAA,IACX,QAAQ,GAAG,SAAS;AAAA,IACpB,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,GAAG,OAAO,KAAK,GAAG,eAAe;AAAA,EAC9C,CAAC;AACF;AAKO,SAAS,sBAAsB,QAA6B;AAClE,QAAM,EAAE,aAAa,IAAI,WAAW,UAAU,UAAU,gBAAgB,IAAI;AAG5E,KAAG,SAAS;AAAA,IACX,QAAQ,GAAG,SAAS;AAAA,IACpB,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,GAAG,OAAO,QAAQ,GAAG,eAAe;AAAA,EACjD,CAAC;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Transaction, TransactionArgument, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
2
|
-
import type { ObjectArgument } from '../types/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Call the `transfer_policy::new` function to create a new transfer policy.
|
|
5
|
-
* Returns `transferPolicyCap`
|
|
6
|
-
*/
|
|
7
|
-
export declare function createTransferPolicy(tx: Transaction, itemType: string, publisher: ObjectArgument): TransactionObjectArgument;
|
|
8
|
-
/**
|
|
9
|
-
* Creates a transfer Policy and returns both the Policy and the Cap.
|
|
10
|
-
* Used if we want to use the policy before making it a shared object.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createTransferPolicyWithoutSharing(tx: Transaction, itemType: string, publisher: ObjectArgument): [TransactionObjectArgument, TransactionObjectArgument];
|
|
13
|
-
/**
|
|
14
|
-
* Converts Transfer Policy to a shared object.
|
|
15
|
-
*/
|
|
16
|
-
export declare function shareTransferPolicy(tx: Transaction, itemType: string, transferPolicy: TransactionObjectArgument): void;
|
|
17
|
-
/**
|
|
18
|
-
* Call the `transfer_policy::withdraw` function to withdraw profits from a transfer policy.
|
|
19
|
-
*/
|
|
20
|
-
export declare function withdrawFromPolicy(tx: Transaction, itemType: string, policy: ObjectArgument, policyCap: ObjectArgument, amount?: string | bigint | null): TransactionObjectArgument;
|
|
21
|
-
/**
|
|
22
|
-
* Call the `transfer_policy::confirm_request` function to unblock the
|
|
23
|
-
* transaction.
|
|
24
|
-
*/
|
|
25
|
-
export declare function confirmRequest(tx: Transaction, itemType: string, policy: ObjectArgument, request: TransactionArgument): void;
|
|
26
|
-
/**
|
|
27
|
-
* Calls the `transfer_policy::remove_rule` function to remove a Rule from the transfer policy's ruleset.
|
|
28
|
-
*/
|
|
29
|
-
export declare function removeTransferPolicyRule(tx: Transaction, itemType: string, ruleType: string, configType: string, policy: ObjectArgument, policyCap: ObjectArgument): void;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
-
import { TRANSFER_POLICY_MODULE, TRANSFER_POLICY_TYPE } from "../types/index.js";
|
|
3
|
-
function createTransferPolicy(tx, itemType, publisher) {
|
|
4
|
-
const [transferPolicy, transferPolicyCap] = createTransferPolicyWithoutSharing(
|
|
5
|
-
tx,
|
|
6
|
-
itemType,
|
|
7
|
-
publisher
|
|
8
|
-
);
|
|
9
|
-
shareTransferPolicy(tx, itemType, transferPolicy);
|
|
10
|
-
return transferPolicyCap;
|
|
11
|
-
}
|
|
12
|
-
function createTransferPolicyWithoutSharing(tx, itemType, publisher) {
|
|
13
|
-
const [transferPolicy, transferPolicyCap] = tx.moveCall({
|
|
14
|
-
target: `${TRANSFER_POLICY_MODULE}::new`,
|
|
15
|
-
typeArguments: [itemType],
|
|
16
|
-
arguments: [tx.object(publisher)]
|
|
17
|
-
});
|
|
18
|
-
return [transferPolicy, transferPolicyCap];
|
|
19
|
-
}
|
|
20
|
-
function shareTransferPolicy(tx, itemType, transferPolicy) {
|
|
21
|
-
tx.moveCall({
|
|
22
|
-
target: `0x2::transfer::public_share_object`,
|
|
23
|
-
typeArguments: [`${TRANSFER_POLICY_TYPE}<${itemType}>`],
|
|
24
|
-
arguments: [transferPolicy]
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function withdrawFromPolicy(tx, itemType, policy, policyCap, amount) {
|
|
28
|
-
const amountArg = bcs.option(bcs.u64()).serialize(amount);
|
|
29
|
-
const [profits] = tx.moveCall({
|
|
30
|
-
target: `${TRANSFER_POLICY_MODULE}::withdraw`,
|
|
31
|
-
typeArguments: [itemType],
|
|
32
|
-
arguments: [tx.object(policy), tx.object(policyCap), amountArg]
|
|
33
|
-
});
|
|
34
|
-
return profits;
|
|
35
|
-
}
|
|
36
|
-
function confirmRequest(tx, itemType, policy, request) {
|
|
37
|
-
tx.moveCall({
|
|
38
|
-
target: `${TRANSFER_POLICY_MODULE}::confirm_request`,
|
|
39
|
-
typeArguments: [itemType],
|
|
40
|
-
arguments: [tx.object(policy), request]
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function removeTransferPolicyRule(tx, itemType, ruleType, configType, policy, policyCap) {
|
|
44
|
-
tx.moveCall({
|
|
45
|
-
target: `${TRANSFER_POLICY_MODULE}::remove_rule`,
|
|
46
|
-
typeArguments: [itemType, ruleType, configType],
|
|
47
|
-
arguments: [tx.object(policy), tx.object(policyCap)]
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
confirmRequest,
|
|
52
|
-
createTransferPolicy,
|
|
53
|
-
createTransferPolicyWithoutSharing,
|
|
54
|
-
removeTransferPolicyRule,
|
|
55
|
-
shareTransferPolicy,
|
|
56
|
-
withdrawFromPolicy
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=transfer-policy.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/tx/transfer-policy.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs } from '@mysten/sui/bcs';\nimport type {\n\tTransaction,\n\tTransactionArgument,\n\tTransactionObjectArgument,\n} from '@mysten/sui/transactions';\n\nimport type { ObjectArgument } from '../types/index.js';\nimport { TRANSFER_POLICY_MODULE, TRANSFER_POLICY_TYPE } from '../types/index.js';\n\n/**\n * Call the `transfer_policy::new` function to create a new transfer policy.\n * Returns `transferPolicyCap`\n */\nexport function createTransferPolicy(\n\ttx: Transaction,\n\titemType: string,\n\tpublisher: ObjectArgument,\n): TransactionObjectArgument {\n\tconst [transferPolicy, transferPolicyCap] = createTransferPolicyWithoutSharing(\n\t\ttx,\n\t\titemType,\n\t\tpublisher,\n\t);\n\n\tshareTransferPolicy(tx, itemType, transferPolicy);\n\n\treturn transferPolicyCap;\n}\n\n/**\n * Creates a transfer Policy and returns both the Policy and the Cap.\n * Used if we want to use the policy before making it a shared object.\n */\nexport function createTransferPolicyWithoutSharing(\n\ttx: Transaction,\n\titemType: string,\n\tpublisher: ObjectArgument,\n): [TransactionObjectArgument, TransactionObjectArgument] {\n\tconst [transferPolicy, transferPolicyCap] = tx.moveCall({\n\t\ttarget: `${TRANSFER_POLICY_MODULE}::new`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [tx.object(publisher)],\n\t});\n\n\treturn [transferPolicy, transferPolicyCap];\n}\n/**\n * Converts Transfer Policy to a shared object.\n */\nexport function shareTransferPolicy(\n\ttx: Transaction,\n\titemType: string,\n\ttransferPolicy: TransactionObjectArgument,\n) {\n\ttx.moveCall({\n\t\ttarget: `0x2::transfer::public_share_object`,\n\t\ttypeArguments: [`${TRANSFER_POLICY_TYPE}<${itemType}>`],\n\t\targuments: [transferPolicy],\n\t});\n}\n\n/**\n * Call the `transfer_policy::withdraw` function to withdraw profits from a transfer policy.\n */\nexport function withdrawFromPolicy(\n\ttx: Transaction,\n\titemType: string,\n\tpolicy: ObjectArgument,\n\tpolicyCap: ObjectArgument,\n\tamount?: string | bigint | null,\n): TransactionObjectArgument {\n\tconst amountArg = bcs.option(bcs.u64()).serialize(amount);\n\n\tconst [profits] = tx.moveCall({\n\t\ttarget: `${TRANSFER_POLICY_MODULE}::withdraw`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [tx.object(policy), tx.object(policyCap), amountArg],\n\t});\n\n\treturn profits;\n}\n\n/**\n * Call the `transfer_policy::confirm_request` function to unblock the\n * transaction.\n */\nexport function confirmRequest(\n\ttx: Transaction,\n\titemType: string,\n\tpolicy: ObjectArgument,\n\trequest: TransactionArgument,\n): void {\n\ttx.moveCall({\n\t\ttarget: `${TRANSFER_POLICY_MODULE}::confirm_request`,\n\t\ttypeArguments: [itemType],\n\t\targuments: [tx.object(policy), request],\n\t});\n}\n\n/**\n * Calls the `transfer_policy::remove_rule` function to remove a Rule from the transfer policy's ruleset.\n */\nexport function removeTransferPolicyRule(\n\ttx: Transaction,\n\titemType: string,\n\truleType: string,\n\tconfigType: string,\n\tpolicy: ObjectArgument,\n\tpolicyCap: ObjectArgument,\n): void {\n\ttx.moveCall({\n\t\ttarget: `${TRANSFER_POLICY_MODULE}::remove_rule`,\n\t\ttypeArguments: [itemType, ruleType, configType],\n\t\targuments: [tx.object(policy), tx.object(policyCap)],\n\t});\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,WAAW;AAQpB,SAAS,wBAAwB,4BAA4B;AAMtD,SAAS,qBACf,IACA,UACA,WAC4B;AAC5B,QAAM,CAAC,gBAAgB,iBAAiB,IAAI;AAAA,IAC3C;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,sBAAoB,IAAI,UAAU,cAAc;AAEhD,SAAO;AACR;AAMO,SAAS,mCACf,IACA,UACA,WACyD;AACzD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,GAAG,SAAS;AAAA,IACvD,QAAQ,GAAG,sBAAsB;AAAA,IACjC,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,GAAG,OAAO,SAAS,CAAC;AAAA,EACjC,CAAC;AAED,SAAO,CAAC,gBAAgB,iBAAiB;AAC1C;AAIO,SAAS,oBACf,IACA,UACA,gBACC;AACD,KAAG,SAAS;AAAA,IACX,QAAQ;AAAA,IACR,eAAe,CAAC,GAAG,oBAAoB,IAAI,QAAQ,GAAG;AAAA,IACtD,WAAW,CAAC,cAAc;AAAA,EAC3B,CAAC;AACF;AAKO,SAAS,mBACf,IACA,UACA,QACA,WACA,QAC4B;AAC5B,QAAM,YAAY,IAAI,OAAO,IAAI,IAAI,CAAC,EAAE,UAAU,MAAM;AAExD,QAAM,CAAC,OAAO,IAAI,GAAG,SAAS;AAAA,IAC7B,QAAQ,GAAG,sBAAsB;AAAA,IACjC,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,GAAG,OAAO,MAAM,GAAG,GAAG,OAAO,SAAS,GAAG,SAAS;AAAA,EAC/D,CAAC;AAED,SAAO;AACR;AAMO,SAAS,eACf,IACA,UACA,QACA,SACO;AACP,KAAG,SAAS;AAAA,IACX,QAAQ,GAAG,sBAAsB;AAAA,IACjC,eAAe,CAAC,QAAQ;AAAA,IACxB,WAAW,CAAC,GAAG,OAAO,MAAM,GAAG,OAAO;AAAA,EACvC,CAAC;AACF;AAKO,SAAS,yBACf,IACA,UACA,UACA,YACA,QACA,WACO;AACP,KAAG,SAAS;AAAA,IACX,QAAQ,GAAG,sBAAsB;AAAA,IACjC,eAAe,CAAC,UAAU,UAAU,UAAU;AAAA,IAC9C,WAAW,CAAC,GAAG,OAAO,MAAM,GAAG,GAAG,OAAO,SAAS,CAAC;AAAA,EACpD,CAAC;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { SuiClient } from '@mysten/sui/client';
|
|
2
|
-
import type { TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
3
|
-
import type { BaseRulePackageIds } from '../constants.js';
|
|
4
|
-
export * from './kiosk.js';
|
|
5
|
-
export * from './transfer-policy.js';
|
|
6
|
-
/**
|
|
7
|
-
* A valid argument for any of the Kiosk functions.
|
|
8
|
-
*/
|
|
9
|
-
export type ObjectArgument = string | TransactionObjectArgument;
|
|
10
|
-
/**
|
|
11
|
-
* A Network selector.
|
|
12
|
-
* Kiosk SDK supports mainnet & testnet.
|
|
13
|
-
* Pass `custom` for any other network (devnet, localnet).
|
|
14
|
-
*/
|
|
15
|
-
export declare enum Network {
|
|
16
|
-
MAINNET = "mainnet",
|
|
17
|
-
TESTNET = "testnet",
|
|
18
|
-
CUSTOM = "custom"
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* The Client Options for Both KioskClient & TransferPolicyManager.
|
|
22
|
-
*/
|
|
23
|
-
export type KioskClientOptions = {
|
|
24
|
-
client: SuiClient;
|
|
25
|
-
network: Network;
|
|
26
|
-
packageIds?: BaseRulePackageIds;
|
|
27
|
-
};
|
package/dist/esm/types/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from "./kiosk.js";
|
|
2
|
-
export * from "./transfer-policy.js";
|
|
3
|
-
var Network = /* @__PURE__ */ ((Network2) => {
|
|
4
|
-
Network2["MAINNET"] = "mainnet";
|
|
5
|
-
Network2["TESTNET"] = "testnet";
|
|
6
|
-
Network2["CUSTOM"] = "custom";
|
|
7
|
-
return Network2;
|
|
8
|
-
})(Network || {});
|
|
9
|
-
export {
|
|
10
|
-
Network
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { SuiClient } from '@mysten/sui/client';\nimport type { TransactionObjectArgument } from '@mysten/sui/transactions';\n\nimport type { BaseRulePackageIds } from '../constants.js';\n\nexport * from './kiosk.js';\nexport * from './transfer-policy.js';\n\n/**\n * A valid argument for any of the Kiosk functions.\n */\nexport type ObjectArgument = string | TransactionObjectArgument;\n\n/**\n * A Network selector.\n * Kiosk SDK supports mainnet & testnet.\n * Pass `custom` for any other network (devnet, localnet).\n */\nexport enum Network {\n\tMAINNET = 'mainnet',\n\tTESTNET = 'testnet',\n\tCUSTOM = 'custom',\n}\n\n/**\n * The Client Options for Both KioskClient & TransferPolicyManager.\n */\nexport type KioskClientOptions = {\n\tclient: SuiClient;\n\tnetwork: Network;\n\tpackageIds?: BaseRulePackageIds;\n};\n"],
|
|
5
|
-
"mappings": "AAQA,cAAc;AACd,cAAc;AAYP,IAAK,UAAL,kBAAKA,aAAL;AACN,EAAAA,SAAA,aAAU;AACV,EAAAA,SAAA,aAAU;AACV,EAAAA,SAAA,YAAS;AAHE,SAAAA;AAAA,GAAA;",
|
|
6
|
-
"names": ["Network"]
|
|
7
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import type { PaginatedObjectsResponse, SuiObjectData, SuiObjectDataOptions } from '@mysten/sui/client';
|
|
2
|
-
import type { TransactionArgument } from '@mysten/sui/transactions';
|
|
3
|
-
import type { ObjectArgument } from './index.js';
|
|
4
|
-
/** The Kiosk module. */
|
|
5
|
-
export declare const KIOSK_MODULE = "0x2::kiosk";
|
|
6
|
-
/** The Kiosk type. */
|
|
7
|
-
export declare const KIOSK_TYPE = "0x2::kiosk::Kiosk";
|
|
8
|
-
/** The Kiosk Owner Cap Type */
|
|
9
|
-
export declare const KIOSK_OWNER_CAP = "0x2::kiosk::KioskOwnerCap";
|
|
10
|
-
/** The Kiosk Item Type */
|
|
11
|
-
export declare const KIOSK_ITEM = "0x2::kiosk::Item";
|
|
12
|
-
/** The Kiosk Listing Type */
|
|
13
|
-
export declare const KIOSK_LISTING = "0x2::kiosk::Listing";
|
|
14
|
-
/** The Kiosk Lock Type */
|
|
15
|
-
export declare const KIOSK_LOCK = "0x2::kiosk::Lock";
|
|
16
|
-
/** The Kiosk PurchaseCap type */
|
|
17
|
-
export declare const KIOSK_PURCHASE_CAP = "0x2::kiosk::PurchaseCap";
|
|
18
|
-
/**
|
|
19
|
-
* The Kiosk object fields (for BCS queries).
|
|
20
|
-
*/
|
|
21
|
-
export type Kiosk = {
|
|
22
|
-
id: string;
|
|
23
|
-
profits: string;
|
|
24
|
-
owner: string;
|
|
25
|
-
itemCount: number;
|
|
26
|
-
allowExtensions: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* PurchaseCap object fields (for BCS queries).
|
|
30
|
-
*/
|
|
31
|
-
export type PurchaseCap = {
|
|
32
|
-
id: string;
|
|
33
|
-
kioskId: string;
|
|
34
|
-
itemId: string;
|
|
35
|
-
minPrice: string;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* The response type of a successful purchase flow.
|
|
39
|
-
* Returns the item, and a `canTransfer` param.
|
|
40
|
-
*/
|
|
41
|
-
export type PurchaseAndResolvePoliciesResponse = {
|
|
42
|
-
item: TransactionArgument;
|
|
43
|
-
canTransfer: boolean;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Optional parameters for `purchaseAndResolvePolicies` flow.
|
|
47
|
-
* This gives us the chance to extend the function in further releases
|
|
48
|
-
* without introducing more breaking changes.
|
|
49
|
-
*/
|
|
50
|
-
export type PurchaseOptionalParams = {
|
|
51
|
-
ownedKiosk?: ObjectArgument;
|
|
52
|
-
ownedKioskCap?: ObjectArgument;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* A dynamic field `Listing { ID, isExclusive }` attached to the Kiosk.
|
|
56
|
-
* Holds a `u64` value - the price of the item.
|
|
57
|
-
*/
|
|
58
|
-
export type KioskListing = {
|
|
59
|
-
/** The ID of the Item */
|
|
60
|
-
objectId: string;
|
|
61
|
-
/**
|
|
62
|
-
* Whether or not there's a `PurchaseCap` issued. `true` means that
|
|
63
|
-
* the listing is controlled by some logic and can't be purchased directly.
|
|
64
|
-
*
|
|
65
|
-
* TODO: consider renaming the field for better indication.
|
|
66
|
-
*/
|
|
67
|
-
isExclusive: boolean;
|
|
68
|
-
/** The ID of the listing */
|
|
69
|
-
listingId: string;
|
|
70
|
-
price?: string;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* A dynamic field `Item { ID }` attached to the Kiosk.
|
|
74
|
-
* Holds an Item `T`. The type of the item is known upfront.
|
|
75
|
-
*/
|
|
76
|
-
export type KioskItem = {
|
|
77
|
-
/** The ID of the Item */
|
|
78
|
-
objectId: string;
|
|
79
|
-
/** The type of the Item */
|
|
80
|
-
type: string;
|
|
81
|
-
/** Whether the item is Locked (there must be a `Lock` Dynamic Field) */
|
|
82
|
-
isLocked: boolean;
|
|
83
|
-
/** Optional listing */
|
|
84
|
-
listing?: KioskListing;
|
|
85
|
-
/** The ID of the kiosk the item is placed in */
|
|
86
|
-
kioskId: string;
|
|
87
|
-
/** Optional Kiosk Data */
|
|
88
|
-
data?: SuiObjectData;
|
|
89
|
-
};
|
|
90
|
-
/** The overview type returned from `getKiosk` */
|
|
91
|
-
export type KioskExtensionOverview = {
|
|
92
|
-
/** The ID of the extension's DF */
|
|
93
|
-
objectId: string;
|
|
94
|
-
/** The inner type of the Extension */
|
|
95
|
-
type: string;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Hold the KioskExtension data
|
|
99
|
-
*/
|
|
100
|
-
export type KioskExtension = KioskExtensionOverview & {
|
|
101
|
-
/** These fields are only there if we have `withExtensions` flag */
|
|
102
|
-
isEnabled: boolean;
|
|
103
|
-
permissions: string;
|
|
104
|
-
storageId: string;
|
|
105
|
-
storageSize: number;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Aggregated data from the Kiosk.
|
|
109
|
-
*/
|
|
110
|
-
export type KioskData = {
|
|
111
|
-
items: KioskItem[];
|
|
112
|
-
itemIds: string[];
|
|
113
|
-
listingIds: string[];
|
|
114
|
-
kiosk?: Kiosk;
|
|
115
|
-
extensions: KioskExtensionOverview[];
|
|
116
|
-
};
|
|
117
|
-
export type PagedKioskData = {
|
|
118
|
-
data: KioskData;
|
|
119
|
-
nextCursor: string | null | undefined;
|
|
120
|
-
hasNextPage: boolean;
|
|
121
|
-
};
|
|
122
|
-
export type FetchKioskOptions = {
|
|
123
|
-
/** Include the base kiosk object, which includes the profits, the owner and the base fields. */
|
|
124
|
-
withKioskFields?: boolean;
|
|
125
|
-
/** Include the listing prices. */
|
|
126
|
-
withListingPrices?: boolean;
|
|
127
|
-
/** Include the objects for the Items in the kiosk. Defaults to `display` only. */
|
|
128
|
-
withObjects?: boolean;
|
|
129
|
-
/** Pass the data options for the objects, when fetching, in case you want to query other details. */
|
|
130
|
-
objectOptions?: SuiObjectDataOptions;
|
|
131
|
-
};
|
|
132
|
-
export type OwnedKiosks = {
|
|
133
|
-
kioskOwnerCaps: KioskOwnerCap[];
|
|
134
|
-
kioskIds: string[];
|
|
135
|
-
} & Omit<PaginatedObjectsResponse, 'data'>;
|
|
136
|
-
export type KioskOwnerCap = {
|
|
137
|
-
isPersonal?: boolean;
|
|
138
|
-
objectId: string;
|
|
139
|
-
kioskId: string;
|
|
140
|
-
digest: string;
|
|
141
|
-
version: string;
|
|
142
|
-
};
|
|
143
|
-
export type PurchaseOptions = {
|
|
144
|
-
extraArgs?: Record<string, any>;
|
|
145
|
-
};
|
|
146
|
-
export type ItemId = {
|
|
147
|
-
itemType: string;
|
|
148
|
-
itemId: string;
|
|
149
|
-
};
|
|
150
|
-
export type ItemReference = {
|
|
151
|
-
itemType: string;
|
|
152
|
-
item: ObjectArgument;
|
|
153
|
-
};
|
|
154
|
-
export type ItemValue = {
|
|
155
|
-
itemType: string;
|
|
156
|
-
item: TransactionArgument;
|
|
157
|
-
};
|
|
158
|
-
export type Price = {
|
|
159
|
-
price: string | bigint;
|
|
160
|
-
};
|
package/dist/esm/types/kiosk.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const KIOSK_MODULE = "0x2::kiosk";
|
|
2
|
-
const KIOSK_TYPE = `${KIOSK_MODULE}::Kiosk`;
|
|
3
|
-
const KIOSK_OWNER_CAP = `${KIOSK_MODULE}::KioskOwnerCap`;
|
|
4
|
-
const KIOSK_ITEM = `${KIOSK_MODULE}::Item`;
|
|
5
|
-
const KIOSK_LISTING = `${KIOSK_MODULE}::Listing`;
|
|
6
|
-
const KIOSK_LOCK = `${KIOSK_MODULE}::Lock`;
|
|
7
|
-
const KIOSK_PURCHASE_CAP = `${KIOSK_MODULE}::PurchaseCap`;
|
|
8
|
-
export {
|
|
9
|
-
KIOSK_ITEM,
|
|
10
|
-
KIOSK_LISTING,
|
|
11
|
-
KIOSK_LOCK,
|
|
12
|
-
KIOSK_MODULE,
|
|
13
|
-
KIOSK_OWNER_CAP,
|
|
14
|
-
KIOSK_PURCHASE_CAP,
|
|
15
|
-
KIOSK_TYPE
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=kiosk.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/kiosk.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tPaginatedObjectsResponse,\n\tSuiObjectData,\n\tSuiObjectDataOptions,\n} from '@mysten/sui/client';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\n\nimport type { ObjectArgument } from './index.js';\n\n/** The Kiosk module. */\nexport const KIOSK_MODULE = '0x2::kiosk';\n\n/** The Kiosk type. */\nexport const KIOSK_TYPE = `${KIOSK_MODULE}::Kiosk`;\n\n/** The Kiosk Owner Cap Type */\nexport const KIOSK_OWNER_CAP = `${KIOSK_MODULE}::KioskOwnerCap`;\n\n/** The Kiosk Item Type */\nexport const KIOSK_ITEM = `${KIOSK_MODULE}::Item`;\n\n/** The Kiosk Listing Type */\nexport const KIOSK_LISTING = `${KIOSK_MODULE}::Listing`;\n\n/** The Kiosk Lock Type */\nexport const KIOSK_LOCK = `${KIOSK_MODULE}::Lock`;\n\n/** The Kiosk PurchaseCap type */\nexport const KIOSK_PURCHASE_CAP = `${KIOSK_MODULE}::PurchaseCap`;\n\n/**\n * The Kiosk object fields (for BCS queries).\n */\nexport type Kiosk = {\n\tid: string;\n\tprofits: string;\n\towner: string;\n\titemCount: number;\n\tallowExtensions: boolean;\n};\n\n/**\n * PurchaseCap object fields (for BCS queries).\n */\nexport type PurchaseCap = {\n\tid: string;\n\tkioskId: string;\n\titemId: string;\n\tminPrice: string;\n};\n\n/**\n * The response type of a successful purchase flow.\n * Returns the item, and a `canTransfer` param.\n */\nexport type PurchaseAndResolvePoliciesResponse = {\n\titem: TransactionArgument;\n\tcanTransfer: boolean;\n};\n\n/**\n * Optional parameters for `purchaseAndResolvePolicies` flow.\n * This gives us the chance to extend the function in further releases\n * without introducing more breaking changes.\n */\nexport type PurchaseOptionalParams = {\n\townedKiosk?: ObjectArgument;\n\townedKioskCap?: ObjectArgument;\n};\n\n/**\n * A dynamic field `Listing { ID, isExclusive }` attached to the Kiosk.\n * Holds a `u64` value - the price of the item.\n */\nexport type KioskListing = {\n\t/** The ID of the Item */\n\tobjectId: string;\n\t/**\n\t * Whether or not there's a `PurchaseCap` issued. `true` means that\n\t * the listing is controlled by some logic and can't be purchased directly.\n\t *\n\t * TODO: consider renaming the field for better indication.\n\t */\n\tisExclusive: boolean;\n\t/** The ID of the listing */\n\tlistingId: string;\n\tprice?: string;\n};\n\n/**\n * A dynamic field `Item { ID }` attached to the Kiosk.\n * Holds an Item `T`. The type of the item is known upfront.\n */\nexport type KioskItem = {\n\t/** The ID of the Item */\n\tobjectId: string;\n\t/** The type of the Item */\n\ttype: string;\n\t/** Whether the item is Locked (there must be a `Lock` Dynamic Field) */\n\tisLocked: boolean;\n\t/** Optional listing */\n\tlisting?: KioskListing;\n\t/** The ID of the kiosk the item is placed in */\n\tkioskId: string;\n\t/** Optional Kiosk Data */\n\tdata?: SuiObjectData;\n};\n\n/** The overview type returned from `getKiosk` */\nexport type KioskExtensionOverview = {\n\t/** The ID of the extension's DF */\n\tobjectId: string;\n\t/** The inner type of the Extension */\n\ttype: string;\n};\n/**\n * Hold the KioskExtension data\n */\nexport type KioskExtension = KioskExtensionOverview & {\n\t/** These fields are only there if we have `withExtensions` flag */\n\tisEnabled: boolean;\n\tpermissions: string;\n\tstorageId: string;\n\tstorageSize: number;\n};\n\n/**\n * Aggregated data from the Kiosk.\n */\nexport type KioskData = {\n\titems: KioskItem[];\n\titemIds: string[];\n\tlistingIds: string[];\n\tkiosk?: Kiosk;\n\textensions: KioskExtensionOverview[]; // type will be defined on later versions of the SDK.\n};\n\nexport type PagedKioskData = {\n\tdata: KioskData;\n\tnextCursor: string | null | undefined;\n\thasNextPage: boolean;\n};\n\nexport type FetchKioskOptions = {\n\t/** Include the base kiosk object, which includes the profits, the owner and the base fields. */\n\twithKioskFields?: boolean;\n\t/** Include the listing prices. */\n\twithListingPrices?: boolean;\n\t/** Include the objects for the Items in the kiosk. Defaults to `display` only. */\n\twithObjects?: boolean;\n\t/** Pass the data options for the objects, when fetching, in case you want to query other details. */\n\tobjectOptions?: SuiObjectDataOptions;\n};\n\nexport type OwnedKiosks = {\n\tkioskOwnerCaps: KioskOwnerCap[];\n\tkioskIds: string[];\n} & Omit<PaginatedObjectsResponse, 'data'>;\n\nexport type KioskOwnerCap = {\n\tisPersonal?: boolean;\n\tobjectId: string;\n\tkioskId: string;\n\tdigest: string;\n\tversion: string;\n};\n\nexport type PurchaseOptions = {\n\textraArgs?: Record<string, any>;\n};\n\nexport type ItemId = { itemType: string; itemId: string };\nexport type ItemReference = { itemType: string; item: ObjectArgument };\nexport type ItemValue = { itemType: string; item: TransactionArgument };\nexport type Price = { price: string | bigint };\n"],
|
|
5
|
-
"mappings": "AAaO,MAAM,eAAe;AAGrB,MAAM,aAAa,GAAG,YAAY;AAGlC,MAAM,kBAAkB,GAAG,YAAY;AAGvC,MAAM,aAAa,GAAG,YAAY;AAGlC,MAAM,gBAAgB,GAAG,YAAY;AAGrC,MAAM,aAAa,GAAG,YAAY;AAGlC,MAAM,qBAAqB,GAAG,YAAY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { ObjectOwner } from '@mysten/sui/client';
|
|
2
|
-
import type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
3
|
-
import type { KioskClient } from '../client/kiosk-client.js';
|
|
4
|
-
import type { ObjectArgument } from './index.js';
|
|
5
|
-
/** The Transfer Policy module. */
|
|
6
|
-
export declare const TRANSFER_POLICY_MODULE = "0x2::transfer_policy";
|
|
7
|
-
/** Name of the event emitted when a TransferPolicy for T is created. */
|
|
8
|
-
export declare const TRANSFER_POLICY_CREATED_EVENT = "0x2::transfer_policy::TransferPolicyCreated";
|
|
9
|
-
/** The Transfer Policy Type */
|
|
10
|
-
export declare const TRANSFER_POLICY_TYPE = "0x2::transfer_policy::TransferPolicy";
|
|
11
|
-
/** The Transfer Policy Cap Type */
|
|
12
|
-
export declare const TRANSFER_POLICY_CAP_TYPE = "0x2::transfer_policy::TransferPolicyCap";
|
|
13
|
-
/** The Kiosk Lock Rule */
|
|
14
|
-
export declare const KIOSK_LOCK_RULE = "kiosk_lock_rule::Rule";
|
|
15
|
-
/** The Royalty rule */
|
|
16
|
-
export declare const ROYALTY_RULE = "royalty_rule::Rule";
|
|
17
|
-
/**
|
|
18
|
-
* The Transfer Policy Cap in a consumable way.
|
|
19
|
-
*/
|
|
20
|
-
export type TransferPolicyCap = {
|
|
21
|
-
policyId: string;
|
|
22
|
-
policyCapId: string;
|
|
23
|
-
type: string;
|
|
24
|
-
};
|
|
25
|
-
/** The `TransferPolicy` object */
|
|
26
|
-
export type TransferPolicy = {
|
|
27
|
-
id: string;
|
|
28
|
-
type: string;
|
|
29
|
-
balance: string;
|
|
30
|
-
rules: string[];
|
|
31
|
-
owner: ObjectOwner;
|
|
32
|
-
};
|
|
33
|
-
/** Event emitted when a TransferPolicy is created. */
|
|
34
|
-
export type TransferPolicyCreated = {
|
|
35
|
-
id: string;
|
|
36
|
-
};
|
|
37
|
-
export type RuleResolvingParams = {
|
|
38
|
-
transaction: Transaction;
|
|
39
|
-
/** @deprecated use transaction instead */
|
|
40
|
-
transactionBlock: Transaction;
|
|
41
|
-
itemType: string;
|
|
42
|
-
itemId: string;
|
|
43
|
-
price: string;
|
|
44
|
-
policyId: ObjectArgument;
|
|
45
|
-
sellerKiosk: ObjectArgument;
|
|
46
|
-
kiosk: ObjectArgument;
|
|
47
|
-
kioskCap: ObjectArgument;
|
|
48
|
-
transferRequest: TransactionObjectArgument;
|
|
49
|
-
purchasedItem: TransactionObjectArgument;
|
|
50
|
-
packageId: string;
|
|
51
|
-
extraArgs: Record<string, any>;
|
|
52
|
-
kioskClient: KioskClient;
|
|
53
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const TRANSFER_POLICY_MODULE = "0x2::transfer_policy";
|
|
2
|
-
const TRANSFER_POLICY_CREATED_EVENT = `${TRANSFER_POLICY_MODULE}::TransferPolicyCreated`;
|
|
3
|
-
const TRANSFER_POLICY_TYPE = `${TRANSFER_POLICY_MODULE}::TransferPolicy`;
|
|
4
|
-
const TRANSFER_POLICY_CAP_TYPE = `${TRANSFER_POLICY_MODULE}::TransferPolicyCap`;
|
|
5
|
-
const KIOSK_LOCK_RULE = "kiosk_lock_rule::Rule";
|
|
6
|
-
const ROYALTY_RULE = "royalty_rule::Rule";
|
|
7
|
-
export {
|
|
8
|
-
KIOSK_LOCK_RULE,
|
|
9
|
-
ROYALTY_RULE,
|
|
10
|
-
TRANSFER_POLICY_CAP_TYPE,
|
|
11
|
-
TRANSFER_POLICY_CREATED_EVENT,
|
|
12
|
-
TRANSFER_POLICY_MODULE,
|
|
13
|
-
TRANSFER_POLICY_TYPE
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=transfer-policy.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/transfer-policy.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ObjectOwner } from '@mysten/sui/client';\nimport type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';\n\nimport type { KioskClient } from '../client/kiosk-client.js';\nimport type { ObjectArgument } from './index.js';\n\n/** The Transfer Policy module. */\nexport const TRANSFER_POLICY_MODULE = '0x2::transfer_policy';\n\n/** Name of the event emitted when a TransferPolicy for T is created. */\nexport const TRANSFER_POLICY_CREATED_EVENT = `${TRANSFER_POLICY_MODULE}::TransferPolicyCreated`;\n\n/** The Transfer Policy Type */\nexport const TRANSFER_POLICY_TYPE = `${TRANSFER_POLICY_MODULE}::TransferPolicy`;\n\n/** The Transfer Policy Cap Type */\nexport const TRANSFER_POLICY_CAP_TYPE = `${TRANSFER_POLICY_MODULE}::TransferPolicyCap`;\n\n/** The Kiosk Lock Rule */\nexport const KIOSK_LOCK_RULE = 'kiosk_lock_rule::Rule';\n\n/** The Royalty rule */\nexport const ROYALTY_RULE = 'royalty_rule::Rule';\n\n/**\n * The Transfer Policy Cap in a consumable way.\n */\nexport type TransferPolicyCap = {\n\tpolicyId: string;\n\tpolicyCapId: string;\n\ttype: string;\n};\n\n/** The `TransferPolicy` object */\nexport type TransferPolicy = {\n\tid: string;\n\ttype: string;\n\tbalance: string;\n\trules: string[];\n\towner: ObjectOwner;\n};\n\n/** Event emitted when a TransferPolicy is created. */\nexport type TransferPolicyCreated = {\n\tid: string;\n};\n\n// The object a Rule resolving function accepts\n// It can accept a set of fixed fields, that are part of every purchase flow as well any extra arguments to resolve custom policies!\n// Each rule resolving function should check that the key it's seeking is in the object\n// e.g. `if(!'my_key' in ruleParams!) throw new Error(\"Can't resolve that rule!\")`\nexport type RuleResolvingParams = {\n\ttransaction: Transaction;\n\t/** @deprecated use transaction instead */\n\ttransactionBlock: Transaction;\n\titemType: string;\n\titemId: string;\n\tprice: string;\n\tpolicyId: ObjectArgument;\n\tsellerKiosk: ObjectArgument;\n\tkiosk: ObjectArgument;\n\tkioskCap: ObjectArgument;\n\ttransferRequest: TransactionObjectArgument;\n\tpurchasedItem: TransactionObjectArgument;\n\tpackageId: string;\n\textraArgs: Record<string, any>; // extraParams contains more possible {key, values} to pass for custom rules.\n\tkioskClient: KioskClient;\n};\n"],
|
|
5
|
-
"mappings": "AAUO,MAAM,yBAAyB;AAG/B,MAAM,gCAAgC,GAAG,sBAAsB;AAG/D,MAAM,uBAAuB,GAAG,sBAAsB;AAGtD,MAAM,2BAA2B,GAAG,sBAAsB;AAG1D,MAAM,kBAAkB;AAGxB,MAAM,eAAe;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/utils.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { DynamicFieldInfo, PaginationArguments, SuiClient, SuiObjectData, SuiObjectDataFilter, SuiObjectDataOptions, SuiObjectResponse } from '@mysten/sui/client';
|
|
2
|
-
import type { Kiosk, KioskData, KioskListing, TransferPolicyCap } from './types/index.js';
|
|
3
|
-
export declare function getKioskObject(client: SuiClient, id: string): Promise<Kiosk>;
|
|
4
|
-
export declare function extractKioskData(data: DynamicFieldInfo[], listings: KioskListing[], lockedItemIds: string[], kioskId: string): KioskData;
|
|
5
|
-
/**
|
|
6
|
-
* A helper that attaches the listing prices to kiosk listings.
|
|
7
|
-
*/
|
|
8
|
-
export declare function attachListingsAndPrices(kioskData: KioskData, listings: KioskListing[], listingObjects: SuiObjectResponse[]): void;
|
|
9
|
-
/**
|
|
10
|
-
* A helper that attaches the listing prices to kiosk listings.
|
|
11
|
-
*/
|
|
12
|
-
export declare function attachObjects(kioskData: KioskData, objects: SuiObjectData[]): void;
|
|
13
|
-
/**
|
|
14
|
-
* A Helper to attach locked state to items in Kiosk Data.
|
|
15
|
-
*/
|
|
16
|
-
export declare function attachLockedItems(kioskData: KioskData, lockedItemIds: string[]): void;
|
|
17
|
-
/**
|
|
18
|
-
* A helper to fetch all DF pages.
|
|
19
|
-
* We need that to fetch the kiosk DFs consistently, until we have
|
|
20
|
-
* RPC calls that allow filtering of Type / batch fetching of spec
|
|
21
|
-
*/
|
|
22
|
-
export declare function getAllDynamicFields(client: SuiClient, parentId: string, pagination: PaginationArguments<string>): Promise<DynamicFieldInfo[]>;
|
|
23
|
-
/**
|
|
24
|
-
* A helper to fetch all objects that works with pagination.
|
|
25
|
-
* It will fetch all objects in the array, and limit it to 50/request.
|
|
26
|
-
* Requests are sent using `Promise.all`.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getAllObjects(client: SuiClient, ids: string[], options: SuiObjectDataOptions, limit?: number): Promise<SuiObjectResponse[]>;
|
|
29
|
-
/**
|
|
30
|
-
* A helper to return all owned objects, with an optional filter.
|
|
31
|
-
* It parses all the pages and returns the data.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getAllOwnedObjects({ client, owner, filter, limit, options, }: {
|
|
34
|
-
client: SuiClient;
|
|
35
|
-
owner: string;
|
|
36
|
-
filter?: SuiObjectDataFilter;
|
|
37
|
-
options?: SuiObjectDataOptions;
|
|
38
|
-
limit?: number;
|
|
39
|
-
}): Promise<SuiObjectResponse[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Converts a number to basis points.
|
|
42
|
-
* Supports up to 2 decimal points.
|
|
43
|
-
* E.g 9.95 -> 995
|
|
44
|
-
* @param percentage A percentage amount in the range [0, 100] including decimals.
|
|
45
|
-
*/
|
|
46
|
-
export declare function percentageToBasisPoints(percentage: number): number;
|
|
47
|
-
/**
|
|
48
|
-
* A helper to parse a transfer policy Cap into a usable object.
|
|
49
|
-
*/
|
|
50
|
-
export declare function parseTransferPolicyCapObject(item: SuiObjectResponse): TransferPolicyCap | undefined;
|
|
51
|
-
export declare function getNormalizedRuleType(rule: string): string;
|