@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
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @mysten/sui-groups
2
+
3
+ TypeScript SDK for permissioned groups on Sui. Create and manage groups with fine-grained, on-chain
4
+ permissions using the [sui_groups](https://github.com/MystenLabs/sui-groups) Move package.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install @mysten/sui-groups
10
+ ```
11
+
12
+ Peer dependencies: `@mysten/sui`, `@mysten/bcs`
13
+
14
+ ## Quick Start
15
+
16
+ ```ts
17
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
18
+ import { suiGroups } from '@mysten/sui-groups';
19
+
20
+ // Create a Sui client extended with groups
21
+ const client = new SuiGrpcClient({ network: 'testnet' }).$extend(
22
+ suiGroups({
23
+ // The witness type from your extending Move package
24
+ witnessType: '0xYOUR_PACKAGE::module::WITNESS',
25
+ }),
26
+ );
27
+
28
+ // Add members with permissions
29
+ await client.groups.addMembers({
30
+ signer,
31
+ groupId: '0x...',
32
+ members: [
33
+ {
34
+ address: '0xalice...',
35
+ permissions: ['0xYOUR_PACKAGE::module::Reader', '0xYOUR_PACKAGE::module::Writer'],
36
+ },
37
+ { address: '0xbob...', permissions: ['0xYOUR_PACKAGE::module::Reader'] },
38
+ ],
39
+ });
40
+
41
+ // Grant / revoke permissions
42
+ await client.groups.grantPermission({
43
+ signer,
44
+ groupId: '0x...',
45
+ member: '0xalice...',
46
+ permissionType: '0xYOUR_PACKAGE::module::Admin',
47
+ });
48
+ await client.groups.revokePermission({
49
+ signer,
50
+ groupId: '0x...',
51
+ member: '0xbob...',
52
+ permissionType: '0xYOUR_PACKAGE::module::Writer',
53
+ });
54
+
55
+ // Remove a member
56
+ await client.groups.removeMember({ signer, groupId: '0x...', member: '0xbob...' });
57
+
58
+ // Pause / unpause a group
59
+ await client.groups.pause({ signer, groupId: '0x...' });
60
+ await client.groups.unpause({ signer, groupId: '0x...', unpauseCapId: '0x...' });
61
+ ```
62
+
63
+ ## Client Extension Pattern
64
+
65
+ The SDK uses Sui's client extension system. Call `$extend(suiGroups(...))` on any Sui client
66
+ (`SuiGrpcClient`, `SuiGraphQLClient`, etc.) to add the `.groups` property:
67
+
68
+ ```ts
69
+ const client = suiClient.$extend(
70
+ suiGroups({
71
+ witnessType: '0xYOUR_PACKAGE::module::WITNESS',
72
+ // Optional: override package config for localnet/devnet
73
+ packageConfig: { originalPackageId: '0x...', latestPackageId: '0x...' },
74
+ }),
75
+ );
76
+
77
+ client.groups; // SuiGroupsClient instance
78
+ client.groups.tx; // Transaction builders (returns Transaction, doesn't execute)
79
+ client.groups.call; // Low-level Move call builders
80
+ client.groups.view; // Read-only queries
81
+ client.groups.bcs; // BCS parsing utilities
82
+ ```
83
+
84
+ ## API
85
+
86
+ ### Top-Level Methods
87
+
88
+ These sign, execute, and wait for the transaction:
89
+
90
+ | Method | Description |
91
+ | --------------------- | --------------------------------------------------- |
92
+ | `addMembers()` | Add members with permissions (idempotent) |
93
+ | `grantPermission()` | Grant a permission (adds the member if they're new) |
94
+ | `grantPermissions()` | Grant multiple permissions in one transaction |
95
+ | `revokePermission()` | Revoke a permission (removes member if last one) |
96
+ | `revokePermissions()` | Revoke multiple permissions in one transaction |
97
+ | `removeMember()` | Remove a member entirely |
98
+ | `pause()` | Pause the group, receive an `UnpauseCap` |
99
+ | `unpause()` | Unpause the group by consuming the `UnpauseCap` |
100
+
101
+ ### Transaction Builders (`client.groups.tx`)
102
+
103
+ Same methods as above, but return a `Transaction` object without executing. Useful for composing
104
+ with other transactions.
105
+
106
+ ## License
107
+
108
+ Apache-2.0
package/dist/bcs.d.mts ADDED
@@ -0,0 +1,82 @@
1
+ import { SuiGroupsPackageConfig } from "./types.mjs";
2
+ import { ExtensionPermissionsAdmin, GroupCreated, GroupDeleted, GroupDeleter, GroupPaused, GroupUnpaused, MemberAdded, MemberRemoved, ObjectAdmin, PausedMarker, PermissionedGroup, PermissionsAdmin, PermissionsGranted, PermissionsRevoked } from "./contracts/sui_groups/permissioned_group.mjs";
3
+ import { BcsType } from "@mysten/sui/bcs";
4
+
5
+ //#region src/bcs.d.ts
6
+ type ParsedPermissionedGroup = ReturnType<typeof PermissionedGroup>['$inferType'];
7
+ type ParsedPermissionsAdmin = (typeof PermissionsAdmin)['$inferType'];
8
+ type ParsedExtensionPermissionsAdmin = (typeof ExtensionPermissionsAdmin)['$inferType'];
9
+ type ParsedObjectAdmin = (typeof ObjectAdmin)['$inferType'];
10
+ type ParsedGroupDeleter = (typeof GroupDeleter)['$inferType'];
11
+ type ParsedPausedMarker = (typeof PausedMarker)['$inferType'];
12
+ type ParsedGroupCreated = ReturnType<typeof GroupCreated>['$inferType'];
13
+ type ParsedGroupDerived<DerivationKey = unknown> = {
14
+ group_id: string;
15
+ creator: string;
16
+ parent_id: string;
17
+ derivation_key: DerivationKey;
18
+ };
19
+ type ParsedGroupDeleted = ReturnType<typeof GroupDeleted>['$inferType'];
20
+ type ParsedGroupPaused = ReturnType<typeof GroupPaused>['$inferType'];
21
+ type ParsedGroupUnpaused = ReturnType<typeof GroupUnpaused>['$inferType'];
22
+ type ParsedMemberAdded = ReturnType<typeof MemberAdded>['$inferType'];
23
+ type ParsedMemberRemoved = ReturnType<typeof MemberRemoved>['$inferType'];
24
+ type ParsedPermissionsGranted = ReturnType<typeof PermissionsGranted>['$inferType'];
25
+ type ParsedPermissionsRevoked = ReturnType<typeof PermissionsRevoked>['$inferType'];
26
+ interface SuiGroupsBCSOptions {
27
+ packageConfig: SuiGroupsPackageConfig;
28
+ witnessType: string;
29
+ }
30
+ /**
31
+ * BCS type definitions for the permissioned-groups package.
32
+ *
33
+ * Each instance creates transformed copies of the generated BCS types
34
+ * with the correct package ID in the type name, ensuring multiple SDK
35
+ * instances with different package configurations don't interfere.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const bcs = new SuiGroupsBCS({
40
+ * packageConfig: { packageId: '0x123...' }
41
+ * });
42
+ *
43
+ * const group = bcs.PermissionedGroup.parse(permissionedGroupObject.content);
44
+ * ```
45
+ */
46
+ declare class SuiGroupsBCS {
47
+ #private;
48
+ /** Core permission: manages core permissions from this package */
49
+ readonly PermissionsAdmin: BcsType<ParsedPermissionsAdmin, unknown>;
50
+ /** Core permission: manages extension permissions from other packages */
51
+ readonly ExtensionPermissionsAdmin: BcsType<ParsedExtensionPermissionsAdmin, unknown>;
52
+ /** Core permission: grants raw &mut UID access via the actor-object pattern */
53
+ readonly ObjectAdmin: BcsType<ParsedObjectAdmin, unknown>;
54
+ /** Core permission: allows destroying/deleting the group */
55
+ readonly GroupDeleter: BcsType<ParsedGroupDeleter, unknown>;
56
+ /** Dynamic field marker set when a group is paused */
57
+ readonly PausedMarker: BcsType<ParsedPausedMarker, unknown>;
58
+ /** Main group struct containing membership and permission data */
59
+ readonly PermissionedGroup: BcsType<ParsedPermissionedGroup, unknown>;
60
+ /** Event emitted when a group is created */
61
+ readonly GroupCreated: BcsType<ParsedGroupCreated, unknown>;
62
+ /** Event emitted when a group is deleted */
63
+ readonly GroupDeleted: BcsType<ParsedGroupDeleted, unknown>;
64
+ /** Event emitted when a group is paused */
65
+ readonly GroupPaused: BcsType<ParsedGroupPaused, unknown>;
66
+ /** Event emitted when a group is unpaused */
67
+ readonly GroupUnpaused: BcsType<ParsedGroupUnpaused, unknown>;
68
+ /** Event emitted when a member is added to a group */
69
+ readonly MemberAdded: BcsType<ParsedMemberAdded, unknown>;
70
+ /** Event emitted when a member is removed from a group */
71
+ readonly MemberRemoved: BcsType<ParsedMemberRemoved, unknown>;
72
+ /** Event emitted when permissions are granted to a member */
73
+ readonly PermissionsGranted: BcsType<ParsedPermissionsGranted, unknown>;
74
+ /** Event emitted when permissions are revoked from a member */
75
+ readonly PermissionsRevoked: BcsType<ParsedPermissionsRevoked, unknown>;
76
+ constructor(options: SuiGroupsBCSOptions);
77
+ /** Event emitted when a group is derived from a parent object */
78
+ GroupDerived<DerivationKey extends BcsType<any>>(derivationKeyType: DerivationKey): BcsType<ParsedGroupDerived<DerivationKey['$inferType']>, unknown>;
79
+ }
80
+ //#endregion
81
+ export { ParsedExtensionPermissionsAdmin, ParsedGroupCreated, ParsedGroupDeleted, ParsedGroupDeleter, ParsedGroupDerived, ParsedGroupPaused, ParsedGroupUnpaused, ParsedMemberAdded, ParsedMemberRemoved, ParsedObjectAdmin, ParsedPausedMarker, ParsedPermissionedGroup, ParsedPermissionsAdmin, ParsedPermissionsGranted, ParsedPermissionsRevoked, SuiGroupsBCS };
82
+ //# sourceMappingURL=bcs.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bcs.d.mts","names":[],"sources":["../src/bcs.ts"],"mappings":";;;;;KAyBY,uBAAA,GAA0B,UAAA,QAAkB,iBAAA;AAAA,KAC5C,sBAAA,WAAiC,gBAAA;AAAA,KACjC,+BAAA,WAA0C,yBAAA;AAAA,KAC1C,iBAAA,WAA4B,WAAA;AAAA,KAC5B,kBAAA,WAA6B,YAAA;AAAA,KAC7B,kBAAA,WAA6B,YAAA;AAAA,KAC7B,kBAAA,GAAqB,UAAA,QAAkB,YAAA;AAAA,KACvC,kBAAA;EACX,QAAA;EACA,OAAA;EACA,SAAA;EACA,cAAA,EAAgB,aAAA;AAAA;AAAA,KAEL,kBAAA,GAAqB,UAAA,QAAkB,YAAA;AAAA,KACvC,iBAAA,GAAoB,UAAA,QAAkB,WAAA;AAAA,KACtC,mBAAA,GAAsB,UAAA,QAAkB,aAAA;AAAA,KACxC,iBAAA,GAAoB,UAAA,QAAkB,WAAA;AAAA,KACtC,mBAAA,GAAsB,UAAA,QAAkB,aAAA;AAAA,KACxC,wBAAA,GAA2B,UAAA,QAAkB,kBAAA;AAAA,KAC7C,wBAAA,GAA2B,UAAA,QAAkB,kBAAA;AAAA,UAIxC,mBAAA;EAChB,aAAA,EAAe,sBAAA;EACf,WAAA;AAAA;;;;AApBD;;;;;AACA;;;;;AACA;;;cAqCa,YAAA;EAAA;EApCZ;EAAA,SAsCS,gBAAA,EAAkB,OAAA,CAAQ,sBAAA;EApCnC;EAAA,SAsCS,yBAAA,EAA2B,OAAA,CAAQ,+BAAA;EArC5B;EAAA,SAuCP,WAAA,EAAa,OAAA,CAAQ,iBAAA;EAvCD;EAAA,SAyCpB,YAAA,EAAc,OAAA,CAAQ,kBAAA;EAvCF;EAAA,SAyCpB,YAAA,EAAc,OAAA,CAAQ,kBAAA;EAzCC;EAAA,SA2CvB,iBAAA,EAAmB,OAAA,CAAQ,uBAAA;EA1CzB;EAAA,SA4CF,YAAA,EAAc,OAAA,CAAQ,kBAAA;;WAEtB,YAAA,EAAc,OAAA,CAAQ,kBAAA;EA9C6B;EAAA,SAgDnD,WAAA,EAAa,OAAA,CAAQ,iBAAA;EA/CA;EAAA,SAiDrB,aAAA,EAAe,OAAA,CAAQ,mBAAA;EAjDC;EAAA,SAmDxB,WAAA,EAAa,OAAA,CAAQ,iBAAA;EAlDnB;EAAA,SAoDF,aAAA,EAAe,OAAA,CAAQ,mBAAA;;WAEvB,kBAAA,EAAoB,OAAA,CAAQ,wBAAA;EAtDuB;EAAA,SAwDnD,kBAAA,EAAoB,OAAA,CAAQ,wBAAA;cAKzB,OAAA,EAAS,mBAAA;;EA+BrB,YAAA,uBAAmC,OAAA,MAAA,CAClC,iBAAA,EAAmB,aAAA,GACjB,OAAA,CAAQ,kBAAA,CAAmB,aAAA;AAAA"}
package/dist/bcs.mjs ADDED
@@ -0,0 +1,55 @@
1
+ import { ExtensionPermissionsAdmin, GroupCreated, GroupDeleted, GroupDeleter, GroupDerived, GroupPaused, GroupUnpaused, MemberAdded, MemberRemoved, ObjectAdmin, PausedMarker, PermissionedGroup, PermissionsAdmin, PermissionsGranted, PermissionsRevoked } from "./contracts/sui_groups/permissioned_group.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/bcs.ts
5
+ const LOCAL_PACKAGE_ALIAS = "@local-pkg/sui-groups";
6
+ /**
7
+ * BCS type definitions for the permissioned-groups package.
8
+ *
9
+ * Each instance creates transformed copies of the generated BCS types
10
+ * with the correct package ID in the type name, ensuring multiple SDK
11
+ * instances with different package configurations don't interfere.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const bcs = new SuiGroupsBCS({
16
+ * packageConfig: { packageId: '0x123...' }
17
+ * });
18
+ *
19
+ * const group = bcs.PermissionedGroup.parse(permissionedGroupObject.content);
20
+ * ```
21
+ */
22
+ var SuiGroupsBCS = class {
23
+ #phantomWitnessBcs;
24
+ #packageId;
25
+ constructor(options) {
26
+ this.#packageId = options.packageConfig.originalPackageId;
27
+ this.#phantomWitnessBcs = bcs.bool().transform({ name: options.witnessType });
28
+ this.PermissionsAdmin = this.#withPackageId(PermissionsAdmin);
29
+ this.ExtensionPermissionsAdmin = this.#withPackageId(ExtensionPermissionsAdmin);
30
+ this.ObjectAdmin = this.#withPackageId(ObjectAdmin);
31
+ this.GroupDeleter = this.#withPackageId(GroupDeleter);
32
+ this.PausedMarker = this.#withPackageId(PausedMarker);
33
+ this.PermissionedGroup = this.#withPackageId(PermissionedGroup(this.#phantomWitnessBcs));
34
+ this.GroupCreated = this.#withPackageId(GroupCreated(this.#phantomWitnessBcs));
35
+ this.GroupDeleted = this.#withPackageId(GroupDeleted(this.#phantomWitnessBcs));
36
+ this.GroupPaused = this.#withPackageId(GroupPaused(this.#phantomWitnessBcs));
37
+ this.GroupUnpaused = this.#withPackageId(GroupUnpaused(this.#phantomWitnessBcs));
38
+ this.MemberAdded = this.#withPackageId(MemberAdded(this.#phantomWitnessBcs));
39
+ this.MemberRemoved = this.#withPackageId(MemberRemoved(this.#phantomWitnessBcs));
40
+ this.PermissionsGranted = this.#withPackageId(PermissionsGranted(this.#phantomWitnessBcs));
41
+ this.PermissionsRevoked = this.#withPackageId(PermissionsRevoked(this.#phantomWitnessBcs));
42
+ }
43
+ /** Replaces the codegen local package alias with the real package ID in the BCS type name. */
44
+ #withPackageId(type) {
45
+ return type.transform({ name: type.name.replace(LOCAL_PACKAGE_ALIAS, this.#packageId) });
46
+ }
47
+ /** Event emitted when a group is derived from a parent object */
48
+ GroupDerived(derivationKeyType) {
49
+ return this.#withPackageId(GroupDerived(this.#phantomWitnessBcs, derivationKeyType));
50
+ }
51
+ };
52
+
53
+ //#endregion
54
+ export { SuiGroupsBCS };
55
+ //# sourceMappingURL=bcs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bcs.mjs","names":["#phantomWitnessBcs","#packageId","#withPackageId"],"sources":["../src/bcs.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs, type BcsType } from '@mysten/sui/bcs';\n\nimport type { SuiGroupsPackageConfig } from './types.js';\n\nimport {\n\tPermissionsAdmin,\n\tExtensionPermissionsAdmin,\n\tObjectAdmin,\n\tGroupDeleter,\n\tPausedMarker,\n\tGroupCreated,\n\tGroupDerived,\n\tGroupDeleted,\n\tGroupPaused,\n\tGroupUnpaused,\n\tMemberAdded,\n\tMemberRemoved,\n\tPermissionedGroup,\n\tPermissionsGranted,\n\tPermissionsRevoked,\n} from './contracts/sui_groups/permissioned_group.js';\n\nexport type ParsedPermissionedGroup = ReturnType<typeof PermissionedGroup>['$inferType'];\nexport type ParsedPermissionsAdmin = (typeof PermissionsAdmin)['$inferType'];\nexport type ParsedExtensionPermissionsAdmin = (typeof ExtensionPermissionsAdmin)['$inferType'];\nexport type ParsedObjectAdmin = (typeof ObjectAdmin)['$inferType'];\nexport type ParsedGroupDeleter = (typeof GroupDeleter)['$inferType'];\nexport type ParsedPausedMarker = (typeof PausedMarker)['$inferType'];\nexport type ParsedGroupCreated = ReturnType<typeof GroupCreated>['$inferType'];\nexport type ParsedGroupDerived<DerivationKey = unknown> = {\n\tgroup_id: string;\n\tcreator: string;\n\tparent_id: string;\n\tderivation_key: DerivationKey;\n};\nexport type ParsedGroupDeleted = ReturnType<typeof GroupDeleted>['$inferType'];\nexport type ParsedGroupPaused = ReturnType<typeof GroupPaused>['$inferType'];\nexport type ParsedGroupUnpaused = ReturnType<typeof GroupUnpaused>['$inferType'];\nexport type ParsedMemberAdded = ReturnType<typeof MemberAdded>['$inferType'];\nexport type ParsedMemberRemoved = ReturnType<typeof MemberRemoved>['$inferType'];\nexport type ParsedPermissionsGranted = ReturnType<typeof PermissionsGranted>['$inferType'];\nexport type ParsedPermissionsRevoked = ReturnType<typeof PermissionsRevoked>['$inferType'];\n\nconst LOCAL_PACKAGE_ALIAS = '@local-pkg/sui-groups';\n\nexport interface SuiGroupsBCSOptions {\n\tpackageConfig: SuiGroupsPackageConfig;\n\twitnessType: string;\n}\n\n/**\n * BCS type definitions for the permissioned-groups package.\n *\n * Each instance creates transformed copies of the generated BCS types\n * with the correct package ID in the type name, ensuring multiple SDK\n * instances with different package configurations don't interfere.\n *\n * @example\n * ```ts\n * const bcs = new SuiGroupsBCS({\n * packageConfig: { packageId: '0x123...' }\n * });\n *\n * const group = bcs.PermissionedGroup.parse(permissionedGroupObject.content);\n * ```\n */\nexport class SuiGroupsBCS {\n\t/** Core permission: manages core permissions from this package */\n\treadonly PermissionsAdmin: BcsType<ParsedPermissionsAdmin, unknown>;\n\t/** Core permission: manages extension permissions from other packages */\n\treadonly ExtensionPermissionsAdmin: BcsType<ParsedExtensionPermissionsAdmin, unknown>;\n\t/** Core permission: grants raw &mut UID access via the actor-object pattern */\n\treadonly ObjectAdmin: BcsType<ParsedObjectAdmin, unknown>;\n\t/** Core permission: allows destroying/deleting the group */\n\treadonly GroupDeleter: BcsType<ParsedGroupDeleter, unknown>;\n\t/** Dynamic field marker set when a group is paused */\n\treadonly PausedMarker: BcsType<ParsedPausedMarker, unknown>;\n\t/** Main group struct containing membership and permission data */\n\treadonly PermissionedGroup: BcsType<ParsedPermissionedGroup, unknown>;\n\t/** Event emitted when a group is created */\n\treadonly GroupCreated: BcsType<ParsedGroupCreated, unknown>;\n\t/** Event emitted when a group is deleted */\n\treadonly GroupDeleted: BcsType<ParsedGroupDeleted, unknown>;\n\t/** Event emitted when a group is paused */\n\treadonly GroupPaused: BcsType<ParsedGroupPaused, unknown>;\n\t/** Event emitted when a group is unpaused */\n\treadonly GroupUnpaused: BcsType<ParsedGroupUnpaused, unknown>;\n\t/** Event emitted when a member is added to a group */\n\treadonly MemberAdded: BcsType<ParsedMemberAdded, unknown>;\n\t/** Event emitted when a member is removed from a group */\n\treadonly MemberRemoved: BcsType<ParsedMemberRemoved, unknown>;\n\t/** Event emitted when permissions are granted to a member */\n\treadonly PermissionsGranted: BcsType<ParsedPermissionsGranted, unknown>;\n\t/** Event emitted when permissions are revoked from a member */\n\treadonly PermissionsRevoked: BcsType<ParsedPermissionsRevoked, unknown>;\n\n\treadonly #phantomWitnessBcs: BcsType<any>;\n\treadonly #packageId: string;\n\n\tconstructor(options: SuiGroupsBCSOptions) {\n\t\tthis.#packageId = options.packageConfig.originalPackageId;\n\n\t\t// Phantom BcsType that carries the witness type name for codegen functions.\n\t\t// Phantom types don't affect serialization, so the underlying type is irrelevant.\n\t\tthis.#phantomWitnessBcs = bcs.bool().transform({ name: options.witnessType });\n\n\t\tthis.PermissionsAdmin = this.#withPackageId(PermissionsAdmin);\n\t\tthis.ExtensionPermissionsAdmin = this.#withPackageId(ExtensionPermissionsAdmin);\n\t\tthis.ObjectAdmin = this.#withPackageId(ObjectAdmin);\n\t\tthis.GroupDeleter = this.#withPackageId(GroupDeleter);\n\t\tthis.PausedMarker = this.#withPackageId(PausedMarker);\n\t\tthis.PermissionedGroup = this.#withPackageId(PermissionedGroup(this.#phantomWitnessBcs));\n\t\tthis.GroupCreated = this.#withPackageId(GroupCreated(this.#phantomWitnessBcs));\n\t\tthis.GroupDeleted = this.#withPackageId(GroupDeleted(this.#phantomWitnessBcs));\n\t\tthis.GroupPaused = this.#withPackageId(GroupPaused(this.#phantomWitnessBcs));\n\t\tthis.GroupUnpaused = this.#withPackageId(GroupUnpaused(this.#phantomWitnessBcs));\n\t\tthis.MemberAdded = this.#withPackageId(MemberAdded(this.#phantomWitnessBcs));\n\t\tthis.MemberRemoved = this.#withPackageId(MemberRemoved(this.#phantomWitnessBcs));\n\t\tthis.PermissionsGranted = this.#withPackageId(PermissionsGranted(this.#phantomWitnessBcs));\n\t\tthis.PermissionsRevoked = this.#withPackageId(PermissionsRevoked(this.#phantomWitnessBcs));\n\t}\n\n\t/** Replaces the codegen local package alias with the real package ID in the BCS type name. */\n\t#withPackageId(type: BcsType<any>) {\n\t\treturn type.transform({\n\t\t\tname: type.name.replace(LOCAL_PACKAGE_ALIAS, this.#packageId),\n\t\t});\n\t}\n\n\t/** Event emitted when a group is derived from a parent object */\n\tGroupDerived<DerivationKey extends BcsType<any>>(\n\t\tderivationKeyType: DerivationKey,\n\t): BcsType<ParsedGroupDerived<DerivationKey['$inferType']>, unknown> {\n\t\treturn this.#withPackageId(GroupDerived(this.#phantomWitnessBcs, derivationKeyType));\n\t}\n}\n"],"mappings":";;;;AA8CA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;AAuB5B,IAAa,eAAb,MAA0B;CA8BzB,CAASA;CACT,CAASC;CAET,YAAY,SAA8B;AACzC,QAAKA,YAAa,QAAQ,cAAc;AAIxC,QAAKD,oBAAqB,IAAI,MAAM,CAAC,UAAU,EAAE,MAAM,QAAQ,aAAa,CAAC;AAE7E,OAAK,mBAAmB,MAAKE,cAAe,iBAAiB;AAC7D,OAAK,4BAA4B,MAAKA,cAAe,0BAA0B;AAC/E,OAAK,cAAc,MAAKA,cAAe,YAAY;AACnD,OAAK,eAAe,MAAKA,cAAe,aAAa;AACrD,OAAK,eAAe,MAAKA,cAAe,aAAa;AACrD,OAAK,oBAAoB,MAAKA,cAAe,kBAAkB,MAAKF,kBAAmB,CAAC;AACxF,OAAK,eAAe,MAAKE,cAAe,aAAa,MAAKF,kBAAmB,CAAC;AAC9E,OAAK,eAAe,MAAKE,cAAe,aAAa,MAAKF,kBAAmB,CAAC;AAC9E,OAAK,cAAc,MAAKE,cAAe,YAAY,MAAKF,kBAAmB,CAAC;AAC5E,OAAK,gBAAgB,MAAKE,cAAe,cAAc,MAAKF,kBAAmB,CAAC;AAChF,OAAK,cAAc,MAAKE,cAAe,YAAY,MAAKF,kBAAmB,CAAC;AAC5E,OAAK,gBAAgB,MAAKE,cAAe,cAAc,MAAKF,kBAAmB,CAAC;AAChF,OAAK,qBAAqB,MAAKE,cAAe,mBAAmB,MAAKF,kBAAmB,CAAC;AAC1F,OAAK,qBAAqB,MAAKE,cAAe,mBAAmB,MAAKF,kBAAmB,CAAC;;;CAI3F,eAAe,MAAoB;AAClC,SAAO,KAAK,UAAU,EACrB,MAAM,KAAK,KAAK,QAAQ,qBAAqB,MAAKC,UAAW,EAC7D,CAAC;;;CAIH,aACC,mBACoE;AACpE,SAAO,MAAKC,cAAe,aAAa,MAAKF,mBAAoB,kBAAkB,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { AddMembersCallOptions, DeleteCallOptions, GrantPermissionCallOptions, GrantPermissionsCallOptions, PauseCallOptions, RemoveMemberCallOptions, RevokePermissionCallOptions, RevokePermissionsCallOptions, SuiGroupsPackageConfig, UnpauseCallOptions } from "./types.mjs";
2
+ import { Transaction, TransactionResult } from "@mysten/sui/transactions";
3
+
4
+ //#region src/call.d.ts
5
+ interface SuiGroupsCallOptions {
6
+ packageConfig: SuiGroupsPackageConfig;
7
+ witnessType: string;
8
+ }
9
+ /**
10
+ * Low-level transaction building methods for permissioned groups.
11
+ *
12
+ * Each method returns a thunk `(tx: Transaction) => TransactionResult`
13
+ * that can be composed with other transaction operations.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const tx = new Transaction();
18
+ * tx.add(client.groups.call.grantPermission({
19
+ * groupId: '0x...',
20
+ * member: '0x...',
21
+ * permissionType: '0xabc::my_app::Editor',
22
+ * }));
23
+ * ```
24
+ */
25
+ declare class SuiGroupsCall {
26
+ #private;
27
+ constructor(options: SuiGroupsCallOptions);
28
+ /**
29
+ * Grants a permission to a member.
30
+ * If the member doesn't exist, they are automatically added to the group.
31
+ *
32
+ * Permission requirements:
33
+ * - To grant PermissionsAdmin: caller must have PermissionsAdmin
34
+ * - To grant any other permission: caller must have PermissionsAdmin OR ExtensionPermissionsAdmin
35
+ */
36
+ grantPermission(options: GrantPermissionCallOptions): (tx: Transaction) => TransactionResult;
37
+ /**
38
+ * Revokes a permission from a member.
39
+ * If this is the member's last permission, they are automatically removed.
40
+ *
41
+ * Permission requirements:
42
+ * - To revoke PermissionsAdmin: caller must have PermissionsAdmin
43
+ * - To revoke any other permission: caller must have PermissionsAdmin OR ExtensionPermissionsAdmin
44
+ */
45
+ revokePermission(options: RevokePermissionCallOptions): (tx: Transaction) => TransactionResult;
46
+ /**
47
+ * Grants multiple permissions to a member in a single transaction.
48
+ * If the member doesn't exist, they are automatically added on the first grant.
49
+ */
50
+ grantPermissions(options: GrantPermissionsCallOptions): (tx: Transaction) => void;
51
+ /**
52
+ * Revokes multiple permissions from a member in a single transaction.
53
+ * If the last permission is revoked, the member is automatically removed.
54
+ */
55
+ revokePermissions(options: RevokePermissionsCallOptions): (tx: Transaction) => void;
56
+ /**
57
+ * Adds multiple members to a group, each with their own set of permissions.
58
+ * Members who already exist will simply receive the additional permissions.
59
+ */
60
+ addMembers(options: AddMembersCallOptions): (tx: Transaction) => void;
61
+ /**
62
+ * Removes a member from the PermissionedGroup.
63
+ * Requires PermissionsAdmin permission.
64
+ */
65
+ removeMember(options: RemoveMemberCallOptions): (tx: Transaction) => TransactionResult;
66
+ /**
67
+ * Pauses the group, preventing all mutations.
68
+ * Returns an `UnpauseCap<T>` that is required to unpause.
69
+ *
70
+ * NOTE: This returns an `UnpauseCap` object that must be handled in the same
71
+ * transaction (e.g., transferred to the caller or stored as a dynamic field).
72
+ * Use `tx.transferObjects` or a custom PTB step after calling this.
73
+ *
74
+ * Permission requirements: caller must have PermissionsAdmin.
75
+ */
76
+ pause(options: PauseCallOptions): (tx: Transaction) => TransactionResult;
77
+ /**
78
+ * Unpauses the group. Consumes and destroys the `UnpauseCap`.
79
+ *
80
+ * @param options.unpauseCapId - The object ID or TransactionArgument of the UnpauseCap
81
+ */
82
+ unpause(options: UnpauseCallOptions): (tx: Transaction) => TransactionResult;
83
+ /**
84
+ * Deletes the group, returning its components as a PTB tuple.
85
+ *
86
+ * NOTE: `delete` returns `(PermissionsTable, u64, address)` from Move.
87
+ * There is no high-level imperative variant — callers must compose this with
88
+ * additional PTB steps to handle the returned PermissionsTable
89
+ * (e.g., `permissions_table::destroy_empty`). This is intentional: only
90
+ * an extending contract that knows about any dynamic fields on the group
91
+ * can safely complete the deletion.
92
+ *
93
+ * Permission requirements: caller must have GroupDeleter permission.
94
+ */
95
+ delete(options: DeleteCallOptions): (tx: Transaction) => TransactionResult;
96
+ }
97
+ //#endregion
98
+ export { SuiGroupsCall };
99
+ //# sourceMappingURL=call.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.d.mts","names":[],"sources":["../src/call.ts"],"mappings":";;;;UAmBiB,oBAAA;EAChB,aAAA,EAAe,sBAAA;EACf,WAAA;AAAA;;;;;;;;AAmBD;;;;;;;;;cAAa,aAAA;EAAA;cAIA,OAAA,EAAS,oBAAA;EAqEM;;;;;;;;EAtD3B,eAAA,CAAgB,OAAA,EAAS,0BAAA,IAA8B,EAAA,EAAI,WAAA,KAAgB,iBAAA;EAqHpB;;;;;;;;EAlGvD,gBAAA,CAAiB,OAAA,EAAS,2BAAA,IAA+B,EAAA,EAAI,WAAA,KAAgB,iBAAA;;;;;EAiB7E,gBAAA,CAAiB,OAAA,EAAS,2BAAA,IAA+B,EAAA,EAAI,WAAA;EApCpC;;;;EAsDzB,iBAAA,CAAkB,OAAA,EAAS,4BAAA,IAAgC,EAAA,EAAI,WAAA;EAnC/D;;;;EAqDA,UAAA,CAAW,OAAA,EAAS,qBAAA,IAAyB,EAAA,EAAI,WAAA;EArD4B;;;;EA2E7E,YAAA,CAAa,OAAA,EAAS,uBAAA,IAA2B,EAAA,EAAI,WAAA,KAAgB,iBAAA;EA1DZ;;;;;;;;;;EAiFzD,KAAA,CAAM,OAAA,EAAS,gBAAA,IAAoB,EAAA,EAAI,WAAA,KAAgB,iBAAA;EAvBvD;;;;;EAsCA,OAAA,CAAQ,OAAA,EAAS,kBAAA,IAAsB,EAAA,EAAI,WAAA,KAAgB,iBAAA;EAf3D;;;;;;;;;;;;EAsCA,MAAA,CAAO,OAAA,EAAS,iBAAA,IAAqB,EAAA,EAAI,WAAA,KAAgB,iBAAA;AAAA"}
package/dist/call.mjs ADDED
@@ -0,0 +1,171 @@
1
+ import { _delete, grantPermission, pause, removeMember, revokePermission, unpause } from "./contracts/sui_groups/permissioned_group.mjs";
2
+
3
+ //#region src/call.ts
4
+ /**
5
+ * Low-level transaction building methods for permissioned groups.
6
+ *
7
+ * Each method returns a thunk `(tx: Transaction) => TransactionResult`
8
+ * that can be composed with other transaction operations.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const tx = new Transaction();
13
+ * tx.add(client.groups.call.grantPermission({
14
+ * groupId: '0x...',
15
+ * member: '0x...',
16
+ * permissionType: '0xabc::my_app::Editor',
17
+ * }));
18
+ * ```
19
+ */
20
+ var SuiGroupsCall = class {
21
+ #packageConfig;
22
+ #witnessType;
23
+ constructor(options) {
24
+ this.#packageConfig = options.packageConfig;
25
+ this.#witnessType = options.witnessType;
26
+ }
27
+ /**
28
+ * Grants a permission to a member.
29
+ * If the member doesn't exist, they are automatically added to the group.
30
+ *
31
+ * Permission requirements:
32
+ * - To grant PermissionsAdmin: caller must have PermissionsAdmin
33
+ * - To grant any other permission: caller must have PermissionsAdmin OR ExtensionPermissionsAdmin
34
+ */
35
+ grantPermission(options) {
36
+ return grantPermission({
37
+ package: this.#packageConfig.latestPackageId,
38
+ arguments: {
39
+ self: options.groupId,
40
+ member: options.member
41
+ },
42
+ typeArguments: [this.#witnessType, options.permissionType]
43
+ });
44
+ }
45
+ /**
46
+ * Revokes a permission from a member.
47
+ * If this is the member's last permission, they are automatically removed.
48
+ *
49
+ * Permission requirements:
50
+ * - To revoke PermissionsAdmin: caller must have PermissionsAdmin
51
+ * - To revoke any other permission: caller must have PermissionsAdmin OR ExtensionPermissionsAdmin
52
+ */
53
+ revokePermission(options) {
54
+ return revokePermission({
55
+ package: this.#packageConfig.latestPackageId,
56
+ arguments: {
57
+ self: options.groupId,
58
+ member: options.member
59
+ },
60
+ typeArguments: [this.#witnessType, options.permissionType]
61
+ });
62
+ }
63
+ /**
64
+ * Grants multiple permissions to a member in a single transaction.
65
+ * If the member doesn't exist, they are automatically added on the first grant.
66
+ */
67
+ grantPermissions(options) {
68
+ return (tx) => {
69
+ for (const permType of options.permissionTypes) tx.add(this.grantPermission({
70
+ groupId: options.groupId,
71
+ member: options.member,
72
+ permissionType: permType
73
+ }));
74
+ };
75
+ }
76
+ /**
77
+ * Revokes multiple permissions from a member in a single transaction.
78
+ * If the last permission is revoked, the member is automatically removed.
79
+ */
80
+ revokePermissions(options) {
81
+ return (tx) => {
82
+ for (const permType of options.permissionTypes) tx.add(this.revokePermission({
83
+ groupId: options.groupId,
84
+ member: options.member,
85
+ permissionType: permType
86
+ }));
87
+ };
88
+ }
89
+ /**
90
+ * Adds multiple members to a group, each with their own set of permissions.
91
+ * Members who already exist will simply receive the additional permissions.
92
+ */
93
+ addMembers(options) {
94
+ return (tx) => {
95
+ for (const member of options.members) for (const permType of member.permissions) tx.add(this.grantPermission({
96
+ groupId: options.groupId,
97
+ member: member.address,
98
+ permissionType: permType
99
+ }));
100
+ };
101
+ }
102
+ /**
103
+ * Removes a member from the PermissionedGroup.
104
+ * Requires PermissionsAdmin permission.
105
+ */
106
+ removeMember(options) {
107
+ return removeMember({
108
+ package: this.#packageConfig.latestPackageId,
109
+ arguments: {
110
+ self: options.groupId,
111
+ member: options.member
112
+ },
113
+ typeArguments: [this.#witnessType]
114
+ });
115
+ }
116
+ /**
117
+ * Pauses the group, preventing all mutations.
118
+ * Returns an `UnpauseCap<T>` that is required to unpause.
119
+ *
120
+ * NOTE: This returns an `UnpauseCap` object that must be handled in the same
121
+ * transaction (e.g., transferred to the caller or stored as a dynamic field).
122
+ * Use `tx.transferObjects` or a custom PTB step after calling this.
123
+ *
124
+ * Permission requirements: caller must have PermissionsAdmin.
125
+ */
126
+ pause(options) {
127
+ return pause({
128
+ package: this.#packageConfig.latestPackageId,
129
+ arguments: { self: options.groupId },
130
+ typeArguments: [this.#witnessType]
131
+ });
132
+ }
133
+ /**
134
+ * Unpauses the group. Consumes and destroys the `UnpauseCap`.
135
+ *
136
+ * @param options.unpauseCapId - The object ID or TransactionArgument of the UnpauseCap
137
+ */
138
+ unpause(options) {
139
+ return unpause({
140
+ package: this.#packageConfig.latestPackageId,
141
+ arguments: {
142
+ self: options.groupId,
143
+ cap: options.unpauseCapId
144
+ },
145
+ typeArguments: [this.#witnessType]
146
+ });
147
+ }
148
+ /**
149
+ * Deletes the group, returning its components as a PTB tuple.
150
+ *
151
+ * NOTE: `delete` returns `(PermissionsTable, u64, address)` from Move.
152
+ * There is no high-level imperative variant — callers must compose this with
153
+ * additional PTB steps to handle the returned PermissionsTable
154
+ * (e.g., `permissions_table::destroy_empty`). This is intentional: only
155
+ * an extending contract that knows about any dynamic fields on the group
156
+ * can safely complete the deletion.
157
+ *
158
+ * Permission requirements: caller must have GroupDeleter permission.
159
+ */
160
+ delete(options) {
161
+ return _delete({
162
+ package: this.#packageConfig.latestPackageId,
163
+ arguments: { self: options.groupId },
164
+ typeArguments: [this.#witnessType]
165
+ });
166
+ }
167
+ };
168
+
169
+ //#endregion
170
+ export { SuiGroupsCall };
171
+ //# sourceMappingURL=call.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.mjs","names":["#packageConfig","#witnessType","permissionedGroup.grantPermission","permissionedGroup.revokePermission","permissionedGroup.removeMember","permissionedGroup.pause","permissionedGroup.unpause","permissionedGroup._delete"],"sources":["../src/call.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction, TransactionResult } from '@mysten/sui/transactions';\n\nimport * as permissionedGroup from './contracts/sui_groups/permissioned_group.js';\nimport type {\n\tAddMembersCallOptions,\n\tDeleteCallOptions,\n\tGrantPermissionCallOptions,\n\tGrantPermissionsCallOptions,\n\tPauseCallOptions,\n\tSuiGroupsPackageConfig,\n\tRemoveMemberCallOptions,\n\tRevokePermissionCallOptions,\n\tRevokePermissionsCallOptions,\n\tUnpauseCallOptions,\n} from './types.js';\n\nexport interface SuiGroupsCallOptions {\n\tpackageConfig: SuiGroupsPackageConfig;\n\twitnessType: string;\n}\n\n/**\n * Low-level transaction building methods for permissioned groups.\n *\n * Each method returns a thunk `(tx: Transaction) => TransactionResult`\n * that can be composed with other transaction operations.\n *\n * @example\n * ```ts\n * const tx = new Transaction();\n * tx.add(client.groups.call.grantPermission({\n * groupId: '0x...',\n * member: '0x...',\n * permissionType: '0xabc::my_app::Editor',\n * }));\n * ```\n */\nexport class SuiGroupsCall {\n\t#packageConfig: SuiGroupsPackageConfig;\n\t#witnessType: string;\n\n\tconstructor(options: SuiGroupsCallOptions) {\n\t\tthis.#packageConfig = options.packageConfig;\n\t\tthis.#witnessType = options.witnessType;\n\t}\n\n\t// === Permission Management Functions ===\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\t * Permission requirements:\n\t * - To grant PermissionsAdmin: caller must have PermissionsAdmin\n\t * - To grant any other permission: caller must have PermissionsAdmin OR ExtensionPermissionsAdmin\n\t */\n\tgrantPermission(options: GrantPermissionCallOptions): (tx: Transaction) => TransactionResult {\n\t\treturn permissionedGroup.grantPermission({\n\t\t\tpackage: this.#packageConfig.latestPackageId,\n\t\t\targuments: {\n\t\t\t\tself: options.groupId,\n\t\t\t\tmember: options.member,\n\t\t\t},\n\t\t\ttypeArguments: [this.#witnessType, options.permissionType],\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\t * Permission requirements:\n\t * - To revoke PermissionsAdmin: caller must have PermissionsAdmin\n\t * - To revoke any other permission: caller must have PermissionsAdmin OR ExtensionPermissionsAdmin\n\t */\n\trevokePermission(options: RevokePermissionCallOptions): (tx: Transaction) => TransactionResult {\n\t\treturn permissionedGroup.revokePermission({\n\t\t\tpackage: this.#packageConfig.latestPackageId,\n\t\t\targuments: {\n\t\t\t\tself: options.groupId,\n\t\t\t\tmember: options.member,\n\t\t\t},\n\t\t\ttypeArguments: [this.#witnessType, options.permissionType],\n\t\t});\n\t}\n\n\t// === Batch/Convenience Functions ===\n\n\t/**\n\t * Grants multiple permissions to a member in a single transaction.\n\t * If the member doesn't exist, they are automatically added on the first grant.\n\t */\n\tgrantPermissions(options: GrantPermissionsCallOptions): (tx: Transaction) => void {\n\t\treturn (tx: Transaction) => {\n\t\t\tfor (const permType of options.permissionTypes) {\n\t\t\t\ttx.add(\n\t\t\t\t\tthis.grantPermission({\n\t\t\t\t\t\tgroupId: options.groupId,\n\t\t\t\t\t\tmember: options.member,\n\t\t\t\t\t\tpermissionType: permType,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Revokes multiple permissions from a member in a single transaction.\n\t * If the last permission is revoked, the member is automatically removed.\n\t */\n\trevokePermissions(options: RevokePermissionsCallOptions): (tx: Transaction) => void {\n\t\treturn (tx: Transaction) => {\n\t\t\tfor (const permType of options.permissionTypes) {\n\t\t\t\ttx.add(\n\t\t\t\t\tthis.revokePermission({\n\t\t\t\t\t\tgroupId: options.groupId,\n\t\t\t\t\t\tmember: options.member,\n\t\t\t\t\t\tpermissionType: permType,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\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\taddMembers(options: AddMembersCallOptions): (tx: Transaction) => void {\n\t\treturn (tx: Transaction) => {\n\t\t\tfor (const member of options.members) {\n\t\t\t\tfor (const permType of member.permissions) {\n\t\t\t\t\ttx.add(\n\t\t\t\t\t\tthis.grantPermission({\n\t\t\t\t\t\t\tgroupId: options.groupId,\n\t\t\t\t\t\t\tmember: member.address,\n\t\t\t\t\t\t\tpermissionType: permType,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\t// === Member Management Functions ===\n\n\t/**\n\t * Removes a member from the PermissionedGroup.\n\t * Requires PermissionsAdmin permission.\n\t */\n\tremoveMember(options: RemoveMemberCallOptions): (tx: Transaction) => TransactionResult {\n\t\treturn permissionedGroup.removeMember({\n\t\t\tpackage: this.#packageConfig.latestPackageId,\n\t\t\targuments: {\n\t\t\t\tself: options.groupId,\n\t\t\t\tmember: options.member,\n\t\t\t},\n\t\t\ttypeArguments: [this.#witnessType],\n\t\t});\n\t}\n\n\t// === Group Lifecycle Functions ===\n\n\t/**\n\t * Pauses the group, preventing all mutations.\n\t * Returns an `UnpauseCap<T>` that is required to unpause.\n\t *\n\t * NOTE: This returns an `UnpauseCap` object that must be handled in the same\n\t * transaction (e.g., transferred to the caller or stored as a dynamic field).\n\t * Use `tx.transferObjects` or a custom PTB step after calling this.\n\t *\n\t * Permission requirements: caller must have PermissionsAdmin.\n\t */\n\tpause(options: PauseCallOptions): (tx: Transaction) => TransactionResult {\n\t\treturn permissionedGroup.pause({\n\t\t\tpackage: this.#packageConfig.latestPackageId,\n\t\t\targuments: {\n\t\t\t\tself: options.groupId,\n\t\t\t},\n\t\t\ttypeArguments: [this.#witnessType],\n\t\t});\n\t}\n\n\t/**\n\t * Unpauses the group. Consumes and destroys the `UnpauseCap`.\n\t *\n\t * @param options.unpauseCapId - The object ID or TransactionArgument of the UnpauseCap\n\t */\n\tunpause(options: UnpauseCallOptions): (tx: Transaction) => TransactionResult {\n\t\treturn permissionedGroup.unpause({\n\t\t\tpackage: this.#packageConfig.latestPackageId,\n\t\t\targuments: {\n\t\t\t\tself: options.groupId,\n\t\t\t\tcap: options.unpauseCapId,\n\t\t\t},\n\t\t\ttypeArguments: [this.#witnessType],\n\t\t});\n\t}\n\n\t/**\n\t * Deletes the group, returning its components as a PTB tuple.\n\t *\n\t * NOTE: `delete` returns `(PermissionsTable, u64, address)` from Move.\n\t * There is no high-level imperative variant — callers must compose this with\n\t * additional PTB steps to handle the returned PermissionsTable\n\t * (e.g., `permissions_table::destroy_empty`). This is intentional: only\n\t * an extending contract that knows about any dynamic fields on the group\n\t * can safely complete the deletion.\n\t *\n\t * Permission requirements: caller must have GroupDeleter permission.\n\t */\n\tdelete(options: DeleteCallOptions): (tx: Transaction) => TransactionResult {\n\t\treturn permissionedGroup._delete({\n\t\t\tpackage: this.#packageConfig.latestPackageId,\n\t\t\targuments: {\n\t\t\t\tself: options.groupId,\n\t\t\t},\n\t\t\ttypeArguments: [this.#witnessType],\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,IAAa,gBAAb,MAA2B;CAC1B;CACA;CAEA,YAAY,SAA+B;AAC1C,QAAKA,gBAAiB,QAAQ;AAC9B,QAAKC,cAAe,QAAQ;;;;;;;;;;CAa7B,gBAAgB,SAA6E;AAC5F,SAAOC,gBAAkC;GACxC,SAAS,MAAKF,cAAe;GAC7B,WAAW;IACV,MAAM,QAAQ;IACd,QAAQ,QAAQ;IAChB;GACD,eAAe,CAAC,MAAKC,aAAc,QAAQ,eAAe;GAC1D,CAAC;;;;;;;;;;CAWH,iBAAiB,SAA8E;AAC9F,SAAOE,iBAAmC;GACzC,SAAS,MAAKH,cAAe;GAC7B,WAAW;IACV,MAAM,QAAQ;IACd,QAAQ,QAAQ;IAChB;GACD,eAAe,CAAC,MAAKC,aAAc,QAAQ,eAAe;GAC1D,CAAC;;;;;;CASH,iBAAiB,SAAiE;AACjF,UAAQ,OAAoB;AAC3B,QAAK,MAAM,YAAY,QAAQ,gBAC9B,IAAG,IACF,KAAK,gBAAgB;IACpB,SAAS,QAAQ;IACjB,QAAQ,QAAQ;IAChB,gBAAgB;IAChB,CAAC,CACF;;;;;;;CASJ,kBAAkB,SAAkE;AACnF,UAAQ,OAAoB;AAC3B,QAAK,MAAM,YAAY,QAAQ,gBAC9B,IAAG,IACF,KAAK,iBAAiB;IACrB,SAAS,QAAQ;IACjB,QAAQ,QAAQ;IAChB,gBAAgB;IAChB,CAAC,CACF;;;;;;;CASJ,WAAW,SAA2D;AACrE,UAAQ,OAAoB;AAC3B,QAAK,MAAM,UAAU,QAAQ,QAC5B,MAAK,MAAM,YAAY,OAAO,YAC7B,IAAG,IACF,KAAK,gBAAgB;IACpB,SAAS,QAAQ;IACjB,QAAQ,OAAO;IACf,gBAAgB;IAChB,CAAC,CACF;;;;;;;CAYL,aAAa,SAA0E;AACtF,SAAOG,aAA+B;GACrC,SAAS,MAAKJ,cAAe;GAC7B,WAAW;IACV,MAAM,QAAQ;IACd,QAAQ,QAAQ;IAChB;GACD,eAAe,CAAC,MAAKC,YAAa;GAClC,CAAC;;;;;;;;;;;;CAeH,MAAM,SAAmE;AACxE,SAAOI,MAAwB;GAC9B,SAAS,MAAKL,cAAe;GAC7B,WAAW,EACV,MAAM,QAAQ,SACd;GACD,eAAe,CAAC,MAAKC,YAAa;GAClC,CAAC;;;;;;;CAQH,QAAQ,SAAqE;AAC5E,SAAOK,QAA0B;GAChC,SAAS,MAAKN,cAAe;GAC7B,WAAW;IACV,MAAM,QAAQ;IACd,KAAK,QAAQ;IACb;GACD,eAAe,CAAC,MAAKC,YAAa;GAClC,CAAC;;;;;;;;;;;;;;CAeH,OAAO,SAAoE;AAC1E,SAAOM,QAA0B;GAChC,SAAS,MAAKP,cAAe;GAC7B,WAAW,EACV,MAAM,QAAQ,SACd;GACD,eAAe,CAAC,MAAKC,YAAa;GAClC,CAAC"}