@aztec/accounts 0.82.2 → 0.82.3

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.
Files changed (37) hide show
  1. package/artifacts/EcdsaKAccount.json +479 -475
  2. package/artifacts/EcdsaRAccount.json +783 -779
  3. package/artifacts/SchnorrAccount.json +597 -593
  4. package/artifacts/SchnorrSingleKeyAccount.json +174 -174
  5. package/dest/ecdsa/ecdsa_r/account_contract.d.ts +21 -0
  6. package/dest/ecdsa/ecdsa_r/account_contract.d.ts.map +1 -0
  7. package/dest/ecdsa/ecdsa_r/account_contract.js +41 -0
  8. package/dest/ecdsa/ecdsa_r/index.d.ts +43 -0
  9. package/dest/ecdsa/ecdsa_r/index.d.ts.map +1 -0
  10. package/dest/ecdsa/ecdsa_r/index.js +44 -0
  11. package/dest/ecdsa/ecdsa_r/lazy.d.ts +47 -0
  12. package/dest/ecdsa/ecdsa_r/lazy.d.ts.map +1 -0
  13. package/dest/ecdsa/ecdsa_r/lazy.js +52 -0
  14. package/dest/ecdsa/index.d.ts +1 -0
  15. package/dest/ecdsa/index.d.ts.map +1 -1
  16. package/dest/ecdsa/index.js +1 -0
  17. package/dest/ecdsa/lazy.d.ts +1 -0
  18. package/dest/ecdsa/lazy.d.ts.map +1 -1
  19. package/dest/ecdsa/lazy.js +1 -0
  20. package/dest/ecdsa/ssh_ecdsa_r/index.d.ts +0 -1
  21. package/dest/ecdsa/ssh_ecdsa_r/index.d.ts.map +1 -1
  22. package/dest/ecdsa/ssh_ecdsa_r/index.js +1 -5
  23. package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts +0 -4
  24. package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts.map +1 -1
  25. package/dest/ecdsa/ssh_ecdsa_r/lazy.js +1 -15
  26. package/dest/testing/index.d.ts +7 -1
  27. package/dest/testing/index.d.ts.map +1 -1
  28. package/dest/testing/index.js +9 -5
  29. package/package.json +6 -6
  30. package/src/ecdsa/ecdsa_r/account_contract.ts +42 -0
  31. package/src/ecdsa/ecdsa_r/index.ts +63 -0
  32. package/src/ecdsa/ecdsa_r/lazy.ts +71 -0
  33. package/src/ecdsa/index.ts +1 -0
  34. package/src/ecdsa/lazy.ts +1 -0
  35. package/src/ecdsa/ssh_ecdsa_r/index.ts +1 -7
  36. package/src/ecdsa/ssh_ecdsa_r/lazy.ts +1 -18
  37. package/src/testing/index.ts +16 -11
@@ -1,2 +1,3 @@
1
1
  export * from './ecdsa_k/index.js';
2
+ export * from './ecdsa_r/index.js';
2
3
  export * from './ssh_ecdsa_r/index.js';
package/src/ecdsa/lazy.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './ecdsa_k/lazy.js';
2
+ export * from './ecdsa_r/lazy.js';
2
3
  export * from './ssh_ecdsa_r/lazy.js';
@@ -8,18 +8,12 @@ import { AccountManager, type Salt } from '@aztec/aztec.js/account';
8
8
  import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
9
9
  import { Fr } from '@aztec/foundation/fields';
10
10
  import type { ContractArtifact } from '@aztec/stdlib/abi';
11
- import { loadContractArtifact } from '@aztec/stdlib/abi';
12
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
12
  import type { PXE } from '@aztec/stdlib/interfaces/client';
14
- import type { NoirCompiledContract } from '@aztec/stdlib/noir';
15
13
 
16
- import EcdsaRAccountContractJson from '../../../artifacts/EcdsaKAccount.json' assert { type: 'json' };
14
+ import { EcdsaRAccountContractArtifact } from '../ecdsa_r/index.js';
17
15
  import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
18
16
 
19
- export const EcdsaRAccountContractArtifact: ContractArtifact = loadContractArtifact(
20
- EcdsaRAccountContractJson as NoirCompiledContract,
21
- );
22
-
23
17
  /**
24
18
  * Account contract that authenticates transactions using ECDSA signatures
25
19
  * verified against a secp256r1 public key stored in an immutable encrypted note.
@@ -8,29 +8,12 @@ import { AccountManager, type Salt } from '@aztec/aztec.js/account';
8
8
  import { type AccountWallet, getWallet } from '@aztec/aztec.js/wallet';
9
9
  import { Fr } from '@aztec/foundation/fields';
10
10
  import type { ContractArtifact } from '@aztec/stdlib/abi';
11
- import { loadContractArtifact } from '@aztec/stdlib/abi';
12
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
12
  import type { PXE } from '@aztec/stdlib/interfaces/client';
14
13
 
14
+ import { getEcdsaRAccountContractArtifact } from '../ecdsa_r/lazy.js';
15
15
  import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
16
16
 
17
- /*
18
- * Lazily loads the contract artifact
19
- * @returns The contract artifact for the ecdsa R account contract
20
- */
21
- /**
22
- *
23
- */
24
- export async function getEcdsaRAccountContractArtifact() {
25
- // Cannot assert this import as it's incompatible with browsers
26
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
27
- // Use the new "with" syntax once supported by firefox
28
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
29
- // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
30
- const { default: ecdsaKAccountContractJson } = await import('../../../artifacts/EcdsaRAccount.json');
31
- return loadContractArtifact(ecdsaKAccountContractJson);
32
- }
33
-
34
17
  /**
35
18
  * Account contract that authenticates transactions using ECDSA signatures
36
19
  * verified against a secp256r1 public key stored in an immutable encrypted note.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @packageDocumentation
7
7
  */
8
- import type { PXE } from '@aztec/aztec.js';
8
+ import { AccountManager, type PXE } from '@aztec/aztec.js';
9
9
  import type { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
10
10
 
11
11
  import {
@@ -47,22 +47,27 @@ export function getInitialTestAccounts(): Promise<InitialAccountData[]> {
47
47
  );
48
48
  }
49
49
 
50
+ /**
51
+ * Gets a collection of account managers for the Aztec accounts that are initially stored in the test environment.
52
+ * @param pxe - PXE instance.
53
+ * @returns A set of AccountManager implementations for each of the initial accounts.
54
+ */
55
+ export function getInitialTestAccountsManagers(pxe: PXE): Promise<AccountManager[]> {
56
+ return Promise.all(
57
+ INITIAL_TEST_SECRET_KEYS.map((encryptionKey, i) =>
58
+ getSchnorrAccount(pxe, encryptionKey!, INITIAL_TEST_SIGNING_KEYS[i]!, INITIAL_TEST_ACCOUNT_SALTS[i]),
59
+ ),
60
+ );
61
+ }
62
+
50
63
  /**
51
64
  * Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment.
52
65
  * @param pxe - PXE instance.
53
66
  * @returns A set of AccountWallet implementations for each of the initial accounts.
54
67
  */
55
- export function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]> {
68
+ export async function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]> {
56
69
  return Promise.all(
57
- INITIAL_TEST_SECRET_KEYS.map(async (encryptionKey, i) => {
58
- const account = await getSchnorrAccount(
59
- pxe,
60
- encryptionKey!,
61
- INITIAL_TEST_SIGNING_KEYS[i]!,
62
- INITIAL_TEST_ACCOUNT_SALTS[i],
63
- );
64
- return account.getWallet();
65
- }),
70
+ (await Promise.all(await getInitialTestAccountsManagers(pxe))).map(accountManager => accountManager.getWallet()),
66
71
  );
67
72
  }
68
73