@algorandfoundation/algokit-utils 8.0.0 → 8.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.
- package/README.md +4 -4
- package/indexer-lookup.js +0 -1
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs +0 -1
- package/indexer-lookup.mjs.map +1 -1
- package/package.json +1 -1
- package/transaction/transaction.js +0 -3
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +0 -3
- package/transaction/transaction.mjs.map +1 -1
- package/types/account.js +0 -1
- package/types/account.js.map +1 -1
- package/types/account.mjs +0 -1
- package/types/account.mjs.map +1 -1
- package/types/algo-http-client-with-retry.js +0 -1
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs +0 -1
- package/types/algo-http-client-with-retry.mjs.map +1 -1
- package/types/app-client.d.ts +1 -1
- package/types/app-client.js +4 -13
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +4 -13
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.js +3 -9
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +3 -9
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +29 -18
- package/types/app-factory.js +10 -3
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +10 -3
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.js +0 -1
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +0 -1
- package/types/app-manager.mjs.map +1 -1
- package/types/composer.d.ts +20 -6
- package/types/composer.js +6 -9
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +6 -9
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +0 -4
- package/types/config.js.map +1 -1
- package/types/config.mjs.map +1 -1
- package/types/kmd-account-manager.js +0 -2
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +0 -2
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/logging.js +0 -5
- package/types/logging.js.map +1 -1
- package/types/logging.mjs +0 -5
- package/types/logging.mjs.map +1 -1
- package/types/transaction.d.ts +1 -1
package/types/app-factory.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import algosdk, { Address } from 'algosdk';
|
|
2
|
+
import { TransactionSignerAccount } from './account';
|
|
2
3
|
import { AlgorandClientInterface } from './algorand-client-interface';
|
|
3
4
|
import { AppReturn, SendAppTransactionResult, TealTemplateParams } from './app';
|
|
4
5
|
import { ABIStruct, Arc56Contract, Arc56Method } from './app-arc56';
|
|
@@ -153,7 +154,7 @@ export declare class AppFactory {
|
|
|
153
154
|
create: (params: {
|
|
154
155
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
155
156
|
note?: string | Uint8Array | undefined;
|
|
156
|
-
signer?: algosdk.TransactionSigner |
|
|
157
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
157
158
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
158
159
|
lease?: string | Uint8Array | undefined;
|
|
159
160
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -199,7 +200,7 @@ export declare class AppFactory {
|
|
|
199
200
|
clearStateProgram: Uint8Array;
|
|
200
201
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
201
202
|
note?: string | Uint8Array | undefined;
|
|
202
|
-
signer?: algosdk.TransactionSigner |
|
|
203
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
203
204
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
204
205
|
lease?: string | Uint8Array | undefined;
|
|
205
206
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -220,13 +221,14 @@ export declare class AppFactory {
|
|
|
220
221
|
extraProgramPages?: number | undefined;
|
|
221
222
|
} & {
|
|
222
223
|
sender: algosdk.Address;
|
|
224
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
223
225
|
method: Arc56Method;
|
|
224
226
|
args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
|
|
225
227
|
sender: string | algosdk.Address;
|
|
226
228
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
227
229
|
note?: string | Uint8Array | undefined;
|
|
228
230
|
args?: Uint8Array[] | undefined;
|
|
229
|
-
signer?: algosdk.TransactionSigner |
|
|
231
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
230
232
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
231
233
|
lease?: string | Uint8Array | undefined;
|
|
232
234
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -250,7 +252,7 @@ export declare class AppFactory {
|
|
|
250
252
|
extraProgramPages?: number | undefined;
|
|
251
253
|
}> | AppMethodCall<{
|
|
252
254
|
sender: string | algosdk.Address;
|
|
253
|
-
signer?: algosdk.TransactionSigner |
|
|
255
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
254
256
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
255
257
|
note?: string | Uint8Array | undefined;
|
|
256
258
|
lease?: string | Uint8Array | undefined;
|
|
@@ -276,7 +278,7 @@ export declare class AppFactory {
|
|
|
276
278
|
deployUpdate: (params: {
|
|
277
279
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
278
280
|
note?: string | Uint8Array | undefined;
|
|
279
|
-
signer?: algosdk.TransactionSigner |
|
|
281
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
280
282
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
281
283
|
lease?: string | Uint8Array | undefined;
|
|
282
284
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -295,7 +297,7 @@ export declare class AppFactory {
|
|
|
295
297
|
}) => {
|
|
296
298
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
297
299
|
note?: string | Uint8Array | undefined;
|
|
298
|
-
signer?: algosdk.TransactionSigner |
|
|
300
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
299
301
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
300
302
|
lease?: string | Uint8Array | undefined;
|
|
301
303
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -313,13 +315,14 @@ export declare class AppFactory {
|
|
|
313
315
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
314
316
|
} & {
|
|
315
317
|
sender: algosdk.Address;
|
|
318
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
316
319
|
method: Arc56Method;
|
|
317
320
|
args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
|
|
318
321
|
sender: string | algosdk.Address;
|
|
319
322
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
320
323
|
note?: string | Uint8Array | undefined;
|
|
321
324
|
args?: Uint8Array[] | undefined;
|
|
322
|
-
signer?: algosdk.TransactionSigner |
|
|
325
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
323
326
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
324
327
|
lease?: string | Uint8Array | undefined;
|
|
325
328
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -343,7 +346,7 @@ export declare class AppFactory {
|
|
|
343
346
|
extraProgramPages?: number | undefined;
|
|
344
347
|
}> | AppMethodCall<{
|
|
345
348
|
sender: string | algosdk.Address;
|
|
346
|
-
signer?: algosdk.TransactionSigner |
|
|
349
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
347
350
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
348
351
|
note?: string | Uint8Array | undefined;
|
|
349
352
|
lease?: string | Uint8Array | undefined;
|
|
@@ -369,7 +372,7 @@ export declare class AppFactory {
|
|
|
369
372
|
deployDelete: (params: {
|
|
370
373
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
371
374
|
note?: string | Uint8Array | undefined;
|
|
372
|
-
signer?: algosdk.TransactionSigner |
|
|
375
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
373
376
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
374
377
|
lease?: string | Uint8Array | undefined;
|
|
375
378
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -388,7 +391,7 @@ export declare class AppFactory {
|
|
|
388
391
|
}) => {
|
|
389
392
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
390
393
|
note?: string | Uint8Array | undefined;
|
|
391
|
-
signer?: algosdk.TransactionSigner |
|
|
394
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
392
395
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
393
396
|
lease?: string | Uint8Array | undefined;
|
|
394
397
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -406,13 +409,14 @@ export declare class AppFactory {
|
|
|
406
409
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
407
410
|
} & {
|
|
408
411
|
sender: algosdk.Address;
|
|
412
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
409
413
|
method: Arc56Method;
|
|
410
414
|
args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
|
|
411
415
|
sender: string | algosdk.Address;
|
|
412
416
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
413
417
|
note?: string | Uint8Array | undefined;
|
|
414
418
|
args?: Uint8Array[] | undefined;
|
|
415
|
-
signer?: algosdk.TransactionSigner |
|
|
419
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
416
420
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
417
421
|
lease?: string | Uint8Array | undefined;
|
|
418
422
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
@@ -436,7 +440,7 @@ export declare class AppFactory {
|
|
|
436
440
|
extraProgramPages?: number | undefined;
|
|
437
441
|
}> | AppMethodCall<{
|
|
438
442
|
sender: string | algosdk.Address;
|
|
439
|
-
signer?: algosdk.TransactionSigner |
|
|
443
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
440
444
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
441
445
|
note?: string | Uint8Array | undefined;
|
|
442
446
|
lease?: string | Uint8Array | undefined;
|
|
@@ -464,7 +468,7 @@ export declare class AppFactory {
|
|
|
464
468
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
465
469
|
note?: string | Uint8Array | undefined;
|
|
466
470
|
args?: Uint8Array[] | undefined;
|
|
467
|
-
signer?: algosdk.TransactionSigner |
|
|
471
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
468
472
|
lease?: string | Uint8Array | undefined;
|
|
469
473
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
470
474
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -511,7 +515,7 @@ export declare class AppFactory {
|
|
|
511
515
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
512
516
|
note?: string | Uint8Array | undefined;
|
|
513
517
|
args?: Uint8Array[] | undefined;
|
|
514
|
-
signer?: algosdk.TransactionSigner |
|
|
518
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
515
519
|
lease?: string | Uint8Array | undefined;
|
|
516
520
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
517
521
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -530,6 +534,7 @@ export declare class AppFactory {
|
|
|
530
534
|
extraProgramPages?: number | undefined;
|
|
531
535
|
} & {
|
|
532
536
|
sender: algosdk.Address;
|
|
537
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
533
538
|
onComplete: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC;
|
|
534
539
|
}>;
|
|
535
540
|
/** Return params for a deployment update bare call */
|
|
@@ -537,7 +542,7 @@ export declare class AppFactory {
|
|
|
537
542
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
538
543
|
note?: string | Uint8Array | undefined;
|
|
539
544
|
args?: Uint8Array[] | undefined;
|
|
540
|
-
signer?: algosdk.TransactionSigner |
|
|
545
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
541
546
|
lease?: string | Uint8Array | undefined;
|
|
542
547
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
543
548
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -554,7 +559,7 @@ export declare class AppFactory {
|
|
|
554
559
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
555
560
|
note?: string | Uint8Array | undefined;
|
|
556
561
|
args?: Uint8Array[] | undefined;
|
|
557
|
-
signer?: algosdk.TransactionSigner |
|
|
562
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
558
563
|
lease?: string | Uint8Array | undefined;
|
|
559
564
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
560
565
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -569,6 +574,7 @@ export declare class AppFactory {
|
|
|
569
574
|
sender?: string | algosdk.Address | undefined;
|
|
570
575
|
} & {
|
|
571
576
|
sender: algosdk.Address;
|
|
577
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
572
578
|
onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
|
|
573
579
|
};
|
|
574
580
|
/** Return params for a deployment delete bare call */
|
|
@@ -576,7 +582,7 @@ export declare class AppFactory {
|
|
|
576
582
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
577
583
|
note?: string | Uint8Array | undefined;
|
|
578
584
|
args?: Uint8Array[] | undefined;
|
|
579
|
-
signer?: algosdk.TransactionSigner |
|
|
585
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
580
586
|
lease?: string | Uint8Array | undefined;
|
|
581
587
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
582
588
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -593,7 +599,7 @@ export declare class AppFactory {
|
|
|
593
599
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
594
600
|
note?: string | Uint8Array | undefined;
|
|
595
601
|
args?: Uint8Array[] | undefined;
|
|
596
|
-
signer?: algosdk.TransactionSigner |
|
|
602
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
597
603
|
lease?: string | Uint8Array | undefined;
|
|
598
604
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
599
605
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -608,6 +614,7 @@ export declare class AppFactory {
|
|
|
608
614
|
sender?: string | algosdk.Address | undefined;
|
|
609
615
|
} & {
|
|
610
616
|
sender: algosdk.Address;
|
|
617
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
611
618
|
onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC;
|
|
612
619
|
};
|
|
613
620
|
};
|
|
@@ -832,6 +839,10 @@ export declare class AppFactory {
|
|
|
832
839
|
/** Returns the sender for a call, using the `defaultSender`
|
|
833
840
|
* if none provided and throws an error if neither provided */
|
|
834
841
|
private getSender;
|
|
842
|
+
/** Returns the signer for a call, using the provided signer or the `defaultSigner`
|
|
843
|
+
* if no signer was provided and the sender resolves to the default sender, the call will use default signer
|
|
844
|
+
* or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
|
|
845
|
+
private getSigner;
|
|
835
846
|
/**
|
|
836
847
|
* Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
|
|
837
848
|
* on the ARC-56 method.
|
package/types/app-factory.js
CHANGED
|
@@ -347,6 +347,7 @@ class AppFactory {
|
|
|
347
347
|
return {
|
|
348
348
|
...params,
|
|
349
349
|
sender: this.getSender(params?.sender),
|
|
350
|
+
signer: this.getSigner(params?.sender, params?.signer),
|
|
350
351
|
onComplete,
|
|
351
352
|
};
|
|
352
353
|
}
|
|
@@ -354,6 +355,7 @@ class AppFactory {
|
|
|
354
355
|
return {
|
|
355
356
|
...params,
|
|
356
357
|
sender: this.getSender(params.sender),
|
|
358
|
+
signer: this.getSigner(params.sender, params.signer),
|
|
357
359
|
method: types_appArc56.getArc56Method(params.method, this._appSpec),
|
|
358
360
|
args: this.getCreateABIArgsWithDefaultValues(params.method, params.args),
|
|
359
361
|
onComplete,
|
|
@@ -385,10 +387,15 @@ class AppFactory {
|
|
|
385
387
|
* if none provided and throws an error if neither provided */
|
|
386
388
|
getSender(sender) {
|
|
387
389
|
if (!sender && !this._defaultSender) {
|
|
388
|
-
throw new Error(`No sender provided and no default sender present in app
|
|
390
|
+
throw new Error(`No sender provided and no default sender present in app factory for call to app ${this._appName}`);
|
|
389
391
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
+
return typeof sender === 'string' ? algosdk.Address.fromString(sender) : (sender ?? this._defaultSender);
|
|
393
|
+
}
|
|
394
|
+
/** Returns the signer for a call, using the provided signer or the `defaultSigner`
|
|
395
|
+
* if no signer was provided and the sender resolves to the default sender, the call will use default signer
|
|
396
|
+
* or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
|
|
397
|
+
getSigner(sender, signer) {
|
|
398
|
+
return signer ?? (!sender || sender === this._defaultSender ? this._defaultSigner : undefined);
|
|
392
399
|
}
|
|
393
400
|
/**
|
|
394
401
|
* Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
|
package/types/app-factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-factory.js","sources":["../../src/types/app-factory.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { AlgorandClientInterface } from './algorand-client-interface'\nimport {\n AppCompilationResult,\n AppReturn,\n DELETABLE_TEMPLATE_NAME,\n SendAppTransactionResult,\n TealTemplateParams,\n UPDATABLE_TEMPLATE_NAME,\n} from './app'\nimport {\n ABIStruct,\n Arc56Contract,\n Arc56Method,\n getABIDecodedValue,\n getABITupleFromABIStruct,\n getArc56Method,\n getArc56ReturnValue,\n} from './app-arc56'\nimport {\n AppClient,\n AppClientBareCallParams,\n AppClientCompilationParams,\n AppClientMethodCallParams,\n AppClientParams,\n AppSourceMaps,\n ResolveAppClientByCreatorAndName,\n} from './app-client'\nimport {\n AppDeployParams,\n DeployAppDeleteMethodCall,\n DeployAppDeleteParams,\n DeployAppUpdateMethodCall,\n DeployAppUpdateParams,\n} from './app-deployer'\nimport { AppSpec } from './app-spec'\nimport { AppCreateMethodCall, AppCreateParams, AppMethodCall, AppMethodCallTransactionArgument, CommonAppCallParams } from './composer'\nimport { Expand } from './expand'\nimport { SendParams } from './transaction'\nimport SourceMap = algosdk.ProgramSourceMap\nimport OnApplicationComplete = algosdk.OnApplicationComplete\nimport ABIValue = algosdk.ABIValue\nimport TransactionSigner = algosdk.TransactionSigner\n\n/** Parameters to create an app client */\nexport interface AppFactoryParams {\n /** The ARC-56 or ARC-32 application spec as either:\n * * Parsed JSON ARC-56 `Contract`\n * * Parsed JSON ARC-32 `AppSpec`\n * * Raw JSON string (in either ARC-56 or ARC-32 format)\n */\n appSpec: Arc56Contract | AppSpec | string\n\n /** `AlgorandClient` instance */\n algorand: AlgorandClientInterface\n\n /**\n * Optional override for the app name; used for on-chain metadata and lookups.\n * Defaults to the ARC-32/ARC-56 app spec name.\n */\n appName?: string\n\n /** Optional address to use for the account to use as the default sender for calls. */\n defaultSender?: Address | string\n\n /** Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from `AlgorandClient`). */\n defaultSigner?: TransactionSigner\n\n /** The version of app that is / will be deployed; defaults to 1.0 */\n version?: string\n\n /**\n * Whether or not the contract should have deploy-time immutability control set, undefined = ignore.\n * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.\n *\n * Useful if you want to vend multiple contracts from the same factory without specifying this value\n * for each call.\n */\n updatable?: boolean\n\n /**\n * Whether or not the contract should have deploy-time permanence control set, undefined = ignore.\n * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.\n *\n * Useful if you want to vend multiple contracts from the same factory without specifying this value\n * for each call.\n */\n deletable?: boolean\n\n /**\n * Optional deploy-time TEAL template replacement parameters.\n * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.\n *\n * Useful if you want to vend multiple contracts from the same factory without specifying this value\n * for each call.\n */\n deployTimeParams?: TealTemplateParams\n}\n\n/** onComplete parameter for a create app call */\nexport type CreateOnComplete = {\n onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>\n}\n\n/** Specifies a schema used for creating an app */\nexport type CreateSchema = {\n /** The state schema for the app. This is immutable once the app is created. By default uses the ARC32/ARC-56 spec. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n}\n\n/** Params to specify a bare (raw) create call for an app */\nexport type AppFactoryCreateParams = Expand<AppClientBareCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema>\n\n/** Params to specify a create method call for an app */\nexport type AppFactoryCreateMethodCallParams = Expand<\n AppClientMethodCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema\n>\n\n/** Params to get an app client by ID from an app factory. */\nexport type AppFactoryAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>\n\n/** Params to get an app client by creator address and name from an app factory. */\nexport type AppFactoryResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>\n\n/** Parameters to define a deployment for an `AppFactory` */\nexport type AppFactoryDeployParams = Expand<\n Omit<AppDeployParams, 'createParams' | 'updateParams' | 'deleteParams' | 'metadata'> & {\n /** Create transaction parameters to use if a create needs to be issued as part of deployment */\n createParams?:\n | Expand<AppClientMethodCallParams & CreateOnComplete & CreateSchema>\n | Expand<AppClientBareCallParams & CreateOnComplete & CreateSchema>\n /** Update transaction parameters to use if a create needs to be issued as part of deployment */\n updateParams?: AppClientMethodCallParams | AppClientBareCallParams\n /** Delete transaction parameters to use if a create needs to be issued as part of deployment */\n deleteParams?: AppClientMethodCallParams | AppClientBareCallParams\n /**\n * Whether or not the contract should have deploy-time immutability control set.\n * `undefined` = use AppFactory constructor value if set or base it on the app spec.\n */\n updatable?: boolean\n /**\n * Whether or not the contract should have deploy-time permanence control set.\n * `undefined` = use AppFactory constructor value if set or base it on the app spec.\n */\n deletable?: boolean\n /** Override the app name for this deployment */\n appName?: string\n }\n>\n\n/**\n * ARC-56/ARC-32 app factory that, for a given app spec, allows you to create\n * and deploy one or more app instances and to create one or more app clients\n * to interact with those (or other) app instances.\n */\nexport class AppFactory {\n private _appSpec: Arc56Contract\n private _appName: string\n private _algorand: AlgorandClientInterface\n private _version: string\n private _defaultSender?: Address\n private _defaultSigner?: TransactionSigner\n private _deployTimeParams?: TealTemplateParams\n private _updatable?: boolean\n private _deletable?: boolean\n\n private _approvalSourceMap: SourceMap | undefined\n private _clearSourceMap: SourceMap | undefined\n\n private _paramsMethods: ReturnType<AppFactory['getParamsMethods']>\n\n constructor(params: AppFactoryParams) {\n this._appSpec = AppClient.normaliseAppSpec(params.appSpec)\n this._appName = params.appName ?? this._appSpec.name\n this._algorand = params.algorand\n this._version = params.version ?? '1.0'\n this._defaultSender = typeof params.defaultSender === 'string' ? Address.fromString(params.defaultSender) : params.defaultSender\n this._defaultSigner = params.defaultSigner\n this._deployTimeParams = params.deployTimeParams\n this._updatable = params.updatable\n this._deletable = params.deletable\n this._paramsMethods = this.getParamsMethods()\n }\n\n /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */\n public get appName() {\n return this._appName\n }\n\n /** The ARC-56 app spec being used */\n get appSpec() {\n return this._appSpec\n }\n\n /** Return the algorand client this factory is using. */\n get algorand() {\n return this._algorand\n }\n\n /** Get parameters to create transactions (create and deploy related calls) for the current app.\n *\n * A good mental model for this is that these parameters represent a deferred transaction creation.\n * @example Create a transaction in the future using Algorand Client\n * ```typescript\n * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})\n * // ...\n * await algorand.send.AppCreateMethodCall(createAppParams)\n * ```\n * @example Define a nested transaction as an ABI argument\n * ```typescript\n * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})\n * await appClient.send.call({method: 'my_method', args: [createAppParams]})\n * ```\n */\n get params() {\n return this._paramsMethods\n }\n\n /** Create transactions for the current app */\n readonly createTransaction = {\n /** Create bare (raw) transactions for the current app */\n bare: {\n /** Create a create call transaction, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params?: AppFactoryCreateParams) => {\n return this._algorand.createTransaction.appCreate(await this.params.bare.create(params))\n },\n },\n\n /** Create a create ABI call transaction, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params: AppFactoryCreateMethodCallParams) => {\n return this._algorand.createTransaction.appCreateMethodCall(await this.params.create(params))\n },\n }\n\n /** Send transactions to the current app */\n readonly send = {\n /** Send bare (raw) transactions for the current app */\n bare: {\n create: async (params?: AppFactoryCreateParams & SendParams) => {\n const updatable = params?.updatable ?? this._updatable\n const deletable = params?.deletable ?? this._deletable\n const deployTimeParams = params?.deployTimeParams ?? this._deployTimeParams\n const compiled = await this.compile({ deployTimeParams, updatable, deletable })\n const result = await this.handleCallErrors(async () => ({\n ...(await this._algorand.send.appCreate(await this.params.bare.create({ ...params, updatable, deletable, deployTimeParams }))),\n return: undefined,\n }))\n return {\n appClient: this.getAppClientById({\n appId: result.appId,\n }),\n result: {\n ...result,\n ...(compiled as Partial<AppCompilationResult>),\n },\n }\n },\n },\n\n /**\n * Creates an instance of the app and returns the result of the creation\n * transaction and an app client to interact with that app instance.\n *\n * Performs deploy-time TEAL template placeholder substitutions (if specified).\n * @param params The parameters to create the app\n * @returns The app client and the result of the creation transaction\n */\n create: async (params: AppFactoryCreateMethodCallParams & SendParams) => {\n const updatable = params?.updatable ?? this._updatable\n const deletable = params?.deletable ?? this._deletable\n const deployTimeParams = params?.deployTimeParams ?? this._deployTimeParams\n const compiled = await this.compile({ deployTimeParams, updatable, deletable })\n const result = await this.handleCallErrors(async () =>\n this.parseMethodCallReturn(\n this._algorand.send.appCreateMethodCall(await this.params.create({ ...params, updatable, deletable, deployTimeParams })),\n getArc56Method(params.method, this._appSpec),\n ),\n )\n return {\n appClient: this.getAppClientById({\n appId: result.appId,\n }),\n result: {\n ...result,\n ...(compiled as Partial<AppCompilationResult>),\n },\n }\n },\n }\n\n /**\n * Idempotently deploy (create if not exists, update if changed) an app against the given name for the given creator account, including deploy-time TEAL template placeholder substitutions (if specified).\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param params The arguments to control the app deployment\n * @returns The app client and the result of the deployment\n */\n public async deploy(params: AppFactoryDeployParams) {\n const updatable = params.updatable ?? this._updatable ?? this.getDeployTimeControl('updatable')\n const deletable = params.deletable ?? this._deletable ?? this.getDeployTimeControl('deletable')\n const deployTimeParams = params.deployTimeParams ?? this._deployTimeParams\n const compiled = await this.compile({ deployTimeParams, updatable, deletable })\n const deployResult = await this._algorand.appDeployer.deploy({\n ...params,\n createParams: await (params.createParams && 'method' in params.createParams\n ? this.params.create({ ...params.createParams, updatable, deletable, deployTimeParams })\n : this.params.bare.create({ ...params.createParams, updatable, deletable, deployTimeParams })),\n updateParams:\n params.updateParams && 'method' in params.updateParams\n ? this.params.deployUpdate(params.updateParams)\n : this.params.bare.deployUpdate(params.updateParams),\n deleteParams:\n params.deleteParams && 'method' in params.deleteParams\n ? this.params.deployDelete(params.deleteParams)\n : this.params.bare.deployDelete(params.deleteParams),\n metadata: {\n name: params.appName ?? this._appName,\n version: this._version,\n updatable,\n deletable,\n },\n })\n const appClient = this.getAppClientById({\n appId: deployResult.appId,\n appName: params.appName,\n })\n const result = {\n ...deployResult,\n ...(compiled as Partial<AppCompilationResult>),\n }\n return {\n appClient,\n result: {\n ...result,\n return:\n 'return' in result\n ? result.operationPerformed === 'update'\n ? params.updateParams && 'method' in params.updateParams\n ? getArc56ReturnValue(result.return, getArc56Method(params.updateParams.method, this._appSpec), this._appSpec.structs)\n : undefined\n : params.createParams && 'method' in params.createParams\n ? getArc56ReturnValue(result.return, getArc56Method(params.createParams.method, this._appSpec), this._appSpec.structs)\n : undefined\n : undefined,\n deleteReturn:\n 'deleteReturn' in result && params.deleteParams && 'method' in params.deleteParams\n ? getArc56ReturnValue(result.deleteReturn, getArc56Method(params.deleteParams.method, this._appSpec), this._appSpec.structs)\n : undefined,\n },\n }\n }\n\n /**\n * Returns a new `AppClient` client for an app instance of the given ID.\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The `AppClient`\n */\n public getAppClientById(params: AppFactoryAppClientParams) {\n return new AppClient({\n ...params,\n algorand: this._algorand,\n appSpec: this._appSpec,\n appName: params.appName ?? this._appName,\n defaultSender: params.defaultSender ?? this._defaultSender,\n defaultSigner: params.defaultSigner ?? this._defaultSigner,\n approvalSourceMap: params.approvalSourceMap ?? this._approvalSourceMap,\n clearSourceMap: params.clearSourceMap ?? this._clearSourceMap,\n })\n }\n\n /**\n * Returns a new `AppClient` client, resolving the app by creator address and name\n * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The `AppClient`\n */\n public getAppClientByCreatorAndName(params: AppFactoryResolveAppClientByCreatorAndNameParams) {\n return AppClient.fromCreatorAndName({\n ...params,\n algorand: this._algorand,\n appSpec: this._appSpec,\n appName: params.appName ?? this._appName,\n defaultSender: params.defaultSender ?? this._defaultSender,\n approvalSourceMap: params.approvalSourceMap ?? this._approvalSourceMap,\n clearSourceMap: params.clearSourceMap ?? this._clearSourceMap,\n })\n }\n\n /**\n * Takes an error that may include a logic error from a call to the current app and re-exposes the\n * error to include source code information via the source map and ARC-56 spec.\n * @param e The error to parse\n * @param isClearStateProgram Whether or not the code was running the clear state program (defaults to approval program)\n * @returns The new error, or if there was no logic error or source map then the wrapped error with source details\n */\n exposeLogicError(e: Error, isClearStateProgram?: boolean): Error {\n return AppClient.exposeLogicError(e, this._appSpec, {\n isClearStateProgram,\n approvalSourceMap: this._approvalSourceMap,\n clearSourceMap: this._clearSourceMap,\n })\n }\n\n /**\n * Export the current source maps for the app.\n * @returns The source maps\n */\n exportSourceMaps(): AppSourceMaps {\n if (!this._approvalSourceMap || !this._clearSourceMap) {\n throw new Error(\n \"Unable to export source maps; they haven't been loaded into this client - you need to call create, update, or deploy first\",\n )\n }\n\n return {\n approvalSourceMap: this._approvalSourceMap,\n clearSourceMap: this._clearSourceMap,\n }\n }\n\n /**\n * Import source maps for the app.\n * @param sourceMaps The source maps to import\n */\n importSourceMaps(sourceMaps: AppSourceMaps) {\n this._approvalSourceMap = new SourceMap(sourceMaps.approvalSourceMap)\n this._clearSourceMap = new SourceMap(sourceMaps.clearSourceMap)\n }\n\n private getDeployTimeControl(control: 'updatable' | 'deletable'): boolean | undefined {\n const approval = this._appSpec.source?.approval ? Buffer.from(this._appSpec.source.approval, 'base64').toString('utf-8') : undefined\n // variable not present, so unknown control value\n if (!approval || !approval.includes(control === 'updatable' ? UPDATABLE_TEMPLATE_NAME : DELETABLE_TEMPLATE_NAME)) return undefined\n\n // A call is present and configured\n return (\n this._appSpec.bareActions.call.includes(control === 'updatable' ? 'UpdateApplication' : 'DeleteApplication') ||\n Object.values(this._appSpec.methods).some((c) =>\n c.actions.call.includes(control === 'updatable' ? 'UpdateApplication' : 'DeleteApplication'),\n )\n )\n }\n\n private getParamsMethods() {\n return {\n /** Return params for a create ABI call, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params: AppFactoryCreateMethodCallParams) => {\n const compiled = await this.compile({ ...params, deployTimeParams: params.deployTimeParams ?? this._deployTimeParams })\n return this.getABIParams(\n {\n ...params,\n deployTimeParams: params.deployTimeParams ?? this._deployTimeParams,\n schema: params.schema ?? {\n globalByteSlices: this._appSpec.state.schema.global.bytes,\n globalInts: this._appSpec.state.schema.global.ints,\n localByteSlices: this._appSpec.state.schema.local.bytes,\n localInts: this._appSpec.state.schema.local.ints,\n },\n approvalProgram: compiled.approvalProgram,\n clearStateProgram: compiled.clearStateProgram,\n },\n params.onComplete ?? OnApplicationComplete.NoOpOC,\n ) satisfies AppCreateMethodCall\n },\n /** Return params for a deployment update ABI call */\n deployUpdate: (params: AppClientMethodCallParams) => {\n return this.getABIParams(params, OnApplicationComplete.UpdateApplicationOC) satisfies DeployAppUpdateMethodCall\n },\n /** Return params for a deployment delete ABI call */\n deployDelete: (params: AppClientMethodCallParams) => {\n return this.getABIParams(params, OnApplicationComplete.DeleteApplicationOC) satisfies DeployAppDeleteMethodCall\n },\n bare: {\n /** Return params for a create bare call, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params?: AppFactoryCreateParams) => {\n return this.getBareParams(\n {\n ...params,\n deployTimeParams: params?.deployTimeParams ?? this._deployTimeParams,\n schema: params?.schema ?? {\n globalByteSlices: this._appSpec.state.schema.global.bytes,\n globalInts: this._appSpec.state.schema.global.ints,\n localByteSlices: this._appSpec.state.schema.local.bytes,\n localInts: this._appSpec.state.schema.local.ints,\n },\n ...(await this.compile({ ...params, deployTimeParams: params?.deployTimeParams ?? this._deployTimeParams })),\n },\n params?.onComplete ?? OnApplicationComplete.NoOpOC,\n ) satisfies AppCreateParams\n },\n /** Return params for a deployment update bare call */\n deployUpdate: (params?: AppClientBareCallParams) => {\n return this.getBareParams(params, OnApplicationComplete.UpdateApplicationOC) satisfies DeployAppUpdateParams\n },\n /** Return params for a deployment delete bare call */\n deployDelete: (params?: AppClientBareCallParams) => {\n return this.getBareParams(params, OnApplicationComplete.DeleteApplicationOC) satisfies DeployAppDeleteParams\n },\n },\n }\n }\n\n /** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */\n private async handleCallErrors<TResult>(call: () => Promise<TResult>) {\n try {\n return await call()\n } catch (e) {\n throw this.exposeLogicError(e as Error)\n }\n }\n\n /**\n * Compiles the approval and clear state programs (if TEAL templates provided),\n * performing any provided deploy-time parameter replacement and stores\n * the source maps.\n *\n * If no TEAL templates provided it will use any byte code provided in the app spec.\n *\n * Will store any generated source maps for later use in debugging.\n */\n public async compile(compilation?: AppClientCompilationParams) {\n const result = await AppClient.compile(this._appSpec, this._algorand.app, compilation)\n\n if (result.compiledApproval) {\n this._approvalSourceMap = result.compiledApproval.sourceMap\n }\n if (result.compiledClear) {\n this._clearSourceMap = result.compiledClear.sourceMap\n }\n\n return result\n }\n\n private getBareParams<TParams extends { sender?: Address | string } | undefined, TOnComplete extends OnApplicationComplete>(\n params: TParams,\n onComplete: TOnComplete,\n ) {\n return {\n ...params,\n sender: this.getSender(params?.sender),\n onComplete,\n }\n }\n\n private getABIParams<\n TParams extends { method: string; sender?: Address | string; args?: AppClientMethodCallParams['args'] },\n TOnComplete extends OnApplicationComplete,\n >(params: TParams, onComplete: TOnComplete) {\n return {\n ...params,\n sender: this.getSender(params.sender),\n method: getArc56Method(params.method, this._appSpec),\n args: this.getCreateABIArgsWithDefaultValues(params.method, params.args),\n onComplete,\n }\n }\n\n private getCreateABIArgsWithDefaultValues(\n methodNameOrSignature: string,\n args: AppClientMethodCallParams['args'] | undefined,\n ): AppMethodCall<CommonAppCallParams>['args'] {\n const m = getArc56Method(methodNameOrSignature, this._appSpec)\n return args?.map((a, i) => {\n const arg = m.args[i]\n if (a !== undefined) {\n // If a struct then convert to tuple for the underlying call\n return arg.struct && typeof a === 'object' && !Array.isArray(a)\n ? getABITupleFromABIStruct(a as ABIStruct, this._appSpec.structs[arg.struct], this._appSpec.structs)\n : (a as ABIValue | AppMethodCallTransactionArgument)\n }\n const defaultValue = arg.defaultValue\n if (defaultValue) {\n switch (defaultValue.source) {\n case 'literal':\n return getABIDecodedValue(Buffer.from(defaultValue.data, 'base64'), m.method.args[i].type, this._appSpec.structs) as ABIValue\n default:\n throw new Error(`Can't provide default value for ${defaultValue.source} for a contract creation call`)\n }\n }\n throw new Error(`No value provided for required argument ${arg.name ?? `arg${i + 1}`} in call to method ${m.name}`)\n })\n }\n\n /** Returns the sender for a call, using the `defaultSender`\n * if none provided and throws an error if neither provided */\n private getSender(sender: string | Address | undefined): Address {\n if (!sender && !this._defaultSender) {\n throw new Error(`No sender provided and no default sender present in app client for call to app ${this._appName}`)\n }\n const s = sender ?? this._defaultSender!\n return typeof s === 'string' ? Address.fromString(s) : s\n }\n\n /**\n * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type\n * on the ARC-56 method.\n *\n * If the return type is a struct then the struct will be returned.\n *\n * @param result The SendAppTransactionResult to be mapped\n * @param method The method that was called\n * @returns The smart contract response with an updated return value\n */\n async parseMethodCallReturn<\n TReturn extends Uint8Array | ABIValue | ABIStruct | undefined,\n TResult extends SendAppTransactionResult = SendAppTransactionResult,\n >(result: Promise<TResult> | TResult, method: Arc56Method): Promise<Omit<TResult, 'return'> & AppReturn<TReturn>> {\n const resultValue = await result\n return { ...resultValue, return: getArc56ReturnValue(resultValue.return, method, this._appSpec.structs) }\n }\n}\n"],"names":["getArc56Method","AppClient","Address","getArc56ReturnValue","UPDATABLE_TEMPLATE_NAME","DELETABLE_TEMPLATE_NAME","getABITupleFromABIStruct","getABIDecodedValue"],"mappings":";;;;;;;AAuCA,IAAO,SAAS,GAAG,OAAO,CAAC,gBAAgB;AAC3C,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB;AA2H5D;;;;AAIG;MACU,UAAU,CAAA;AAgBrB,IAAA,WAAA,CAAY,MAAwB,EAAA;;AAgD3B,QAAA,IAAA,CAAA,iBAAiB,GAAG;;AAE3B,YAAA,IAAI,EAAE;;AAEJ,gBAAA,MAAM,EAAE,OAAO,MAA+B,KAAI;oBAChD,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;iBACzF;AACF,aAAA;;AAGD,YAAA,MAAM,EAAE,OAAO,MAAwC,KAAI;AACzD,gBAAA,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,MAAM,IAAI,CAAC,MAAM,CAA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CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAa;AAC/H,oBAAA;wBACE,MAAM,IAAI,KAAK,CAAC,CAAA,gCAAA,EAAmC,YAAY,CAAC,MAAM,CAA+B,6BAAA,CAAA,CAAC;;;AAG5G,YAAA,MAAM,IAAI,KAAK,CAAC,2CAA2C,GAAG,CAAC,IAAI,IAAI,CAAA,GAAA,EAAM,CAAC,GAAG,CAAC,EAAE,CAAsB,mBAAA,EAAA,CAAC,CAAC,IAAI,CAAA,CAAE,CAAC;AACrH,SAAC,CAAC;;AAGJ;AAC8D;AACtD,IAAA,SAAS,CAAC,MAAoC,EAAA;QACpD,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,CAAA,+EAAA,EAAkF,IAAI,CAAC,QAAQ,CAAE,CAAA,CAAC;;AAEpH,QAAA,MAAM,CAAC,GAAG,MAAM,IAAI,IAAI,CAAC,cAAe;AACxC,QAAA,OAAO,OAAO,CAAC,KAAK,QAAQ,GAAGL,eAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;;AAG1D;;;;;;;;;AASG;AACH,IAAA,MAAM,qBAAqB,CAGzB,MAAkC,EAAE,MAAmB,EAAA;AACvD,QAAA,MAAM,WAAW,GAAG,MAAM,MAAM;QAChC,OAAO,EAAE,GAAG,WAAW,EAAE,MAAM,EAAEC,kCAAmB,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;;AAE5G;;;;"}
|
|
1
|
+
{"version":3,"file":"app-factory.js","sources":["../../src/types/app-factory.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { TransactionSignerAccount } from './account'\nimport { AlgorandClientInterface } from './algorand-client-interface'\nimport {\n AppCompilationResult,\n AppReturn,\n DELETABLE_TEMPLATE_NAME,\n SendAppTransactionResult,\n TealTemplateParams,\n UPDATABLE_TEMPLATE_NAME,\n} from './app'\nimport {\n ABIStruct,\n Arc56Contract,\n Arc56Method,\n getABIDecodedValue,\n getABITupleFromABIStruct,\n getArc56Method,\n getArc56ReturnValue,\n} from './app-arc56'\nimport {\n AppClient,\n AppClientBareCallParams,\n AppClientCompilationParams,\n AppClientMethodCallParams,\n AppClientParams,\n AppSourceMaps,\n ResolveAppClientByCreatorAndName,\n} from './app-client'\nimport {\n AppDeployParams,\n DeployAppDeleteMethodCall,\n DeployAppDeleteParams,\n DeployAppUpdateMethodCall,\n DeployAppUpdateParams,\n} from './app-deployer'\nimport { AppSpec } from './app-spec'\nimport { AppCreateMethodCall, AppCreateParams, AppMethodCall, AppMethodCallTransactionArgument, CommonAppCallParams } from './composer'\nimport { Expand } from './expand'\nimport { SendParams } from './transaction'\nimport SourceMap = algosdk.ProgramSourceMap\nimport OnApplicationComplete = algosdk.OnApplicationComplete\nimport ABIValue = algosdk.ABIValue\nimport TransactionSigner = algosdk.TransactionSigner\n\n/** Parameters to create an app client */\nexport interface AppFactoryParams {\n /** The ARC-56 or ARC-32 application spec as either:\n * * Parsed JSON ARC-56 `Contract`\n * * Parsed JSON ARC-32 `AppSpec`\n * * Raw JSON string (in either ARC-56 or ARC-32 format)\n */\n appSpec: Arc56Contract | AppSpec | string\n\n /** `AlgorandClient` instance */\n algorand: AlgorandClientInterface\n\n /**\n * Optional override for the app name; used for on-chain metadata and lookups.\n * Defaults to the ARC-32/ARC-56 app spec name.\n */\n appName?: string\n\n /** Optional address to use for the account to use as the default sender for calls. */\n defaultSender?: Address | string\n\n /** Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from `AlgorandClient`). */\n defaultSigner?: TransactionSigner\n\n /** The version of app that is / will be deployed; defaults to 1.0 */\n version?: string\n\n /**\n * Whether or not the contract should have deploy-time immutability control set, undefined = ignore.\n * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.\n *\n * Useful if you want to vend multiple contracts from the same factory without specifying this value\n * for each call.\n */\n updatable?: boolean\n\n /**\n * Whether or not the contract should have deploy-time permanence control set, undefined = ignore.\n * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.\n *\n * Useful if you want to vend multiple contracts from the same factory without specifying this value\n * for each call.\n */\n deletable?: boolean\n\n /**\n * Optional deploy-time TEAL template replacement parameters.\n * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.\n *\n * Useful if you want to vend multiple contracts from the same factory without specifying this value\n * for each call.\n */\n deployTimeParams?: TealTemplateParams\n}\n\n/** onComplete parameter for a create app call */\nexport type CreateOnComplete = {\n onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>\n}\n\n/** Specifies a schema used for creating an app */\nexport type CreateSchema = {\n /** The state schema for the app. This is immutable once the app is created. By default uses the ARC32/ARC-56 spec. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n}\n\n/** Params to specify a bare (raw) create call for an app */\nexport type AppFactoryCreateParams = Expand<AppClientBareCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema>\n\n/** Params to specify a create method call for an app */\nexport type AppFactoryCreateMethodCallParams = Expand<\n AppClientMethodCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema\n>\n\n/** Params to get an app client by ID from an app factory. */\nexport type AppFactoryAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>\n\n/** Params to get an app client by creator address and name from an app factory. */\nexport type AppFactoryResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>\n\n/** Parameters to define a deployment for an `AppFactory` */\nexport type AppFactoryDeployParams = Expand<\n Omit<AppDeployParams, 'createParams' | 'updateParams' | 'deleteParams' | 'metadata'> & {\n /** Create transaction parameters to use if a create needs to be issued as part of deployment */\n createParams?:\n | Expand<AppClientMethodCallParams & CreateOnComplete & CreateSchema>\n | Expand<AppClientBareCallParams & CreateOnComplete & CreateSchema>\n /** Update transaction parameters to use if a create needs to be issued as part of deployment */\n updateParams?: AppClientMethodCallParams | AppClientBareCallParams\n /** Delete transaction parameters to use if a create needs to be issued as part of deployment */\n deleteParams?: AppClientMethodCallParams | AppClientBareCallParams\n /**\n * Whether or not the contract should have deploy-time immutability control set.\n * `undefined` = use AppFactory constructor value if set or base it on the app spec.\n */\n updatable?: boolean\n /**\n * Whether or not the contract should have deploy-time permanence control set.\n * `undefined` = use AppFactory constructor value if set or base it on the app spec.\n */\n deletable?: boolean\n /** Override the app name for this deployment */\n appName?: string\n }\n>\n\n/**\n * ARC-56/ARC-32 app factory that, for a given app spec, allows you to create\n * and deploy one or more app instances and to create one or more app clients\n * to interact with those (or other) app instances.\n */\nexport class AppFactory {\n private _appSpec: Arc56Contract\n private _appName: string\n private _algorand: AlgorandClientInterface\n private _version: string\n private _defaultSender?: Address\n private _defaultSigner?: TransactionSigner\n private _deployTimeParams?: TealTemplateParams\n private _updatable?: boolean\n private _deletable?: boolean\n\n private _approvalSourceMap: SourceMap | undefined\n private _clearSourceMap: SourceMap | undefined\n\n private _paramsMethods: ReturnType<AppFactory['getParamsMethods']>\n\n constructor(params: AppFactoryParams) {\n this._appSpec = AppClient.normaliseAppSpec(params.appSpec)\n this._appName = params.appName ?? this._appSpec.name\n this._algorand = params.algorand\n this._version = params.version ?? '1.0'\n this._defaultSender = typeof params.defaultSender === 'string' ? Address.fromString(params.defaultSender) : params.defaultSender\n this._defaultSigner = params.defaultSigner\n this._deployTimeParams = params.deployTimeParams\n this._updatable = params.updatable\n this._deletable = params.deletable\n this._paramsMethods = this.getParamsMethods()\n }\n\n /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */\n public get appName() {\n return this._appName\n }\n\n /** The ARC-56 app spec being used */\n get appSpec() {\n return this._appSpec\n }\n\n /** Return the algorand client this factory is using. */\n get algorand() {\n return this._algorand\n }\n\n /** Get parameters to create transactions (create and deploy related calls) for the current app.\n *\n * A good mental model for this is that these parameters represent a deferred transaction creation.\n * @example Create a transaction in the future using Algorand Client\n * ```typescript\n * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})\n * // ...\n * await algorand.send.AppCreateMethodCall(createAppParams)\n * ```\n * @example Define a nested transaction as an ABI argument\n * ```typescript\n * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})\n * await appClient.send.call({method: 'my_method', args: [createAppParams]})\n * ```\n */\n get params() {\n return this._paramsMethods\n }\n\n /** Create transactions for the current app */\n readonly createTransaction = {\n /** Create bare (raw) transactions for the current app */\n bare: {\n /** Create a create call transaction, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params?: AppFactoryCreateParams) => {\n return this._algorand.createTransaction.appCreate(await this.params.bare.create(params))\n },\n },\n\n /** Create a create ABI call transaction, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params: AppFactoryCreateMethodCallParams) => {\n return this._algorand.createTransaction.appCreateMethodCall(await this.params.create(params))\n },\n }\n\n /** Send transactions to the current app */\n readonly send = {\n /** Send bare (raw) transactions for the current app */\n bare: {\n create: async (params?: AppFactoryCreateParams & SendParams) => {\n const updatable = params?.updatable ?? this._updatable\n const deletable = params?.deletable ?? this._deletable\n const deployTimeParams = params?.deployTimeParams ?? this._deployTimeParams\n const compiled = await this.compile({ deployTimeParams, updatable, deletable })\n const result = await this.handleCallErrors(async () => ({\n ...(await this._algorand.send.appCreate(await this.params.bare.create({ ...params, updatable, deletable, deployTimeParams }))),\n return: undefined,\n }))\n return {\n appClient: this.getAppClientById({\n appId: result.appId,\n }),\n result: {\n ...result,\n ...(compiled as Partial<AppCompilationResult>),\n },\n }\n },\n },\n\n /**\n * Creates an instance of the app and returns the result of the creation\n * transaction and an app client to interact with that app instance.\n *\n * Performs deploy-time TEAL template placeholder substitutions (if specified).\n * @param params The parameters to create the app\n * @returns The app client and the result of the creation transaction\n */\n create: async (params: AppFactoryCreateMethodCallParams & SendParams) => {\n const updatable = params?.updatable ?? this._updatable\n const deletable = params?.deletable ?? this._deletable\n const deployTimeParams = params?.deployTimeParams ?? this._deployTimeParams\n const compiled = await this.compile({ deployTimeParams, updatable, deletable })\n const result = await this.handleCallErrors(async () =>\n this.parseMethodCallReturn(\n this._algorand.send.appCreateMethodCall(await this.params.create({ ...params, updatable, deletable, deployTimeParams })),\n getArc56Method(params.method, this._appSpec),\n ),\n )\n return {\n appClient: this.getAppClientById({\n appId: result.appId,\n }),\n result: {\n ...result,\n ...(compiled as Partial<AppCompilationResult>),\n },\n }\n },\n }\n\n /**\n * Idempotently deploy (create if not exists, update if changed) an app against the given name for the given creator account, including deploy-time TEAL template placeholder substitutions (if specified).\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param params The arguments to control the app deployment\n * @returns The app client and the result of the deployment\n */\n public async deploy(params: AppFactoryDeployParams) {\n const updatable = params.updatable ?? this._updatable ?? this.getDeployTimeControl('updatable')\n const deletable = params.deletable ?? this._deletable ?? this.getDeployTimeControl('deletable')\n const deployTimeParams = params.deployTimeParams ?? this._deployTimeParams\n const compiled = await this.compile({ deployTimeParams, updatable, deletable })\n const deployResult = await this._algorand.appDeployer.deploy({\n ...params,\n createParams: await (params.createParams && 'method' in params.createParams\n ? this.params.create({ ...params.createParams, updatable, deletable, deployTimeParams })\n : this.params.bare.create({ ...params.createParams, updatable, deletable, deployTimeParams })),\n updateParams:\n params.updateParams && 'method' in params.updateParams\n ? this.params.deployUpdate(params.updateParams)\n : this.params.bare.deployUpdate(params.updateParams),\n deleteParams:\n params.deleteParams && 'method' in params.deleteParams\n ? this.params.deployDelete(params.deleteParams)\n : this.params.bare.deployDelete(params.deleteParams),\n metadata: {\n name: params.appName ?? this._appName,\n version: this._version,\n updatable,\n deletable,\n },\n })\n const appClient = this.getAppClientById({\n appId: deployResult.appId,\n appName: params.appName,\n })\n const result = {\n ...deployResult,\n ...(compiled as Partial<AppCompilationResult>),\n }\n return {\n appClient,\n result: {\n ...result,\n return:\n 'return' in result\n ? result.operationPerformed === 'update'\n ? params.updateParams && 'method' in params.updateParams\n ? getArc56ReturnValue(result.return, getArc56Method(params.updateParams.method, this._appSpec), this._appSpec.structs)\n : undefined\n : params.createParams && 'method' in params.createParams\n ? getArc56ReturnValue(result.return, getArc56Method(params.createParams.method, this._appSpec), this._appSpec.structs)\n : undefined\n : undefined,\n deleteReturn:\n 'deleteReturn' in result && params.deleteParams && 'method' in params.deleteParams\n ? getArc56ReturnValue(result.deleteReturn, getArc56Method(params.deleteParams.method, this._appSpec), this._appSpec.structs)\n : undefined,\n },\n }\n }\n\n /**\n * Returns a new `AppClient` client for an app instance of the given ID.\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The `AppClient`\n */\n public getAppClientById(params: AppFactoryAppClientParams) {\n return new AppClient({\n ...params,\n algorand: this._algorand,\n appSpec: this._appSpec,\n appName: params.appName ?? this._appName,\n defaultSender: params.defaultSender ?? this._defaultSender,\n defaultSigner: params.defaultSigner ?? this._defaultSigner,\n approvalSourceMap: params.approvalSourceMap ?? this._approvalSourceMap,\n clearSourceMap: params.clearSourceMap ?? this._clearSourceMap,\n })\n }\n\n /**\n * Returns a new `AppClient` client, resolving the app by creator address and name\n * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The `AppClient`\n */\n public getAppClientByCreatorAndName(params: AppFactoryResolveAppClientByCreatorAndNameParams) {\n return AppClient.fromCreatorAndName({\n ...params,\n algorand: this._algorand,\n appSpec: this._appSpec,\n appName: params.appName ?? this._appName,\n defaultSender: params.defaultSender ?? this._defaultSender,\n approvalSourceMap: params.approvalSourceMap ?? this._approvalSourceMap,\n clearSourceMap: params.clearSourceMap ?? this._clearSourceMap,\n })\n }\n\n /**\n * Takes an error that may include a logic error from a call to the current app and re-exposes the\n * error to include source code information via the source map and ARC-56 spec.\n * @param e The error to parse\n * @param isClearStateProgram Whether or not the code was running the clear state program (defaults to approval program)\n * @returns The new error, or if there was no logic error or source map then the wrapped error with source details\n */\n exposeLogicError(e: Error, isClearStateProgram?: boolean): Error {\n return AppClient.exposeLogicError(e, this._appSpec, {\n isClearStateProgram,\n approvalSourceMap: this._approvalSourceMap,\n clearSourceMap: this._clearSourceMap,\n })\n }\n\n /**\n * Export the current source maps for the app.\n * @returns The source maps\n */\n exportSourceMaps(): AppSourceMaps {\n if (!this._approvalSourceMap || !this._clearSourceMap) {\n throw new Error(\n \"Unable to export source maps; they haven't been loaded into this client - you need to call create, update, or deploy first\",\n )\n }\n\n return {\n approvalSourceMap: this._approvalSourceMap,\n clearSourceMap: this._clearSourceMap,\n }\n }\n\n /**\n * Import source maps for the app.\n * @param sourceMaps The source maps to import\n */\n importSourceMaps(sourceMaps: AppSourceMaps) {\n this._approvalSourceMap = new SourceMap(sourceMaps.approvalSourceMap)\n this._clearSourceMap = new SourceMap(sourceMaps.clearSourceMap)\n }\n\n private getDeployTimeControl(control: 'updatable' | 'deletable'): boolean | undefined {\n const approval = this._appSpec.source?.approval ? Buffer.from(this._appSpec.source.approval, 'base64').toString('utf-8') : undefined\n // variable not present, so unknown control value\n if (!approval || !approval.includes(control === 'updatable' ? UPDATABLE_TEMPLATE_NAME : DELETABLE_TEMPLATE_NAME)) return undefined\n\n // A call is present and configured\n return (\n this._appSpec.bareActions.call.includes(control === 'updatable' ? 'UpdateApplication' : 'DeleteApplication') ||\n Object.values(this._appSpec.methods).some((c) =>\n c.actions.call.includes(control === 'updatable' ? 'UpdateApplication' : 'DeleteApplication'),\n )\n )\n }\n\n private getParamsMethods() {\n return {\n /** Return params for a create ABI call, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params: AppFactoryCreateMethodCallParams) => {\n const compiled = await this.compile({ ...params, deployTimeParams: params.deployTimeParams ?? this._deployTimeParams })\n return this.getABIParams(\n {\n ...params,\n deployTimeParams: params.deployTimeParams ?? this._deployTimeParams,\n schema: params.schema ?? {\n globalByteSlices: this._appSpec.state.schema.global.bytes,\n globalInts: this._appSpec.state.schema.global.ints,\n localByteSlices: this._appSpec.state.schema.local.bytes,\n localInts: this._appSpec.state.schema.local.ints,\n },\n approvalProgram: compiled.approvalProgram,\n clearStateProgram: compiled.clearStateProgram,\n },\n params.onComplete ?? OnApplicationComplete.NoOpOC,\n ) satisfies AppCreateMethodCall\n },\n /** Return params for a deployment update ABI call */\n deployUpdate: (params: AppClientMethodCallParams) => {\n return this.getABIParams(params, OnApplicationComplete.UpdateApplicationOC) satisfies DeployAppUpdateMethodCall\n },\n /** Return params for a deployment delete ABI call */\n deployDelete: (params: AppClientMethodCallParams) => {\n return this.getABIParams(params, OnApplicationComplete.DeleteApplicationOC) satisfies DeployAppDeleteMethodCall\n },\n bare: {\n /** Return params for a create bare call, including deploy-time TEAL template replacements and compilation if provided */\n create: async (params?: AppFactoryCreateParams) => {\n return this.getBareParams(\n {\n ...params,\n deployTimeParams: params?.deployTimeParams ?? this._deployTimeParams,\n schema: params?.schema ?? {\n globalByteSlices: this._appSpec.state.schema.global.bytes,\n globalInts: this._appSpec.state.schema.global.ints,\n localByteSlices: this._appSpec.state.schema.local.bytes,\n localInts: this._appSpec.state.schema.local.ints,\n },\n ...(await this.compile({ ...params, deployTimeParams: params?.deployTimeParams ?? this._deployTimeParams })),\n },\n params?.onComplete ?? OnApplicationComplete.NoOpOC,\n ) satisfies AppCreateParams\n },\n /** Return params for a deployment update bare call */\n deployUpdate: (params?: AppClientBareCallParams) => {\n return this.getBareParams(params, OnApplicationComplete.UpdateApplicationOC) satisfies DeployAppUpdateParams\n },\n /** Return params for a deployment delete bare call */\n deployDelete: (params?: AppClientBareCallParams) => {\n return this.getBareParams(params, OnApplicationComplete.DeleteApplicationOC) satisfies DeployAppDeleteParams\n },\n },\n }\n }\n\n /** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */\n private async handleCallErrors<TResult>(call: () => Promise<TResult>) {\n try {\n return await call()\n } catch (e) {\n throw this.exposeLogicError(e as Error)\n }\n }\n\n /**\n * Compiles the approval and clear state programs (if TEAL templates provided),\n * performing any provided deploy-time parameter replacement and stores\n * the source maps.\n *\n * If no TEAL templates provided it will use any byte code provided in the app spec.\n *\n * Will store any generated source maps for later use in debugging.\n */\n public async compile(compilation?: AppClientCompilationParams) {\n const result = await AppClient.compile(this._appSpec, this._algorand.app, compilation)\n\n if (result.compiledApproval) {\n this._approvalSourceMap = result.compiledApproval.sourceMap\n }\n if (result.compiledClear) {\n this._clearSourceMap = result.compiledClear.sourceMap\n }\n\n return result\n }\n\n private getBareParams<\n TParams extends { sender?: Address | string; signer?: TransactionSigner | TransactionSignerAccount } | undefined,\n TOnComplete extends OnApplicationComplete,\n >(params: TParams, onComplete: TOnComplete) {\n return {\n ...params,\n sender: this.getSender(params?.sender),\n signer: this.getSigner(params?.sender, params?.signer),\n onComplete,\n }\n }\n\n private getABIParams<\n TParams extends {\n method: string\n sender?: Address | string\n signer?: TransactionSigner | TransactionSignerAccount\n args?: AppClientMethodCallParams['args']\n },\n TOnComplete extends OnApplicationComplete,\n >(params: TParams, onComplete: TOnComplete) {\n return {\n ...params,\n sender: this.getSender(params.sender),\n signer: this.getSigner(params.sender, params.signer),\n method: getArc56Method(params.method, this._appSpec),\n args: this.getCreateABIArgsWithDefaultValues(params.method, params.args),\n onComplete,\n }\n }\n\n private getCreateABIArgsWithDefaultValues(\n methodNameOrSignature: string,\n args: AppClientMethodCallParams['args'] | undefined,\n ): AppMethodCall<CommonAppCallParams>['args'] {\n const m = getArc56Method(methodNameOrSignature, this._appSpec)\n return args?.map((a, i) => {\n const arg = m.args[i]\n if (a !== undefined) {\n // If a struct then convert to tuple for the underlying call\n return arg.struct && typeof a === 'object' && !Array.isArray(a)\n ? getABITupleFromABIStruct(a as ABIStruct, this._appSpec.structs[arg.struct], this._appSpec.structs)\n : (a as ABIValue | AppMethodCallTransactionArgument)\n }\n const defaultValue = arg.defaultValue\n if (defaultValue) {\n switch (defaultValue.source) {\n case 'literal':\n return getABIDecodedValue(Buffer.from(defaultValue.data, 'base64'), m.method.args[i].type, this._appSpec.structs) as ABIValue\n default:\n throw new Error(`Can't provide default value for ${defaultValue.source} for a contract creation call`)\n }\n }\n throw new Error(`No value provided for required argument ${arg.name ?? `arg${i + 1}`} in call to method ${m.name}`)\n })\n }\n\n /** Returns the sender for a call, using the `defaultSender`\n * if none provided and throws an error if neither provided */\n private getSender(sender: string | Address | undefined): Address {\n if (!sender && !this._defaultSender) {\n throw new Error(`No sender provided and no default sender present in app factory for call to app ${this._appName}`)\n }\n return typeof sender === 'string' ? Address.fromString(sender) : (sender ?? this._defaultSender!)\n }\n\n /** Returns the signer for a call, using the provided signer or the `defaultSigner`\n * if no signer was provided and the sender resolves to the default sender, the call will use default signer\n * or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */\n private getSigner(\n sender: Address | string | undefined,\n signer: TransactionSigner | TransactionSignerAccount | undefined,\n ): TransactionSigner | TransactionSignerAccount | undefined {\n return signer ?? (!sender || sender === this._defaultSender ? this._defaultSigner : undefined)\n }\n\n /**\n * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type\n * on the ARC-56 method.\n *\n * If the return type is a struct then the struct will be returned.\n *\n * @param result The SendAppTransactionResult to be mapped\n * @param method The method that was called\n * @returns The smart contract response with an updated return value\n */\n async parseMethodCallReturn<\n TReturn extends Uint8Array | ABIValue | ABIStruct | undefined,\n TResult extends SendAppTransactionResult = SendAppTransactionResult,\n >(result: Promise<TResult> | TResult, method: Arc56Method): Promise<Omit<TResult, 'return'> & AppReturn<TReturn>> {\n const resultValue = await result\n return { ...resultValue, return: getArc56ReturnValue(resultValue.return, method, this._appSpec.structs) }\n }\n}\n"],"names":["getArc56Method","AppClient","Address","getArc56ReturnValue","UPDATABLE_TEMPLATE_NAME","DELETABLE_TEMPLATE_NAME","getABITupleFromABIStruct","getABIDecodedValue"],"mappings":";;;;;;;AAwCA,IAAO,SAAS,GAAG,OAAO,CAAC,gBAAgB;AAC3C,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB;AA2H5D;;;;AAIG;MACU,UAAU,CAAA;AAgBrB,IAAA,WAAA,CAAY,MAAwB,EAAA;;AAgD3B,QAAA,IAAA,CAAA,iBAAiB,GAAG;;AAE3B,YAAA,IAAI,EAAE;;AAEJ,gBAAA,MAAM,EAAE,OAAO,MAA+B,KAAI;oBAChD,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;iBACzF;AACF,aAAA;;AAGD,YAAA,MAAM,EAAE,OAAO,MAAwC,KAAI;AACzD,gBAAA,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aAC9F;SACF;;AAGQ,QAAA,IAAA,CAAA,IAAI,GAAG;;AAEd,YAAA,IAAI,EAAE;AACJ,gBAAA,MAAM,EAAE,OAAO,MAA4C,KAAI;oBAC7D,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,IAAI,IAAI,CAAC,UAAU;oBACtD,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,IAAI,IAAI,CA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|
|
345
345
|
return {
|
|
346
346
|
...params,
|
|
347
347
|
sender: this.getSender(params?.sender),
|
|
348
|
+
signer: this.getSigner(params?.sender, params?.signer),
|
|
348
349
|
onComplete,
|
|
349
350
|
};
|
|
350
351
|
}
|
|
@@ -352,6 +353,7 @@ class AppFactory {
|
|
|
352
353
|
return {
|
|
353
354
|
...params,
|
|
354
355
|
sender: this.getSender(params.sender),
|
|
356
|
+
signer: this.getSigner(params.sender, params.signer),
|
|
355
357
|
method: getArc56Method(params.method, this._appSpec),
|
|
356
358
|
args: this.getCreateABIArgsWithDefaultValues(params.method, params.args),
|
|
357
359
|
onComplete,
|
|
@@ -383,10 +385,15 @@ class AppFactory {
|
|
|
383
385
|
* if none provided and throws an error if neither provided */
|
|
384
386
|
getSender(sender) {
|
|
385
387
|
if (!sender && !this._defaultSender) {
|
|
386
|
-
throw new Error(`No sender provided and no default sender present in app
|
|
388
|
+
throw new Error(`No sender provided and no default sender present in app factory for call to app ${this._appName}`);
|
|
387
389
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
+
return typeof sender === 'string' ? Address.fromString(sender) : (sender ?? this._defaultSender);
|
|
391
|
+
}
|
|
392
|
+
/** Returns the signer for a call, using the provided signer or the `defaultSigner`
|
|
393
|
+
* if no signer was provided and the sender resolves to the default sender, the call will use default signer
|
|
394
|
+
* or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
|
|
395
|
+
getSigner(sender, signer) {
|
|
396
|
+
return signer ?? (!sender || sender === this._defaultSender ? this._defaultSigner : undefined);
|
|
390
397
|
}
|
|
391
398
|
/**
|
|
392
399
|
* Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
|