@aztec/end-to-end 0.0.1-fake-c83136db25 → 0.0.1-fake-ceab37513c

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 (137) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +2 -3
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +2 -2
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +12 -16
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +58 -54
  7. package/dest/bench/client_flows/data_extractor.js +3 -3
  8. package/dest/bench/utils.d.ts +11 -2
  9. package/dest/bench/utils.d.ts.map +1 -1
  10. package/dest/bench/utils.js +34 -10
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -7
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +8 -10
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +33 -31
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -10
  18. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  19. package/dest/e2e_deploy_contract/deploy_test.js +18 -9
  20. package/dest/e2e_epochs/epochs_test.d.ts +1 -3
  21. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  22. package/dest/e2e_epochs/epochs_test.js +9 -10
  23. package/dest/e2e_fees/bridging_race.notest.js +9 -12
  24. package/dest/e2e_fees/fees_test.d.ts +5 -5
  25. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  26. package/dest/e2e_fees/fees_test.js +31 -23
  27. package/dest/e2e_l1_publisher/write_json.d.ts +1 -3
  28. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  29. package/dest/e2e_l1_publisher/write_json.js +5 -5
  30. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  31. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -6
  33. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  34. package/dest/e2e_nested_contract/nested_contract_test.js +9 -7
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  36. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  37. package/dest/e2e_p2p/inactivity_slash_test.js +2 -5
  38. package/dest/e2e_p2p/p2p_network.d.ts +2 -14
  39. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  40. package/dest/e2e_p2p/p2p_network.js +10 -32
  41. package/dest/e2e_p2p/shared.d.ts +13 -11
  42. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  43. package/dest/e2e_p2p/shared.js +45 -49
  44. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -5
  45. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.js +17 -14
  47. package/dest/fixtures/e2e_prover_test.d.ts +6 -8
  48. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  49. package/dest/fixtures/e2e_prover_test.js +50 -40
  50. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  51. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  52. package/dest/fixtures/get_bb_config.d.ts +1 -1
  53. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  54. package/dest/fixtures/get_bb_config.js +2 -2
  55. package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
  56. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  57. package/dest/fixtures/setup_l1_contracts.js +2 -2
  58. package/dest/fixtures/setup_p2p_test.d.ts +7 -0
  59. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  60. package/dest/fixtures/snapshot_manager.d.ts +7 -10
  61. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  62. package/dest/fixtures/snapshot_manager.js +32 -42
  63. package/dest/fixtures/token_utils.d.ts +4 -6
  64. package/dest/fixtures/token_utils.d.ts.map +1 -1
  65. package/dest/fixtures/token_utils.js +15 -11
  66. package/dest/fixtures/utils.d.ts +27 -23
  67. package/dest/fixtures/utils.d.ts.map +1 -1
  68. package/dest/fixtures/utils.js +100 -75
  69. package/dest/fixtures/web3signer.d.ts +1 -1
  70. package/dest/fixtures/web3signer.d.ts.map +1 -1
  71. package/dest/fixtures/web3signer.js +5 -16
  72. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  73. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  74. package/dest/shared/cross_chain_test_harness.d.ts +10 -16
  75. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  76. package/dest/shared/cross_chain_test_harness.js +15 -13
  77. package/dest/shared/gas_portal_test_harness.d.ts +6 -9
  78. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  79. package/dest/shared/gas_portal_test_harness.js +7 -10
  80. package/dest/shared/jest_setup.js +1 -1
  81. package/dest/shared/submit-transactions.d.ts +3 -5
  82. package/dest/shared/submit-transactions.d.ts.map +1 -1
  83. package/dest/shared/submit-transactions.js +7 -8
  84. package/dest/shared/uniswap_l1_l2.d.ts +6 -9
  85. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  86. package/dest/shared/uniswap_l1_l2.js +45 -29
  87. package/dest/simulators/lending_simulator.d.ts +1 -2
  88. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  89. package/dest/simulators/lending_simulator.js +2 -3
  90. package/dest/simulators/token_simulator.d.ts +1 -3
  91. package/dest/simulators/token_simulator.d.ts.map +1 -1
  92. package/dest/simulators/token_simulator.js +2 -2
  93. package/dest/spartan/setup_test_wallets.d.ts +13 -19
  94. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  95. package/dest/spartan/setup_test_wallets.js +84 -107
  96. package/dest/spartan/utils.d.ts +0 -44
  97. package/dest/spartan/utils.d.ts.map +1 -1
  98. package/dest/spartan/utils.js +20 -212
  99. package/package.json +36 -37
  100. package/src/bench/client_flows/benchmark.ts +8 -8
  101. package/src/bench/client_flows/client_flows_benchmark.ts +82 -62
  102. package/src/bench/client_flows/data_extractor.ts +4 -4
  103. package/src/bench/utils.ts +37 -9
  104. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +63 -46
  105. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -33
  106. package/src/e2e_deploy_contract/deploy_test.ts +35 -17
  107. package/src/e2e_epochs/epochs_test.ts +14 -12
  108. package/src/e2e_fees/bridging_race.notest.ts +9 -14
  109. package/src/e2e_fees/fees_test.ts +38 -26
  110. package/src/e2e_l1_publisher/write_json.ts +6 -8
  111. package/src/e2e_multi_validator/utils.ts +1 -1
  112. package/src/e2e_nested_contract/nested_contract_test.ts +10 -11
  113. package/src/e2e_p2p/inactivity_slash_test.ts +3 -7
  114. package/src/e2e_p2p/p2p_network.ts +67 -105
  115. package/src/e2e_p2p/shared.ts +55 -50
  116. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  117. package/src/fixtures/e2e_prover_test.ts +88 -51
  118. package/src/fixtures/get_acvm_config.ts +1 -1
  119. package/src/fixtures/get_bb_config.ts +2 -3
  120. package/src/fixtures/setup_l1_contracts.ts +3 -3
  121. package/src/fixtures/setup_p2p_test.ts +8 -0
  122. package/src/fixtures/snapshot_manager.ts +59 -59
  123. package/src/fixtures/token_utils.ts +21 -13
  124. package/src/fixtures/utils.ts +137 -86
  125. package/src/fixtures/web3signer.ts +5 -22
  126. package/src/guides/up_quick_start.sh +10 -2
  127. package/src/quality_of_service/alert_checker.ts +1 -1
  128. package/src/shared/cross_chain_test_harness.ts +29 -18
  129. package/src/shared/gas_portal_test_harness.ts +19 -12
  130. package/src/shared/jest_setup.ts +1 -1
  131. package/src/shared/submit-transactions.ts +8 -12
  132. package/src/shared/uniswap_l1_l2.ts +67 -61
  133. package/src/simulators/lending_simulator.ts +2 -3
  134. package/src/simulators/token_simulator.ts +2 -5
  135. package/src/spartan/DEVELOP.md +3 -8
  136. package/src/spartan/setup_test_wallets.ts +125 -132
  137. package/src/spartan/utils.ts +18 -268
@@ -1,29 +1,36 @@
1
- import { generateSchnorrAccounts } from '@aztec/accounts/testing';
2
- import { AztecAddress } from '@aztec/aztec.js/addresses';
3
- import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
4
- import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
5
- import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
6
- import { Fr } from '@aztec/aztec.js/fields';
7
- import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
8
- import type { Wallet } from '@aztec/aztec.js/wallet';
1
+ import { getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
2
+ import { generateSchnorrAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
3
+ import {
4
+ type AccountWalletWithSecretKey,
5
+ type AztecAddress,
6
+ type AztecNode,
7
+ FeeJuicePaymentMethodWithClaim,
8
+ type FeePaymentMethod,
9
+ Fr,
10
+ L1FeeJuicePortalManager,
11
+ type PXE,
12
+ SponsoredFeePaymentMethod,
13
+ createAztecNodeClient,
14
+ createCompatibleClient,
15
+ retryUntil,
16
+ } from '@aztec/aztec.js';
9
17
  import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
10
18
  import type { Logger } from '@aztec/foundation/log';
11
- import { retryUntil } from '@aztec/foundation/retry';
12
19
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
20
+ import { createPXEService } from '@aztec/pxe/server';
13
21
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
14
- import { TestWallet, proveInteraction, registerInitialSandboxAccountsInWallet } from '@aztec/test-wallet/server';
15
22
 
16
23
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
17
24
  import { getBBConfig } from '../fixtures/get_bb_config.js';
18
25
  import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
19
26
 
20
- export interface TestAccounts {
21
- aztecNode: AztecNode;
22
- wallet: TestWallet;
23
- accounts: AztecAddress[];
24
- tokenContract: TokenContract;
27
+ export interface TestWallets {
28
+ pxe: PXE;
29
+ wallets: AccountWalletWithSecretKey[];
30
+ tokenAdminWallet: TokenContract;
25
31
  tokenAdminAddress: AztecAddress;
26
32
  tokenName: string;
33
+ recipientWallet: AccountWalletWithSecretKey;
27
34
  recipientAddress: AztecAddress;
28
35
  tokenAddress: AztecAddress;
29
36
  }
@@ -32,165 +39,164 @@ const TOKEN_NAME = 'USDC';
32
39
  const TOKEN_SYMBOL = 'USD';
33
40
  const TOKEN_DECIMALS = 18n;
34
41
 
35
- export async function setupTestAccountsWithTokens(
36
- nodeUrl: string,
42
+ export async function setupTestWalletsWithTokens(
43
+ pxeUrl: string,
37
44
  mintAmount: bigint,
38
45
  logger: Logger,
39
- ): Promise<TestAccounts> {
40
- const ACCOUNT_COUNT = 1; // TODO fix this to allow for 16 wallets again
46
+ ): Promise<TestWallets> {
47
+ const WALLET_COUNT = 1; // TODO fix this to allow for 16 wallets again
41
48
 
42
- const aztecNode = createAztecNodeClient(nodeUrl);
43
- const wallet = await TestWallet.create(aztecNode);
49
+ const pxe = await createCompatibleClient(pxeUrl, logger);
44
50
 
45
- const [recipientAccount, ...accounts] = (await registerInitialSandboxAccountsInWallet(wallet)).slice(
46
- 0,
47
- ACCOUNT_COUNT + 1,
48
- );
51
+ const [recipientWallet, ...wallets] = (await getDeployedTestAccountsWallets(pxe)).slice(0, WALLET_COUNT + 1);
49
52
 
50
- const tokenAdmin = accounts[0];
51
- const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
52
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
53
+ const tokenAdmin = wallets[0];
54
+ const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
55
+ const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
53
56
 
54
57
  return {
55
- aztecNode,
56
- accounts,
57
- wallet,
58
- tokenAdminAddress: tokenAdmin,
58
+ pxe,
59
+ wallets,
60
+ tokenAdminWallet,
61
+ tokenAdminAddress: tokenAdmin.getAddress(),
59
62
  tokenName: TOKEN_NAME,
60
63
  tokenAddress,
61
- tokenContract,
62
- recipientAddress: recipientAccount,
64
+ recipientAddress: recipientWallet.getAddress(),
65
+ recipientWallet,
63
66
  };
64
67
  }
65
68
 
66
- export async function deploySponsoredTestAccounts(
67
- wallet: TestWallet,
68
- aztecNode: AztecNode,
69
+ export async function deploySponsoredTestWallets(
70
+ pxe: PXE,
69
71
  mintAmount: bigint,
70
72
  logger: Logger,
71
73
  numberOfFundedWallets = 1,
72
- ): Promise<TestAccounts> {
74
+ ): Promise<TestWallets> {
73
75
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
74
- const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
75
- const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
76
+ const recipientWallet = await getSchnorrWalletWithSecretKey(
77
+ pxe,
78
+ recipient.secret,
79
+ recipient.signingKey,
80
+ recipient.salt,
81
+ );
82
+ const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
76
83
 
77
- await registerSponsoredFPC(wallet);
84
+ await registerSponsoredFPC(pxe);
78
85
 
79
- const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
80
- const recipientDeployMethod = await recipientAccount.getDeployMethod();
81
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
82
- await Promise.all(
86
+ const wallets = await Promise.all(
83
87
  fundedAccounts.map(async a => {
84
- const deployMethod = await a.getDeployMethod();
85
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
86
- logger.info(`Account deployed at ${a.address}`);
88
+ const wallet = await a.getWallet();
89
+ const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
90
+ await a.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
91
+ logger.info(`Account deployed at ${a.getAddress()}`);
92
+ return wallet;
87
93
  }),
88
94
  );
89
95
 
90
- const tokenAdmin = fundedAccounts[0];
96
+ const tokenAdmin = wallets[0];
91
97
  const tokenAddress = await deployTokenAndMint(
92
- wallet,
93
- fundedAccounts.map(acc => acc.address),
94
- tokenAdmin.address,
98
+ wallets,
99
+ tokenAdmin.getAddress(),
95
100
  mintAmount,
96
101
  new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
97
102
  logger,
98
103
  );
99
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
104
+ const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
100
105
 
101
106
  return {
102
- aztecNode,
103
- wallet,
104
- accounts: fundedAccounts.map(acc => acc.address),
105
- tokenAdminAddress: tokenAdmin.address,
107
+ pxe,
108
+ wallets,
109
+ tokenAdminAddress: tokenAdmin.getAddress(),
110
+ tokenAdminWallet,
106
111
  tokenName: TOKEN_NAME,
107
112
  tokenAddress,
108
- tokenContract,
109
- recipientAddress: recipientAccount.address,
113
+ recipientWallet,
114
+ recipientAddress: recipientWallet.getAddress(),
110
115
  };
111
116
  }
112
117
 
113
- export async function deployTestAccountsWithTokens(
118
+ export async function deployTestWalletWithTokens(
119
+ pxeUrl: string,
114
120
  nodeUrl: string,
115
121
  l1RpcUrls: string[],
116
122
  mnemonicOrPrivateKey: string,
117
123
  mintAmount: bigint,
118
124
  logger: Logger,
119
125
  numberOfFundedWallets = 1,
120
- ): Promise<TestAccounts> {
121
- const aztecNode = createAztecNodeClient(nodeUrl);
122
- const wallet = await TestWallet.create(aztecNode);
126
+ ): Promise<TestWallets> {
127
+ const pxe = await createCompatibleClient(pxeUrl, logger);
128
+ const node = createAztecNodeClient(nodeUrl);
123
129
 
124
130
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
125
- const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
126
- const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
131
+ const recipientWallet = await getSchnorrWalletWithSecretKey(
132
+ pxe,
133
+ recipient.secret,
134
+ recipient.signingKey,
135
+ recipient.salt,
136
+ );
137
+ const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
127
138
 
128
139
  const claims = await Promise.all(
129
- fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.address, undefined, logger)),
140
+ fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)),
130
141
  );
131
142
 
132
143
  // Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
133
- await advanceL2Block(aztecNode);
134
- await advanceL2Block(aztecNode);
135
- await advanceL2Block(aztecNode);
144
+ await advanceL2Block(node);
145
+ await advanceL2Block(node);
146
+ await advanceL2Block(node);
136
147
 
137
- await Promise.all(
148
+ const wallets = await Promise.all(
138
149
  fundedAccounts.map(async (a, i) => {
139
- const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
140
- const deployMethod = await a.getDeployMethod();
141
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait();
142
- logger.info(`Account deployed at ${a.address}`);
150
+ const wallet = await a.getWallet();
151
+ const paymentMethod = new FeeJuicePaymentMethodWithClaim(wallet, claims[i]);
152
+ await a.deploy({ fee: { paymentMethod } }).wait();
153
+ logger.info(`Account deployed at ${a.getAddress()}`);
154
+ return wallet;
143
155
  }),
144
156
  );
145
157
 
146
- const tokenAdmin = fundedAccounts[0];
147
- const tokenAddress = await deployTokenAndMint(
148
- wallet,
149
- fundedAccounts.map(acc => acc.address),
150
- tokenAdmin.address,
151
- mintAmount,
152
- undefined,
153
- logger,
154
- );
155
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
158
+ const tokenAdmin = wallets[0];
159
+ const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
160
+ const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
156
161
 
157
162
  return {
158
- aztecNode,
159
- wallet,
160
- accounts: fundedAccounts.map(acc => acc.address),
161
- tokenAdminAddress: tokenAdmin.address,
163
+ pxe,
164
+ wallets,
165
+ tokenAdminAddress: tokenAdmin.getAddress(),
166
+ tokenAdminWallet,
162
167
  tokenName: TOKEN_NAME,
163
168
  tokenAddress,
164
- tokenContract,
165
- recipientAddress: recipientAccount.address,
169
+ recipientWallet,
170
+ recipientAddress: recipientWallet.getAddress(),
166
171
  };
167
172
  }
168
173
 
169
174
  async function bridgeL1FeeJuice(
170
175
  l1RpcUrls: string[],
171
176
  mnemonicOrPrivateKey: string,
172
- aztecNode: AztecNode,
177
+ pxe: PXE,
173
178
  recipient: AztecAddress,
174
179
  amount: bigint | undefined,
175
180
  log: Logger,
176
181
  ) {
177
- const { l1ChainId } = await aztecNode.getNodeInfo();
182
+ const { l1ChainId } = await pxe.getNodeInfo();
178
183
  const chain = createEthereumChain(l1RpcUrls, l1ChainId);
179
184
  const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
180
185
 
181
- const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
186
+ // docs:start:bridge_fee_juice
187
+ const portal = await L1FeeJuicePortalManager.new(pxe, l1Client, log);
182
188
  const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
189
+ // docs:end:bridge_fee_juice
183
190
 
184
- const isSynced = async () =>
185
- (await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
191
+ const isSynced = async () => await pxe.isL1ToL2MessageSynced(Fr.fromHexString(claim.messageHash));
186
192
  await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
187
193
 
188
194
  log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
189
195
  return claim;
190
196
  }
191
197
 
192
- async function advanceL2Block(aztecNode: AztecNode, nodeAdmin?: AztecNodeAdmin) {
193
- const initialBlockNumber = await aztecNode.getBlockNumber();
198
+ async function advanceL2Block(node: AztecNode, nodeAdmin?: AztecNodeAdmin) {
199
+ const initialBlockNumber = await node.getBlockNumber();
194
200
 
195
201
  let minTxsPerBlock = undefined;
196
202
  if (nodeAdmin) {
@@ -198,7 +204,7 @@ async function advanceL2Block(aztecNode: AztecNode, nodeAdmin?: AztecNodeAdmin)
198
204
  await nodeAdmin.setConfig({ minTxsPerBlock: 0 }); // Set to 0 to ensure we can advance the block
199
205
  }
200
206
 
201
- await retryUntil(async () => (await aztecNode.getBlockNumber()) >= initialBlockNumber + 1);
207
+ await retryUntil(async () => (await node.getBlockNumber()) >= initialBlockNumber + 1);
202
208
 
203
209
  if (nodeAdmin && minTxsPerBlock !== undefined) {
204
210
  await nodeAdmin.setConfig({ minTxsPerBlock });
@@ -206,15 +212,14 @@ async function advanceL2Block(aztecNode: AztecNode, nodeAdmin?: AztecNodeAdmin)
206
212
  }
207
213
 
208
214
  async function deployTokenAndMint(
209
- wallet: Wallet,
210
- accounts: AztecAddress[],
215
+ wallets: AccountWalletWithSecretKey[],
211
216
  admin: AztecAddress,
212
217
  mintAmount: bigint,
213
218
  paymentMethod: FeePaymentMethod | undefined,
214
219
  logger: Logger,
215
220
  ) {
216
221
  logger.verbose(`Deploying TokenContract...`);
217
- const tokenContract = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
222
+ const tokenContract = await TokenContract.deploy(wallets[0], admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
218
223
  .send({
219
224
  from: admin,
220
225
  fee: {
@@ -225,12 +230,12 @@ async function deployTokenAndMint(
225
230
 
226
231
  const tokenAddress = tokenContract.address;
227
232
 
228
- logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
233
+ logger.verbose(`Minting ${mintAmount} public assets to the ${wallets.length} wallets...`);
229
234
 
230
235
  await Promise.all(
231
- accounts.map(async acc =>
232
- (await TokenContract.at(tokenAddress, wallet)).methods
233
- .mint_to_public(acc, mintAmount)
236
+ wallets.map(async w =>
237
+ (await TokenContract.at(tokenAddress, w)).methods
238
+ .mint_to_public(w.getAddress(), mintAmount)
234
239
  .send({ from: admin, fee: { paymentMethod } })
235
240
  .wait({ timeout: 600 }),
236
241
  ),
@@ -242,33 +247,23 @@ async function deployTokenAndMint(
242
247
  }
243
248
 
244
249
  export async function performTransfers({
245
- wallet,
246
- testAccounts,
250
+ testWallets,
247
251
  rounds,
248
252
  transferAmount,
249
253
  logger,
250
- feePaymentMethod,
251
254
  }: {
252
- wallet: TestWallet;
253
- testAccounts: TestAccounts;
255
+ testWallets: TestWallets;
254
256
  rounds: number;
255
257
  transferAmount: bigint;
256
258
  logger: Logger;
257
- feePaymentMethod?: FeePaymentMethod;
258
259
  }) {
259
- const recipient = testAccounts.recipientAddress;
260
- // Default to sponsored fee payment if no fee method is provided
261
- const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
260
+ const recipient = testWallets.recipientWallet.getAddress();
262
261
  for (let i = 0; i < rounds; i++) {
263
- const txs = testAccounts.accounts.map(async acc => {
264
- const token = await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
265
- return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
266
- from: acc,
267
- fee: {
268
- paymentMethod: defaultFeePaymentMethod,
269
- },
270
- });
271
- });
262
+ const txs = testWallets.wallets.map(async w =>
263
+ (await TokenContract.at(testWallets.tokenAddress, w)).methods
264
+ .transfer_in_public(w.getAddress(), recipient, transferAmount, 0)
265
+ .prove({ from: w.getAddress() }),
266
+ );
272
267
 
273
268
  const provenTxs = await Promise.all(txs);
274
269
 
@@ -278,27 +273,25 @@ export async function performTransfers({
278
273
  }
279
274
  }
280
275
 
281
- export async function createWalletAndAztecNodeClient(
276
+ export async function startCompatiblePXE(
282
277
  nodeUrl: string,
283
278
  proverEnabled: boolean,
284
279
  logger: Logger,
285
- ): Promise<{ wallet: TestWallet; aztecNode: AztecNode; cleanup: () => Promise<void> }> {
286
- const aztecNode = createAztecNodeClient(nodeUrl);
280
+ ): Promise<{ pxe: PXE; cleanup: () => Promise<void> }> {
281
+ const node = createAztecNodeClient(nodeUrl);
287
282
  const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
288
- const pxeConfig = {
283
+ const pxe = await createPXEService(node, {
289
284
  dataDirectory: undefined,
290
285
  dataStoreMapSizeKb: 1024 * 1024,
291
286
  ...bbConfig,
292
287
  ...acvmConfig,
293
288
  proverEnabled,
294
- };
295
- const wallet = await TestWallet.create(aztecNode, pxeConfig);
289
+ });
296
290
 
297
291
  return {
298
- wallet,
299
- aztecNode,
292
+ pxe,
300
293
  async cleanup() {
301
- await wallet.stop();
294
+ await pxe.stop();
302
295
  await bbConfig?.cleanup();
303
296
  await acvmConfig?.cleanup();
304
297
  },