@algorandfoundation/algokit-utils 7.0.0 → 7.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.
@@ -1,4 +1,5 @@
1
1
  import algosdk 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';
@@ -154,7 +155,7 @@ export declare class AppFactory {
154
155
  lease?: string | Uint8Array | undefined;
155
156
  note?: string | Uint8Array | undefined;
156
157
  maxFee?: import("./amount").AlgoAmount | undefined;
157
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
158
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
158
159
  rekeyTo?: string | undefined;
159
160
  staticFee?: import("./amount").AlgoAmount | undefined;
160
161
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -200,7 +201,7 @@ export declare class AppFactory {
200
201
  lease?: string | Uint8Array | undefined;
201
202
  note?: string | Uint8Array | undefined;
202
203
  maxFee?: import("./amount").AlgoAmount | undefined;
203
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
204
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
204
205
  rekeyTo?: string | undefined;
205
206
  staticFee?: import("./amount").AlgoAmount | undefined;
206
207
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -220,13 +221,14 @@ export declare class AppFactory {
220
221
  extraProgramPages?: number | undefined;
221
222
  } & {
222
223
  sender: string;
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
  lease?: string | Uint8Array | undefined;
226
228
  note?: string | Uint8Array | undefined;
227
229
  maxFee?: import("./amount").AlgoAmount | undefined;
228
230
  args?: Uint8Array[] | undefined;
229
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
231
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
230
232
  sender: string;
231
233
  rekeyTo?: string | undefined;
232
234
  staticFee?: import("./amount").AlgoAmount | undefined;
@@ -250,7 +252,7 @@ export declare class AppFactory {
250
252
  extraProgramPages?: number | undefined;
251
253
  }> | AppMethodCall<{
252
254
  sender: string;
253
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
255
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
254
256
  rekeyTo?: string | undefined;
255
257
  note?: string | Uint8Array | undefined;
256
258
  lease?: string | Uint8Array | undefined;
@@ -277,7 +279,7 @@ export declare class AppFactory {
277
279
  lease?: string | Uint8Array | undefined;
278
280
  note?: string | Uint8Array | undefined;
279
281
  maxFee?: import("./amount").AlgoAmount | undefined;
280
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
282
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
281
283
  rekeyTo?: string | undefined;
282
284
  staticFee?: import("./amount").AlgoAmount | undefined;
283
285
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -296,7 +298,7 @@ export declare class AppFactory {
296
298
  lease?: string | Uint8Array | undefined;
297
299
  note?: string | Uint8Array | undefined;
298
300
  maxFee?: import("./amount").AlgoAmount | undefined;
299
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
301
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
300
302
  rekeyTo?: string | undefined;
301
303
  staticFee?: import("./amount").AlgoAmount | undefined;
302
304
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -313,13 +315,14 @@ export declare class AppFactory {
313
315
  args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
314
316
  } & {
315
317
  sender: string;
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
  lease?: string | Uint8Array | undefined;
319
322
  note?: string | Uint8Array | undefined;
320
323
  maxFee?: import("./amount").AlgoAmount | undefined;
321
324
  args?: Uint8Array[] | undefined;
322
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
325
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
323
326
  sender: string;
324
327
  rekeyTo?: string | undefined;
325
328
  staticFee?: import("./amount").AlgoAmount | undefined;
@@ -343,7 +346,7 @@ export declare class AppFactory {
343
346
  extraProgramPages?: number | undefined;
344
347
  }> | AppMethodCall<{
345
348
  sender: string;
346
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
349
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
347
350
  rekeyTo?: string | undefined;
348
351
  note?: string | Uint8Array | undefined;
349
352
  lease?: string | Uint8Array | undefined;
@@ -370,7 +373,7 @@ export declare class AppFactory {
370
373
  lease?: string | Uint8Array | undefined;
371
374
  note?: string | Uint8Array | undefined;
372
375
  maxFee?: import("./amount").AlgoAmount | undefined;
373
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
376
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
374
377
  rekeyTo?: string | undefined;
375
378
  staticFee?: import("./amount").AlgoAmount | undefined;
376
379
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -389,7 +392,7 @@ export declare class AppFactory {
389
392
  lease?: string | Uint8Array | undefined;
390
393
  note?: string | Uint8Array | undefined;
391
394
  maxFee?: import("./amount").AlgoAmount | undefined;
392
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
395
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
393
396
  rekeyTo?: string | undefined;
394
397
  staticFee?: import("./amount").AlgoAmount | undefined;
395
398
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -406,13 +409,14 @@ export declare class AppFactory {
406
409
  args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
407
410
  } & {
408
411
  sender: string;
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
  lease?: string | Uint8Array | undefined;
412
416
  note?: string | Uint8Array | undefined;
413
417
  maxFee?: import("./amount").AlgoAmount | undefined;
414
418
  args?: Uint8Array[] | undefined;
415
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
419
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
416
420
  sender: string;
417
421
  rekeyTo?: string | undefined;
418
422
  staticFee?: import("./amount").AlgoAmount | undefined;
@@ -436,7 +440,7 @@ export declare class AppFactory {
436
440
  extraProgramPages?: number | undefined;
437
441
  }> | AppMethodCall<{
438
442
  sender: string;
439
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
443
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
440
444
  rekeyTo?: string | undefined;
441
445
  note?: string | Uint8Array | undefined;
442
446
  lease?: string | Uint8Array | undefined;
@@ -465,7 +469,7 @@ export declare class AppFactory {
465
469
  note?: string | Uint8Array | undefined;
466
470
  maxFee?: import("./amount").AlgoAmount | undefined;
467
471
  args?: Uint8Array[] | undefined;
468
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
472
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
469
473
  rekeyTo?: string | undefined;
470
474
  staticFee?: import("./amount").AlgoAmount | undefined;
471
475
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -494,17 +498,7 @@ export declare class AppFactory {
494
498
  extraProgramPages?: number | undefined;
495
499
  } | undefined) => Promise<{
496
500
  approvalProgram: Uint8Array;
497
- clearStateProgram: Uint8Array; /**
498
- * 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).
499
- *
500
- * **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`.
501
- *
502
- * **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.
503
- *
504
- * **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.
505
- * @param params The arguments to control the app deployment
506
- * @returns The app client and the result of the deployment
507
- */
501
+ clearStateProgram: Uint8Array;
508
502
  compiledApproval?: import("./app").CompiledTeal | undefined;
509
503
  compiledClear?: import("./app").CompiledTeal | undefined;
510
504
  deployTimeParams: TealTemplateParams | undefined;
@@ -522,7 +516,7 @@ export declare class AppFactory {
522
516
  note?: string | Uint8Array | undefined;
523
517
  maxFee?: import("./amount").AlgoAmount | undefined;
524
518
  args?: Uint8Array[] | undefined;
525
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
519
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
526
520
  rekeyTo?: string | undefined;
527
521
  staticFee?: import("./amount").AlgoAmount | undefined;
528
522
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -540,6 +534,7 @@ export declare class AppFactory {
540
534
  extraProgramPages?: number | undefined;
541
535
  } & {
542
536
  sender: string;
537
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
543
538
  onComplete: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC;
544
539
  }>;
545
540
  /** Return params for a deployment update bare call */
@@ -548,7 +543,7 @@ export declare class AppFactory {
548
543
  note?: string | Uint8Array | undefined;
549
544
  maxFee?: import("./amount").AlgoAmount | undefined;
550
545
  args?: Uint8Array[] | undefined;
551
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
546
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
552
547
  rekeyTo?: string | undefined;
553
548
  staticFee?: import("./amount").AlgoAmount | undefined;
554
549
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -565,7 +560,7 @@ export declare class AppFactory {
565
560
  note?: string | Uint8Array | undefined;
566
561
  maxFee?: import("./amount").AlgoAmount | undefined;
567
562
  args?: Uint8Array[] | undefined;
568
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
563
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
569
564
  rekeyTo?: string | undefined;
570
565
  staticFee?: import("./amount").AlgoAmount | undefined;
571
566
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -579,6 +574,7 @@ export declare class AppFactory {
579
574
  sender?: string | undefined;
580
575
  } & {
581
576
  sender: string;
577
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
582
578
  onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
583
579
  };
584
580
  /** Return params for a deployment delete bare call */
@@ -587,7 +583,7 @@ export declare class AppFactory {
587
583
  note?: string | Uint8Array | undefined;
588
584
  maxFee?: import("./amount").AlgoAmount | undefined;
589
585
  args?: Uint8Array[] | undefined;
590
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
586
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
591
587
  rekeyTo?: string | undefined;
592
588
  staticFee?: import("./amount").AlgoAmount | undefined;
593
589
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -604,7 +600,7 @@ export declare class AppFactory {
604
600
  note?: string | Uint8Array | undefined;
605
601
  maxFee?: import("./amount").AlgoAmount | undefined;
606
602
  args?: Uint8Array[] | undefined;
607
- signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
603
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
608
604
  rekeyTo?: string | undefined;
609
605
  staticFee?: import("./amount").AlgoAmount | undefined;
610
606
  extraFee?: import("./amount").AlgoAmount | undefined;
@@ -618,6 +614,7 @@ export declare class AppFactory {
618
614
  sender?: string | undefined;
619
615
  } & {
620
616
  sender: string;
617
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
621
618
  onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC;
622
619
  };
623
620
  };
@@ -842,6 +839,10 @@ export declare class AppFactory {
842
839
  /** Returns the sender for a call, using the `defaultSender`
843
840
  * if none provided and throws an error if neither provided */
844
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;
845
846
  /**
846
847
  * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
847
848
  * on the ARC-56 method.
@@ -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,
@@ -389,6 +391,12 @@ class AppFactory {
389
391
  }
390
392
  return sender ?? this._defaultSender;
391
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);
399
+ }
392
400
  /**
393
401
  * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
394
402
  * on the ARC-56 method.
@@ -1 +1 @@
1
- {"version":3,"file":"app-factory.js","sources":["../../src/types/app-factory.ts"],"sourcesContent":["import algosdk 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.SourceMap\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?: 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?: string\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 = 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?: 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?: 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 | undefined): string {\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 return sender ?? this._defaultSender!\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","getArc56ReturnValue","UPDATABLE_TEMPLATE_NAME","DELETABLE_TEMPLATE_NAME","getABITupleFromABIStruct","getABIDecodedValue"],"mappings":";;;;;;;AAuCA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS;AACpC,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,CAAC,UAAU;oBACtD,MAAM,gBAAgB,GAAG,MAAM,EAAE,gBAAgB,IAAI,IAAI,CAAC,iBAAiB;AAC3E,oBAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;oBAC/E,MAAM,MAAM,GAA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,MAAM,IAAI,KAAK,CAAC,CAAA,+EAAA,EAAkF,IAAI,CAAC,QAAQ,CAAE,CAAA,CAAC;;AAEpH,QAAA,OAAO,MAAM,IAAI,IAAI,CAAC,cAAe;;AAGvC;;;;;;;;;AASG;AACH,IAAA,MAAM,qBAAqB,CAGzB,MAAkC,EAAE,MAAmB,EAAA;AACvD,QAAA,MAAM,WAAW,GAAG,MAAM,MAAM;QAChC,OAAO,EAAE,GAAG,WAAW,EAAE,MAAM,EAAEJ,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 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.SourceMap\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?: 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?: string\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 = 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?: 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?: 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 | undefined): string {\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 return 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: 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","getArc56ReturnValue","UPDATABLE_TEMPLATE_NAME","DELETABLE_TEMPLATE_NAME","getABITupleFromABIStruct","getABIDecodedValue"],"mappings":";;;;;;;AAwCA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS;AACpC,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,YAA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,MAAM,WAAW,GAAG,MAAM,MAAM;QAChC,OAAO,EAAE,GAAG,WAAW,EAAE,MAAM,EAAEJ,kCAAmB,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;;AAE5G;;;;"}
@@ -345,6 +345,7 @@ class AppFactory {
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,
@@ -387,6 +389,12 @@ class AppFactory {
387
389
  }
388
390
  return sender ?? this._defaultSender;
389
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);
397
+ }
390
398
  /**
391
399
  * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
392
400
  * on the ARC-56 method.