@aztec/aztec 0.0.0-test.1 → 0.0.1-commit.017a351
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/README.md +1 -1
- package/dest/bin/index.d.ts +1 -1
- package/dest/bin/index.js +28 -13
- package/dest/cli/admin_api_key_store.d.ts +45 -0
- package/dest/cli/admin_api_key_store.d.ts.map +1 -0
- package/dest/cli/admin_api_key_store.js +98 -0
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +107 -49
- package/dest/cli/aztec_start_options.d.ts +6 -4
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +160 -223
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +11 -7
- package/dest/cli/cmds/compile.d.ts +4 -0
- package/dest/cli/cmds/compile.d.ts.map +1 -0
- package/dest/cli/cmds/compile.js +166 -0
- package/dest/cli/cmds/migrate_ha_db.d.ts +3 -0
- package/dest/cli/cmds/migrate_ha_db.d.ts.map +1 -0
- package/dest/cli/cmds/migrate_ha_db.js +27 -0
- package/dest/cli/cmds/profile.d.ts +4 -0
- package/dest/cli/cmds/profile.d.ts.map +1 -0
- package/dest/cli/cmds/profile.js +8 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
- package/dest/cli/cmds/profile_flamegraph.js +52 -0
- package/dest/cli/cmds/profile_gates.d.ts +4 -0
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
- package/dest/cli/cmds/profile_gates.js +76 -0
- package/dest/cli/cmds/profile_utils.d.ts +18 -0
- package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
- package/dest/cli/cmds/profile_utils.js +50 -0
- package/dest/cli/cmds/standby.d.ts +30 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -0
- package/dest/cli/cmds/start_bot.d.ts +4 -7
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +32 -17
- package/dest/cli/cmds/start_node.d.ts +3 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +113 -86
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +2 -2
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +10 -6
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +29 -12
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +25 -10
- package/dest/cli/cmds/start_txe.d.ts +2 -2
- package/dest/cli/cmds/start_txe.d.ts.map +1 -1
- package/dest/cli/cmds/start_txe.js +6 -5
- package/dest/cli/cmds/utils/artifacts.d.ts +21 -0
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
- package/dest/cli/cmds/utils/artifacts.js +24 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
- package/dest/cli/cmds/utils/needs_recompile.js +90 -0
- package/dest/cli/cmds/utils/spawn.d.ts +3 -0
- package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
- package/dest/cli/cmds/utils/spawn.js +16 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +61 -0
- package/dest/cli/index.d.ts +1 -1
- package/dest/cli/preload_crs.d.ts +3 -0
- package/dest/cli/preload_crs.d.ts.map +1 -0
- package/dest/cli/preload_crs.js +6 -0
- package/dest/cli/util.d.ts +37 -17
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +171 -35
- package/dest/cli/versioning.d.ts +1 -1
- package/dest/cli/versioning.js +3 -3
- package/dest/examples/token.d.ts +1 -1
- package/dest/examples/token.js +31 -18
- package/dest/examples/util.d.ts +5 -6
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/examples/util.js +5 -6
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/local-network/auth_registry.d.ts +5 -0
- package/dest/local-network/auth_registry.d.ts.map +1 -0
- package/dest/local-network/auth_registry.js +17 -0
- package/dest/local-network/banana_fpc.d.ts +11 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/banana_fpc.js +29 -27
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/local-network/index.js +3 -0
- package/dest/local-network/local-network.d.ts +50 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/local-network/local-network.js +248 -0
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/local-network/sponsored_fpc.js +18 -0
- package/dest/mnemonic.d.ts +1 -1
- package/dest/splash.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts +54 -0
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -0
- package/dest/testing/anvil_test_watcher.js +235 -0
- package/dest/testing/cheat_codes.d.ts +44 -0
- package/dest/testing/cheat_codes.d.ts.map +1 -0
- package/dest/testing/cheat_codes.js +98 -0
- package/dest/testing/epoch_test_settler.d.ts +19 -0
- package/dest/testing/epoch_test_settler.d.ts.map +1 -0
- package/dest/testing/epoch_test_settler.js +63 -0
- package/dest/testing/index.d.ts +6 -0
- package/dest/testing/index.d.ts.map +1 -0
- package/dest/testing/index.js +5 -0
- package/dest/testing/token_allowed_setup.d.ts +7 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +20 -0
- package/package.json +56 -45
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +73 -0
- package/scripts/init.sh +39 -0
- package/scripts/new.sh +83 -0
- package/scripts/setup_workspace.sh +69 -0
- package/scripts/templates/blank/contract/Nargo.toml +6 -0
- package/scripts/templates/blank/contract/src/main.nr +10 -0
- package/scripts/templates/blank/test/Nargo.toml +7 -0
- package/scripts/templates/blank/test/src/lib.nr +11 -0
- package/scripts/templates/counter/contract/Nargo.toml +7 -0
- package/scripts/templates/counter/contract/src/main.nr +48 -0
- package/scripts/templates/counter/test/Nargo.toml +7 -0
- package/scripts/templates/counter/test/src/lib.nr +32 -0
- package/src/bin/index.ts +33 -13
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +100 -46
- package/src/cli/aztec_start_options.ts +183 -226
- package/src/cli/cli.ts +19 -11
- package/src/cli/cmds/compile.ts +192 -0
- package/src/cli/cmds/migrate_ha_db.ts +43 -0
- package/src/cli/cmds/profile.ts +26 -0
- package/src/cli/cmds/profile_flamegraph.ts +64 -0
- package/src/cli/cmds/profile_gates.ts +84 -0
- package/src/cli/cmds/profile_utils.ts +58 -0
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_bot.ts +43 -19
- package/src/cli/cmds/start_node.ts +142 -91
- package/src/cli/cmds/start_p2p_bootstrap.ts +14 -6
- package/src/cli/cmds/start_prover_agent.ts +25 -16
- package/src/cli/cmds/start_prover_broker.ts +32 -9
- package/src/cli/cmds/start_txe.ts +7 -5
- package/src/cli/cmds/utils/artifacts.ts +44 -0
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +98 -0
- package/src/cli/cmds/utils/spawn.ts +16 -0
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
- package/src/cli/preload_crs.ts +7 -0
- package/src/cli/util.ts +192 -56
- package/src/cli/versioning.ts +3 -3
- package/src/examples/token.ts +23 -19
- package/src/examples/util.ts +6 -8
- package/src/index.ts +5 -6
- package/src/local-network/auth_registry.ts +19 -0
- package/src/{sandbox → local-network}/banana_fpc.ts +32 -29
- package/src/local-network/index.ts +7 -0
- package/src/local-network/local-network.ts +303 -0
- package/src/local-network/sponsored_fpc.ts +26 -0
- package/src/testing/anvil_test_watcher.ts +273 -0
- package/src/testing/cheat_codes.ts +132 -0
- package/src/testing/epoch_test_settler.ts +69 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/token_allowed_setup.ts +19 -0
- package/dest/cli/chain_l2_config.d.ts +0 -19
- package/dest/cli/chain_l2_config.d.ts.map +0 -1
- package/dest/cli/chain_l2_config.js +0 -56
- package/dest/cli/cmds/start_archiver.d.ts +0 -9
- package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
- package/dest/cli/cmds/start_archiver.js +0 -42
- package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
- package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
- package/dest/cli/cmds/start_blob_sink.js +0 -17
- 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_prover_node.d.ts +0 -7
- package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
- package/dest/cli/cmds/start_prover_node.js +0 -110
- 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 -95
- 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/sandbox/banana_fpc.d.ts +0 -11
- package/dest/sandbox/banana_fpc.d.ts.map +0 -1
- package/dest/sandbox/index.d.ts +0 -5
- package/dest/sandbox/index.d.ts.map +0 -1
- package/dest/sandbox/index.js +0 -4
- package/dest/sandbox/sandbox.d.ts +0 -76
- package/dest/sandbox/sandbox.d.ts.map +0 -1
- package/dest/sandbox/sandbox.js +0 -181
- package/dest/sandbox/sponsored_fee_payment_method.d.ts +0 -23
- package/dest/sandbox/sponsored_fee_payment_method.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fee_payment_method.js +0 -36
- package/dest/sandbox/sponsored_fpc.d.ts +0 -6
- package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fpc.js +0 -26
- package/src/cli/chain_l2_config.ts +0 -74
- package/src/cli/cmds/start_archiver.ts +0 -55
- package/src/cli/cmds/start_blob_sink.ts +0 -31
- package/src/cli/cmds/start_faucet.ts +0 -34
- package/src/cli/cmds/start_prover_node.ts +0 -121
- package/src/cli/cmds/start_pxe.ts +0 -129
- package/src/cli/get_l1_config.ts +0 -18
- package/src/sandbox/index.ts +0 -5
- package/src/sandbox/sandbox.ts +0 -229
- package/src/sandbox/sponsored_fee_payment_method.ts +0 -46
- package/src/sandbox/sponsored_fpc.ts +0 -38
package/dest/cli/util.js
CHANGED
|
@@ -1,40 +1,91 @@
|
|
|
1
|
+
import { getNetworkConfig } from '@aztec/cli/config';
|
|
2
|
+
import { RegistryContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
1
6
|
import chalk from 'chalk';
|
|
2
7
|
import { aztecStartOptions } from './aztec_start_options.js';
|
|
8
|
+
export var ExitCode = /*#__PURE__*/ function(ExitCode) {
|
|
9
|
+
ExitCode[ExitCode["SUCCESS"] = 0] = "SUCCESS";
|
|
10
|
+
ExitCode[ExitCode["ERROR"] = 1] = "ERROR";
|
|
11
|
+
ExitCode[ExitCode["ROLLUP_UPGRADE"] = 78] = "ROLLUP_UPGRADE";
|
|
12
|
+
ExitCode[ExitCode["VERSION_UPGRADE"] = 79] = "VERSION_UPGRADE";
|
|
13
|
+
// 128 + int(SIGNAL)
|
|
14
|
+
ExitCode[ExitCode["SIGHUP"] = 129] = "SIGHUP";
|
|
15
|
+
ExitCode[ExitCode["SIGINT"] = 130] = "SIGINT";
|
|
16
|
+
ExitCode[ExitCode["SIGQUIT"] = 131] = "SIGQUIT";
|
|
17
|
+
ExitCode[ExitCode["SIGTERM"] = 143] = "SIGTERM";
|
|
18
|
+
return ExitCode;
|
|
19
|
+
}({});
|
|
20
|
+
let shutdownPromise;
|
|
21
|
+
export function shutdown(logFn, exitCode, cb) {
|
|
22
|
+
if (shutdownPromise) {
|
|
23
|
+
logFn('Already shutting down.');
|
|
24
|
+
return shutdownPromise;
|
|
25
|
+
}
|
|
26
|
+
logFn('Shutting down...', {
|
|
27
|
+
exitCode
|
|
28
|
+
});
|
|
29
|
+
if (cb) {
|
|
30
|
+
shutdownPromise = Promise.allSettled(cb.map((fn)=>fn())).then(()=>process.exit(exitCode));
|
|
31
|
+
} else {
|
|
32
|
+
// synchronously shuts down the process
|
|
33
|
+
// no need to set shutdownPromise on this branch of the if statement because no more code will be executed
|
|
34
|
+
process.exit(exitCode);
|
|
35
|
+
}
|
|
36
|
+
return shutdownPromise;
|
|
37
|
+
}
|
|
38
|
+
export function isShuttingDown() {
|
|
39
|
+
return shutdownPromise !== undefined;
|
|
40
|
+
}
|
|
3
41
|
export const installSignalHandlers = (logFn, cb)=>{
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
42
|
+
const signals = [
|
|
43
|
+
[
|
|
44
|
+
'SIGINT',
|
|
45
|
+
130
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
'SIGTERM',
|
|
49
|
+
143
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
'SIGHUP',
|
|
53
|
+
129
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
'SIQUIT',
|
|
57
|
+
131
|
|
58
|
+
]
|
|
59
|
+
];
|
|
60
|
+
for (const [signal, exitCode] of signals){
|
|
61
|
+
process.removeAllListeners(signal);
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
63
|
+
process.once(signal, ()=>shutdown(logFn, exitCode, cb));
|
|
64
|
+
}
|
|
17
65
|
};
|
|
18
66
|
/**
|
|
19
67
|
* Creates logs for the initial accounts
|
|
20
68
|
* @param accounts - The initial accounts
|
|
21
|
-
* @param
|
|
69
|
+
* @param wallet - A EmbeddedWallet instance to get the registered accounts
|
|
22
70
|
* @returns A string array containing the initial accounts details
|
|
23
|
-
*/ export async function createAccountLogs(
|
|
24
|
-
const registeredAccounts = await
|
|
71
|
+
*/ export async function createAccountLogs(accountManagers, wallet) {
|
|
72
|
+
const registeredAccounts = await wallet.getAccounts();
|
|
25
73
|
const accountLogStrings = [
|
|
26
74
|
`Initial Accounts:\n\n`
|
|
27
75
|
];
|
|
28
|
-
for (const
|
|
29
|
-
const
|
|
30
|
-
|
|
76
|
+
for (const accountManager of accountManagers){
|
|
77
|
+
const account = await accountManager.getAccount();
|
|
78
|
+
const completeAddress = account.getCompleteAddress();
|
|
79
|
+
if (registeredAccounts.find((a)=>a.item.equals(completeAddress.address))) {
|
|
31
80
|
accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
|
|
32
81
|
accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
|
|
33
|
-
accountLogStrings.push(` Secret Key: ${
|
|
34
|
-
accountLogStrings.push(` Master nullifier public key: ${completeAddress.publicKeys.
|
|
35
|
-
accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.
|
|
36
|
-
accountLogStrings.push(` Master outgoing viewing public key: ${completeAddress.publicKeys.
|
|
37
|
-
accountLogStrings.push(` Master tagging public key: ${completeAddress.publicKeys.
|
|
82
|
+
accountLogStrings.push(` Secret Key: ${account.getSecretKey().toString()}\n`);
|
|
83
|
+
accountLogStrings.push(` Master nullifier public key hash: ${completeAddress.publicKeys.npkMHash.toString()}\n`);
|
|
84
|
+
accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.ivpkM.toString()}\n\n`);
|
|
85
|
+
accountLogStrings.push(` Master outgoing viewing public key hash: ${completeAddress.publicKeys.ovpkMHash.toString()}\n\n`);
|
|
86
|
+
accountLogStrings.push(` Master tagging public key hash: ${completeAddress.publicKeys.tpkMHash.toString()}\n\n`);
|
|
87
|
+
accountLogStrings.push(` Master message-signing public key hash: ${completeAddress.publicKeys.mspkMHash.toString()}\n\n`);
|
|
88
|
+
accountLogStrings.push(` Master fallback public key hash: ${completeAddress.publicKeys.fbpkMHash.toString()}\n\n`);
|
|
38
89
|
}
|
|
39
90
|
}
|
|
40
91
|
return accountLogStrings;
|
|
@@ -65,22 +116,34 @@ export function formatHelpLine(option, defaultValue, envVar, maxOptionLength, ma
|
|
|
65
116
|
}
|
|
66
117
|
const getDefaultOrEnvValue = (opt)=>{
|
|
67
118
|
let val;
|
|
68
|
-
// if the option is set in the environment, use that
|
|
69
|
-
if (opt.
|
|
70
|
-
val = process.env[opt.
|
|
71
|
-
|
|
119
|
+
// if the option is set in the environment, use that
|
|
120
|
+
if (opt.env) {
|
|
121
|
+
val = process.env[opt.env];
|
|
122
|
+
}
|
|
123
|
+
// if we have fallback env vars, check those
|
|
124
|
+
if (!val && opt.fallback && opt.fallback.length > 0) {
|
|
125
|
+
for (const fallback of opt.fallback){
|
|
126
|
+
val = process.env[fallback];
|
|
127
|
+
if (val) {
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// if we have a value, optionally parse it and return
|
|
133
|
+
if (val) {
|
|
134
|
+
if (opt.parseVal) {
|
|
72
135
|
return opt.parseVal(val);
|
|
73
136
|
}
|
|
74
|
-
|
|
75
|
-
} else if (opt.defaultValue) {
|
|
76
|
-
|
|
137
|
+
return val;
|
|
138
|
+
} else if (opt.defaultValue !== undefined) {
|
|
139
|
+
return opt.defaultValue;
|
|
77
140
|
}
|
|
78
|
-
return
|
|
141
|
+
return undefined;
|
|
79
142
|
};
|
|
80
143
|
// Function to add options dynamically
|
|
81
144
|
export const addOptions = (cmd, options)=>{
|
|
82
145
|
options.forEach((opt)=>{
|
|
83
|
-
cmd.option(opt.flag, `${opt.description} (default: ${opt.defaultValue}) ($${opt.
|
|
146
|
+
cmd.option(opt.flag, `${opt.description} (default: ${opt.defaultValue}) ($${opt.env})`, opt.parseVal ? opt.parseVal : (val)=>val, getDefaultOrEnvValue(opt));
|
|
84
147
|
});
|
|
85
148
|
};
|
|
86
149
|
export const printAztecStartHelpText = ()=>{
|
|
@@ -92,8 +155,8 @@ export const printAztecStartHelpText = ()=>{
|
|
|
92
155
|
helpTextLines.push(chalk.bold.blue(` ${category}`));
|
|
93
156
|
helpTextLines.push('');
|
|
94
157
|
aztecStartOptions[category].forEach((opt)=>{
|
|
95
|
-
const defaultValueText = opt.defaultValue ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})` : '';
|
|
96
|
-
const envVarText = opt.
|
|
158
|
+
const defaultValueText = opt.defaultValue || Array.isArray(opt.defaultValue) && opt.defaultValue.length > 0 ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})` : '';
|
|
159
|
+
const envVarText = opt.env ? `($${opt.env})` : '';
|
|
97
160
|
const flagText = `${opt.flag}`;
|
|
98
161
|
const paddedText = formatHelpLine(flagText, defaultValueText, envVarText, maxFlagLength, maxDefaultLength);
|
|
99
162
|
helpTextLines.push(` ${paddedText}`);
|
|
@@ -152,3 +215,76 @@ export const printAztecStartHelpText = ()=>{
|
|
|
152
215
|
});
|
|
153
216
|
return relevantOptions;
|
|
154
217
|
};
|
|
218
|
+
/**
|
|
219
|
+
* Downloads just enough points to be able to verify Chonk proofs.
|
|
220
|
+
* @param opts - Whether proof are to be verifier
|
|
221
|
+
* @param log - Logging function
|
|
222
|
+
*/ export async function preloadCrsDataForVerifying({ realProofs }, log) {
|
|
223
|
+
if (realProofs) {
|
|
224
|
+
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
225
|
+
await Promise.all([
|
|
226
|
+
Crs.new(2 ** 1, undefined, log),
|
|
227
|
+
GrumpkinCrs.new(2 ** 16, undefined, log)
|
|
228
|
+
]);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Downloads enough points to be able to prove every server-side circuit
|
|
233
|
+
* @param opts - Whether real proof are to be generated
|
|
234
|
+
* @param log - Logging function
|
|
235
|
+
*/ export async function preloadCrsDataForServerSideProving({ realProofs }, log) {
|
|
236
|
+
if (realProofs) {
|
|
237
|
+
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
238
|
+
await Promise.all([
|
|
239
|
+
Crs.new(2 ** 25, undefined, log),
|
|
240
|
+
GrumpkinCrs.new(2 ** 18, undefined, log)
|
|
241
|
+
]);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
export async function setupVersionChecker(network, followsCanonicalRollup, publicClient, signalHandlers, cacheDir) {
|
|
245
|
+
const networkConfig = await getNetworkConfig(network, cacheDir);
|
|
246
|
+
if (!networkConfig) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const { VersionChecker } = await import('@aztec/stdlib/update-checker');
|
|
250
|
+
const logger = createLogger('version_check');
|
|
251
|
+
const registry = new RegistryContract(publicClient, networkConfig.registryAddress);
|
|
252
|
+
const checks = [];
|
|
253
|
+
checks.push({
|
|
254
|
+
name: 'node',
|
|
255
|
+
currentVersion: getPackageVersion(),
|
|
256
|
+
getLatestVersion: async ()=>{
|
|
257
|
+
const cfg = await getNetworkConfig(network, cacheDir);
|
|
258
|
+
return cfg?.nodeVersion;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
if (followsCanonicalRollup) {
|
|
262
|
+
const getLatestVersion = async ()=>{
|
|
263
|
+
const version = (await registry.getRollupVersions()).at(-1);
|
|
264
|
+
return version !== undefined ? String(version) : undefined;
|
|
265
|
+
};
|
|
266
|
+
const currentVersion = await getLatestVersion();
|
|
267
|
+
if (currentVersion !== undefined) {
|
|
268
|
+
checks.push({
|
|
269
|
+
name: 'rollup',
|
|
270
|
+
currentVersion,
|
|
271
|
+
getLatestVersion
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const checker = new VersionChecker(checks, 600_000, logger);
|
|
276
|
+
checker.on('newVersion', ({ name, latestVersion, currentVersion })=>{
|
|
277
|
+
if (isShuttingDown()) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
logger.warn(`New ${name} version available`, {
|
|
281
|
+
latestVersion,
|
|
282
|
+
currentVersion
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
checker.start();
|
|
286
|
+
signalHandlers.push(()=>checker.stop());
|
|
287
|
+
}
|
|
288
|
+
export function stringifyConfig(config) {
|
|
289
|
+
return Object.entries(config).map(([key, value])=>`${key}=${jsonStringify(value)}`).join(' ');
|
|
290
|
+
}
|
package/dest/cli/versioning.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
2
2
|
import { type ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
3
3
|
export declare function getVersions(config?: ChainConfig): Partial<ComponentsVersions>;
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbmluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS92ZXJzaW9uaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3hELE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFtQyxNQUFNLDBCQUEwQixDQUFDO0FBRXBHLHdCQUFnQixXQUFXLENBQUMsTUFBTSxDQUFDLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQU83RSJ9
|
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.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW4uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGFtcGxlcy90b2tlbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
|
package/dest/examples/token.js
CHANGED
|
@@ -1,40 +1,53 @@
|
|
|
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 { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
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
|
|
17
|
-
|
|
15
|
+
const wallet = await EmbeddedWallet.create(node);
|
|
16
|
+
// During local network 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;
|
|
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 { contract: token } = await TokenContract.deploy(wallet, alice, 'TokenName', 'TokenSymbol', 18).send({
|
|
25
|
+
from: alice
|
|
26
|
+
});
|
|
20
27
|
logger.info('Token deployed');
|
|
21
|
-
// Create the contract abstraction and link it to Alice's and Bob's wallet for future signing
|
|
22
|
-
const tokenAlice = await TokenContract.at(token.address, aliceWallet);
|
|
23
|
-
const tokenBob = await TokenContract.at(token.address, bobWallet);
|
|
24
28
|
// Mint tokens to Alice
|
|
25
29
|
logger.info(`Minting ${ALICE_MINT_BALANCE} more coins to Alice...`);
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
await token.methods.mint_to_private(alice, ALICE_MINT_BALANCE).send({
|
|
31
|
+
from: alice
|
|
32
|
+
});
|
|
28
33
|
logger.info(`${ALICE_MINT_BALANCE} tokens were successfully minted by Alice and transferred to private`);
|
|
29
|
-
const balanceAfterMint = await
|
|
34
|
+
const { result: balanceAfterMint } = await token.methods.balance_of_private(alice).simulate({
|
|
35
|
+
from: alice
|
|
36
|
+
});
|
|
30
37
|
logger.info(`Tokens successfully minted. New Alice's balance: ${balanceAfterMint}`);
|
|
31
38
|
// We will now transfer tokens from Alice to Bob
|
|
32
39
|
logger.info(`Transferring ${TRANSFER_AMOUNT} tokens from Alice to Bob...`);
|
|
33
|
-
await
|
|
40
|
+
await token.methods.transfer(bob, TRANSFER_AMOUNT).send({
|
|
41
|
+
from: alice
|
|
42
|
+
});
|
|
34
43
|
// Check the new balances
|
|
35
|
-
const aliceBalance = await
|
|
44
|
+
const { result: aliceBalance } = await token.methods.balance_of_private(alice).simulate({
|
|
45
|
+
from: alice
|
|
46
|
+
});
|
|
36
47
|
logger.info(`Alice's balance ${aliceBalance}`);
|
|
37
|
-
const bobBalance = await
|
|
48
|
+
const { result: bobBalance } = await token.methods.balance_of_private(bob).simulate({
|
|
49
|
+
from: bob
|
|
50
|
+
});
|
|
38
51
|
logger.info(`Bob's balance ${bobBalance}`);
|
|
39
52
|
}
|
|
40
53
|
main().then(()=>{
|
package/dest/examples/util.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
-
import type {
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
3
3
|
import type { Abi, Narrow } from 'abitype';
|
|
4
4
|
import type { Hex } from 'viem';
|
|
5
5
|
/**
|
|
6
6
|
* Helper function to deploy ETH contracts.
|
|
7
|
-
* @param
|
|
8
|
-
* @param publicClient - A viem PublicClient.
|
|
7
|
+
* @param l1Client - A viem WalletClient extended with public actions.
|
|
9
8
|
* @param abi - The ETH contract's ABI (as abitype's Abi).
|
|
10
9
|
* @param bytecode - The ETH contract's bytecode.
|
|
11
10
|
* @param args - Constructor arguments for the contract.
|
|
12
11
|
* @returns The ETH address the contract was deployed to.
|
|
13
12
|
*/
|
|
14
|
-
export declare function deployL1Contract(
|
|
13
|
+
export declare function deployL1Contract(l1Client: ExtendedViemWalletClient, abi: Narrow<Abi | readonly unknown[]>, bytecode: Hex, args?: readonly unknown[]): Promise<EthAddress>;
|
|
15
14
|
/**
|
|
16
15
|
* Sleep for a given number of milliseconds.
|
|
17
16
|
* @param ms - the number of milliseconds to sleep for
|
|
18
17
|
*/
|
|
19
18
|
export declare function delay(ms: number): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2V4YW1wbGVzL3V0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3ZELE9BQU8sS0FBSyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHdEUsT0FBTyxLQUFLLEVBQUUsR0FBRyxFQUFFLE1BQU0sRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUMzQyxPQUFPLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFFaEM7Ozs7Ozs7R0FPRztBQUNILHdCQUFzQixnQkFBZ0IsQ0FDcEMsUUFBUSxFQUFFLHdCQUF3QixFQUNsQyxHQUFHLEVBQUUsTUFBTSxDQUFDLEdBQUcsR0FBRyxTQUFTLE9BQU8sRUFBRSxDQUFDLEVBQ3JDLFFBQVEsRUFBRSxHQUFHLEVBQ2IsSUFBSSxHQUFFLFNBQVMsT0FBTyxFQUFPLEdBQzVCLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FjckI7QUFFRDs7O0dBR0c7QUFDSCx3QkFBZ0IsS0FBSyxDQUFDLEVBQUUsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUvQyJ9
|
|
@@ -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,uBAAuB,CAAC;AAGtE,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
|
@@ -1,20 +1,19 @@
|
|
|
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.
|
|
5
|
-
* @param
|
|
6
|
-
* @param publicClient - A viem PublicClient.
|
|
5
|
+
* @param l1Client - A viem WalletClient extended with public actions.
|
|
7
6
|
* @param abi - The ETH contract's ABI (as abitype's Abi).
|
|
8
7
|
* @param bytecode - The ETH contract's bytecode.
|
|
9
8
|
* @param args - Constructor arguments for the contract.
|
|
10
9
|
* @returns The ETH address the contract was deployed to.
|
|
11
|
-
*/ export async function deployL1Contract(
|
|
12
|
-
const hash = await
|
|
10
|
+
*/ export async function deployL1Contract(l1Client, abi, bytecode, args = []) {
|
|
11
|
+
const hash = await l1Client.deployContract({
|
|
13
12
|
abi,
|
|
14
13
|
bytecode,
|
|
15
14
|
args
|
|
16
15
|
});
|
|
17
|
-
const receipt = await
|
|
16
|
+
const receipt = await l1Client.waitForTransactionReceipt({
|
|
18
17
|
hash
|
|
19
18
|
});
|
|
20
19
|
const contractAddress = receipt.contractAddress;
|
package/dest/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
export { createLocalNetwork, registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, registerDeployedSponsoredFPCInWalletAndGetAddress, } from './local-network/index.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsa0JBQWtCLEVBQ2xCLCtDQUErQyxFQUMvQyw4Q0FBOEMsRUFDOUMsaURBQWlELEdBQ2xELE1BQU0sMEJBQTBCLENBQUMifQ==
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,+CAA+C,EAC/C,8CAA8C,EAC9C,iDAAiD,GAClD,MAAM,0BAA0B,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createLocalNetwork, registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, registerDeployedSponsoredFPCInWalletAndGetAddress } from './local-network/index.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
export declare function publishStandardAuthRegistry(wallet: Wallet, from: AztecAddress, waitOpts?: WaitOpts): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aF9yZWdpc3RyeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsLW5ldHdvcmsvYXV0aF9yZWdpc3RyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVyRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVoRSx3QkFBc0IsMkJBQTJCLENBQy9DLE1BQU0sRUFBRSxNQUFNLEVBQ2QsSUFBSSxFQUFFLFlBQVksRUFDbEIsUUFBUSxDQUFDLEVBQUUsUUFBUSxHQUNsQixPQUFPLENBQUMsSUFBSSxDQUFDLENBUWYifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_registry.d.ts","sourceRoot":"","sources":["../../src/local-network/auth_registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,QAAQ,CAAC,EAAE,QAAQ,GAClB,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
2
|
+
import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
3
|
+
export async function publishStandardAuthRegistry(wallet, from, waitOpts) {
|
|
4
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
5
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
6
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
|
|
7
|
+
from,
|
|
8
|
+
wait: waitOpts
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
12
|
+
await publishInstance(wallet, instance).send({
|
|
13
|
+
from,
|
|
14
|
+
wait: waitOpts
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
4
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
export declare function getBananaCoinAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
|
|
7
|
+
export declare function getBananaFPCAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
|
|
8
|
+
export declare function setupBananaFPC(initialAccounts: InitialAccountData[], wallet: Wallet, log: LogFn, waitOpts?: WaitOpts): Promise<void>;
|
|
9
|
+
export declare function registerDeployedBananaCoinInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
|
|
10
|
+
export declare function registerDeployedBananaFPCInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFuYW5hX2ZwYy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsLW5ldHdvcmsvYmFuYW5hX2ZwYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBOEIsTUFBTSx5QkFBeUIsQ0FBQztBQUM5RixPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVyRCxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUduRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUF3QjNELHdCQUFzQixvQkFBb0IsQ0FBQyxlQUFlLEVBQUUsa0JBQWtCLEVBQUUseUJBRS9FO0FBV0Qsd0JBQXNCLG1CQUFtQixDQUFDLGVBQWUsRUFBRSxrQkFBa0IsRUFBRSx5QkFFOUU7QUFFRCx3QkFBc0IsY0FBYyxDQUNsQyxlQUFlLEVBQUUsa0JBQWtCLEVBQUUsRUFDckMsTUFBTSxFQUFFLE1BQU0sRUFDZCxHQUFHLEVBQUUsS0FBSyxFQUNWLFFBQVEsQ0FBQyxFQUFFLFFBQVEsaUJBaUJwQjtBQUVELHdCQUFzQiwrQ0FBK0MsQ0FBQyxNQUFNLEVBQUUsTUFBTSx5QkFNbkY7QUFFRCx3QkFBc0IsOENBQThDLENBQUMsTUFBTSxFQUFFLE1BQU0seUJBTWxGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banana_fpc.d.ts","sourceRoot":"","sources":["../../src/local-network/banana_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,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,CAClC,eAAe,EAAE,kBAAkB,EAAE,EACrC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,QAAQ,CAAC,EAAE,QAAQ,iBAiBpB;AAED,wBAAsB,+CAA+C,CAAC,MAAM,EAAE,MAAM,yBAMnF;AAED,wBAAsB,8CAA8C,CAAC,MAAM,EAAE,MAAM,yBAMlF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
4
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import {
|
|
6
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
7
7
|
const BANANA_COIN_SALT = new Fr(0);
|
|
8
8
|
const bananaCoinArgs = {
|
|
9
9
|
name: 'BC',
|
|
@@ -16,7 +16,7 @@ function getBananaAdmin(initialAccounts) {
|
|
|
16
16
|
}
|
|
17
17
|
async function getBananaCoinInstance(initialAccounts) {
|
|
18
18
|
const admin = getBananaAdmin(initialAccounts);
|
|
19
|
-
return await
|
|
19
|
+
return await getContractInstanceFromInstantiationParams(TokenContract.artifact, {
|
|
20
20
|
constructorArgs: [
|
|
21
21
|
admin,
|
|
22
22
|
bananaCoinArgs.name,
|
|
@@ -32,7 +32,7 @@ export async function getBananaCoinAddress(initialAccounts) {
|
|
|
32
32
|
async function getBananaFPCInstance(initialAccounts) {
|
|
33
33
|
const bananaCoin = await getBananaCoinAddress(initialAccounts);
|
|
34
34
|
const admin = getBananaAdmin(initialAccounts);
|
|
35
|
-
return await
|
|
35
|
+
return await getContractInstanceFromInstantiationParams(FPCContract.artifact, {
|
|
36
36
|
constructorArgs: [
|
|
37
37
|
bananaCoin,
|
|
38
38
|
admin
|
|
@@ -43,37 +43,39 @@ 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, waitOpts) {
|
|
47
47
|
const bananaCoinAddress = await getBananaCoinAddress(initialAccounts);
|
|
48
48
|
const admin = getBananaAdmin(initialAccounts);
|
|
49
|
-
const [bananaCoin, fpc] = await Promise.all([
|
|
50
|
-
TokenContract.deploy(
|
|
51
|
-
|
|
49
|
+
const [{ contract: bananaCoin }, { contract: fpc }] = await Promise.all([
|
|
50
|
+
TokenContract.deploy(wallet, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal, {
|
|
51
|
+
salt: BANANA_COIN_SALT,
|
|
52
52
|
universalDeploy: true
|
|
53
|
-
}).
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
}).send({
|
|
54
|
+
from: admin,
|
|
55
|
+
wait: waitOpts
|
|
56
|
+
}),
|
|
57
|
+
FPCContract.deploy(wallet, bananaCoinAddress, admin, {
|
|
58
|
+
salt: BANANA_FPC_SALT,
|
|
56
59
|
universalDeploy: true
|
|
57
|
-
}).
|
|
60
|
+
}).send({
|
|
61
|
+
from: admin,
|
|
62
|
+
wait: waitOpts
|
|
63
|
+
})
|
|
58
64
|
]);
|
|
59
65
|
log(`BananaCoin: ${bananaCoin.address}`);
|
|
60
66
|
log(`FPC: ${fpc.address}`);
|
|
61
67
|
}
|
|
62
|
-
export async function
|
|
63
|
-
const initialAccounts = await
|
|
64
|
-
const bananaCoin = await
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
return bananaCoin;
|
|
68
|
+
export async function registerDeployedBananaCoinInWalletAndGetAddress(wallet) {
|
|
69
|
+
const initialAccounts = await getInitialTestAccountsData();
|
|
70
|
+
const bananaCoin = await getBananaCoinInstance(initialAccounts);
|
|
71
|
+
// The following is no-op if the contract is already registered
|
|
72
|
+
await wallet.registerContract(bananaCoin, TokenContract.artifact);
|
|
73
|
+
return bananaCoin.address;
|
|
70
74
|
}
|
|
71
|
-
export async function
|
|
72
|
-
const initialAccounts = await
|
|
75
|
+
export async function registerDeployedBananaFPCInWalletAndGetAddress(wallet) {
|
|
76
|
+
const initialAccounts = await getInitialTestAccountsData();
|
|
73
77
|
const fpc = await getBananaFPCInstance(initialAccounts);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
throw new Error('BananaFPC not deployed.');
|
|
77
|
-
}
|
|
78
|
+
// The following is no-op if the contract is already registered
|
|
79
|
+
await wallet.registerContract(fpc, FPCContract.artifact);
|
|
78
80
|
return fpc.address;
|
|
79
81
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './local-network.js';
|
|
2
|
+
export { registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, } from './banana_fpc.js';
|
|
3
|
+
export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2NhbC1uZXR3b3JrL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsb0JBQW9CLENBQUM7QUFFbkMsT0FBTyxFQUNMLCtDQUErQyxFQUMvQyw4Q0FBOEMsR0FDL0MsTUFBTSxpQkFBaUIsQ0FBQztBQUN6QixPQUFPLEVBQUUsaURBQWlELEVBQUUsTUFBTSxvQkFBb0IsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/local-network/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EACL,+CAA+C,EAC/C,8CAA8C,GAC/C,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iDAAiD,EAAE,MAAM,oBAAoB,CAAC"}
|