@d13co/escreg-sdk 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.
@@ -0,0 +1,1176 @@
1
+ import { getArc56ReturnValue, getABIStructFromABITuple } from '@algorandfoundation/algokit-utils/types/app-arc56';
2
+ import { AppClient as _AppClient, } from '@algorandfoundation/algokit-utils/types/app-client';
3
+ export const APP_SPEC = { "name": "Escreg", "structs": { "AddressWithAuth": [{ "name": "appId", "type": "uint64" }, { "name": "authAppId", "type": "uint64" }] }, "methods": [{ "name": "deleteApplication", "args": [], "returns": { "type": "void" }, "actions": { "create": [], "call": ["DeleteApplication"] }, "readonly": false, "desc": "Delete the application.", "events": [], "recommendations": {} }, { "name": "updateApplication", "args": [], "returns": { "type": "void" }, "actions": { "create": [], "call": ["UpdateApplication"] }, "readonly": false, "desc": "Update the application.", "events": [], "recommendations": {} }, { "name": "withdraw", "args": [{ "type": "uint64", "name": "amount", "desc": "Amount of microAlgos to withdraw." }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "desc": "Withdraw funds from the contract to the admin.", "events": [], "recommendations": {} }, { "name": "deleteBoxes", "args": [{ "type": "byte[4][]", "name": "boxKeys", "desc": "Array of 4-byte box keys to delete." }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "desc": "Delete app registry boxes by their keys.", "events": [], "recommendations": {} }, { "name": "register", "args": [{ "type": "uint64", "name": "appId", "desc": "App ID of the application to register. The app address derived from this ID will be registered in the contract and can be retrieved later." }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "desc": "Register a single application escrow account", "events": [], "recommendations": {} }, { "name": "registerList", "args": [{ "type": "uint64[]", "name": "appIds", "desc": "Array of App IDs to register. The app addresses derived from these IDs will be registered in the contract and can be retrieved later." }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "desc": "Register multiple application escrow accounts in a single transaction. This is more efficient than calling register multiple times as the MBR cost can be paid for in a single payment and the app IDs can be stored more efficiently in the contract state.", "events": [], "recommendations": {} }, { "name": "exists", "args": [{ "type": "address", "name": "address", "desc": "App Escrow to check" }], "returns": { "type": "bool", "desc": "boolean indicating whether the given address is registered in the contract" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": true, "desc": "Return true if an app escrow account exists for the given address, false otherwise.", "events": [], "recommendations": {} }, { "name": "get", "args": [{ "type": "address", "name": "address", "desc": "App Escrow to get the app ID for" }], "returns": { "type": "uint64", "desc": "App ID for the given address, or 0 if not registered" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": true, "desc": "Get the app ID for the given app escrow address. Returns 0 if the app escrow is not registered in the contract.", "events": [], "recommendations": {} }, { "name": "mustGet", "args": [{ "type": "address", "name": "address", "desc": "App Escrow to get the app ID for" }], "returns": { "type": "uint64", "desc": "App ID for the given address" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": true, "desc": "Get the app ID for the given app escrow address. Throws an error if the app escrow is not registered in the contract.", "events": [], "recommendations": {} }, { "name": "getWithAuth", "args": [{ "type": "address", "name": "address", "desc": "App Escrow to get the app ID for, along with its auth address" }], "returns": { "type": "(uint64,uint64)", "struct": "AddressWithAuth", "desc": "[app ID for the given address, app ID for the auth address], or 0 for each if not registered" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": true, "desc": "Get the app ID for the given app escrow address and its auth address. Returns 0 for each if not registered in the contract.", "events": [], "recommendations": {} }, { "name": "getWithAuthList", "args": [{ "type": "address[]", "name": "addresses", "desc": "App Escrows to get the app IDs for, along with their auth addresses" }], "returns": { "type": "(uint64,uint64)[]", "desc": "Array of [app ID for the given address, app ID for the auth address] for each input address, or 0 for each if not registered" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": true, "desc": "Get the app ID for multiple app escrow addresses and their auth addresses. Returns 0 for each if not registered in the contract.", "events": [], "recommendations": {} }, { "name": "getList", "args": [{ "type": "address[]", "name": "addresses", "desc": "App Escrows to get the app IDs for" }], "returns": { "type": "uint64[]", "desc": "Array of app IDs for each input address, or 0 if not registered" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": true, "desc": "Get the app IDs for multiple app escrow addresses. Returns 0 for each if not registered in the contract.", "events": [], "recommendations": {} }, { "name": "mustGetList", "args": [{ "type": "address[]", "name": "addresses", "desc": "App Escrows to get the app IDs for" }], "returns": { "type": "uint64[]", "desc": "Array of app IDs for each input address" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": true, "desc": "Get the app IDs for multiple app escrow addresses. Throws an error if any of the app escrows are not registered in the contract.", "events": [], "recommendations": {} }, { "name": "increaseBudget", "args": [{ "type": "uint64", "name": "itxns", "desc": "Number of itxns to perform." }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "desc": "Utility for explicitly increasing the budget of a transaction group by performing no-op inner transactions.", "events": [], "recommendations": {} }, { "name": "depositCredits", "args": [{ "type": "address", "name": "creditor", "desc": "account to credit" }, { "type": "pay", "name": "txn", "desc": "payment transaction to contract. amount is the credit received" }], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "desc": "public method to deposit MBR credits for an account", "events": [], "recommendations": {} }, { "name": "withdrawCredits", "args": [], "returns": { "type": "void" }, "actions": { "create": [], "call": ["NoOp"] }, "readonly": false, "desc": "Withdraw all remaining MBR credits for sender. This will delete the user credit box, so all credits are withdrawn including the MBR locked for the box itself.", "events": [], "recommendations": {} }], "arcs": [22, 28], "networks": {}, "state": { "schema": { "global": { "ints": 32, "bytes": 32 }, "local": { "ints": 0, "bytes": 0 } }, "keys": { "global": { "admin": { "keyType": "AVMString", "valueType": "address", "key": "YWRtaW4=", "desc": "Contract admin" }, "counter": { "keyType": "AVMString", "valueType": "AVMUint64", "key": "Y291bnRlcg==", "desc": "Counter for the number of registered applications" } }, "local": {}, "box": {} }, "maps": { "global": {}, "local": {}, "box": { "apps": { "keyType": "AVMBytes", "valueType": "uint64[]", "desc": "BoxMap from 4-byte prefix of escrow to app IDs", "prefix": "" }, "userCredits": { "keyType": "address", "valueType": "uint64", "prefix": "Yw==" } } } }, "bareActions": { "create": ["NoOp"], "call": [] }, "sourceInfo": { "approval": { "sourceInfo": [{ "pc": [557, 613, 664, 732, 790, 888, 946, 1103, 1223, 1390, 1439, 1518, 1715, 1783], "errorMessage": "Box must have value" }, { "pc": [242], "errorMessage": "OnCompletion must be DeleteApplication && can only call when not creating" }, { "pc": [113], "errorMessage": "OnCompletion must be NoOp" }, { "pc": [253], "errorMessage": "OnCompletion must be NoOp && can only call when creating" }, { "pc": [230], "errorMessage": "OnCompletion must be UpdateApplication && can only call when not creating" }, { "pc": [369, 428, 751, 907, 1396, 1419, 1451, 1677], "errorMessage": "account funded" }, { "pc": [330, 383, 465, 1479, 1602], "errorMessage": "check GlobalState exists" }, { "pc": [317, 846, 1028, 1180], "errorMessage": "index access is out of bounds" }, { "pc": [298, 430, 825, 1007, 1159, 1617], "errorMessage": "invalid array length header" }, { "pc": [1337], "errorMessage": "invalid number of bytes for arc4.static_array<arc4.uint8, 32>" }, { "pc": [967, 1076, 1121, 1253, 1577], "errorMessage": "max array length exceeded" }, { "pc": [1348], "errorMessage": "transaction type is pay" }], "pcOffsetMethod": "none" }, "clear": { "sourceInfo": [], "pcOffsetMethod": "none" } }, "events": [] };
4
+ class BinaryStateValue {
5
+ constructor(value) {
6
+ this.value = value;
7
+ }
8
+ asByteArray() {
9
+ return this.value;
10
+ }
11
+ asString() {
12
+ return this.value !== undefined ? Buffer.from(this.value).toString('utf-8') : undefined;
13
+ }
14
+ }
15
+ /**
16
+ * Converts the ABI tuple representation of a AddressWithAuth to the struct representation
17
+ */
18
+ export function AddressWithAuthFromTuple(abiTuple) {
19
+ return getABIStructFromABITuple(abiTuple, APP_SPEC.structs.AddressWithAuth, APP_SPEC.structs);
20
+ }
21
+ /**
22
+ * Exposes methods for constructing `AppClient` params objects for ABI calls to the Escreg smart contract
23
+ */
24
+ export class EscregParamsFactory {
25
+ /**
26
+ * Constructs a no op call for the withdraw(uint64)void ABI method
27
+ *
28
+ * Withdraw funds from the contract to the admin.
29
+ *
30
+ * @param params Parameters for the call
31
+ * @returns An `AppClientMethodCallParams` object for the call
32
+ */
33
+ static withdraw(params) {
34
+ return {
35
+ ...params,
36
+ method: 'withdraw(uint64)void',
37
+ args: Array.isArray(params.args) ? params.args : [params.args.amount],
38
+ };
39
+ }
40
+ /**
41
+ * Constructs a no op call for the deleteBoxes(byte[4][])void ABI method
42
+ *
43
+ * Delete app registry boxes by their keys.
44
+ *
45
+ * @param params Parameters for the call
46
+ * @returns An `AppClientMethodCallParams` object for the call
47
+ */
48
+ static deleteBoxes(params) {
49
+ return {
50
+ ...params,
51
+ method: 'deleteBoxes(byte[4][])void',
52
+ args: Array.isArray(params.args) ? params.args : [params.args.boxKeys],
53
+ };
54
+ }
55
+ /**
56
+ * Constructs a no op call for the register(uint64)void ABI method
57
+ *
58
+ * Register a single application escrow account
59
+ *
60
+ * @param params Parameters for the call
61
+ * @returns An `AppClientMethodCallParams` object for the call
62
+ */
63
+ static register(params) {
64
+ return {
65
+ ...params,
66
+ method: 'register(uint64)void',
67
+ args: Array.isArray(params.args) ? params.args : [params.args.appId],
68
+ };
69
+ }
70
+ /**
71
+ * Constructs a no op call for the registerList(uint64[])void ABI method
72
+ *
73
+ * Register multiple application escrow accounts in a single transaction. This is more efficient than calling register multiple times as the MBR cost can be paid for in a single payment and the app IDs can be stored more efficiently in the contract state.
74
+ *
75
+ * @param params Parameters for the call
76
+ * @returns An `AppClientMethodCallParams` object for the call
77
+ */
78
+ static registerList(params) {
79
+ return {
80
+ ...params,
81
+ method: 'registerList(uint64[])void',
82
+ args: Array.isArray(params.args) ? params.args : [params.args.appIds],
83
+ };
84
+ }
85
+ /**
86
+ * Constructs a no op call for the exists(address)bool ABI method
87
+ *
88
+ * Return true if an app escrow account exists for the given address, false otherwise.
89
+ *
90
+ * @param params Parameters for the call
91
+ * @returns An `AppClientMethodCallParams` object for the call
92
+ */
93
+ static exists(params) {
94
+ return {
95
+ ...params,
96
+ method: 'exists(address)bool',
97
+ args: Array.isArray(params.args) ? params.args : [params.args.address],
98
+ };
99
+ }
100
+ /**
101
+ * Constructs a no op call for the get(address)uint64 ABI method
102
+ *
103
+ * Get the app ID for the given app escrow address. Returns 0 if the app escrow is not registered in the contract.
104
+ *
105
+ * @param params Parameters for the call
106
+ * @returns An `AppClientMethodCallParams` object for the call
107
+ */
108
+ static get(params) {
109
+ return {
110
+ ...params,
111
+ method: 'get(address)uint64',
112
+ args: Array.isArray(params.args) ? params.args : [params.args.address],
113
+ };
114
+ }
115
+ /**
116
+ * Constructs a no op call for the mustGet(address)uint64 ABI method
117
+ *
118
+ * Get the app ID for the given app escrow address. Throws an error if the app escrow is not registered in the contract.
119
+ *
120
+ * @param params Parameters for the call
121
+ * @returns An `AppClientMethodCallParams` object for the call
122
+ */
123
+ static mustGet(params) {
124
+ return {
125
+ ...params,
126
+ method: 'mustGet(address)uint64',
127
+ args: Array.isArray(params.args) ? params.args : [params.args.address],
128
+ };
129
+ }
130
+ /**
131
+ * Constructs a no op call for the getWithAuth(address)(uint64,uint64) ABI method
132
+ *
133
+ * Get the app ID for the given app escrow address and its auth address. Returns 0 for each if not registered in the contract.
134
+ *
135
+ * @param params Parameters for the call
136
+ * @returns An `AppClientMethodCallParams` object for the call
137
+ */
138
+ static getWithAuth(params) {
139
+ return {
140
+ ...params,
141
+ method: 'getWithAuth(address)(uint64,uint64)',
142
+ args: Array.isArray(params.args) ? params.args : [params.args.address],
143
+ };
144
+ }
145
+ /**
146
+ * Constructs a no op call for the getWithAuthList(address[])(uint64,uint64)[] ABI method
147
+ *
148
+ * Get the app ID for multiple app escrow addresses and their auth addresses. Returns 0 for each if not registered in the contract.
149
+ *
150
+ * @param params Parameters for the call
151
+ * @returns An `AppClientMethodCallParams` object for the call
152
+ */
153
+ static getWithAuthList(params) {
154
+ return {
155
+ ...params,
156
+ method: 'getWithAuthList(address[])(uint64,uint64)[]',
157
+ args: Array.isArray(params.args) ? params.args : [params.args.addresses],
158
+ };
159
+ }
160
+ /**
161
+ * Constructs a no op call for the getList(address[])uint64[] ABI method
162
+ *
163
+ * Get the app IDs for multiple app escrow addresses. Returns 0 for each if not registered in the contract.
164
+ *
165
+ * @param params Parameters for the call
166
+ * @returns An `AppClientMethodCallParams` object for the call
167
+ */
168
+ static getList(params) {
169
+ return {
170
+ ...params,
171
+ method: 'getList(address[])uint64[]',
172
+ args: Array.isArray(params.args) ? params.args : [params.args.addresses],
173
+ };
174
+ }
175
+ /**
176
+ * Constructs a no op call for the mustGetList(address[])uint64[] ABI method
177
+ *
178
+ * Get the app IDs for multiple app escrow addresses. Throws an error if any of the app escrows are not registered in the contract.
179
+ *
180
+ * @param params Parameters for the call
181
+ * @returns An `AppClientMethodCallParams` object for the call
182
+ */
183
+ static mustGetList(params) {
184
+ return {
185
+ ...params,
186
+ method: 'mustGetList(address[])uint64[]',
187
+ args: Array.isArray(params.args) ? params.args : [params.args.addresses],
188
+ };
189
+ }
190
+ /**
191
+ * Constructs a no op call for the increaseBudget(uint64)void ABI method
192
+ *
193
+ * Utility for explicitly increasing the budget of a transaction group by performing no-op inner transactions.
194
+ *
195
+ * @param params Parameters for the call
196
+ * @returns An `AppClientMethodCallParams` object for the call
197
+ */
198
+ static increaseBudget(params) {
199
+ return {
200
+ ...params,
201
+ method: 'increaseBudget(uint64)void',
202
+ args: Array.isArray(params.args) ? params.args : [params.args.itxns],
203
+ };
204
+ }
205
+ /**
206
+ * Constructs a no op call for the depositCredits(address,pay)void ABI method
207
+ *
208
+ * public method to deposit MBR credits for an account
209
+ *
210
+ * @param params Parameters for the call
211
+ * @returns An `AppClientMethodCallParams` object for the call
212
+ */
213
+ static depositCredits(params) {
214
+ return {
215
+ ...params,
216
+ method: 'depositCredits(address,pay)void',
217
+ args: Array.isArray(params.args) ? params.args : [params.args.creditor, params.args.txn],
218
+ };
219
+ }
220
+ /**
221
+ * Constructs a no op call for the withdrawCredits()void ABI method
222
+ *
223
+ * Withdraw all remaining MBR credits for sender. This will delete the user credit box, so all credits are withdrawn including the MBR locked for the box itself.
224
+ *
225
+ * @param params Parameters for the call
226
+ * @returns An `AppClientMethodCallParams` object for the call
227
+ */
228
+ static withdrawCredits(params) {
229
+ return {
230
+ ...params,
231
+ method: 'withdrawCredits()void',
232
+ args: Array.isArray(params.args) ? params.args : [],
233
+ };
234
+ }
235
+ }
236
+ /**
237
+ * A client to make calls to the Escreg smart contract
238
+ */
239
+ export class EscregClient {
240
+ constructor(appClientOrParams) {
241
+ /**
242
+ * Get parameters to create transactions for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.
243
+ */
244
+ this.params = {
245
+ /**
246
+ * Makes a clear_state call to an existing instance of the Escreg smart contract.
247
+ *
248
+ * @param params The params for the bare (raw) call
249
+ * @returns The clearState result
250
+ */
251
+ clearState: (params) => {
252
+ return this.appClient.params.bare.clearState(params);
253
+ },
254
+ /**
255
+ * Makes a call to the Escreg smart contract using the `withdraw(uint64)void` ABI method.
256
+ *
257
+ * Withdraw funds from the contract to the admin.
258
+ *
259
+ * @param params The params for the smart contract call
260
+ * @returns The call params
261
+ */
262
+ withdraw: (params) => {
263
+ return this.appClient.params.call(EscregParamsFactory.withdraw(params));
264
+ },
265
+ /**
266
+ * Makes a call to the Escreg smart contract using the `deleteBoxes(byte[4][])void` ABI method.
267
+ *
268
+ * Delete app registry boxes by their keys.
269
+ *
270
+ * @param params The params for the smart contract call
271
+ * @returns The call params
272
+ */
273
+ deleteBoxes: (params) => {
274
+ return this.appClient.params.call(EscregParamsFactory.deleteBoxes(params));
275
+ },
276
+ /**
277
+ * Makes a call to the Escreg smart contract using the `register(uint64)void` ABI method.
278
+ *
279
+ * Register a single application escrow account
280
+ *
281
+ * @param params The params for the smart contract call
282
+ * @returns The call params
283
+ */
284
+ register: (params) => {
285
+ return this.appClient.params.call(EscregParamsFactory.register(params));
286
+ },
287
+ /**
288
+ * Makes a call to the Escreg smart contract using the `registerList(uint64[])void` ABI method.
289
+ *
290
+ * Register multiple application escrow accounts in a single transaction. This is more efficient than calling register multiple times as the MBR cost can be paid for in a single payment and the app IDs can be stored more efficiently in the contract state.
291
+ *
292
+ * @param params The params for the smart contract call
293
+ * @returns The call params
294
+ */
295
+ registerList: (params) => {
296
+ return this.appClient.params.call(EscregParamsFactory.registerList(params));
297
+ },
298
+ /**
299
+ * Makes a call to the Escreg smart contract using the `exists(address)bool` ABI method.
300
+ *
301
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
302
+ *
303
+ * Return true if an app escrow account exists for the given address, false otherwise.
304
+ *
305
+ * @param params The params for the smart contract call
306
+ * @returns The call params: boolean indicating whether the given address is registered in the contract
307
+ */
308
+ exists: (params) => {
309
+ return this.appClient.params.call(EscregParamsFactory.exists(params));
310
+ },
311
+ /**
312
+ * Makes a call to the Escreg smart contract using the `get(address)uint64` ABI method.
313
+ *
314
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
315
+ *
316
+ * Get the app ID for the given app escrow address. Returns 0 if the app escrow is not registered in the contract.
317
+ *
318
+ * @param params The params for the smart contract call
319
+ * @returns The call params: App ID for the given address, or 0 if not registered
320
+ */
321
+ get: (params) => {
322
+ return this.appClient.params.call(EscregParamsFactory.get(params));
323
+ },
324
+ /**
325
+ * Makes a call to the Escreg smart contract using the `mustGet(address)uint64` ABI method.
326
+ *
327
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
328
+ *
329
+ * Get the app ID for the given app escrow address. Throws an error if the app escrow is not registered in the contract.
330
+ *
331
+ * @param params The params for the smart contract call
332
+ * @returns The call params: App ID for the given address
333
+ */
334
+ mustGet: (params) => {
335
+ return this.appClient.params.call(EscregParamsFactory.mustGet(params));
336
+ },
337
+ /**
338
+ * Makes a call to the Escreg smart contract using the `getWithAuth(address)(uint64,uint64)` ABI method.
339
+ *
340
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
341
+ *
342
+ * Get the app ID for the given app escrow address and its auth address. Returns 0 for each if not registered in the contract.
343
+ *
344
+ * @param params The params for the smart contract call
345
+ * @returns The call params: [app ID for the given address, app ID for the auth address], or 0 for each if not registered
346
+ */
347
+ getWithAuth: (params) => {
348
+ return this.appClient.params.call(EscregParamsFactory.getWithAuth(params));
349
+ },
350
+ /**
351
+ * Makes a call to the Escreg smart contract using the `getWithAuthList(address[])(uint64,uint64)[]` ABI method.
352
+ *
353
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
354
+ *
355
+ * Get the app ID for multiple app escrow addresses and their auth addresses. Returns 0 for each if not registered in the contract.
356
+ *
357
+ * @param params The params for the smart contract call
358
+ * @returns The call params: Array of [app ID for the given address, app ID for the auth address] for each input address, or 0 for each if not registered
359
+ */
360
+ getWithAuthList: (params) => {
361
+ return this.appClient.params.call(EscregParamsFactory.getWithAuthList(params));
362
+ },
363
+ /**
364
+ * Makes a call to the Escreg smart contract using the `getList(address[])uint64[]` ABI method.
365
+ *
366
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
367
+ *
368
+ * Get the app IDs for multiple app escrow addresses. Returns 0 for each if not registered in the contract.
369
+ *
370
+ * @param params The params for the smart contract call
371
+ * @returns The call params: Array of app IDs for each input address, or 0 if not registered
372
+ */
373
+ getList: (params) => {
374
+ return this.appClient.params.call(EscregParamsFactory.getList(params));
375
+ },
376
+ /**
377
+ * Makes a call to the Escreg smart contract using the `mustGetList(address[])uint64[]` ABI method.
378
+ *
379
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
380
+ *
381
+ * Get the app IDs for multiple app escrow addresses. Throws an error if any of the app escrows are not registered in the contract.
382
+ *
383
+ * @param params The params for the smart contract call
384
+ * @returns The call params: Array of app IDs for each input address
385
+ */
386
+ mustGetList: (params) => {
387
+ return this.appClient.params.call(EscregParamsFactory.mustGetList(params));
388
+ },
389
+ /**
390
+ * Makes a call to the Escreg smart contract using the `increaseBudget(uint64)void` ABI method.
391
+ *
392
+ * Utility for explicitly increasing the budget of a transaction group by performing no-op inner transactions.
393
+ *
394
+ * @param params The params for the smart contract call
395
+ * @returns The call params
396
+ */
397
+ increaseBudget: (params) => {
398
+ return this.appClient.params.call(EscregParamsFactory.increaseBudget(params));
399
+ },
400
+ /**
401
+ * Makes a call to the Escreg smart contract using the `depositCredits(address,pay)void` ABI method.
402
+ *
403
+ * public method to deposit MBR credits for an account
404
+ *
405
+ * @param params The params for the smart contract call
406
+ * @returns The call params
407
+ */
408
+ depositCredits: (params) => {
409
+ return this.appClient.params.call(EscregParamsFactory.depositCredits(params));
410
+ },
411
+ /**
412
+ * Makes a call to the Escreg smart contract using the `withdrawCredits()void` ABI method.
413
+ *
414
+ * Withdraw all remaining MBR credits for sender. This will delete the user credit box, so all credits are withdrawn including the MBR locked for the box itself.
415
+ *
416
+ * @param params The params for the smart contract call
417
+ * @returns The call params
418
+ */
419
+ withdrawCredits: (params = { args: [] }) => {
420
+ return this.appClient.params.call(EscregParamsFactory.withdrawCredits(params));
421
+ },
422
+ };
423
+ /**
424
+ * Create transactions for the current app
425
+ */
426
+ this.createTransaction = {
427
+ /**
428
+ * Makes a clear_state call to an existing instance of the Escreg smart contract.
429
+ *
430
+ * @param params The params for the bare (raw) call
431
+ * @returns The clearState result
432
+ */
433
+ clearState: (params) => {
434
+ return this.appClient.createTransaction.bare.clearState(params);
435
+ },
436
+ /**
437
+ * Makes a call to the Escreg smart contract using the `withdraw(uint64)void` ABI method.
438
+ *
439
+ * Withdraw funds from the contract to the admin.
440
+ *
441
+ * @param params The params for the smart contract call
442
+ * @returns The call transaction
443
+ */
444
+ withdraw: (params) => {
445
+ return this.appClient.createTransaction.call(EscregParamsFactory.withdraw(params));
446
+ },
447
+ /**
448
+ * Makes a call to the Escreg smart contract using the `deleteBoxes(byte[4][])void` ABI method.
449
+ *
450
+ * Delete app registry boxes by their keys.
451
+ *
452
+ * @param params The params for the smart contract call
453
+ * @returns The call transaction
454
+ */
455
+ deleteBoxes: (params) => {
456
+ return this.appClient.createTransaction.call(EscregParamsFactory.deleteBoxes(params));
457
+ },
458
+ /**
459
+ * Makes a call to the Escreg smart contract using the `register(uint64)void` ABI method.
460
+ *
461
+ * Register a single application escrow account
462
+ *
463
+ * @param params The params for the smart contract call
464
+ * @returns The call transaction
465
+ */
466
+ register: (params) => {
467
+ return this.appClient.createTransaction.call(EscregParamsFactory.register(params));
468
+ },
469
+ /**
470
+ * Makes a call to the Escreg smart contract using the `registerList(uint64[])void` ABI method.
471
+ *
472
+ * Register multiple application escrow accounts in a single transaction. This is more efficient than calling register multiple times as the MBR cost can be paid for in a single payment and the app IDs can be stored more efficiently in the contract state.
473
+ *
474
+ * @param params The params for the smart contract call
475
+ * @returns The call transaction
476
+ */
477
+ registerList: (params) => {
478
+ return this.appClient.createTransaction.call(EscregParamsFactory.registerList(params));
479
+ },
480
+ /**
481
+ * Makes a call to the Escreg smart contract using the `exists(address)bool` ABI method.
482
+ *
483
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
484
+ *
485
+ * Return true if an app escrow account exists for the given address, false otherwise.
486
+ *
487
+ * @param params The params for the smart contract call
488
+ * @returns The call transaction: boolean indicating whether the given address is registered in the contract
489
+ */
490
+ exists: (params) => {
491
+ return this.appClient.createTransaction.call(EscregParamsFactory.exists(params));
492
+ },
493
+ /**
494
+ * Makes a call to the Escreg smart contract using the `get(address)uint64` ABI method.
495
+ *
496
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
497
+ *
498
+ * Get the app ID for the given app escrow address. Returns 0 if the app escrow is not registered in the contract.
499
+ *
500
+ * @param params The params for the smart contract call
501
+ * @returns The call transaction: App ID for the given address, or 0 if not registered
502
+ */
503
+ get: (params) => {
504
+ return this.appClient.createTransaction.call(EscregParamsFactory.get(params));
505
+ },
506
+ /**
507
+ * Makes a call to the Escreg smart contract using the `mustGet(address)uint64` ABI method.
508
+ *
509
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
510
+ *
511
+ * Get the app ID for the given app escrow address. Throws an error if the app escrow is not registered in the contract.
512
+ *
513
+ * @param params The params for the smart contract call
514
+ * @returns The call transaction: App ID for the given address
515
+ */
516
+ mustGet: (params) => {
517
+ return this.appClient.createTransaction.call(EscregParamsFactory.mustGet(params));
518
+ },
519
+ /**
520
+ * Makes a call to the Escreg smart contract using the `getWithAuth(address)(uint64,uint64)` ABI method.
521
+ *
522
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
523
+ *
524
+ * Get the app ID for the given app escrow address and its auth address. Returns 0 for each if not registered in the contract.
525
+ *
526
+ * @param params The params for the smart contract call
527
+ * @returns The call transaction: [app ID for the given address, app ID for the auth address], or 0 for each if not registered
528
+ */
529
+ getWithAuth: (params) => {
530
+ return this.appClient.createTransaction.call(EscregParamsFactory.getWithAuth(params));
531
+ },
532
+ /**
533
+ * Makes a call to the Escreg smart contract using the `getWithAuthList(address[])(uint64,uint64)[]` ABI method.
534
+ *
535
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
536
+ *
537
+ * Get the app ID for multiple app escrow addresses and their auth addresses. Returns 0 for each if not registered in the contract.
538
+ *
539
+ * @param params The params for the smart contract call
540
+ * @returns The call transaction: Array of [app ID for the given address, app ID for the auth address] for each input address, or 0 for each if not registered
541
+ */
542
+ getWithAuthList: (params) => {
543
+ return this.appClient.createTransaction.call(EscregParamsFactory.getWithAuthList(params));
544
+ },
545
+ /**
546
+ * Makes a call to the Escreg smart contract using the `getList(address[])uint64[]` ABI method.
547
+ *
548
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
549
+ *
550
+ * Get the app IDs for multiple app escrow addresses. Returns 0 for each if not registered in the contract.
551
+ *
552
+ * @param params The params for the smart contract call
553
+ * @returns The call transaction: Array of app IDs for each input address, or 0 if not registered
554
+ */
555
+ getList: (params) => {
556
+ return this.appClient.createTransaction.call(EscregParamsFactory.getList(params));
557
+ },
558
+ /**
559
+ * Makes a call to the Escreg smart contract using the `mustGetList(address[])uint64[]` ABI method.
560
+ *
561
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
562
+ *
563
+ * Get the app IDs for multiple app escrow addresses. Throws an error if any of the app escrows are not registered in the contract.
564
+ *
565
+ * @param params The params for the smart contract call
566
+ * @returns The call transaction: Array of app IDs for each input address
567
+ */
568
+ mustGetList: (params) => {
569
+ return this.appClient.createTransaction.call(EscregParamsFactory.mustGetList(params));
570
+ },
571
+ /**
572
+ * Makes a call to the Escreg smart contract using the `increaseBudget(uint64)void` ABI method.
573
+ *
574
+ * Utility for explicitly increasing the budget of a transaction group by performing no-op inner transactions.
575
+ *
576
+ * @param params The params for the smart contract call
577
+ * @returns The call transaction
578
+ */
579
+ increaseBudget: (params) => {
580
+ return this.appClient.createTransaction.call(EscregParamsFactory.increaseBudget(params));
581
+ },
582
+ /**
583
+ * Makes a call to the Escreg smart contract using the `depositCredits(address,pay)void` ABI method.
584
+ *
585
+ * public method to deposit MBR credits for an account
586
+ *
587
+ * @param params The params for the smart contract call
588
+ * @returns The call transaction
589
+ */
590
+ depositCredits: (params) => {
591
+ return this.appClient.createTransaction.call(EscregParamsFactory.depositCredits(params));
592
+ },
593
+ /**
594
+ * Makes a call to the Escreg smart contract using the `withdrawCredits()void` ABI method.
595
+ *
596
+ * Withdraw all remaining MBR credits for sender. This will delete the user credit box, so all credits are withdrawn including the MBR locked for the box itself.
597
+ *
598
+ * @param params The params for the smart contract call
599
+ * @returns The call transaction
600
+ */
601
+ withdrawCredits: (params = { args: [] }) => {
602
+ return this.appClient.createTransaction.call(EscregParamsFactory.withdrawCredits(params));
603
+ },
604
+ };
605
+ /**
606
+ * Send calls to the current app
607
+ */
608
+ this.send = {
609
+ /**
610
+ * Makes a clear_state call to an existing instance of the Escreg smart contract.
611
+ *
612
+ * @param params The params for the bare (raw) call
613
+ * @returns The clearState result
614
+ */
615
+ clearState: (params) => {
616
+ return this.appClient.send.bare.clearState(params);
617
+ },
618
+ /**
619
+ * Makes a call to the Escreg smart contract using the `withdraw(uint64)void` ABI method.
620
+ *
621
+ * Withdraw funds from the contract to the admin.
622
+ *
623
+ * @param params The params for the smart contract call
624
+ * @returns The call result
625
+ */
626
+ withdraw: async (params) => {
627
+ const result = await this.appClient.send.call(EscregParamsFactory.withdraw(params));
628
+ return { ...result, return: result.return };
629
+ },
630
+ /**
631
+ * Makes a call to the Escreg smart contract using the `deleteBoxes(byte[4][])void` ABI method.
632
+ *
633
+ * Delete app registry boxes by their keys.
634
+ *
635
+ * @param params The params for the smart contract call
636
+ * @returns The call result
637
+ */
638
+ deleteBoxes: async (params) => {
639
+ const result = await this.appClient.send.call(EscregParamsFactory.deleteBoxes(params));
640
+ return { ...result, return: result.return };
641
+ },
642
+ /**
643
+ * Makes a call to the Escreg smart contract using the `register(uint64)void` ABI method.
644
+ *
645
+ * Register a single application escrow account
646
+ *
647
+ * @param params The params for the smart contract call
648
+ * @returns The call result
649
+ */
650
+ register: async (params) => {
651
+ const result = await this.appClient.send.call(EscregParamsFactory.register(params));
652
+ return { ...result, return: result.return };
653
+ },
654
+ /**
655
+ * Makes a call to the Escreg smart contract using the `registerList(uint64[])void` ABI method.
656
+ *
657
+ * Register multiple application escrow accounts in a single transaction. This is more efficient than calling register multiple times as the MBR cost can be paid for in a single payment and the app IDs can be stored more efficiently in the contract state.
658
+ *
659
+ * @param params The params for the smart contract call
660
+ * @returns The call result
661
+ */
662
+ registerList: async (params) => {
663
+ const result = await this.appClient.send.call(EscregParamsFactory.registerList(params));
664
+ return { ...result, return: result.return };
665
+ },
666
+ /**
667
+ * Makes a call to the Escreg smart contract using the `exists(address)bool` ABI method.
668
+ *
669
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
670
+ *
671
+ * Return true if an app escrow account exists for the given address, false otherwise.
672
+ *
673
+ * @param params The params for the smart contract call
674
+ * @returns The call result: boolean indicating whether the given address is registered in the contract
675
+ */
676
+ exists: async (params) => {
677
+ const result = await this.appClient.send.call(EscregParamsFactory.exists(params));
678
+ return { ...result, return: result.return };
679
+ },
680
+ /**
681
+ * Makes a call to the Escreg smart contract using the `get(address)uint64` ABI method.
682
+ *
683
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
684
+ *
685
+ * Get the app ID for the given app escrow address. Returns 0 if the app escrow is not registered in the contract.
686
+ *
687
+ * @param params The params for the smart contract call
688
+ * @returns The call result: App ID for the given address, or 0 if not registered
689
+ */
690
+ get: async (params) => {
691
+ const result = await this.appClient.send.call(EscregParamsFactory.get(params));
692
+ return { ...result, return: result.return };
693
+ },
694
+ /**
695
+ * Makes a call to the Escreg smart contract using the `mustGet(address)uint64` ABI method.
696
+ *
697
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
698
+ *
699
+ * Get the app ID for the given app escrow address. Throws an error if the app escrow is not registered in the contract.
700
+ *
701
+ * @param params The params for the smart contract call
702
+ * @returns The call result: App ID for the given address
703
+ */
704
+ mustGet: async (params) => {
705
+ const result = await this.appClient.send.call(EscregParamsFactory.mustGet(params));
706
+ return { ...result, return: result.return };
707
+ },
708
+ /**
709
+ * Makes a call to the Escreg smart contract using the `getWithAuth(address)(uint64,uint64)` ABI method.
710
+ *
711
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
712
+ *
713
+ * Get the app ID for the given app escrow address and its auth address. Returns 0 for each if not registered in the contract.
714
+ *
715
+ * @param params The params for the smart contract call
716
+ * @returns The call result: [app ID for the given address, app ID for the auth address], or 0 for each if not registered
717
+ */
718
+ getWithAuth: async (params) => {
719
+ const result = await this.appClient.send.call(EscregParamsFactory.getWithAuth(params));
720
+ return { ...result, return: result.return };
721
+ },
722
+ /**
723
+ * Makes a call to the Escreg smart contract using the `getWithAuthList(address[])(uint64,uint64)[]` ABI method.
724
+ *
725
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
726
+ *
727
+ * Get the app ID for multiple app escrow addresses and their auth addresses. Returns 0 for each if not registered in the contract.
728
+ *
729
+ * @param params The params for the smart contract call
730
+ * @returns The call result: Array of [app ID for the given address, app ID for the auth address] for each input address, or 0 for each if not registered
731
+ */
732
+ getWithAuthList: async (params) => {
733
+ const result = await this.appClient.send.call(EscregParamsFactory.getWithAuthList(params));
734
+ return { ...result, return: result.return };
735
+ },
736
+ /**
737
+ * Makes a call to the Escreg smart contract using the `getList(address[])uint64[]` ABI method.
738
+ *
739
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
740
+ *
741
+ * Get the app IDs for multiple app escrow addresses. Returns 0 for each if not registered in the contract.
742
+ *
743
+ * @param params The params for the smart contract call
744
+ * @returns The call result: Array of app IDs for each input address, or 0 if not registered
745
+ */
746
+ getList: async (params) => {
747
+ const result = await this.appClient.send.call(EscregParamsFactory.getList(params));
748
+ return { ...result, return: result.return };
749
+ },
750
+ /**
751
+ * Makes a call to the Escreg smart contract using the `mustGetList(address[])uint64[]` ABI method.
752
+ *
753
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
754
+ *
755
+ * Get the app IDs for multiple app escrow addresses. Throws an error if any of the app escrows are not registered in the contract.
756
+ *
757
+ * @param params The params for the smart contract call
758
+ * @returns The call result: Array of app IDs for each input address
759
+ */
760
+ mustGetList: async (params) => {
761
+ const result = await this.appClient.send.call(EscregParamsFactory.mustGetList(params));
762
+ return { ...result, return: result.return };
763
+ },
764
+ /**
765
+ * Makes a call to the Escreg smart contract using the `increaseBudget(uint64)void` ABI method.
766
+ *
767
+ * Utility for explicitly increasing the budget of a transaction group by performing no-op inner transactions.
768
+ *
769
+ * @param params The params for the smart contract call
770
+ * @returns The call result
771
+ */
772
+ increaseBudget: async (params) => {
773
+ const result = await this.appClient.send.call(EscregParamsFactory.increaseBudget(params));
774
+ return { ...result, return: result.return };
775
+ },
776
+ /**
777
+ * Makes a call to the Escreg smart contract using the `depositCredits(address,pay)void` ABI method.
778
+ *
779
+ * public method to deposit MBR credits for an account
780
+ *
781
+ * @param params The params for the smart contract call
782
+ * @returns The call result
783
+ */
784
+ depositCredits: async (params) => {
785
+ const result = await this.appClient.send.call(EscregParamsFactory.depositCredits(params));
786
+ return { ...result, return: result.return };
787
+ },
788
+ /**
789
+ * Makes a call to the Escreg smart contract using the `withdrawCredits()void` ABI method.
790
+ *
791
+ * Withdraw all remaining MBR credits for sender. This will delete the user credit box, so all credits are withdrawn including the MBR locked for the box itself.
792
+ *
793
+ * @param params The params for the smart contract call
794
+ * @returns The call result
795
+ */
796
+ withdrawCredits: async (params = { args: [] }) => {
797
+ const result = await this.appClient.send.call(EscregParamsFactory.withdrawCredits(params));
798
+ return { ...result, return: result.return };
799
+ },
800
+ };
801
+ /**
802
+ * Methods to access state for the current Escreg app
803
+ */
804
+ this.state = {
805
+ /**
806
+ * Methods to access global state for the current Escreg app
807
+ */
808
+ global: {
809
+ /**
810
+ * Get all current keyed values from global state
811
+ */
812
+ getAll: async () => {
813
+ const result = await this.appClient.state.global.getAll();
814
+ return {
815
+ admin: result.admin,
816
+ counter: result.counter,
817
+ };
818
+ },
819
+ /**
820
+ * Get the current value of the admin key in global state
821
+ */
822
+ admin: async () => { return (await this.appClient.state.global.getValue("admin")); },
823
+ /**
824
+ * Get the current value of the counter key in global state
825
+ */
826
+ counter: async () => { return (await this.appClient.state.global.getValue("counter")); },
827
+ },
828
+ /**
829
+ * Methods to access box state for the current Escreg app
830
+ */
831
+ box: {
832
+ /**
833
+ * Get all current keyed values from box state
834
+ */
835
+ getAll: async () => {
836
+ const result = await this.appClient.state.box.getAll();
837
+ return {};
838
+ },
839
+ /**
840
+ * Get values from the apps map in box state
841
+ */
842
+ apps: {
843
+ /**
844
+ * Get all current values of the apps map in box state
845
+ */
846
+ getMap: async () => { return (await this.appClient.state.box.getMap("apps")); },
847
+ /**
848
+ * Get a current value of the apps map by key from box state
849
+ */
850
+ value: async (key) => { return await this.appClient.state.box.getMapValue("apps", key); },
851
+ },
852
+ /**
853
+ * Get values from the userCredits map in box state
854
+ */
855
+ userCredits: {
856
+ /**
857
+ * Get all current values of the userCredits map in box state
858
+ */
859
+ getMap: async () => { return (await this.appClient.state.box.getMap("userCredits")); },
860
+ /**
861
+ * Get a current value of the userCredits map by key from box state
862
+ */
863
+ value: async (key) => { return await this.appClient.state.box.getMapValue("userCredits", key); },
864
+ },
865
+ },
866
+ };
867
+ this.appClient = appClientOrParams instanceof _AppClient ? appClientOrParams : new _AppClient({
868
+ ...appClientOrParams,
869
+ appSpec: APP_SPEC,
870
+ });
871
+ }
872
+ /**
873
+ * Checks for decode errors on the given return value and maps the return value to the return type for the given method
874
+ * @returns The typed return value or undefined if there was no value
875
+ */
876
+ decodeReturnValue(method, returnValue) {
877
+ return returnValue !== undefined ? getArc56ReturnValue(returnValue, this.appClient.getABIMethod(method), APP_SPEC.structs) : undefined;
878
+ }
879
+ /**
880
+ * Returns a new `EscregClient` client, resolving the app by creator address and name
881
+ * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
882
+ * @param params The parameters to create the app client
883
+ */
884
+ static async fromCreatorAndName(params) {
885
+ return new EscregClient(await _AppClient.fromCreatorAndName({ ...params, appSpec: APP_SPEC }));
886
+ }
887
+ /**
888
+ * Returns an `EscregClient` instance for the current network based on
889
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
890
+ *
891
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
892
+ * @param params The parameters to create the app client
893
+ */
894
+ static async fromNetwork(params) {
895
+ return new EscregClient(await _AppClient.fromNetwork({ ...params, appSpec: APP_SPEC }));
896
+ }
897
+ /** The ID of the app instance this client is linked to. */
898
+ get appId() {
899
+ return this.appClient.appId;
900
+ }
901
+ /** The app address of the app instance this client is linked to. */
902
+ get appAddress() {
903
+ return this.appClient.appAddress;
904
+ }
905
+ /** The name of the app. */
906
+ get appName() {
907
+ return this.appClient.appName;
908
+ }
909
+ /** The ARC-56 app spec being used */
910
+ get appSpec() {
911
+ return this.appClient.appSpec;
912
+ }
913
+ /** A reference to the underlying `AlgorandClient` this app client is using. */
914
+ get algorand() {
915
+ return this.appClient.algorand;
916
+ }
917
+ /**
918
+ * Clone this app client with different params
919
+ *
920
+ * @param params The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.
921
+ * @returns A new app client with the altered params
922
+ */
923
+ clone(params) {
924
+ return new EscregClient(this.appClient.clone(params));
925
+ }
926
+ /**
927
+ * Makes a readonly (simulated) call to the Escreg smart contract using the `exists(address)bool` ABI method.
928
+ *
929
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
930
+ *
931
+ * Return true if an app escrow account exists for the given address, false otherwise.
932
+ *
933
+ * @param params The params for the smart contract call
934
+ * @returns The call result: boolean indicating whether the given address is registered in the contract
935
+ */
936
+ async exists(params) {
937
+ const result = await this.appClient.send.call(EscregParamsFactory.exists(params));
938
+ return result.return;
939
+ }
940
+ /**
941
+ * Makes a readonly (simulated) call to the Escreg smart contract using the `get(address)uint64` ABI method.
942
+ *
943
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
944
+ *
945
+ * Get the app ID for the given app escrow address. Returns 0 if the app escrow is not registered in the contract.
946
+ *
947
+ * @param params The params for the smart contract call
948
+ * @returns The call result: App ID for the given address, or 0 if not registered
949
+ */
950
+ async get(params) {
951
+ const result = await this.appClient.send.call(EscregParamsFactory.get(params));
952
+ return result.return;
953
+ }
954
+ /**
955
+ * Makes a readonly (simulated) call to the Escreg smart contract using the `mustGet(address)uint64` ABI method.
956
+ *
957
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
958
+ *
959
+ * Get the app ID for the given app escrow address. Throws an error if the app escrow is not registered in the contract.
960
+ *
961
+ * @param params The params for the smart contract call
962
+ * @returns The call result: App ID for the given address
963
+ */
964
+ async mustGet(params) {
965
+ const result = await this.appClient.send.call(EscregParamsFactory.mustGet(params));
966
+ return result.return;
967
+ }
968
+ /**
969
+ * Makes a readonly (simulated) call to the Escreg smart contract using the `getWithAuth(address)(uint64,uint64)` ABI method.
970
+ *
971
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
972
+ *
973
+ * Get the app ID for the given app escrow address and its auth address. Returns 0 for each if not registered in the contract.
974
+ *
975
+ * @param params The params for the smart contract call
976
+ * @returns The call result: [app ID for the given address, app ID for the auth address], or 0 for each if not registered
977
+ */
978
+ async getWithAuth(params) {
979
+ const result = await this.appClient.send.call(EscregParamsFactory.getWithAuth(params));
980
+ return result.return;
981
+ }
982
+ /**
983
+ * Makes a readonly (simulated) call to the Escreg smart contract using the `getWithAuthList(address[])(uint64,uint64)[]` ABI method.
984
+ *
985
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
986
+ *
987
+ * Get the app ID for multiple app escrow addresses and their auth addresses. Returns 0 for each if not registered in the contract.
988
+ *
989
+ * @param params The params for the smart contract call
990
+ * @returns The call result: Array of [app ID for the given address, app ID for the auth address] for each input address, or 0 for each if not registered
991
+ */
992
+ async getWithAuthList(params) {
993
+ const result = await this.appClient.send.call(EscregParamsFactory.getWithAuthList(params));
994
+ return result.return;
995
+ }
996
+ /**
997
+ * Makes a readonly (simulated) call to the Escreg smart contract using the `getList(address[])uint64[]` ABI method.
998
+ *
999
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
1000
+ *
1001
+ * Get the app IDs for multiple app escrow addresses. Returns 0 for each if not registered in the contract.
1002
+ *
1003
+ * @param params The params for the smart contract call
1004
+ * @returns The call result: Array of app IDs for each input address, or 0 if not registered
1005
+ */
1006
+ async getList(params) {
1007
+ const result = await this.appClient.send.call(EscregParamsFactory.getList(params));
1008
+ return result.return;
1009
+ }
1010
+ /**
1011
+ * Makes a readonly (simulated) call to the Escreg smart contract using the `mustGetList(address[])uint64[]` ABI method.
1012
+ *
1013
+ * This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.
1014
+ *
1015
+ * Get the app IDs for multiple app escrow addresses. Throws an error if any of the app escrows are not registered in the contract.
1016
+ *
1017
+ * @param params The params for the smart contract call
1018
+ * @returns The call result: Array of app IDs for each input address
1019
+ */
1020
+ async mustGetList(params) {
1021
+ const result = await this.appClient.send.call(EscregParamsFactory.mustGetList(params));
1022
+ return result.return;
1023
+ }
1024
+ newGroup() {
1025
+ const client = this;
1026
+ const composer = this.algorand.newGroup();
1027
+ let promiseChain = Promise.resolve();
1028
+ const resultMappers = [];
1029
+ return {
1030
+ /**
1031
+ * Add a withdraw(uint64)void method call against the Escreg contract
1032
+ */
1033
+ withdraw(params) {
1034
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.withdraw(params)));
1035
+ resultMappers.push(undefined);
1036
+ return this;
1037
+ },
1038
+ /**
1039
+ * Add a deleteBoxes(byte[4][])void method call against the Escreg contract
1040
+ */
1041
+ deleteBoxes(params) {
1042
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.deleteBoxes(params)));
1043
+ resultMappers.push(undefined);
1044
+ return this;
1045
+ },
1046
+ /**
1047
+ * Add a register(uint64)void method call against the Escreg contract
1048
+ */
1049
+ register(params) {
1050
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.register(params)));
1051
+ resultMappers.push(undefined);
1052
+ return this;
1053
+ },
1054
+ /**
1055
+ * Add a registerList(uint64[])void method call against the Escreg contract
1056
+ */
1057
+ registerList(params) {
1058
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.registerList(params)));
1059
+ resultMappers.push(undefined);
1060
+ return this;
1061
+ },
1062
+ /**
1063
+ * Add a exists(address)bool method call against the Escreg contract
1064
+ */
1065
+ exists(params) {
1066
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.exists(params)));
1067
+ resultMappers.push((v) => client.decodeReturnValue('exists(address)bool', v));
1068
+ return this;
1069
+ },
1070
+ /**
1071
+ * Add a get(address)uint64 method call against the Escreg contract
1072
+ */
1073
+ get(params) {
1074
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.get(params)));
1075
+ resultMappers.push((v) => client.decodeReturnValue('get(address)uint64', v));
1076
+ return this;
1077
+ },
1078
+ /**
1079
+ * Add a mustGet(address)uint64 method call against the Escreg contract
1080
+ */
1081
+ mustGet(params) {
1082
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.mustGet(params)));
1083
+ resultMappers.push((v) => client.decodeReturnValue('mustGet(address)uint64', v));
1084
+ return this;
1085
+ },
1086
+ /**
1087
+ * Add a getWithAuth(address)(uint64,uint64) method call against the Escreg contract
1088
+ */
1089
+ getWithAuth(params) {
1090
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.getWithAuth(params)));
1091
+ resultMappers.push((v) => client.decodeReturnValue('getWithAuth(address)(uint64,uint64)', v));
1092
+ return this;
1093
+ },
1094
+ /**
1095
+ * Add a getWithAuthList(address[])(uint64,uint64)[] method call against the Escreg contract
1096
+ */
1097
+ getWithAuthList(params) {
1098
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.getWithAuthList(params)));
1099
+ resultMappers.push((v) => client.decodeReturnValue('getWithAuthList(address[])(uint64,uint64)[]', v));
1100
+ return this;
1101
+ },
1102
+ /**
1103
+ * Add a getList(address[])uint64[] method call against the Escreg contract
1104
+ */
1105
+ getList(params) {
1106
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.getList(params)));
1107
+ resultMappers.push((v) => client.decodeReturnValue('getList(address[])uint64[]', v));
1108
+ return this;
1109
+ },
1110
+ /**
1111
+ * Add a mustGetList(address[])uint64[] method call against the Escreg contract
1112
+ */
1113
+ mustGetList(params) {
1114
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.mustGetList(params)));
1115
+ resultMappers.push((v) => client.decodeReturnValue('mustGetList(address[])uint64[]', v));
1116
+ return this;
1117
+ },
1118
+ /**
1119
+ * Add a increaseBudget(uint64)void method call against the Escreg contract
1120
+ */
1121
+ increaseBudget(params) {
1122
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.increaseBudget(params)));
1123
+ resultMappers.push(undefined);
1124
+ return this;
1125
+ },
1126
+ /**
1127
+ * Add a depositCredits(address,pay)void method call against the Escreg contract
1128
+ */
1129
+ depositCredits(params) {
1130
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.depositCredits(params)));
1131
+ resultMappers.push(undefined);
1132
+ return this;
1133
+ },
1134
+ /**
1135
+ * Add a withdrawCredits()void method call against the Escreg contract
1136
+ */
1137
+ withdrawCredits(params) {
1138
+ promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params.withdrawCredits(params)));
1139
+ resultMappers.push(undefined);
1140
+ return this;
1141
+ },
1142
+ /**
1143
+ * Add a clear state call to the Escreg contract
1144
+ */
1145
+ clearState(params) {
1146
+ promiseChain = promiseChain.then(() => composer.addAppCall(client.params.clearState(params)));
1147
+ return this;
1148
+ },
1149
+ addTransaction(txn, signer) {
1150
+ promiseChain = promiseChain.then(() => composer.addTransaction(txn, signer));
1151
+ return this;
1152
+ },
1153
+ async composer() {
1154
+ await promiseChain;
1155
+ return composer;
1156
+ },
1157
+ async simulate(options) {
1158
+ await promiseChain;
1159
+ const result = await (!options ? composer.simulate() : composer.simulate(options));
1160
+ return {
1161
+ ...result,
1162
+ returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i](val) : val.returnValue)
1163
+ };
1164
+ },
1165
+ async send(params) {
1166
+ await promiseChain;
1167
+ const result = await composer.send(params);
1168
+ return {
1169
+ ...result,
1170
+ returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i](val) : val.returnValue)
1171
+ };
1172
+ }
1173
+ };
1174
+ }
1175
+ }
1176
+ //# sourceMappingURL=EscregGenerated.js.map