@aztec/aztec 3.0.0-canary.a9708bd → 3.0.0-devnet.3
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.
- package/dest/bin/index.js +7 -9
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +2 -17
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +105 -225
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +3 -3
- package/dest/cli/cmds/start_blob_sink.d.ts.map +1 -1
- package/dest/cli/cmds/start_blob_sink.js +1 -1
- package/dest/cli/cmds/start_bot.d.ts +3 -6
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +24 -13
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +9 -26
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +10 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +7 -2
- package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_node.js +14 -9
- package/dest/cli/util.d.ts +6 -4
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +10 -10
- package/dest/cli/versioning.js +3 -3
- package/dest/examples/token.js +18 -16
- package/dest/examples/util.d.ts +1 -1
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/examples/util.js +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/sandbox/banana_fpc.d.ts +4 -5
- package/dest/sandbox/banana_fpc.d.ts.map +1 -1
- package/dest/sandbox/banana_fpc.js +14 -18
- package/dest/sandbox/index.d.ts +2 -2
- package/dest/sandbox/index.d.ts.map +1 -1
- package/dest/sandbox/index.js +2 -2
- package/dest/sandbox/sandbox.d.ts +3 -12
- package/dest/sandbox/sandbox.d.ts.map +1 -1
- package/dest/sandbox/sandbox.js +19 -32
- package/dest/sandbox/sponsored_fpc.d.ts +3 -3
- package/dest/sandbox/sponsored_fpc.d.ts.map +1 -1
- package/dest/sandbox/sponsored_fpc.js +7 -8
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +3 -4
- package/dest/testing/cheat_codes.d.ts +6 -7
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +9 -10
- package/dest/testing/index.d.ts +0 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +0 -1
- package/package.json +34 -33
- package/src/bin/index.ts +7 -9
- package/src/cli/aztec_start_action.ts +2 -14
- package/src/cli/aztec_start_options.ts +113 -232
- package/src/cli/cmds/start_archiver.ts +3 -3
- package/src/cli/cmds/start_blob_sink.ts +1 -1
- package/src/cli/cmds/start_bot.ts +35 -12
- package/src/cli/cmds/start_node.ts +12 -23
- package/src/cli/cmds/start_prover_agent.ts +6 -1
- package/src/cli/cmds/start_prover_broker.ts +16 -2
- package/src/cli/cmds/start_prover_node.ts +11 -11
- package/src/cli/util.ts +17 -14
- package/src/cli/versioning.ts +3 -3
- package/src/examples/token.ts +20 -17
- package/src/examples/util.ts +1 -1
- package/src/index.ts +3 -3
- package/src/sandbox/banana_fpc.ts +15 -20
- package/src/sandbox/index.ts +5 -2
- package/src/sandbox/sandbox.ts +21 -32
- package/src/sandbox/sponsored_fpc.ts +8 -10
- package/src/testing/anvil_test_watcher.ts +2 -5
- package/src/testing/cheat_codes.ts +10 -11
- package/src/testing/index.ts +0 -1
- package/dest/cli/chain_l2_config.d.ts +0 -31
- package/dest/cli/chain_l2_config.d.ts.map +0 -1
- package/dest/cli/chain_l2_config.js +0 -261
- package/dest/cli/cmds/start_faucet.d.ts +0 -4
- package/dest/cli/cmds/start_faucet.d.ts.map +0 -1
- package/dest/cli/cmds/start_faucet.js +0 -20
- package/dest/cli/cmds/start_pxe.d.ts +0 -16
- package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
- package/dest/cli/cmds/start_pxe.js +0 -31
- package/dest/cli/get_l1_config.d.ts +0 -7
- package/dest/cli/get_l1_config.d.ts.map +0 -1
- package/dest/cli/get_l1_config.js +0 -13
- package/dest/testing/aztec_cheat_codes.d.ts +0 -59
- package/dest/testing/aztec_cheat_codes.d.ts.map +0 -1
- package/dest/testing/aztec_cheat_codes.js +0 -62
- package/src/cli/chain_l2_config.ts +0 -341
- package/src/cli/cmds/start_faucet.ts +0 -34
- package/src/cli/cmds/start_pxe.ts +0 -49
- package/src/cli/get_l1_config.ts +0 -19
- package/src/testing/aztec_cheat_codes.ts +0 -77
|
@@ -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
|
|
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,
|
|
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;
|
|
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,27 +1,38 @@
|
|
|
1
|
-
import { BotRunner, botConfigMappings, getBotRunnerApiHandler } from '@aztec/bot';
|
|
2
|
-
import {
|
|
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';
|
|
4
|
+
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
5
|
+
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient, makeTracedFetch } from '@aztec/telemetry-client';
|
|
6
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
3
7
|
import { extractRelevantOptions } from '../util.js';
|
|
8
|
+
import { getVersions } from '../versioning.js';
|
|
4
9
|
export async function startBot(options, signalHandlers, services, userLog) {
|
|
5
10
|
const { proverNode, archiver, sequencer, p2pBootstrap, txe, prover } = options;
|
|
6
11
|
if (proverNode || archiver || sequencer || p2pBootstrap || txe || prover) {
|
|
7
12
|
userLog(`Starting a bot with --prover-node, --prover, --archiver, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
8
13
|
process.exit(1);
|
|
9
14
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
const fetch = makeTracedFetch([
|
|
16
|
+
1,
|
|
17
|
+
2,
|
|
18
|
+
3
|
|
19
|
+
], true);
|
|
20
|
+
const config = extractRelevantOptions(options, botConfigMappings, 'bot');
|
|
21
|
+
if (!config.nodeUrl) {
|
|
22
|
+
throw new Error('The bot requires access to a Node');
|
|
15
23
|
}
|
|
24
|
+
const aztecNode = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
|
|
25
|
+
const pxeConfig = extractRelevantOptions(options, allPxeConfigMappings, 'pxe');
|
|
26
|
+
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
16
27
|
const telemetry = initTelemetryClient(getTelemetryClientConfig());
|
|
17
|
-
await addBot(options, signalHandlers, services,
|
|
18
|
-
pxe,
|
|
19
|
-
telemetry
|
|
20
|
-
});
|
|
28
|
+
await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
|
|
21
29
|
}
|
|
22
|
-
export function addBot(options, signalHandlers, services,
|
|
30
|
+
export async function addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, aztecNodeAdmin) {
|
|
23
31
|
const config = extractRelevantOptions(options, botConfigMappings, 'bot');
|
|
24
|
-
const
|
|
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);
|
|
25
36
|
if (!config.noStart) {
|
|
26
37
|
void botRunner.start(); // Do not block since bot setup takes time
|
|
27
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;
|
|
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,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
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
|
+
import { getL1Config } from '@aztec/cli/config';
|
|
5
6
|
import { getPublicClient } from '@aztec/ethereum';
|
|
6
7
|
import { SecretValue } from '@aztec/foundation/config';
|
|
8
|
+
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
7
9
|
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
8
10
|
import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
9
11
|
import { initTelemetryClient, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
12
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
10
13
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
11
14
|
import { createAztecNode } from '../../sandbox/index.js';
|
|
12
|
-
import { getL1Config } from '../get_l1_config.js';
|
|
13
15
|
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
|
|
14
16
|
export async function startNode(options, signalHandlers, services, adminServices, userLog) {
|
|
15
17
|
// All options set from environment variables
|
|
@@ -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
|
|
31
|
+
const testAccounts = nodeConfig.testAccounts ? (await getInitialTestAccountsData()).map((a)=>a.address) : [];
|
|
30
32
|
const sponsoredFPCAccounts = nodeConfig.sponsoredFPC ? [
|
|
31
33
|
await getSponsoredFPCAddress()
|
|
32
34
|
] : [];
|
|
@@ -52,15 +54,6 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
52
54
|
},
|
|
53
55
|
...config
|
|
54
56
|
};
|
|
55
|
-
if (!options.archiver) {
|
|
56
|
-
// expect archiver url in node config
|
|
57
|
-
const archiverUrl = nodeConfig.archiverUrl;
|
|
58
|
-
if (!archiverUrl) {
|
|
59
|
-
userLog('Archiver Service URL is required to start Aztec Node without --archiver option');
|
|
60
|
-
throw new Error('Archiver Service URL is required to start Aztec Node without --archiver option');
|
|
61
|
-
}
|
|
62
|
-
nodeConfig.archiverUrl = archiverUrl;
|
|
63
|
-
}
|
|
64
57
|
if (!options.sequencer) {
|
|
65
58
|
nodeConfig.disableValidator = true;
|
|
66
59
|
} else {
|
|
@@ -107,22 +100,12 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
107
100
|
];
|
|
108
101
|
// Add node stop function to signal handlers
|
|
109
102
|
signalHandlers.push(node.stop.bind(node));
|
|
110
|
-
// Add a PXE client that connects to this node if requested
|
|
111
|
-
let pxe;
|
|
112
|
-
if (options.pxe) {
|
|
113
|
-
const { addPXE } = await import('./start_pxe.js');
|
|
114
|
-
({ pxe } = await addPXE(options, signalHandlers, services, userLog, {
|
|
115
|
-
node
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
103
|
// Add a txs bot if requested
|
|
119
104
|
if (options.bot) {
|
|
120
105
|
const { addBot } = await import('./start_bot.js');
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
telemetry
|
|
125
|
-
});
|
|
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);
|
|
126
109
|
}
|
|
127
110
|
if (nodeConfig.autoUpdate !== 'disabled' && nodeConfig.autoUpdateUrl) {
|
|
128
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAgEf"}
|
|
@@ -25,9 +25,18 @@ export async function startProverAgent(options, signalHandlers, services, userLo
|
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
await preloadCrsDataForServerSideProving(config, userLog);
|
|
28
|
-
const fetch = makeTracedFetch(
|
|
28
|
+
const fetch = makeTracedFetch(// retry connections every 3s, up to 30s before giving up
|
|
29
|
+
[
|
|
29
30
|
1,
|
|
30
31
|
2,
|
|
32
|
+
3,
|
|
33
|
+
3,
|
|
34
|
+
3,
|
|
35
|
+
3,
|
|
36
|
+
3,
|
|
37
|
+
3,
|
|
38
|
+
3,
|
|
39
|
+
3,
|
|
31
40
|
3
|
|
32
41
|
], false, makeUndiciFetch(new Agent({
|
|
33
42
|
connections: 10
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_prover_broker.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_broker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start_prover_broker.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_broker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAKxE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,CA4CnE"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { getL1Config } from '@aztec/cli/config';
|
|
2
|
+
import { getPublicClient } from '@aztec/ethereum';
|
|
1
3
|
import { ProvingJobBrokerSchema, createAndStartProvingBroker, proverBrokerConfigMappings } from '@aztec/prover-client/broker';
|
|
2
4
|
import { getProverNodeBrokerConfigFromEnv } from '@aztec/prover-node';
|
|
3
5
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
4
|
-
import {
|
|
5
|
-
import { extractRelevantOptions } from '../util.js';
|
|
6
|
+
import { extractRelevantOptions, setupUpdateMonitor } from '../util.js';
|
|
6
7
|
export async function startProverBroker(options, signalHandlers, services, userLog) {
|
|
7
8
|
if (options.node || options.sequencer || options.pxe || options.p2pBootstrap || options.txe) {
|
|
8
9
|
userLog(`Starting a prover broker with --node, --sequencer, --pxe, --p2p-bootstrap, or --txe is not supported.`);
|
|
@@ -15,11 +16,15 @@ export async function startProverBroker(options, signalHandlers, services, userL
|
|
|
15
16
|
if (!config.l1Contracts.registryAddress || config.l1Contracts.registryAddress.isZero()) {
|
|
16
17
|
throw new Error('L1 registry address is required to start Aztec Node without --deploy-aztec-contracts option');
|
|
17
18
|
}
|
|
19
|
+
const followsCanonicalRollup = typeof config.rollupVersion !== 'number';
|
|
18
20
|
const { addresses, config: rollupConfig } = await getL1Config(config.l1Contracts.registryAddress, config.l1RpcUrls, config.l1ChainId, config.rollupVersion);
|
|
19
21
|
config.l1Contracts = addresses;
|
|
20
22
|
config.rollupVersion = rollupConfig.rollupVersion;
|
|
21
23
|
const client = initTelemetryClient(getTelemetryClientConfig());
|
|
22
24
|
const broker = await createAndStartProvingBroker(config, client);
|
|
25
|
+
if (options.autoUpdate !== 'disabled' && options.autoUpdateUrl) {
|
|
26
|
+
await setupUpdateMonitor(options.autoUpdate, new URL(options.autoUpdateUrl), followsCanonicalRollup, getPublicClient(config), config.l1Contracts.registryAddress, signalHandlers);
|
|
27
|
+
}
|
|
23
28
|
services.proverBroker = [
|
|
24
29
|
broker,
|
|
25
30
|
ProvingJobBrokerSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_prover_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start_prover_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_node.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,oBAAoB,CAAC;AAS5B,wBAAsB,eAAe,CACnC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CA+FvC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
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
|
+
import { getL1Config } from '@aztec/cli/config';
|
|
4
5
|
import { getPublicClient } from '@aztec/ethereum';
|
|
5
6
|
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
6
7
|
import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
|
|
@@ -8,7 +9,6 @@ import { createProverNode, getProverNodeConfigFromEnv, proverNodeConfigMappings
|
|
|
8
9
|
import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
9
10
|
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
10
11
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
11
|
-
import { getL1Config } from '../get_l1_config.js';
|
|
12
12
|
import { extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
|
|
13
13
|
import { getVersions } from '../versioning.js';
|
|
14
14
|
import { startProverBroker } from './start_prover_broker.js';
|
|
@@ -21,12 +21,8 @@ export async function startProverNode(options, signalHandlers, services, userLog
|
|
|
21
21
|
...getProverNodeConfigFromEnv(),
|
|
22
22
|
...extractRelevantOptions(options, proverNodeConfigMappings, 'proverNode')
|
|
23
23
|
};
|
|
24
|
-
if (!options.archiver && !proverConfig.archiverUrl) {
|
|
25
|
-
userLog('--archiver.archiverUrl is required to start a Prover Node without --archiver option');
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
24
|
if (!proverConfig.l1Contracts.registryAddress || proverConfig.l1Contracts.registryAddress.isZero()) {
|
|
29
|
-
throw new Error('L1 registry address is required to start a Prover Node
|
|
25
|
+
throw new Error('L1 registry address is required to start a Prover Node');
|
|
30
26
|
}
|
|
31
27
|
const followsCanonicalRollup = typeof proverConfig.rollupVersion !== 'number';
|
|
32
28
|
const { addresses, config } = await getL1Config(proverConfig.l1Contracts.registryAddress, proverConfig.l1RpcUrls, proverConfig.l1ChainId, proverConfig.rollupVersion);
|
|
@@ -36,7 +32,7 @@ export async function startProverNode(options, signalHandlers, services, userLog
|
|
|
36
32
|
...proverConfig,
|
|
37
33
|
...config
|
|
38
34
|
};
|
|
39
|
-
const testAccounts = proverConfig.testAccounts ? (await
|
|
35
|
+
const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccountsData()).map((a)=>a.address) : [];
|
|
40
36
|
const sponsoredFPCAccounts = proverConfig.sponsoredFPC ? [
|
|
41
37
|
await getSponsoredFPCAddress()
|
|
42
38
|
] : [];
|
|
@@ -52,9 +48,18 @@ export async function startProverNode(options, signalHandlers, services, userLog
|
|
|
52
48
|
if (proverConfig.proverBrokerUrl) {
|
|
53
49
|
// at 1TPS we'd enqueue ~1k tube proofs and ~1k AVM proofs immediately
|
|
54
50
|
// set a lower connection limit such that we don't overload the server
|
|
51
|
+
// Keep retrying up to 30s
|
|
55
52
|
const fetch = makeTracedFetch([
|
|
56
53
|
1,
|
|
57
54
|
2,
|
|
55
|
+
3,
|
|
56
|
+
3,
|
|
57
|
+
3,
|
|
58
|
+
3,
|
|
59
|
+
3,
|
|
60
|
+
3,
|
|
61
|
+
3,
|
|
62
|
+
3,
|
|
58
63
|
3
|
|
59
64
|
], false, makeUndiciFetch(new Agent({
|
|
60
65
|
connections: 100
|
package/dest/cli/util.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
|
-
import
|
|
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
|
|
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
|
-
}[],
|
|
41
|
+
}[], wallet: TestWallet): Promise<string[]>;
|
|
40
42
|
export declare function getMaxLengths(sections: {
|
|
41
43
|
[key: string]: AztecStartOption[];
|
|
42
44
|
}): [number, number];
|
package/dest/cli/util.d.ts.map
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"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"}
|
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
|
|
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,
|
|
70
|
-
const registeredAccounts = await
|
|
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`);
|
|
@@ -112,8 +112,8 @@ export function formatHelpLine(option, defaultValue, envVar, maxOptionLength, ma
|
|
|
112
112
|
const getDefaultOrEnvValue = (opt)=>{
|
|
113
113
|
let val;
|
|
114
114
|
// if the option is set in the environment, use that
|
|
115
|
-
if (opt.
|
|
116
|
-
val = process.env[opt.
|
|
115
|
+
if (opt.env) {
|
|
116
|
+
val = process.env[opt.env];
|
|
117
117
|
}
|
|
118
118
|
// if we have fallback env vars, check those
|
|
119
119
|
if (!val && opt.fallback && opt.fallback.length > 0) {
|
|
@@ -130,7 +130,7 @@ const getDefaultOrEnvValue = (opt)=>{
|
|
|
130
130
|
return opt.parseVal(val);
|
|
131
131
|
}
|
|
132
132
|
return val;
|
|
133
|
-
} else if (opt.defaultValue) {
|
|
133
|
+
} else if (opt.defaultValue !== undefined) {
|
|
134
134
|
return opt.defaultValue;
|
|
135
135
|
}
|
|
136
136
|
return undefined;
|
|
@@ -138,7 +138,7 @@ const getDefaultOrEnvValue = (opt)=>{
|
|
|
138
138
|
// Function to add options dynamically
|
|
139
139
|
export const addOptions = (cmd, options)=>{
|
|
140
140
|
options.forEach((opt)=>{
|
|
141
|
-
cmd.option(opt.flag, `${opt.description} (default: ${opt.defaultValue}) ($${opt.
|
|
141
|
+
cmd.option(opt.flag, `${opt.description} (default: ${opt.defaultValue}) ($${opt.env})`, opt.parseVal ? opt.parseVal : (val)=>val, getDefaultOrEnvValue(opt));
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
144
|
export const printAztecStartHelpText = ()=>{
|
|
@@ -150,8 +150,8 @@ export const printAztecStartHelpText = ()=>{
|
|
|
150
150
|
helpTextLines.push(chalk.bold.blue(` ${category}`));
|
|
151
151
|
helpTextLines.push('');
|
|
152
152
|
aztecStartOptions[category].forEach((opt)=>{
|
|
153
|
-
const defaultValueText = opt.defaultValue ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})` : '';
|
|
154
|
-
const envVarText = opt.
|
|
153
|
+
const defaultValueText = opt.defaultValue || Array.isArray(opt.defaultValue) && opt.defaultValue.length > 0 ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})` : '';
|
|
154
|
+
const envVarText = opt.env ? `($${opt.env})` : '';
|
|
155
155
|
const flagText = `${opt.flag}`;
|
|
156
156
|
const paddedText = formatHelpLine(flagText, defaultValueText, envVarText, maxFlagLength, maxDefaultLength);
|
|
157
157
|
helpTextLines.push(` ${paddedText}`);
|
package/dest/cli/versioning.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
2
|
-
import {
|
|
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,
|
|
5
|
+
return config ? getComponentsVersionsFromConfig(config, protocolContractsHash, getVKTreeRoot()) : {
|
|
6
6
|
l2CircuitsVkTreeRoot: getVKTreeRoot().toString(),
|
|
7
|
-
|
|
7
|
+
l2ProtocolContractsHash: protocolContractsHash.toString()
|
|
8
8
|
};
|
|
9
9
|
}
|
package/dest/examples/token.js
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
7
|
-
const
|
|
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
|
|
15
|
-
|
|
16
|
-
const
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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}`);
|
package/dest/examples/util.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/examples/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
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"}
|
package/dest/examples/util.js
CHANGED
package/dest/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createSandbox,
|
|
1
|
+
export { createSandbox, registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, registerDeployedSponsoredFPCInWalletAndGetAddress, } from './sandbox/index.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,
|
|
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,
|
|
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[],
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
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,
|
|
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 {
|
|
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,
|
|
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(
|
|
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(
|
|
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
|
|
65
|
-
const initialAccounts = await
|
|
66
|
-
const bananaCoin = await
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
74
|
-
const initialAccounts = await
|
|
71
|
+
export async function registerDeployedBananaFPCInWalletAndGetAddress(wallet) {
|
|
72
|
+
const initialAccounts = await getInitialTestAccountsData();
|
|
75
73
|
const fpc = await getBananaFPCInstance(initialAccounts);
|
|
76
|
-
|
|
77
|
-
|
|
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
|
}
|
package/dest/sandbox/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './sandbox.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
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,
|
|
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"}
|
package/dest/sandbox/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './sandbox.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress } from './banana_fpc.js';
|
|
3
|
+
export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';
|