@aztec/accounts 0.81.0 → 0.82.0

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.
@@ -1,5 +1,6 @@
1
1
  import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
2
- import type { EntrypointInterface, ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
2
+ import type { EntrypointInterface, FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
3
+ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
3
4
  import { Fr } from '@aztec/foundation/fields';
4
5
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
5
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -17,7 +18,7 @@ export declare class DefaultAccountInterface implements AccountInterface {
17
18
  private chainId;
18
19
  private version;
19
20
  constructor(authWitnessProvider: AuthWitnessProvider, address: CompleteAddress, nodeInfo: Pick<NodeInfo, 'l1ChainId' | 'protocolVersion'>);
20
- createTxExecutionRequest(execution: ExecutionRequestInit): Promise<TxExecutionRequest>;
21
+ createTxExecutionRequest(exec: ExecutionPayload, fee: FeeOptions, options: TxExecutionOptions): Promise<TxExecutionRequest>;
21
22
  createAuthWit(messageHash: Fr): Promise<AuthWitness>;
22
23
  getCompleteAddress(): CompleteAddress;
23
24
  getAddress(): AztecAddress;
@@ -1 +1 @@
1
- {"version":3,"file":"account_interface.d.ts","sourceRoot":"","sources":["../../src/defaults/account_interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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C;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAO5D,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,OAAO;IAPjB,SAAS,CAAC,UAAU,EAAE,mBAAmB,CAAC;IAE1C,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAK;gBAGV,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,eAAe,EAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAY3D,wBAAwB,CACtB,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IAI9B,aAAa,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAIpD,kBAAkB,IAAI,eAAe;IAIrC,UAAU,IAAI,YAAY;IAI1B,UAAU,IAAI,EAAE;IAIhB,UAAU,IAAI,EAAE;CAGjB"}
@@ -16,8 +16,8 @@ import { Fr } from '@aztec/foundation/fields';
16
16
  this.chainId = new Fr(nodeInfo.l1ChainId);
17
17
  this.version = new Fr(nodeInfo.protocolVersion);
18
18
  }
19
- createTxExecutionRequest(execution) {
20
- return this.entrypoint.createTxExecutionRequest(execution);
19
+ createTxExecutionRequest(exec, fee, options) {
20
+ return this.entrypoint.createTxExecutionRequest(exec, fee, options);
21
21
  }
22
22
  createAuthWit(messageHash) {
23
23
  return this.authWitnessProvider.createAuthWit(messageHash);
@@ -1,4 +1,4 @@
1
- import { type AccountManager, type PXE, type WaitOpts } from '@aztec/aztec.js';
1
+ import { type AccountManager, type PXE, type WaitForProvenOpts, type WaitOpts } from '@aztec/aztec.js';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import type { InitialAccountData } from './configuration.js';
4
4
  /**
@@ -28,7 +28,7 @@ export declare function deployFundedSchnorrAccount(pxe: PXE, account: DeployAcco
28
28
  * Whether or not to skip registering contract class.
29
29
  */
30
30
  skipClassRegistration?: boolean;
31
- }): Promise<AccountManager>;
31
+ }, waitForProvenOptions?: WaitForProvenOpts): Promise<AccountManager>;
32
32
  /**
33
33
  * Deploy schnorr account contracts.
34
34
  * They will pay for the fees for the deployment themselves. So they must be funded with the prefilled public data.
@@ -38,6 +38,6 @@ export declare function deployFundedSchnorrAccounts(pxe: PXE, accounts: DeployAc
38
38
  * Whether or not to skip registering contract class.
39
39
  */
40
40
  skipClassRegistration?: boolean;
41
- }): Promise<AccountManager[]>;
41
+ }, waitForProvenOptions?: WaitForProvenOpts): Promise<AccountManager[]>;
42
42
  export {};
43
43
  //# sourceMappingURL=create_account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/testing/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM;;;;;KAarE;AAED;;GAEG;AACH,KAAK,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,iBAAiB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AiB,EAAE,EAC7B,IAAI,GAAE,QAAQ,GAAG;IACf;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACiB,EACnD,oBAAoB,CAAC,EAAE,iBAAiB,GACvC,OAAO,CAAC,cAAc,EAAE,CAAC,CAiB3B"}
@@ -1,4 +1,4 @@
1
- import { FeeJuicePaymentMethod } from '@aztec/aztec.js';
1
+ import { FeeJuicePaymentMethod, waitForProven } from '@aztec/aztec.js';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { deriveSigningKey } from '@aztec/stdlib/keys';
4
4
  import { getSchnorrAccount, getSchnorrAccountContractAddress } from '../schnorr/index.js';
@@ -24,19 +24,22 @@ import { getSchnorrAccount, getSchnorrAccountContractAddress } from '../schnorr/
24
24
  */ export async function deployFundedSchnorrAccount(pxe, account, opts = {
25
25
  interval: 0.1,
26
26
  skipClassRegistration: false
27
- }) {
27
+ }, waitForProvenOptions) {
28
28
  const signingKey = account.signingKey ?? deriveSigningKey(account.secret);
29
29
  const accountManager = await getSchnorrAccount(pxe, account.secret, signingKey, account.salt);
30
30
  // Pay the fee by the account itself.
31
31
  // This only works when the world state is prefilled with the balance for the account in test environment.
32
32
  const paymentMethod = new FeeJuicePaymentMethod(accountManager.getAddress());
33
- await accountManager.deploy({
33
+ const receipt = await accountManager.deploy({
34
34
  skipClassRegistration: opts.skipClassRegistration,
35
35
  skipPublicDeployment: true,
36
36
  fee: {
37
37
  paymentMethod
38
38
  }
39
39
  }).wait(opts);
40
+ if (waitForProvenOptions !== undefined) {
41
+ await waitForProven(pxe, receipt, waitForProvenOptions);
42
+ }
40
43
  return accountManager;
41
44
  }
42
45
  /**
@@ -45,14 +48,14 @@ import { getSchnorrAccount, getSchnorrAccountContractAddress } from '../schnorr/
45
48
  */ export async function deployFundedSchnorrAccounts(pxe, accounts, opts = {
46
49
  interval: 0.1,
47
50
  skipClassRegistration: false
48
- }) {
51
+ }, waitForProvenOptions) {
49
52
  const accountManagers = [];
50
53
  // Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
51
54
  for(let i = 0; i < accounts.length; i++){
52
55
  accountManagers.push(await deployFundedSchnorrAccount(pxe, accounts[i], {
53
56
  ...opts,
54
57
  skipClassRegistration: i !== 0 || opts.skipClassRegistration
55
- }));
58
+ }, waitForProvenOptions));
56
59
  }
57
60
  return accountManagers;
58
61
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
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.81.0",
5
+ "version": "0.82.0",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  "./dapp": "./dest/dapp/index.js",
@@ -77,11 +77,11 @@
77
77
  ]
78
78
  },
79
79
  "dependencies": {
80
- "@aztec/aztec.js": "0.81.0",
81
- "@aztec/entrypoints": "0.81.0",
82
- "@aztec/ethereum": "0.81.0",
83
- "@aztec/foundation": "0.81.0",
84
- "@aztec/stdlib": "0.81.0",
80
+ "@aztec/aztec.js": "0.82.0",
81
+ "@aztec/entrypoints": "0.82.0",
82
+ "@aztec/ethereum": "0.82.0",
83
+ "@aztec/foundation": "0.82.0",
84
+ "@aztec/stdlib": "0.82.0",
85
85
  "tslib": "^2.4.0"
86
86
  },
87
87
  "devDependencies": {
@@ -1,6 +1,7 @@
1
1
  import type { AccountInterface, AuthWitnessProvider } from '@aztec/aztec.js/account';
2
- import type { EntrypointInterface, ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
3
2
  import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
3
+ import type { EntrypointInterface, FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
4
+ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
4
5
  import { Fr } from '@aztec/foundation/fields';
5
6
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
6
7
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -33,8 +34,12 @@ export class DefaultAccountInterface implements AccountInterface {
33
34
  this.version = new Fr(nodeInfo.protocolVersion);
34
35
  }
35
36
 
36
- createTxExecutionRequest(execution: ExecutionRequestInit): Promise<TxExecutionRequest> {
37
- return this.entrypoint.createTxExecutionRequest(execution);
37
+ createTxExecutionRequest(
38
+ exec: ExecutionPayload,
39
+ fee: FeeOptions,
40
+ options: TxExecutionOptions,
41
+ ): Promise<TxExecutionRequest> {
42
+ return this.entrypoint.createTxExecutionRequest(exec, fee, options);
38
43
  }
39
44
 
40
45
  createAuthWit(messageHash: Fr): Promise<AuthWitness> {
@@ -1,4 +1,11 @@
1
- import { type AccountManager, FeeJuicePaymentMethod, type PXE, type WaitOpts } from '@aztec/aztec.js';
1
+ import {
2
+ type AccountManager,
3
+ FeeJuicePaymentMethod,
4
+ type PXE,
5
+ type WaitForProvenOpts,
6
+ type WaitOpts,
7
+ waitForProven,
8
+ } from '@aztec/aztec.js';
2
9
  import { Fr } from '@aztec/foundation/fields';
3
10
  import { deriveSigningKey } from '@aztec/stdlib/keys';
4
11
 
@@ -46,6 +53,7 @@ export async function deployFundedSchnorrAccount(
46
53
  */
47
54
  skipClassRegistration?: boolean;
48
55
  } = { interval: 0.1, skipClassRegistration: false },
56
+ waitForProvenOptions?: WaitForProvenOpts,
49
57
  ): Promise<AccountManager> {
50
58
  const signingKey = account.signingKey ?? deriveSigningKey(account.secret);
51
59
  const accountManager = await getSchnorrAccount(pxe, account.secret, signingKey, account.salt);
@@ -54,7 +62,7 @@ export async function deployFundedSchnorrAccount(
54
62
  // This only works when the world state is prefilled with the balance for the account in test environment.
55
63
  const paymentMethod = new FeeJuicePaymentMethod(accountManager.getAddress());
56
64
 
57
- await accountManager
65
+ const receipt = await accountManager
58
66
  .deploy({
59
67
  skipClassRegistration: opts.skipClassRegistration,
60
68
  skipPublicDeployment: true,
@@ -62,6 +70,10 @@ export async function deployFundedSchnorrAccount(
62
70
  })
63
71
  .wait(opts);
64
72
 
73
+ if (waitForProvenOptions !== undefined) {
74
+ await waitForProven(pxe, receipt, waitForProvenOptions);
75
+ }
76
+
65
77
  return accountManager;
66
78
  }
67
79
 
@@ -78,15 +90,21 @@ export async function deployFundedSchnorrAccounts(
78
90
  */
79
91
  skipClassRegistration?: boolean;
80
92
  } = { interval: 0.1, skipClassRegistration: false },
93
+ waitForProvenOptions?: WaitForProvenOpts,
81
94
  ): Promise<AccountManager[]> {
82
95
  const accountManagers: AccountManager[] = [];
83
96
  // Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
84
97
  for (let i = 0; i < accounts.length; i++) {
85
98
  accountManagers.push(
86
- await deployFundedSchnorrAccount(pxe, accounts[i], {
87
- ...opts,
88
- skipClassRegistration: i !== 0 || opts.skipClassRegistration, // Register the contract class at most once.
89
- }),
99
+ await deployFundedSchnorrAccount(
100
+ pxe,
101
+ accounts[i],
102
+ {
103
+ ...opts,
104
+ skipClassRegistration: i !== 0 || opts.skipClassRegistration, // Register the contract class at most once.
105
+ },
106
+ waitForProvenOptions,
107
+ ),
90
108
  );
91
109
  }
92
110
  return accountManagers;