@aztec/accounts 0.0.0-test.1 → 0.0.1-commit.017a351

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 (139) hide show
  1. package/README.md +1 -2
  2. package/artifacts/EcdsaKAccount.json +9402 -3941
  3. package/artifacts/EcdsaRAccount.json +9622 -4161
  4. package/artifacts/SchnorrAccount.json +9534 -4113
  5. package/artifacts/SimulatedEcdsaAccount.json +10122 -0
  6. package/artifacts/SimulatedSchnorrAccount.d.json.ts +3 -0
  7. package/artifacts/SimulatedSchnorrAccount.json +10214 -0
  8. package/dest/defaults/account_contract.d.ts +10 -5
  9. package/dest/defaults/account_contract.d.ts.map +1 -1
  10. package/dest/defaults/account_contract.js +5 -3
  11. package/dest/defaults/index.d.ts +2 -3
  12. package/dest/defaults/index.d.ts.map +1 -1
  13. package/dest/defaults/index.js +2 -3
  14. package/dest/ecdsa/ecdsa_k/account_contract.d.ts +5 -4
  15. package/dest/ecdsa/ecdsa_k/account_contract.d.ts.map +1 -1
  16. package/dest/ecdsa/ecdsa_k/account_contract.js +13 -6
  17. package/dest/ecdsa/ecdsa_k/index.d.ts +1 -25
  18. package/dest/ecdsa/ecdsa_k/index.d.ts.map +1 -1
  19. package/dest/ecdsa/ecdsa_k/index.js +2 -23
  20. package/dest/ecdsa/ecdsa_k/lazy.d.ts +1 -25
  21. package/dest/ecdsa/ecdsa_k/lazy.d.ts.map +1 -1
  22. package/dest/ecdsa/ecdsa_k/lazy.js +5 -26
  23. package/dest/ecdsa/ecdsa_r/account_contract.d.ts +19 -0
  24. package/dest/ecdsa/ecdsa_r/account_contract.d.ts.map +1 -0
  25. package/dest/ecdsa/ecdsa_r/account_contract.js +45 -0
  26. package/dest/ecdsa/ecdsa_r/index.d.ts +19 -0
  27. package/dest/ecdsa/ecdsa_r/index.d.ts.map +1 -0
  28. package/dest/ecdsa/ecdsa_r/index.js +23 -0
  29. package/dest/ecdsa/ecdsa_r/lazy.d.ts +23 -0
  30. package/dest/ecdsa/ecdsa_r/lazy.d.ts.map +1 -0
  31. package/dest/ecdsa/ecdsa_r/lazy.js +31 -0
  32. package/dest/ecdsa/index.d.ts +2 -1
  33. package/dest/ecdsa/index.d.ts.map +1 -1
  34. package/dest/ecdsa/index.js +1 -0
  35. package/dest/ecdsa/lazy.d.ts +2 -1
  36. package/dest/ecdsa/lazy.d.ts.map +1 -1
  37. package/dest/ecdsa/lazy.js +1 -0
  38. package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +5 -4
  39. package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts.map +1 -1
  40. package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +13 -6
  41. package/dest/ecdsa/ssh_ecdsa_r/index.d.ts +2 -27
  42. package/dest/ecdsa/ssh_ecdsa_r/index.d.ts.map +1 -1
  43. package/dest/ecdsa/ssh_ecdsa_r/index.js +3 -28
  44. package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts +2 -30
  45. package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts.map +1 -1
  46. package/dest/ecdsa/ssh_ecdsa_r/lazy.js +3 -38
  47. package/dest/schnorr/account_contract.d.ts +7 -3
  48. package/dest/schnorr/account_contract.d.ts.map +1 -1
  49. package/dest/schnorr/account_contract.js +11 -10
  50. package/dest/schnorr/index.d.ts +4 -38
  51. package/dest/schnorr/index.d.ts.map +1 -1
  52. package/dest/schnorr/index.js +2 -33
  53. package/dest/schnorr/lazy.d.ts +4 -38
  54. package/dest/schnorr/lazy.d.ts.map +1 -1
  55. package/dest/schnorr/lazy.js +5 -36
  56. package/dest/stub/account_contract.d.ts +29 -0
  57. package/dest/stub/account_contract.d.ts.map +1 -0
  58. package/dest/stub/account_contract.js +30 -0
  59. package/dest/stub/ecdsa/index.d.ts +11 -0
  60. package/dest/stub/ecdsa/index.d.ts.map +1 -0
  61. package/dest/stub/ecdsa/index.js +18 -0
  62. package/dest/stub/ecdsa/lazy.d.ts +14 -0
  63. package/dest/stub/ecdsa/lazy.d.ts.map +1 -0
  64. package/dest/stub/ecdsa/lazy.js +22 -0
  65. package/dest/stub/schnorr/index.d.ts +11 -0
  66. package/dest/stub/schnorr/index.d.ts.map +1 -0
  67. package/dest/stub/schnorr/index.js +18 -0
  68. package/dest/stub/schnorr/lazy.d.ts +14 -0
  69. package/dest/stub/schnorr/lazy.d.ts.map +1 -0
  70. package/dest/stub/schnorr/lazy.js +22 -0
  71. package/dest/testing/configuration.d.ts +5 -4
  72. package/dest/testing/configuration.d.ts.map +1 -1
  73. package/dest/testing/configuration.js +1 -1
  74. package/dest/testing/index.d.ts +6 -30
  75. package/dest/testing/index.d.ts.map +1 -1
  76. package/dest/testing/index.js +18 -30
  77. package/dest/testing/lazy.d.ts +5 -28
  78. package/dest/testing/lazy.d.ts.map +1 -1
  79. package/dest/testing/lazy.js +19 -30
  80. package/dest/utils/index.d.ts +1 -1
  81. package/dest/utils/ssh_agent.d.ts +2 -5
  82. package/dest/utils/ssh_agent.d.ts.map +1 -1
  83. package/dest/utils/ssh_agent.js +2 -0
  84. package/package.json +28 -23
  85. package/src/defaults/account_contract.ts +19 -7
  86. package/src/defaults/index.ts +1 -2
  87. package/src/ecdsa/ecdsa_k/account_contract.ts +7 -4
  88. package/src/ecdsa/ecdsa_k/index.ts +1 -33
  89. package/src/ecdsa/ecdsa_k/lazy.ts +4 -36
  90. package/src/ecdsa/ecdsa_r/account_contract.ts +42 -0
  91. package/src/ecdsa/ecdsa_r/index.ts +31 -0
  92. package/src/ecdsa/ecdsa_r/lazy.ts +39 -0
  93. package/src/ecdsa/index.ts +1 -0
  94. package/src/ecdsa/lazy.ts +1 -0
  95. package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +7 -4
  96. package/src/ecdsa/ssh_ecdsa_r/index.ts +3 -42
  97. package/src/ecdsa/ssh_ecdsa_r/lazy.ts +3 -53
  98. package/src/schnorr/account_contract.ts +7 -6
  99. package/src/schnorr/index.ts +10 -57
  100. package/src/schnorr/lazy.ts +13 -60
  101. package/src/stub/account_contract.ts +39 -0
  102. package/src/stub/ecdsa/index.ts +28 -0
  103. package/src/stub/ecdsa/lazy.ts +34 -0
  104. package/src/stub/schnorr/index.ts +30 -0
  105. package/src/stub/schnorr/lazy.ts +34 -0
  106. package/src/testing/configuration.ts +2 -1
  107. package/src/testing/index.ts +19 -51
  108. package/src/testing/lazy.ts +18 -50
  109. package/src/utils/ssh_agent.ts +2 -0
  110. package/artifacts/SchnorrSingleKeyAccount.json +0 -3937
  111. package/dest/dapp/dapp_interface.d.ts +0 -10
  112. package/dest/dapp/dapp_interface.d.ts.map +0 -1
  113. package/dest/dapp/dapp_interface.js +0 -16
  114. package/dest/dapp/index.d.ts +0 -2
  115. package/dest/dapp/index.d.ts.map +0 -1
  116. package/dest/dapp/index.js +0 -1
  117. package/dest/defaults/account_interface.d.ts +0 -27
  118. package/dest/defaults/account_interface.d.ts.map +0 -1
  119. package/dest/defaults/account_interface.js +0 -37
  120. package/dest/single_key/account_contract.d.ts +0 -17
  121. package/dest/single_key/account_contract.d.ts.map +0 -1
  122. package/dest/single_key/account_contract.js +0 -42
  123. package/dest/single_key/index.d.ts +0 -39
  124. package/dest/single_key/index.d.ts.map +0 -1
  125. package/dest/single_key/index.js +0 -45
  126. package/dest/single_key/lazy.d.ts +0 -43
  127. package/dest/single_key/lazy.d.ts.map +0 -1
  128. package/dest/single_key/lazy.js +0 -53
  129. package/dest/testing/create_account.d.ts +0 -43
  130. package/dest/testing/create_account.d.ts.map +0 -1
  131. package/dest/testing/create_account.js +0 -58
  132. package/src/dapp/dapp_interface.ts +0 -38
  133. package/src/dapp/index.ts +0 -1
  134. package/src/defaults/account_interface.ts +0 -59
  135. package/src/single_key/account_contract.ts +0 -43
  136. package/src/single_key/index.ts +0 -63
  137. package/src/single_key/lazy.ts +0 -71
  138. package/src/testing/create_account.ts +0 -93
  139. /package/artifacts/{SchnorrSingleKeyAccount.d.json.ts → SimulatedEcdsaAccount.d.json.ts} +0 -0
@@ -0,0 +1,18 @@
1
+ import { BaseAccount } from '@aztec/aztec.js/account';
2
+ import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
3
+ import { loadContractArtifact } from '@aztec/stdlib/abi';
4
+ import SimulatedEcdsaAccountJson from '../../../artifacts/SimulatedEcdsaAccount.json' with {
5
+ type: 'json'
6
+ };
7
+ import { StubBaseAccountContract } from '../account_contract.js';
8
+ export const StubEcdsaAccountContractArtifact = loadContractArtifact(SimulatedEcdsaAccountJson);
9
+ /** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Eagerly loads the contract artifact. */ export class StubEcdsaAccountContract extends StubBaseAccountContract {
10
+ getContractArtifact() {
11
+ return Promise.resolve(StubEcdsaAccountContractArtifact);
12
+ }
13
+ }
14
+ /** Creates an ECDSA stub account that impersonates the one with the provided address. */ export function createStubEcdsaAccount(originalAddress) {
15
+ const accountContract = new StubEcdsaAccountContract();
16
+ const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
17
+ return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
18
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseAccount } from '@aztec/aztec.js/account';
2
+ import type { CompleteAddress } from '@aztec/aztec.js/addresses';
3
+ import { StubBaseAccountContract } from '../account_contract.js';
4
+ /**
5
+ * Lazily loads the ECDSA stub contract artifact (browser-compatible).
6
+ */
7
+ export declare function getStubEcdsaAccountContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
8
+ /** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Lazily loads the contract artifact. */
9
+ export declare class StubEcdsaAccountContract extends StubBaseAccountContract {
10
+ getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
11
+ }
12
+ /** Creates an ECDSA stub account that impersonates the one with the provided address. */
13
+ export declare function createStubEcdsaAccount(originalAddress: CompleteAddress): BaseAccount;
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0dWIvZWNkc2EvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFJakUsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFakU7O0dBRUc7QUFDSCx3QkFBc0IsbUNBQW1DLDBEQUt4RDtBQUVELDhHQUE4RztBQUM5RyxxQkFBYSx3QkFBeUIsU0FBUSx1QkFBdUI7SUFDMUQsbUJBQW1CLDBEQUUzQjtDQUNGO0FBRUQseUZBQXlGO0FBQ3pGLHdCQUFnQixzQkFBc0IsQ0FBQyxlQUFlLEVBQUUsZUFBZSxlQVF0RSJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/stub/ecdsa/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,wBAAsB,mCAAmC,0DAKxD;AAED,8GAA8G;AAC9G,qBAAa,wBAAyB,SAAQ,uBAAuB;IAC1D,mBAAmB,0DAE3B;CACF;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,eAAe,eAQtE"}
@@ -0,0 +1,22 @@
1
+ import { BaseAccount } from '@aztec/aztec.js/account';
2
+ import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
3
+ import { loadContractArtifact } from '@aztec/stdlib/abi';
4
+ import { StubBaseAccountContract } from '../account_contract.js';
5
+ /**
6
+ * Lazily loads the ECDSA stub contract artifact (browser-compatible).
7
+ */ export async function getStubEcdsaAccountContractArtifact() {
8
+ // Cannot assert this import as it's incompatible with bundlers like vite
9
+ // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
10
+ const { default: json } = await import('../../../artifacts/SimulatedEcdsaAccount.json');
11
+ return loadContractArtifact(json);
12
+ }
13
+ /** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Lazily loads the contract artifact. */ export class StubEcdsaAccountContract extends StubBaseAccountContract {
14
+ getContractArtifact() {
15
+ return getStubEcdsaAccountContractArtifact();
16
+ }
17
+ }
18
+ /** Creates an ECDSA stub account that impersonates the one with the provided address. */ export function createStubEcdsaAccount(originalAddress) {
19
+ const accountContract = new StubEcdsaAccountContract();
20
+ const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
21
+ return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
22
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseAccount } from '@aztec/aztec.js/account';
2
+ import type { CompleteAddress } from '@aztec/aztec.js/addresses';
3
+ import { StubBaseAccountContract } from '../account_contract.js';
4
+ export declare const StubSchnorrAccountContractArtifact: import("@aztec/stdlib/abi").ContractArtifact;
5
+ /** Stub account contract for Schnorr accounts. Eagerly loads the contract artifact. */
6
+ export declare class StubSchnorrAccountContract extends StubBaseAccountContract {
7
+ getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
8
+ }
9
+ /** Creates a Schnorr stub account that impersonates the one with the provided address. */
10
+ export declare function createStubSchnorrAccount(originalAddress: CompleteAddress): BaseAccount;
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdHViL3NjaG5vcnIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBTWpFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRWpFLGVBQU8sTUFBTSxrQ0FBa0MsOENBRTlDLENBQUM7QUFFRix1RkFBdUY7QUFDdkYscUJBQWEsMEJBQTJCLFNBQVEsdUJBQXVCO0lBQzVELG1CQUFtQiwwREFFM0I7Q0FDRjtBQUVELDBGQUEwRjtBQUMxRix3QkFBZ0Isd0JBQXdCLENBQUMsZUFBZSxFQUFFLGVBQWUsZUFReEUifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/schnorr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,eAAO,MAAM,kCAAkC,8CAE9C,CAAC;AAEF,uFAAuF;AACvF,qBAAa,0BAA2B,SAAQ,uBAAuB;IAC5D,mBAAmB,0DAE3B;CACF;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,eAQxE"}
@@ -0,0 +1,18 @@
1
+ import { BaseAccount } from '@aztec/aztec.js/account';
2
+ import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
3
+ import { loadContractArtifact } from '@aztec/stdlib/abi';
4
+ import SimulatedSchnorrAccountJson from '../../../artifacts/SimulatedSchnorrAccount.json' with {
5
+ type: 'json'
6
+ };
7
+ import { StubBaseAccountContract } from '../account_contract.js';
8
+ export const StubSchnorrAccountContractArtifact = loadContractArtifact(SimulatedSchnorrAccountJson);
9
+ /** Stub account contract for Schnorr accounts. Eagerly loads the contract artifact. */ export class StubSchnorrAccountContract extends StubBaseAccountContract {
10
+ getContractArtifact() {
11
+ return Promise.resolve(StubSchnorrAccountContractArtifact);
12
+ }
13
+ }
14
+ /** Creates a Schnorr stub account that impersonates the one with the provided address. */ export function createStubSchnorrAccount(originalAddress) {
15
+ const accountContract = new StubSchnorrAccountContract();
16
+ const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
17
+ return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
18
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseAccount } from '@aztec/aztec.js/account';
2
+ import type { CompleteAddress } from '@aztec/aztec.js/addresses';
3
+ import { StubBaseAccountContract } from '../account_contract.js';
4
+ /**
5
+ * Lazily loads the Schnorr stub contract artifact (browser-compatible).
6
+ */
7
+ export declare function getStubSchnorrAccountContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
8
+ /** Stub account contract for Schnorr accounts. Lazily loads the contract artifact. */
9
+ export declare class StubSchnorrAccountContract extends StubBaseAccountContract {
10
+ getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
11
+ }
12
+ /** Creates a Schnorr stub account that impersonates the one with the provided address. */
13
+ export declare function createStubSchnorrAccount(originalAddress: CompleteAddress): BaseAccount;
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0dWIvc2Nobm9yci9sYXp5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUlqRSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVqRTs7R0FFRztBQUNILHdCQUFzQixxQ0FBcUMsMERBSzFEO0FBRUQsc0ZBQXNGO0FBQ3RGLHFCQUFhLDBCQUEyQixTQUFRLHVCQUF1QjtJQUM1RCxtQkFBbUIsMERBRTNCO0NBQ0Y7QUFFRCwwRkFBMEY7QUFDMUYsd0JBQWdCLHdCQUF3QixDQUFDLGVBQWUsRUFBRSxlQUFlLGVBUXhFIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/stub/schnorr/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,wBAAsB,qCAAqC,0DAK1D;AAED,sFAAsF;AACtF,qBAAa,0BAA2B,SAAQ,uBAAuB;IAC5D,mBAAmB,0DAE3B;CACF;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,eAQxE"}
@@ -0,0 +1,22 @@
1
+ import { BaseAccount } from '@aztec/aztec.js/account';
2
+ import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
3
+ import { loadContractArtifact } from '@aztec/stdlib/abi';
4
+ import { StubBaseAccountContract } from '../account_contract.js';
5
+ /**
6
+ * Lazily loads the Schnorr stub contract artifact (browser-compatible).
7
+ */ export async function getStubSchnorrAccountContractArtifact() {
8
+ // Cannot assert this import as it's incompatible with bundlers like vite
9
+ // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
10
+ const { default: json } = await import('../../../artifacts/SimulatedSchnorrAccount.json');
11
+ return loadContractArtifact(json);
12
+ }
13
+ /** Stub account contract for Schnorr accounts. Lazily loads the contract artifact. */ export class StubSchnorrAccountContract extends StubBaseAccountContract {
14
+ getContractArtifact() {
15
+ return getStubSchnorrAccountContractArtifact();
16
+ }
17
+ }
18
+ /** Creates a Schnorr stub account that impersonates the one with the provided address. */ export function createStubSchnorrAccount(originalAddress) {
19
+ const accountContract = new StubSchnorrAccountContract();
20
+ const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
21
+ return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
22
+ }
@@ -1,8 +1,9 @@
1
- import { Fr, GrumpkinScalar } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
2
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
4
  export declare const INITIAL_TEST_SECRET_KEYS: Fr[];
4
- export declare const INITIAL_TEST_ENCRYPTION_KEYS: import("@aztec/foundation/fields").Fq[];
5
- export declare const INITIAL_TEST_SIGNING_KEYS: import("@aztec/foundation/fields").Fq[];
5
+ export declare const INITIAL_TEST_ENCRYPTION_KEYS: import("@aztec/foundation/curves/bn254").Fq[];
6
+ export declare const INITIAL_TEST_SIGNING_KEYS: import("@aztec/foundation/curves/bn254").Fq[];
6
7
  export declare const INITIAL_TEST_ACCOUNT_SALTS: Fr[];
7
8
  /**
8
9
  * Data for generating an initial account.
@@ -25,4 +26,4 @@ export interface InitialAccountData {
25
26
  */
26
27
  address: AztecAddress;
27
28
  }
28
- //# sourceMappingURL=configuration.d.ts.map
29
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvY29uZmlndXJhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBR2hFLGVBQU8sTUFBTSx3QkFBd0IsTUFJcEMsQ0FBQztBQUVGLGVBQU8sTUFBTSw0QkFBNEIsK0NBRXhDLENBQUM7QUFFRixlQUFPLE1BQU0seUJBQXlCLCtDQUErQixDQUFDO0FBRXRFLGVBQU8sTUFBTSwwQkFBMEIsTUFBOEIsQ0FBQztBQUV0RTs7R0FFRztBQUNILE1BQU0sV0FBVyxrQkFBa0I7SUFDakM7O09BRUc7SUFDSCxNQUFNLEVBQUUsRUFBRSxDQUFDO0lBQ1g7O09BRUc7SUFDSCxVQUFVLEVBQUUsY0FBYyxDQUFDO0lBQzNCOztPQUVHO0lBQ0gsSUFBSSxFQUFFLEVBQUUsQ0FBQztJQUNUOztPQUVHO0lBQ0gsT0FBTyxFQUFFLFlBQVksQ0FBQztDQUN2QiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/testing/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,eAAO,MAAM,wBAAwB,MAIpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,yCAExC,CAAC;AAEF,eAAO,MAAM,yBAAyB,yCAA+B,CAAC;AAEtE,eAAO,MAAM,0BAA0B,MAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,EAAE,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,EAAE,CAAC;IACT;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;CACvB"}
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/testing/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,eAAO,MAAM,wBAAwB,MAIpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,+CAExC,CAAC;AAEF,eAAO,MAAM,yBAAyB,+CAA+B,CAAC;AAEtE,eAAO,MAAM,0BAA0B,MAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,EAAE,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,EAAE,CAAC;IACT;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;CACvB"}
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
3
3
  export const INITIAL_TEST_SECRET_KEYS = [
4
4
  Fr.fromHexString('2153536ff6628eee01cf4024889ff977a18d9fa61d0e414422f7681cf085c281'),
@@ -1,35 +1,11 @@
1
- /**
2
- * The `@aztec/accounts/testing` export provides utility methods for testing, in particular in a Sandbox environment.
3
- *
4
- * Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
5
- *
6
- * @packageDocumentation
7
- */
8
- import type { PXE } from '@aztec/aztec.js';
9
- import type { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
10
- import type { InitialAccountData } from './configuration.js';
11
- export { type InitialAccountData, INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS, } from './configuration.js';
1
+ import { type InitialAccountData } from './configuration.js';
2
+ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS, type InitialAccountData, } from './configuration.js';
12
3
  /**
13
4
  * Gets the basic information for initial test accounts.
14
5
  */
15
- export declare function getInitialTestAccounts(): Promise<InitialAccountData[]>;
16
- /**
17
- * Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment.
18
- * @param pxe - PXE instance.
19
- * @returns A set of AccountWallet implementations for each of the initial accounts.
20
- */
21
- export declare function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]>;
22
- /**
23
- * Queries a PXE for it's registered accounts.
24
- * @param pxe - PXE instance.
25
- * @returns A set of key data for each of the initial accounts.
26
- */
27
- export declare function getDeployedTestAccounts(pxe: PXE): Promise<InitialAccountData[]>;
6
+ export declare function getInitialTestAccountsData(): Promise<InitialAccountData[]>;
28
7
  /**
29
- * Queries a PXE for it's registered accounts and returns wallets for those accounts using keys in the initial test accounts.
30
- * @param pxe - PXE instance.
31
- * @returns A set of AccountWallet implementations for each of the initial accounts.
8
+ * Generate a fixed amount of random schnorr account contract instance.
32
9
  */
33
- export declare function getDeployedTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]>;
34
- export { deployFundedSchnorrAccount, deployFundedSchnorrAccounts, generateSchnorrAccounts } from './create_account.js';
35
- //# sourceMappingURL=index.d.ts.map
10
+ export declare function generateSchnorrAccounts(numberOfAccounts: number): Promise<Promise<InitialAccountData[]>>;
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVNBLE9BQU8sRUFLTCxLQUFLLGtCQUFrQixFQUN4QixNQUFNLG9CQUFvQixDQUFDO0FBRTVCLE9BQU8sRUFDTCwwQkFBMEIsRUFDMUIsNEJBQTRCLEVBQzVCLHdCQUF3QixFQUN4Qix5QkFBeUIsRUFDekIsS0FBSyxrQkFBa0IsR0FDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQUU1Qjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWExRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUFDLGdCQUFnQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0FBQyxDQWE5RyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAOzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQ7D,OAAO,EACL,KAAK,kBAAkB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAatE;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAY7F;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAIrF;AAED;;;;GAIG;AACH,wBAAsB,8BAA8B,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAKpG;AAED,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAa1E;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAa9G"}
@@ -1,15 +1,15 @@
1
1
  /**
2
- * The `@aztec/accounts/testing` export provides utility methods for testing, in particular in a Sandbox environment.
3
- *
4
- * Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
2
+ * The `@aztec/accounts/testing` export provides utility methods for testing, in particular in a local network environment.
5
3
  *
6
4
  * @packageDocumentation
7
- */ import { getSchnorrAccount, getSchnorrAccountContractAddress, getSchnorrWalletWithSecretKey } from '../schnorr/index.js';
5
+ */ import { Fr } from '@aztec/aztec.js/fields';
6
+ import { deriveSigningKey } from '@aztec/stdlib/keys';
7
+ import { getSchnorrAccountContractAddress } from '../schnorr/index.js';
8
8
  import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
9
9
  export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
10
10
  /**
11
11
  * Gets the basic information for initial test accounts.
12
- */ export function getInitialTestAccounts() {
12
+ */ export function getInitialTestAccountsData() {
13
13
  return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (secret, i)=>({
14
14
  secret,
15
15
  signingKey: INITIAL_TEST_ENCRYPTION_KEYS[i],
@@ -18,30 +18,18 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_
18
18
  })));
19
19
  }
20
20
  /**
21
- * Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment.
22
- * @param pxe - PXE instance.
23
- * @returns A set of AccountWallet implementations for each of the initial accounts.
24
- */ export function getInitialTestAccountsWallets(pxe) {
25
- return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (encryptionKey, i)=>{
26
- const account = await getSchnorrAccount(pxe, encryptionKey, INITIAL_TEST_SIGNING_KEYS[i], INITIAL_TEST_ACCOUNT_SALTS[i]);
27
- return account.getWallet();
21
+ * Generate a fixed amount of random schnorr account contract instance.
22
+ */ export async function generateSchnorrAccounts(numberOfAccounts) {
23
+ const secrets = Array.from({
24
+ length: numberOfAccounts
25
+ }, ()=>Fr.random());
26
+ return await Promise.all(secrets.map(async (secret)=>{
27
+ const salt = Fr.random();
28
+ return {
29
+ secret,
30
+ signingKey: deriveSigningKey(secret),
31
+ salt,
32
+ address: await getSchnorrAccountContractAddress(secret, salt)
33
+ };
28
34
  }));
29
35
  }
30
- /**
31
- * Queries a PXE for it's registered accounts.
32
- * @param pxe - PXE instance.
33
- * @returns A set of key data for each of the initial accounts.
34
- */ export async function getDeployedTestAccounts(pxe) {
35
- const registeredAccounts = await pxe.getRegisteredAccounts();
36
- const testAccounts = await getInitialTestAccounts();
37
- return testAccounts.filter((t)=>registeredAccounts.some((r)=>r.address.equals(t.address)));
38
- }
39
- /**
40
- * Queries a PXE for it's registered accounts and returns wallets for those accounts using keys in the initial test accounts.
41
- * @param pxe - PXE instance.
42
- * @returns A set of AccountWallet implementations for each of the initial accounts.
43
- */ export async function getDeployedTestAccountsWallets(pxe) {
44
- const testAccounts = await getDeployedTestAccounts(pxe);
45
- return Promise.all(testAccounts.map(({ secret, signingKey, salt })=>getSchnorrWalletWithSecretKey(pxe, secret, signingKey, salt)));
46
- }
47
- export { deployFundedSchnorrAccount, deployFundedSchnorrAccounts, generateSchnorrAccounts } from './create_account.js';
@@ -1,34 +1,11 @@
1
- /**
2
- * The `@aztec/accounts/testing/lazy` export provides utility methods for testing, in particular in a Sandbox environment.
3
- *
4
- * Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
5
- *
6
- * @packageDocumentation
7
- */
8
- import type { PXE } from '@aztec/aztec.js';
9
- import type { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
10
1
  import { type InitialAccountData } from './configuration.js';
11
- export { type InitialAccountData, INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS, } from './configuration.js';
2
+ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configuration.js';
12
3
  /**
13
4
  * Gets the basic information for initial test accounts.
14
5
  */
15
- export declare function getInitialTestAccounts(): Promise<InitialAccountData[]>;
16
- /**
17
- * Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment.
18
- * @param pxe - PXE instance.
19
- * @returns A set of AccountWallet implementations for each of the initial accounts.
20
- */
21
- export declare function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]>;
22
- /**
23
- * Queries a PXE for it's registered accounts.
24
- * @param pxe - PXE instance.
25
- * @returns A set of key data for each of the initial accounts.
26
- */
27
- export declare function getDeployedTestAccounts(pxe: PXE): Promise<InitialAccountData[]>;
6
+ export declare function getInitialTestAccountsData(): Promise<InitialAccountData[]>;
28
7
  /**
29
- * Queries a PXE for it's registered accounts and returns wallets for those accounts using keys in the initial test accounts.
30
- * @param pxe - PXE instance.
31
- * @returns A set of AccountWallet implementations for each of the initial accounts.
8
+ * Generate a fixed amount of random schnorr account contract instance.
32
9
  */
33
- export declare function getDeployedTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]>;
34
- //# sourceMappingURL=lazy.d.ts.map
10
+ export declare function generateSchnorrAccounts(numberOfAccounts: number): Promise<InitialAccountData[]>;
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTQSxPQUFPLEVBS0wsS0FBSyxrQkFBa0IsRUFDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQUU1QixPQUFPLEVBQUUsMEJBQTBCLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUUxRjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWExRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUFDLGdCQUFnQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWFyRyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGzE,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,kBAAkB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAatE;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAY7F;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAIrF;AAED;;;;GAIG;AACH,wBAAsB,8BAA8B,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAKpG"}
1
+ {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE1F;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAa1E;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAarG"}
@@ -1,15 +1,15 @@
1
1
  /**
2
- * The `@aztec/accounts/testing/lazy` export provides utility methods for testing, in particular in a Sandbox environment.
3
- *
4
- * Use {@link getInitialTestAccountsWallets} to obtain a list of wallets for the Sandbox pre-seeded accounts.
2
+ * The `@aztec/accounts/testing/lazy` export provides utility methods for testing, in particular in a local network environment.
5
3
  *
6
4
  * @packageDocumentation
7
- */ import { getSchnorrAccount, getSchnorrAccountContractAddress, getSchnorrWalletWithSecretKey } from '../schnorr/lazy.js';
5
+ */ import { Fr } from '@aztec/aztec.js/fields';
6
+ import { deriveSigningKey } from '@aztec/stdlib/keys';
7
+ import { getSchnorrAccountContractAddress } from '../schnorr/lazy.js';
8
8
  import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
9
- export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
9
+ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configuration.js';
10
10
  /**
11
11
  * Gets the basic information for initial test accounts.
12
- */ export function getInitialTestAccounts() {
12
+ */ export function getInitialTestAccountsData() {
13
13
  return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (secret, i)=>({
14
14
  secret,
15
15
  signingKey: INITIAL_TEST_ENCRYPTION_KEYS[i],
@@ -18,29 +18,18 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_
18
18
  })));
19
19
  }
20
20
  /**
21
- * Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment.
22
- * @param pxe - PXE instance.
23
- * @returns A set of AccountWallet implementations for each of the initial accounts.
24
- */ export function getInitialTestAccountsWallets(pxe) {
25
- return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (encryptionKey, i)=>{
26
- const account = await getSchnorrAccount(pxe, encryptionKey, INITIAL_TEST_SIGNING_KEYS[i], INITIAL_TEST_ACCOUNT_SALTS[i]);
27
- return account.getWallet();
21
+ * Generate a fixed amount of random schnorr account contract instance.
22
+ */ export async function generateSchnorrAccounts(numberOfAccounts) {
23
+ const secrets = Array.from({
24
+ length: numberOfAccounts
25
+ }, ()=>Fr.random());
26
+ return await Promise.all(secrets.map(async (secret)=>{
27
+ const salt = Fr.random();
28
+ return {
29
+ secret,
30
+ signingKey: deriveSigningKey(secret),
31
+ salt,
32
+ address: await getSchnorrAccountContractAddress(secret, salt)
33
+ };
28
34
  }));
29
35
  }
30
- /**
31
- * Queries a PXE for it's registered accounts.
32
- * @param pxe - PXE instance.
33
- * @returns A set of key data for each of the initial accounts.
34
- */ export async function getDeployedTestAccounts(pxe) {
35
- const registeredAccounts = await pxe.getRegisteredAccounts();
36
- const testAccounts = await getInitialTestAccounts();
37
- return testAccounts.filter((t)=>registeredAccounts.some((r)=>r.address.equals(t.address)));
38
- }
39
- /**
40
- * Queries a PXE for it's registered accounts and returns wallets for those accounts using keys in the initial test accounts.
41
- * @param pxe - PXE instance.
42
- * @returns A set of AccountWallet implementations for each of the initial accounts.
43
- */ export async function getDeployedTestAccountsWallets(pxe) {
44
- const testAccounts = await getDeployedTestAccounts(pxe);
45
- return Promise.all(testAccounts.map(({ secret, signingKey, salt })=>getSchnorrWalletWithSecretKey(pxe, secret, signingKey, salt)));
46
- }
@@ -1,2 +1,2 @@
1
1
  export * from './ssh_agent.js';
2
- //# sourceMappingURL=index.d.ts.map
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGdCQUFnQixDQUFDIn0=
@@ -1,6 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
1
  import { Buffer } from 'buffer';
5
2
  import net from 'net';
6
3
  /**
@@ -31,6 +28,6 @@ export declare function getIdentities(): Promise<StoredKey[]>;
31
28
  /**
32
29
  * Sign data using a key stored in the SSH agent. The private signing key is identified by its corresponding public key.
33
30
  */
34
- export declare function signWithAgent(keyType: Buffer, curveName: Buffer, publicKey: Buffer, data: Buffer): Promise<Buffer>;
31
+ export declare function signWithAgent(keyType: Buffer, curveName: Buffer, publicKey: Buffer, data: Buffer): Promise<Buffer<ArrayBufferLike>>;
35
32
  export {};
36
- //# sourceMappingURL=ssh_agent.d.ts.map
33
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3NoX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvc3NoX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxRQUFRLENBQUM7QUFDaEMsT0FBTyxHQUFHLE1BQU0sS0FBSyxDQUFDO0FBT3RCOztHQUVHO0FBQ0gsd0JBQWdCLGNBQWMsZUFNN0I7QUFFRDs7R0FFRztBQUNILEtBQUssU0FBUyxHQUFHO0lBQ2Y7O09BRUc7SUFDSCxJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2I7O09BRUc7SUFDSCxTQUFTLEVBQUUsTUFBTSxDQUFDO0lBQ2xCOztPQUVHO0lBQ0gsT0FBTyxFQUFFLE1BQU0sQ0FBQztDQUNqQixDQUFDO0FBRUY7O0dBRUc7QUFDSCx3QkFBZ0IsYUFBYSxJQUFJLE9BQU8sQ0FBQyxTQUFTLEVBQUUsQ0FBQyxDQW1EcEQ7QUFFRDs7R0FFRztBQUNILHdCQUFnQixhQUFhLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLE1BQU0sb0NBeUNoRyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"ssh_agent.d.ts","sourceRoot":"","sources":["../../src/utils/ssh_agent.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AAOtB;;GAEG;AACH,wBAAgB,cAAc,eAM7B;AAED;;GAEG;AACH,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAkDpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAwChG"}
1
+ {"version":3,"file":"ssh_agent.d.ts","sourceRoot":"","sources":["../../src/utils/ssh_agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AAOtB;;GAEG;AACH,wBAAgB,cAAc,eAM7B;AAED;;GAEG;AACH,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAmDpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oCAyChG"}
@@ -18,6 +18,7 @@ const SSH_AGENT_SIGN_RESPONSE = 14;
18
18
  */ export function getIdentities() {
19
19
  return new Promise((resolve, reject)=>{
20
20
  const stream = connectToAgent();
21
+ stream.on('error', reject);
21
22
  stream.on('connect', ()=>{
22
23
  const request = Buffer.concat([
23
24
  Buffer.from([
@@ -78,6 +79,7 @@ const SSH_AGENT_SIGN_RESPONSE = 14;
78
79
  */ export function signWithAgent(keyType, curveName, publicKey, data) {
79
80
  return new Promise((resolve, reject)=>{
80
81
  const stream = connectToAgent();
82
+ stream.on('error', reject);
81
83
  stream.on('connect', ()=>{
82
84
  // Construct the key blob
83
85
  const keyBlob = Buffer.concat([
package/package.json CHANGED
@@ -2,19 +2,22 @@
2
2
  "name": "@aztec/accounts",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/accounts",
4
4
  "description": "Implementation of sample account contracts for Aztec Network",
5
- "version": "0.0.0-test.1",
5
+ "version": "0.0.1-commit.017a351",
6
6
  "type": "module",
7
7
  "exports": {
8
- "./dapp": "./dest/dapp/index.js",
9
8
  "./defaults": "./dest/defaults/index.js",
10
9
  "./ecdsa": "./dest/ecdsa/index.js",
11
10
  "./ecdsa/lazy": "./dest/ecdsa/lazy.js",
12
11
  "./schnorr": "./dest/schnorr/index.js",
13
12
  "./schnorr/lazy": "./dest/schnorr/lazy.js",
14
- "./single_key": "./dest/single_key/index.js",
15
- "./single_key/lazy": "./dest/single_key/lazy.js",
13
+ "./stub/schnorr": "./dest/stub/schnorr/index.js",
14
+ "./stub/schnorr/lazy": "./dest/stub/schnorr/lazy.js",
15
+ "./stub/ecdsa": "./dest/stub/ecdsa/index.js",
16
+ "./stub/ecdsa/lazy": "./dest/stub/ecdsa/lazy.js",
16
17
  "./testing": "./dest/testing/index.js",
17
18
  "./testing/lazy": "./dest/testing/lazy.js",
19
+ "./copy-cat": "./dest/copy_cat/index.js",
20
+ "./copy-cat/lazy": "./dest/copy_cat/lazy.js",
18
21
  "./utils": "./dest/utils/index.js"
19
22
  },
20
23
  "typedocOptions": {
@@ -22,21 +25,18 @@
22
25
  "./src/defaults/index.ts",
23
26
  "./src/ecdsa/index.ts",
24
27
  "./src/schnorr/index.ts",
25
- "./src/single_key/index.ts",
26
28
  "./src/testing/index.ts"
27
29
  ],
28
30
  "name": "Accounts",
29
31
  "tsconfig": "./tsconfig.json"
30
32
  },
31
33
  "scripts": {
32
- "build": "yarn clean && yarn generate && tsc -b",
34
+ "build": "yarn clean && yarn generate && ../scripts/tsc.sh",
33
35
  "generate": "yarn generate:noir-contracts",
34
36
  "generate:noir-contracts": "./scripts/copy-contracts.sh",
35
- "build:dev": "tsc -b --watch",
36
- "build:ts": "tsc -b",
37
+ "build:dev": "../scripts/tsc.sh --watch",
38
+ "build:ts": "../scripts/tsc.sh",
37
39
  "clean": "rm -rf ./dest .tsbuildinfo ./artifacts",
38
- "formatting": "run -T prettier --check ./src && run -T eslint ./src",
39
- "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
40
40
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
41
41
  },
42
42
  "inherits": [
@@ -74,25 +74,30 @@
74
74
  "testTimeout": 120000,
75
75
  "setupFiles": [
76
76
  "../../foundation/src/jest/setup.mjs"
77
+ ],
78
+ "testEnvironment": "../../foundation/src/jest/env.mjs",
79
+ "setupFilesAfterEnv": [
80
+ "../../foundation/src/jest/setupAfterEnv.mjs"
77
81
  ]
78
82
  },
79
83
  "dependencies": {
80
- "@aztec/aztec.js": "0.0.0-test.1",
81
- "@aztec/entrypoints": "0.0.0-test.1",
82
- "@aztec/ethereum": "0.0.0-test.1",
83
- "@aztec/foundation": "0.0.0-test.1",
84
- "@aztec/stdlib": "0.0.0-test.1",
84
+ "@aztec/aztec.js": "0.0.1-commit.017a351",
85
+ "@aztec/entrypoints": "0.0.1-commit.017a351",
86
+ "@aztec/ethereum": "0.0.1-commit.017a351",
87
+ "@aztec/foundation": "0.0.1-commit.017a351",
88
+ "@aztec/stdlib": "0.0.1-commit.017a351",
85
89
  "tslib": "^2.4.0"
86
90
  },
87
91
  "devDependencies": {
88
- "@jest/globals": "^29.5.0",
89
- "@types/jest": "^29.5.0",
90
- "@types/node": "^18.7.23",
91
- "jest": "^29.5.0",
92
- "jest-mock-extended": "^3.0.3",
93
- "ts-loader": "^9.4.4",
92
+ "@jest/globals": "^30.0.0",
93
+ "@types/jest": "^30.0.0",
94
+ "@types/node": "^22.15.17",
95
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
96
+ "jest": "^30.0.0",
97
+ "jest-mock-extended": "^4.0.0",
98
+ "ts-loader": "^9.5.4",
94
99
  "ts-node": "^10.9.1",
95
- "typescript": "^5.0.4"
100
+ "typescript": "^5.3.3"
96
101
  },
97
102
  "files": [
98
103
  "dest",
@@ -101,6 +106,6 @@
101
106
  "artifacts"
102
107
  ],
103
108
  "engines": {
104
- "node": ">=18"
109
+ "node": ">=20.10"
105
110
  }
106
111
  }
@@ -1,8 +1,7 @@
1
- import type { AccountContract, AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
1
+ import { type Account, type AccountContract, type AuthWitnessProvider, BaseAccount } from '@aztec/aztec.js/account';
2
+ import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
2
3
  import type { ContractArtifact } from '@aztec/stdlib/abi';
3
- import type { CompleteAddress, NodeInfo } from '@aztec/stdlib/contract';
4
-
5
- import { DefaultAccountInterface } from '../defaults/account_interface.js';
4
+ import type { CompleteAddress } from '@aztec/stdlib/contract';
6
5
 
7
6
  /**
8
7
  * Base class for implementing an account contract. Requires that the account uses the
@@ -10,12 +9,25 @@ import { DefaultAccountInterface } from '../defaults/account_interface.js';
10
9
  */
11
10
  export abstract class DefaultAccountContract implements AccountContract {
12
11
  abstract getAuthWitnessProvider(address: CompleteAddress): AuthWitnessProvider;
13
- abstract getDeploymentArgs(): Promise<any[] | undefined>;
12
+ abstract getInitializationFunctionAndArgs(): Promise<
13
+ | {
14
+ /** The name of the function used to initialize the contract */
15
+ constructorName: string;
16
+ /** The args to the function used to initialize the contract */
17
+ constructorArgs: any[];
18
+ }
19
+ | undefined
20
+ >;
14
21
  abstract getContractArtifact(): Promise<ContractArtifact>;
15
22
 
16
23
  constructor() {}
17
24
 
18
- getInterface(address: CompleteAddress, nodeInfo: NodeInfo): AccountInterface {
19
- return new DefaultAccountInterface(this.getAuthWitnessProvider(address), address, nodeInfo);
25
+ getAccount(completeAddress: CompleteAddress): Account {
26
+ const authWitnessProvider = this.getAuthWitnessProvider(completeAddress);
27
+ return new BaseAccount(
28
+ new DefaultAccountEntrypoint(completeAddress.address, authWitnessProvider),
29
+ authWitnessProvider,
30
+ completeAddress,
31
+ );
20
32
  }
21
33
  }
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * The `@aztec/accounts/defaults` export provides the base class {@link DefaultAccountContract} for implementing account contracts that use the default entrypoint payload module.
3
3
  *
4
- * Read more in {@link https://docs.aztec.network/developers/tutorials/codealong/contract_tutorials/write_accounts_contract | Writing an account contract}.
4
+ * Read more in {@link https://docs.aztec.network/developers/tutorials/contract_tutorials/counter_contract | Writing an account contract}.
5
5
  *
6
6
  * @packageDocumentation
7
7
  */
8
8
 
9
- export * from './account_interface.js';
10
9
  export * from './account_contract.js';