@aztec/aztec 2.1.0-rc.9 → 3.0.0-devnet.2

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 (71) hide show
  1. package/dest/bin/index.js +4 -6
  2. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  3. package/dest/cli/aztec_start_action.js +2 -14
  4. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  5. package/dest/cli/aztec_start_options.js +2 -8
  6. package/dest/cli/cmds/start_archiver.js +2 -2
  7. package/dest/cli/cmds/start_bot.d.ts +3 -6
  8. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  9. package/dest/cli/cmds/start_bot.js +13 -17
  10. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  11. package/dest/cli/cmds/start_node.js +8 -16
  12. package/dest/cli/cmds/start_prover_node.js +3 -3
  13. package/dest/cli/util.d.ts +6 -4
  14. package/dest/cli/util.d.ts.map +1 -1
  15. package/dest/cli/util.js +4 -4
  16. package/dest/cli/versioning.js +3 -3
  17. package/dest/examples/token.js +18 -16
  18. package/dest/examples/util.d.ts +1 -1
  19. package/dest/examples/util.d.ts.map +1 -1
  20. package/dest/examples/util.js +1 -1
  21. package/dest/index.d.ts +1 -1
  22. package/dest/index.d.ts.map +1 -1
  23. package/dest/index.js +1 -1
  24. package/dest/sandbox/banana_fpc.d.ts +4 -5
  25. package/dest/sandbox/banana_fpc.d.ts.map +1 -1
  26. package/dest/sandbox/banana_fpc.js +14 -18
  27. package/dest/sandbox/index.d.ts +2 -2
  28. package/dest/sandbox/index.d.ts.map +1 -1
  29. package/dest/sandbox/index.js +2 -2
  30. package/dest/sandbox/sandbox.d.ts +2 -12
  31. package/dest/sandbox/sandbox.d.ts.map +1 -1
  32. package/dest/sandbox/sandbox.js +19 -32
  33. package/dest/sandbox/sponsored_fpc.d.ts +3 -3
  34. package/dest/sandbox/sponsored_fpc.d.ts.map +1 -1
  35. package/dest/sandbox/sponsored_fpc.js +7 -8
  36. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  37. package/dest/testing/anvil_test_watcher.js +3 -4
  38. package/dest/testing/cheat_codes.d.ts +6 -7
  39. package/dest/testing/cheat_codes.d.ts.map +1 -1
  40. package/dest/testing/cheat_codes.js +9 -10
  41. package/dest/testing/index.d.ts +0 -1
  42. package/dest/testing/index.d.ts.map +1 -1
  43. package/dest/testing/index.js +0 -1
  44. package/package.json +33 -33
  45. package/src/bin/index.ts +4 -6
  46. package/src/cli/aztec_start_action.ts +2 -11
  47. package/src/cli/aztec_start_options.ts +2 -8
  48. package/src/cli/cmds/start_archiver.ts +2 -2
  49. package/src/cli/cmds/start_bot.ts +22 -13
  50. package/src/cli/cmds/start_node.ts +11 -12
  51. package/src/cli/cmds/start_prover_node.ts +3 -3
  52. package/src/cli/util.ts +8 -6
  53. package/src/cli/versioning.ts +3 -3
  54. package/src/examples/token.ts +20 -17
  55. package/src/examples/util.ts +1 -1
  56. package/src/index.ts +3 -3
  57. package/src/sandbox/banana_fpc.ts +15 -20
  58. package/src/sandbox/index.ts +5 -2
  59. package/src/sandbox/sandbox.ts +21 -32
  60. package/src/sandbox/sponsored_fpc.ts +8 -10
  61. package/src/testing/anvil_test_watcher.ts +2 -5
  62. package/src/testing/cheat_codes.ts +10 -11
  63. package/src/testing/index.ts +0 -1
  64. package/dest/cli/cmds/start_pxe.d.ts +0 -16
  65. package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
  66. package/dest/cli/cmds/start_pxe.js +0 -31
  67. package/dest/testing/aztec_cheat_codes.d.ts +0 -59
  68. package/dest/testing/aztec_cheat_codes.d.ts.map +0 -1
  69. package/dest/testing/aztec_cheat_codes.js +0 -62
  70. package/src/cli/cmds/start_pxe.ts +0 -49
  71. package/src/testing/aztec_cheat_codes.ts +0 -77
package/dest/bin/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  //
3
3
  import { injectCommands as injectBuilderCommands } from '@aztec/builder';
4
- import { injectCommands as injectWalletCommands } from '@aztec/cli-wallet';
4
+ import { injectCommands as injectAztecNodeCommands } from '@aztec/cli/aztec_node';
5
5
  import { enrichEnvironmentWithChainConfig, enrichEnvironmentWithNetworkConfig } from '@aztec/cli/config';
6
6
  import { injectCommands as injectContractCommands } from '@aztec/cli/contracts';
7
7
  import { injectCommands as injectInfrastructureCommands } from '@aztec/cli/infrastructure';
8
8
  import { injectCommands as injectL1Commands } from '@aztec/cli/l1';
9
9
  import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
10
- import { injectCommands as injectPXECommands } from '@aztec/cli/pxe';
11
10
  import { getActiveNetworkName } from '@aztec/foundation/config';
12
11
  import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
13
12
  import { Command } from 'commander';
@@ -30,19 +29,18 @@ const debugLogger = createLogger('cli');
30
29
  networkValue = args[networkIndex].split('=')[1] || args[networkIndex + 1];
31
30
  }
32
31
  const networkName = getActiveNetworkName(networkValue);
33
- await enrichEnvironmentWithChainConfig(networkName);
34
32
  await enrichEnvironmentWithNetworkConfig(networkName);
33
+ enrichEnvironmentWithChainConfig(networkName);
35
34
  const cliVersion = getCliVersion();
36
35
  let program = new Command('aztec');
37
36
  program.description('Aztec command line interface').version(cliVersion);
38
37
  program = injectAztecCommands(program, userLog, debugLogger);
39
38
  program = injectBuilderCommands(program);
40
39
  program = injectContractCommands(program, userLog, debugLogger);
41
- program = injectInfrastructureCommands(program, userLog, debugLogger);
40
+ program = injectInfrastructureCommands(program, userLog);
42
41
  program = injectL1Commands(program, userLog, debugLogger);
43
- program = injectPXECommands(program, userLog, debugLogger);
42
+ program = injectAztecNodeCommands(program, userLog, debugLogger);
44
43
  program = injectMiscCommands(program, userLog);
45
- program = injectWalletCommands(program, userLog, debugLogger);
46
44
  await program.parseAsync(process.argv);
47
45
  }
48
46
  main().catch((err)=>{
@@ -1 +1 @@
1
- {"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAY3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAsGjF"}
1
+ {"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAY3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBA6FjF"}
@@ -1,5 +1,5 @@
1
1
  import { createNamespacedSafeJsonRpcServer, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
2
- import { AztecNodeApiSchema, PXESchema } from '@aztec/stdlib/interfaces/client';
2
+ import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
3
3
  import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
4
4
  import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
5
5
  import { createSandbox } from '../sandbox/index.js';
@@ -19,11 +19,10 @@ export async function aztecStart(options, userLog, debugLogger) {
19
19
  sandboxOptions.testAccounts = true;
20
20
  userLog(`${splash}\n${github}\n\n`);
21
21
  userLog(`Setting up Aztec Sandbox ${cliVersion}, please stand by...`);
22
- const { node, pxe, stop } = await createSandbox({
22
+ const { node, stop } = await createSandbox({
23
23
  l1Mnemonic: sandboxOptions.l1Mnemonic,
24
24
  l1RpcUrls: options.l1RpcUrls,
25
25
  deployAztecContractsSalt: sandboxOptions.deployAztecContractsSalt,
26
- noPXE: sandboxOptions.noPXE,
27
26
  testAccounts: sandboxOptions.testAccounts,
28
27
  realProofs: false
29
28
  }, userLog);
@@ -33,14 +32,6 @@ export async function aztecStart(options, userLog, debugLogger) {
33
32
  node,
34
33
  AztecNodeApiSchema
35
34
  ];
36
- if (!sandboxOptions.noPXE) {
37
- services.pxe = [
38
- pxe,
39
- PXESchema
40
- ];
41
- } else {
42
- userLog(`Not exposing PXE API through JSON-RPC server`);
43
- }
44
35
  } else {
45
36
  if (options.node) {
46
37
  const { startNode } = await import('./cmds/start_node.js');
@@ -54,9 +45,6 @@ export async function aztecStart(options, userLog, debugLogger) {
54
45
  } else if (options.blobSink) {
55
46
  const { startBlobSink } = await import('./cmds/start_blob_sink.js');
56
47
  await startBlobSink(options, signalHandlers, userLog);
57
- } else if (options.pxe) {
58
- const { startPXE } = await import('./cmds/start_pxe.js');
59
- ({ config } = await startPXE(options, signalHandlers, services, userLog));
60
48
  } else if (options.archiver) {
61
49
  const { startArchiver } = await import('./cmds/start_archiver.js');
62
50
  ({ config } = await startArchiver(options, signalHandlers, services));
@@ -1 +1 @@
1
- {"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAclC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,EAAE,gBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,uBAoB1F,CAAC;AAuBF,eAAO,MAAM,gBAAgB,UAW5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CAqOlE,CAAC"}
1
+ {"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAclC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,EAAE,gBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,uBAoB1F,CAAC;AAuBF,eAAO,MAAM,gBAAgB,UAW5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CA+NlE,CAAC"}
@@ -85,12 +85,6 @@ export const aztecStartOptions = {
85
85
  defaultValue: undefined,
86
86
  env: undefined
87
87
  },
88
- {
89
- flag: '--sandbox.noPXE',
90
- description: 'Do not expose PXE service on sandbox start',
91
- env: 'NO_PXE',
92
- ...booleanConfigHelper()
93
- },
94
88
  {
95
89
  flag: '--sandbox.l1Mnemonic <value>',
96
90
  description: 'Mnemonic for L1 accounts. Will be used ',
@@ -115,7 +109,7 @@ export const aztecStartOptions = {
115
109
  },
116
110
  {
117
111
  flag: '--admin-port <value>',
118
- description: 'Port to run admin APIs of Aztec Services on on',
112
+ description: 'Port to run admin APIs of Aztec Services on',
119
113
  defaultValue: 8880,
120
114
  env: 'AZTEC_ADMIN_PORT',
121
115
  parseVal: (val)=>parseInt(val, 10)
@@ -144,7 +138,7 @@ export const aztecStartOptions = {
144
138
  ],
145
139
  STORAGE: [
146
140
  configToFlag('--data-directory', dataConfigMappings.dataDirectory),
147
- configToFlag('--data-store-map-size-kb', dataConfigMappings.dataStoreMapSizeKB)
141
+ configToFlag('--data-store-map-size-kb', dataConfigMappings.dataStoreMapSizeKb)
148
142
  ],
149
143
  'WORLD STATE': [
150
144
  configToFlag('--world-state-data-directory', worldStateConfigMappings.worldStateDataDirectory),
@@ -1,5 +1,5 @@
1
1
  import { Archiver, KVArchiverDataStore, archiverConfigMappings, getArchiverConfigFromEnv } from '@aztec/archiver';
2
- import { createLogger } from '@aztec/aztec.js';
2
+ import { createLogger } from '@aztec/aztec.js/log';
3
3
  import { blobSinkConfigMapping, createBlobSinkClient } from '@aztec/blob-sink/client';
4
4
  import { getL1Config } from '@aztec/cli/config';
5
5
  import { dataConfigMappings } from '@aztec/kv-store/config';
@@ -18,7 +18,7 @@ import { extractRelevantOptions } from '../util.js';
18
18
  ...envConfig,
19
19
  ...cliOptions
20
20
  };
21
- archiverConfig.dataStoreMapSizeKB = archiverConfig.archiverStoreMapSizeKb ?? archiverConfig.dataStoreMapSizeKB;
21
+ archiverConfig.dataStoreMapSizeKb = archiverConfig.archiverStoreMapSizeKb ?? archiverConfig.dataStoreMapSizeKb;
22
22
  if (!archiverConfig.l1Contracts.registryAddress || archiverConfig.l1Contracts.registryAddress.isZero()) {
23
23
  throw new Error('L1 registry address is required to start an Archiver');
24
24
  }
@@ -1,11 +1,8 @@
1
1
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
- import { type AztecNode, type PXE } from '@aztec/stdlib/interfaces/client';
3
+ import { type AztecNode, type AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
4
4
  import type { TelemetryClient } from '@aztec/telemetry-client';
5
+ import { TestWallet } from '@aztec/test-wallet/server';
5
6
  export declare function startBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<void>;
6
- export declare function addBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, deps: {
7
- pxe?: PXE;
8
- node?: AztecNode;
9
- telemetry: TelemetryClient;
10
- }): Promise<void>;
7
+ export declare function addBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, wallet: TestWallet, aztecNode: AztecNode, telemetry: TelemetryClient, aztecNodeAdmin?: AztecNodeAdmin): Promise<void>;
11
8
  //# sourceMappingURL=start_bot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start_bot.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_bot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAyB,MAAM,iCAAiC,CAAC;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAU/D,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBA2Bf;AAED,wBAAgB,MAAM,CACpB,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,EAAE;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAAE,iBAWlE"}
1
+ {"version":3,"file":"start_bot.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_bot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAyB,MAAM,iCAAiC,CAAC;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAKvD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAuBf;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,eAAe,EAC1B,cAAc,CAAC,EAAE,cAAc,iBAkBhC"}
@@ -1,6 +1,9 @@
1
- import { BotRunner, botConfigMappings, getBotRunnerApiHandler } from '@aztec/bot';
1
+ import { BotRunner, BotStore, botConfigMappings, getBotRunnerApiHandler } from '@aztec/bot';
2
+ import { createStore, openTmpStore } from '@aztec/kv-store/lmdb-v2';
3
+ import { allPxeConfigMappings } from '@aztec/pxe/config';
2
4
  import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
3
5
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient, makeTracedFetch } from '@aztec/telemetry-client';
6
+ import { TestWallet } from '@aztec/test-wallet/server';
4
7
  import { extractRelevantOptions } from '../util.js';
5
8
  import { getVersions } from '../versioning.js';
6
9
  export async function startBot(options, signalHandlers, services, userLog) {
@@ -18,25 +21,18 @@ export async function startBot(options, signalHandlers, services, userLog) {
18
21
  if (!config.nodeUrl) {
19
22
  throw new Error('The bot requires access to a Node');
20
23
  }
21
- const node = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
22
- // Start a PXE client that is used by the bot if required
23
- let pxe;
24
- if (options.pxe) {
25
- const { addPXE } = await import('./start_pxe.js');
26
- ({ pxe } = await addPXE(options, signalHandlers, services, userLog, {
27
- node
28
- }));
29
- }
24
+ const aztecNode = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
25
+ const pxeConfig = extractRelevantOptions(options, allPxeConfigMappings, 'pxe');
26
+ const wallet = await TestWallet.create(aztecNode, pxeConfig);
30
27
  const telemetry = initTelemetryClient(getTelemetryClientConfig());
31
- await addBot(options, signalHandlers, services, {
32
- pxe,
33
- telemetry,
34
- node
35
- });
28
+ await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
36
29
  }
37
- export function addBot(options, signalHandlers, services, deps) {
30
+ export async function addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, aztecNodeAdmin) {
38
31
  const config = extractRelevantOptions(options, botConfigMappings, 'bot');
39
- const botRunner = new BotRunner(config, deps);
32
+ const db = await (config.dataDirectory ? createStore('bot', BotStore.SCHEMA_VERSION, config) : openTmpStore('bot', true, config.dataStoreMapSizeKb));
33
+ const store = new BotStore(db);
34
+ await store.cleanupOldClaims();
35
+ const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store);
40
36
  if (!config.noStart) {
41
37
  void botRunner.start(); // Do not block since bot setup takes time
42
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAMpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAkBnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CA4HtC"}
1
+ {"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAMpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAoBnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAyHtC"}
@@ -1,13 +1,15 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
2
  import { aztecNodeConfigMappings, getConfigEnvVars } from '@aztec/aztec-node';
3
- import { Fr } from '@aztec/aztec.js';
3
+ import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
5
5
  import { getL1Config } from '@aztec/cli/config';
6
6
  import { getPublicClient } from '@aztec/ethereum';
7
7
  import { SecretValue } from '@aztec/foundation/config';
8
+ import { allPxeConfigMappings } from '@aztec/pxe/config';
8
9
  import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
9
10
  import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
10
11
  import { initTelemetryClient, telemetryClientConfigMappings } from '@aztec/telemetry-client';
12
+ import { TestWallet } from '@aztec/test-wallet/server';
11
13
  import { getGenesisValues } from '@aztec/world-state/testing';
12
14
  import { createAztecNode } from '../../sandbox/index.js';
13
15
  import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
@@ -26,7 +28,7 @@ export async function startNode(options, signalHandlers, services, adminServices
26
28
  process.exit(1);
27
29
  }
28
30
  await preloadCrsDataForVerifying(nodeConfig, userLog);
29
- const testAccounts = nodeConfig.testAccounts ? (await getInitialTestAccounts()).map((a)=>a.address) : [];
31
+ const testAccounts = nodeConfig.testAccounts ? (await getInitialTestAccountsData()).map((a)=>a.address) : [];
30
32
  const sponsoredFPCAccounts = nodeConfig.sponsoredFPC ? [
31
33
  await getSponsoredFPCAddress()
32
34
  ] : [];
@@ -98,22 +100,12 @@ export async function startNode(options, signalHandlers, services, adminServices
98
100
  ];
99
101
  // Add node stop function to signal handlers
100
102
  signalHandlers.push(node.stop.bind(node));
101
- // Add a PXE client that connects to this node if requested
102
- let pxe;
103
- if (options.pxe) {
104
- const { addPXE } = await import('./start_pxe.js');
105
- ({ pxe } = await addPXE(options, signalHandlers, services, userLog, {
106
- node
107
- }));
108
- }
109
103
  // Add a txs bot if requested
110
104
  if (options.bot) {
111
105
  const { addBot } = await import('./start_bot.js');
112
- await addBot(options, signalHandlers, services, {
113
- pxe,
114
- node,
115
- telemetry
116
- });
106
+ const pxeConfig = extractRelevantOptions(options, allPxeConfigMappings, 'pxe');
107
+ const wallet = await TestWallet.create(node, pxeConfig);
108
+ await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
117
109
  }
118
110
  if (nodeConfig.autoUpdate !== 'disabled' && nodeConfig.autoUpdateUrl) {
119
111
  await setupUpdateMonitor(nodeConfig.autoUpdate, new URL(nodeConfig.autoUpdateUrl), followsCanonicalRollup, getPublicClient(nodeConfig), nodeConfig.l1Contracts.registryAddress, signalHandlers, async (config)=>node.setConfig((await AztecNodeAdminApiSchema.setConfig.parameters().parseAsync([
@@ -1,5 +1,5 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import { Fr } from '@aztec/aztec.js';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
3
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
4
4
  import { getL1Config } from '@aztec/cli/config';
5
5
  import { getPublicClient } from '@aztec/ethereum';
@@ -32,7 +32,7 @@ export async function startProverNode(options, signalHandlers, services, userLog
32
32
  ...proverConfig,
33
33
  ...config
34
34
  };
35
- const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccounts()).map((a)=>a.address) : [];
35
+ const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccountsData()).map((a)=>a.address) : [];
36
36
  const sponsoredFPCAccounts = proverConfig.sponsoredFPC ? [
37
37
  await getSponsoredFPCAddress()
38
38
  ] : [];
@@ -1,11 +1,13 @@
1
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
2
- import type { AccountManager, EthAddress, Fr } from '@aztec/aztec.js';
2
+ import { EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { Fr } from '@aztec/aztec.js/fields';
4
+ import { AccountManager } from '@aztec/aztec.js/wallet';
3
5
  import type { ViemClient } from '@aztec/ethereum';
4
6
  import type { ConfigMappingsType } from '@aztec/foundation/config';
5
7
  import { type LogFn } from '@aztec/foundation/log';
6
8
  import type { SharedNodeConfig } from '@aztec/node-lib/config';
7
- import type { PXEService } from '@aztec/pxe/server';
8
9
  import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
10
+ import type { TestWallet } from '@aztec/test-wallet/server';
9
11
  import type { Command } from 'commander';
10
12
  import { type AztecStartOption } from './aztec_start_options.js';
11
13
  export declare const enum ExitCode {
@@ -24,7 +26,7 @@ export declare const installSignalHandlers: (logFn: LogFn, cb?: Array<() => Prom
24
26
  /**
25
27
  * Creates logs for the initial accounts
26
28
  * @param accounts - The initial accounts
27
- * @param pxe - A PXE instance to get the registered accounts
29
+ * @param wallet - A TestWallet instance to get the registered accounts
28
30
  * @returns A string array containing the initial accounts details
29
31
  */
30
32
  export declare function createAccountLogs(accountsWithSecretKeys: {
@@ -36,7 +38,7 @@ export declare function createAccountLogs(accountsWithSecretKeys: {
36
38
  * The secret key of the account
37
39
  */
38
40
  secretKey: Fr;
39
- }[], pxe: PXEService): Promise<string[]>;
41
+ }[], wallet: TestWallet): Promise<string[]>;
40
42
  export declare function getMaxLengths(sections: {
41
43
  [key: string]: AztecStartOption[];
42
44
  }): [number, number];
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAKpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAEpF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AAI,CAAC,iBA8ErD"}
package/dest/cli/util.js CHANGED
@@ -64,16 +64,16 @@ export const installSignalHandlers = (logFn, cb)=>{
64
64
  /**
65
65
  * Creates logs for the initial accounts
66
66
  * @param accounts - The initial accounts
67
- * @param pxe - A PXE instance to get the registered accounts
67
+ * @param wallet - A TestWallet instance to get the registered accounts
68
68
  * @returns A string array containing the initial accounts details
69
- */ export async function createAccountLogs(accountsWithSecretKeys, pxe) {
70
- const registeredAccounts = await pxe.getRegisteredAccounts();
69
+ */ export async function createAccountLogs(accountsWithSecretKeys, wallet) {
70
+ const registeredAccounts = await wallet.getAccounts();
71
71
  const accountLogStrings = [
72
72
  `Initial Accounts:\n\n`
73
73
  ];
74
74
  for (const accountWithSecretKey of accountsWithSecretKeys){
75
75
  const completeAddress = await accountWithSecretKey.account.getCompleteAddress();
76
- if (registeredAccounts.find((a)=>a.equals(completeAddress))) {
76
+ if (registeredAccounts.find((a)=>a.item.equals(completeAddress.address))) {
77
77
  accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
78
78
  accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
79
79
  accountLogStrings.push(` Secret Key: ${accountWithSecretKey.secretKey.toString()}\n`);
@@ -1,9 +1,9 @@
1
1
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
2
- import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
2
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
3
3
  import { getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
4
4
  export function getVersions(config) {
5
- return config ? getComponentsVersionsFromConfig(config, protocolContractTreeRoot, getVKTreeRoot()) : {
5
+ return config ? getComponentsVersionsFromConfig(config, protocolContractsHash, getVKTreeRoot()) : {
6
6
  l2CircuitsVkTreeRoot: getVKTreeRoot().toString(),
7
- l2ProtocolContractsTreeRoot: protocolContractTreeRoot.toString()
7
+ l2ProtocolContractsHash: protocolContractsHash.toString()
8
8
  };
9
9
  }
@@ -1,49 +1,51 @@
1
- import { getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
2
- import { createPXEClient } from '@aztec/aztec.js';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
5
+ import { TestWallet } from '@aztec/test-wallet/server';
5
6
  const logger = createLogger('example:token');
6
- const url = 'http://localhost:8080';
7
- const pxe = createPXEClient(url);
7
+ const nodeUrl = 'http://localhost:8080';
8
+ const node = createAztecNodeClient(nodeUrl);
8
9
  const ALICE_MINT_BALANCE = 333n;
9
10
  const TRANSFER_AMOUNT = 33n;
10
11
  /**
11
12
  * Main function.
12
13
  */ async function main() {
13
14
  logger.info('Running token contract test on HTTP interface.');
14
- const [aliceWallet, bobWallet] = await getDeployedTestAccountsWallets(pxe);
15
- const alice = aliceWallet.getAddress();
16
- const bob = bobWallet.getAddress();
15
+ const wallet = await TestWallet.create(node);
16
+ // During sandbox setup we deploy a few accounts. Below we add them to our wallet.
17
+ const [aliceInitialAccountData, bobInitialAccountData] = await getInitialTestAccountsData();
18
+ await wallet.createSchnorrAccount(aliceInitialAccountData.secret, aliceInitialAccountData.salt);
19
+ await wallet.createSchnorrAccount(bobInitialAccountData.secret, bobInitialAccountData.salt);
20
+ const alice = aliceInitialAccountData.address;
21
+ const bob = bobInitialAccountData.address;
17
22
  logger.info(`Fetched Alice and Bob accounts: ${alice.toString()}, ${bob.toString()}`);
18
23
  logger.info('Deploying Token...');
19
- const token = await TokenContract.deploy(aliceWallet, alice, 'TokenName', 'TokenSymbol', 18).send({
24
+ const token = await TokenContract.deploy(wallet, alice, 'TokenName', 'TokenSymbol', 18).send({
20
25
  from: alice
21
26
  }).deployed();
22
27
  logger.info('Token deployed');
23
- // Create the contract abstraction and link it to Alice's and Bob's wallet for future signing
24
- const tokenAlice = await TokenContract.at(token.address, aliceWallet);
25
- const tokenBob = await TokenContract.at(token.address, bobWallet);
26
28
  // Mint tokens to Alice
27
29
  logger.info(`Minting ${ALICE_MINT_BALANCE} more coins to Alice...`);
28
- await tokenAlice.methods.mint_to_private(alice, ALICE_MINT_BALANCE).send({
30
+ await token.methods.mint_to_private(alice, ALICE_MINT_BALANCE).send({
29
31
  from: alice
30
32
  }).wait();
31
33
  logger.info(`${ALICE_MINT_BALANCE} tokens were successfully minted by Alice and transferred to private`);
32
- const balanceAfterMint = await tokenAlice.methods.balance_of_private(alice).simulate({
34
+ const balanceAfterMint = await token.methods.balance_of_private(alice).simulate({
33
35
  from: alice
34
36
  });
35
37
  logger.info(`Tokens successfully minted. New Alice's balance: ${balanceAfterMint}`);
36
38
  // We will now transfer tokens from Alice to Bob
37
39
  logger.info(`Transferring ${TRANSFER_AMOUNT} tokens from Alice to Bob...`);
38
- await tokenAlice.methods.transfer(bob, TRANSFER_AMOUNT).send({
40
+ await token.methods.transfer(bob, TRANSFER_AMOUNT).send({
39
41
  from: alice
40
42
  }).wait();
41
43
  // Check the new balances
42
- const aliceBalance = await tokenAlice.methods.balance_of_private(alice).simulate({
44
+ const aliceBalance = await token.methods.balance_of_private(alice).simulate({
43
45
  from: alice
44
46
  });
45
47
  logger.info(`Alice's balance ${aliceBalance}`);
46
- const bobBalance = await tokenBob.methods.balance_of_private(bob).simulate({
48
+ const bobBalance = await token.methods.balance_of_private(bob).simulate({
47
49
  from: bob
48
50
  });
49
51
  logger.info(`Bob's balance ${bobBalance}`);
@@ -1,4 +1,4 @@
1
- import { EthAddress } from '@aztec/aztec.js';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
2
  import type { ExtendedViemWalletClient } from '@aztec/ethereum';
3
3
  import type { Abi, Narrow } from 'abitype';
4
4
  import type { Hex } from 'viem';
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/examples/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,wBAAwB,EAClC,GAAG,EAAE,MAAM,CAAC,GAAG,GAAG,SAAS,OAAO,EAAE,CAAC,EACrC,QAAQ,EAAE,GAAG,EACb,IAAI,GAAE,SAAS,OAAO,EAAO,GAC5B,OAAO,CAAC,UAAU,CAAC,CAcrB;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/examples/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,wBAAwB,EAClC,GAAG,EAAE,MAAM,CAAC,GAAG,GAAG,SAAS,OAAO,EAAE,CAAC,EACrC,QAAQ,EAAE,GAAG,EACb,IAAI,GAAE,SAAS,OAAO,EAAO,GAC5B,OAAO,CAAC,UAAU,CAAC,CAcrB;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C"}
@@ -1,4 +1,4 @@
1
- import { EthAddress } from '@aztec/aztec.js';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
2
  import { jsonStringify } from '@aztec/foundation/json-rpc';
3
3
  /**
4
4
  * Helper function to deploy ETH contracts.
package/dest/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { createSandbox, getDeployedBananaCoinAddress, getDeployedBananaFPCAddress, getDeployedSponsoredFPCAddress, } from './sandbox/index.js';
1
+ export { createSandbox, registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, registerDeployedSponsoredFPCInWalletAndGetAddress, } from './sandbox/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,+CAA+C,EAC/C,8CAA8C,EAC9C,iDAAiD,GAClD,MAAM,oBAAoB,CAAC"}
package/dest/index.js CHANGED
@@ -1 +1 @@
1
- export { createSandbox, getDeployedBananaCoinAddress, getDeployedBananaFPCAddress, getDeployedSponsoredFPCAddress } from './sandbox/index.js';
1
+ export { createSandbox, registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, registerDeployedSponsoredFPCInWalletAndGetAddress } from './sandbox/index.js';
@@ -1,11 +1,10 @@
1
1
  import { type InitialAccountData } from '@aztec/accounts/testing';
2
- import type { Wallet } from '@aztec/aztec.js';
2
+ import type { Wallet } from '@aztec/aztec.js/wallet';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import type { PXE } from '@aztec/stdlib/interfaces/client';
6
5
  export declare function getBananaCoinAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
7
6
  export declare function getBananaFPCAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
8
- export declare function setupBananaFPC(initialAccounts: InitialAccountData[], deployer: Wallet, log: LogFn): Promise<void>;
9
- export declare function getDeployedBananaCoinAddress(pxe: PXE): Promise<AztecAddress>;
10
- export declare function getDeployedBananaFPCAddress(pxe: PXE): Promise<AztecAddress>;
7
+ export declare function setupBananaFPC(initialAccounts: InitialAccountData[], wallet: Wallet, log: LogFn): Promise<void>;
8
+ export declare function registerDeployedBananaCoinInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
9
+ export declare function registerDeployedBananaFPCInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
11
10
  //# sourceMappingURL=banana_fpc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"banana_fpc.d.ts","sourceRoot":"","sources":["../../src/sandbox/banana_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAuB3D,wBAAsB,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE/E;AAWD,wBAAsB,mBAAmB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE9E;AAED,wBAAsB,cAAc,CAAC,eAAe,EAAE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAcvG;AAED,wBAAsB,4BAA4B,CAAC,GAAG,EAAE,GAAG,yBAQ1D;AAED,wBAAsB,2BAA2B,CAAC,GAAG,EAAE,GAAG,yBAQzD"}
1
+ {"version":3,"file":"banana_fpc.d.ts","sourceRoot":"","sources":["../../src/sandbox/banana_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAwB3D,wBAAsB,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE/E;AAWD,wBAAsB,mBAAmB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE9E;AAED,wBAAsB,cAAc,CAAC,eAAe,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAcrG;AAED,wBAAsB,+CAA+C,CAAC,MAAM,EAAE,MAAM,yBAMnF;AAED,wBAAsB,8CAA8C,CAAC,MAAM,EAAE,MAAM,yBAMlF"}
@@ -1,4 +1,4 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { FPCContract } from '@aztec/noir-contracts.js/FPC';
4
4
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
@@ -43,16 +43,16 @@ async function getBananaFPCInstance(initialAccounts) {
43
43
  export async function getBananaFPCAddress(initialAccounts) {
44
44
  return (await getBananaFPCInstance(initialAccounts)).address;
45
45
  }
46
- export async function setupBananaFPC(initialAccounts, deployer, log) {
46
+ export async function setupBananaFPC(initialAccounts, wallet, log) {
47
47
  const bananaCoinAddress = await getBananaCoinAddress(initialAccounts);
48
48
  const admin = getBananaAdmin(initialAccounts);
49
49
  const [bananaCoin, fpc] = await Promise.all([
50
- TokenContract.deploy(deployer, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal).send({
50
+ TokenContract.deploy(wallet, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal).send({
51
51
  from: admin,
52
52
  contractAddressSalt: BANANA_COIN_SALT,
53
53
  universalDeploy: true
54
54
  }).deployed(),
55
- FPCContract.deploy(deployer, bananaCoinAddress, admin).send({
55
+ FPCContract.deploy(wallet, bananaCoinAddress, admin).send({
56
56
  from: admin,
57
57
  contractAddressSalt: BANANA_FPC_SALT,
58
58
  universalDeploy: true
@@ -61,21 +61,17 @@ export async function setupBananaFPC(initialAccounts, deployer, log) {
61
61
  log(`BananaCoin: ${bananaCoin.address}`);
62
62
  log(`FPC: ${fpc.address}`);
63
63
  }
64
- export async function getDeployedBananaCoinAddress(pxe) {
65
- const initialAccounts = await getInitialTestAccounts();
66
- const bananaCoin = await getBananaCoinAddress(initialAccounts);
67
- const contracts = await pxe.getContracts();
68
- if (!contracts.find((c)=>c.equals(bananaCoin))) {
69
- throw new Error('BananaCoin not deployed.');
70
- }
71
- return bananaCoin;
64
+ export async function registerDeployedBananaCoinInWalletAndGetAddress(wallet) {
65
+ const initialAccounts = await getInitialTestAccountsData();
66
+ const bananaCoin = await getBananaCoinInstance(initialAccounts);
67
+ // The following is no-op if the contract is already registered
68
+ await wallet.registerContract(bananaCoin, TokenContract.artifact);
69
+ return bananaCoin.address;
72
70
  }
73
- export async function getDeployedBananaFPCAddress(pxe) {
74
- const initialAccounts = await getInitialTestAccounts();
71
+ export async function registerDeployedBananaFPCInWalletAndGetAddress(wallet) {
72
+ const initialAccounts = await getInitialTestAccountsData();
75
73
  const fpc = await getBananaFPCInstance(initialAccounts);
76
- const contracts = await pxe.getContracts();
77
- if (!contracts.find((c)=>c.equals(fpc.address))) {
78
- throw new Error('BananaFPC not deployed.');
79
- }
74
+ // The following is no-op if the contract is already registered
75
+ await wallet.registerContract(fpc, FPCContract.artifact);
80
76
  return fpc.address;
81
77
  }
@@ -1,4 +1,4 @@
1
1
  export * from './sandbox.js';
2
- export { getDeployedBananaCoinAddress, getDeployedBananaFPCAddress } from './banana_fpc.js';
3
- export { getDeployedSponsoredFPCAddress } from './sponsored_fpc.js';
2
+ export { registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, } from './banana_fpc.js';
3
+ export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,+CAA+C,EAC/C,8CAA8C,GAC/C,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iDAAiD,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from './sandbox.js';
2
- export { getDeployedBananaCoinAddress, getDeployedBananaFPCAddress } from './banana_fpc.js';
3
- export { getDeployedSponsoredFPCAddress } from './sponsored_fpc.js';
2
+ export { registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress } from './banana_fpc.js';
3
+ export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';