@aztec/aztec.js 0.16.3 → 0.16.5

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 (63) hide show
  1. package/dest/artifacts/ecdsa_account_contract.json +2 -2
  2. package/dest/artifacts/schnorr_account_contract.json +2 -2
  3. package/dest/artifacts/schnorr_single_key_account_contract.json +2 -2
  4. package/dest/index.d.ts +8 -7
  5. package/dest/index.d.ts.map +1 -1
  6. package/dest/index.js +7 -6
  7. package/package.json +5 -5
  8. package/src/account/contract/base_account_contract.ts +0 -25
  9. package/src/account/contract/ecdsa_account_contract.ts +0 -38
  10. package/src/account/contract/index.ts +0 -37
  11. package/src/account/contract/schnorr_account_contract.ts +0 -38
  12. package/src/account/contract/single_key_account_contract.ts +0 -45
  13. package/src/account/defaults/default_entrypoint.ts +0 -102
  14. package/src/account/defaults/default_interface.ts +0 -38
  15. package/src/account/defaults/entrypoint_payload.ts +0 -89
  16. package/src/account/defaults/index.ts +0 -3
  17. package/src/account/index.ts +0 -124
  18. package/src/account/interface.ts +0 -35
  19. package/src/account/manager/deploy_account_sent_tx.ts +0 -42
  20. package/src/account/manager/index.ts +0 -156
  21. package/src/account/manager/util.ts +0 -29
  22. package/src/account/utils.ts +0 -47
  23. package/src/api/README.md +0 -7
  24. package/src/api/abi.ts +0 -1
  25. package/src/api/aztec_address.ts +0 -1
  26. package/src/api/eth_address.ts +0 -1
  27. package/src/api/ethereum.ts +0 -6
  28. package/src/api/fields.ts +0 -1
  29. package/src/api/init.ts +0 -1
  30. package/src/api/interfaces/pxe.ts +0 -1
  31. package/src/api/log_id.ts +0 -1
  32. package/src/api/tx_hash.ts +0 -1
  33. package/src/artifacts/ecdsa_account_contract.json +0 -699
  34. package/src/artifacts/schnorr_account_contract.json +0 -687
  35. package/src/artifacts/schnorr_single_key_account_contract.json +0 -622
  36. package/src/contract/base_contract_interaction.ts +0 -61
  37. package/src/contract/batch_call.ts +0 -23
  38. package/src/contract/checker.ts +0 -117
  39. package/src/contract/contract.ts +0 -59
  40. package/src/contract/contract_base.ts +0 -70
  41. package/src/contract/contract_function_interaction.ts +0 -80
  42. package/src/contract/index.ts +0 -42
  43. package/src/contract/sent_tx.ts +0 -137
  44. package/src/contract_deployer/contract_deployer.ts +0 -26
  45. package/src/contract_deployer/deploy_method.ts +0 -139
  46. package/src/contract_deployer/deploy_sent_tx.ts +0 -71
  47. package/src/contract_deployer/index.ts +0 -3
  48. package/src/index.ts +0 -137
  49. package/src/pxe_client.ts +0 -63
  50. package/src/sandbox/index.ts +0 -85
  51. package/src/utils/abi_types.ts +0 -10
  52. package/src/utils/authwit.ts +0 -24
  53. package/src/utils/cheat_codes.ts +0 -300
  54. package/src/utils/defaults.ts +0 -4
  55. package/src/utils/index.ts +0 -7
  56. package/src/utils/l1_contracts.ts +0 -21
  57. package/src/utils/l2_contracts.ts +0 -12
  58. package/src/utils/pub_key.ts +0 -12
  59. package/src/utils/secrets.ts +0 -11
  60. package/src/wallet/account_wallet.ts +0 -86
  61. package/src/wallet/base_wallet.ts +0 -120
  62. package/src/wallet/index.ts +0 -12
  63. package/src/wallet/signerless_wallet.ts +0 -38
@@ -395,7 +395,7 @@
395
395
  }
396
396
  },
397
397
  {
398
- "name": "blocks_tree_root",
398
+ "name": "archive_root",
399
399
  "type": {
400
400
  "kind": "field"
401
401
  }
@@ -662,7 +662,7 @@
662
662
  }
663
663
  },
664
664
  {
665
- "name": "blocks_tree_root",
665
+ "name": "archive_root",
666
666
  "type": {
667
667
  "kind": "field"
668
668
  }
@@ -383,7 +383,7 @@
383
383
  }
384
384
  },
385
385
  {
386
- "name": "blocks_tree_root",
386
+ "name": "archive_root",
387
387
  "type": {
388
388
  "kind": "field"
389
389
  }
@@ -650,7 +650,7 @@
650
650
  }
651
651
  },
652
652
  {
653
- "name": "blocks_tree_root",
653
+ "name": "archive_root",
654
654
  "type": {
655
655
  "kind": "field"
656
656
  }
@@ -318,7 +318,7 @@
318
318
  }
319
319
  },
320
320
  {
321
- "name": "blocks_tree_root",
321
+ "name": "archive_root",
322
322
  "type": {
323
323
  "kind": "field"
324
324
  }
@@ -585,7 +585,7 @@
585
585
  }
586
586
  },
587
587
  {
588
- "name": "blocks_tree_root",
588
+ "name": "archive_root",
589
589
  "type": {
590
590
  "kind": "field"
591
591
  }
package/dest/index.d.ts CHANGED
@@ -24,18 +24,19 @@ export { createPXEClient } from './pxe_client.js';
24
24
  export { CompleteAddress, getSchnorrAccount, AccountContract, AccountManager, getUnsafeSchnorrAccount, EcdsaAccountContract, createAccounts, SchnorrAccountContract, SingleKeyAccountContract, createAccount, AuthWitnessProvider, BaseAccountContract, } from './account/index.js';
25
25
  export { waitForSandbox, getSandboxAccountsWallets, deployInitialSandboxAccounts } from './sandbox/index.js';
26
26
  export { AccountWalletWithPrivateKey, AccountWallet, Wallet, SignerlessWallet } from './wallet/index.js';
27
- export { AztecAddress, EthAddress, Point, Fr, Fq, FunctionSelector, GlobalVariables, GrumpkinScalar, getContractDeploymentInfo, } from '@aztec/circuits.js';
27
+ export { AztecAddress, EthAddress, Fr, Fq, FunctionSelector, GlobalVariables, GrumpkinScalar, Point, getContractDeploymentInfo, } from '@aztec/circuits.js';
28
28
  export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg';
29
- export { AuthWitness, AztecNode, ContractData, DeployedContract, ExtendedContractData, ExtendedNote, FunctionCall, INITIAL_L2_BLOCK_NUM, GrumpkinPrivateKey, L2Actor, L2Block, L2BlockL2Logs, LogFilter, LogId, LogType, MerkleTreeId, NodeInfo, Note, PackedArguments, PartialAddress, PublicKey, PXE, SyncStatus, Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, UnencryptedL2Log, emptyFunctionCall, createAztecNodeClient, merkleTreeIds, mockTx, } from '@aztec/types';
30
- export { ContractArtifact, FunctionArtifact } from '@aztec/foundation/abi';
29
+ export { AuthWitness, AztecNode, ContractData, DeployedContract, ExtendedContractData, ExtendedNote, FunctionCall, GrumpkinPrivateKey, INITIAL_L2_BLOCK_NUM, L2Actor, L2Block, L2BlockL2Logs, LogFilter, LogId, LogType, MerkleTreeId, NodeInfo, Note, PXE, PackedArguments, PartialAddress, PublicKey, SyncStatus, Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, UnencryptedL2Log, createAztecNodeClient, emptyFunctionCall, merkleTreeIds, mockTx, } from '@aztec/types';
30
+ export { ContractArtifact, FunctionArtifact, encodeArguments } from '@aztec/foundation/abi';
31
+ export { sha256, init } from '@aztec/foundation/crypto';
31
32
  export { DebugLogger, createDebugLogger, onLog } from '@aztec/foundation/log';
32
- export { fileURLToPath } from '@aztec/foundation/url';
33
+ export { retry, retryUntil } from '@aztec/foundation/retry';
33
34
  export { sleep } from '@aztec/foundation/sleep';
34
35
  export { elapsed } from '@aztec/foundation/timer';
35
- export { retry, retryUntil } from '@aztec/foundation/retry';
36
- export { sha256, init } from '@aztec/foundation/crypto';
36
+ export { fileURLToPath } from '@aztec/foundation/url';
37
37
  export { to2Fields, toBigInt } from '@aztec/foundation/serialize';
38
38
  export { toBigIntBE } from '@aztec/foundation/bigint-buffer';
39
39
  export { makeFetch } from '@aztec/foundation/json-rpc/client';
40
- export { deployL1Contract, deployL1Contracts, DeployL1Contracts, L1ContractArtifactsForDeployment, } from '@aztec/ethereum';
40
+ export { DeployL1Contracts, L1ContractArtifactsForDeployment, deployL1Contract, deployL1Contracts, } from '@aztec/ethereum';
41
+ export { FieldsOf } from '@aztec/foundation/types';
41
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,QAAQ,EACR,2BAA2B,EAC3B,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,MAAM,EACN,SAAS,GACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAA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,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,OAAO,EACL,iBAAiB,EACjB,gCAAgC,EAChC,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC"}
package/dest/index.js CHANGED
@@ -26,20 +26,21 @@ export { waitForSandbox, getSandboxAccountsWallets, deployInitialSandboxAccounts
26
26
  export { AccountWalletWithPrivateKey, AccountWallet, SignerlessWallet } from './wallet/index.js';
27
27
  // TODO https://github.com/AztecProtocol/aztec-packages/issues/2632 --> FunctionSelector might not need to be exposed
28
28
  // here once the issue is resolved.
29
- export { AztecAddress, EthAddress, Point, Fr, Fq, FunctionSelector, GlobalVariables, GrumpkinScalar, getContractDeploymentInfo, } from '@aztec/circuits.js';
29
+ export { AztecAddress, EthAddress, Fr, Fq, FunctionSelector, GlobalVariables, GrumpkinScalar, Point, getContractDeploymentInfo, } from '@aztec/circuits.js';
30
30
  export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg';
31
- export { AuthWitness, ContractData, ExtendedContractData, ExtendedNote, INITIAL_L2_BLOCK_NUM, L2Actor, L2Block, L2BlockL2Logs, LogId, LogType, MerkleTreeId, Note, PackedArguments, Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, UnencryptedL2Log, emptyFunctionCall, createAztecNodeClient, merkleTreeIds, mockTx, } from '@aztec/types';
31
+ export { AuthWitness, ContractData, ExtendedContractData, ExtendedNote, INITIAL_L2_BLOCK_NUM, L2Actor, L2Block, L2BlockL2Logs, LogId, LogType, MerkleTreeId, Note, PackedArguments, Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, UnencryptedL2Log, createAztecNodeClient, emptyFunctionCall, merkleTreeIds, mockTx, } from '@aztec/types';
32
32
  // TODO: These kinds of things have no place on our public api.
33
33
  // External devs will almost certainly have their own methods of doing these things.
34
34
  // If we want to use them in our own "aztec.js consuming code", import them from foundation as needed.
35
+ export { encodeArguments } from '@aztec/foundation/abi';
36
+ export { sha256, init } from '@aztec/foundation/crypto';
35
37
  export { createDebugLogger, onLog } from '@aztec/foundation/log';
36
- export { fileURLToPath } from '@aztec/foundation/url';
38
+ export { retry, retryUntil } from '@aztec/foundation/retry';
37
39
  export { sleep } from '@aztec/foundation/sleep';
38
40
  export { elapsed } from '@aztec/foundation/timer';
39
- export { retry, retryUntil } from '@aztec/foundation/retry';
40
- export { sha256, init } from '@aztec/foundation/crypto';
41
+ export { fileURLToPath } from '@aztec/foundation/url';
41
42
  export { to2Fields, toBigInt } from '@aztec/foundation/serialize';
42
43
  export { toBigIntBE } from '@aztec/foundation/bigint-buffer';
43
44
  export { makeFetch } from '@aztec/foundation/json-rpc/client';
44
45
  export { deployL1Contract, deployL1Contracts, } from '@aztec/ethereum';
45
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQWtCRztBQUNILE9BQU8sRUFFTCwyQkFBMkIsRUFDM0IsUUFBUSxFQUNSLFlBQVksRUFFWixNQUFNLEVBQ04sU0FBUyxHQUNWLE1BQU0scUJBQXFCLENBQUM7QUFFN0IsT0FBTyxFQUFFLGdCQUFnQixFQUFFLFlBQVksRUFBRSxZQUFZLE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UUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM3RCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFOUQsT0FBTyxFQUdMLGdCQUFnQixFQUNoQixpQkFBaUIsR0FDbEIsTUFBTSxpQkFBaUIsQ0FBQyJ9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aztec/aztec.js",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js",
4
- "version": "0.16.3",
4
+ "version": "0.16.5",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -49,10 +49,10 @@
49
49
  "rootDir": "./src"
50
50
  },
51
51
  "dependencies": {
52
- "@aztec/circuits.js": "0.16.3",
53
- "@aztec/ethereum": "0.16.3",
54
- "@aztec/foundation": "0.16.3",
55
- "@aztec/types": "0.16.3",
52
+ "@aztec/circuits.js": "0.16.5",
53
+ "@aztec/ethereum": "0.16.5",
54
+ "@aztec/foundation": "0.16.5",
55
+ "@aztec/types": "0.16.5",
56
56
  "lodash.every": "^4.6.0",
57
57
  "lodash.partition": "^4.6.0",
58
58
  "lodash.zip": "^4.2.0",
@@ -1,25 +0,0 @@
1
- import { ContractArtifact } from '@aztec/foundation/abi';
2
- import { CompleteAddress, NodeInfo } from '@aztec/types';
3
-
4
- import { DefaultAccountInterface } from '../defaults/default_interface.js';
5
- import { AccountInterface, AuthWitnessProvider } from '../interface.js';
6
- import { AccountContract } from './index.js';
7
-
8
- /**
9
- * Base class for implementing an account contract. Requires that the account uses the
10
- * default entrypoint method signature.
11
- */
12
- export abstract class BaseAccountContract implements AccountContract {
13
- abstract getAuthWitnessProvider(address: CompleteAddress): AuthWitnessProvider;
14
- abstract getDeploymentArgs(): any[];
15
-
16
- constructor(private artifact: ContractArtifact) {}
17
-
18
- getContractArtifact(): ContractArtifact {
19
- return this.artifact;
20
- }
21
-
22
- getInterface(address: CompleteAddress, nodeInfo: NodeInfo): AccountInterface {
23
- return new DefaultAccountInterface(this.getAuthWitnessProvider(address), address, nodeInfo);
24
- }
25
- }
@@ -1,38 +0,0 @@
1
- import { Ecdsa } from '@aztec/circuits.js/barretenberg';
2
- import { ContractArtifact } from '@aztec/foundation/abi';
3
- import { Fr } from '@aztec/foundation/fields';
4
- import { AuthWitness, CompleteAddress } from '@aztec/types';
5
-
6
- import EcdsaAccountContractArtifact from '../../artifacts/ecdsa_account_contract.json' assert { type: 'json' };
7
- import { AuthWitnessProvider } from '../interface.js';
8
- import { BaseAccountContract } from './base_account_contract.js';
9
-
10
- /**
11
- * Account contract that authenticates transactions using ECDSA signatures
12
- * verified against a secp256k1 public key stored in an immutable encrypted note.
13
- */
14
- export class EcdsaAccountContract extends BaseAccountContract {
15
- constructor(private signingPrivateKey: Buffer) {
16
- super(EcdsaAccountContractArtifact as ContractArtifact);
17
- }
18
-
19
- getDeploymentArgs() {
20
- const signingPublicKey = new Ecdsa().computePublicKey(this.signingPrivateKey);
21
- return [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)];
22
- }
23
-
24
- getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider {
25
- return new EcdsaAuthWitnessProvider(this.signingPrivateKey);
26
- }
27
- }
28
-
29
- /** Creates auth witnesses using ECDSA signatures. */
30
- class EcdsaAuthWitnessProvider implements AuthWitnessProvider {
31
- constructor(private signingPrivateKey: Buffer) {}
32
-
33
- createAuthWitness(message: Fr): Promise<AuthWitness> {
34
- const ecdsa = new Ecdsa();
35
- const signature = ecdsa.constructSignature(message.toBuffer(), this.signingPrivateKey);
36
- return Promise.resolve(new AuthWitness(message, [...signature.r, ...signature.s]));
37
- }
38
- }
@@ -1,37 +0,0 @@
1
- import { ContractArtifact } from '@aztec/foundation/abi';
2
- import { CompleteAddress, NodeInfo } from '@aztec/types';
3
-
4
- import { AccountInterface } from '../interface.js';
5
-
6
- export * from './ecdsa_account_contract.js';
7
- export * from './schnorr_account_contract.js';
8
- export * from './single_key_account_contract.js';
9
- export * from './base_account_contract.js';
10
-
11
- // docs:start:account-contract-interface
12
- /**
13
- * An account contract instance. Knows its artifact, deployment arguments, how to create
14
- * transaction execution requests out of function calls, and how to authorize actions.
15
- */
16
- export interface AccountContract {
17
- /**
18
- * Returns the artifact of this account contract.
19
- */
20
- getContractArtifact(): ContractArtifact;
21
-
22
- /**
23
- * Returns the deployment arguments for this instance.
24
- */
25
- getDeploymentArgs(): any[];
26
-
27
- /**
28
- * Returns the account interface for this account contract given a deployment at the provided address.
29
- * The account interface is responsible for assembling tx requests given requested function calls, and
30
- * for creating signed auth witnesses given action identifiers (message hashes).
31
- * @param address - Address where this account contract is deployed.
32
- * @param nodeInfo - Info on the chain where it is deployed.
33
- * @returns An account interface instance for creating tx requests and authorizing actions.
34
- */
35
- getInterface(address: CompleteAddress, nodeInfo: NodeInfo): AccountInterface;
36
- }
37
- // docs:end:account-contract-interface
@@ -1,38 +0,0 @@
1
- import { Schnorr } from '@aztec/circuits.js/barretenberg';
2
- import { ContractArtifact } from '@aztec/foundation/abi';
3
- import { Fr } from '@aztec/foundation/fields';
4
- import { AuthWitness, CompleteAddress, GrumpkinPrivateKey } from '@aztec/types';
5
-
6
- import SchnorrAccountContractArtifact from '../../artifacts/schnorr_account_contract.json' assert { type: 'json' };
7
- import { AuthWitnessProvider } from '../interface.js';
8
- import { BaseAccountContract } from './base_account_contract.js';
9
-
10
- /**
11
- * Account contract that authenticates transactions using Schnorr signatures
12
- * verified against a Grumpkin public key stored in an immutable encrypted note.
13
- */
14
- export class SchnorrAccountContract extends BaseAccountContract {
15
- constructor(private signingPrivateKey: GrumpkinPrivateKey) {
16
- super(SchnorrAccountContractArtifact as ContractArtifact);
17
- }
18
-
19
- getDeploymentArgs() {
20
- const signingPublicKey = new Schnorr().computePublicKey(this.signingPrivateKey);
21
- return [signingPublicKey.x, signingPublicKey.y];
22
- }
23
-
24
- getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider {
25
- return new SchnorrAuthWitnessProvider(this.signingPrivateKey);
26
- }
27
- }
28
-
29
- /** Creates auth witnesses using Schnorr signatures. */
30
- class SchnorrAuthWitnessProvider implements AuthWitnessProvider {
31
- constructor(private signingPrivateKey: GrumpkinPrivateKey) {}
32
-
33
- createAuthWitness(message: Fr): Promise<AuthWitness> {
34
- const schnorr = new Schnorr();
35
- const signature = schnorr.constructSignature(message.toBuffer(), this.signingPrivateKey).toBuffer();
36
- return Promise.resolve(new AuthWitness(message, [...signature]));
37
- }
38
- }
@@ -1,45 +0,0 @@
1
- import { PartialAddress } from '@aztec/circuits.js';
2
- import { Schnorr } from '@aztec/circuits.js/barretenberg';
3
- import { ContractArtifact } from '@aztec/foundation/abi';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import { AuthWitness, CompleteAddress, GrumpkinPrivateKey } from '@aztec/types';
6
-
7
- import SchnorrSingleKeyAccountContractArtifact from '../../artifacts/schnorr_single_key_account_contract.json' assert { type: 'json' };
8
- import { generatePublicKey } from '../../index.js';
9
- import { AuthWitnessProvider } from '../interface.js';
10
- import { BaseAccountContract } from './base_account_contract.js';
11
-
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
- */
16
- export class SingleKeyAccountContract extends BaseAccountContract {
17
- constructor(private encryptionPrivateKey: GrumpkinPrivateKey) {
18
- super(SchnorrSingleKeyAccountContractArtifact as ContractArtifact);
19
- }
20
-
21
- getDeploymentArgs(): any[] {
22
- return [];
23
- }
24
-
25
- getAuthWitnessProvider({ partialAddress }: CompleteAddress): AuthWitnessProvider {
26
- return new SingleKeyAuthWitnessProvider(this.encryptionPrivateKey, partialAddress);
27
- }
28
- }
29
-
30
- /**
31
- * Creates auth witnesses using Schnorr signatures and including the partial address and public key
32
- * in the witness, so verifiers do not need to store the public key and can instead validate it
33
- * by reconstructing the current address.
34
- */
35
- class SingleKeyAuthWitnessProvider implements AuthWitnessProvider {
36
- constructor(private privateKey: GrumpkinPrivateKey, private partialAddress: PartialAddress) {}
37
-
38
- createAuthWitness(message: Fr): Promise<AuthWitness> {
39
- const schnorr = new Schnorr();
40
- const signature = schnorr.constructSignature(message.toBuffer(), this.privateKey);
41
- const publicKey = generatePublicKey(this.privateKey);
42
- const witness = [...publicKey.toFields(), ...signature.toBuffer(), this.partialAddress];
43
- return Promise.resolve(new AuthWitness(message, witness));
44
- }
45
- }
@@ -1,102 +0,0 @@
1
- import { AztecAddress, Fr, FunctionData, TxContext } from '@aztec/circuits.js';
2
- import { FunctionAbi, encodeArguments } from '@aztec/foundation/abi';
3
- import { FunctionCall, PackedArguments, TxExecutionRequest } from '@aztec/types';
4
-
5
- import { DEFAULT_CHAIN_ID, DEFAULT_VERSION } from '../../utils/defaults.js';
6
- import { AuthWitnessProvider, EntrypointInterface } from '../interface.js';
7
- import { buildPayload, hashPayload } from './entrypoint_payload.js';
8
-
9
- /**
10
- * Implementation for an entrypoint interface that follows the default entrypoint signature
11
- * for an account, which accepts an EntrypointPayload as defined in noir-libs/aztec-noir/src/entrypoint.nr.
12
- */
13
- export class DefaultAccountEntrypoint implements EntrypointInterface {
14
- constructor(
15
- private address: AztecAddress,
16
- private auth: AuthWitnessProvider,
17
- private chainId: number = DEFAULT_CHAIN_ID,
18
- private version: number = DEFAULT_VERSION,
19
- ) {}
20
-
21
- async createTxExecutionRequest(executions: FunctionCall[]): Promise<TxExecutionRequest> {
22
- const { payload, packedArguments: callsPackedArguments } = buildPayload(executions);
23
- const abi = this.getEntrypointAbi();
24
- const packedArgs = PackedArguments.fromArgs(encodeArguments(abi, [payload]));
25
- const message = Fr.fromBuffer(hashPayload(payload));
26
- const authWitness = await this.auth.createAuthWitness(message);
27
- const txRequest = TxExecutionRequest.from({
28
- argsHash: packedArgs.hash,
29
- origin: this.address,
30
- functionData: FunctionData.fromAbi(abi),
31
- txContext: TxContext.empty(this.chainId, this.version),
32
- packedArguments: [...callsPackedArguments, packedArgs],
33
- authWitnesses: [authWitness],
34
- });
35
-
36
- return txRequest;
37
- }
38
-
39
- private getEntrypointAbi() {
40
- return {
41
- name: 'entrypoint',
42
- functionType: 'secret',
43
- isInternal: false,
44
- parameters: [
45
- {
46
- name: 'payload',
47
- type: {
48
- kind: 'struct',
49
- path: 'authwit::entrypoint::EntrypointPayload',
50
- fields: [
51
- {
52
- name: 'function_calls',
53
- type: {
54
- kind: 'array',
55
- length: 4,
56
- type: {
57
- kind: 'struct',
58
- path: 'authwit::entrypoint::FunctionCall',
59
- fields: [
60
- {
61
- name: 'args_hash',
62
- type: {
63
- kind: 'field',
64
- },
65
- },
66
- {
67
- name: 'function_selector',
68
- type: {
69
- kind: 'field',
70
- },
71
- },
72
- {
73
- name: 'target_address',
74
- type: {
75
- kind: 'field',
76
- },
77
- },
78
- {
79
- name: 'is_public',
80
- type: {
81
- kind: 'boolean',
82
- },
83
- },
84
- ],
85
- },
86
- },
87
- },
88
- {
89
- name: 'nonce',
90
- type: {
91
- kind: 'field',
92
- },
93
- },
94
- ],
95
- },
96
- visibility: 'public',
97
- },
98
- ],
99
- returnTypes: [],
100
- } as FunctionAbi;
101
- }
102
- }
@@ -1,38 +0,0 @@
1
- import { CompleteAddress, Fr } from '@aztec/circuits.js';
2
- import { AuthWitness, FunctionCall, NodeInfo, TxExecutionRequest } from '@aztec/types';
3
-
4
- import { AccountInterface, AuthWitnessProvider, EntrypointInterface } from '../interface.js';
5
- import { DefaultAccountEntrypoint } from './default_entrypoint.js';
6
-
7
- /**
8
- * Default implementation for an account interface. Requires that the account uses the default
9
- * entrypoint signature, which accepts an EntrypointPayload as defined in noir-libs/aztec-noir/src/entrypoint.nr.
10
- */
11
- export class DefaultAccountInterface implements AccountInterface {
12
- private entrypoint: EntrypointInterface;
13
-
14
- constructor(
15
- private authWitnessProvider: AuthWitnessProvider,
16
- private address: CompleteAddress,
17
- nodeInfo: Pick<NodeInfo, 'chainId' | 'protocolVersion'>,
18
- ) {
19
- this.entrypoint = new DefaultAccountEntrypoint(
20
- address.address,
21
- authWitnessProvider,
22
- nodeInfo.chainId,
23
- nodeInfo.protocolVersion,
24
- );
25
- }
26
-
27
- createTxExecutionRequest(executions: FunctionCall[]): Promise<TxExecutionRequest> {
28
- return this.entrypoint.createTxExecutionRequest(executions);
29
- }
30
-
31
- createAuthWitness(message: Fr): Promise<AuthWitness> {
32
- return this.authWitnessProvider.createAuthWitness(message);
33
- }
34
-
35
- getCompleteAddress(): CompleteAddress {
36
- return this.address;
37
- }
38
- }
@@ -1,89 +0,0 @@
1
- import { Fr, GeneratorIndex } from '@aztec/circuits.js';
2
- import { padArrayEnd } from '@aztec/foundation/collection';
3
- import { pedersenHash } from '@aztec/foundation/crypto';
4
- import { FunctionCall, PackedArguments, emptyFunctionCall } from '@aztec/types';
5
-
6
- // These must match the values defined in yarn-project/aztec-nr/aztec/src/entrypoint.nr
7
- export const ACCOUNT_MAX_CALLS = 4;
8
-
9
- /** Encoded function call for account contract entrypoint */
10
- export type EntrypointFunctionCall = {
11
- // eslint-disable-next-line camelcase
12
- /** Arguments hash for the call */
13
- args_hash: Fr;
14
- // eslint-disable-next-line camelcase
15
- /** Selector of the function to call */
16
- function_selector: Fr;
17
- // eslint-disable-next-line camelcase
18
- /** Address of the contract to call */
19
- target_address: Fr;
20
- // eslint-disable-next-line camelcase
21
- /** Whether the function is public or private */
22
- is_public: boolean;
23
- };
24
-
25
- /** Encoded payload for the account contract entrypoint */
26
- export type EntrypointPayload = {
27
- // eslint-disable-next-line camelcase
28
- /** Encoded function calls to execute */
29
- function_calls: EntrypointFunctionCall[];
30
- /** A nonce for replay protection */
31
- nonce: Fr;
32
- };
33
-
34
- /** Assembles an entrypoint payload from a set of private and public function calls */
35
- export function buildPayload(calls: FunctionCall[]): {
36
- /** The payload for the entrypoint function */
37
- payload: EntrypointPayload;
38
- /** The packed arguments of functions called */
39
- packedArguments: PackedArguments[];
40
- } {
41
- const nonce = Fr.random();
42
-
43
- const paddedCalls = padArrayEnd(calls, emptyFunctionCall(), ACCOUNT_MAX_CALLS);
44
- const packedArguments: PackedArguments[] = [];
45
- for (const call of paddedCalls) {
46
- packedArguments.push(PackedArguments.fromArgs(call.args));
47
- }
48
-
49
- const formattedCalls: EntrypointFunctionCall[] = paddedCalls.map((call, index) => ({
50
- // eslint-disable-next-line camelcase
51
- args_hash: packedArguments[index].hash,
52
- // eslint-disable-next-line camelcase
53
- function_selector: call.functionData.selector.toField(),
54
- // eslint-disable-next-line camelcase
55
- target_address: call.to.toField(),
56
- // eslint-disable-next-line camelcase
57
- is_public: !call.functionData.isPrivate,
58
- }));
59
-
60
- return {
61
- payload: {
62
- // eslint-disable-next-line camelcase
63
- function_calls: formattedCalls,
64
- nonce,
65
- },
66
- packedArguments,
67
- };
68
- }
69
-
70
- /** Hashes an entrypoint payload to a 32-byte buffer (useful for signing) */
71
- export function hashPayload(payload: EntrypointPayload) {
72
- return pedersenHash(
73
- flattenPayload(payload).map(fr => fr.toBuffer()),
74
- GeneratorIndex.SIGNATURE_PAYLOAD,
75
- );
76
- }
77
-
78
- /** Flattens an entrypoint payload */
79
- export function flattenPayload(payload: EntrypointPayload) {
80
- return [
81
- ...payload.function_calls.flatMap(call => [
82
- call.args_hash,
83
- call.function_selector,
84
- call.target_address,
85
- new Fr(call.is_public),
86
- ]),
87
- payload.nonce,
88
- ];
89
- }
@@ -1,3 +0,0 @@
1
- export * from './entrypoint_payload.js';
2
- export * from './default_entrypoint.js';
3
- export * from './default_interface.js';