@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
@@ -1,59 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { PXE } from '@aztec/stdlib/interfaces/client';
4
- import type { Note } from '@aztec/stdlib/note';
5
- /**
6
- * A class that provides utility functions for interacting with the aztec chain.
7
- */
8
- export declare class AztecCheatCodes {
9
- /**
10
- * The PXE Service to use for interacting with the chain
11
- */
12
- pxe: PXE;
13
- /**
14
- * The logger to use for the aztec cheatcodes
15
- */
16
- logger: import("@aztec/foundation/log").Logger;
17
- constructor(
18
- /**
19
- * The PXE Service to use for interacting with the chain
20
- */
21
- pxe: PXE,
22
- /**
23
- * The logger to use for the aztec cheatcodes
24
- */
25
- logger?: import("@aztec/foundation/log").Logger);
26
- /**
27
- * Computes the slot value for a given map and key.
28
- * @param mapSlot - The slot of the map (specified in Aztec.nr contract)
29
- * @param key - The key to lookup in the map
30
- * @returns The storage slot of the value in the map
31
- */
32
- computeSlotInMap(mapSlot: Fr | bigint, key: Fr | bigint | AztecAddress): Promise<Fr>;
33
- /**
34
- * Get the current blocknumber
35
- * @returns The current block number
36
- */
37
- blockNumber(): Promise<number>;
38
- /**
39
- * Get the current timestamp
40
- * @returns The current timestamp
41
- */
42
- timestamp(): Promise<number>;
43
- /**
44
- * Loads the value stored at the given slot in the public storage of the given contract.
45
- * @param who - The address of the contract
46
- * @param slot - The storage slot to lookup
47
- * @returns The value stored at the given slot
48
- */
49
- loadPublic(who: AztecAddress, slot: Fr | bigint): Promise<Fr>;
50
- /**
51
- * Loads the value stored at the given slot in the private storage of the given contract.
52
- * @param contract - The address of the contract
53
- * @param recipient - The address whose public key was used to encrypt the note
54
- * @param slot - The storage slot to lookup
55
- * @returns The notes stored at the given slot
56
- */
57
- loadPrivate(recipient: AztecAddress, contract: AztecAddress, slot: Fr | bigint): Promise<Note[]>;
58
- }
59
- //# sourceMappingURL=aztec_cheat_codes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aztec_cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/aztec_cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAe;IAExB;;OAEG;IACI,GAAG,EAAE,GAAG;IACf;;OAEG;IACI,MAAM;;IAPb;;OAEG;IACI,GAAG,EAAE,GAAG;IACf;;OAEG;IACI,MAAM,yCAAsC;IAGrD;;;;;OAKG;IACI,gBAAgB,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC;IAK3F;;;OAGG;IACU,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAKzC;;;;;OAKG;IACU,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IAK1E;;;;;;OAMG;IACU,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;CAQ9G"}
@@ -1,62 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { createLogger } from '@aztec/foundation/log';
3
- import { deriveStorageSlotInMap } from '@aztec/stdlib/hash';
4
- /**
5
- * A class that provides utility functions for interacting with the aztec chain.
6
- */ export class AztecCheatCodes {
7
- pxe;
8
- logger;
9
- constructor(/**
10
- * The PXE Service to use for interacting with the chain
11
- */ pxe, /**
12
- * The logger to use for the aztec cheatcodes
13
- */ logger = createLogger('aztecjs:cheat_codes')){
14
- this.pxe = pxe;
15
- this.logger = logger;
16
- }
17
- /**
18
- * Computes the slot value for a given map and key.
19
- * @param mapSlot - The slot of the map (specified in Aztec.nr contract)
20
- * @param key - The key to lookup in the map
21
- * @returns The storage slot of the value in the map
22
- */ computeSlotInMap(mapSlot, key) {
23
- const keyFr = typeof key === 'bigint' ? new Fr(key) : key.toField();
24
- return deriveStorageSlotInMap(mapSlot, keyFr);
25
- }
26
- /**
27
- * Get the current blocknumber
28
- * @returns The current block number
29
- */ async blockNumber() {
30
- return await this.pxe.getBlockNumber();
31
- }
32
- /**
33
- * Get the current timestamp
34
- * @returns The current timestamp
35
- */ async timestamp() {
36
- const res = await this.pxe.getBlock(await this.blockNumber());
37
- return Number(res?.header.globalVariables.timestamp ?? 0);
38
- }
39
- /**
40
- * Loads the value stored at the given slot in the public storage of the given contract.
41
- * @param who - The address of the contract
42
- * @param slot - The storage slot to lookup
43
- * @returns The value stored at the given slot
44
- */ async loadPublic(who, slot) {
45
- const storageValue = await this.pxe.getPublicStorageAt(who, new Fr(slot));
46
- return storageValue;
47
- }
48
- /**
49
- * Loads the value stored at the given slot in the private storage of the given contract.
50
- * @param contract - The address of the contract
51
- * @param recipient - The address whose public key was used to encrypt the note
52
- * @param slot - The storage slot to lookup
53
- * @returns The notes stored at the given slot
54
- */ async loadPrivate(recipient, contract, slot) {
55
- const extendedNotes = await this.pxe.getNotes({
56
- recipient,
57
- contractAddress: contract,
58
- storageSlot: new Fr(slot)
59
- });
60
- return extendedNotes.map((extendedNote)=>extendedNote.note);
61
- }
62
- }
@@ -1,49 +0,0 @@
1
- import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
2
- import type { LogFn } from '@aztec/foundation/log';
3
- import {
4
- type CliPXEOptions,
5
- type PXEService,
6
- type PXEServiceConfig,
7
- allPxeConfigMappings,
8
- createPXEService,
9
- } from '@aztec/pxe/server';
10
- import { type AztecNode, PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
11
- import { makeTracedFetch } from '@aztec/telemetry-client';
12
-
13
- import { extractRelevantOptions } from '../util.js';
14
- import { getVersions } from '../versioning.js';
15
-
16
- export type { PXEServiceConfig, CliPXEOptions };
17
-
18
- export async function startPXE(
19
- options: any,
20
- signalHandlers: (() => Promise<void>)[],
21
- services: NamespacedApiHandlers,
22
- userLog: LogFn,
23
- ): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
24
- return await addPXE(options, signalHandlers, services, userLog, {});
25
- }
26
-
27
- export async function addPXE(
28
- options: any,
29
- _signalHandlers: (() => Promise<void>)[],
30
- services: NamespacedApiHandlers,
31
- userLog: LogFn,
32
- deps: { node?: AztecNode } = {},
33
- ): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
34
- const pxeConfig = extractRelevantOptions<PXEServiceConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
35
- const nodeUrl = pxeConfig.nodeUrl;
36
-
37
- if (!nodeUrl && !deps.node) {
38
- userLog('Aztec Node URL (nodeUrl | AZTEC_NODE_URL) option is required to start PXE without --node option');
39
- process.exit(1);
40
- }
41
-
42
- const node = deps.node ?? createAztecNodeClient(nodeUrl!, getVersions(pxeConfig), makeTracedFetch([1, 2, 3], true));
43
- const pxe = await createPXEService(node, pxeConfig as PXEServiceConfig);
44
-
45
- // Add PXE to services list
46
- services.pxe = [pxe, PXESchema];
47
-
48
- return { pxe, config: pxeConfig };
49
- }
@@ -1,77 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { createLogger } from '@aztec/foundation/log';
3
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import { deriveStorageSlotInMap } from '@aztec/stdlib/hash';
5
- import type { PXE } from '@aztec/stdlib/interfaces/client';
6
- import type { Note } from '@aztec/stdlib/note';
7
-
8
- /**
9
- * A class that provides utility functions for interacting with the aztec chain.
10
- */
11
- export class AztecCheatCodes {
12
- constructor(
13
- /**
14
- * The PXE Service to use for interacting with the chain
15
- */
16
- public pxe: PXE,
17
- /**
18
- * The logger to use for the aztec cheatcodes
19
- */
20
- public logger = createLogger('aztecjs:cheat_codes'),
21
- ) {}
22
-
23
- /**
24
- * Computes the slot value for a given map and key.
25
- * @param mapSlot - The slot of the map (specified in Aztec.nr contract)
26
- * @param key - The key to lookup in the map
27
- * @returns The storage slot of the value in the map
28
- */
29
- public computeSlotInMap(mapSlot: Fr | bigint, key: Fr | bigint | AztecAddress): Promise<Fr> {
30
- const keyFr = typeof key === 'bigint' ? new Fr(key) : key.toField();
31
- return deriveStorageSlotInMap(mapSlot, keyFr);
32
- }
33
-
34
- /**
35
- * Get the current blocknumber
36
- * @returns The current block number
37
- */
38
- public async blockNumber(): Promise<number> {
39
- return await this.pxe.getBlockNumber();
40
- }
41
-
42
- /**
43
- * Get the current timestamp
44
- * @returns The current timestamp
45
- */
46
- public async timestamp(): Promise<number> {
47
- const res = await this.pxe.getBlock(await this.blockNumber());
48
- return Number(res?.header.globalVariables.timestamp ?? 0);
49
- }
50
-
51
- /**
52
- * Loads the value stored at the given slot in the public storage of the given contract.
53
- * @param who - The address of the contract
54
- * @param slot - The storage slot to lookup
55
- * @returns The value stored at the given slot
56
- */
57
- public async loadPublic(who: AztecAddress, slot: Fr | bigint): Promise<Fr> {
58
- const storageValue = await this.pxe.getPublicStorageAt(who, new Fr(slot));
59
- return storageValue;
60
- }
61
-
62
- /**
63
- * Loads the value stored at the given slot in the private storage of the given contract.
64
- * @param contract - The address of the contract
65
- * @param recipient - The address whose public key was used to encrypt the note
66
- * @param slot - The storage slot to lookup
67
- * @returns The notes stored at the given slot
68
- */
69
- public async loadPrivate(recipient: AztecAddress, contract: AztecAddress, slot: Fr | bigint): Promise<Note[]> {
70
- const extendedNotes = await this.pxe.getNotes({
71
- recipient,
72
- contractAddress: contract,
73
- storageSlot: new Fr(slot),
74
- });
75
- return extendedNotes.map(extendedNote => extendedNote.note);
76
- }
77
- }