@akta/sdk 0.0.1 → 0.0.2-canary

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.
@@ -38,14 +38,8 @@ export interface SerializedMethodDefinition {
38
38
  export interface AgentInstallPlugin {
39
39
  /** Plugin identifier (sdkKey from NetworkAppIds, e.g. "payPlugin") */
40
40
  id: string;
41
- /** 0 = Global, 1 = Admin, 2 = Agent (caller-scoped) */
42
- delegationType: number;
43
41
  /** Whether the wallet owner covers transaction fees */
44
42
  coverFees?: boolean;
45
- /** Whether to default plugin execution to the escrow */
46
- defaultToEscrow?: boolean;
47
- /** Whether to use an execution key */
48
- useExecutionKey?: boolean;
49
43
  /** Method cooldown in seconds (default 0) */
50
44
  cooldown?: string;
51
45
  /** Spending allowances for this plugin */
@@ -84,7 +84,7 @@ export interface NetworkAppIds {
84
84
  * These are auto-generated by deploy-universe.ts when deploying to localnet.
85
85
  * They will be overwritten each time you run a localnet deployment.
86
86
  *
87
- * Last updated: 2026-02-17T15:59:52.097Z
87
+ * Last updated: 2026-02-17T20:47:31.334Z
88
88
  */
89
89
  export declare const LOCALNET_APP_IDS: NetworkAppIds;
90
90
  /**
@@ -19,7 +19,7 @@ exports.getAppIdFromNetwork = getAppIdFromNetwork;
19
19
  * These are auto-generated by deploy-universe.ts when deploying to localnet.
20
20
  * They will be overwritten each time you run a localnet deployment.
21
21
  *
22
- * Last updated: 2026-02-17T15:59:52.097Z
22
+ * Last updated: 2026-02-17T20:47:31.334Z
23
23
  */
24
24
  exports.LOCALNET_APP_IDS = {
25
25
  // Core Contracts
@@ -69,22 +69,22 @@ exports.LOCALNET_APP_IDS = {
69
69
  hyperSwap: 1064n,
70
70
  metaMerkles: 1048n,
71
71
  // Subgates
72
- akitaReferrerGate: 1068n,
73
- assetGate: 1066n,
74
- merkleAddressGate: 1067n,
75
- merkleAssetGate: 1065n,
76
- nfdGate: 1069n,
77
- nfdRootGate: 1070n,
78
- pollGate: 1077n,
79
- socialActivityGate: 1075n,
80
- socialFollowerCountGate: 1071n,
81
- socialFollowerIndexGate: 1076n,
82
- socialImpactGate: 1079n,
83
- socialModeratorGate: 1073n,
84
- stakingAmountGate: 1078n,
85
- stakingPowerGate: 1074n,
86
- subscriptionGate: 1080n,
87
- subscriptionStreakGate: 1072n,
72
+ akitaReferrerGate: 1067n,
73
+ assetGate: 1065n,
74
+ merkleAddressGate: 1070n,
75
+ merkleAssetGate: 1066n,
76
+ nfdGate: 1068n,
77
+ nfdRootGate: 1073n,
78
+ pollGate: 1069n,
79
+ socialActivityGate: 1072n,
80
+ socialFollowerCountGate: 1075n,
81
+ socialFollowerIndexGate: 1074n,
82
+ socialImpactGate: 1071n,
83
+ socialModeratorGate: 1076n,
84
+ stakingAmountGate: 1077n,
85
+ stakingPowerGate: 1078n,
86
+ subscriptionGate: 1079n,
87
+ subscriptionStreakGate: 1080n,
88
88
  // Assets
89
89
  akta: 1002n,
90
90
  bones: 1599n,
@@ -0,0 +1,60 @@
1
+ import type { WalletSDK } from './index';
2
+ import { AbstractedAccountArgs } from '../generated/AbstractedAccountClient';
3
+ import { AddAllowanceArgs, WalletAddPluginParams, WalletUsePluginParams } from './types';
4
+ import { MaybeSigner, SDKClient, GroupReturn } from '../types';
5
+ import { SendParams } from '@algorandfoundation/algokit-utils/types/transaction';
6
+ type ContractArgs = AbstractedAccountArgs["obj"];
7
+ /**
8
+ * Fluent composer returned by `wallet.group()` that queues wallet operations
9
+ * and resolves them as a single atomic group at `send()` time.
10
+ *
11
+ * Tracks internal state like new escrow creation across operations so that
12
+ * only the first addPlugin with a given escrow pays the NewEscrowFeeAmount.
13
+ */
14
+ export declare class WalletGroupComposer {
15
+ private wallet;
16
+ private resolvers;
17
+ private postProcessors;
18
+ private newEscrows;
19
+ private group;
20
+ constructor(wallet: WalletSDK);
21
+ private getSendParams;
22
+ addPlugin<TClient extends SDKClient>(params: WalletAddPluginParams<TClient>): this;
23
+ usePlugin(params: WalletUsePluginParams): this;
24
+ register({ sender, signer, ...args }: ContractArgs['register(string)void'] & MaybeSigner): this;
25
+ changeRevocationApp({ sender, signer, app }: MaybeSigner & {
26
+ app: bigint;
27
+ }): this;
28
+ setNickname({ sender, signer, nickname }: MaybeSigner & {
29
+ nickname: string;
30
+ }): this;
31
+ setAvatar({ sender, signer, avatar }: MaybeSigner & {
32
+ avatar: bigint;
33
+ }): this;
34
+ setBanner({ sender, signer, banner }: MaybeSigner & {
35
+ banner: bigint;
36
+ }): this;
37
+ setBio({ sender, signer, bio }: MaybeSigner & {
38
+ bio: string;
39
+ }): this;
40
+ changeAdmin({ sender, signer, newAdmin }: MaybeSigner & {
41
+ newAdmin: string;
42
+ }): this;
43
+ verifyAuthAddress(params?: MaybeSigner): this;
44
+ rekeyTo({ sender, signer, ...args }: MaybeSigner & ContractArgs['arc58_rekeyTo(address,bool)void']): this;
45
+ canCall({ sender, signer, ...args }: ContractArgs['arc58_canCall(uint64,bool,address,string,byte[4])bool'] & MaybeSigner): this;
46
+ removePlugin({ sender, signer, ...args }: ContractArgs['arc58_removePlugin(uint64,address,string)void'] & MaybeSigner): this;
47
+ newEscrow({ sender, signer, ...args }: ContractArgs['arc58_newEscrow(string)uint64'] & MaybeSigner): this;
48
+ toggleEscrowLock({ sender, signer, ...args }: ContractArgs['arc58_toggleEscrowLock(string)(uint64,bool)'] & MaybeSigner): this;
49
+ reclaimFunds({ sender, signer, ...args }: ContractArgs['arc58_reclaim(string,(uint64,uint64,bool)[])void'] & MaybeSigner): this;
50
+ optInEscrow({ sender, signer, ...args }: ContractArgs['arc58_optInEscrow(string,uint64[])void'] & MaybeSigner): this;
51
+ addAllowances({ sender, signer, escrow, allowances }: {
52
+ escrow: string;
53
+ allowances: AddAllowanceArgs[];
54
+ } & MaybeSigner): this;
55
+ removeAllowances({ sender, signer, ...args }: ContractArgs['arc58_removeAllowances(string,uint64[])void'] & MaybeSigner): this;
56
+ addExecutionKey({ sender, signer, ...args }: ContractArgs['arc58_addExecutionKey(byte[32],byte[32][],uint64,uint64)void'] & MaybeSigner): this;
57
+ removeExecutionKey({ sender, signer, ...args }: ContractArgs['arc58_removeExecutionKey(byte[32])void'] & MaybeSigner): this;
58
+ send(params?: SendParams): Promise<GroupReturn>;
59
+ }
60
+ export {};
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletGroupComposer = void 0;
4
+ const utils_1 = require("./utils");
5
+ const constants_1 = require("./constants");
6
+ const types_1 = require("../types");
7
+ const constants_2 = require("../constants");
8
+ const algosdk_1 = require("algosdk");
9
+ const algokit_utils_1 = require("@algorandfoundation/algokit-utils");
10
+ /**
11
+ * Fluent composer returned by `wallet.group()` that queues wallet operations
12
+ * and resolves them as a single atomic group at `send()` time.
13
+ *
14
+ * Tracks internal state like new escrow creation across operations so that
15
+ * only the first addPlugin with a given escrow pays the NewEscrowFeeAmount.
16
+ */
17
+ class WalletGroupComposer {
18
+ constructor(wallet) {
19
+ this.resolvers = [];
20
+ this.postProcessors = [];
21
+ this.newEscrows = new Set();
22
+ this.wallet = wallet;
23
+ this.group = wallet.client.newGroup();
24
+ }
25
+ getSendParams({ sender, signer } = {}) {
26
+ return {
27
+ ...this.wallet.sendParams,
28
+ ...(sender !== undefined && { sender }),
29
+ ...(signer !== undefined && { signer }),
30
+ };
31
+ }
32
+ // ---------------------------------------------------------------------------
33
+ // Complex methods
34
+ // ---------------------------------------------------------------------------
35
+ addPlugin(params) {
36
+ this.resolvers.push(async () => {
37
+ const { sender, signer, name = '', client, caller: rawCaller, global = false, methods = [], escrow = '', admin = false, delegationType = 0n, lastValid = constants_2.MAX_UINT64, cooldown = 0n, useRounds = false, useExecutionKey = false, coverFees = false, canReclaim = true, defaultToEscrow = false, allowances = [] } = params;
38
+ let caller = rawCaller;
39
+ const sendParams = this.getSendParams({ sender, signer });
40
+ const plugin = client.appId;
41
+ if (global) {
42
+ caller = algosdk_1.ALGORAND_ZERO_ADDRESS_STRING;
43
+ }
44
+ // Transform methods
45
+ let transformedMethods = [];
46
+ if (methods.length > 0) {
47
+ transformedMethods = methods.reduce((acc, method) => {
48
+ if ((0, types_1.isPluginSDKReturn)(method.name)) {
49
+ const selectors = method.name().selectors ?? [];
50
+ selectors.forEach((selector) => acc.push([selector, method.cooldown]));
51
+ }
52
+ else {
53
+ method.name.forEach(x => acc.push([x, method.cooldown]));
54
+ }
55
+ return acc;
56
+ }, []);
57
+ }
58
+ // Check escrow — both SDK cache and this group's new escrows
59
+ const isNewEscrow = escrow !== ''
60
+ && !this.wallet.escrows.get(escrow)
61
+ && !this.newEscrows.has(escrow);
62
+ if (isNewEscrow) {
63
+ this.newEscrows.add(escrow);
64
+ }
65
+ // Check if controlled address differs from app address — requires extra fee
66
+ const controlledAddress = await this.wallet.client.state.global.controlledAddress();
67
+ const hasExternalControlledAddress = controlledAddress !== this.wallet.client.appAddress.toString();
68
+ const externalControlledFee = hasExternalControlledAddress ? 1000n : 0n;
69
+ const extraFee = (0, algokit_utils_1.microAlgo)((isNewEscrow ? constants_1.NewEscrowFeeAmount : 0n) + externalControlledFee);
70
+ const args = {
71
+ plugin,
72
+ caller: caller,
73
+ escrow,
74
+ admin,
75
+ delegationType,
76
+ lastValid,
77
+ cooldown,
78
+ methods: transformedMethods,
79
+ useRounds,
80
+ useExecutionKey,
81
+ coverFees,
82
+ canReclaim,
83
+ defaultToEscrow
84
+ };
85
+ if (name !== '') {
86
+ this.group.arc58AddNamedPlugin({
87
+ ...sendParams,
88
+ args: { name, ...args },
89
+ extraFee
90
+ });
91
+ }
92
+ else {
93
+ this.group.arc58AddPlugin({
94
+ ...sendParams,
95
+ args,
96
+ extraFee
97
+ });
98
+ }
99
+ if (allowances.length > 0) {
100
+ if (escrow === '') {
101
+ throw new Error('Allowances can only be added to plugins with an escrow');
102
+ }
103
+ this.group.arc58AddAllowances({
104
+ ...sendParams,
105
+ args: {
106
+ escrow,
107
+ allowances: (0, utils_1.AllowancesToTuple)(allowances)
108
+ }
109
+ });
110
+ }
111
+ // Queue post-processing (runs after the group is sent)
112
+ const pluginKey = { plugin, caller: caller, escrow };
113
+ const allowanceAssets = allowances.map((a) => a.asset);
114
+ this.postProcessors.push(async () => {
115
+ if (isNewEscrow) {
116
+ await this.wallet.register({ sender, signer, escrow });
117
+ }
118
+ await this.wallet.updateCache(pluginKey, allowanceAssets).catch(error => {
119
+ console.warn('Failed to update plugin cache:', error);
120
+ });
121
+ });
122
+ });
123
+ return this;
124
+ }
125
+ usePlugin(params) {
126
+ this.resolvers.push(async () => {
127
+ const { group: tempGroup } = await this.wallet.prepareUsePlugin(params);
128
+ const atc = (await (await tempGroup.composer()).build()).atc;
129
+ const mainComposer = await this.group.composer();
130
+ mainComposer.addAtc(atc);
131
+ });
132
+ return this;
133
+ }
134
+ // ---------------------------------------------------------------------------
135
+ // Simple methods
136
+ // ---------------------------------------------------------------------------
137
+ register({ sender, signer, ...args }) {
138
+ this.resolvers.push(async () => {
139
+ this.group.register({ ...this.getSendParams({ sender, signer }), args });
140
+ });
141
+ return this;
142
+ }
143
+ changeRevocationApp({ sender, signer, app }) {
144
+ this.resolvers.push(async () => {
145
+ this.group.setRevocationApp({ ...this.getSendParams({ sender, signer }), args: { app } });
146
+ });
147
+ return this;
148
+ }
149
+ setNickname({ sender, signer, nickname }) {
150
+ this.resolvers.push(async () => {
151
+ this.group.setNickname({ ...this.getSendParams({ sender, signer }), args: { nickname } });
152
+ });
153
+ return this;
154
+ }
155
+ setAvatar({ sender, signer, avatar }) {
156
+ this.resolvers.push(async () => {
157
+ this.group.setAvatar({ ...this.getSendParams({ sender, signer }), args: { avatar } });
158
+ });
159
+ return this;
160
+ }
161
+ setBanner({ sender, signer, banner }) {
162
+ this.resolvers.push(async () => {
163
+ this.group.setBanner({ ...this.getSendParams({ sender, signer }), args: { banner } });
164
+ });
165
+ return this;
166
+ }
167
+ setBio({ sender, signer, bio }) {
168
+ this.resolvers.push(async () => {
169
+ this.group.setBio({ ...this.getSendParams({ sender, signer }), args: { bio } });
170
+ });
171
+ return this;
172
+ }
173
+ changeAdmin({ sender, signer, newAdmin }) {
174
+ this.resolvers.push(async () => {
175
+ this.group.arc58ChangeAdmin({ ...this.getSendParams({ sender, signer }), args: { newAdmin } });
176
+ });
177
+ return this;
178
+ }
179
+ verifyAuthAddress(params) {
180
+ this.resolvers.push(async () => {
181
+ this.group.arc58VerifyAuthAddress({ ...this.getSendParams(params), args: {} });
182
+ });
183
+ return this;
184
+ }
185
+ rekeyTo({ sender, signer, ...args }) {
186
+ this.resolvers.push(async () => {
187
+ this.group.arc58RekeyTo({ ...this.getSendParams({ sender, signer }), args });
188
+ });
189
+ return this;
190
+ }
191
+ canCall({ sender, signer, ...args }) {
192
+ this.resolvers.push(async () => {
193
+ this.group.arc58CanCall({ ...this.getSendParams({ sender, signer }), args });
194
+ });
195
+ return this;
196
+ }
197
+ removePlugin({ sender, signer, ...args }) {
198
+ this.resolvers.push(async () => {
199
+ this.group.arc58RemovePlugin({ ...this.getSendParams({ sender, signer }), args });
200
+ });
201
+ return this;
202
+ }
203
+ newEscrow({ sender, signer, ...args }) {
204
+ this.resolvers.push(async () => {
205
+ this.group.arc58NewEscrow({ ...this.getSendParams({ sender, signer }), args });
206
+ this.newEscrows.add(args.escrow);
207
+ });
208
+ return this;
209
+ }
210
+ toggleEscrowLock({ sender, signer, ...args }) {
211
+ this.resolvers.push(async () => {
212
+ this.group.arc58ToggleEscrowLock({ ...this.getSendParams({ sender, signer }), args });
213
+ });
214
+ return this;
215
+ }
216
+ reclaimFunds({ sender, signer, ...args }) {
217
+ this.resolvers.push(async () => {
218
+ this.group.arc58Reclaim({ ...this.getSendParams({ sender, signer }), args });
219
+ });
220
+ return this;
221
+ }
222
+ optInEscrow({ sender, signer, ...args }) {
223
+ this.resolvers.push(async () => {
224
+ this.group.arc58OptInEscrow({ ...this.getSendParams({ sender, signer }), args });
225
+ });
226
+ return this;
227
+ }
228
+ addAllowances({ sender, signer, escrow, allowances }) {
229
+ this.resolvers.push(async () => {
230
+ this.group.arc58AddAllowances({
231
+ ...this.getSendParams({ sender, signer }),
232
+ args: { escrow, allowances: (0, utils_1.AllowancesToTuple)(allowances) }
233
+ });
234
+ });
235
+ return this;
236
+ }
237
+ removeAllowances({ sender, signer, ...args }) {
238
+ this.resolvers.push(async () => {
239
+ this.group.arc58RemoveAllowances({ ...this.getSendParams({ sender, signer }), args });
240
+ });
241
+ return this;
242
+ }
243
+ addExecutionKey({ sender, signer, ...args }) {
244
+ this.resolvers.push(async () => {
245
+ this.group.arc58AddExecutionKey({ ...this.getSendParams({ sender, signer }), args });
246
+ });
247
+ return this;
248
+ }
249
+ removeExecutionKey({ sender, signer, ...args }) {
250
+ this.resolvers.push(async () => {
251
+ this.group.arc58RemoveExecutionKey({ ...this.getSendParams({ sender, signer }), args });
252
+ });
253
+ return this;
254
+ }
255
+ // ---------------------------------------------------------------------------
256
+ // Terminal
257
+ // ---------------------------------------------------------------------------
258
+ async send(params) {
259
+ // Resolve all queued operations (builds the atomic group)
260
+ for (const resolver of this.resolvers) {
261
+ await resolver();
262
+ }
263
+ // Send the atomic group
264
+ const result = await this.group.send(params);
265
+ // Run post-processors (register escrows, update caches)
266
+ for (const postProcessor of this.postProcessors) {
267
+ await postProcessor();
268
+ }
269
+ return result;
270
+ }
271
+ }
272
+ exports.WalletGroupComposer = WalletGroupComposer;
273
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/wallet/group.ts"],"names":[],"mappings":";;;AAGA,mCAA2C;AAC3C,2CAAgD;AAChD,oCAAqG;AACrG,4CAAyC;AACzC,qCAAsD;AACtD,qEAA6D;AAK7D;;;;;;GAMG;AACH,MAAa,mBAAmB;IAO9B,YAAY,MAAiB;QALrB,cAAS,GAA4B,EAAE,CAAA;QACvC,mBAAc,GAA4B,EAAE,CAAA;QAC5C,eAAU,GAAgB,IAAI,GAAG,EAAE,CAAA;QAIzC,IAAI,CAAC,MAAM,GAAG,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EAAE,MAAM,EAAE,GAAG,IAAI,EAAwE;QAClH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAC7B,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACzF,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,8EAA8E;IAC9E,WAAW;IACX,8EAA8E;IAE9E,KAAK,CAAC,IAAI,CAAC,MAAmB;QAC5B,0DAA0D;QAC1D,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,MAAM,QAAQ,EAAE,CAAA;QAClB,CAAC;QAED,wBAAwB;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAE5C,wDAAwD;QACxD,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YAChD,MAAM,aAAa,EAAE,CAAA;QACvB,CAAC;QAED,OAAO,MAAgC,CAAA;IACzC,CAAC;CACF;AAhTD,kDAgTC"}
@@ -1,10 +1,12 @@
1
- import { AbstractAccountBoxMbrData, AbstractedAccountArgs, AllowanceKey, EscrowInfo, PluginKey, type AbstractedAccountClient, ExecutionInfo } from '../generated/AbstractedAccountClient';
1
+ import { AbstractAccountBoxMbrData, AbstractedAccountArgs, AllowanceKey, EscrowInfo, PluginKey, type AbstractedAccountClient, ExecutionInfo, AbstractedAccountComposer } from '../generated/AbstractedAccountClient';
2
2
  import { AddAllowanceArgs, AllowanceInfo, BuildWalletUsePluginParams, CanCallParams, ExecutionBuildGroup, MbrParams, PluginInfo, WalletAddPluginParams, WalletGlobalState, WalletUsePluginParams } from './types';
3
- import { MaybeSigner, NewContractSDKParams, SDKClient, GroupReturn, TxnReturn } from '../types';
3
+ import { MaybeSigner, NewContractSDKParams, SDKClient, GroupReturn, TxnReturn, ExpandedSendParamsWithSigner } from '../types';
4
4
  import { BaseSDK } from '../base';
5
5
  import { ValueMap } from './utils';
6
+ import { WalletGroupComposer } from './group';
6
7
  export * from './constants';
7
8
  export * from './factory';
9
+ export * from './group';
8
10
  export * from './plugins';
9
11
  export * from "./types";
10
12
  type ContractArgs = AbstractedAccountArgs["obj"];
@@ -17,8 +19,16 @@ export declare class WalletSDK extends BaseSDK<AbstractedAccountClient> {
17
19
  allowances: ValueMap<AllowanceKey, AllowanceInfo>;
18
20
  executions: Map<Uint8Array, ExecutionInfo>;
19
21
  constructor(params: NewContractSDKParams);
20
- private updateCache;
21
- private prepareUsePlugin;
22
+ group(): WalletGroupComposer;
23
+ updateCache(key: PluginKey, allowances?: bigint[]): Promise<void>;
24
+ prepareUsePlugin({ sender, signer, name, global, escrow, fundsRequest, calls, lease }: WalletUsePluginParams): Promise<{
25
+ plugins: bigint[];
26
+ caller: string;
27
+ useRounds: boolean;
28
+ length: number;
29
+ group: AbstractedAccountComposer<[]>;
30
+ sendParams: ExpandedSendParamsWithSigner;
31
+ }>;
22
32
  register({ sender, signer, escrow }: ContractArgs['register(string)void'] & MaybeSigner): Promise<void>;
23
33
  changeRevocationApp({ sender, signer, app }: MaybeSigner & {
24
34
  app: bigint;
@@ -47,7 +57,7 @@ export declare class WalletSDK extends BaseSDK<AbstractedAccountClient> {
47
57
  newEscrow({ sender, signer, ...args }: ContractArgs['arc58_newEscrow(string)uint64'] & MaybeSigner): Promise<TxnReturn<bigint>>;
48
58
  toggleEscrowLock({ sender, signer, ...args }: ContractArgs['arc58_toggleEscrowLock(string)(uint64,bool)'] & MaybeSigner): Promise<TxnReturn<EscrowInfo>>;
49
59
  reclaimFunds({ sender, signer, ...args }: ContractArgs['arc58_reclaim(string,(uint64,uint64,bool)[])void'] & MaybeSigner): Promise<TxnReturn<void>>;
50
- optinEscrow({ sender, signer, ...args }: ContractArgs['arc58_optInEscrow(string,uint64[])void'] & MaybeSigner): Promise<TxnReturn<void>>;
60
+ optInEscrow({ sender, signer, ...args }: ContractArgs['arc58_optInEscrow(string,uint64[])void'] & MaybeSigner): Promise<TxnReturn<void>>;
51
61
  addAllowances({ sender, signer, escrow, allowances }: {
52
62
  escrow: string;
53
63
  allowances: AddAllowanceArgs[];
@@ -47,8 +47,10 @@ const utils_1 = require("./utils");
47
47
  const constants_2 = require("./constants");
48
48
  const algokit_utils_1 = require("@algorandfoundation/algokit-utils");
49
49
  const prepare_1 = require("../simulate/prepare");
50
+ const group_1 = require("./group");
50
51
  __exportStar(require("./constants"), exports);
51
52
  __exportStar(require("./factory"), exports);
53
+ __exportStar(require("./group"), exports);
52
54
  __exportStar(require("./plugins"), exports);
53
55
  __exportStar(require("./types"), exports);
54
56
  // things i want to include in the SDK
@@ -193,6 +195,9 @@ class WalletSDK extends base_1.BaseSDK {
193
195
  }
194
196
  };
195
197
  }
198
+ group() {
199
+ return new group_1.WalletGroupComposer(this);
200
+ }
196
201
  async updateCache(key, allowances) {
197
202
  const { escrow } = key;
198
203
  const requestList = [this.getPluginByKey(key)];
@@ -712,7 +717,7 @@ class WalletSDK extends base_1.BaseSDK {
712
717
  args
713
718
  });
714
719
  }
715
- async optinEscrow({ sender, signer, ...args }) {
720
+ async optInEscrow({ sender, signer, ...args }) {
716
721
  const sendParams = this.getSendParams({ sender, signer });
717
722
  return await this.client.send.arc58OptInEscrow({ ...sendParams, args });
718
723
  }