@algorandfoundation/algokit-utils 10.0.0-alpha.41 → 10.0.0-alpha.42

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.
@@ -349,6 +349,7 @@ declare class AlgorandClientTransactionCreator {
349
349
  */
350
350
  appCreate: (params: {
351
351
  sender: SendingAddress;
352
+ args?: Uint8Array[] | undefined;
352
353
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
353
354
  rekeyTo?: ReadableAddress | undefined;
354
355
  note?: (Uint8Array | string) | undefined;
@@ -360,7 +361,6 @@ declare class AlgorandClientTransactionCreator {
360
361
  firstValidRound?: bigint | undefined;
361
362
  lastValidRound?: bigint | undefined;
362
363
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
363
- args?: Uint8Array[] | undefined;
364
364
  accountReferences?: ReadableAddress[] | undefined;
365
365
  appReferences?: bigint[] | undefined;
366
366
  assetReferences?: bigint[] | undefined;
@@ -568,6 +568,7 @@ declare class AlgorandClientTransactionCreator {
568
568
  * @returns The application ABI method create transaction
569
569
  */
570
570
  appCreateMethodCall: (params: {
571
+ appId?: 0 | undefined;
571
572
  sender: SendingAddress;
572
573
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
573
574
  rekeyTo?: ReadableAddress | undefined;
@@ -579,7 +580,6 @@ declare class AlgorandClientTransactionCreator {
579
580
  validityWindow?: number | bigint | undefined;
580
581
  firstValidRound?: bigint | undefined;
581
582
  lastValidRound?: bigint | undefined;
582
- appId?: 0 | undefined;
583
583
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
584
584
  accountReferences?: ReadableAddress[] | undefined;
585
585
  appReferences?: bigint[] | undefined;
@@ -649,6 +649,7 @@ declare class AlgorandClientTransactionCreator {
649
649
  * @returns The application ABI method update transaction
650
650
  */
651
651
  appUpdateMethodCall: (params: {
652
+ appId: bigint;
652
653
  sender: SendingAddress;
653
654
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
654
655
  rekeyTo?: ReadableAddress | undefined;
@@ -660,7 +661,6 @@ declare class AlgorandClientTransactionCreator {
660
661
  validityWindow?: number | bigint | undefined;
661
662
  firstValidRound?: bigint | undefined;
662
663
  lastValidRound?: bigint | undefined;
663
- appId: bigint;
664
664
  onComplete?: OnApplicationComplete.UpdateApplication | undefined;
665
665
  accountReferences?: ReadableAddress[] | undefined;
666
666
  appReferences?: bigint[] | undefined;
@@ -721,6 +721,7 @@ declare class AlgorandClientTransactionCreator {
721
721
  * @returns The application ABI method delete transaction
722
722
  */
723
723
  appDeleteMethodCall: (params: {
724
+ appId: bigint;
724
725
  sender: SendingAddress;
725
726
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
726
727
  rekeyTo?: ReadableAddress | undefined;
@@ -732,7 +733,6 @@ declare class AlgorandClientTransactionCreator {
732
733
  validityWindow?: number | bigint | undefined;
733
734
  firstValidRound?: bigint | undefined;
734
735
  lastValidRound?: bigint | undefined;
735
- appId: bigint;
736
736
  onComplete?: OnApplicationComplete.DeleteApplication | undefined;
737
737
  accountReferences?: ReadableAddress[] | undefined;
738
738
  appReferences?: bigint[] | undefined;
@@ -791,6 +791,7 @@ declare class AlgorandClientTransactionCreator {
791
791
  * @returns The application ABI method call transaction
792
792
  */
793
793
  appCallMethodCall: (params: {
794
+ appId: bigint;
794
795
  sender: SendingAddress;
795
796
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
796
797
  rekeyTo?: ReadableAddress | undefined;
@@ -802,7 +803,6 @@ declare class AlgorandClientTransactionCreator {
802
803
  validityWindow?: number | bigint | undefined;
803
804
  firstValidRound?: bigint | undefined;
804
805
  lastValidRound?: bigint | undefined;
805
- appId: bigint;
806
806
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.DeleteApplication | undefined;
807
807
  accountReferences?: ReadableAddress[] | undefined;
808
808
  appReferences?: bigint[] | undefined;
@@ -474,6 +474,7 @@ declare class AlgorandClientTransactionSender {
474
474
  */
475
475
  appCreate: (params: {
476
476
  sender: SendingAddress;
477
+ args?: Uint8Array[] | undefined;
477
478
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
478
479
  rekeyTo?: ReadableAddress | undefined;
479
480
  note?: (Uint8Array | string) | undefined;
@@ -485,7 +486,6 @@ declare class AlgorandClientTransactionSender {
485
486
  firstValidRound?: bigint | undefined;
486
487
  lastValidRound?: bigint | undefined;
487
488
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
488
- args?: Uint8Array[] | undefined;
489
489
  accountReferences?: ReadableAddress[] | undefined;
490
490
  appReferences?: bigint[] | undefined;
491
491
  assetReferences?: bigint[] | undefined;
@@ -746,6 +746,7 @@ declare class AlgorandClientTransactionSender {
746
746
  * @returns The result of the application ABI method create transaction and the transaction that was sent
747
747
  */
748
748
  appCreateMethodCall: (params: {
749
+ appId?: 0 | undefined;
749
750
  sender: SendingAddress;
750
751
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
751
752
  rekeyTo?: ReadableAddress | undefined;
@@ -757,7 +758,6 @@ declare class AlgorandClientTransactionSender {
757
758
  validityWindow?: number | bigint | undefined;
758
759
  firstValidRound?: bigint | undefined;
759
760
  lastValidRound?: bigint | undefined;
760
- appId?: 0 | undefined;
761
761
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
762
762
  accountReferences?: ReadableAddress[] | undefined;
763
763
  appReferences?: bigint[] | undefined;
@@ -834,6 +834,7 @@ declare class AlgorandClientTransactionSender {
834
834
  * @returns The result of the application ABI method update transaction and the transaction that was sent
835
835
  */
836
836
  appUpdateMethodCall: (params: {
837
+ appId: bigint;
837
838
  sender: SendingAddress;
838
839
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
839
840
  rekeyTo?: ReadableAddress | undefined;
@@ -845,7 +846,6 @@ declare class AlgorandClientTransactionSender {
845
846
  validityWindow?: number | bigint | undefined;
846
847
  firstValidRound?: bigint | undefined;
847
848
  lastValidRound?: bigint | undefined;
848
- appId: bigint;
849
849
  onComplete?: OnApplicationComplete.UpdateApplication | undefined;
850
850
  accountReferences?: ReadableAddress[] | undefined;
851
851
  appReferences?: bigint[] | undefined;
@@ -913,6 +913,7 @@ declare class AlgorandClientTransactionSender {
913
913
  * @returns The result of the application ABI method delete transaction and the transaction that was sent
914
914
  */
915
915
  appDeleteMethodCall: (params: {
916
+ appId: bigint;
916
917
  sender: SendingAddress;
917
918
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
918
919
  rekeyTo?: ReadableAddress | undefined;
@@ -924,7 +925,6 @@ declare class AlgorandClientTransactionSender {
924
925
  validityWindow?: number | bigint | undefined;
925
926
  firstValidRound?: bigint | undefined;
926
927
  lastValidRound?: bigint | undefined;
927
- appId: bigint;
928
928
  onComplete?: OnApplicationComplete.DeleteApplication | undefined;
929
929
  accountReferences?: ReadableAddress[] | undefined;
930
930
  appReferences?: bigint[] | undefined;
@@ -990,6 +990,7 @@ declare class AlgorandClientTransactionSender {
990
990
  * @returns The result of the application ABI method call transaction and the transaction that was sent
991
991
  */
992
992
  appCallMethodCall: (params: {
993
+ appId: bigint;
993
994
  sender: SendingAddress;
994
995
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
995
996
  rekeyTo?: ReadableAddress | undefined;
@@ -1001,7 +1002,6 @@ declare class AlgorandClientTransactionSender {
1001
1002
  validityWindow?: number | bigint | undefined;
1002
1003
  firstValidRound?: bigint | undefined;
1003
1004
  lastValidRound?: bigint | undefined;
1004
- appId: bigint;
1005
1005
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.DeleteApplication | undefined;
1006
1006
  accountReferences?: ReadableAddress[] | undefined;
1007
1007
  appReferences?: bigint[] | undefined;
package/app-client.d.ts CHANGED
@@ -458,8 +458,9 @@ declare class AppClient {
458
458
  signer: AddressWithTransactionSigner | TransactionSigner | undefined;
459
459
  method: ABIMethod;
460
460
  onComplete: OnApplicationComplete.UpdateApplication;
461
- args: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
461
+ args: (ABIValue | TransactionWithSigner | Transaction | AppMethodCall<{
462
462
  sender: SendingAddress;
463
+ args?: Uint8Array[] | undefined;
463
464
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
464
465
  rekeyTo?: ReadableAddress | undefined;
465
466
  note?: (Uint8Array | string) | undefined;
@@ -471,7 +472,6 @@ declare class AppClient {
471
472
  firstValidRound?: bigint | undefined;
472
473
  lastValidRound?: bigint | undefined;
473
474
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
474
- args?: Uint8Array[] | undefined;
475
475
  accountReferences?: ReadableAddress[] | undefined;
476
476
  appReferences?: bigint[] | undefined;
477
477
  assetReferences?: bigint[] | undefined;
@@ -488,7 +488,7 @@ declare class AppClient {
488
488
  localByteSlices: number;
489
489
  } | undefined;
490
490
  extraProgramPages?: number | undefined;
491
- }> | AppMethodCall<{
491
+ }> | Promise<Transaction> | AppMethodCall<{
492
492
  sender: SendingAddress;
493
493
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
494
494
  rekeyTo?: ReadableAddress | undefined;
@@ -511,7 +511,7 @@ declare class AppClient {
511
511
  rejectVersion?: number | undefined;
512
512
  approvalProgram: string | Uint8Array;
513
513
  clearStateProgram: string | Uint8Array;
514
- }> | AppMethodCall<AppMethodCallParams> | Promise<Transaction> | undefined)[] | undefined;
514
+ }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
515
515
  }>;
516
516
  /**
517
517
  * Return params for an opt-in ABI call
@@ -519,6 +519,7 @@ declare class AppClient {
519
519
  * @returns The parameters which can be used to create an opt-in ABI method call
520
520
  */
521
521
  optIn: (params: AppClientMethodCallParams) => Promise<{
522
+ appId: bigint;
522
523
  sender: SendingAddress;
523
524
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
524
525
  rekeyTo?: ReadableAddress | undefined;
@@ -530,7 +531,6 @@ declare class AppClient {
530
531
  validityWindow?: number | bigint | undefined;
531
532
  firstValidRound?: bigint | undefined;
532
533
  lastValidRound?: bigint | undefined;
533
- appId: bigint;
534
534
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.DeleteApplication | undefined;
535
535
  accountReferences?: ReadableAddress[] | undefined;
536
536
  appReferences?: bigint[] | undefined;
@@ -547,6 +547,7 @@ declare class AppClient {
547
547
  * @returns The parameters which can be used to create a delete ABI method call
548
548
  */
549
549
  delete: (params: AppClientMethodCallParams) => Promise<{
550
+ appId: bigint;
550
551
  sender: SendingAddress;
551
552
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
552
553
  rekeyTo?: ReadableAddress | undefined;
@@ -558,7 +559,6 @@ declare class AppClient {
558
559
  validityWindow?: number | bigint | undefined;
559
560
  firstValidRound?: bigint | undefined;
560
561
  lastValidRound?: bigint | undefined;
561
- appId: bigint;
562
562
  onComplete?: OnApplicationComplete.DeleteApplication | undefined;
563
563
  accountReferences?: ReadableAddress[] | undefined;
564
564
  appReferences?: bigint[] | undefined;
@@ -574,6 +574,7 @@ declare class AppClient {
574
574
  * @returns The parameters which can be used to create a close out ABI method call
575
575
  */
576
576
  closeOut: (params: AppClientMethodCallParams) => Promise<{
577
+ appId: bigint;
577
578
  sender: SendingAddress;
578
579
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
579
580
  rekeyTo?: ReadableAddress | undefined;
@@ -585,7 +586,6 @@ declare class AppClient {
585
586
  validityWindow?: number | bigint | undefined;
586
587
  firstValidRound?: bigint | undefined;
587
588
  lastValidRound?: bigint | undefined;
588
- appId: bigint;
589
589
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.DeleteApplication | undefined;
590
590
  accountReferences?: ReadableAddress[] | undefined;
591
591
  appReferences?: bigint[] | undefined;
@@ -601,6 +601,7 @@ declare class AppClient {
601
601
  * @returns The parameters which can be used to create an ABI method call
602
602
  */
603
603
  call: (params: AppClientMethodCallParams & CallOnComplete) => Promise<{
604
+ appId: bigint;
604
605
  sender: SendingAddress;
605
606
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
606
607
  rekeyTo?: ReadableAddress | undefined;
@@ -612,7 +613,6 @@ declare class AppClient {
612
613
  validityWindow?: number | bigint | undefined;
613
614
  firstValidRound?: bigint | undefined;
614
615
  lastValidRound?: bigint | undefined;
615
- appId: bigint;
616
616
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.DeleteApplication | undefined;
617
617
  accountReferences?: ReadableAddress[] | undefined;
618
618
  appReferences?: bigint[] | undefined;
@@ -709,8 +709,8 @@ declare class AppClient {
709
709
  update: (params: AppClientMethodCallParams & AppClientCompilationParams & SendParams) => Promise<{
710
710
  compiledApproval?: CompiledTeal | undefined;
711
711
  compiledClear?: CompiledTeal | undefined;
712
- confirmations: PendingTransactionResponse[];
713
712
  transactions: Transaction[];
713
+ confirmations: PendingTransactionResponse[];
714
714
  groupId: string | undefined;
715
715
  txIds: string[];
716
716
  returns?: ABIReturn[] | undefined;
package/app-factory.d.ts CHANGED
@@ -211,8 +211,9 @@ declare class AppFactory {
211
211
  sender: Address;
212
212
  signer: AddressWithTransactionSigner | TransactionSigner | undefined;
213
213
  method: ABIMethod;
214
- args: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
214
+ args: (ABIValue | TransactionWithSigner | Transaction | AppMethodCall<{
215
215
  sender: SendingAddress;
216
+ args?: Uint8Array[] | undefined;
216
217
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
217
218
  rekeyTo?: ReadableAddress | undefined;
218
219
  note?: (Uint8Array | string) | undefined;
@@ -224,7 +225,6 @@ declare class AppFactory {
224
225
  firstValidRound?: bigint | undefined;
225
226
  lastValidRound?: bigint | undefined;
226
227
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
227
- args?: Uint8Array[] | undefined;
228
228
  accountReferences?: ReadableAddress[] | undefined;
229
229
  appReferences?: bigint[] | undefined;
230
230
  assetReferences?: bigint[] | undefined;
@@ -241,7 +241,7 @@ declare class AppFactory {
241
241
  localByteSlices: number;
242
242
  } | undefined;
243
243
  extraProgramPages?: number | undefined;
244
- }> | AppMethodCall<{
244
+ }> | Promise<Transaction> | AppMethodCall<{
245
245
  sender: SendingAddress;
246
246
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
247
247
  rekeyTo?: ReadableAddress | undefined;
@@ -264,7 +264,7 @@ declare class AppFactory {
264
264
  rejectVersion?: number | undefined;
265
265
  approvalProgram: string | Uint8Array;
266
266
  clearStateProgram: string | Uint8Array;
267
- }> | AppMethodCall<AppMethodCallParams> | Promise<Transaction> | undefined)[] | undefined;
267
+ }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
268
268
  onComplete: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication;
269
269
  }>;
270
270
  /** Return params for a deployment update ABI call */
@@ -293,8 +293,9 @@ declare class AppFactory {
293
293
  sender: Address;
294
294
  signer: AddressWithTransactionSigner | TransactionSigner | undefined;
295
295
  method: ABIMethod;
296
- args: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
296
+ args: (ABIValue | TransactionWithSigner | Transaction | AppMethodCall<{
297
297
  sender: SendingAddress;
298
+ args?: Uint8Array[] | undefined;
298
299
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
299
300
  rekeyTo?: ReadableAddress | undefined;
300
301
  note?: (Uint8Array | string) | undefined;
@@ -306,7 +307,6 @@ declare class AppFactory {
306
307
  firstValidRound?: bigint | undefined;
307
308
  lastValidRound?: bigint | undefined;
308
309
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
309
- args?: Uint8Array[] | undefined;
310
310
  accountReferences?: ReadableAddress[] | undefined;
311
311
  appReferences?: bigint[] | undefined;
312
312
  assetReferences?: bigint[] | undefined;
@@ -323,7 +323,7 @@ declare class AppFactory {
323
323
  localByteSlices: number;
324
324
  } | undefined;
325
325
  extraProgramPages?: number | undefined;
326
- }> | AppMethodCall<{
326
+ }> | Promise<Transaction> | AppMethodCall<{
327
327
  sender: SendingAddress;
328
328
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
329
329
  rekeyTo?: ReadableAddress | undefined;
@@ -346,7 +346,7 @@ declare class AppFactory {
346
346
  rejectVersion?: number | undefined;
347
347
  approvalProgram: string | Uint8Array;
348
348
  clearStateProgram: string | Uint8Array;
349
- }> | AppMethodCall<AppMethodCallParams> | Promise<Transaction> | undefined)[] | undefined;
349
+ }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
350
350
  onComplete: OnApplicationComplete.UpdateApplication;
351
351
  };
352
352
  /** Return params for a deployment delete ABI call */
@@ -375,8 +375,9 @@ declare class AppFactory {
375
375
  sender: Address;
376
376
  signer: AddressWithTransactionSigner | TransactionSigner | undefined;
377
377
  method: ABIMethod;
378
- args: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
378
+ args: (ABIValue | TransactionWithSigner | Transaction | AppMethodCall<{
379
379
  sender: SendingAddress;
380
+ args?: Uint8Array[] | undefined;
380
381
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
381
382
  rekeyTo?: ReadableAddress | undefined;
382
383
  note?: (Uint8Array | string) | undefined;
@@ -388,7 +389,6 @@ declare class AppFactory {
388
389
  firstValidRound?: bigint | undefined;
389
390
  lastValidRound?: bigint | undefined;
390
391
  onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
391
- args?: Uint8Array[] | undefined;
392
392
  accountReferences?: ReadableAddress[] | undefined;
393
393
  appReferences?: bigint[] | undefined;
394
394
  assetReferences?: bigint[] | undefined;
@@ -405,7 +405,7 @@ declare class AppFactory {
405
405
  localByteSlices: number;
406
406
  } | undefined;
407
407
  extraProgramPages?: number | undefined;
408
- }> | AppMethodCall<{
408
+ }> | Promise<Transaction> | AppMethodCall<{
409
409
  sender: SendingAddress;
410
410
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
411
411
  rekeyTo?: ReadableAddress | undefined;
@@ -428,7 +428,7 @@ declare class AppFactory {
428
428
  rejectVersion?: number | undefined;
429
429
  approvalProgram: string | Uint8Array;
430
430
  clearStateProgram: string | Uint8Array;
431
- }> | AppMethodCall<AppMethodCallParams> | Promise<Transaction> | undefined)[] | undefined;
431
+ }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
432
432
  onComplete: OnApplicationComplete.DeleteApplication;
433
433
  };
434
434
  bare: {
@@ -449,6 +449,7 @@ declare class AppFactory {
449
449
  /** The number of byte slices saved in local state. */
450
450
  localByteSlices: number;
451
451
  };
452
+ args?: Uint8Array[];
452
453
  signer?: TransactionSigner | AddressWithTransactionSigner;
453
454
  rekeyTo?: ReadableAddress;
454
455
  note?: Uint8Array | string;
@@ -459,7 +460,6 @@ declare class AppFactory {
459
460
  validityWindow?: number | bigint;
460
461
  firstValidRound?: bigint;
461
462
  lastValidRound?: bigint;
462
- args?: Uint8Array[];
463
463
  accountReferences?: ReadableAddress[];
464
464
  appReferences?: bigint[];
465
465
  assetReferences?: bigint[];
@@ -478,6 +478,7 @@ declare class AppFactory {
478
478
  }>;
479
479
  /** Return params for a deployment update bare call */
480
480
  deployUpdate: (params?: AppClientBareCallParams) => {
481
+ args?: Uint8Array[] | undefined;
481
482
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
482
483
  rekeyTo?: ReadableAddress | undefined;
483
484
  note?: (Uint8Array | string) | undefined;
@@ -488,7 +489,6 @@ declare class AppFactory {
488
489
  validityWindow?: number | bigint | undefined;
489
490
  firstValidRound?: bigint | undefined;
490
491
  lastValidRound?: bigint | undefined;
491
- args?: Uint8Array[] | undefined;
492
492
  accountReferences?: ReadableAddress[] | undefined;
493
493
  appReferences?: bigint[] | undefined;
494
494
  assetReferences?: bigint[] | undefined;
@@ -503,6 +503,7 @@ declare class AppFactory {
503
503
  };
504
504
  /** Return params for a deployment delete bare call */
505
505
  deployDelete: (params?: AppClientBareCallParams) => {
506
+ args?: Uint8Array[] | undefined;
506
507
  signer?: (TransactionSigner | AddressWithTransactionSigner) | undefined;
507
508
  rekeyTo?: ReadableAddress | undefined;
508
509
  note?: (Uint8Array | string) | undefined;
@@ -513,7 +514,6 @@ declare class AppFactory {
513
514
  validityWindow?: number | bigint | undefined;
514
515
  firstValidRound?: bigint | undefined;
515
516
  lastValidRound?: bigint | undefined;
516
- args?: Uint8Array[] | undefined;
517
517
  accountReferences?: ReadableAddress[] | undefined;
518
518
  appReferences?: bigint[] | undefined;
519
519
  assetReferences?: bigint[] | undefined;
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "**"
7
7
  ],
8
8
  "name": "@algorandfoundation/algokit-utils",
9
- "version": "10.0.0-alpha.41",
9
+ "version": "10.0.0-alpha.42",
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",
@@ -94,6 +94,7 @@
94
94
  },
95
95
  "dependencies": {
96
96
  "@algorandfoundation/xhd-wallet-api": "2.0.0-canary.1",
97
+ "@noble/curves": "^2.0.1",
97
98
  "@noble/ed25519": "^3.0.0",
98
99
  "@noble/hashes": "^2.0.1",
99
100
  "algorand-msgpack": "^1.1.0",
@@ -1,13 +1,13 @@
1
1
  const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
2
- const require_utils = require('../../../node_modules/@noble/curves/utils.js');
3
- const require_modular = require('../../../node_modules/@noble/curves/abstract/modular.js');
4
- const require_ed25519 = require('../../../node_modules/@noble/curves/ed25519.js');
5
- const require_ed25519$1 = require('./ed25519.js');
2
+ const require_ed25519 = require('./ed25519.js');
6
3
  const require_hash = require('./hash.js');
7
4
  const require_hd = require('./hd.js');
8
5
  let _noble_hashes_sha2_js = require("@noble/hashes/sha2.js");
9
6
  let _noble_ed25519 = require("@noble/ed25519");
10
7
  _noble_ed25519 = require_runtime.__toESM(_noble_ed25519);
8
+ let _noble_curves_ed25519_js = require("@noble/curves/ed25519.js");
9
+ let _noble_curves_utils_js = require("@noble/curves/utils.js");
10
+ let _noble_curves_abstract_modular_js = require("@noble/curves/abstract/modular.js");
11
11
 
12
12
  //#region packages/crypto/src/index.ts
13
13
  const ED25519_SEED_LENGTH = 32;
@@ -29,21 +29,21 @@ const throwWrapUnwrapErrors = (operationError, wrapError, operationName) => {
29
29
  throw new AggregateError([operationError, wrapError], `${operationName} failed and failed to re-wrap Ed25519 secret. Check both errors for details.`);
30
30
  };
31
31
  function rawSign(extendedSecretKey, data) {
32
- const scalar = require_utils.bytesToNumberLE(extendedSecretKey.slice(0, 32));
32
+ const scalar = (0, _noble_curves_utils_js.bytesToNumberLE)(extendedSecretKey.slice(0, 32));
33
33
  const kR = extendedSecretKey.slice(32, 64);
34
34
  const publicKey = rawPubkey(extendedSecretKey);
35
- const r = require_modular.mod(require_utils.bytesToNumberLE((0, _noble_hashes_sha2_js.sha512)(new Uint8Array([...kR, ...data]))), require_ed25519.ed25519.Point.Fn.ORDER);
36
- const R = require_ed25519.ed25519.Point.BASE.multiply(r);
37
- const S = require_modular.mod(r + require_modular.mod(require_utils.bytesToNumberLE((0, _noble_hashes_sha2_js.sha512)(new Uint8Array([
35
+ const r = (0, _noble_curves_abstract_modular_js.mod)((0, _noble_curves_utils_js.bytesToNumberLE)((0, _noble_hashes_sha2_js.sha512)(new Uint8Array([...kR, ...data]))), _noble_curves_ed25519_js.ed25519.Point.Fn.ORDER);
36
+ const R = _noble_curves_ed25519_js.ed25519.Point.BASE.multiply(r);
37
+ const S = (0, _noble_curves_abstract_modular_js.mod)(r + (0, _noble_curves_abstract_modular_js.mod)((0, _noble_curves_utils_js.bytesToNumberLE)((0, _noble_hashes_sha2_js.sha512)(new Uint8Array([
38
38
  ...R.toBytes(),
39
39
  ...publicKey,
40
40
  ...data
41
- ]))), require_ed25519.ed25519.Point.Fn.ORDER) * scalar, require_ed25519.ed25519.Point.Fn.ORDER);
42
- return new Uint8Array([...R.toBytes(), ...require_utils.numberToBytesLE(S, 32)]);
41
+ ]))), _noble_curves_ed25519_js.ed25519.Point.Fn.ORDER) * scalar, _noble_curves_ed25519_js.ed25519.Point.Fn.ORDER);
42
+ return new Uint8Array([...R.toBytes(), ...(0, _noble_curves_utils_js.numberToBytesLE)(S, 32)]);
43
43
  }
44
44
  function rawPubkey(extendedSecretKey) {
45
- const reducedScalar = require_modular.mod(require_utils.bytesToNumberLE(extendedSecretKey.slice(0, 32)) & (1n << 255n) - 1n, require_ed25519.ed25519.Point.Fn.ORDER);
46
- return require_ed25519.ed25519.Point.BASE.multiply(reducedScalar).toBytes();
45
+ const reducedScalar = (0, _noble_curves_abstract_modular_js.mod)((0, _noble_curves_utils_js.bytesToNumberLE)(extendedSecretKey.slice(0, 32)) & (1n << 255n) - 1n, _noble_curves_ed25519_js.ed25519.Point.Fn.ORDER);
46
+ return _noble_curves_ed25519_js.ed25519.Point.BASE.multiply(reducedScalar).toBytes();
47
47
  }
48
48
  /**
49
49
  * Creates an Ed25519 signing key from a wrapped secret using the @noble/ed25519 implementation.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["bytesToNumberLE","mod","ed25519","numberToBytesLE","ed"],"sources":["../../../../packages/crypto/src/index.ts"],"sourcesContent":["import { Ed25519SigningKey, WrappedEd25519Seed } from './ed25519'\nimport * as ed from '@noble/ed25519'\nimport { WrappedHdExtendedPrivateKey } from './hd'\nimport { ed25519 } from '@noble/curves/ed25519.js'\nimport { sha512 } from '@noble/hashes/sha2.js'\nimport { bytesToNumberLE, numberToBytesLE } from '@noble/curves/utils.js'\nimport { mod } from '@noble/curves/abstract/modular.js'\n\nexport * from './ed25519'\nexport * from './hash'\nexport * from './hd'\n\nexport type WrappedEd25519Secret = WrappedEd25519Seed | WrappedHdExtendedPrivateKey\n\nconst ED25519_SEED_LENGTH = 32\nconst ED25519_EXTENDED_PRIVATE_KEY_LENGTH = 96\n\nconst assertEd25519SecretLength = (secret: Uint8Array, secretType: 'ed25519 seed' | 'HD extended key'): void => {\n let expectedLength: number\n switch (secretType) {\n case 'ed25519 seed':\n expectedLength = ED25519_SEED_LENGTH\n break\n case 'HD extended key':\n expectedLength = ED25519_EXTENDED_PRIVATE_KEY_LENGTH\n break\n default:\n throw new Error(`Unknown secret type: ${secretType}`)\n }\n\n if (secret.length !== expectedLength) {\n throw new Error(`Expected unwrapped ${secretType} to be ${expectedLength} bytes, got ${secret.length}.`)\n }\n}\n\nconst throwWrapUnwrapErrors = (operationError: unknown, wrapError: unknown, operationName: string): never => {\n throw new AggregateError(\n [operationError, wrapError],\n `${operationName} failed and failed to re-wrap Ed25519 secret. Check both errors for details.`,\n )\n}\n\nfunction rawSign(extendedSecretKey: Uint8Array, data: Uint8Array): Uint8Array {\n const scalar = bytesToNumberLE(extendedSecretKey.slice(0, 32))\n\n const kR = extendedSecretKey.slice(32, 64)\n\n // (1): pubKey = scalar * G\n const publicKey = rawPubkey(extendedSecretKey)\n\n // (2): h = hash(kR || msg) mod q\n const rHash = sha512(new Uint8Array([...kR, ...data]))\n const r = mod(bytesToNumberLE(rHash), ed25519.Point.Fn.ORDER)\n\n // (4): R = r * G\n const R = ed25519.Point.BASE.multiply(r)\n\n // h = hash(R || pubKey || msg) mod q\n const hHash = sha512(new Uint8Array([...R.toBytes(), ...publicKey, ...data]))\n const h = mod(bytesToNumberLE(hHash), ed25519.Point.Fn.ORDER)\n\n // (5): S = (r + h * k) mod q\n const S = mod(r + h * scalar, ed25519.Point.Fn.ORDER)\n\n return new Uint8Array([...R.toBytes(), ...numberToBytesLE(S, 32)])\n}\n\nfunction rawPubkey(extendedSecretKey: Uint8Array): Uint8Array {\n const scalar = bytesToNumberLE(extendedSecretKey.slice(0, 32))\n const clearedTopBitScalar = scalar & ((1n << 255n) - 1n)\n const reducedScalar = mod(clearedTopBitScalar, ed25519.Point.Fn.ORDER)\n\n // pubKey = scalar * G\n const publicKey = ed25519.Point.BASE.multiply(reducedScalar)\n return publicKey.toBytes()\n}\n\n/**\n * Creates an Ed25519 signing key from a wrapped secret using the @noble/ed25519 implementation.\n *\n * NOTE: This function will zero out the unwrapped secret after the wrap function is called.\n *\n * @param wrapUnwrap - The wrapped secret provider that unwraps and re-wraps the Ed25519 secret.\n * @returns A promise that resolves to an Ed25519 signing key containing the public key and raw signer.\n */\nexport const nobleEd25519SigningKeyFromWrappedSecret = async (wrapUnwrap: WrappedEd25519Secret): Promise<Ed25519SigningKey> => {\n let wrapFunction: () => Promise<void>\n if ('wrapEd25519Seed' in wrapUnwrap) {\n wrapFunction = wrapUnwrap.wrapEd25519Seed\n } else if ('wrapHdExtendedPrivateKey' in wrapUnwrap) {\n wrapFunction = wrapUnwrap.wrapHdExtendedPrivateKey\n } else {\n throw new Error('Invalid WrappedEd25519Secret: missing wrap function')\n }\n\n const signer = async (bytesToSign: Uint8Array): Promise<Uint8Array> => {\n let secret: Uint8Array | undefined = undefined\n let signature: Uint8Array | undefined = undefined\n let signingError: unknown\n let wrapError: unknown\n try {\n if ('unwrapEd25519Seed' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapEd25519Seed()\n assertEd25519SecretLength(secret, 'ed25519 seed')\n signature = await ed.signAsync(bytesToSign, secret)\n } else if ('unwrapHdExtendedPrivateKey' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapHdExtendedPrivateKey()\n assertEd25519SecretLength(secret, 'HD extended key')\n signature = rawSign(secret.slice(0, 64), bytesToSign)\n } else {\n throw new Error('Invalid WrappedEd25519Secret: missing unwrap function')\n }\n } catch (error) {\n signingError = error\n } finally {\n try {\n await wrapFunction()\n } catch (error) {\n wrapError = error\n } finally {\n secret?.fill(0)\n }\n }\n\n if (signingError !== undefined && wrapError !== undefined) {\n throwWrapUnwrapErrors(signingError, wrapError, 'Signing')\n }\n\n if (signingError !== undefined) {\n throw signingError\n }\n\n if (wrapError !== undefined) {\n throw wrapError\n }\n\n if (signature === undefined) {\n throw new Error('Signing failed unexpectedly without an error.')\n }\n\n return signature\n }\n\n let pubkey: Uint8Array | undefined = undefined\n let pubkeyError: unknown\n let wrapError: unknown\n let secret: Uint8Array | undefined = undefined\n try {\n if ('unwrapEd25519Seed' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapEd25519Seed()\n assertEd25519SecretLength(secret, 'ed25519 seed')\n pubkey = await ed.getPublicKeyAsync(secret)\n } else if ('unwrapHdExtendedPrivateKey' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapHdExtendedPrivateKey()\n assertEd25519SecretLength(secret, 'HD extended key')\n pubkey = rawPubkey(secret.slice(0, 64))\n } else {\n throw new Error('Invalid WrappedEd25519Secret: missing unwrap function')\n }\n } catch (error) {\n pubkeyError = error\n } finally {\n try {\n await wrapFunction()\n } catch (error) {\n wrapError = error\n } finally {\n secret?.fill(0)\n }\n }\n\n if (pubkeyError !== undefined && wrapError !== undefined) {\n throwWrapUnwrapErrors(pubkeyError, wrapError, 'Deriving Ed25519 public key')\n }\n\n if (pubkeyError !== undefined) {\n throw pubkeyError\n }\n\n if (wrapError !== undefined) {\n throw wrapError\n }\n\n if (pubkey === undefined) {\n throw new Error('Deriving Ed25519 public key failed unexpectedly without an error.')\n }\n\n return {\n ed25519Pubkey: pubkey,\n rawEd25519Signer: signer,\n }\n}\n\n/**\n * Creates an ed25519 signing key from a wrapped secret using the default ed25519 implementation (currently @noble/ed25519).\n * The implementation may change in the future. To explicitly use the @noble/ed25519 implementation, use `nobleEd25519SigningKeyFromWrappedSecret`.\n *\n * NOTE: This function will zero out the unwrapped secret after the wrap function is called.\n *\n * @param wrapUnwrap - The wrapped secret provider that unwraps and re-wraps the ed25519 secret.\n * @returns A promise that resolves to an ed25519 signing key with public key and raw signer.\n */\nexport const ed25519SigningKeyFromWrappedSecret = nobleEd25519SigningKeyFromWrappedSecret\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,sBAAsB;AAC5B,MAAM,sCAAsC;AAE5C,MAAM,6BAA6B,QAAoB,eAAyD;CAC9G,IAAI;AACJ,SAAQ,YAAR;EACE,KAAK;AACH,oBAAiB;AACjB;EACF,KAAK;AACH,oBAAiB;AACjB;EACF,QACE,OAAM,IAAI,MAAM,wBAAwB,aAAa;;AAGzD,KAAI,OAAO,WAAW,eACpB,OAAM,IAAI,MAAM,sBAAsB,WAAW,SAAS,eAAe,cAAc,OAAO,OAAO,GAAG;;AAI5G,MAAM,yBAAyB,gBAAyB,WAAoB,kBAAiC;AAC3G,OAAM,IAAI,eACR,CAAC,gBAAgB,UAAU,EAC3B,GAAG,cAAc,8EAClB;;AAGH,SAAS,QAAQ,mBAA+B,MAA8B;CAC5E,MAAM,SAASA,8BAAgB,kBAAkB,MAAM,GAAG,GAAG,CAAC;CAE9D,MAAM,KAAK,kBAAkB,MAAM,IAAI,GAAG;CAG1C,MAAM,YAAY,UAAU,kBAAkB;CAI9C,MAAM,IAAIC,oBAAID,gEADO,IAAI,WAAW,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAClB,EAAEE,wBAAQ,MAAM,GAAG,MAAM;CAG7D,MAAM,IAAIA,wBAAQ,MAAM,KAAK,SAAS,EAAE;CAOxC,MAAM,IAAID,oBAAI,IAHJA,oBAAID,gEADO,IAAI,WAAW;EAAC,GAAG,EAAE,SAAS;EAAE,GAAG;EAAW,GAAG;EAAK,CAAC,CAAC,CACzC,EAAEE,wBAAQ,MAAM,GAAG,MAAM,GAGvC,QAAQA,wBAAQ,MAAM,GAAG,MAAM;AAErD,QAAO,IAAI,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,GAAGC,8BAAgB,GAAG,GAAG,CAAC,CAAC;;AAGpE,SAAS,UAAU,mBAA2C;CAG5D,MAAM,gBAAgBF,oBAFPD,8BAAgB,kBAAkB,MAAM,GAAG,GAAG,CAAC,IACvB,MAAM,QAAQ,IACNE,wBAAQ,MAAM,GAAG,MAAM;AAItE,QADkBA,wBAAQ,MAAM,KAAK,SAAS,cAAc,CAC3C,SAAS;;;;;;;;;;AAW5B,MAAa,0CAA0C,OAAO,eAAiE;CAC7H,IAAI;AACJ,KAAI,qBAAqB,WACvB,gBAAe,WAAW;UACjB,8BAA8B,WACvC,gBAAe,WAAW;KAE1B,OAAM,IAAI,MAAM,sDAAsD;CAGxE,MAAM,SAAS,OAAO,gBAAiD;EACrE,IAAI,SAAiC;EACrC,IAAI,YAAoC;EACxC,IAAI;EACJ,IAAI;AACJ,MAAI;AACF,OAAI,uBAAuB,YAAY;AACrC,aAAS,MAAM,WAAW,mBAAmB;AAC7C,8BAA0B,QAAQ,eAAe;AACjD,gBAAY,MAAME,eAAG,UAAU,aAAa,OAAO;cAC1C,gCAAgC,YAAY;AACrD,aAAS,MAAM,WAAW,4BAA4B;AACtD,8BAA0B,QAAQ,kBAAkB;AACpD,gBAAY,QAAQ,OAAO,MAAM,GAAG,GAAG,EAAE,YAAY;SAErD,OAAM,IAAI,MAAM,wDAAwD;WAEnE,OAAO;AACd,kBAAe;YACP;AACR,OAAI;AACF,UAAM,cAAc;YACb,OAAO;AACd,gBAAY;aACJ;AACR,YAAQ,KAAK,EAAE;;;AAInB,MAAI,iBAAiB,UAAa,cAAc,OAC9C,uBAAsB,cAAc,WAAW,UAAU;AAG3D,MAAI,iBAAiB,OACnB,OAAM;AAGR,MAAI,cAAc,OAChB,OAAM;AAGR,MAAI,cAAc,OAChB,OAAM,IAAI,MAAM,gDAAgD;AAGlE,SAAO;;CAGT,IAAI,SAAiC;CACrC,IAAI;CACJ,IAAI;CACJ,IAAI,SAAiC;AACrC,KAAI;AACF,MAAI,uBAAuB,YAAY;AACrC,YAAS,MAAM,WAAW,mBAAmB;AAC7C,6BAA0B,QAAQ,eAAe;AACjD,YAAS,MAAMA,eAAG,kBAAkB,OAAO;aAClC,gCAAgC,YAAY;AACrD,YAAS,MAAM,WAAW,4BAA4B;AACtD,6BAA0B,QAAQ,kBAAkB;AACpD,YAAS,UAAU,OAAO,MAAM,GAAG,GAAG,CAAC;QAEvC,OAAM,IAAI,MAAM,wDAAwD;UAEnE,OAAO;AACd,gBAAc;WACN;AACR,MAAI;AACF,SAAM,cAAc;WACb,OAAO;AACd,eAAY;YACJ;AACR,WAAQ,KAAK,EAAE;;;AAInB,KAAI,gBAAgB,UAAa,cAAc,OAC7C,uBAAsB,aAAa,WAAW,8BAA8B;AAG9E,KAAI,gBAAgB,OAClB,OAAM;AAGR,KAAI,cAAc,OAChB,OAAM;AAGR,KAAI,WAAW,OACb,OAAM,IAAI,MAAM,oEAAoE;AAGtF,QAAO;EACL,eAAe;EACf,kBAAkB;EACnB;;;;;;;;;;;AAYH,MAAa,qCAAqC"}
1
+ {"version":3,"file":"index.js","names":["ed25519","ed"],"sources":["../../../../packages/crypto/src/index.ts"],"sourcesContent":["import { Ed25519SigningKey, WrappedEd25519Seed } from './ed25519'\nimport * as ed from '@noble/ed25519'\nimport { WrappedHdExtendedPrivateKey } from './hd'\nimport { ed25519 } from '@noble/curves/ed25519.js'\nimport { sha512 } from '@noble/hashes/sha2.js'\nimport { bytesToNumberLE, numberToBytesLE } from '@noble/curves/utils.js'\nimport { mod } from '@noble/curves/abstract/modular.js'\n\nexport * from './ed25519'\nexport * from './hash'\nexport * from './hd'\n\nexport type WrappedEd25519Secret = WrappedEd25519Seed | WrappedHdExtendedPrivateKey\n\nconst ED25519_SEED_LENGTH = 32\nconst ED25519_EXTENDED_PRIVATE_KEY_LENGTH = 96\n\nconst assertEd25519SecretLength = (secret: Uint8Array, secretType: 'ed25519 seed' | 'HD extended key'): void => {\n let expectedLength: number\n switch (secretType) {\n case 'ed25519 seed':\n expectedLength = ED25519_SEED_LENGTH\n break\n case 'HD extended key':\n expectedLength = ED25519_EXTENDED_PRIVATE_KEY_LENGTH\n break\n default:\n throw new Error(`Unknown secret type: ${secretType}`)\n }\n\n if (secret.length !== expectedLength) {\n throw new Error(`Expected unwrapped ${secretType} to be ${expectedLength} bytes, got ${secret.length}.`)\n }\n}\n\nconst throwWrapUnwrapErrors = (operationError: unknown, wrapError: unknown, operationName: string): never => {\n throw new AggregateError(\n [operationError, wrapError],\n `${operationName} failed and failed to re-wrap Ed25519 secret. Check both errors for details.`,\n )\n}\n\nfunction rawSign(extendedSecretKey: Uint8Array, data: Uint8Array): Uint8Array {\n const scalar = bytesToNumberLE(extendedSecretKey.slice(0, 32))\n\n const kR = extendedSecretKey.slice(32, 64)\n\n // (1): pubKey = scalar * G\n const publicKey = rawPubkey(extendedSecretKey)\n\n // (2): h = hash(kR || msg) mod q\n const rHash = sha512(new Uint8Array([...kR, ...data]))\n const r = mod(bytesToNumberLE(rHash), ed25519.Point.Fn.ORDER)\n\n // (4): R = r * G\n const R = ed25519.Point.BASE.multiply(r)\n\n // h = hash(R || pubKey || msg) mod q\n const hHash = sha512(new Uint8Array([...R.toBytes(), ...publicKey, ...data]))\n const h = mod(bytesToNumberLE(hHash), ed25519.Point.Fn.ORDER)\n\n // (5): S = (r + h * k) mod q\n const S = mod(r + h * scalar, ed25519.Point.Fn.ORDER)\n\n return new Uint8Array([...R.toBytes(), ...numberToBytesLE(S, 32)])\n}\n\nfunction rawPubkey(extendedSecretKey: Uint8Array): Uint8Array {\n const scalar = bytesToNumberLE(extendedSecretKey.slice(0, 32))\n const clearedTopBitScalar = scalar & ((1n << 255n) - 1n)\n const reducedScalar = mod(clearedTopBitScalar, ed25519.Point.Fn.ORDER)\n\n // pubKey = scalar * G\n const publicKey = ed25519.Point.BASE.multiply(reducedScalar)\n return publicKey.toBytes()\n}\n\n/**\n * Creates an Ed25519 signing key from a wrapped secret using the @noble/ed25519 implementation.\n *\n * NOTE: This function will zero out the unwrapped secret after the wrap function is called.\n *\n * @param wrapUnwrap - The wrapped secret provider that unwraps and re-wraps the Ed25519 secret.\n * @returns A promise that resolves to an Ed25519 signing key containing the public key and raw signer.\n */\nexport const nobleEd25519SigningKeyFromWrappedSecret = async (wrapUnwrap: WrappedEd25519Secret): Promise<Ed25519SigningKey> => {\n let wrapFunction: () => Promise<void>\n if ('wrapEd25519Seed' in wrapUnwrap) {\n wrapFunction = wrapUnwrap.wrapEd25519Seed\n } else if ('wrapHdExtendedPrivateKey' in wrapUnwrap) {\n wrapFunction = wrapUnwrap.wrapHdExtendedPrivateKey\n } else {\n throw new Error('Invalid WrappedEd25519Secret: missing wrap function')\n }\n\n const signer = async (bytesToSign: Uint8Array): Promise<Uint8Array> => {\n let secret: Uint8Array | undefined = undefined\n let signature: Uint8Array | undefined = undefined\n let signingError: unknown\n let wrapError: unknown\n try {\n if ('unwrapEd25519Seed' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapEd25519Seed()\n assertEd25519SecretLength(secret, 'ed25519 seed')\n signature = await ed.signAsync(bytesToSign, secret)\n } else if ('unwrapHdExtendedPrivateKey' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapHdExtendedPrivateKey()\n assertEd25519SecretLength(secret, 'HD extended key')\n signature = rawSign(secret.slice(0, 64), bytesToSign)\n } else {\n throw new Error('Invalid WrappedEd25519Secret: missing unwrap function')\n }\n } catch (error) {\n signingError = error\n } finally {\n try {\n await wrapFunction()\n } catch (error) {\n wrapError = error\n } finally {\n secret?.fill(0)\n }\n }\n\n if (signingError !== undefined && wrapError !== undefined) {\n throwWrapUnwrapErrors(signingError, wrapError, 'Signing')\n }\n\n if (signingError !== undefined) {\n throw signingError\n }\n\n if (wrapError !== undefined) {\n throw wrapError\n }\n\n if (signature === undefined) {\n throw new Error('Signing failed unexpectedly without an error.')\n }\n\n return signature\n }\n\n let pubkey: Uint8Array | undefined = undefined\n let pubkeyError: unknown\n let wrapError: unknown\n let secret: Uint8Array | undefined = undefined\n try {\n if ('unwrapEd25519Seed' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapEd25519Seed()\n assertEd25519SecretLength(secret, 'ed25519 seed')\n pubkey = await ed.getPublicKeyAsync(secret)\n } else if ('unwrapHdExtendedPrivateKey' in wrapUnwrap) {\n secret = await wrapUnwrap.unwrapHdExtendedPrivateKey()\n assertEd25519SecretLength(secret, 'HD extended key')\n pubkey = rawPubkey(secret.slice(0, 64))\n } else {\n throw new Error('Invalid WrappedEd25519Secret: missing unwrap function')\n }\n } catch (error) {\n pubkeyError = error\n } finally {\n try {\n await wrapFunction()\n } catch (error) {\n wrapError = error\n } finally {\n secret?.fill(0)\n }\n }\n\n if (pubkeyError !== undefined && wrapError !== undefined) {\n throwWrapUnwrapErrors(pubkeyError, wrapError, 'Deriving Ed25519 public key')\n }\n\n if (pubkeyError !== undefined) {\n throw pubkeyError\n }\n\n if (wrapError !== undefined) {\n throw wrapError\n }\n\n if (pubkey === undefined) {\n throw new Error('Deriving Ed25519 public key failed unexpectedly without an error.')\n }\n\n return {\n ed25519Pubkey: pubkey,\n rawEd25519Signer: signer,\n }\n}\n\n/**\n * Creates an ed25519 signing key from a wrapped secret using the default ed25519 implementation (currently @noble/ed25519).\n * The implementation may change in the future. To explicitly use the @noble/ed25519 implementation, use `nobleEd25519SigningKeyFromWrappedSecret`.\n *\n * NOTE: This function will zero out the unwrapped secret after the wrap function is called.\n *\n * @param wrapUnwrap - The wrapped secret provider that unwraps and re-wraps the ed25519 secret.\n * @returns A promise that resolves to an ed25519 signing key with public key and raw signer.\n */\nexport const ed25519SigningKeyFromWrappedSecret = nobleEd25519SigningKeyFromWrappedSecret\n"],"mappings":"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"}
@@ -1,11 +1,11 @@
1
- import { bytesToNumberLE, numberToBytesLE } from "../../../node_modules/@noble/curves/utils.mjs";
2
- import { mod } from "../../../node_modules/@noble/curves/abstract/modular.mjs";
3
- import { ed25519 } from "../../../node_modules/@noble/curves/ed25519.mjs";
4
1
  import { ed25519Generator, ed25519Verifier, nobleEd25519Generator, nobleEd25519Verifier } from "./ed25519.mjs";
5
2
  import { hash } from "./hash.mjs";
6
3
  import { peikertXHdWalletGenerator } from "./hd.mjs";
7
4
  import { sha512 } from "@noble/hashes/sha2.js";
8
5
  import * as ed from "@noble/ed25519";
6
+ import { ed25519 } from "@noble/curves/ed25519.js";
7
+ import { bytesToNumberLE, numberToBytesLE } from "@noble/curves/utils.js";
8
+ import { mod } from "@noble/curves/abstract/modular.js";
9
9
 
10
10
  //#region packages/crypto/src/index.ts
11
11
  const ED25519_SEED_LENGTH = 32;