@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 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/contracts/utils/index.ts"],"sourcesContent":["import {\n\tbcs,\n\tBcsType,\n\tTypeTag,\n\tTypeTagSerializer,\n\tBcsStruct,\n\tBcsEnum,\n\tBcsTuple,\n} from '@mysten/sui/bcs';\nimport { normalizeSuiAddress } from '@mysten/sui/utils';\nimport { TransactionArgument, isArgument } from '@mysten/sui/transactions';\nimport { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client';\n\nconst MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');\nconst SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');\n\nexport type RawTransactionArgument<T> = T | TransactionArgument;\n\nexport interface GetOptions<\n\tInclude extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {},\n> extends SuiClientTypes.GetObjectOptions<Include> {\n\tclient: ClientWithCoreApi;\n}\n\nexport interface GetManyOptions<\n\tInclude extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {},\n> extends SuiClientTypes.GetObjectsOptions<Include> {\n\tclient: ClientWithCoreApi;\n}\n\nexport function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {\n\tconst parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;\n\n\tif ('u8' in parsedTag) {\n\t\treturn bcs.U8;\n\t} else if ('u16' in parsedTag) {\n\t\treturn bcs.U16;\n\t} else if ('u32' in parsedTag) {\n\t\treturn bcs.U32;\n\t} else if ('u64' in parsedTag) {\n\t\treturn bcs.U64;\n\t} else if ('u128' in parsedTag) {\n\t\treturn bcs.U128;\n\t} else if ('u256' in parsedTag) {\n\t\treturn bcs.U256;\n\t} else if ('address' in parsedTag) {\n\t\treturn bcs.Address;\n\t} else if ('bool' in parsedTag) {\n\t\treturn bcs.Bool;\n\t} else if ('vector' in parsedTag) {\n\t\tconst type = getPureBcsSchema(parsedTag.vector);\n\t\treturn type ? bcs.vector(type) : null;\n\t} else if ('struct' in parsedTag) {\n\t\tconst structTag = parsedTag.struct;\n\t\tconst pkg = normalizeSuiAddress(structTag.address);\n\n\t\tif (pkg === MOVE_STDLIB_ADDRESS) {\n\t\t\tif (\n\t\t\t\t(structTag.module === 'ascii' || structTag.module === 'string') &&\n\t\t\t\tstructTag.name === 'String'\n\t\t\t) {\n\t\t\t\treturn bcs.String;\n\t\t\t}\n\n\t\t\tif (structTag.module === 'option' && structTag.name === 'Option') {\n\t\t\t\tconst type = getPureBcsSchema(structTag.typeParams[0]);\n\t\t\t\treturn type ? bcs.option(type) : null;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tpkg === SUI_FRAMEWORK_ADDRESS &&\n\t\t\tstructTag.module === 'object' &&\n\t\t\t(structTag.name === 'ID' || structTag.name === 'UID')\n\t\t) {\n\t\t\treturn bcs.Address;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function normalizeMoveArguments(\n\targs: unknown[] | object,\n\targTypes: readonly (string | null)[],\n\tparameterNames?: string[],\n) {\n\tconst argLen = Array.isArray(args) ? args.length : Object.keys(args).length;\n\tif (parameterNames && argLen !== parameterNames.length) {\n\t\tthrow new Error(\n\t\t\t`Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,\n\t\t);\n\t}\n\n\tconst normalizedArgs: TransactionArgument[] = [];\n\n\tlet index = 0;\n\tfor (const [i, argType] of argTypes.entries()) {\n\t\tif (argType === '0x2::clock::Clock') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.clock());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::random::Random') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.random());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::deny_list::DenyList') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.denyList());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x3::sui_system::SuiSystemState') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.system());\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet arg;\n\t\tif (Array.isArray(args)) {\n\t\t\tif (index >= args.length) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\targ = args[index];\n\t\t} else {\n\t\t\tif (!parameterNames) {\n\t\t\t\tthrow new Error(`Expected arguments to be passed as an array`);\n\t\t\t}\n\t\t\tconst name = parameterNames[index];\n\t\t\targ = args[name as keyof typeof args];\n\n\t\t\tif (arg === undefined) {\n\t\t\t\tthrow new Error(`Parameter ${name} is required`);\n\t\t\t}\n\t\t}\n\n\t\tindex += 1;\n\n\t\tif (typeof arg === 'function' || isArgument(arg)) {\n\t\t\tnormalizedArgs.push(arg as TransactionArgument);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst type = argTypes[i];\n\t\tconst bcsType = type === null ? null : getPureBcsSchema(type);\n\n\t\tif (bcsType) {\n\t\t\tconst bytes = bcsType.serialize(arg as never);\n\t\t\tnormalizedArgs.push((tx) => tx.pure(bytes));\n\t\t\tcontinue;\n\t\t} else if (typeof arg === 'string') {\n\t\t\tnormalizedArgs.push((tx) => tx.object(arg));\n\t\t\tcontinue;\n\t\t}\n\n\t\tthrow new Error(`Invalid argument ${stringify(arg)} for type ${type}`);\n\t}\n\n\treturn normalizedArgs;\n}\n\nexport class MoveStruct<\n\tT extends Record<string, BcsType<any>>,\n\tconst Name extends string = string,\n> extends BcsStruct<T, Name> {\n\tasync get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tobjectId,\n\t\t...options\n\t}: GetOptions<Include>): Promise<\n\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t}\n\t> {\n\t\tconst [res] = await this.getMany<Include>({\n\t\t\t...options,\n\t\t\tobjectIds: [objectId],\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tasync getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tclient,\n\t\t...options\n\t}: GetManyOptions<Include>): Promise<\n\t\tArray<\n\t\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t\t}\n\t\t>\n\t> {\n\t\tconst response = (await client.core.getObjects({\n\t\t\t...options,\n\t\t\tinclude: {\n\t\t\t\t...options.include,\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t})) as SuiClientTypes.GetObjectsResponse<Include & { content: true }>;\n\n\t\treturn response.objects.map((obj) => {\n\t\t\tif (obj instanceof Error) {\n\t\t\t\tthrow obj;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...obj,\n\t\t\t\tjson: this.parse(obj.content),\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport class MoveEnum<\n\tT extends Record<string, BcsType<any> | null>,\n\tconst Name extends string,\n> extends BcsEnum<T, Name> {}\n\nexport class MoveTuple<\n\tconst T extends readonly BcsType<any>[],\n\tconst Name extends string,\n> extends BcsTuple<T, Name> {}\n\nfunction stringify(val: unknown) {\n\tif (typeof val === 'object') {\n\t\treturn JSON.stringify(val, (val: unknown) => val);\n\t}\n\tif (typeof val === 'bigint') {\n\t\treturn val.toString();\n\t}\n\n\treturn val;\n}\n"],"mappings":";;;;;AAaA,MAAM,sBAAsB,oBAAoB,MAAM;AACtD,MAAM,wBAAwB,oBAAoB,MAAM;AAgBxD,SAAgB,iBAAiB,SAAgD;CAChF,MAAM,YAAY,OAAO,YAAY,WAAW,kBAAkB,aAAa,QAAQ,GAAG;AAE1F,KAAI,QAAQ,UACX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ACT;GACD,CAAC,EAEc,QAAQ,KAAK,QAAQ;AACpC,OAAI,eAAe,MAClB,OAAM;AAGP,UAAO;IACN,GAAG;IACH,MAAM,KAAK,MAAM,IAAI,QAAQ;IAC7B;IACA;;;AASJ,IAAa,YAAb,cAGU,SAAkB;AAE5B,SAAS,UAAU,KAAc;AAChC,KAAI,OAAO,QAAQ,SAClB,QAAO,KAAK,UAAU,MAAM,QAAiB,IAAI;AAElD,KAAI,OAAO,QAAQ,SAClB,QAAO,IAAI,UAAU;AAGtB,QAAO"}
@@ -0,0 +1,5 @@
1
+ //#region src/error.d.ts
2
+ declare class SuiGroupsClientError extends Error {}
3
+ //#endregion
4
+ export { SuiGroupsClientError };
5
+ //# sourceMappingURL=error.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.mts","names":[],"sources":["../src/error.ts"],"mappings":";cAGa,oBAAA,SAA6B,KAAA"}
package/dist/error.mjs ADDED
@@ -0,0 +1,6 @@
1
+ //#region src/error.ts
2
+ var SuiGroupsClientError = class extends Error {};
3
+
4
+ //#endregion
5
+ export { SuiGroupsClientError };
6
+ //# sourceMappingURL=error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.mjs","names":[],"sources":["../src/error.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport class SuiGroupsClientError extends Error {}\n"],"mappings":";AAGA,IAAa,uBAAb,cAA0C,MAAM"}
@@ -0,0 +1,9 @@
1
+ import { AddMembersCallOptions, AddMembersOptions, DeleteCallOptions, GetMembersExhaustiveViewOptions, GetMembersPaginatedViewOptions, GetMembersResponse, GetMembersViewOptions, GrantPermissionCallOptions, GrantPermissionOptions, GrantPermissionsCallOptions, GrantPermissionsOptions, HasPermissionViewOptions, IsMemberViewOptions, IsPausedViewOptions, LeaveCallOptions, LeaveOptions, MemberWithPermissions, PauseCallOptions, PauseOptions, RemoveMemberCallOptions, RemoveMemberOptions, RevokePermissionCallOptions, RevokePermissionOptions, RevokePermissionsCallOptions, RevokePermissionsOptions, SuiGroupsClientOptions, SuiGroupsCompatibleClient, SuiGroupsPackageConfig, UnpauseCallOptions, UnpauseOptions } from "./types.mjs";
2
+ import { SuiGroupsCall } from "./call.mjs";
3
+ import { SuiGroupsTransactions } from "./transactions.mjs";
4
+ import { ParsedExtensionPermissionsAdmin, ParsedGroupCreated, ParsedGroupDeleted, ParsedGroupDeleter, ParsedGroupDerived, ParsedGroupPaused, ParsedGroupUnpaused, ParsedMemberAdded, ParsedMemberRemoved, ParsedObjectAdmin, ParsedPausedMarker, ParsedPermissionedGroup, ParsedPermissionsAdmin, ParsedPermissionsGranted, ParsedPermissionsRevoked, SuiGroupsBCS } from "./bcs.mjs";
5
+ import { SuiGroupsView } from "./view.mjs";
6
+ import { SuiGroupsClient, suiGroups } from "./client.mjs";
7
+ import { SuiGroupsClientError } from "./error.mjs";
8
+ import { MAINNET_SUI_GROUPS_PACKAGE_CONFIG, TESTNET_SUI_GROUPS_PACKAGE_CONFIG, actorObjectPermissionTypes, pausedMarkerType, permissionTypes, permissionedGroupType } from "./constants.mjs";
9
+ export { AddMembersCallOptions, AddMembersOptions, DeleteCallOptions, GetMembersExhaustiveViewOptions, GetMembersPaginatedViewOptions, GetMembersResponse, GetMembersViewOptions, GrantPermissionCallOptions, GrantPermissionOptions, GrantPermissionsCallOptions, GrantPermissionsOptions, HasPermissionViewOptions, IsMemberViewOptions, IsPausedViewOptions, LeaveCallOptions, LeaveOptions, MAINNET_SUI_GROUPS_PACKAGE_CONFIG, MemberWithPermissions, type ParsedExtensionPermissionsAdmin, type ParsedGroupCreated, type ParsedGroupDeleted, type ParsedGroupDeleter, type ParsedGroupDerived, type ParsedGroupPaused, type ParsedGroupUnpaused, type ParsedMemberAdded, type ParsedMemberRemoved, type ParsedObjectAdmin, type ParsedPausedMarker, type ParsedPermissionedGroup, type ParsedPermissionsAdmin, type ParsedPermissionsGranted, type ParsedPermissionsRevoked, PauseCallOptions, PauseOptions, RemoveMemberCallOptions, RemoveMemberOptions, RevokePermissionCallOptions, RevokePermissionOptions, RevokePermissionsCallOptions, RevokePermissionsOptions, SuiGroupsBCS, SuiGroupsCall, SuiGroupsClient, SuiGroupsClientError, SuiGroupsClientOptions, SuiGroupsCompatibleClient, SuiGroupsPackageConfig, SuiGroupsTransactions, SuiGroupsView, TESTNET_SUI_GROUPS_PACKAGE_CONFIG, UnpauseCallOptions, UnpauseOptions, actorObjectPermissionTypes, pausedMarkerType, permissionTypes, permissionedGroupType, suiGroups };
package/dist/index.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import { SuiGroupsClientError } from "./error.mjs";
2
+ import { MAINNET_SUI_GROUPS_PACKAGE_CONFIG, TESTNET_SUI_GROUPS_PACKAGE_CONFIG, actorObjectPermissionTypes, pausedMarkerType, permissionTypes, permissionedGroupType } 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 { SuiGroupsClient, suiGroups } from "./client.mjs";
8
+
9
+ export { MAINNET_SUI_GROUPS_PACKAGE_CONFIG, SuiGroupsBCS, SuiGroupsCall, SuiGroupsClient, SuiGroupsClientError, SuiGroupsTransactions, SuiGroupsView, TESTNET_SUI_GROUPS_PACKAGE_CONFIG, actorObjectPermissionTypes, pausedMarkerType, permissionTypes, permissionedGroupType, suiGroups };
@@ -0,0 +1,110 @@
1
+ import { AddMembersCallOptions, GrantPermissionCallOptions, GrantPermissionsCallOptions, PauseCallOptions, RemoveMemberCallOptions, RevokePermissionCallOptions, RevokePermissionsCallOptions, UnpauseCallOptions } from "./types.mjs";
2
+ import { SuiGroupsCall } from "./call.mjs";
3
+ import { Transaction } from "@mysten/sui/transactions";
4
+
5
+ //#region src/transactions.d.ts
6
+ interface SuiGroupsTransactionsOptions {
7
+ call: SuiGroupsCall;
8
+ }
9
+ /**
10
+ * Transaction factory methods for permissioned groups.
11
+ *
12
+ * Each method returns a complete Transaction object ready for signing.
13
+ * Useful for dapp-kit integration where you need Transaction objects.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // For use with dapp-kit's signAndExecuteTransaction
18
+ * const tx = client.groups.tx.grantPermission({
19
+ * groupId: '0x...',
20
+ * member: '0x...',
21
+ * permissionType: '0xabc::my_app::Editor',
22
+ * });
23
+ * signAndExecuteTransaction({ transaction: tx });
24
+ * ```
25
+ */
26
+ declare class SuiGroupsTransactions {
27
+ #private;
28
+ constructor(options: SuiGroupsTransactionsOptions);
29
+ /**
30
+ * Creates a Transaction that grants a permission to a member.
31
+ */
32
+ grantPermission({
33
+ transaction,
34
+ ...options
35
+ }: GrantPermissionCallOptions & {
36
+ transaction?: Transaction;
37
+ }): Transaction;
38
+ /**
39
+ * Creates a Transaction that revokes a permission from a member.
40
+ */
41
+ revokePermission({
42
+ transaction,
43
+ ...options
44
+ }: RevokePermissionCallOptions & {
45
+ transaction?: Transaction;
46
+ }): Transaction;
47
+ /**
48
+ * Creates a Transaction that grants multiple permissions to a member.
49
+ */
50
+ grantPermissions({
51
+ transaction,
52
+ ...options
53
+ }: GrantPermissionsCallOptions & {
54
+ transaction?: Transaction;
55
+ }): Transaction;
56
+ /**
57
+ * Creates a Transaction that revokes multiple permissions from a member.
58
+ */
59
+ revokePermissions({
60
+ transaction,
61
+ ...options
62
+ }: RevokePermissionsCallOptions & {
63
+ transaction?: Transaction;
64
+ }): Transaction;
65
+ /**
66
+ * Creates a Transaction that adds multiple members with their permissions.
67
+ */
68
+ addMembers({
69
+ transaction,
70
+ ...options
71
+ }: AddMembersCallOptions & {
72
+ transaction?: Transaction;
73
+ }): Transaction;
74
+ /**
75
+ * Creates a Transaction that removes a member from the group.
76
+ */
77
+ removeMember({
78
+ transaction,
79
+ ...options
80
+ }: RemoveMemberCallOptions & {
81
+ transaction?: Transaction;
82
+ }): Transaction;
83
+ /**
84
+ * Creates a Transaction that pauses the group and transfers the
85
+ * `UnpauseCap` to `unpauseCapRecipient`.
86
+ *
87
+ * Unlike the top-level `client.pause()`, this method requires an explicit
88
+ * recipient because the transaction sender is not yet known at build time.
89
+ */
90
+ pause({
91
+ transaction,
92
+ ...options
93
+ }: PauseCallOptions & {
94
+ unpauseCapRecipient: string;
95
+ transaction?: Transaction;
96
+ }): Transaction;
97
+ /**
98
+ * Creates a Transaction that unpauses the group.
99
+ * The `unpauseCapId` must be owned by the signer.
100
+ */
101
+ unpause({
102
+ transaction,
103
+ ...options
104
+ }: UnpauseCallOptions & {
105
+ transaction?: Transaction;
106
+ }): Transaction;
107
+ }
108
+ //#endregion
109
+ export { SuiGroupsTransactions };
110
+ //# sourceMappingURL=transactions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.d.mts","names":[],"sources":["../src/transactions.ts"],"mappings":";;;;;UAiBiB,4BAAA;EAChB,IAAA,EAAM,aAAA;AAAA;;;;;AAoBP;;;;;;;;;;;;;cAAa,qBAAA;EAAA;cAGA,OAAA,EAAS,4BAAA;EA6CpB;;;EApCD,eAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,0BAAA;IAA+B,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;EA8CrB;;;EAtC3C,gBAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,2BAAA;IAAgC,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;EA+DhE;;;EArDD,gBAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,2BAAA;IAAgC,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;EAmEzB;;;EA3DxC,iBAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,4BAAA;IAAiC,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;EA/C7C;;;EAuDrB,UAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,qBAAA;IAA0B,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;EA9CxD;;;EAwDH,YAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,uBAAA;IAA4B,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;EAlD5D;;;;;;;EAgED,KAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,gBAAA;IAAqB,mBAAA;IAA6B,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;EApDhD;;;;EAgEnC,OAAA,CAAA;IACC,WAAA;IAAA,GACG;EAAA,GACD,kBAAA;IAAuB,WAAA,GAAc,WAAA;EAAA,IAAgB,WAAA;AAAA"}
@@ -0,0 +1,91 @@
1
+ import { Transaction } from "@mysten/sui/transactions";
2
+
3
+ //#region src/transactions.ts
4
+ /**
5
+ * Transaction factory methods for permissioned groups.
6
+ *
7
+ * Each method returns a complete Transaction object ready for signing.
8
+ * Useful for dapp-kit integration where you need Transaction objects.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * // For use with dapp-kit's signAndExecuteTransaction
13
+ * const tx = client.groups.tx.grantPermission({
14
+ * groupId: '0x...',
15
+ * member: '0x...',
16
+ * permissionType: '0xabc::my_app::Editor',
17
+ * });
18
+ * signAndExecuteTransaction({ transaction: tx });
19
+ * ```
20
+ */
21
+ var SuiGroupsTransactions = class {
22
+ #call;
23
+ constructor(options) {
24
+ this.#call = options.call;
25
+ }
26
+ /**
27
+ * Creates a Transaction that grants a permission to a member.
28
+ */
29
+ grantPermission({ transaction = new Transaction(), ...options }) {
30
+ transaction.add(this.#call.grantPermission(options));
31
+ return transaction;
32
+ }
33
+ /**
34
+ * Creates a Transaction that revokes a permission from a member.
35
+ */
36
+ revokePermission({ transaction = new Transaction(), ...options }) {
37
+ transaction.add(this.#call.revokePermission(options));
38
+ return transaction;
39
+ }
40
+ /**
41
+ * Creates a Transaction that grants multiple permissions to a member.
42
+ */
43
+ grantPermissions({ transaction = new Transaction(), ...options }) {
44
+ transaction.add(this.#call.grantPermissions(options));
45
+ return transaction;
46
+ }
47
+ /**
48
+ * Creates a Transaction that revokes multiple permissions from a member.
49
+ */
50
+ revokePermissions({ transaction = new Transaction(), ...options }) {
51
+ transaction.add(this.#call.revokePermissions(options));
52
+ return transaction;
53
+ }
54
+ /**
55
+ * Creates a Transaction that adds multiple members with their permissions.
56
+ */
57
+ addMembers({ transaction = new Transaction(), ...options }) {
58
+ transaction.add(this.#call.addMembers(options));
59
+ return transaction;
60
+ }
61
+ /**
62
+ * Creates a Transaction that removes a member from the group.
63
+ */
64
+ removeMember({ transaction = new Transaction(), ...options }) {
65
+ transaction.add(this.#call.removeMember(options));
66
+ return transaction;
67
+ }
68
+ /**
69
+ * Creates a Transaction that pauses the group and transfers the
70
+ * `UnpauseCap` to `unpauseCapRecipient`.
71
+ *
72
+ * Unlike the top-level `client.pause()`, this method requires an explicit
73
+ * recipient because the transaction sender is not yet known at build time.
74
+ */
75
+ pause({ transaction = new Transaction(), ...options }) {
76
+ transaction.transferObjects([transaction.add(this.#call.pause(options))], options.unpauseCapRecipient);
77
+ return transaction;
78
+ }
79
+ /**
80
+ * Creates a Transaction that unpauses the group.
81
+ * The `unpauseCapId` must be owned by the signer.
82
+ */
83
+ unpause({ transaction = new Transaction(), ...options }) {
84
+ transaction.add(this.#call.unpause(options));
85
+ return transaction;
86
+ }
87
+ };
88
+
89
+ //#endregion
90
+ export { SuiGroupsTransactions };
91
+ //# sourceMappingURL=transactions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.mjs","names":["#call"],"sources":["../src/transactions.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { SuiGroupsCall } from './call.js';\nimport type {\n\tAddMembersCallOptions,\n\tGrantPermissionCallOptions,\n\tGrantPermissionsCallOptions,\n\tPauseCallOptions,\n\tRemoveMemberCallOptions,\n\tRevokePermissionCallOptions,\n\tRevokePermissionsCallOptions,\n\tUnpauseCallOptions,\n} from './types.js';\n\nexport interface SuiGroupsTransactionsOptions {\n\tcall: SuiGroupsCall;\n}\n\n/**\n * Transaction factory methods for permissioned groups.\n *\n * Each method returns a complete Transaction object ready for signing.\n * Useful for dapp-kit integration where you need Transaction objects.\n *\n * @example\n * ```ts\n * // For use with dapp-kit's signAndExecuteTransaction\n * const tx = client.groups.tx.grantPermission({\n * groupId: '0x...',\n * member: '0x...',\n * permissionType: '0xabc::my_app::Editor',\n * });\n * signAndExecuteTransaction({ transaction: tx });\n * ```\n */\nexport class SuiGroupsTransactions {\n\t#call: SuiGroupsCall;\n\n\tconstructor(options: SuiGroupsTransactionsOptions) {\n\t\tthis.#call = options.call;\n\t}\n\n\t// === Permission Management Functions ===\n\n\t/**\n\t * Creates a Transaction that grants a permission to a member.\n\t */\n\tgrantPermission({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: GrantPermissionCallOptions & { transaction?: Transaction }): Transaction {\n\t\ttransaction.add(this.#call.grantPermission(options));\n\t\treturn transaction;\n\t}\n\n\t/**\n\t * Creates a Transaction that revokes a permission from a member.\n\t */\n\trevokePermission({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: RevokePermissionCallOptions & { transaction?: Transaction }): Transaction {\n\t\ttransaction.add(this.#call.revokePermission(options));\n\t\treturn transaction;\n\t}\n\n\t// === Batch/Convenience Functions ===\n\n\t/**\n\t * Creates a Transaction that grants multiple permissions to a member.\n\t */\n\tgrantPermissions({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: GrantPermissionsCallOptions & { transaction?: Transaction }): Transaction {\n\t\ttransaction.add(this.#call.grantPermissions(options));\n\t\treturn transaction;\n\t}\n\n\t/**\n\t * Creates a Transaction that revokes multiple permissions from a member.\n\t */\n\trevokePermissions({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: RevokePermissionsCallOptions & { transaction?: Transaction }): Transaction {\n\t\ttransaction.add(this.#call.revokePermissions(options));\n\t\treturn transaction;\n\t}\n\n\t/**\n\t * Creates a Transaction that adds multiple members with their permissions.\n\t */\n\taddMembers({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: AddMembersCallOptions & { transaction?: Transaction }): Transaction {\n\t\ttransaction.add(this.#call.addMembers(options));\n\t\treturn transaction;\n\t}\n\n\t// === Member Management Functions ===\n\n\t/**\n\t * Creates a Transaction that removes a member from the group.\n\t */\n\tremoveMember({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: RemoveMemberCallOptions & { transaction?: Transaction }): Transaction {\n\t\ttransaction.add(this.#call.removeMember(options));\n\t\treturn transaction;\n\t}\n\n\t// === Group Lifecycle Functions ===\n\n\t/**\n\t * Creates a Transaction that pauses the group and transfers the\n\t * `UnpauseCap` to `unpauseCapRecipient`.\n\t *\n\t * Unlike the top-level `client.pause()`, this method requires an explicit\n\t * recipient because the transaction sender is not yet known at build time.\n\t */\n\tpause({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: PauseCallOptions & { unpauseCapRecipient: string; transaction?: Transaction }): Transaction {\n\t\ttransaction.transferObjects(\n\t\t\t[transaction.add(this.#call.pause(options))],\n\t\t\toptions.unpauseCapRecipient,\n\t\t);\n\t\treturn transaction;\n\t}\n\n\t/**\n\t * Creates a Transaction that unpauses the group.\n\t * The `unpauseCapId` must be owned by the signer.\n\t */\n\tunpause({\n\t\ttransaction = new Transaction(),\n\t\t...options\n\t}: UnpauseCallOptions & { transaction?: Transaction }): Transaction {\n\t\ttransaction.add(this.#call.unpause(options));\n\t\treturn transaction;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,IAAa,wBAAb,MAAmC;CAClC;CAEA,YAAY,SAAuC;AAClD,QAAKA,OAAQ,QAAQ;;;;;CAQtB,gBAAgB,EACf,cAAc,IAAI,aAAa,EAC/B,GAAG,WACwE;AAC3E,cAAY,IAAI,MAAKA,KAAM,gBAAgB,QAAQ,CAAC;AACpD,SAAO;;;;;CAMR,iBAAiB,EAChB,cAAc,IAAI,aAAa,EAC/B,GAAG,WACyE;AAC5E,cAAY,IAAI,MAAKA,KAAM,iBAAiB,QAAQ,CAAC;AACrD,SAAO;;;;;CAQR,iBAAiB,EAChB,cAAc,IAAI,aAAa,EAC/B,GAAG,WACyE;AAC5E,cAAY,IAAI,MAAKA,KAAM,iBAAiB,QAAQ,CAAC;AACrD,SAAO;;;;;CAMR,kBAAkB,EACjB,cAAc,IAAI,aAAa,EAC/B,GAAG,WAC0E;AAC7E,cAAY,IAAI,MAAKA,KAAM,kBAAkB,QAAQ,CAAC;AACtD,SAAO;;;;;CAMR,WAAW,EACV,cAAc,IAAI,aAAa,EAC/B,GAAG,WACmE;AACtE,cAAY,IAAI,MAAKA,KAAM,WAAW,QAAQ,CAAC;AAC/C,SAAO;;;;;CAQR,aAAa,EACZ,cAAc,IAAI,aAAa,EAC/B,GAAG,WACqE;AACxE,cAAY,IAAI,MAAKA,KAAM,aAAa,QAAQ,CAAC;AACjD,SAAO;;;;;;;;;CAYR,MAAM,EACL,cAAc,IAAI,aAAa,EAC/B,GAAG,WAC2F;AAC9F,cAAY,gBACX,CAAC,YAAY,IAAI,MAAKA,KAAM,MAAM,QAAQ,CAAC,CAAC,EAC5C,QAAQ,oBACR;AACD,SAAO;;;;;;CAOR,QAAQ,EACP,cAAc,IAAI,aAAa,EAC/B,GAAG,WACgE;AACnE,cAAY,IAAI,MAAKA,KAAM,QAAQ,QAAQ,CAAC;AAC5C,SAAO"}
@@ -0,0 +1,221 @@
1
+ import { TransactionArgument } from "@mysten/sui/transactions";
2
+ import { ClientWithCoreApi } from "@mysten/sui/client";
3
+ import { Signer } from "@mysten/sui/cryptography";
4
+
5
+ //#region src/types.d.ts
6
+ /**
7
+ * Configuration for the permissioned_groups Move package.
8
+ * This is managed by us and provided in constants for testnet/mainnet.
9
+ *
10
+ * After a package upgrade on Sui, the original (V1) package ID is still needed
11
+ * for TypeName strings (BCS parsing, permission type comparisons), Seal encryption
12
+ * namespace, and `deriveObjectID` type tags — because Move's `type_name::with_original_ids()`
13
+ * always references V1 addresses.
14
+ *
15
+ * The latest package ID is used for `moveCall` targets so that transactions
16
+ * execute the most recent version of the contract code.
17
+ */
18
+ type SuiGroupsPackageConfig = {
19
+ /** The original (V1) package ID. Used for TypeName strings, BCS, Seal namespace, and deriveObjectID. */originalPackageId: string; /** The latest (current) package ID. Used for moveCall targets. Equals originalPackageId before any upgrade. */
20
+ latestPackageId: string;
21
+ };
22
+ interface SuiGroupsCompatibleClient extends ClientWithCoreApi {}
23
+ interface SuiGroupsClientOptions {
24
+ client: SuiGroupsCompatibleClient;
25
+ /**
26
+ * The witness type from the extending package that scopes permissions.
27
+ * This must be the full type path including package ID and module
28
+ * (e.g., '0xabc::my_module::MY_WITNESS').
29
+ *
30
+ * The witness type exists in the extending Move package (not in permissioned_groups),
31
+ * so this must always be provided by the user/extending SDK.
32
+ */
33
+ witnessType: string;
34
+ /**
35
+ * Custom package configuration for localnet, devnet, or custom deployments.
36
+ * When not provided, the config is auto-detected from the client's network.
37
+ */
38
+ packageConfig?: SuiGroupsPackageConfig;
39
+ }
40
+ /** Options for granting a permission to a member */
41
+ interface GrantPermissionCallOptions {
42
+ /** Object ID or TransactionArgument for the PermissionedGroup */
43
+ groupId: string | TransactionArgument;
44
+ /** Address of the member */
45
+ member: string | TransactionArgument;
46
+ /** The permission type to grant (e.g., '0xabc::my_app::Editor') */
47
+ permissionType: string;
48
+ }
49
+ /** Options for revoking a permission from a member */
50
+ interface RevokePermissionCallOptions {
51
+ /** Object ID or TransactionArgument for the PermissionedGroup */
52
+ groupId: string | TransactionArgument;
53
+ /** Address of the member */
54
+ member: string | TransactionArgument;
55
+ /** The permission type to revoke */
56
+ permissionType: string;
57
+ }
58
+ /** Options for removing a member from the group */
59
+ interface RemoveMemberCallOptions {
60
+ /** Object ID or TransactionArgument for the PermissionedGroup */
61
+ groupId: string | TransactionArgument;
62
+ /** Address of the member to remove */
63
+ member: string | TransactionArgument;
64
+ }
65
+ /** Options for granting permission (imperative) */
66
+ interface GrantPermissionOptions extends GrantPermissionCallOptions {
67
+ /** Signer to execute the transaction */
68
+ signer: Signer;
69
+ }
70
+ /** Options for revoking permission (imperative) */
71
+ interface RevokePermissionOptions extends RevokePermissionCallOptions {
72
+ /** Signer to execute the transaction */
73
+ signer: Signer;
74
+ }
75
+ /** Options for removing member (imperative) */
76
+ interface RemoveMemberOptions extends RemoveMemberCallOptions {
77
+ /** Signer to execute the transaction */
78
+ signer: Signer;
79
+ }
80
+ /** Options for granting multiple permissions to a member in a single transaction */
81
+ interface GrantPermissionsCallOptions {
82
+ /** Object ID or TransactionArgument for the PermissionedGroup */
83
+ groupId: string | TransactionArgument;
84
+ /** Address of the member */
85
+ member: string | TransactionArgument;
86
+ /** The permission types to grant (e.g., ['0xabc::my_app::Editor', '0xabc::my_app::Viewer']) */
87
+ permissionTypes: string[];
88
+ }
89
+ /** Options for revoking multiple permissions from a member in a single transaction */
90
+ interface RevokePermissionsCallOptions {
91
+ /** Object ID or TransactionArgument for the PermissionedGroup */
92
+ groupId: string | TransactionArgument;
93
+ /** Address of the member */
94
+ member: string | TransactionArgument;
95
+ /** The permission types to revoke */
96
+ permissionTypes: string[];
97
+ }
98
+ /** Options for a member to leave a group */
99
+ interface LeaveCallOptions {
100
+ /** Object ID or TransactionArgument for the PermissionedGroup */
101
+ groupId: string | TransactionArgument;
102
+ }
103
+ /** Options for pausing a group */
104
+ interface PauseCallOptions {
105
+ /** Object ID or TransactionArgument for the PermissionedGroup */
106
+ groupId: string | TransactionArgument;
107
+ /**
108
+ * Address to receive the `UnpauseCap`.
109
+ * Defaults to the transaction sender.
110
+ */
111
+ unpauseCapRecipient?: string;
112
+ }
113
+ /** Options for unpausing a group */
114
+ interface UnpauseCallOptions {
115
+ /** Object ID or TransactionArgument for the PermissionedGroup */
116
+ groupId: string | TransactionArgument;
117
+ /** Object ID or TransactionArgument for the UnpauseCap */
118
+ unpauseCapId: string | TransactionArgument;
119
+ }
120
+ /**
121
+ * Options for deleting a group.
122
+ *
123
+ * NOTE: `delete` returns a tuple `(PermissionsTable, u64, address)` from Move.
124
+ * There is no high-level imperative variant — callers must compose this with
125
+ * additional PTB steps (e.g., `permissions_table::destroy_empty`) in the
126
+ * extending contract or their own transaction.
127
+ */
128
+ interface DeleteCallOptions {
129
+ /** Object ID or TransactionArgument for the PermissionedGroup */
130
+ groupId: string | TransactionArgument;
131
+ }
132
+ /** Options for granting multiple permissions (imperative) */
133
+ interface GrantPermissionsOptions extends GrantPermissionsCallOptions {
134
+ /** Signer to execute the transaction */
135
+ signer: Signer;
136
+ }
137
+ /** Options for revoking multiple permissions (imperative) */
138
+ interface RevokePermissionsOptions extends RevokePermissionsCallOptions {
139
+ /** Signer to execute the transaction */
140
+ signer: Signer;
141
+ }
142
+ /** Options for leaving a group (imperative) */
143
+ interface LeaveOptions extends LeaveCallOptions {
144
+ /** Signer to execute the transaction */
145
+ signer: Signer;
146
+ }
147
+ /** Options for pausing a group (imperative) */
148
+ interface PauseOptions extends PauseCallOptions {
149
+ /** Signer to execute the transaction */
150
+ signer: Signer;
151
+ }
152
+ /** Options for unpausing a group (imperative) */
153
+ interface UnpauseOptions extends UnpauseCallOptions {
154
+ /** Signer to execute the transaction */
155
+ signer: Signer;
156
+ }
157
+ /** A member with their associated permissions, used for batch operations */
158
+ interface MemberWithPermissions {
159
+ /** Address of the member */
160
+ address: string;
161
+ /** Permission types to grant (e.g., ['0xabc::my_app::Editor', '0xabc::my_app::Viewer']) */
162
+ permissions: string[];
163
+ }
164
+ /** Options for adding multiple members with their permissions in a single transaction */
165
+ interface AddMembersCallOptions {
166
+ /** Object ID or TransactionArgument for the PermissionedGroup */
167
+ groupId: string | TransactionArgument;
168
+ /** Members and their permissions to add */
169
+ members: MemberWithPermissions[];
170
+ }
171
+ /** Options for adding multiple members with their permissions (imperative) */
172
+ interface AddMembersOptions extends AddMembersCallOptions {
173
+ /** Signer to execute the transaction */
174
+ signer: Signer;
175
+ }
176
+ /** Options for checking if a member has a specific permission */
177
+ interface HasPermissionViewOptions {
178
+ /** Object ID of the PermissionedGroup */
179
+ groupId: string;
180
+ /** Address to check */
181
+ member: string;
182
+ /** The permission type to check */
183
+ permissionType: string;
184
+ }
185
+ /** Options for checking if an address is a member */
186
+ interface IsMemberViewOptions {
187
+ /** Object ID of the PermissionedGroup */
188
+ groupId: string;
189
+ /** Address to check */
190
+ member: string;
191
+ }
192
+ /** Options for checking if a group is paused */
193
+ interface IsPausedViewOptions {
194
+ /** Object ID of the PermissionedGroup */
195
+ groupId: string;
196
+ }
197
+ /** Options for fetching a single page of members */
198
+ interface GetMembersPaginatedViewOptions {
199
+ /** Object ID of the PermissionedGroup */
200
+ groupId: string;
201
+ /** Pagination cursor from a previous response */
202
+ cursor?: string | null;
203
+ /** Maximum number of members to return per page */
204
+ limit?: number;
205
+ }
206
+ /** Options for fetching all members across all pages */
207
+ interface GetMembersExhaustiveViewOptions {
208
+ /** Object ID of the PermissionedGroup */
209
+ groupId: string;
210
+ exhaustive: true;
211
+ }
212
+ type GetMembersViewOptions = GetMembersPaginatedViewOptions | GetMembersExhaustiveViewOptions;
213
+ /** Paginated response for getMembers */
214
+ interface GetMembersResponse {
215
+ members: MemberWithPermissions[];
216
+ hasNextPage: boolean;
217
+ cursor: string | null;
218
+ }
219
+ //#endregion
220
+ export { AddMembersCallOptions, AddMembersOptions, DeleteCallOptions, GetMembersExhaustiveViewOptions, GetMembersPaginatedViewOptions, GetMembersResponse, GetMembersViewOptions, GrantPermissionCallOptions, GrantPermissionOptions, GrantPermissionsCallOptions, GrantPermissionsOptions, HasPermissionViewOptions, IsMemberViewOptions, IsPausedViewOptions, LeaveCallOptions, LeaveOptions, MemberWithPermissions, PauseCallOptions, PauseOptions, RemoveMemberCallOptions, RemoveMemberOptions, RevokePermissionCallOptions, RevokePermissionOptions, RevokePermissionsCallOptions, RevokePermissionsOptions, SuiGroupsClientOptions, SuiGroupsCompatibleClient, SuiGroupsPackageConfig, UnpauseCallOptions, UnpauseOptions };
221
+ //# sourceMappingUR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iGroupsCompatibleClient, SuiGroupsPackageConfig } from "./types.mjs";
2
+
3
+ //#region src/view.d.ts
4
+ interface SuiGroupsViewOptions {
5
+ packageConfig: SuiGroupsPackageConfig;
6
+ witnessType: string;
7
+ client: SuiGroupsCompatibleClient;
8
+ }
9
+ /**
10
+ * View methods for querying permissioned group state.
11
+ *
12
+ * These methods query on-chain state by fetching objects directly,
13
+ * without requiring a signature or spending gas.
14
+ *
15
+ * Note: Fields like `creator` and `permissions_admin_count` are available
16
+ * directly on the PermissionedGroup object when fetched via getObject.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const hasPerm = await client.groups.view.hasPermission({
21
+ * groupId: '0x456...',
22
+ * member: '0x789...',
23
+ * permissionType: '0xabc::my_app::Editor',
24
+ * });
25
+ *
26
+ * const isMember = await client.groups.view.isMember({
27
+ * groupId: '0x456...',
28
+ * member: '0x789...',
29
+ * });
30
+ * ```
31
+ */
32
+ declare class SuiGroupsView {
33
+ #private;
34
+ constructor(options: SuiGroupsViewOptions);
35
+ /**
36
+ * Checks if the given address has the specified permission.
37
+ *
38
+ * @param options.groupId - Object ID of the PermissionedGroup
39
+ * @param options.member - Address to check
40
+ * @param options.permissionType - The permission type to check (e.g., '0xabc::my_app::Editor')
41
+ * @returns `true` if the address has the permission, `false` otherwise
42
+ */
43
+ hasPermission(options: HasPermissionViewOptions): Promise<boolean>;
44
+ /**
45
+ * Checks if the given address is a member of the group.
46
+ * A member is any address that has at least one permission.
47
+ *
48
+ * @param options.groupId - Object ID of the PermissionedGroup
49
+ * @param options.member - Address to check
50
+ * @returns `true` if the address is a member, `false` otherwise
51
+ */
52
+ isMember(options: IsMemberViewOptions): Promise<boolean>;
53
+ /**
54
+ * Returns members of the group with their permissions.
55
+ *
56
+ * Supports two modes:
57
+ * - **Paginated** (default): returns a single page of members with cursor-based pagination.
58
+ * - **Exhaustive** (`{ exhaustive: true }`): fetches all members across all pages.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * // Paginated
63
+ * const page = await client.groups.view.getMembers({ groupId: '0x...' });
64
+ * console.log(page.members, page.hasNextPage, page.cursor);
65
+ *
66
+ * // Exhaustive
67
+ * const all = await client.groups.view.getMembers({ groupId: '0x...', exhaustive: true });
68
+ * console.log(all.members); // all.hasNextPage is always false
69
+ * ```
70
+ */
71
+ getMembers(options: GetMembersViewOptions): Promise<GetMembersResponse>;
72
+ /**
73
+ * Checks if the group is currently paused.
74
+ *
75
+ * A group is paused when it has a `PausedMarker` dynamic field on its UID.
76
+ * Paused groups reject all mutation calls.
77
+ *
78
+ * @param options.groupId - Object ID of the PermissionedGroup
79
+ * @returns `true` if the group is paused, `false` otherwise
80
+ */
81
+ isPaused(options: IsPausedViewOptions): Promise<boolean>;
82
+ }
83
+ //#endregion
84
+ export { SuiGroupsView };
85
+ //# sourceMappingURL=view.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.mts","names":[],"sources":["../src/view.ts"],"mappings":";;;UA0EiB,oBAAA;EAChB,aAAA,EAAe,sBAAA;EACf,WAAA;EACA,MAAA,EAAQ,yBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;cA0BI,aAAA;EAAA;cAIA,OAAA,EAAS,oBAAA;EAqKgC;;;;;;;;EAhH/C,aAAA,CAAc,OAAA,EAAS,wBAAA,GAA2B,OAAA;;;;;;;;;EAkBlD,QAAA,CAAS,OAAA,EAAS,mBAAA,GAAsB,OAAA;;;;;;;;;;;;;;;;;;;EA+CxC,UAAA,CAAW,OAAA,EAAS,qBAAA,GAAwB,OAAA,CAAQ,kBAAA;;;;;;;;;;EA+CpD,QAAA,CAAS,OAAA,EAAS,mBAAA,GAAsB,OAAA;AAAA"}