@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
|
@@ -3,19 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
import type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from '../tx/
|
|
12
|
-
import {
|
|
13
|
-
createTransferPolicy,
|
|
14
|
-
createTransferPolicyWithoutSharing,
|
|
15
|
-
removeTransferPolicyRule,
|
|
16
|
-
shareTransferPolicy,
|
|
17
|
-
withdrawFromPolicy,
|
|
18
|
-
} from '../tx/transfer-policy.js';
|
|
6
|
+
import * as royaltyRule from '../contracts/kiosk/royalty_rule.js';
|
|
7
|
+
import * as kioskLockRule from '../contracts/kiosk/kiosk_lock_rule.js';
|
|
8
|
+
import * as personalKioskRule from '../contracts/kiosk/personal_kiosk_rule.js';
|
|
9
|
+
import * as floorPriceRule from '../contracts/kiosk/floor_price_rule.js';
|
|
10
|
+
import * as transferPolicyContract from '../contracts/0x2/transfer_policy.js';
|
|
11
|
+
import { createTransferPolicy, withdrawFromPolicy } from '../tx/transfer-policy.js';
|
|
19
12
|
import type { ObjectArgument, TransferPolicyCap } from '../types/index.js';
|
|
20
13
|
import type { KioskClient } from './kiosk-client.js';
|
|
21
14
|
|
|
@@ -28,8 +21,6 @@ export type TransferPolicyBaseParams = {
|
|
|
28
21
|
export type TransferPolicyTransactionParams = {
|
|
29
22
|
kioskClient: KioskClient;
|
|
30
23
|
transaction: Transaction;
|
|
31
|
-
/** @deprecated use transaction instead */
|
|
32
|
-
transactionBlock?: Transaction;
|
|
33
24
|
cap?: TransferPolicyCap;
|
|
34
25
|
};
|
|
35
26
|
|
|
@@ -40,12 +31,7 @@ export class TransferPolicyTransaction {
|
|
|
40
31
|
policyCap?: ObjectArgument;
|
|
41
32
|
type?: string;
|
|
42
33
|
|
|
43
|
-
constructor({
|
|
44
|
-
kioskClient,
|
|
45
|
-
transactionBlock,
|
|
46
|
-
transaction = transactionBlock!,
|
|
47
|
-
cap,
|
|
48
|
-
}: TransferPolicyTransactionParams) {
|
|
34
|
+
constructor({ kioskClient, transaction, cap }: TransferPolicyTransactionParams) {
|
|
49
35
|
this.kioskClient = kioskClient;
|
|
50
36
|
this.transaction = transaction;
|
|
51
37
|
if (cap) this.setCap(cap);
|
|
@@ -76,7 +62,7 @@ export class TransferPolicyTransaction {
|
|
|
76
62
|
if (policies.length > 0) throw new Error("There's already transfer policy for this Type.");
|
|
77
63
|
}
|
|
78
64
|
const cap = createTransferPolicy(this.transaction, type, publisher);
|
|
79
|
-
this.transaction.transferObjects([cap],
|
|
65
|
+
this.transaction.transferObjects([cap], address);
|
|
80
66
|
}
|
|
81
67
|
|
|
82
68
|
/**
|
|
@@ -96,10 +82,13 @@ export class TransferPolicyTransaction {
|
|
|
96
82
|
const policies = await this.kioskClient.getTransferPolicies({ type });
|
|
97
83
|
if (policies.length > 0) throw new Error("There's already transfer policy for this Type.");
|
|
98
84
|
}
|
|
99
|
-
const
|
|
100
|
-
this.transaction
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
const publisherArg =
|
|
86
|
+
typeof publisher === 'string' ? this.transaction.object(publisher) : publisher;
|
|
87
|
+
const [policy, policyCap] = this.transaction.add(
|
|
88
|
+
transferPolicyContract._new({
|
|
89
|
+
arguments: [publisherArg],
|
|
90
|
+
typeArguments: [type],
|
|
91
|
+
}),
|
|
103
92
|
);
|
|
104
93
|
|
|
105
94
|
this.#setup(policy, policyCap, type); // sets the client's TP to the newly created one.
|
|
@@ -116,10 +105,20 @@ export class TransferPolicyTransaction {
|
|
|
116
105
|
if (!this.type || !this.policyCap || !this.policy)
|
|
117
106
|
throw new Error('This function can only be called after `transferPolicyManager.create`');
|
|
118
107
|
|
|
119
|
-
|
|
108
|
+
this.transaction.moveCall({
|
|
109
|
+
target: '0x2::transfer::public_share_object',
|
|
110
|
+
arguments: [
|
|
111
|
+
typeof this.policy === 'string' ? this.transaction.object(this.policy) : this.policy,
|
|
112
|
+
],
|
|
113
|
+
typeArguments: [`0x2::transfer_policy::TransferPolicy<${this.type}>`],
|
|
114
|
+
});
|
|
120
115
|
this.transaction.transferObjects(
|
|
121
|
-
[
|
|
122
|
-
|
|
116
|
+
[
|
|
117
|
+
typeof this.policyCap === 'string'
|
|
118
|
+
? this.transaction.object(this.policyCap)
|
|
119
|
+
: this.policyCap,
|
|
120
|
+
],
|
|
121
|
+
address,
|
|
123
122
|
);
|
|
124
123
|
}
|
|
125
124
|
|
|
@@ -148,7 +147,7 @@ export class TransferPolicyTransaction {
|
|
|
148
147
|
amount,
|
|
149
148
|
);
|
|
150
149
|
|
|
151
|
-
this.transaction.transferObjects([coin],
|
|
150
|
+
this.transaction.transferObjects([coin], address);
|
|
152
151
|
|
|
153
152
|
return this;
|
|
154
153
|
}
|
|
@@ -169,17 +168,28 @@ export class TransferPolicyTransaction {
|
|
|
169
168
|
) {
|
|
170
169
|
this.#validateInputs();
|
|
171
170
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
171
|
+
const policyArg =
|
|
172
|
+
typeof this.policy === 'string'
|
|
173
|
+
? this.transaction.object(this.policy)
|
|
174
|
+
: (this.policy as TransactionObjectArgument);
|
|
175
|
+
const policyCapArg =
|
|
176
|
+
typeof this.policyCap === 'string'
|
|
177
|
+
? this.transaction.object(this.policyCap)
|
|
178
|
+
: (this.policyCap as TransactionObjectArgument);
|
|
179
|
+
|
|
180
|
+
const packageId = this.kioskClient.getRulePackageId('royaltyRulePackageId');
|
|
181
|
+
|
|
182
|
+
this.transaction.add(
|
|
183
|
+
royaltyRule.add({
|
|
184
|
+
package: packageId,
|
|
185
|
+
arguments: {
|
|
186
|
+
policy: policyArg,
|
|
187
|
+
cap: policyCapArg,
|
|
188
|
+
amountBp: Number(percentageBps),
|
|
189
|
+
minAmount: typeof minAmount === 'string' ? BigInt(minAmount) : BigInt(minAmount),
|
|
190
|
+
},
|
|
191
|
+
typeArguments: [this.type!],
|
|
192
|
+
}),
|
|
183
193
|
);
|
|
184
194
|
return this;
|
|
185
195
|
}
|
|
@@ -191,12 +201,26 @@ export class TransferPolicyTransaction {
|
|
|
191
201
|
addLockRule() {
|
|
192
202
|
this.#validateInputs();
|
|
193
203
|
|
|
194
|
-
|
|
195
|
-
this.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
this.
|
|
204
|
+
const policyArg =
|
|
205
|
+
typeof this.policy === 'string'
|
|
206
|
+
? this.transaction.object(this.policy)
|
|
207
|
+
: (this.policy as TransactionObjectArgument);
|
|
208
|
+
const policyCapArg =
|
|
209
|
+
typeof this.policyCap === 'string'
|
|
210
|
+
? this.transaction.object(this.policyCap)
|
|
211
|
+
: (this.policyCap as TransactionObjectArgument);
|
|
212
|
+
|
|
213
|
+
const packageId = this.kioskClient.getRulePackageId('kioskLockRulePackageId');
|
|
214
|
+
|
|
215
|
+
this.transaction.add(
|
|
216
|
+
kioskLockRule.add({
|
|
217
|
+
package: packageId,
|
|
218
|
+
arguments: {
|
|
219
|
+
policy: policyArg,
|
|
220
|
+
cap: policyCapArg,
|
|
221
|
+
},
|
|
222
|
+
typeArguments: [this.type!],
|
|
223
|
+
}),
|
|
200
224
|
);
|
|
201
225
|
return this;
|
|
202
226
|
}
|
|
@@ -207,12 +231,26 @@ export class TransferPolicyTransaction {
|
|
|
207
231
|
addPersonalKioskRule() {
|
|
208
232
|
this.#validateInputs();
|
|
209
233
|
|
|
210
|
-
|
|
211
|
-
this.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
this.
|
|
234
|
+
const policyArg =
|
|
235
|
+
typeof this.policy === 'string'
|
|
236
|
+
? this.transaction.object(this.policy)
|
|
237
|
+
: (this.policy as TransactionObjectArgument);
|
|
238
|
+
const policyCapArg =
|
|
239
|
+
typeof this.policyCap === 'string'
|
|
240
|
+
? this.transaction.object(this.policyCap)
|
|
241
|
+
: (this.policyCap as TransactionObjectArgument);
|
|
242
|
+
|
|
243
|
+
const packageId = this.kioskClient.getRulePackageId('personalKioskRulePackageId');
|
|
244
|
+
|
|
245
|
+
this.transaction.add(
|
|
246
|
+
personalKioskRule.add({
|
|
247
|
+
package: packageId,
|
|
248
|
+
arguments: {
|
|
249
|
+
policy: policyArg,
|
|
250
|
+
cap: policyCapArg,
|
|
251
|
+
},
|
|
252
|
+
typeArguments: [this.type!],
|
|
253
|
+
}),
|
|
216
254
|
);
|
|
217
255
|
return this;
|
|
218
256
|
}
|
|
@@ -224,13 +262,27 @@ export class TransferPolicyTransaction {
|
|
|
224
262
|
addFloorPriceRule(minPrice: string | bigint) {
|
|
225
263
|
this.#validateInputs();
|
|
226
264
|
|
|
227
|
-
|
|
228
|
-
this.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
265
|
+
const policyArg =
|
|
266
|
+
typeof this.policy === 'string'
|
|
267
|
+
? this.transaction.object(this.policy)
|
|
268
|
+
: (this.policy as TransactionObjectArgument);
|
|
269
|
+
const policyCapArg =
|
|
270
|
+
typeof this.policyCap === 'string'
|
|
271
|
+
? this.transaction.object(this.policyCap)
|
|
272
|
+
: (this.policyCap as TransactionObjectArgument);
|
|
273
|
+
|
|
274
|
+
const packageId = this.kioskClient.getRulePackageId('floorPriceRulePackageId');
|
|
275
|
+
|
|
276
|
+
this.transaction.add(
|
|
277
|
+
floorPriceRule.add({
|
|
278
|
+
package: packageId,
|
|
279
|
+
arguments: {
|
|
280
|
+
policy: policyArg,
|
|
281
|
+
cap: policyCapArg,
|
|
282
|
+
floorPrice: typeof minPrice === 'string' ? BigInt(minPrice) : minPrice,
|
|
283
|
+
},
|
|
284
|
+
typeArguments: [this.type!],
|
|
285
|
+
}),
|
|
234
286
|
);
|
|
235
287
|
return this;
|
|
236
288
|
}
|
|
@@ -243,13 +295,11 @@ export class TransferPolicyTransaction {
|
|
|
243
295
|
removeRule({ ruleType, configType }: { ruleType: string; configType: string }) {
|
|
244
296
|
this.#validateInputs();
|
|
245
297
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.policy!,
|
|
252
|
-
this.policyCap!,
|
|
298
|
+
this.transaction.add(
|
|
299
|
+
transferPolicyContract.removeRule({
|
|
300
|
+
arguments: [this.policy!, this.policyCap!],
|
|
301
|
+
typeArguments: [this.type!, ruleType, configType],
|
|
302
|
+
}),
|
|
253
303
|
);
|
|
254
304
|
}
|
|
255
305
|
|
|
@@ -261,13 +311,15 @@ export class TransferPolicyTransaction {
|
|
|
261
311
|
|
|
262
312
|
const packageId = this.kioskClient.getRulePackageId('kioskLockRulePackageId');
|
|
263
313
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
314
|
+
this.transaction.add(
|
|
315
|
+
transferPolicyContract.removeRule({
|
|
316
|
+
arguments: [this.policy!, this.policyCap!],
|
|
317
|
+
typeArguments: [
|
|
318
|
+
this.type!,
|
|
319
|
+
`${packageId}::kiosk_lock_rule::Rule`,
|
|
320
|
+
`${packageId}::kiosk_lock_rule::Config`,
|
|
321
|
+
],
|
|
322
|
+
}),
|
|
271
323
|
);
|
|
272
324
|
return this;
|
|
273
325
|
}
|
|
@@ -280,13 +332,15 @@ export class TransferPolicyTransaction {
|
|
|
280
332
|
|
|
281
333
|
const packageId = this.kioskClient.getRulePackageId('royaltyRulePackageId');
|
|
282
334
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
335
|
+
this.transaction.add(
|
|
336
|
+
transferPolicyContract.removeRule({
|
|
337
|
+
arguments: [this.policy!, this.policyCap!],
|
|
338
|
+
typeArguments: [
|
|
339
|
+
this.type!,
|
|
340
|
+
`${packageId}::royalty_rule::Rule`,
|
|
341
|
+
`${packageId}::royalty_rule::Config`,
|
|
342
|
+
],
|
|
343
|
+
}),
|
|
290
344
|
);
|
|
291
345
|
return this;
|
|
292
346
|
}
|
|
@@ -296,13 +350,11 @@ export class TransferPolicyTransaction {
|
|
|
296
350
|
|
|
297
351
|
const packageId = this.kioskClient.getRulePackageId('personalKioskRulePackageId');
|
|
298
352
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
this.policy!,
|
|
305
|
-
this.policyCap!,
|
|
353
|
+
this.transaction.add(
|
|
354
|
+
transferPolicyContract.removeRule({
|
|
355
|
+
arguments: [this.policy!, this.policyCap!],
|
|
356
|
+
typeArguments: [this.type!, `${packageId}::personal_kiosk_rule::Rule`, `bool`],
|
|
357
|
+
}),
|
|
306
358
|
);
|
|
307
359
|
return this;
|
|
308
360
|
}
|
|
@@ -312,13 +364,15 @@ export class TransferPolicyTransaction {
|
|
|
312
364
|
|
|
313
365
|
const packageId = this.kioskClient.getRulePackageId('floorPriceRulePackageId');
|
|
314
366
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
367
|
+
this.transaction.add(
|
|
368
|
+
transferPolicyContract.removeRule({
|
|
369
|
+
arguments: [this.policy!, this.policyCap!],
|
|
370
|
+
typeArguments: [
|
|
371
|
+
this.type!,
|
|
372
|
+
`${packageId}::floor_price_rule::Rule`,
|
|
373
|
+
`${packageId}::floor_price_rule::Config`,
|
|
374
|
+
],
|
|
375
|
+
}),
|
|
322
376
|
);
|
|
323
377
|
return this;
|
|
324
378
|
}
|
package/src/constants.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import { SuiClientTypes } from '@mysten/sui/client';
|
|
5
5
|
import {
|
|
6
6
|
resolveFloorPriceRule,
|
|
7
7
|
resolveKioskLockRule,
|
|
8
8
|
resolvePersonalKioskRule,
|
|
9
9
|
resolveRoyaltyRule,
|
|
10
10
|
} from './tx/rules/resolve.js';
|
|
11
|
-
import { Network } from './types/index.js';
|
|
12
11
|
import type { ObjectArgument, RuleResolvingParams } from './types/index.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -33,28 +32,24 @@ export type TransferPolicyRule = {
|
|
|
33
32
|
hasLockingRule?: boolean;
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
export const ROYALTY_RULE_ADDRESS: Record<Network, string
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[Network.CUSTOM]: '',
|
|
35
|
+
export const ROYALTY_RULE_ADDRESS: Partial<Record<SuiClientTypes.Network, string>> = {
|
|
36
|
+
['testnet']: 'bd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585',
|
|
37
|
+
['mainnet']: '0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879',
|
|
40
38
|
};
|
|
41
39
|
|
|
42
|
-
export const KIOSK_LOCK_RULE_ADDRESS: Record<Network, string
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[Network.CUSTOM]: '',
|
|
40
|
+
export const KIOSK_LOCK_RULE_ADDRESS: Partial<Record<SuiClientTypes.Network, string>> = {
|
|
41
|
+
['testnet']: 'bd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585',
|
|
42
|
+
['mainnet']: '0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879',
|
|
46
43
|
};
|
|
47
44
|
|
|
48
|
-
export const FLOOR_PRICE_RULE_ADDRESS: Record<Network, string
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[Network.CUSTOM]: '',
|
|
45
|
+
export const FLOOR_PRICE_RULE_ADDRESS: Partial<Record<SuiClientTypes.Network, string>> = {
|
|
46
|
+
['testnet']: '0x06f6bdd3f2e2e759d8a4b9c252f379f7a05e72dfe4c0b9311cdac27b8eb791b1',
|
|
47
|
+
['mainnet']: '0x34cc6762780f4f6f153c924c0680cfe2a1fb4601e7d33cc28a92297b62de1e0e',
|
|
52
48
|
};
|
|
53
49
|
|
|
54
|
-
export const PERSONAL_KIOSK_RULE_ADDRESS: Record<Network, string
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
[Network.CUSTOM]: '',
|
|
50
|
+
export const PERSONAL_KIOSK_RULE_ADDRESS: Partial<Record<SuiClientTypes.Network, string>> = {
|
|
51
|
+
['testnet']: '0x06f6bdd3f2e2e759d8a4b9c252f379f7a05e72dfe4c0b9311cdac27b8eb791b1',
|
|
52
|
+
['mainnet']: '0x0cb4bcc0560340eb1a1b929cabe56b33fc6449820ec8c1980d69bb98b649b802',
|
|
58
53
|
};
|
|
59
54
|
|
|
60
55
|
/**
|
|
@@ -106,16 +101,16 @@ export function getBaseRules({
|
|
|
106
101
|
|
|
107
102
|
// A list of testnet's base rules.
|
|
108
103
|
export const testnetRules: TransferPolicyRule[] = getBaseRules({
|
|
109
|
-
royaltyRulePackageId: ROYALTY_RULE_ADDRESS[
|
|
110
|
-
kioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS[
|
|
111
|
-
personalKioskRulePackageId: PERSONAL_KIOSK_RULE_ADDRESS[
|
|
112
|
-
floorPriceRulePackageId: FLOOR_PRICE_RULE_ADDRESS[
|
|
104
|
+
royaltyRulePackageId: ROYALTY_RULE_ADDRESS['testnet'],
|
|
105
|
+
kioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS['testnet'],
|
|
106
|
+
personalKioskRulePackageId: PERSONAL_KIOSK_RULE_ADDRESS['testnet'],
|
|
107
|
+
floorPriceRulePackageId: FLOOR_PRICE_RULE_ADDRESS['testnet'],
|
|
113
108
|
});
|
|
114
109
|
|
|
115
110
|
// A list of mainnet's base rules.
|
|
116
111
|
export const mainnetRules: TransferPolicyRule[] = getBaseRules({
|
|
117
|
-
royaltyRulePackageId: ROYALTY_RULE_ADDRESS[
|
|
118
|
-
kioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS[
|
|
112
|
+
royaltyRulePackageId: ROYALTY_RULE_ADDRESS['mainnet'],
|
|
113
|
+
kioskLockRulePackageId: KIOSK_LOCK_RULE_ADDRESS['mainnet'],
|
|
119
114
|
});
|
|
120
115
|
|
|
121
116
|
export const rules: TransferPolicyRule[] = [...testnetRules, ...mainnetRules];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
const $moduleName = '0x2::accumulator';
|
|
7
|
+
export const AccumulatorRoot = new MoveStruct({
|
|
8
|
+
name: `${$moduleName}::AccumulatorRoot`,
|
|
9
|
+
fields: {
|
|
10
|
+
id: bcs.Address,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export const U128 = new MoveStruct({
|
|
14
|
+
name: `${$moduleName}::U128`,
|
|
15
|
+
fields: {
|
|
16
|
+
value: bcs.u128(),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export const Key = new MoveStruct({
|
|
20
|
+
name: `${$moduleName}::Key`,
|
|
21
|
+
fields: {
|
|
22
|
+
address: bcs.Address,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import * as bag from './bag.js';
|
|
7
|
+
const $moduleName = '0x2::accumulator_metadata';
|
|
8
|
+
export const OwnerKey = new MoveStruct({
|
|
9
|
+
name: `${$moduleName}::OwnerKey`,
|
|
10
|
+
fields: {
|
|
11
|
+
owner: bcs.Address,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
export const Owner = new MoveStruct({
|
|
15
|
+
name: `${$moduleName}::Owner`,
|
|
16
|
+
fields: {
|
|
17
|
+
balances: bag.Bag,
|
|
18
|
+
owner: bcs.Address,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export const MetadataKey = new MoveStruct({
|
|
22
|
+
name: `${$moduleName}::MetadataKey`,
|
|
23
|
+
fields: {
|
|
24
|
+
dummy_field: bcs.bool(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const Metadata = new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::Metadata`,
|
|
29
|
+
fields: {
|
|
30
|
+
fields: bag.Bag,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const AccumulatorObjectCountKey = new MoveStruct({
|
|
34
|
+
name: `${$moduleName}::AccumulatorObjectCountKey`,
|
|
35
|
+
fields: {
|
|
36
|
+
dummy_field: bcs.bool(),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
const $moduleName = '0x2::accumulator_settlement';
|
|
7
|
+
export const EventStreamHead = new MoveStruct({
|
|
8
|
+
name: `${$moduleName}::EventStreamHead`,
|
|
9
|
+
fields: {
|
|
10
|
+
mmr: bcs.vector(bcs.u256()),
|
|
11
|
+
checkpoint_seq: bcs.u64(),
|
|
12
|
+
num_events: bcs.u64(),
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
5
|
+
import { normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
6
|
+
export interface ToU256Options {
|
|
7
|
+
package?: string;
|
|
8
|
+
arguments: [RawTransactionArgument<string>];
|
|
9
|
+
}
|
|
10
|
+
export function toU256(options: ToU256Options) {
|
|
11
|
+
const packageAddress =
|
|
12
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
13
|
+
const argumentsTypes = ['address'] satisfies (string | null)[];
|
|
14
|
+
return (tx: Transaction) =>
|
|
15
|
+
tx.moveCall({
|
|
16
|
+
package: packageAddress,
|
|
17
|
+
module: 'address',
|
|
18
|
+
function: 'to_u256',
|
|
19
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export interface FromU256Options {
|
|
23
|
+
package?: string;
|
|
24
|
+
arguments: [RawTransactionArgument<number | bigint>];
|
|
25
|
+
}
|
|
26
|
+
export function fromU256(options: FromU256Options) {
|
|
27
|
+
const packageAddress =
|
|
28
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
29
|
+
const argumentsTypes = ['u256'] satisfies (string | null)[];
|
|
30
|
+
return (tx: Transaction) =>
|
|
31
|
+
tx.moveCall({
|
|
32
|
+
package: packageAddress,
|
|
33
|
+
module: 'address',
|
|
34
|
+
function: 'from_u256',
|
|
35
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export interface FromBytesOptions {
|
|
39
|
+
package?: string;
|
|
40
|
+
arguments: [RawTransactionArgument<number[]>];
|
|
41
|
+
}
|
|
42
|
+
export function fromBytes(options: FromBytesOptions) {
|
|
43
|
+
const packageAddress =
|
|
44
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
45
|
+
const argumentsTypes = ['vector<u8>'] satisfies (string | null)[];
|
|
46
|
+
return (tx: Transaction) =>
|
|
47
|
+
tx.moveCall({
|
|
48
|
+
package: packageAddress,
|
|
49
|
+
module: 'address',
|
|
50
|
+
function: 'from_bytes',
|
|
51
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export interface ToBytesOptions {
|
|
55
|
+
package?: string;
|
|
56
|
+
arguments: [RawTransactionArgument<string>];
|
|
57
|
+
}
|
|
58
|
+
export function toBytes(options: ToBytesOptions) {
|
|
59
|
+
const packageAddress =
|
|
60
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
61
|
+
const argumentsTypes = ['address'] satisfies (string | null)[];
|
|
62
|
+
return (tx: Transaction) =>
|
|
63
|
+
tx.moveCall({
|
|
64
|
+
package: packageAddress,
|
|
65
|
+
module: 'address',
|
|
66
|
+
function: 'to_bytes',
|
|
67
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export interface ToAsciiStringOptions {
|
|
71
|
+
package?: string;
|
|
72
|
+
arguments: [RawTransactionArgument<string>];
|
|
73
|
+
}
|
|
74
|
+
export function toAsciiString(options: ToAsciiStringOptions) {
|
|
75
|
+
const packageAddress =
|
|
76
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
77
|
+
const argumentsTypes = ['address'] satisfies (string | null)[];
|
|
78
|
+
return (tx: Transaction) =>
|
|
79
|
+
tx.moveCall({
|
|
80
|
+
package: packageAddress,
|
|
81
|
+
module: 'address',
|
|
82
|
+
function: 'to_ascii_string',
|
|
83
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export interface ToStringOptions {
|
|
87
|
+
package?: string;
|
|
88
|
+
arguments: [RawTransactionArgument<string>];
|
|
89
|
+
}
|
|
90
|
+
export function toString(options: ToStringOptions) {
|
|
91
|
+
const packageAddress =
|
|
92
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
93
|
+
const argumentsTypes = ['address'] satisfies (string | null)[];
|
|
94
|
+
return (tx: Transaction) =>
|
|
95
|
+
tx.moveCall({
|
|
96
|
+
package: packageAddress,
|
|
97
|
+
module: 'address',
|
|
98
|
+
function: 'to_string',
|
|
99
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export interface FromAsciiBytesOptions {
|
|
103
|
+
package?: string;
|
|
104
|
+
arguments: [RawTransactionArgument<number[]>];
|
|
105
|
+
}
|
|
106
|
+
export function fromAsciiBytes(options: FromAsciiBytesOptions) {
|
|
107
|
+
const packageAddress =
|
|
108
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
109
|
+
const argumentsTypes = ['vector<u8>'] satisfies (string | null)[];
|
|
110
|
+
return (tx: Transaction) =>
|
|
111
|
+
tx.moveCall({
|
|
112
|
+
package: packageAddress,
|
|
113
|
+
module: 'address',
|
|
114
|
+
function: 'from_ascii_bytes',
|
|
115
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export interface LengthOptions {
|
|
119
|
+
package?: string;
|
|
120
|
+
arguments?: [];
|
|
121
|
+
}
|
|
122
|
+
export function length(options: LengthOptions = {}) {
|
|
123
|
+
const packageAddress =
|
|
124
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
125
|
+
return (tx: Transaction) =>
|
|
126
|
+
tx.moveCall({
|
|
127
|
+
package: packageAddress,
|
|
128
|
+
module: 'address',
|
|
129
|
+
function: 'length',
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export interface MaxOptions {
|
|
133
|
+
package?: string;
|
|
134
|
+
arguments?: [];
|
|
135
|
+
}
|
|
136
|
+
export function max(options: MaxOptions = {}) {
|
|
137
|
+
const packageAddress =
|
|
138
|
+
options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
|
|
139
|
+
return (tx: Transaction) =>
|
|
140
|
+
tx.moveCall({
|
|
141
|
+
package: packageAddress,
|
|
142
|
+
module: 'address',
|
|
143
|
+
function: 'max',
|
|
144
|
+
});
|
|
145
|
+
}
|