@mysten/sui-groups 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +108 -0
  2. package/dist/bcs.d.mts +82 -0
  3. package/dist/bcs.d.mts.map +1 -0
  4. package/dist/bcs.mjs +55 -0
  5. package/dist/bcs.mjs.map +1 -0
  6. package/dist/call.d.mts +99 -0
  7. package/dist/call.d.mts.map +1 -0
  8. package/dist/call.mjs +171 -0
  9. package/dist/call.mjs.map +1 -0
  10. package/dist/client.d.mts +143 -0
  11. package/dist/client.d.mts.map +1 -0
  12. package/dist/client.mjs +173 -0
  13. package/dist/client.mjs.map +1 -0
  14. package/dist/constants.d.mts +65 -0
  15. package/dist/constants.d.mts.map +1 -0
  16. package/dist/constants.mjs +77 -0
  17. package/dist/constants.mjs.map +1 -0
  18. package/dist/contracts/sui_groups/deps/std/type_name.mjs +17 -0
  19. package/dist/contracts/sui_groups/deps/std/type_name.mjs.map +1 -0
  20. package/dist/contracts/sui_groups/permissioned_group.d.mts +84 -0
  21. package/dist/contracts/sui_groups/permissioned_group.d.mts.map +1 -0
  22. package/dist/contracts/sui_groups/permissioned_group.mjs +368 -0
  23. package/dist/contracts/sui_groups/permissioned_group.mjs.map +1 -0
  24. package/dist/contracts/sui_groups/permissions_table.mjs +26 -0
  25. package/dist/contracts/sui_groups/permissions_table.mjs.map +1 -0
  26. package/dist/contracts/utils/index.d.mts +35 -0
  27. package/dist/contracts/utils/index.d.mts.map +1 -0
  28. package/dist/contracts/utils/index.mjs +119 -0
  29. package/dist/contracts/utils/index.mjs.map +1 -0
  30. package/dist/error.d.mts +5 -0
  31. package/dist/error.d.mts.map +1 -0
  32. package/dist/error.mjs +6 -0
  33. package/dist/error.mjs.map +1 -0
  34. package/dist/index.d.mts +9 -0
  35. package/dist/index.mjs +9 -0
  36. package/dist/transactions.d.mts +110 -0
  37. package/dist/transactions.d.mts.map +1 -0
  38. package/dist/transactions.mjs +91 -0
  39. package/dist/transactions.mjs.map +1 -0
  40. package/dist/types.d.mts +221 -0
  41. package/dist/types.d.mts.map +1 -0
  42. package/dist/view.d.mts +85 -0
  43. package/dist/view.d.mts.map +1 -0
  44. package/dist/view.mjs +221 -0
  45. package/dist/view.mjs.map +1 -0
  46. package/package.json +57 -0
@@ -0,0 +1,143 @@
1
+ import { AddMembersOptions, GrantPermissionOptions, GrantPermissionsOptions, PauseOptions, RemoveMemberOptions, RevokePermissionOptions, RevokePermissionsOptions, SuiGroupsClientOptions, SuiGroupsPackageConfig, UnpauseOptions } from "./types.mjs";
2
+ import { SuiGroupsCall } from "./call.mjs";
3
+ import { SuiGroupsTransactions } from "./transactions.mjs";
4
+ import { SuiGroupsBCS } from "./bcs.mjs";
5
+ import { SuiGroupsView } from "./view.mjs";
6
+ import { Transaction } from "@mysten/sui/transactions";
7
+ import * as _mysten_sui_client0 from "@mysten/sui/client";
8
+ import { ClientWithCoreApi } from "@mysten/sui/client";
9
+
10
+ //#region src/client.d.ts
11
+ declare function suiGroups<const Name = 'groups'>({
12
+ name,
13
+ witnessType,
14
+ packageConfig
15
+ }: {
16
+ name?: Name; /** The witness type from the extending package (e.g., '0xabc::my_module::MY_WITNESS') */
17
+ witnessType: string;
18
+ packageConfig?: SuiGroupsPackageConfig;
19
+ }): {
20
+ name: Name;
21
+ register: (client: ClientWithCoreApi) => SuiGroupsClient;
22
+ };
23
+ declare class SuiGroupsClient {
24
+ #private;
25
+ call: SuiGroupsCall;
26
+ tx: SuiGroupsTransactions;
27
+ view: SuiGroupsView;
28
+ bcs: SuiGroupsBCS;
29
+ constructor(options: SuiGroupsClientOptions);
30
+ /**
31
+ * Grants a permission to a member.
32
+ * If the member doesn't exist, they are automatically added to the group.
33
+ */
34
+ grantPermission({
35
+ signer,
36
+ transaction,
37
+ ...callOptions
38
+ }: GrantPermissionOptions & {
39
+ transaction?: Transaction;
40
+ }): Promise<{
41
+ digest: string;
42
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
43
+ }>;
44
+ /**
45
+ * Grants multiple permissions to a member in a single transaction.
46
+ */
47
+ grantPermissions({
48
+ signer,
49
+ transaction,
50
+ ...callOptions
51
+ }: GrantPermissionsOptions & {
52
+ transaction?: Transaction;
53
+ }): Promise<{
54
+ digest: string;
55
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
56
+ }>;
57
+ /**
58
+ * Adds multiple members to a group, each with their own set of permissions.
59
+ * Members who already exist will simply receive the additional permissions.
60
+ */
61
+ addMembers({
62
+ signer,
63
+ transaction,
64
+ ...callOptions
65
+ }: AddMembersOptions & {
66
+ transaction?: Transaction;
67
+ }): Promise<{
68
+ digest: string;
69
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
70
+ }>;
71
+ /**
72
+ * Revokes a permission from a member.
73
+ * If this is the member's last permission, they are automatically removed.
74
+ */
75
+ revokePermission({
76
+ signer,
77
+ transaction,
78
+ ...callOptions
79
+ }: RevokePermissionOptions & {
80
+ transaction?: Transaction;
81
+ }): Promise<{
82
+ digest: string;
83
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
84
+ }>;
85
+ /**
86
+ * Revokes multiple permissions from a member in a single transaction.
87
+ */
88
+ revokePermissions({
89
+ signer,
90
+ transaction,
91
+ ...callOptions
92
+ }: RevokePermissionsOptions & {
93
+ transaction?: Transaction;
94
+ }): Promise<{
95
+ digest: string;
96
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
97
+ }>;
98
+ /**
99
+ * Removes a member from the PermissionedGroup.
100
+ * Requires PermissionsAdmin permission.
101
+ */
102
+ removeMember({
103
+ signer,
104
+ transaction,
105
+ ...callOptions
106
+ }: RemoveMemberOptions & {
107
+ transaction?: Transaction;
108
+ }): Promise<{
109
+ digest: string;
110
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
111
+ }>;
112
+ /**
113
+ * Pauses the group and transfers the `UnpauseCap` to the given recipient
114
+ * (defaults to the transaction sender, or the signer's address).
115
+ */
116
+ pause({
117
+ signer,
118
+ transaction,
119
+ ...callOptions
120
+ }: PauseOptions & {
121
+ transaction?: Transaction;
122
+ }): Promise<{
123
+ digest: string;
124
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
125
+ }>;
126
+ /**
127
+ * Unpauses the group. Consumes and destroys the `UnpauseCap`.
128
+ * The signer must own the `UnpauseCap` object.
129
+ */
130
+ unpause({
131
+ signer,
132
+ transaction,
133
+ ...callOptions
134
+ }: UnpauseOptions & {
135
+ transaction?: Transaction;
136
+ }): Promise<{
137
+ digest: string;
138
+ effects: _mysten_sui_client0.SuiClientTypes.TransactionEffects;
139
+ }>;
140
+ }
141
+ //#endregion
142
+ export { SuiGroupsClient, suiGroups };
143
+ //# sourceMappingURL=client.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;;;;;;iBA8BgB,SAAA,uBAAA,CAAA;EACf,IAAA;EACA,WAAA;EACA;AAAA;EAEA,IAAA,GAAO,IAAA;EAEP,WAAA;EACA,aAAA,GAAgB,sBAAA;AAAA;;qBAII,iBAAA,KAAiB,eAAA;AAAA;AAAA,cAMzB,eAAA;EAAA;EAKZ,IAAA,EAAM,aAAA;EACN,EAAA,EAAI,qBAAA;EACJ,IAAA,EAAM,aAAA;EACN,GAAA,EAAK,YAAA;cAEO,OAAA,EAAS,sBAAA;EA5BU;;;;EAmIzB,eAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,sBAAA;IAA2B,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA;;;;EA/HzD;;;EA0IM,gBAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,uBAAA;IAA4B,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA;;;;EA1IrB;AAMtC;;;EAgJO,UAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,iBAAA;IAAsB,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA;;;;EAjCnD;;;;EA6CK,gBAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,uBAAA;IAA4B,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA;;;;EAhCA;;;EA2CpD,iBAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,wBAAA;IAA6B,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA;;;;EAfxD;;;;EA2BG,YAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,mBAAA;IAAwB,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA;;;;EAHrD;;;;EAeK,KAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,YAAA;IAAiB,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA;;;;;;;;EAczC,OAAA,CAAA;IACL,MAAA;IACA,WAAA;IAAA,GACG;EAAA,GACD,cAAA;IAAmB,WAAA,GAAc,WAAA;EAAA,IAAa,OAAA"}
@@ -0,0 +1,173 @@
1
+ import { SuiGroupsClientError } from "./error.mjs";
2
+ import { MAINNET_SUI_GROUPS_PACKAGE_CONFIG, TESTNET_SUI_GROUPS_PACKAGE_CONFIG } from "./constants.mjs";
3
+ import { SuiGroupsCall } from "./call.mjs";
4
+ import { SuiGroupsTransactions } from "./transactions.mjs";
5
+ import { SuiGroupsBCS } from "./bcs.mjs";
6
+ import { SuiGroupsView } from "./view.mjs";
7
+ import { isValidNamedPackage, isValidSuiAddress } from "@mysten/sui/utils";
8
+
9
+ //#region src/client.ts
10
+ function suiGroups({ name = "groups", witnessType, packageConfig }) {
11
+ return {
12
+ name,
13
+ register: (client) => {
14
+ return new SuiGroupsClient({
15
+ client,
16
+ witnessType,
17
+ packageConfig
18
+ });
19
+ }
20
+ };
21
+ }
22
+ var SuiGroupsClient = class SuiGroupsClient {
23
+ #packageConfig;
24
+ #client;
25
+ #witnessType;
26
+ constructor(options) {
27
+ if (!options.client) throw new SuiGroupsClientError("client must be provided");
28
+ this.#client = options.client;
29
+ if (!options.witnessType) throw new SuiGroupsClientError("witnessType must be provided");
30
+ SuiGroupsClient.#validateWitnessType(options.witnessType);
31
+ this.#witnessType = options.witnessType;
32
+ if (options.packageConfig) this.#packageConfig = options.packageConfig;
33
+ else {
34
+ const network = options.client.network;
35
+ switch (network) {
36
+ case "testnet":
37
+ this.#packageConfig = TESTNET_SUI_GROUPS_PACKAGE_CONFIG;
38
+ break;
39
+ case "mainnet":
40
+ this.#packageConfig = MAINNET_SUI_GROUPS_PACKAGE_CONFIG;
41
+ break;
42
+ default: throw new SuiGroupsClientError(`Unsupported network: ${network}. Provide a custom packageConfig for localnet/devnet.`);
43
+ }
44
+ }
45
+ this.call = new SuiGroupsCall({
46
+ packageConfig: this.#packageConfig,
47
+ witnessType: this.#witnessType
48
+ });
49
+ this.bcs = new SuiGroupsBCS({
50
+ packageConfig: this.#packageConfig,
51
+ witnessType: this.#witnessType
52
+ });
53
+ this.tx = new SuiGroupsTransactions({ call: this.call });
54
+ this.view = new SuiGroupsView({
55
+ packageConfig: this.#packageConfig,
56
+ witnessType: this.#witnessType,
57
+ client: this.#client
58
+ });
59
+ }
60
+ /**
61
+ * Executes a transaction with the given signer and waits for confirmation.
62
+ * @throws {SuiGroupsClientError} if the transaction fails
63
+ */
64
+ async #executeTransaction(transaction, signer, action) {
65
+ transaction.setSenderIfNotSet(signer.toSuiAddress());
66
+ const result = await signer.signAndExecuteTransaction({
67
+ transaction,
68
+ client: this.#client
69
+ });
70
+ const tx = result.Transaction ?? result.FailedTransaction;
71
+ if (!tx) throw new SuiGroupsClientError(`Failed to ${action}: no transaction result`);
72
+ if (!tx.status.success) throw new SuiGroupsClientError(`Failed to ${action} (${tx.digest}): ${tx.status.error}`);
73
+ await this.#client.core.waitForTransaction({ result });
74
+ return {
75
+ digest: tx.digest,
76
+ effects: tx.effects
77
+ };
78
+ }
79
+ /**
80
+ * Validates that a witnessType is a valid Move struct tag.
81
+ * @throws {SuiGroupsClientError} if the witnessType is invalid
82
+ */
83
+ static #validateWitnessType(witnessType) {
84
+ const parts = witnessType.split("::");
85
+ if (parts.length < 3) throw new SuiGroupsClientError(`Invalid witnessType: "${witnessType}". Must be a valid Move type (e.g., '0xabc::module::Type').`);
86
+ const [address] = parts;
87
+ if (!isValidSuiAddress(address) && !isValidNamedPackage(address)) throw new SuiGroupsClientError(`Invalid witnessType address: "${address}". Must be a valid Sui address or MVR package name.`);
88
+ }
89
+ /**
90
+ * Grants a permission to a member.
91
+ * If the member doesn't exist, they are automatically added to the group.
92
+ */
93
+ async grantPermission({ signer, transaction, ...callOptions }) {
94
+ return this.#executeTransaction(this.tx.grantPermission({
95
+ transaction,
96
+ ...callOptions
97
+ }), signer, "grant permission");
98
+ }
99
+ /**
100
+ * Grants multiple permissions to a member in a single transaction.
101
+ */
102
+ async grantPermissions({ signer, transaction, ...callOptions }) {
103
+ return this.#executeTransaction(this.tx.grantPermissions({
104
+ transaction,
105
+ ...callOptions
106
+ }), signer, "grant permissions");
107
+ }
108
+ /**
109
+ * Adds multiple members to a group, each with their own set of permissions.
110
+ * Members who already exist will simply receive the additional permissions.
111
+ */
112
+ async addMembers({ signer, transaction, ...callOptions }) {
113
+ return this.#executeTransaction(this.tx.addMembers({
114
+ transaction,
115
+ ...callOptions
116
+ }), signer, "add members");
117
+ }
118
+ /**
119
+ * Revokes a permission from a member.
120
+ * If this is the member's last permission, they are automatically removed.
121
+ */
122
+ async revokePermission({ signer, transaction, ...callOptions }) {
123
+ return this.#executeTransaction(this.tx.revokePermission({
124
+ transaction,
125
+ ...callOptions
126
+ }), signer, "revoke permission");
127
+ }
128
+ /**
129
+ * Revokes multiple permissions from a member in a single transaction.
130
+ */
131
+ async revokePermissions({ signer, transaction, ...callOptions }) {
132
+ return this.#executeTransaction(this.tx.revokePermissions({
133
+ transaction,
134
+ ...callOptions
135
+ }), signer, "revoke permissions");
136
+ }
137
+ /**
138
+ * Removes a member from the PermissionedGroup.
139
+ * Requires PermissionsAdmin permission.
140
+ */
141
+ async removeMember({ signer, transaction, ...callOptions }) {
142
+ return this.#executeTransaction(this.tx.removeMember({
143
+ transaction,
144
+ ...callOptions
145
+ }), signer, "remove member");
146
+ }
147
+ /**
148
+ * Pauses the group and transfers the `UnpauseCap` to the given recipient
149
+ * (defaults to the transaction sender, or the signer's address).
150
+ */
151
+ async pause({ signer, transaction, ...callOptions }) {
152
+ const recipient = callOptions.unpauseCapRecipient ?? transaction?.getData().sender ?? signer.toSuiAddress();
153
+ return this.#executeTransaction(this.tx.pause({
154
+ transaction,
155
+ ...callOptions,
156
+ unpauseCapRecipient: recipient
157
+ }), signer, "pause group");
158
+ }
159
+ /**
160
+ * Unpauses the group. Consumes and destroys the `UnpauseCap`.
161
+ * The signer must own the `UnpauseCap` object.
162
+ */
163
+ async unpause({ signer, transaction, ...callOptions }) {
164
+ return this.#executeTransaction(this.tx.unpause({
165
+ transaction,
166
+ ...callOptions
167
+ }), signer, "unpause group");
168
+ }
169
+ };
170
+
171
+ //#endregion
172
+ export { SuiGroupsClient, suiGroups };
173
+ //# sourceMappingURL=client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","names":["#client","#validateWitnessType","#witnessType","#packageConfig","#executeTransaction"],"sources":["../src/client.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Signer } from '@mysten/sui/cryptography';\nimport type { ClientWithCoreApi } from '@mysten/sui/client';\nimport type { Transaction } from '@mysten/sui/transactions';\nimport { isValidNamedPackage, isValidSuiAddress } from '@mysten/sui/utils';\nimport { SuiGroupsClientError } from './error.js';\nimport {\n\tTESTNET_SUI_GROUPS_PACKAGE_CONFIG,\n\tMAINNET_SUI_GROUPS_PACKAGE_CONFIG,\n} from './constants.js';\nimport type {\n\tAddMembersOptions,\n\tGrantPermissionOptions,\n\tGrantPermissionsOptions,\n\tPauseOptions,\n\tSuiGroupsClientOptions,\n\tSuiGroupsCompatibleClient,\n\tSuiGroupsPackageConfig,\n\tRemoveMemberOptions,\n\tRevokePermissionOptions,\n\tRevokePermissionsOptions,\n\tUnpauseOptions,\n} from './types.js';\nimport { SuiGroupsCall } from './call.js';\nimport { SuiGroupsTransactions } from './transactions.js';\nimport { SuiGroupsBCS } from './bcs.js';\nimport { SuiGroupsView } from './view.js';\n\nexport function suiGroups<const Name = 'groups'>({\n\tname = 'groups' as Name,\n\twitnessType,\n\tpackageConfig,\n}: {\n\tname?: Name;\n\t/** The witness type from the extending package (e.g., '0xabc::my_module::MY_WITNESS') */\n\twitnessType: string;\n\tpackageConfig?: SuiGroupsPackageConfig;\n}) {\n\treturn {\n\t\tname,\n\t\tregister: (client: ClientWithCoreApi) => {\n\t\t\treturn new SuiGroupsClient({ client, witnessType, packageConfig });\n\t\t},\n\t};\n}\n\nexport class SuiGroupsClient {\n\t#packageConfig: SuiGroupsPackageConfig;\n\t#client: SuiGroupsCompatibleClient;\n\t#witnessType: string;\n\n\tcall: SuiGroupsCall;\n\ttx: SuiGroupsTransactions;\n\tview: SuiGroupsView;\n\tbcs: SuiGroupsBCS;\n\n\tconstructor(options: SuiGroupsClientOptions) {\n\t\tif (!options.client) {\n\t\t\tthrow new SuiGroupsClientError('client must be provided');\n\t\t}\n\t\tthis.#client = options.client;\n\n\t\tif (!options.witnessType) {\n\t\t\tthrow new SuiGroupsClientError('witnessType must be provided');\n\t\t}\n\t\tSuiGroupsClient.#validateWitnessType(options.witnessType);\n\t\tthis.#witnessType = options.witnessType;\n\n\t\t// Use custom packageConfig if provided, otherwise determine from network\n\t\tif (options.packageConfig) {\n\t\t\tthis.#packageConfig = options.packageConfig;\n\t\t} else {\n\t\t\tconst network = options.client.network;\n\t\t\tswitch (network) {\n\t\t\t\tcase 'testnet':\n\t\t\t\t\tthis.#packageConfig = TESTNET_SUI_GROUPS_PACKAGE_CONFIG;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'mainnet':\n\t\t\t\t\tthis.#packageConfig = MAINNET_SUI_GROUPS_PACKAGE_CONFIG;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new SuiGroupsClientError(\n\t\t\t\t\t\t`Unsupported network: ${network}. Provide a custom packageConfig for localnet/devnet.`,\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.call = new SuiGroupsCall({\n\t\t\tpackageConfig: this.#packageConfig,\n\t\t\twitnessType: this.#witnessType,\n\t\t});\n\t\tthis.bcs = new SuiGroupsBCS({\n\t\t\tpackageConfig: this.#packageConfig,\n\t\t\twitnessType: this.#witnessType,\n\t\t});\n\t\tthis.tx = new SuiGroupsTransactions({\n\t\t\tcall: this.call,\n\t\t});\n\t\tthis.view = new SuiGroupsView({\n\t\t\tpackageConfig: this.#packageConfig,\n\t\t\twitnessType: this.#witnessType,\n\t\t\tclient: this.#client,\n\t\t});\n\t}\n\n\t// === Private Helpers ===\n\n\t/**\n\t * Executes a transaction with the given signer and waits for confirmation.\n\t * @throws {SuiGroupsClientError} if the transaction fails\n\t */\n\tasync #executeTransaction(transaction: Transaction, signer: Signer, action: string) {\n\t\ttransaction.setSenderIfNotSet(signer.toSuiAddress());\n\n\t\tconst result = await signer.signAndExecuteTransaction({\n\t\t\ttransaction,\n\t\t\tclient: this.#client,\n\t\t});\n\n\t\tconst tx = result.Transaction ?? result.FailedTransaction;\n\t\tif (!tx) {\n\t\t\tthrow new SuiGroupsClientError(`Failed to ${action}: no transaction result`);\n\t\t}\n\n\t\tif (!tx.status.success) {\n\t\t\tthrow new SuiGroupsClientError(`Failed to ${action} (${tx.digest}): ${tx.status.error}`);\n\t\t}\n\n\t\tawait this.#client.core.waitForTransaction({ result });\n\n\t\treturn { digest: tx.digest, effects: tx.effects };\n\t}\n\n\t/**\n\t * Validates that a witnessType is a valid Move struct tag.\n\t * @throws {SuiGroupsClientError} if the witnessType is invalid\n\t */\n\tstatic #validateWitnessType(witnessType: string): void {\n\t\t// Must have at least 3 parts: address::module::name\n\t\tconst parts = witnessType.split('::');\n\t\tif (parts.length < 3) {\n\t\t\tthrow new SuiGroupsClientError(\n\t\t\t\t`Invalid witnessType: \"${witnessType}\". Must be a valid Move type (e.g., '0xabc::module::Type').`,\n\t\t\t);\n\t\t}\n\t\tconst [address] = parts;\n\t\tif (!isValidSuiAddress(address) && !isValidNamedPackage(address)) {\n\t\t\tthrow new SuiGroupsClientError(\n\t\t\t\t`Invalid witnessType address: \"${address}\". Must be a valid Sui address or MVR package name.`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// === Top-Level Imperative Methods ===\n\n\t/**\n\t * Grants a permission to a member.\n\t * If the member doesn't exist, they are automatically added to the group.\n\t */\n\tasync grantPermission({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: GrantPermissionOptions & { transaction?: Transaction }) {\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.grantPermission({ transaction, ...callOptions }),\n\t\t\tsigner,\n\t\t\t'grant permission',\n\t\t);\n\t}\n\n\t/**\n\t * Grants multiple permissions to a member in a single transaction.\n\t */\n\tasync grantPermissions({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: GrantPermissionsOptions & { transaction?: Transaction }) {\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.grantPermissions({ transaction, ...callOptions }),\n\t\t\tsigner,\n\t\t\t'grant permissions',\n\t\t);\n\t}\n\n\t/**\n\t * Adds multiple members to a group, each with their own set of permissions.\n\t * Members who already exist will simply receive the additional permissions.\n\t */\n\tasync addMembers({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: AddMembersOptions & { transaction?: Transaction }) {\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.addMembers({ transaction, ...callOptions }),\n\t\t\tsigner,\n\t\t\t'add members',\n\t\t);\n\t}\n\n\t/**\n\t * Revokes a permission from a member.\n\t * If this is the member's last permission, they are automatically removed.\n\t */\n\tasync revokePermission({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: RevokePermissionOptions & { transaction?: Transaction }) {\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.revokePermission({ transaction, ...callOptions }),\n\t\t\tsigner,\n\t\t\t'revoke permission',\n\t\t);\n\t}\n\n\t/**\n\t * Revokes multiple permissions from a member in a single transaction.\n\t */\n\tasync revokePermissions({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: RevokePermissionsOptions & { transaction?: Transaction }) {\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.revokePermissions({ transaction, ...callOptions }),\n\t\t\tsigner,\n\t\t\t'revoke permissions',\n\t\t);\n\t}\n\n\t/**\n\t * Removes a member from the PermissionedGroup.\n\t * Requires PermissionsAdmin permission.\n\t */\n\tasync removeMember({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: RemoveMemberOptions & { transaction?: Transaction }) {\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.removeMember({ transaction, ...callOptions }),\n\t\t\tsigner,\n\t\t\t'remove member',\n\t\t);\n\t}\n\n\t/**\n\t * Pauses the group and transfers the `UnpauseCap` to the given recipient\n\t * (defaults to the transaction sender, or the signer's address).\n\t */\n\tasync pause({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: PauseOptions & { transaction?: Transaction }) {\n\t\tconst recipient =\n\t\t\tcallOptions.unpauseCapRecipient ?? transaction?.getData().sender ?? signer.toSuiAddress();\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.pause({ transaction, ...callOptions, unpauseCapRecipient: recipient }),\n\t\t\tsigner,\n\t\t\t'pause group',\n\t\t);\n\t}\n\n\t/**\n\t * Unpauses the group. Consumes and destroys the `UnpauseCap`.\n\t * The signer must own the `UnpauseCap` object.\n\t */\n\tasync unpause({\n\t\tsigner,\n\t\ttransaction,\n\t\t...callOptions\n\t}: UnpauseOptions & { transaction?: Transaction }) {\n\t\treturn this.#executeTransaction(\n\t\t\tthis.tx.unpause({ transaction, ...callOptions }),\n\t\t\tsigner,\n\t\t\t'unpause group',\n\t\t);\n\t}\n}\n"],"mappings":"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"}
@@ -0,0 +1,65 @@
1
+ //#region src/constants.d.ts
2
+ declare const TESTNET_SUI_GROUPS_PACKAGE_CONFIG: {
3
+ originalPackageId: string;
4
+ latestPackageId: string;
5
+ };
6
+ declare const MAINNET_SUI_GROUPS_PACKAGE_CONFIG: {
7
+ originalPackageId: string;
8
+ latestPackageId: string;
9
+ };
10
+ /**
11
+ * Returns the full Move type name for the `PausedMarker` struct.
12
+ * Used to derive the dynamic field ID that indicates a paused group.
13
+ *
14
+ * @param packageId - The **original (V1)** permissioned-groups package ID.
15
+ */
16
+ declare function pausedMarkerType(packageId: string): string;
17
+ /**
18
+ * Returns full Move type paths for core permissions intended for human members.
19
+ *
20
+ * Does **not** include `ObjectAdmin` — that permission is reserved for actor objects
21
+ * (e.g., `GroupManager`, `GroupLeaver`) and should be granted via
22
+ * {@link actorObjectPermissionTypes} instead.
23
+ *
24
+ * @param packageId - The **original (V1)** package ID. The TypeNames stored in the
25
+ * PermissionsTable always use V1 addresses (via `type_name::with_original_ids`).
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const perms = permissionTypes('0xabc...');
30
+ * // perms.PermissionsAdmin === '0xabc...::permissioned_group::PermissionsAdmin'
31
+ *
32
+ * await client.groups.grantPermission({
33
+ * groupId, member, signer,
34
+ * permissionType: perms.PermissionsAdmin,
35
+ * });
36
+ * ```
37
+ */
38
+ declare function permissionTypes(packageId: string): {
39
+ readonly PermissionsAdmin: `${string}::permissioned_group::PermissionsAdmin`;
40
+ readonly ExtensionPermissionsAdmin: `${string}::permissioned_group::ExtensionPermissionsAdmin`;
41
+ readonly GroupDeleter: `${string}::permissioned_group::GroupDeleter`;
42
+ };
43
+ /**
44
+ * Returns full Move type paths for permissions reserved for actor objects.
45
+ *
46
+ * Actor objects are on-chain singletons (e.g., `GroupManager`, `GroupLeaver`) that
47
+ * hold permissions on behalf of the contract. `ObjectAdmin` grants raw `&mut UID`
48
+ * access and should never be granted to human members.
49
+ *
50
+ * @param packageId - The **original (V1)** package ID.
51
+ */
52
+ declare function actorObjectPermissionTypes(packageId: string): {
53
+ readonly ObjectAdmin: `${string}::permissioned_group::ObjectAdmin`;
54
+ };
55
+ /**
56
+ * Returns the full Move type name for `PermissionedGroup<T>`.
57
+ *
58
+ * @param packageId - The **original (V1)** permissioned-groups package ID.
59
+ * TypeNames on-chain always use V1 addresses (via `type_name::with_original_ids`).
60
+ * @param witnessType - The witness type parameter (e.g., `0xdef::messaging::Messaging`)
61
+ */
62
+ declare function permissionedGroupType(packageId: string, witnessType: string): string;
63
+ //#endregion
64
+ export { MAINNET_SUI_GROUPS_PACKAGE_CONFIG, TESTNET_SUI_GROUPS_PACKAGE_CONFIG, actorObjectPermissionTypes, pausedMarkerType, permissionTypes, permissionedGroupType };
65
+ //# sourceMappingURL=constants.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"mappings":";cAKa,iCAAA;EAGqB,iBAAA;EAAA,eAAA;AAAA;AAAA,cAErB,iCAAA;EAGqB,iBAAA;EAAA,eAAA;AAAA;;;;AAuClC;;;iBAzBgB,gBAAA,CAAiB,SAAA;;;;;;;AA0CjC;;;;;AAaA;;;;;;;;;;iBA9BgB,eAAA,CAAgB,SAAA;EAAA;;;;;;;;;;;;;iBAiBhB,0BAAA,CAA2B,SAAA;EAAA,SAAA,WAAA;AAAA;;;;;;;;iBAa3B,qBAAA,CAAsB,SAAA,UAAmB,WAAA"}
@@ -0,0 +1,77 @@
1
+ //#region src/constants.ts
2
+ const TESTNET_SUI_GROUPS_PACKAGE_CONFIG = {
3
+ originalPackageId: "0xba8a26d42bc8b5e5caf4dac2a0f7544128d5dd9b4614af88eec1311ade11de79",
4
+ latestPackageId: "0xba8a26d42bc8b5e5caf4dac2a0f7544128d5dd9b4614af88eec1311ade11de79"
5
+ };
6
+ const MAINNET_SUI_GROUPS_PACKAGE_CONFIG = {
7
+ originalPackageId: "0x541840ae7df705d1c6329c22415ed61f9140a18b79b13c1c9dc7415b115c1ba8",
8
+ latestPackageId: "0x541840ae7df705d1c6329c22415ed61f9140a18b79b13c1c9dc7415b115c1ba8"
9
+ };
10
+ /**
11
+ * The derivation key used to derive the PermissionsTable from a PermissionedGroup.
12
+ * Must match the Move constant `PERMISSIONS_TABLE_DERIVATION_KEY_BYTES` in `permissioned_group.move`.
13
+ */
14
+ const PERMISSIONS_TABLE_DERIVATION_KEY = "permissions_table";
15
+ /**
16
+ * Returns the full Move type name for the `PausedMarker` struct.
17
+ * Used to derive the dynamic field ID that indicates a paused group.
18
+ *
19
+ * @param packageId - The **original (V1)** permissioned-groups package ID.
20
+ */
21
+ function pausedMarkerType(packageId) {
22
+ return `${packageId}::permissioned_group::PausedMarker`;
23
+ }
24
+ /**
25
+ * Returns full Move type paths for core permissions intended for human members.
26
+ *
27
+ * Does **not** include `ObjectAdmin` — that permission is reserved for actor objects
28
+ * (e.g., `GroupManager`, `GroupLeaver`) and should be granted via
29
+ * {@link actorObjectPermissionTypes} instead.
30
+ *
31
+ * @param packageId - The **original (V1)** package ID. The TypeNames stored in the
32
+ * PermissionsTable always use V1 addresses (via `type_name::with_original_ids`).
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const perms = permissionTypes('0xabc...');
37
+ * // perms.PermissionsAdmin === '0xabc...::permissioned_group::PermissionsAdmin'
38
+ *
39
+ * await client.groups.grantPermission({
40
+ * groupId, member, signer,
41
+ * permissionType: perms.PermissionsAdmin,
42
+ * });
43
+ * ```
44
+ */
45
+ function permissionTypes(packageId) {
46
+ return {
47
+ PermissionsAdmin: `${packageId}::permissioned_group::PermissionsAdmin`,
48
+ ExtensionPermissionsAdmin: `${packageId}::permissioned_group::ExtensionPermissionsAdmin`,
49
+ GroupDeleter: `${packageId}::permissioned_group::GroupDeleter`
50
+ };
51
+ }
52
+ /**
53
+ * Returns full Move type paths for permissions reserved for actor objects.
54
+ *
55
+ * Actor objects are on-chain singletons (e.g., `GroupManager`, `GroupLeaver`) that
56
+ * hold permissions on behalf of the contract. `ObjectAdmin` grants raw `&mut UID`
57
+ * access and should never be granted to human members.
58
+ *
59
+ * @param packageId - The **original (V1)** package ID.
60
+ */
61
+ function actorObjectPermissionTypes(packageId) {
62
+ return { ObjectAdmin: `${packageId}::permissioned_group::ObjectAdmin` };
63
+ }
64
+ /**
65
+ * Returns the full Move type name for `PermissionedGroup<T>`.
66
+ *
67
+ * @param packageId - The **original (V1)** permissioned-groups package ID.
68
+ * TypeNames on-chain always use V1 addresses (via `type_name::with_original_ids`).
69
+ * @param witnessType - The witness type parameter (e.g., `0xdef::messaging::Messaging`)
70
+ */
71
+ function permissionedGroupType(packageId, witnessType) {
72
+ return `${packageId}::permissioned_group::PermissionedGroup<${witnessType}>`;
73
+ }
74
+
75
+ //#endregion
76
+ export { MAINNET_SUI_GROUPS_PACKAGE_CONFIG, PERMISSIONS_TABLE_DERIVATION_KEY, TESTNET_SUI_GROUPS_PACKAGE_CONFIG, actorObjectPermissionTypes, pausedMarkerType, permissionTypes, permissionedGroupType };
77
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { SuiGroupsPackageConfig } from './types.js';\n\nexport const TESTNET_SUI_GROUPS_PACKAGE_CONFIG = {\n\toriginalPackageId: '0xba8a26d42bc8b5e5caf4dac2a0f7544128d5dd9b4614af88eec1311ade11de79',\n\tlatestPackageId: '0xba8a26d42bc8b5e5caf4dac2a0f7544128d5dd9b4614af88eec1311ade11de79',\n} satisfies SuiGroupsPackageConfig;\n\nexport const MAINNET_SUI_GROUPS_PACKAGE_CONFIG = {\n\toriginalPackageId: '0x541840ae7df705d1c6329c22415ed61f9140a18b79b13c1c9dc7415b115c1ba8',\n\tlatestPackageId: '0x541840ae7df705d1c6329c22415ed61f9140a18b79b13c1c9dc7415b115c1ba8',\n} satisfies SuiGroupsPackageConfig;\n\n/**\n * The derivation key used to derive the PermissionsTable from a PermissionedGroup.\n * Must match the Move constant `PERMISSIONS_TABLE_DERIVATION_KEY_BYTES` in `permissioned_group.move`.\n */\nexport const PERMISSIONS_TABLE_DERIVATION_KEY = 'permissions_table';\n\n/**\n * Returns the full Move type name for the `PausedMarker` struct.\n * Used to derive the dynamic field ID that indicates a paused group.\n *\n * @param packageId - The **original (V1)** permissioned-groups package ID.\n */\nexport function pausedMarkerType(packageId: string): string {\n\treturn `${packageId}::permissioned_group::PausedMarker`;\n}\n\n/**\n * Returns full Move type paths for core permissions intended for human members.\n *\n * Does **not** include `ObjectAdmin` — that permission is reserved for actor objects\n * (e.g., `GroupManager`, `GroupLeaver`) and should be granted via\n * {@link actorObjectPermissionTypes} instead.\n *\n * @param packageId - The **original (V1)** package ID. The TypeNames stored in the\n * PermissionsTable always use V1 addresses (via `type_name::with_original_ids`).\n *\n * @example\n * ```ts\n * const perms = permissionTypes('0xabc...');\n * // perms.PermissionsAdmin === '0xabc...::permissioned_group::PermissionsAdmin'\n *\n * await client.groups.grantPermission({\n * groupId, member, signer,\n * permissionType: perms.PermissionsAdmin,\n * });\n * ```\n */\nexport function permissionTypes(packageId: string) {\n\treturn {\n\t\tPermissionsAdmin: `${packageId}::permissioned_group::PermissionsAdmin`,\n\t\tExtensionPermissionsAdmin: `${packageId}::permissioned_group::ExtensionPermissionsAdmin`,\n\t\tGroupDeleter: `${packageId}::permissioned_group::GroupDeleter`,\n\t} as const;\n}\n\n/**\n * Returns full Move type paths for permissions reserved for actor objects.\n *\n * Actor objects are on-chain singletons (e.g., `GroupManager`, `GroupLeaver`) that\n * hold permissions on behalf of the contract. `ObjectAdmin` grants raw `&mut UID`\n * access and should never be granted to human members.\n *\n * @param packageId - The **original (V1)** package ID.\n */\nexport function actorObjectPermissionTypes(packageId: string) {\n\treturn {\n\t\tObjectAdmin: `${packageId}::permissioned_group::ObjectAdmin`,\n\t} as const;\n}\n\n/**\n * Returns the full Move type name for `PermissionedGroup<T>`.\n *\n * @param packageId - The **original (V1)** permissioned-groups package ID.\n * TypeNames on-chain always use V1 addresses (via `type_name::with_original_ids`).\n * @param witnessType - The witness type parameter (e.g., `0xdef::messaging::Messaging`)\n */\nexport function permissionedGroupType(packageId: string, witnessType: string): string {\n\treturn `${packageId}::permissioned_group::PermissionedGroup<${witnessType}>`;\n}\n"],"mappings":";AAKA,MAAa,oCAAoC;CAChD,mBAAmB;CACnB,iBAAiB;CACjB;AAED,MAAa,oCAAoC;CAChD,mBAAmB;CACnB,iBAAiB;CACjB;;;;;AAMD,MAAa,mCAAmC;;;;;;;AAQhD,SAAgB,iBAAiB,WAA2B;AAC3D,QAAO,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;;;;AAwBrB,SAAgB,gBAAgB,WAAmB;AAClD,QAAO;EACN,kBAAkB,GAAG,UAAU;EAC/B,2BAA2B,GAAG,UAAU;EACxC,cAAc,GAAG,UAAU;EAC3B;;;;;;;;;;;AAYF,SAAgB,2BAA2B,WAAmB;AAC7D,QAAO,EACN,aAAa,GAAG,UAAU,oCAC1B;;;;;;;;;AAUF,SAAgB,sBAAsB,WAAmB,aAA6B;AACrF,QAAO,GAAG,UAAU,0CAA0C,YAAY"}
@@ -0,0 +1,17 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/sui_groups/deps/std/type_name.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ /** Functionality for converting Move types into values. Use with care! */
9
+ const $moduleName = "std::type_name";
10
+ const TypeName = new MoveStruct({
11
+ name: `${$moduleName}::TypeName`,
12
+ fields: { name: bcs.string() }
13
+ });
14
+
15
+ //#endregion
16
+ export { TypeName };
17
+ //# sourceMappingURL=type_name.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type_name.mjs","names":[],"sources":["../../../../../src/contracts/sui_groups/deps/std/type_name.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/** Functionality for converting Move types into values. Use with care! */\n\nimport { MoveStruct } from '../../../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nconst $moduleName = 'std::type_name';\nexport const TypeName = new MoveStruct({\n\tname: `${$moduleName}::TypeName`,\n\tfields: {\n\t\t/**\n\t\t * String representation of the type. All types are represented using their source\n\t\t * syntax: \"u8\", \"u64\", \"bool\", \"address\", \"vector\", and so on for primitive types.\n\t\t * Struct types are represented as fully qualified type names; e.g.\n\t\t * `00000000000000000000000000000001::string::String` or\n\t\t * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`\n\t\t * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or\n\t\t * 32 depending on the Move platform)\n\t\t */\n\t\tname: bcs.string(),\n\t},\n});\n"],"mappings":";;;;;;;;AAQA,MAAM,cAAc;AACpB,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ,EAUP,MAAM,IAAI,QAAQ,EAClB;CACD,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { MoveStruct, MoveTuple } from "../utils/index.mjs";
2
+ import { BcsType } from "@mysten/sui/bcs";
3
+ import { Transaction } from "@mysten/sui/transactions";
4
+
5
+ //#region src/contracts/sui_groups/permissioned_group.d.ts
6
+ declare const PermissionsAdmin: MoveTuple<readonly [BcsType<boolean, boolean, "bool">], "@local-pkg/sui-groups::permissioned_group::PermissionsAdmin">;
7
+ declare const ExtensionPermissionsAdmin: MoveTuple<readonly [BcsType<boolean, boolean, "bool">], "@local-pkg/sui-groups::permissioned_group::ExtensionPermissionsAdmin">;
8
+ declare const ObjectAdmin: MoveTuple<readonly [BcsType<boolean, boolean, "bool">], "@local-pkg/sui-groups::permissioned_group::ObjectAdmin">;
9
+ declare const GroupDeleter: MoveTuple<readonly [BcsType<boolean, boolean, "bool">], "@local-pkg/sui-groups::permissioned_group::GroupDeleter">;
10
+ /**
11
+ * Group state mapping addresses to their granted permissions. Parameterized by `T`
12
+ * to scope permissions to a specific package.
13
+ */
14
+ declare function PermissionedGroup<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
15
+ id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
16
+ /**
17
+ * Maps member addresses (user or object) to their permission set. Object addresses
18
+ * enable `object_*` functions for third-party "actor" contracts.
19
+ */
20
+ permissions: MoveStruct<{
21
+ id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
22
+ length: BcsType<string, string | number | bigint, "u64">;
23
+ }, "@local-pkg/sui-groups::permissions_table::PermissionsTable">; /** Tracks `PermissionsAdmin` count to enforce at-least-one invariant. */
24
+ permissions_admin_count: BcsType<string, string | number | bigint, "u64">; /** Original creator's address */
25
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
26
+ }, `@local-pkg/sui-groups::permissioned_group::PermissionedGroup<${T["name"]}>`>;
27
+ declare const PausedMarker: MoveTuple<readonly [BcsType<boolean, boolean, "bool">], "@local-pkg/sui-groups::permissioned_group::PausedMarker">;
28
+ /** Emitted when a new PermissionedGroup is created via `new`. */
29
+ declare function GroupCreated<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
30
+ /** ID of the created group. */group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Address of the group creator. */
31
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
32
+ }, `@local-pkg/sui-groups::permissioned_group::GroupCreated<${T["name"]}>`>;
33
+ /** Emitted when a new member is added to a group via grant_permission. */
34
+ declare function MemberAdded<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
35
+ /** ID of the group. */group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Address of the new member. */
36
+ member: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
37
+ }, `@local-pkg/sui-groups::permissioned_group::MemberAdded<${T["name"]}>`>;
38
+ /** Emitted when a member is removed from a group. */
39
+ declare function MemberRemoved<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
40
+ /** ID of the group. */group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Address of the removed member. */
41
+ member: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
42
+ }, `@local-pkg/sui-groups::permissioned_group::MemberRemoved<${T["name"]}>`>;
43
+ /** Emitted when permissions are granted to a member. */
44
+ declare function PermissionsGranted<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
45
+ /** ID of the group. */group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Address of the member receiving the permissions. */
46
+ member: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Type names of the granted permissions. */
47
+ permissions: BcsType<{
48
+ name: string;
49
+ }[], Iterable<{
50
+ name: string;
51
+ }> & {
52
+ length: number;
53
+ }, string>;
54
+ }, `@local-pkg/sui-groups::permissioned_group::PermissionsGranted<${T["name"]}>`>;
55
+ /** Emitted when permissions are revoked from a member. */
56
+ declare function PermissionsRevoked<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
57
+ /** ID of the group. */group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Address of the member losing the permissions. */
58
+ member: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Type names of the revoked permissions. */
59
+ permissions: BcsType<{
60
+ name: string;
61
+ }[], Iterable<{
62
+ name: string;
63
+ }> & {
64
+ length: number;
65
+ }, string>;
66
+ }, `@local-pkg/sui-groups::permissioned_group::PermissionsRevoked<${T["name"]}>`>;
67
+ /** Emitted when a PermissionedGroup is deleted via `delete`. */
68
+ declare function GroupDeleted<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
69
+ /** ID of the deleted group. */group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Address of the caller who deleted the group. */
70
+ deleter: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
71
+ }, `@local-pkg/sui-groups::permissioned_group::GroupDeleted<${T["name"]}>`>;
72
+ /** Emitted when a PermissionedGroup is paused via `pause`. */
73
+ declare function GroupPaused<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
74
+ group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
75
+ paused_by: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
76
+ }, `@local-pkg/sui-groups::permissioned_group::GroupPaused<${T["name"]}>`>;
77
+ /** Emitted when a PermissionedGroup is unpaused via `unpause`. */
78
+ declare function GroupUnpaused<T extends BcsType<any>>(...typeParameters: [T]): MoveStruct<{
79
+ group_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
80
+ unpaused_by: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
81
+ }, `@local-pkg/sui-groups::permissioned_group::GroupUnpaused<${T["name"]}>`>;
82
+ //#endregion
83
+ export { ExtensionPermissionsAdmin, GroupCreated, GroupDeleted, GroupDeleter, GroupPaused, GroupUnpaused, MemberAdded, MemberRemoved, ObjectAdmin, PausedMarker, PermissionedGroup, PermissionsAdmin, PermissionsGranted, PermissionsRevoked };
84
+ //# sourceMappingURL=permissioned_group.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissioned_group.d.mts","names":[],"sources":["../../../src/contracts/sui_groups/permissioned_group.ts"],"mappings":";;;;;cA4Da,gBAAA,EAAgB,SAAA,WAAA,OAAA;AAAA,cAIhB,yBAAA,EAAyB,SAAA,WAAA,OAAA;AAAA,cAIzB,WAAA,EAAW,SAAA,WAAA,OAAA;AAAA,cAIX,YAAA,EAAY,SAAA,WAAA,OAAA;;;;;iBAQT,iBAAA,WAA4B,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;;;;;;;;;;;;;cAiBnE,YAAA,EAAY,SAAA,WAAA,OAAA;;iBAKT,YAAA,WAAuB,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;EALlD,6GAKG;;;;iBA8BZ,WAAA,WAAsB,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;EA9BlB,qGAAmB;;;;iBA0C3D,aAAA,WAAwB,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;;;;;iBAY5D,kBAAA,WAA6B,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;EAxBjE,qGAAW;8EAA6C;;;;;;;;;;iBAsCxD,kBAAA,WAA6B,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;EAtCrD,qGAA2B;8EAAmB;;;;;;;;;;iBAoD1D,YAAA,WAAuB,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;+GAxC9C;;;;iBAoDb,WAAA,WAAsB,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA;;;;;iBAU1D,aAAA,WAAwB,OAAA,MAAA,CAAA,GAAiB,cAAA,GAAiB,CAAA,IAAE,UAAA"}