@aztec/accounts 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0

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 (131) hide show
  1. package/README.md +1 -2
  2. package/artifacts/EcdsaKAccount.json +10501 -4885
  3. package/artifacts/EcdsaRAccount.json +10521 -4905
  4. package/artifacts/SchnorrAccount.json +10632 -5192
  5. package/artifacts/SchnorrInitializerlessAccount.json +8526 -0
  6. package/artifacts/SimulatedEcdsaAccount.json +10976 -0
  7. package/artifacts/SimulatedSchnorrAccount.d.json.ts +3 -0
  8. package/artifacts/SimulatedSchnorrAccount.json +11088 -0
  9. package/dest/defaults/account_contract.d.ts +9 -3
  10. package/dest/defaults/account_contract.d.ts.map +1 -1
  11. package/dest/defaults/account_contract.js +11 -3
  12. package/dest/defaults/index.d.ts +1 -2
  13. package/dest/defaults/index.d.ts.map +1 -1
  14. package/dest/defaults/index.js +1 -2
  15. package/dest/{stub/account_contract.d.ts → defaults/stub_account_contract.d.ts} +2 -2
  16. package/dest/defaults/stub_account_contract.d.ts.map +1 -0
  17. package/dest/ecdsa/ecdsa_k/account_contract.d.ts +1 -1
  18. package/dest/ecdsa/ecdsa_k/account_contract.js +7 -3
  19. package/dest/ecdsa/ecdsa_k/lazy.js +1 -1
  20. package/dest/ecdsa/ecdsa_r/account_contract.d.ts +1 -1
  21. package/dest/ecdsa/ecdsa_r/account_contract.js +7 -3
  22. package/dest/ecdsa/ecdsa_r/lazy.js +1 -1
  23. package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +1 -1
  24. package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +7 -3
  25. package/dest/ecdsa/stub/index.d.ts +11 -0
  26. package/dest/ecdsa/stub/index.d.ts.map +1 -0
  27. package/dest/ecdsa/stub/index.js +18 -0
  28. package/dest/ecdsa/stub/lazy.d.ts +14 -0
  29. package/dest/ecdsa/stub/lazy.d.ts.map +1 -0
  30. package/dest/ecdsa/stub/lazy.js +22 -0
  31. package/dest/schnorr/account_contract.d.ts +10 -5
  32. package/dest/schnorr/account_contract.d.ts.map +1 -1
  33. package/dest/schnorr/account_contract.js +7 -6
  34. package/dest/schnorr/index.d.ts +3 -22
  35. package/dest/schnorr/index.d.ts.map +1 -1
  36. package/dest/schnorr/index.js +2 -35
  37. package/dest/schnorr/initializerless/index.d.ts +25 -0
  38. package/dest/schnorr/initializerless/index.d.ts.map +1 -0
  39. package/dest/schnorr/initializerless/index.js +46 -0
  40. package/dest/schnorr/initializerless/lazy.d.ts +29 -0
  41. package/dest/schnorr/initializerless/lazy.d.ts.map +1 -0
  42. package/dest/schnorr/initializerless/lazy.js +54 -0
  43. package/dest/schnorr/lazy.d.ts +3 -26
  44. package/dest/schnorr/lazy.d.ts.map +1 -1
  45. package/dest/schnorr/lazy.js +2 -43
  46. package/dest/schnorr/private_immutable/index.d.ts +23 -0
  47. package/dest/schnorr/private_immutable/index.d.ts.map +1 -0
  48. package/dest/schnorr/private_immutable/index.js +35 -0
  49. package/dest/schnorr/private_immutable/lazy.d.ts +27 -0
  50. package/dest/schnorr/private_immutable/lazy.d.ts.map +1 -0
  51. package/dest/schnorr/private_immutable/lazy.js +43 -0
  52. package/dest/schnorr/stub/index.d.ts +11 -0
  53. package/dest/schnorr/stub/index.d.ts.map +1 -0
  54. package/dest/schnorr/stub/index.js +18 -0
  55. package/dest/schnorr/stub/lazy.d.ts +14 -0
  56. package/dest/schnorr/stub/lazy.d.ts.map +1 -0
  57. package/dest/schnorr/stub/lazy.js +22 -0
  58. package/dest/testing/configuration.d.ts +13 -4
  59. package/dest/testing/configuration.d.ts.map +1 -1
  60. package/dest/testing/configuration.js +7 -3
  61. package/dest/testing/index.d.ts +5 -5
  62. package/dest/testing/index.d.ts.map +1 -1
  63. package/dest/testing/index.js +20 -12
  64. package/dest/testing/lazy.d.ts +4 -4
  65. package/dest/testing/lazy.d.ts.map +1 -1
  66. package/dest/testing/lazy.js +20 -12
  67. package/dest/utils/index.d.ts +2 -1
  68. package/dest/utils/index.d.ts.map +1 -1
  69. package/dest/utils/index.js +1 -0
  70. package/dest/utils/key_derivation.d.ts +9 -0
  71. package/dest/utils/key_derivation.d.ts.map +1 -0
  72. package/dest/utils/key_derivation.js +16 -0
  73. package/dest/utils/ssh_agent.d.ts +1 -1
  74. package/dest/utils/ssh_agent.d.ts.map +1 -1
  75. package/dest/utils/ssh_agent.js +2 -0
  76. package/package.json +12 -15
  77. package/src/defaults/account_contract.ts +18 -5
  78. package/src/defaults/index.ts +0 -1
  79. package/src/{stub/account_contract.ts → defaults/stub_account_contract.ts} +1 -1
  80. package/src/ecdsa/ecdsa_k/account_contract.ts +3 -3
  81. package/src/ecdsa/ecdsa_k/lazy.ts +1 -1
  82. package/src/ecdsa/ecdsa_r/account_contract.ts +3 -3
  83. package/src/ecdsa/ecdsa_r/lazy.ts +1 -1
  84. package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +3 -3
  85. package/src/ecdsa/stub/index.ts +28 -0
  86. package/src/ecdsa/stub/lazy.ts +34 -0
  87. package/src/schnorr/account_contract.ts +21 -7
  88. package/src/schnorr/index.ts +2 -49
  89. package/src/schnorr/initializerless/index.ts +62 -0
  90. package/src/schnorr/initializerless/lazy.ts +70 -0
  91. package/src/schnorr/lazy.ts +2 -59
  92. package/src/schnorr/private_immutable/index.ts +50 -0
  93. package/src/schnorr/private_immutable/lazy.ts +60 -0
  94. package/src/schnorr/stub/index.ts +30 -0
  95. package/src/schnorr/stub/lazy.ts +34 -0
  96. package/src/testing/configuration.ts +17 -3
  97. package/src/testing/index.ts +29 -13
  98. package/src/testing/lazy.ts +28 -13
  99. package/src/utils/index.ts +1 -0
  100. package/src/utils/key_derivation.ts +15 -0
  101. package/src/utils/ssh_agent.ts +2 -0
  102. package/artifacts/SchnorrSingleKeyAccount.json +0 -4679
  103. package/artifacts/SimulatedAccount.json +0 -4623
  104. package/dest/defaults/account_interface.d.ts +0 -28
  105. package/dest/defaults/account_interface.d.ts.map +0 -1
  106. package/dest/defaults/account_interface.js +0 -36
  107. package/dest/single_key/account_contract.d.ts +0 -17
  108. package/dest/single_key/account_contract.d.ts.map +0 -1
  109. package/dest/single_key/account_contract.js +0 -42
  110. package/dest/single_key/index.d.ts +0 -20
  111. package/dest/single_key/index.d.ts.map +0 -1
  112. package/dest/single_key/index.js +0 -23
  113. package/dest/single_key/lazy.d.ts +0 -24
  114. package/dest/single_key/lazy.d.ts.map +0 -1
  115. package/dest/single_key/lazy.js +0 -31
  116. package/dest/stub/account_contract.d.ts.map +0 -1
  117. package/dest/stub/index.d.ts +0 -21
  118. package/dest/stub/index.d.ts.map +0 -1
  119. package/dest/stub/index.js +0 -29
  120. package/dest/stub/lazy.d.ts +0 -23
  121. package/dest/stub/lazy.d.ts.map +0 -1
  122. package/dest/stub/lazy.js +0 -35
  123. package/src/defaults/account_interface.ts +0 -63
  124. package/src/single_key/account_contract.ts +0 -46
  125. package/src/single_key/index.ts +0 -32
  126. package/src/single_key/lazy.ts +0 -40
  127. package/src/stub/index.ts +0 -41
  128. package/src/stub/lazy.ts +0 -49
  129. /package/artifacts/{SchnorrSingleKeyAccount.d.json.ts → SchnorrInitializerlessAccount.d.json.ts} +0 -0
  130. /package/artifacts/{SimulatedAccount.d.json.ts → SimulatedEcdsaAccount.d.json.ts} +0 -0
  131. /package/dest/{stub/account_contract.js → defaults/stub_account_contract.js} +0 -0
@@ -1,28 +0,0 @@
1
- import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
2
- import { type DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
3
- import type { ChainInfo, EntrypointInterface } from '@aztec/entrypoints/interfaces';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import type { AuthWitness } from '@aztec/stdlib/auth-witness';
6
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import { CompleteAddress } from '@aztec/stdlib/contract';
8
- import type { GasSettings } from '@aztec/stdlib/gas';
9
- import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
10
- /**
11
- * Default implementation for an account interface. Requires that the account uses the default
12
- * entrypoint signature, which accept an AppPayload and a FeePayload as defined in noir-libs/aztec-noir/src/entrypoint module
13
- */
14
- export declare class DefaultAccountInterface implements AccountInterface {
15
- private authWitnessProvider;
16
- private address;
17
- protected entrypoint: EntrypointInterface;
18
- private chainId;
19
- private version;
20
- constructor(authWitnessProvider: AuthWitnessProvider, address: CompleteAddress, chainInfo: ChainInfo);
21
- createTxExecutionRequest(exec: ExecutionPayload, gasSettings: GasSettings, options: DefaultAccountEntrypointOptions): Promise<TxExecutionRequest>;
22
- createAuthWit(messageHash: Fr): Promise<AuthWitness>;
23
- getCompleteAddress(): CompleteAddress;
24
- getAddress(): AztecAddress;
25
- getChainId(): Fr;
26
- getVersion(): Fr;
27
- }
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudF9pbnRlcmZhY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZWZhdWx0cy9hY2NvdW50X2ludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3JGLE9BQU8sRUFBNEIsS0FBSywrQkFBK0IsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQzVHLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxtQkFBbUIsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ3BGLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUM5QyxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM5RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBT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default implementation for an account interface. Requires that the account uses the default
4
- * entrypoint signature, which accept an AppPayload and a FeePayload as defined in noir-libs/aztec-noir/src/entrypoint module
5
- */ export class DefaultAccountInterface {
6
- authWitnessProvider;
7
- address;
8
- entrypoint;
9
- chainId;
10
- version;
11
- constructor(authWitnessProvider, address, chainInfo){
12
- this.authWitnessProvider = authWitnessProvider;
13
- this.address = address;
14
- this.entrypoint = new DefaultAccountEntrypoint(address.address, authWitnessProvider, chainInfo.chainId.toNumber(), chainInfo.version.toNumber());
15
- this.chainId = chainInfo.chainId;
16
- this.version = chainInfo.version;
17
- }
18
- createTxExecutionRequest(exec, gasSettings, options) {
19
- return this.entrypoint.createTxExecutionRequest(exec, gasSettings, options);
20
- }
21
- createAuthWit(messageHash) {
22
- return this.authWitnessProvider.createAuthWit(messageHash);
23
- }
24
- getCompleteAddress() {
25
- return this.address;
26
- }
27
- getAddress() {
28
- return this.address.address;
29
- }
30
- getChainId() {
31
- return this.chainId;
32
- }
33
- getVersion() {
34
- return this.version;
35
- }
36
- }
@@ -1,17 +0,0 @@
1
- import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
2
- import { GrumpkinScalar } from '@aztec/foundation/fields';
3
- import { CompleteAddress } from '@aztec/stdlib/contract';
4
- import { DefaultAccountContract } from '../defaults/account_contract.js';
5
- /**
6
- * Account contract that authenticates transactions using Schnorr signatures verified against
7
- * the note encryption key, relying on a single private key for both encryption and authentication.
8
- * This abstract version does not provide a way to retrieve the artifact, as it
9
- * can be implemented with or without lazy loading.
10
- */
11
- export declare abstract class SingleKeyBaseAccountContract extends DefaultAccountContract {
12
- private encryptionPrivateKey;
13
- constructor(encryptionPrivateKey: GrumpkinScalar);
14
- getInitializationFunctionAndArgs(): Promise<undefined>;
15
- getAuthWitnessProvider(account: CompleteAddress): AuthWitnessProvider;
16
- }
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudF9jb250cmFjdC5kLnRzIiwic291cmN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,42 +0,0 @@
1
- import { Schnorr } from '@aztec/foundation/crypto';
2
- import { AuthWitness } from '@aztec/stdlib/auth-witness';
3
- import { DefaultAccountContract } from '../defaults/account_contract.js';
4
- /**
5
- * Account contract that authenticates transactions using Schnorr signatures verified against
6
- * the note encryption key, relying on a single private key for both encryption and authentication.
7
- * This abstract version does not provide a way to retrieve the artifact, as it
8
- * can be implemented with or without lazy loading.
9
- */ export class SingleKeyBaseAccountContract extends DefaultAccountContract {
10
- encryptionPrivateKey;
11
- constructor(encryptionPrivateKey){
12
- super(), this.encryptionPrivateKey = encryptionPrivateKey;
13
- }
14
- getInitializationFunctionAndArgs() {
15
- return Promise.resolve(undefined);
16
- }
17
- getAuthWitnessProvider(account) {
18
- return new SingleKeyAuthWitnessProvider(this.encryptionPrivateKey, account);
19
- }
20
- }
21
- /**
22
- * Creates auth witnesses using Schnorr signatures and including the partial address and public key
23
- * in the witness, so verifiers do not need to store the public key and can instead validate it
24
- * by reconstructing the current address.
25
- */ class SingleKeyAuthWitnessProvider {
26
- privateKey;
27
- account;
28
- constructor(privateKey, account){
29
- this.privateKey = privateKey;
30
- this.account = account;
31
- }
32
- async createAuthWit(messageHash) {
33
- const schnorr = new Schnorr();
34
- const signature = await schnorr.constructSignature(messageHash.toBuffer(), this.privateKey);
35
- const witness = [
36
- ...this.account.publicKeys.toFields(),
37
- ...signature.toBuffer(),
38
- this.account.partialAddress
39
- ];
40
- return Promise.resolve(new AuthWitness(messageHash, witness));
41
- }
42
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
3
- * It is not recommended to use this account type in production.
4
- *
5
- * @packageDocumentation
6
- */
7
- import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
8
- import type { ContractArtifact } from '@aztec/stdlib/abi';
9
- import { SingleKeyBaseAccountContract } from './account_contract.js';
10
- export declare const SchnorrSingleKeyAccountContractArtifact: ContractArtifact;
11
- /**
12
- * Account contract that authenticates transactions using Schnorr signatures verified against
13
- * the note encryption key, relying on a single private key for both encryption and authentication.
14
- * Eagerly loads the contract artifact
15
- */
16
- export declare class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
17
- constructor(signingPrivateKey: GrumpkinScalar);
18
- getContractArtifact(): Promise<ContractArtifact>;
19
- }
20
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zaW5nbGVfa2V5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7OztHQUtHO0FBQ0gsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUsxRCxPQUFPLEVBQUUsNEJBQTRCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUVyRSxlQUFPLE1BQU0sdUNBQXVDLGtCQUVuRCxDQUFDO0FBRUY7Ozs7R0FJRztBQUNILHFCQUFhLHdCQUF5QixTQUFRLDRCQUE0QjtJQUN4RSxZQUFZLGlCQUFpQixFQUFFLGNBQWMsRUFFNUM7SUFFUSxtQkFBbUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FFeEQ7Q0FDRiJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/single_key/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,eAAO,MAAM,uCAAuC,kBAEnD,CAAC;AAEF;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;IACxE,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF"}
@@ -1,23 +0,0 @@
1
- /**
2
- * The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
3
- * It is not recommended to use this account type in production.
4
- *
5
- * @packageDocumentation
6
- */ import { loadContractArtifact } from '@aztec/stdlib/abi';
7
- import SchnorrSingleKeyAccountContractJson from '../../artifacts/SchnorrSingleKeyAccount.json' with {
8
- type: 'json'
9
- };
10
- import { SingleKeyBaseAccountContract } from './account_contract.js';
11
- export const SchnorrSingleKeyAccountContractArtifact = loadContractArtifact(SchnorrSingleKeyAccountContractJson);
12
- /**
13
- * Account contract that authenticates transactions using Schnorr signatures verified against
14
- * the note encryption key, relying on a single private key for both encryption and authentication.
15
- * Eagerly loads the contract artifact
16
- */ export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
17
- constructor(signingPrivateKey){
18
- super(signingPrivateKey);
19
- }
20
- getContractArtifact() {
21
- return Promise.resolve(SchnorrSingleKeyAccountContractArtifact);
22
- }
23
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
3
- * It is not recommended to use this account type in production.
4
- *
5
- * @packageDocumentation
6
- */
7
- import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
8
- import type { ContractArtifact } from '@aztec/stdlib/abi';
9
- import { SingleKeyBaseAccountContract } from './account_contract.js';
10
- /**
11
- * Lazily loads the contract artifact
12
- * @returns The contract artifact for the single key account contract
13
- */
14
- export declare function getSingleKeyAccountContractArtifact(): Promise<ContractArtifact>;
15
- /**
16
- * Account contract that authenticates transactions using Schnorr signatures verified against
17
- * the note encryption key, relying on a single private key for both encryption and authentication.
18
- * Lazily loads the contract artifact
19
- */
20
- export declare class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
21
- constructor(signingPrivateKey: GrumpkinScalar);
22
- getContractArtifact(): Promise<ContractArtifact>;
23
- }
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NpbmdsZV9rZXkvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7R0FLRztBQUNILE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFHMUQsT0FBTyxFQUFFLDRCQUE0QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFckU7OztHQUdHO0FBQ0gsd0JBQXNCLG1DQUFtQyw4QkFReEQ7QUFFRDs7OztHQUlHO0FBQ0gscUJBQWEsd0JBQXlCLFNBQVEsNEJBQTRCO0lBQ3hFLFlBQVksaUJBQWlCLEVBQUUsY0FBYyxFQUU1QztJQUVRLG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUV4RDtDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/single_key/lazy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;GAGG;AACH,wBAAsB,mCAAmC,8BAQxD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;IACxE,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF"}
@@ -1,31 +0,0 @@
1
- /**
2
- * The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
3
- * It is not recommended to use this account type in production.
4
- *
5
- * @packageDocumentation
6
- */ import { loadContractArtifact } from '@aztec/stdlib/abi';
7
- import { SingleKeyBaseAccountContract } from './account_contract.js';
8
- /**
9
- * Lazily loads the contract artifact
10
- * @returns The contract artifact for the single key account contract
11
- */ export async function getSingleKeyAccountContractArtifact() {
12
- // Cannot assert this import as it's incompatible with bundlers like vite
13
- // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
14
- // Even if now supported by al major browsers, the MIME type is replaced with
15
- // "text/javascript"
16
- // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
17
- const { default: schnorrAccountContractJson } = await import('../../artifacts/SchnorrAccount.json');
18
- return loadContractArtifact(schnorrAccountContractJson);
19
- }
20
- /**
21
- * Account contract that authenticates transactions using Schnorr signatures verified against
22
- * the note encryption key, relying on a single private key for both encryption and authentication.
23
- * Lazily loads the contract artifact
24
- */ export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
25
- constructor(signingPrivateKey){
26
- super(signingPrivateKey);
27
- }
28
- getContractArtifact() {
29
- return getSingleKeyAccountContractArtifact();
30
- }
31
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../src/stub/account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE;;;;GAIG;AACH,8BAAsB,uBAAwB,SAAQ,sBAAsB;IAC1E,cAEC;IAED,gCAAgC;;;OAE/B;IAED,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB,CAErE;CACF;AAED,oDAAoD;AACpD,qBAAa,uBAAwB,YAAW,mBAAmB;IACjE,cAAgB;IAEhB;;;;OAIG;IACH,aAAa,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAEnD;CACF"}
@@ -1,21 +0,0 @@
1
- import { BaseAccount, type ChainInfo } from '@aztec/aztec.js/account';
2
- import type { CompleteAddress } from '@aztec/aztec.js/addresses';
3
- import type { ContractArtifact } from '@aztec/stdlib/abi';
4
- import { StubBaseAccountContract } from './account_contract.js';
5
- export declare const StubAccountContractArtifact: ContractArtifact;
6
- /**
7
- * Stub account contract
8
- * Eagerly loads the contract artifact
9
- */
10
- export declare class StubAccountContract extends StubBaseAccountContract {
11
- constructor();
12
- getContractArtifact(): Promise<ContractArtifact>;
13
- }
14
- /**
15
- * Creates a stub account that impersonates the one with the provided originalAddress.
16
- * @param originalAddress - The address of the account to stub
17
- * @param chainInfo - The chain info that the account is connected to
18
- * @returns A stub account that can be used for kernelless simulations
19
- */
20
- export declare function createStubAccount(originalAddress: CompleteAddress, chainInfo: ChainInfo): BaseAccount;
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdHViL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsS0FBSyxTQUFTLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBTTFELE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRWhFLGVBQU8sTUFBTSwyQkFBMkIsa0JBQXlFLENBQUM7QUFFbEg7OztHQUdHO0FBQ0gscUJBQWEsbUJBQW9CLFNBQVEsdUJBQXVCO0lBQzlELGNBRUM7SUFFUSxtQkFBbUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FFeEQ7Q0FDRjtBQUVEOzs7OztHQUtHO0FBQ0gsd0JBQWdCLGlCQUFpQixDQUFDLGVBQWUsRUFBRSxlQUFlLEVBQUUsU0FBUyxFQUFFLFNBQVMsZUFRdkYifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,eAAO,MAAM,2BAA2B,kBAAyE,CAAC;AAElH;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC9D,cAEC;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,eAQvF"}
@@ -1,29 +0,0 @@
1
- import { BaseAccount } from '@aztec/aztec.js/account';
2
- import { loadContractArtifact } from '@aztec/stdlib/abi';
3
- import SimulatedAccountContract from '../../artifacts/SimulatedAccount.json' with {
4
- type: 'json'
5
- };
6
- import { DefaultAccountInterface } from '../defaults/account_interface.js';
7
- import { StubBaseAccountContract } from './account_contract.js';
8
- export const StubAccountContractArtifact = loadContractArtifact(SimulatedAccountContract);
9
- /**
10
- * Stub account contract
11
- * Eagerly loads the contract artifact
12
- */ export class StubAccountContract extends StubBaseAccountContract {
13
- constructor(){
14
- super();
15
- }
16
- getContractArtifact() {
17
- return Promise.resolve(StubAccountContractArtifact);
18
- }
19
- }
20
- /**
21
- * Creates a stub account that impersonates the one with the provided originalAddress.
22
- * @param originalAddress - The address of the account to stub
23
- * @param chainInfo - The chain info that the account is connected to
24
- * @returns A stub account that can be used for kernelless simulations
25
- */ export function createStubAccount(originalAddress, chainInfo) {
26
- const accountContract = new StubAccountContract();
27
- const accountInterface = new DefaultAccountInterface(accountContract.getAuthWitnessProvider(originalAddress), originalAddress, chainInfo);
28
- return new BaseAccount(accountInterface);
29
- }
@@ -1,23 +0,0 @@
1
- import { BaseAccount, type ChainInfo } from '@aztec/aztec.js/account';
2
- import type { CompleteAddress } from '@aztec/aztec.js/addresses';
3
- import type { ContractArtifact } from '@aztec/stdlib/abi';
4
- import { StubBaseAccountContract } from './account_contract.js';
5
- /**
6
- * Lazily loads the contract artifact
7
- * @returns The contract artifact for the Stub account contract
8
- */
9
- export declare function getStubAccountContractArtifact(): Promise<ContractArtifact>;
10
- /**
11
- * Account contract that authenticates transactions using Stub signatures
12
- * verified against a Grumpkin public key stored in an immutable encrypted note.
13
- * Lazily loads the contract artifact
14
- */
15
- export declare class StubAccountContract extends StubBaseAccountContract {
16
- constructor();
17
- getContractArtifact(): Promise<ContractArtifact>;
18
- }
19
- /**
20
- *
21
- */
22
- export declare function createStubAccount(originalAddress: CompleteAddress, chainInfo: ChainInfo): BaseAccount;
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0dWIvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbm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e,EAAE,SAAS,EAAE,SAAS,eAQvF"}
package/dest/stub/lazy.js DELETED
@@ -1,35 +0,0 @@
1
- import { BaseAccount } from '@aztec/aztec.js/account';
2
- import { loadContractArtifact } from '@aztec/stdlib/abi';
3
- import { DefaultAccountInterface } from '../defaults/account_interface.js';
4
- import { StubBaseAccountContract } from './account_contract.js';
5
- /**
6
- * Lazily loads the contract artifact
7
- * @returns The contract artifact for the Stub account contract
8
- */ export async function getStubAccountContractArtifact() {
9
- // Cannot assert this import as it's incompatible with bundlers like vite
10
- // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
11
- // Even if now supported by al major browsers, the MIME type is replaced with
12
- // "text/javascript"
13
- // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
14
- const { default: StubAccountContractJson } = await import('../../artifacts/SimulatedAccount.json');
15
- return loadContractArtifact(StubAccountContractJson);
16
- }
17
- /**
18
- * Account contract that authenticates transactions using Stub signatures
19
- * verified against a Grumpkin public key stored in an immutable encrypted note.
20
- * Lazily loads the contract artifact
21
- */ export class StubAccountContract extends StubBaseAccountContract {
22
- constructor(){
23
- super();
24
- }
25
- getContractArtifact() {
26
- return getStubAccountContractArtifact();
27
- }
28
- }
29
- /**
30
- *
31
- */ export function createStubAccount(originalAddress, chainInfo) {
32
- const accountContract = new StubAccountContract();
33
- const accountInterface = new DefaultAccountInterface(accountContract.getAuthWitnessProvider(originalAddress), originalAddress, chainInfo);
34
- return new BaseAccount(accountInterface);
35
- }
@@ -1,63 +0,0 @@
1
- import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
2
- import { DefaultAccountEntrypoint, type DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
3
- import type { ChainInfo, EntrypointInterface } from '@aztec/entrypoints/interfaces';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import type { AuthWitness } from '@aztec/stdlib/auth-witness';
6
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import { CompleteAddress } from '@aztec/stdlib/contract';
8
- import type { GasSettings } from '@aztec/stdlib/gas';
9
- import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
10
-
11
- /**
12
- * Default implementation for an account interface. Requires that the account uses the default
13
- * entrypoint signature, which accept an AppPayload and a FeePayload as defined in noir-libs/aztec-noir/src/entrypoint module
14
- */
15
- export class DefaultAccountInterface implements AccountInterface {
16
- protected entrypoint: EntrypointInterface;
17
-
18
- private chainId: Fr;
19
- private version: Fr;
20
-
21
- constructor(
22
- private authWitnessProvider: AuthWitnessProvider,
23
- private address: CompleteAddress,
24
- chainInfo: ChainInfo,
25
- ) {
26
- this.entrypoint = new DefaultAccountEntrypoint(
27
- address.address,
28
- authWitnessProvider,
29
- chainInfo.chainId.toNumber(),
30
- chainInfo.version.toNumber(),
31
- );
32
- this.chainId = chainInfo.chainId;
33
- this.version = chainInfo.version;
34
- }
35
-
36
- createTxExecutionRequest(
37
- exec: ExecutionPayload,
38
- gasSettings: GasSettings,
39
- options: DefaultAccountEntrypointOptions,
40
- ): Promise<TxExecutionRequest> {
41
- return this.entrypoint.createTxExecutionRequest(exec, gasSettings, options);
42
- }
43
-
44
- createAuthWit(messageHash: Fr): Promise<AuthWitness> {
45
- return this.authWitnessProvider.createAuthWit(messageHash);
46
- }
47
-
48
- getCompleteAddress(): CompleteAddress {
49
- return this.address;
50
- }
51
-
52
- getAddress(): AztecAddress {
53
- return this.address.address;
54
- }
55
-
56
- getChainId(): Fr {
57
- return this.chainId;
58
- }
59
-
60
- getVersion(): Fr {
61
- return this.version;
62
- }
63
- }
@@ -1,46 +0,0 @@
1
- import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
2
- import { Schnorr } from '@aztec/foundation/crypto';
3
- import { type Fr, GrumpkinScalar } from '@aztec/foundation/fields';
4
- import { AuthWitness } from '@aztec/stdlib/auth-witness';
5
- import { CompleteAddress } from '@aztec/stdlib/contract';
6
-
7
- import { DefaultAccountContract } from '../defaults/account_contract.js';
8
-
9
- /**
10
- * Account contract that authenticates transactions using Schnorr signatures verified against
11
- * the note encryption key, relying on a single private key for both encryption and authentication.
12
- * This abstract version does not provide a way to retrieve the artifact, as it
13
- * can be implemented with or without lazy loading.
14
- */
15
- export abstract class SingleKeyBaseAccountContract extends DefaultAccountContract {
16
- constructor(private encryptionPrivateKey: GrumpkinScalar) {
17
- super();
18
- }
19
-
20
- getInitializationFunctionAndArgs() {
21
- return Promise.resolve(undefined);
22
- }
23
-
24
- getAuthWitnessProvider(account: CompleteAddress): AuthWitnessProvider {
25
- return new SingleKeyAuthWitnessProvider(this.encryptionPrivateKey, account);
26
- }
27
- }
28
-
29
- /**
30
- * Creates auth witnesses using Schnorr signatures and including the partial address and public key
31
- * in the witness, so verifiers do not need to store the public key and can instead validate it
32
- * by reconstructing the current address.
33
- */
34
- class SingleKeyAuthWitnessProvider implements AuthWitnessProvider {
35
- constructor(
36
- private privateKey: GrumpkinScalar,
37
- private account: CompleteAddress,
38
- ) {}
39
-
40
- async createAuthWit(messageHash: Fr): Promise<AuthWitness> {
41
- const schnorr = new Schnorr();
42
- const signature = await schnorr.constructSignature(messageHash.toBuffer(), this.privateKey);
43
- const witness = [...this.account.publicKeys.toFields(), ...signature.toBuffer(), this.account.partialAddress];
44
- return Promise.resolve(new AuthWitness(messageHash, witness));
45
- }
46
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
3
- * It is not recommended to use this account type in production.
4
- *
5
- * @packageDocumentation
6
- */
7
- import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
8
- import type { ContractArtifact } from '@aztec/stdlib/abi';
9
- import { loadContractArtifact } from '@aztec/stdlib/abi';
10
- import type { NoirCompiledContract } from '@aztec/stdlib/noir';
11
-
12
- import SchnorrSingleKeyAccountContractJson from '../../artifacts/SchnorrSingleKeyAccount.json' with { type: 'json' };
13
- import { SingleKeyBaseAccountContract } from './account_contract.js';
14
-
15
- export const SchnorrSingleKeyAccountContractArtifact = loadContractArtifact(
16
- SchnorrSingleKeyAccountContractJson as NoirCompiledContract,
17
- );
18
-
19
- /**
20
- * Account contract that authenticates transactions using Schnorr signatures verified against
21
- * the note encryption key, relying on a single private key for both encryption and authentication.
22
- * Eagerly loads the contract artifact
23
- */
24
- export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
25
- constructor(signingPrivateKey: GrumpkinScalar) {
26
- super(signingPrivateKey);
27
- }
28
-
29
- override getContractArtifact(): Promise<ContractArtifact> {
30
- return Promise.resolve(SchnorrSingleKeyAccountContractArtifact);
31
- }
32
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * The `@aztec/accounts/single_key` export provides a testing account contract implementation that uses a single Grumpkin key for both authentication and encryption.
3
- * It is not recommended to use this account type in production.
4
- *
5
- * @packageDocumentation
6
- */
7
- import type { GrumpkinScalar } from '@aztec/aztec.js/fields';
8
- import type { ContractArtifact } from '@aztec/stdlib/abi';
9
- import { loadContractArtifact } from '@aztec/stdlib/abi';
10
-
11
- import { SingleKeyBaseAccountContract } from './account_contract.js';
12
-
13
- /**
14
- * Lazily loads the contract artifact
15
- * @returns The contract artifact for the single key account contract
16
- */
17
- export async function getSingleKeyAccountContractArtifact() {
18
- // Cannot assert this import as it's incompatible with bundlers like vite
19
- // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
20
- // Even if now supported by al major browsers, the MIME type is replaced with
21
- // "text/javascript"
22
- // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
23
- const { default: schnorrAccountContractJson } = await import('../../artifacts/SchnorrAccount.json');
24
- return loadContractArtifact(schnorrAccountContractJson);
25
- }
26
-
27
- /**
28
- * Account contract that authenticates transactions using Schnorr signatures verified against
29
- * the note encryption key, relying on a single private key for both encryption and authentication.
30
- * Lazily loads the contract artifact
31
- */
32
- export class SingleKeyAccountContract extends SingleKeyBaseAccountContract {
33
- constructor(signingPrivateKey: GrumpkinScalar) {
34
- super(signingPrivateKey);
35
- }
36
-
37
- override getContractArtifact(): Promise<ContractArtifact> {
38
- return getSingleKeyAccountContractArtifact();
39
- }
40
- }
package/src/stub/index.ts DELETED
@@ -1,41 +0,0 @@
1
- import { BaseAccount, type ChainInfo } from '@aztec/aztec.js/account';
2
- import type { CompleteAddress } from '@aztec/aztec.js/addresses';
3
- import type { ContractArtifact } from '@aztec/stdlib/abi';
4
- import { loadContractArtifact } from '@aztec/stdlib/abi';
5
- import type { NoirCompiledContract } from '@aztec/stdlib/noir';
6
-
7
- import SimulatedAccountContract from '../../artifacts/SimulatedAccount.json' with { type: 'json' };
8
- import { DefaultAccountInterface } from '../defaults/account_interface.js';
9
- import { StubBaseAccountContract } from './account_contract.js';
10
-
11
- export const StubAccountContractArtifact = loadContractArtifact(SimulatedAccountContract as NoirCompiledContract);
12
-
13
- /**
14
- * Stub account contract
15
- * Eagerly loads the contract artifact
16
- */
17
- export class StubAccountContract extends StubBaseAccountContract {
18
- constructor() {
19
- super();
20
- }
21
-
22
- override getContractArtifact(): Promise<ContractArtifact> {
23
- return Promise.resolve(StubAccountContractArtifact);
24
- }
25
- }
26
-
27
- /**
28
- * Creates a stub account that impersonates the one with the provided originalAddress.
29
- * @param originalAddress - The address of the account to stub
30
- * @param chainInfo - The chain info that the account is connected to
31
- * @returns A stub account that can be used for kernelless simulations
32
- */
33
- export function createStubAccount(originalAddress: CompleteAddress, chainInfo: ChainInfo) {
34
- const accountContract = new StubAccountContract();
35
- const accountInterface = new DefaultAccountInterface(
36
- accountContract.getAuthWitnessProvider(originalAddress),
37
- originalAddress,
38
- chainInfo,
39
- );
40
- return new BaseAccount(accountInterface);
41
- }