@algorandfoundation/algokit-utils 7.0.0-beta.7 → 7.0.0-beta.9
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/package.json +1 -1
- package/types/app-client.d.ts +76 -100
- package/types/app-client.js +25 -5
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +25 -5
- package/types/app-client.mjs.map +1 -1
- package/types/app-factory.d.ts +27 -202
- package/types/app-factory.js +19 -2
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +19 -2
- package/types/app-factory.mjs.map +1 -1
- package/types/app.d.ts +1 -1
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/composer.d.ts +4 -1
- package/types/composer.js +19 -4
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +19 -4
- package/types/composer.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-utils",
|
|
9
|
-
"version": "7.0.0-beta.
|
|
9
|
+
"version": "7.0.0-beta.9",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
12
12
|
"author": "Algorand Foundation",
|
package/types/app-client.d.ts
CHANGED
|
@@ -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 { AlgoAmount } from './amount';
|
|
4
5
|
import { ABIAppCallArgs, ABIReturn, AppCallArgs, AppCallTransactionResult, AppCallType, AppCompilationResult, AppMetadata, AppReference, AppReturn, AppState, AppStorageSchema, BoxName, AppLookup as LegacyAppLookup, OnSchemaBreak, OnUpdate, RawAppCallArgs, SendAppTransactionResult, TealTemplateParams } from './app';
|
|
@@ -18,6 +19,7 @@ import Indexer = algosdk.Indexer;
|
|
|
18
19
|
import OnApplicationComplete = algosdk.OnApplicationComplete;
|
|
19
20
|
import SourceMap = algosdk.SourceMap;
|
|
20
21
|
import SuggestedParams = algosdk.SuggestedParams;
|
|
22
|
+
import TransactionSigner = algosdk.TransactionSigner;
|
|
21
23
|
/** Configuration to resolve app by creator and name `getCreatorAppsByName` */
|
|
22
24
|
export type ResolveAppByCreatorAndNameBase = {
|
|
23
25
|
/** The address of the app creator account to resolve the app by */
|
|
@@ -176,6 +178,17 @@ export interface SourceMapExport {
|
|
|
176
178
|
names: string[];
|
|
177
179
|
mappings: string;
|
|
178
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* The result of asking an `AppClient` to compile a program.
|
|
183
|
+
*
|
|
184
|
+
* Always contains the compiled bytecode, and may contain the result of compiling TEAL (including sourcemap) if it was available.
|
|
185
|
+
*/
|
|
186
|
+
export interface AppClientCompilationResult extends Partial<AppCompilationResult> {
|
|
187
|
+
/** The compiled bytecode of the approval program, ready to deploy to algod */
|
|
188
|
+
approvalProgram: Uint8Array;
|
|
189
|
+
/** The compiled bytecode of the clear state program, ready to deploy to algod */
|
|
190
|
+
clearStateProgram: Uint8Array;
|
|
191
|
+
}
|
|
179
192
|
/** Parameters to create an app client */
|
|
180
193
|
export interface AppClientParams {
|
|
181
194
|
/** The ID of the app instance this client should make calls against. */
|
|
@@ -195,6 +208,8 @@ export interface AppClientParams {
|
|
|
195
208
|
appName?: string;
|
|
196
209
|
/** Optional address to use for the account to use as the default sender for calls. */
|
|
197
210
|
defaultSender?: string;
|
|
211
|
+
/** Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from `AlgorandClient`). */
|
|
212
|
+
defaultSigner?: TransactionSigner;
|
|
198
213
|
/** Optional source map for the approval program */
|
|
199
214
|
approvalSourceMap?: SourceMap;
|
|
200
215
|
/** Optional source map for the clear state program */
|
|
@@ -258,6 +273,7 @@ export declare class AppClient {
|
|
|
258
273
|
private _appSpec;
|
|
259
274
|
private _algorand;
|
|
260
275
|
private _defaultSender?;
|
|
276
|
+
private _defaultSigner?;
|
|
261
277
|
private _approvalSourceMap;
|
|
262
278
|
private _clearSourceMap;
|
|
263
279
|
private _localStateMethods;
|
|
@@ -298,6 +314,8 @@ export declare class AppClient {
|
|
|
298
314
|
get appName(): string;
|
|
299
315
|
/** The ARC-56 app spec being used */
|
|
300
316
|
get appSpec(): Arc56Contract;
|
|
317
|
+
/** A reference to the underlying `AlgorandClient` this app client is using. */
|
|
318
|
+
get algorand(): AlgorandClientInterface;
|
|
301
319
|
/** Get parameters to create transactions for the current app.
|
|
302
320
|
*
|
|
303
321
|
* A good mental model for this is that these parameters represent a deferred transaction creation.
|
|
@@ -321,7 +339,7 @@ export declare class AppClient {
|
|
|
321
339
|
amount: AlgoAmount;
|
|
322
340
|
closeRemainderTo?: string | undefined;
|
|
323
341
|
maxFee?: AlgoAmount | undefined;
|
|
324
|
-
signer?: algosdk.TransactionSigner |
|
|
342
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
325
343
|
rekeyTo?: string | undefined;
|
|
326
344
|
staticFee?: AlgoAmount | undefined;
|
|
327
345
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -334,13 +352,13 @@ export declare class AppClient {
|
|
|
334
352
|
sender?: string | undefined;
|
|
335
353
|
}) => {
|
|
336
354
|
sender: string;
|
|
355
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
337
356
|
receiver: string;
|
|
338
357
|
lease?: string | Uint8Array | undefined;
|
|
339
358
|
note?: string | Uint8Array | undefined;
|
|
340
359
|
amount: AlgoAmount;
|
|
341
360
|
closeRemainderTo?: string | undefined;
|
|
342
361
|
maxFee?: AlgoAmount | undefined;
|
|
343
|
-
signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
|
|
344
362
|
rekeyTo?: string | undefined;
|
|
345
363
|
staticFee?: AlgoAmount | undefined;
|
|
346
364
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -356,30 +374,7 @@ export declare class AppClient {
|
|
|
356
374
|
lease?: string | Uint8Array | undefined;
|
|
357
375
|
note?: string | Uint8Array | undefined;
|
|
358
376
|
maxFee?: AlgoAmount | undefined;
|
|
359
|
-
signer?: algosdk.TransactionSigner |
|
|
360
|
-
rekeyTo?: string | undefined;
|
|
361
|
-
staticFee?: AlgoAmount | undefined;
|
|
362
|
-
extraFee?: AlgoAmount | undefined;
|
|
363
|
-
validityWindow?: number | undefined;
|
|
364
|
-
firstValidRound?: bigint | undefined;
|
|
365
|
-
lastValidRound?: bigint | undefined;
|
|
366
|
-
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
367
|
-
accountReferences?: string[] | undefined;
|
|
368
|
-
appReferences?: bigint[] | undefined;
|
|
369
|
-
assetReferences?: bigint[] | undefined;
|
|
370
|
-
boxReferences?: (BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
371
|
-
sender?: string | undefined;
|
|
372
|
-
method: string;
|
|
373
|
-
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
374
|
-
} & AppClientCompilationParams) => Promise<({
|
|
375
|
-
approvalProgram: Uint8Array;
|
|
376
|
-
compiledApproval: undefined;
|
|
377
|
-
clearStateProgram: Uint8Array;
|
|
378
|
-
compiledClear: undefined;
|
|
379
|
-
lease?: string | Uint8Array | undefined;
|
|
380
|
-
note?: string | Uint8Array | undefined;
|
|
381
|
-
maxFee?: AlgoAmount | undefined;
|
|
382
|
-
signer?: algosdk.TransactionSigner | import("./account").TransactionSignerAccount | undefined;
|
|
377
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
383
378
|
rekeyTo?: string | undefined;
|
|
384
379
|
staticFee?: AlgoAmount | undefined;
|
|
385
380
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -394,21 +389,17 @@ export declare class AppClient {
|
|
|
394
389
|
sender?: string | undefined;
|
|
395
390
|
method: string;
|
|
396
391
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
/** Whether or not the contract should have deploy-time immutability control set, undefined = ignore */
|
|
400
|
-
updatable?: boolean | undefined;
|
|
401
|
-
/** Whether or not the contract should have deploy-time permanence control set, undefined = ignore */
|
|
402
|
-
deletable?: boolean | undefined;
|
|
403
|
-
} | {
|
|
392
|
+
} & AppClientCompilationParams) => Promise<{
|
|
393
|
+
/** The compiled bytecode of the approval program, ready to deploy to algod */
|
|
404
394
|
approvalProgram: Uint8Array;
|
|
405
|
-
|
|
395
|
+
/** The compiled bytecode of the clear state program, ready to deploy to algod */
|
|
406
396
|
clearStateProgram: Uint8Array;
|
|
407
|
-
|
|
397
|
+
compiledApproval?: import("./app").CompiledTeal | undefined;
|
|
398
|
+
compiledClear?: import("./app").CompiledTeal | undefined;
|
|
408
399
|
lease?: string | Uint8Array | undefined;
|
|
409
400
|
note?: string | Uint8Array | undefined;
|
|
410
401
|
maxFee?: AlgoAmount | undefined;
|
|
411
|
-
signer?: algosdk.TransactionSigner |
|
|
402
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
412
403
|
rekeyTo?: string | undefined;
|
|
413
404
|
staticFee?: AlgoAmount | undefined;
|
|
414
405
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -429,9 +420,10 @@ export declare class AppClient {
|
|
|
429
420
|
updatable?: boolean | undefined;
|
|
430
421
|
/** Whether or not the contract should have deploy-time permanence control set, undefined = ignore */
|
|
431
422
|
deletable?: boolean | undefined;
|
|
432
|
-
}
|
|
423
|
+
} & {
|
|
433
424
|
appId: bigint;
|
|
434
425
|
sender: string;
|
|
426
|
+
signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
435
427
|
method: Arc56Method;
|
|
436
428
|
onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
|
|
437
429
|
args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
|
|
@@ -439,7 +431,7 @@ export declare class AppClient {
|
|
|
439
431
|
note?: string | Uint8Array | undefined;
|
|
440
432
|
maxFee?: AlgoAmount | undefined;
|
|
441
433
|
args?: Uint8Array[] | undefined;
|
|
442
|
-
signer?: algosdk.TransactionSigner |
|
|
434
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
443
435
|
sender: string;
|
|
444
436
|
rekeyTo?: string | undefined;
|
|
445
437
|
staticFee?: AlgoAmount | undefined;
|
|
@@ -463,7 +455,7 @@ export declare class AppClient {
|
|
|
463
455
|
extraProgramPages?: number | undefined;
|
|
464
456
|
}> | AppMethodCall<{
|
|
465
457
|
sender: string;
|
|
466
|
-
signer?: algosdk.TransactionSigner |
|
|
458
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
467
459
|
rekeyTo?: string | undefined;
|
|
468
460
|
note?: string | Uint8Array | undefined;
|
|
469
461
|
lease?: string | Uint8Array | undefined;
|
|
@@ -489,7 +481,7 @@ export declare class AppClient {
|
|
|
489
481
|
lease?: string | Uint8Array | undefined;
|
|
490
482
|
note?: string | Uint8Array | undefined;
|
|
491
483
|
maxFee?: AlgoAmount | undefined;
|
|
492
|
-
signer?: algosdk.TransactionSigner |
|
|
484
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
493
485
|
rekeyTo?: string | undefined;
|
|
494
486
|
staticFee?: AlgoAmount | undefined;
|
|
495
487
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -510,7 +502,7 @@ export declare class AppClient {
|
|
|
510
502
|
lease?: string | Uint8Array | undefined;
|
|
511
503
|
note?: string | Uint8Array | undefined;
|
|
512
504
|
maxFee?: AlgoAmount | undefined;
|
|
513
|
-
signer?: algosdk.TransactionSigner |
|
|
505
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
514
506
|
rekeyTo?: string | undefined;
|
|
515
507
|
staticFee?: AlgoAmount | undefined;
|
|
516
508
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -531,7 +523,7 @@ export declare class AppClient {
|
|
|
531
523
|
lease?: string | Uint8Array | undefined;
|
|
532
524
|
note?: string | Uint8Array | undefined;
|
|
533
525
|
maxFee?: AlgoAmount | undefined;
|
|
534
|
-
signer?: algosdk.TransactionSigner |
|
|
526
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
535
527
|
rekeyTo?: string | undefined;
|
|
536
528
|
staticFee?: AlgoAmount | undefined;
|
|
537
529
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -552,7 +544,7 @@ export declare class AppClient {
|
|
|
552
544
|
lease?: string | Uint8Array | undefined;
|
|
553
545
|
note?: string | Uint8Array | undefined;
|
|
554
546
|
maxFee?: AlgoAmount | undefined;
|
|
555
|
-
signer?: algosdk.TransactionSigner |
|
|
547
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
556
548
|
rekeyTo?: string | undefined;
|
|
557
549
|
staticFee?: AlgoAmount | undefined;
|
|
558
550
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -576,7 +568,7 @@ export declare class AppClient {
|
|
|
576
568
|
note?: string | Uint8Array | undefined;
|
|
577
569
|
maxFee?: AlgoAmount | undefined;
|
|
578
570
|
args?: Uint8Array[] | undefined;
|
|
579
|
-
signer?: algosdk.TransactionSigner |
|
|
571
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
580
572
|
rekeyTo?: string | undefined;
|
|
581
573
|
staticFee?: AlgoAmount | undefined;
|
|
582
574
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -590,7 +582,7 @@ export declare class AppClient {
|
|
|
590
582
|
sender?: string | undefined;
|
|
591
583
|
} & AppClientCompilationParams) | undefined) => Promise<{
|
|
592
584
|
sender: string;
|
|
593
|
-
signer?: algosdk.TransactionSigner |
|
|
585
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
594
586
|
rekeyTo?: string | undefined;
|
|
595
587
|
note?: string | Uint8Array | undefined;
|
|
596
588
|
lease?: string | Uint8Array | undefined;
|
|
@@ -616,7 +608,7 @@ export declare class AppClient {
|
|
|
616
608
|
note?: string | Uint8Array | undefined;
|
|
617
609
|
maxFee?: AlgoAmount | undefined;
|
|
618
610
|
args?: Uint8Array[] | undefined;
|
|
619
|
-
signer?: algosdk.TransactionSigner |
|
|
611
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
620
612
|
rekeyTo?: string | undefined;
|
|
621
613
|
staticFee?: AlgoAmount | undefined;
|
|
622
614
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -635,7 +627,7 @@ export declare class AppClient {
|
|
|
635
627
|
note?: string | Uint8Array | undefined;
|
|
636
628
|
maxFee?: AlgoAmount | undefined;
|
|
637
629
|
args?: Uint8Array[] | undefined;
|
|
638
|
-
signer?: algosdk.TransactionSigner |
|
|
630
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
639
631
|
rekeyTo?: string | undefined;
|
|
640
632
|
staticFee?: AlgoAmount | undefined;
|
|
641
633
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -654,7 +646,7 @@ export declare class AppClient {
|
|
|
654
646
|
note?: string | Uint8Array | undefined;
|
|
655
647
|
maxFee?: AlgoAmount | undefined;
|
|
656
648
|
args?: Uint8Array[] | undefined;
|
|
657
|
-
signer?: algosdk.TransactionSigner |
|
|
649
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
658
650
|
rekeyTo?: string | undefined;
|
|
659
651
|
staticFee?: AlgoAmount | undefined;
|
|
660
652
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -673,7 +665,7 @@ export declare class AppClient {
|
|
|
673
665
|
note?: string | Uint8Array | undefined;
|
|
674
666
|
maxFee?: AlgoAmount | undefined;
|
|
675
667
|
args?: Uint8Array[] | undefined;
|
|
676
|
-
signer?: algosdk.TransactionSigner |
|
|
668
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
677
669
|
rekeyTo?: string | undefined;
|
|
678
670
|
staticFee?: AlgoAmount | undefined;
|
|
679
671
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -692,7 +684,7 @@ export declare class AppClient {
|
|
|
692
684
|
note?: string | Uint8Array | undefined;
|
|
693
685
|
maxFee?: AlgoAmount | undefined;
|
|
694
686
|
args?: Uint8Array[] | undefined;
|
|
695
|
-
signer?: algosdk.TransactionSigner |
|
|
687
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
696
688
|
rekeyTo?: string | undefined;
|
|
697
689
|
staticFee?: AlgoAmount | undefined;
|
|
698
690
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -716,7 +708,7 @@ export declare class AppClient {
|
|
|
716
708
|
amount: AlgoAmount;
|
|
717
709
|
closeRemainderTo?: string | undefined;
|
|
718
710
|
maxFee?: AlgoAmount | undefined;
|
|
719
|
-
signer?: algosdk.TransactionSigner |
|
|
711
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
720
712
|
rekeyTo?: string | undefined;
|
|
721
713
|
staticFee?: AlgoAmount | undefined;
|
|
722
714
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -735,7 +727,7 @@ export declare class AppClient {
|
|
|
735
727
|
lease?: string | Uint8Array | undefined;
|
|
736
728
|
note?: string | Uint8Array | undefined;
|
|
737
729
|
maxFee?: AlgoAmount | undefined;
|
|
738
|
-
signer?: algosdk.TransactionSigner |
|
|
730
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
739
731
|
rekeyTo?: string | undefined;
|
|
740
732
|
staticFee?: AlgoAmount | undefined;
|
|
741
733
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -762,7 +754,7 @@ export declare class AppClient {
|
|
|
762
754
|
lease?: string | Uint8Array | undefined;
|
|
763
755
|
note?: string | Uint8Array | undefined;
|
|
764
756
|
maxFee?: AlgoAmount | undefined;
|
|
765
|
-
signer?: algosdk.TransactionSigner |
|
|
757
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
766
758
|
rekeyTo?: string | undefined;
|
|
767
759
|
staticFee?: AlgoAmount | undefined;
|
|
768
760
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -789,7 +781,7 @@ export declare class AppClient {
|
|
|
789
781
|
lease?: string | Uint8Array | undefined;
|
|
790
782
|
note?: string | Uint8Array | undefined;
|
|
791
783
|
maxFee?: AlgoAmount | undefined;
|
|
792
|
-
signer?: algosdk.TransactionSigner |
|
|
784
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
793
785
|
rekeyTo?: string | undefined;
|
|
794
786
|
staticFee?: AlgoAmount | undefined;
|
|
795
787
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -816,7 +808,7 @@ export declare class AppClient {
|
|
|
816
808
|
lease?: string | Uint8Array | undefined;
|
|
817
809
|
note?: string | Uint8Array | undefined;
|
|
818
810
|
maxFee?: AlgoAmount | undefined;
|
|
819
|
-
signer?: algosdk.TransactionSigner |
|
|
811
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
820
812
|
rekeyTo?: string | undefined;
|
|
821
813
|
staticFee?: AlgoAmount | undefined;
|
|
822
814
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -843,7 +835,7 @@ export declare class AppClient {
|
|
|
843
835
|
lease?: string | Uint8Array | undefined;
|
|
844
836
|
note?: string | Uint8Array | undefined;
|
|
845
837
|
maxFee?: AlgoAmount | undefined;
|
|
846
|
-
signer?: algosdk.TransactionSigner |
|
|
838
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
847
839
|
rekeyTo?: string | undefined;
|
|
848
840
|
staticFee?: AlgoAmount | undefined;
|
|
849
841
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -871,7 +863,7 @@ export declare class AppClient {
|
|
|
871
863
|
note?: string | Uint8Array | undefined;
|
|
872
864
|
maxFee?: AlgoAmount | undefined;
|
|
873
865
|
args?: Uint8Array[] | undefined;
|
|
874
|
-
signer?: algosdk.TransactionSigner |
|
|
866
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
875
867
|
rekeyTo?: string | undefined;
|
|
876
868
|
staticFee?: AlgoAmount | undefined;
|
|
877
869
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -890,7 +882,7 @@ export declare class AppClient {
|
|
|
890
882
|
note?: string | Uint8Array | undefined;
|
|
891
883
|
maxFee?: AlgoAmount | undefined;
|
|
892
884
|
args?: Uint8Array[] | undefined;
|
|
893
|
-
signer?: algosdk.TransactionSigner |
|
|
885
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
894
886
|
rekeyTo?: string | undefined;
|
|
895
887
|
staticFee?: AlgoAmount | undefined;
|
|
896
888
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -909,7 +901,7 @@ export declare class AppClient {
|
|
|
909
901
|
note?: string | Uint8Array | undefined;
|
|
910
902
|
maxFee?: AlgoAmount | undefined;
|
|
911
903
|
args?: Uint8Array[] | undefined;
|
|
912
|
-
signer?: algosdk.TransactionSigner |
|
|
904
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
913
905
|
rekeyTo?: string | undefined;
|
|
914
906
|
staticFee?: AlgoAmount | undefined;
|
|
915
907
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -928,7 +920,7 @@ export declare class AppClient {
|
|
|
928
920
|
note?: string | Uint8Array | undefined;
|
|
929
921
|
maxFee?: AlgoAmount | undefined;
|
|
930
922
|
args?: Uint8Array[] | undefined;
|
|
931
|
-
signer?: algosdk.TransactionSigner |
|
|
923
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
932
924
|
rekeyTo?: string | undefined;
|
|
933
925
|
staticFee?: AlgoAmount | undefined;
|
|
934
926
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -947,7 +939,7 @@ export declare class AppClient {
|
|
|
947
939
|
note?: string | Uint8Array | undefined;
|
|
948
940
|
maxFee?: AlgoAmount | undefined;
|
|
949
941
|
args?: Uint8Array[] | undefined;
|
|
950
|
-
signer?: algosdk.TransactionSigner |
|
|
942
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
951
943
|
rekeyTo?: string | undefined;
|
|
952
944
|
staticFee?: AlgoAmount | undefined;
|
|
953
945
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -966,7 +958,7 @@ export declare class AppClient {
|
|
|
966
958
|
note?: string | Uint8Array | undefined;
|
|
967
959
|
maxFee?: AlgoAmount | undefined;
|
|
968
960
|
args?: Uint8Array[] | undefined;
|
|
969
|
-
signer?: algosdk.TransactionSigner |
|
|
961
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
970
962
|
rekeyTo?: string | undefined;
|
|
971
963
|
staticFee?: AlgoAmount | undefined;
|
|
972
964
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -990,7 +982,7 @@ export declare class AppClient {
|
|
|
990
982
|
amount: AlgoAmount;
|
|
991
983
|
closeRemainderTo?: string | undefined;
|
|
992
984
|
maxFee?: AlgoAmount | undefined;
|
|
993
|
-
signer?: algosdk.TransactionSigner |
|
|
985
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
994
986
|
rekeyTo?: string | undefined;
|
|
995
987
|
staticFee?: AlgoAmount | undefined;
|
|
996
988
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1017,7 +1009,7 @@ export declare class AppClient {
|
|
|
1017
1009
|
lease?: string | Uint8Array | undefined;
|
|
1018
1010
|
note?: string | Uint8Array | undefined;
|
|
1019
1011
|
maxFee?: AlgoAmount | undefined;
|
|
1020
|
-
signer?: algosdk.TransactionSigner |
|
|
1012
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1021
1013
|
rekeyTo?: string | undefined;
|
|
1022
1014
|
staticFee?: AlgoAmount | undefined;
|
|
1023
1015
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1051,7 +1043,7 @@ export declare class AppClient {
|
|
|
1051
1043
|
lease?: string | Uint8Array | undefined;
|
|
1052
1044
|
note?: string | Uint8Array | undefined;
|
|
1053
1045
|
maxFee?: AlgoAmount | undefined;
|
|
1054
|
-
signer?: algosdk.TransactionSigner |
|
|
1046
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1055
1047
|
rekeyTo?: string | undefined;
|
|
1056
1048
|
staticFee?: AlgoAmount | undefined;
|
|
1057
1049
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1083,7 +1075,7 @@ export declare class AppClient {
|
|
|
1083
1075
|
lease?: string | Uint8Array | undefined;
|
|
1084
1076
|
note?: string | Uint8Array | undefined;
|
|
1085
1077
|
maxFee?: AlgoAmount | undefined;
|
|
1086
|
-
signer?: algosdk.TransactionSigner |
|
|
1078
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1087
1079
|
rekeyTo?: string | undefined;
|
|
1088
1080
|
staticFee?: AlgoAmount | undefined;
|
|
1089
1081
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1115,7 +1107,7 @@ export declare class AppClient {
|
|
|
1115
1107
|
lease?: string | Uint8Array | undefined;
|
|
1116
1108
|
note?: string | Uint8Array | undefined;
|
|
1117
1109
|
maxFee?: AlgoAmount | undefined;
|
|
1118
|
-
signer?: algosdk.TransactionSigner |
|
|
1110
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1119
1111
|
rekeyTo?: string | undefined;
|
|
1120
1112
|
staticFee?: AlgoAmount | undefined;
|
|
1121
1113
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1147,7 +1139,7 @@ export declare class AppClient {
|
|
|
1147
1139
|
lease?: string | Uint8Array | undefined;
|
|
1148
1140
|
note?: string | Uint8Array | undefined;
|
|
1149
1141
|
maxFee?: AlgoAmount | undefined;
|
|
1150
|
-
signer?: algosdk.TransactionSigner |
|
|
1142
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1151
1143
|
rekeyTo?: string | undefined;
|
|
1152
1144
|
staticFee?: AlgoAmount | undefined;
|
|
1153
1145
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1180,7 +1172,7 @@ export declare class AppClient {
|
|
|
1180
1172
|
note?: string | Uint8Array | undefined;
|
|
1181
1173
|
maxFee?: AlgoAmount | undefined;
|
|
1182
1174
|
args?: Uint8Array[] | undefined;
|
|
1183
|
-
signer?: algosdk.TransactionSigner |
|
|
1175
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1184
1176
|
rekeyTo?: string | undefined;
|
|
1185
1177
|
staticFee?: AlgoAmount | undefined;
|
|
1186
1178
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1193,6 +1185,8 @@ export declare class AppClient {
|
|
|
1193
1185
|
boxReferences?: (BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
1194
1186
|
sender?: string | undefined;
|
|
1195
1187
|
} & AppClientCompilationParams & SendParams) | undefined) => Promise<{
|
|
1188
|
+
compiledApproval?: import("./app").CompiledTeal | undefined;
|
|
1189
|
+
compiledClear?: import("./app").CompiledTeal | undefined;
|
|
1196
1190
|
groupId: string;
|
|
1197
1191
|
txIds: string[];
|
|
1198
1192
|
returns?: ABIReturn[] | undefined;
|
|
@@ -1201,8 +1195,6 @@ export declare class AppClient {
|
|
|
1201
1195
|
confirmation: algosdk.modelsv2.PendingTransactionResponse;
|
|
1202
1196
|
transaction: algosdk.Transaction;
|
|
1203
1197
|
return?: ABIReturn | undefined;
|
|
1204
|
-
compiledApproval?: import("./app").CompiledTeal | undefined;
|
|
1205
|
-
compiledClear?: import("./app").CompiledTeal | undefined;
|
|
1206
1198
|
}>;
|
|
1207
1199
|
/** Signs and sends an opt-in call */
|
|
1208
1200
|
optIn: (params?: ({
|
|
@@ -1210,7 +1202,7 @@ export declare class AppClient {
|
|
|
1210
1202
|
note?: string | Uint8Array | undefined;
|
|
1211
1203
|
maxFee?: AlgoAmount | undefined;
|
|
1212
1204
|
args?: Uint8Array[] | undefined;
|
|
1213
|
-
signer?: algosdk.TransactionSigner |
|
|
1205
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1214
1206
|
rekeyTo?: string | undefined;
|
|
1215
1207
|
staticFee?: AlgoAmount | undefined;
|
|
1216
1208
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1238,7 +1230,7 @@ export declare class AppClient {
|
|
|
1238
1230
|
note?: string | Uint8Array | undefined;
|
|
1239
1231
|
maxFee?: AlgoAmount | undefined;
|
|
1240
1232
|
args?: Uint8Array[] | undefined;
|
|
1241
|
-
signer?: algosdk.TransactionSigner |
|
|
1233
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1242
1234
|
rekeyTo?: string | undefined;
|
|
1243
1235
|
staticFee?: AlgoAmount | undefined;
|
|
1244
1236
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1266,7 +1258,7 @@ export declare class AppClient {
|
|
|
1266
1258
|
note?: string | Uint8Array | undefined;
|
|
1267
1259
|
maxFee?: AlgoAmount | undefined;
|
|
1268
1260
|
args?: Uint8Array[] | undefined;
|
|
1269
|
-
signer?: algosdk.TransactionSigner |
|
|
1261
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1270
1262
|
rekeyTo?: string | undefined;
|
|
1271
1263
|
staticFee?: AlgoAmount | undefined;
|
|
1272
1264
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1294,7 +1286,7 @@ export declare class AppClient {
|
|
|
1294
1286
|
note?: string | Uint8Array | undefined;
|
|
1295
1287
|
maxFee?: AlgoAmount | undefined;
|
|
1296
1288
|
args?: Uint8Array[] | undefined;
|
|
1297
|
-
signer?: algosdk.TransactionSigner |
|
|
1289
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1298
1290
|
rekeyTo?: string | undefined;
|
|
1299
1291
|
staticFee?: AlgoAmount | undefined;
|
|
1300
1292
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1322,7 +1314,7 @@ export declare class AppClient {
|
|
|
1322
1314
|
note?: string | Uint8Array | undefined;
|
|
1323
1315
|
maxFee?: AlgoAmount | undefined;
|
|
1324
1316
|
args?: Uint8Array[] | undefined;
|
|
1325
|
-
signer?: algosdk.TransactionSigner |
|
|
1317
|
+
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
1326
1318
|
rekeyTo?: string | undefined;
|
|
1327
1319
|
staticFee?: AlgoAmount | undefined;
|
|
1328
1320
|
extraFee?: AlgoAmount | undefined;
|
|
@@ -1557,17 +1549,7 @@ export declare class AppClient {
|
|
|
1557
1549
|
*
|
|
1558
1550
|
* Will store any generated source maps for later use in debugging.
|
|
1559
1551
|
*/
|
|
1560
|
-
compile(compilation?: AppClientCompilationParams): Promise<
|
|
1561
|
-
approvalProgram: Uint8Array;
|
|
1562
|
-
compiledApproval: undefined;
|
|
1563
|
-
clearStateProgram: Uint8Array;
|
|
1564
|
-
compiledClear: undefined;
|
|
1565
|
-
} | {
|
|
1566
|
-
approvalProgram: Uint8Array;
|
|
1567
|
-
compiledApproval: import("./app").CompiledTeal;
|
|
1568
|
-
clearStateProgram: Uint8Array;
|
|
1569
|
-
compiledClear: import("./app").CompiledTeal;
|
|
1570
|
-
}>;
|
|
1552
|
+
compile(compilation?: AppClientCompilationParams): Promise<AppClientCompilationResult>;
|
|
1571
1553
|
/**
|
|
1572
1554
|
* Takes an error that may include a logic error from a call to the current app and re-exposes the
|
|
1573
1555
|
* error to include source code information via the source map and ARC-56 spec.
|
|
@@ -1592,17 +1574,7 @@ export declare class AppClient {
|
|
|
1592
1574
|
* @param appSpec The app spec for the app
|
|
1593
1575
|
* @param compilation Any compilation parameters to use
|
|
1594
1576
|
*/
|
|
1595
|
-
static compile(appSpec: Arc56Contract, appManager: AppManager, compilation?: AppClientCompilationParams): Promise<
|
|
1596
|
-
approvalProgram: Uint8Array;
|
|
1597
|
-
compiledApproval: undefined;
|
|
1598
|
-
clearStateProgram: Uint8Array;
|
|
1599
|
-
compiledClear: undefined;
|
|
1600
|
-
} | {
|
|
1601
|
-
approvalProgram: Uint8Array;
|
|
1602
|
-
compiledApproval: import("./app").CompiledTeal;
|
|
1603
|
-
clearStateProgram: Uint8Array;
|
|
1604
|
-
compiledClear: import("./app").CompiledTeal;
|
|
1605
|
-
}>;
|
|
1577
|
+
static compile(appSpec: Arc56Contract, appManager: AppManager, compilation?: AppClientCompilationParams): Promise<AppClientCompilationResult>;
|
|
1606
1578
|
/**
|
|
1607
1579
|
* Returns ABI method arguments ready for a method call params object with default values populated
|
|
1608
1580
|
* and structs replaced with tuples.
|
|
@@ -1619,9 +1591,13 @@ export declare class AppClient {
|
|
|
1619
1591
|
private getMethodCallParamsMethods;
|
|
1620
1592
|
private getMethodCallSendMethods;
|
|
1621
1593
|
private getMethodCallCreateTransactionMethods;
|
|
1622
|
-
/** Returns the sender for a call, using the `defaultSender`
|
|
1594
|
+
/** Returns the sender for a call, using the provided sender or using the `defaultSender`
|
|
1623
1595
|
* if none provided and throws an error if neither provided */
|
|
1624
1596
|
private getSender;
|
|
1597
|
+
/** Returns the signer for a call, using the provided signer or the `defaultSigner`
|
|
1598
|
+
* if no signer was provided and the call will use default sender
|
|
1599
|
+
* or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
|
|
1600
|
+
private getSigner;
|
|
1625
1601
|
private getBareParams;
|
|
1626
1602
|
private getABIParams;
|
|
1627
1603
|
/** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */
|
|
@@ -1735,7 +1711,7 @@ export declare class ApplicationClient {
|
|
|
1735
1711
|
updatable?: boolean | undefined;
|
|
1736
1712
|
return?: ABIReturn | undefined;
|
|
1737
1713
|
deleteReturn?: ABIReturn | undefined;
|
|
1738
|
-
deleteResult: import("./transaction").ConfirmedTransactionResult;
|
|
1714
|
+
deleteResult: import("./transaction").ConfirmedTransactionResult; /** The optional name override to resolve the app by within the creator account (default: uses the name in the ABI contract) */
|
|
1739
1715
|
operationPerformed: "replace";
|
|
1740
1716
|
}>;
|
|
1741
1717
|
/**
|
package/types/app-client.js
CHANGED
|
@@ -52,6 +52,7 @@ class AppClient {
|
|
|
52
52
|
this._appName = params.appName ?? this._appSpec.name;
|
|
53
53
|
this._algorand = params.algorand;
|
|
54
54
|
this._defaultSender = params.defaultSender;
|
|
55
|
+
this._defaultSigner = params.defaultSigner;
|
|
55
56
|
this._approvalSourceMap = params.approvalSourceMap;
|
|
56
57
|
this._clearSourceMap = params.clearSourceMap;
|
|
57
58
|
this._localStateMethods = (address) => this.getStateMethods(() => this.getLocalState(address), () => this._appSpec.state.keys.local, () => this._appSpec.state.maps.local);
|
|
@@ -147,6 +148,10 @@ class AppClient {
|
|
|
147
148
|
get appSpec() {
|
|
148
149
|
return this._appSpec;
|
|
149
150
|
}
|
|
151
|
+
/** A reference to the underlying `AlgorandClient` this app client is using. */
|
|
152
|
+
get algorand() {
|
|
153
|
+
return this._algorand;
|
|
154
|
+
}
|
|
150
155
|
/** Get parameters to create transactions for the current app.
|
|
151
156
|
*
|
|
152
157
|
* A good mental model for this is that these parameters represent a deferred transaction creation.
|
|
@@ -396,9 +401,7 @@ class AppClient {
|
|
|
396
401
|
}
|
|
397
402
|
return {
|
|
398
403
|
approvalProgram: buffer.Buffer.from(appSpec.byteCode.approval, 'base64'),
|
|
399
|
-
compiledApproval: undefined,
|
|
400
404
|
clearStateProgram: buffer.Buffer.from(appSpec.byteCode.clear, 'base64'),
|
|
401
|
-
compiledClear: undefined,
|
|
402
405
|
};
|
|
403
406
|
}
|
|
404
407
|
const approvalTemplate = buffer.Buffer.from(appSpec.source.approval, 'base64').toString('utf-8');
|
|
@@ -542,7 +545,11 @@ class AppClient {
|
|
|
542
545
|
return {
|
|
543
546
|
/** Signs and sends an update call, including deploy-time TEAL template replacements and compilation if provided */
|
|
544
547
|
update: async (params) => {
|
|
545
|
-
|
|
548
|
+
const compiled = await this.compile(params);
|
|
549
|
+
return {
|
|
550
|
+
...(await this.handleCallErrors(async () => this._algorand.send.appUpdate(await this.params.bare.update(params)))),
|
|
551
|
+
...compiled,
|
|
552
|
+
};
|
|
546
553
|
},
|
|
547
554
|
/** Signs and sends an opt-in call */
|
|
548
555
|
optIn: (params) => {
|
|
@@ -573,6 +580,7 @@ class AppClient {
|
|
|
573
580
|
return {
|
|
574
581
|
...params,
|
|
575
582
|
sender: this.getSender(params.sender),
|
|
583
|
+
signer: this.getSigner(params.sender, params.signer),
|
|
576
584
|
receiver: this.appAddress,
|
|
577
585
|
};
|
|
578
586
|
},
|
|
@@ -645,7 +653,11 @@ class AppClient {
|
|
|
645
653
|
const result = await this._algorand
|
|
646
654
|
.newGroup()
|
|
647
655
|
.addAppCallMethodCall(await this.params.call(params))
|
|
648
|
-
.simulate(
|
|
656
|
+
.simulate({
|
|
657
|
+
allowUnnamedResources: params.populateAppCallResources,
|
|
658
|
+
// Simulate calls for a readonly method shouldn't invoke signing
|
|
659
|
+
skipSignatures: true,
|
|
660
|
+
});
|
|
649
661
|
return this.processMethodCallReturn({
|
|
650
662
|
...result,
|
|
651
663
|
transaction: result.transactions.at(-1),
|
|
@@ -696,7 +708,7 @@ class AppClient {
|
|
|
696
708
|
},
|
|
697
709
|
};
|
|
698
710
|
}
|
|
699
|
-
/** Returns the sender for a call, using the `defaultSender`
|
|
711
|
+
/** Returns the sender for a call, using the provided sender or using the `defaultSender`
|
|
700
712
|
* if none provided and throws an error if neither provided */
|
|
701
713
|
getSender(sender) {
|
|
702
714
|
if (!sender && !this._defaultSender) {
|
|
@@ -704,11 +716,18 @@ class AppClient {
|
|
|
704
716
|
}
|
|
705
717
|
return sender ?? this._defaultSender;
|
|
706
718
|
}
|
|
719
|
+
/** Returns the signer for a call, using the provided signer or the `defaultSigner`
|
|
720
|
+
* if no signer was provided and the call will use default sender
|
|
721
|
+
* or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
|
|
722
|
+
getSigner(sender, signer) {
|
|
723
|
+
return signer ?? (!sender ? this._defaultSigner : undefined);
|
|
724
|
+
}
|
|
707
725
|
getBareParams(params, onComplete) {
|
|
708
726
|
return {
|
|
709
727
|
...params,
|
|
710
728
|
appId: this._appId,
|
|
711
729
|
sender: this.getSender(params?.sender),
|
|
730
|
+
signer: this.getSigner(params?.sender, params?.signer),
|
|
712
731
|
onComplete,
|
|
713
732
|
};
|
|
714
733
|
}
|
|
@@ -720,6 +739,7 @@ class AppClient {
|
|
|
720
739
|
...params,
|
|
721
740
|
appId: this._appId,
|
|
722
741
|
sender: sender,
|
|
742
|
+
signer: this.getSigner(params.sender, params.signer),
|
|
723
743
|
method,
|
|
724
744
|
onComplete,
|
|
725
745
|
args,
|