@aztec/aztec 0.0.0-test.1 → 0.0.1-commit.b655e406
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 +20 -12
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +32 -33
- package/dest/cli/aztec_start_options.d.ts +4 -2
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +137 -207
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +4 -0
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +18 -10
- package/dest/cli/cmds/start_blob_sink.d.ts.map +1 -1
- package/dest/cli/cmds/start_blob_sink.js +17 -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 +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +66 -79
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +9 -4
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +31 -2
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +9 -3
- package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_node.js +43 -45
- 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/release_version.d.ts +2 -0
- package/dest/cli/release_version.d.ts.map +1 -0
- package/dest/cli/release_version.js +14 -0
- package/dest/cli/util.d.ts +36 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +198 -28
- package/dest/cli/versioning.js +3 -3
- package/dest/examples/token.js +31 -18
- package/dest/examples/util.d.ts +4 -5
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/examples/util.js +5 -6
- 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 +19 -21
- package/dest/sandbox/index.d.ts +2 -3
- package/dest/sandbox/index.d.ts.map +1 -1
- package/dest/sandbox/index.js +2 -3
- package/dest/sandbox/sandbox.d.ts +25 -27
- package/dest/sandbox/sandbox.d.ts.map +1 -1
- package/dest/sandbox/sandbox.js +51 -49
- package/dest/sandbox/sponsored_fpc.d.ts +3 -5
- package/dest/sandbox/sponsored_fpc.d.ts.map +1 -1
- package/dest/sandbox/sponsored_fpc.js +10 -18
- package/dest/testing/anvil_test_watcher.d.ts +34 -0
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -0
- package/dest/testing/anvil_test_watcher.js +142 -0
- package/dest/testing/cheat_codes.d.ts +43 -0
- package/dest/testing/cheat_codes.d.ts.map +1 -0
- package/dest/testing/cheat_codes.js +62 -0
- package/dest/testing/index.d.ts +4 -0
- package/dest/testing/index.d.ts.map +1 -0
- package/dest/testing/index.js +3 -0
- package/package.json +47 -41
- package/src/bin/index.ts +24 -12
- package/src/cli/aztec_start_action.ts +27 -30
- package/src/cli/aztec_start_options.ts +155 -207
- package/src/cli/cli.ts +8 -0
- package/src/cli/cmds/start_archiver.ts +19 -13
- package/src/cli/cmds/start_blob_sink.ts +27 -1
- package/src/cli/cmds/start_bot.ts +35 -12
- package/src/cli/cmds/start_node.ts +89 -84
- package/src/cli/cmds/start_p2p_bootstrap.ts +12 -4
- package/src/cli/cmds/start_prover_agent.ts +22 -2
- package/src/cli/cmds/start_prover_broker.ts +23 -3
- package/src/cli/cmds/start_prover_node.ts +53 -50
- package/src/cli/preload_crs.ts +7 -0
- package/src/cli/release_version.ts +21 -0
- package/src/cli/util.ts +208 -34
- 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 +3 -4
- package/src/sandbox/banana_fpc.ts +20 -25
- package/src/sandbox/index.ts +5 -3
- package/src/sandbox/sandbox.ts +70 -57
- package/src/sandbox/sponsored_fpc.ts +12 -25
- package/src/testing/anvil_test_watcher.ts +164 -0
- package/src/testing/cheat_codes.ts +78 -0
- package/src/testing/index.ts +3 -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_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 -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/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/src/cli/chain_l2_config.ts +0 -74
- package/src/cli/cmds/start_faucet.ts +0 -34
- package/src/cli/cmds/start_pxe.ts +0 -129
- package/src/cli/get_l1_config.ts +0 -18
- package/src/sandbox/sponsored_fee_payment_method.ts +0 -46
package/dest/cli/util.d.ts
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import type { ViemClient } from '@aztec/ethereum';
|
|
2
6
|
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
7
|
+
import { type LogFn } from '@aztec/foundation/log';
|
|
8
|
+
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
9
|
+
import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
|
|
10
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
5
11
|
import type { Command } from 'commander';
|
|
6
12
|
import { type AztecStartOption } from './aztec_start_options.js';
|
|
13
|
+
export declare const enum ExitCode {
|
|
14
|
+
SUCCESS = 0,
|
|
15
|
+
ERROR = 1,
|
|
16
|
+
ROLLUP_UPGRADE = 78,// EX_CONFIG from FreeBSD (https://man.freebsd.org/cgi/man.cgi?query=sysexits)
|
|
17
|
+
VERSION_UPGRADE = 79,// prev + 1 because there's nothing better
|
|
18
|
+
SIGHUP = 129,
|
|
19
|
+
SIGINT = 130,
|
|
20
|
+
SIGQUIT = 131,
|
|
21
|
+
SIGTERM = 143
|
|
22
|
+
}
|
|
23
|
+
export declare function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never>;
|
|
24
|
+
export declare function isShuttingDown(): boolean;
|
|
7
25
|
export declare const installSignalHandlers: (logFn: LogFn, cb?: Array<() => Promise<void>>) => void;
|
|
8
26
|
/**
|
|
9
27
|
* Creates logs for the initial accounts
|
|
10
28
|
* @param accounts - The initial accounts
|
|
11
|
-
* @param
|
|
29
|
+
* @param wallet - A TestWallet instance to get the registered accounts
|
|
12
30
|
* @returns A string array containing the initial accounts details
|
|
13
31
|
*/
|
|
14
32
|
export declare function createAccountLogs(accountsWithSecretKeys: {
|
|
@@ -20,7 +38,7 @@ export declare function createAccountLogs(accountsWithSecretKeys: {
|
|
|
20
38
|
* The secret key of the account
|
|
21
39
|
*/
|
|
22
40
|
secretKey: Fr;
|
|
23
|
-
}[],
|
|
41
|
+
}[], wallet: TestWallet): Promise<string[]>;
|
|
24
42
|
export declare function getMaxLengths(sections: {
|
|
25
43
|
[key: string]: AztecStartOption[];
|
|
26
44
|
}): [number, number];
|
|
@@ -43,4 +61,17 @@ export declare const extractNamespacedOptions: (options: Record<string, any>, na
|
|
|
43
61
|
* @returns Key-value map of relevant options.
|
|
44
62
|
*/
|
|
45
63
|
export declare const extractRelevantOptions: <T>(options: Record<string, any>, mappings: ConfigMappingsType<T>, namespace: string) => T;
|
|
64
|
+
/**
|
|
65
|
+
* Downloads just enough points to be able to verify Chonk proofs.
|
|
66
|
+
* @param opts - Whether proof are to be verifier
|
|
67
|
+
* @param log - Logging function
|
|
68
|
+
*/
|
|
69
|
+
export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNodeConfig, 'realProofs'>, log: LogFn): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Downloads enough points to be able to prove every server-side circuit
|
|
72
|
+
* @param opts - Whether real proof are to be generated
|
|
73
|
+
* @param log - Logging function
|
|
74
|
+
*/
|
|
75
|
+
export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
|
|
76
|
+
export declare function setupUpdateMonitor(autoUpdateMode: SharedNodeConfig['autoUpdate'], updatesLocation: URL, followsCanonicalRollup: boolean, publicClient: ViemClient, registryContractAddress: EthAddress, signalHandlers: Array<() => Promise<void>>, updateNodeConfig?: (config: object) => Promise<void>): Promise<void>;
|
|
46
77
|
//# sourceMappingURL=util.d.ts.map
|
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,cAAc,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;
|
|
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
|
@@ -1,33 +1,79 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { UpdateChecker } from '@aztec/stdlib/update-checker';
|
|
3
|
+
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
1
4
|
import chalk from 'chalk';
|
|
2
5
|
import { aztecStartOptions } from './aztec_start_options.js';
|
|
6
|
+
export var ExitCode = /*#__PURE__*/ function(ExitCode) {
|
|
7
|
+
ExitCode[ExitCode["SUCCESS"] = 0] = "SUCCESS";
|
|
8
|
+
ExitCode[ExitCode["ERROR"] = 1] = "ERROR";
|
|
9
|
+
ExitCode[ExitCode["ROLLUP_UPGRADE"] = 78] = "ROLLUP_UPGRADE";
|
|
10
|
+
ExitCode[ExitCode["VERSION_UPGRADE"] = 79] = "VERSION_UPGRADE";
|
|
11
|
+
// 128 + int(SIGNAL)
|
|
12
|
+
ExitCode[ExitCode["SIGHUP"] = 129] = "SIGHUP";
|
|
13
|
+
ExitCode[ExitCode["SIGINT"] = 130] = "SIGINT";
|
|
14
|
+
ExitCode[ExitCode["SIGQUIT"] = 131] = "SIGQUIT";
|
|
15
|
+
ExitCode[ExitCode["SIGTERM"] = 143] = "SIGTERM";
|
|
16
|
+
return ExitCode;
|
|
17
|
+
}({});
|
|
18
|
+
let shutdownPromise;
|
|
19
|
+
export function shutdown(logFn, exitCode, cb) {
|
|
20
|
+
if (shutdownPromise) {
|
|
21
|
+
logFn('Already shutting down.');
|
|
22
|
+
return shutdownPromise;
|
|
23
|
+
}
|
|
24
|
+
logFn('Shutting down...', {
|
|
25
|
+
exitCode
|
|
26
|
+
});
|
|
27
|
+
if (cb) {
|
|
28
|
+
shutdownPromise = Promise.allSettled(cb).then(()=>process.exit(exitCode));
|
|
29
|
+
} else {
|
|
30
|
+
// synchronously shuts down the process
|
|
31
|
+
// no need to set shutdownPromise on this branch of the if statement because no more code will be executed
|
|
32
|
+
process.exit(exitCode);
|
|
33
|
+
}
|
|
34
|
+
return shutdownPromise;
|
|
35
|
+
}
|
|
36
|
+
export function isShuttingDown() {
|
|
37
|
+
return shutdownPromise !== undefined;
|
|
38
|
+
}
|
|
3
39
|
export const installSignalHandlers = (logFn, cb)=>{
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
40
|
+
const signals = [
|
|
41
|
+
[
|
|
42
|
+
'SIGINT',
|
|
43
|
+
130
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
'SIGTERM',
|
|
47
|
+
143
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
'SIGHUP',
|
|
51
|
+
129
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
'SIQUIT',
|
|
55
|
+
131
|
|
56
|
+
]
|
|
57
|
+
];
|
|
58
|
+
for (const [signal, exitCode] of signals){
|
|
59
|
+
process.removeAllListeners(signal);
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
61
|
+
process.once(signal, ()=>shutdown(logFn, exitCode, cb));
|
|
62
|
+
}
|
|
17
63
|
};
|
|
18
64
|
/**
|
|
19
65
|
* Creates logs for the initial accounts
|
|
20
66
|
* @param accounts - The initial accounts
|
|
21
|
-
* @param
|
|
67
|
+
* @param wallet - A TestWallet instance to get the registered accounts
|
|
22
68
|
* @returns A string array containing the initial accounts details
|
|
23
|
-
*/ export async function createAccountLogs(accountsWithSecretKeys,
|
|
24
|
-
const registeredAccounts = await
|
|
69
|
+
*/ export async function createAccountLogs(accountsWithSecretKeys, wallet) {
|
|
70
|
+
const registeredAccounts = await wallet.getAccounts();
|
|
25
71
|
const accountLogStrings = [
|
|
26
72
|
`Initial Accounts:\n\n`
|
|
27
73
|
];
|
|
28
74
|
for (const accountWithSecretKey of accountsWithSecretKeys){
|
|
29
75
|
const completeAddress = await accountWithSecretKey.account.getCompleteAddress();
|
|
30
|
-
if (registeredAccounts.find((a)=>a.equals(completeAddress))) {
|
|
76
|
+
if (registeredAccounts.find((a)=>a.item.equals(completeAddress.address))) {
|
|
31
77
|
accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
|
|
32
78
|
accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
|
|
33
79
|
accountLogStrings.push(` Secret Key: ${accountWithSecretKey.secretKey.toString()}\n`);
|
|
@@ -65,22 +111,34 @@ export function formatHelpLine(option, defaultValue, envVar, maxOptionLength, ma
|
|
|
65
111
|
}
|
|
66
112
|
const getDefaultOrEnvValue = (opt)=>{
|
|
67
113
|
let val;
|
|
68
|
-
// if the option is set in the environment, use that
|
|
69
|
-
if (opt.
|
|
70
|
-
val = process.env[opt.
|
|
71
|
-
|
|
114
|
+
// if the option is set in the environment, use that
|
|
115
|
+
if (opt.env) {
|
|
116
|
+
val = process.env[opt.env];
|
|
117
|
+
}
|
|
118
|
+
// if we have fallback env vars, check those
|
|
119
|
+
if (!val && opt.fallback && opt.fallback.length > 0) {
|
|
120
|
+
for (const fallback of opt.fallback){
|
|
121
|
+
val = process.env[fallback];
|
|
122
|
+
if (val) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// if we have a value, optionally parse it and return
|
|
128
|
+
if (val) {
|
|
129
|
+
if (opt.parseVal) {
|
|
72
130
|
return opt.parseVal(val);
|
|
73
131
|
}
|
|
74
|
-
|
|
75
|
-
} else if (opt.defaultValue) {
|
|
76
|
-
|
|
132
|
+
return val;
|
|
133
|
+
} else if (opt.defaultValue !== undefined) {
|
|
134
|
+
return opt.defaultValue;
|
|
77
135
|
}
|
|
78
|
-
return
|
|
136
|
+
return undefined;
|
|
79
137
|
};
|
|
80
138
|
// Function to add options dynamically
|
|
81
139
|
export const addOptions = (cmd, options)=>{
|
|
82
140
|
options.forEach((opt)=>{
|
|
83
|
-
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));
|
|
84
142
|
});
|
|
85
143
|
};
|
|
86
144
|
export const printAztecStartHelpText = ()=>{
|
|
@@ -92,8 +150,8 @@ export const printAztecStartHelpText = ()=>{
|
|
|
92
150
|
helpTextLines.push(chalk.bold.blue(` ${category}`));
|
|
93
151
|
helpTextLines.push('');
|
|
94
152
|
aztecStartOptions[category].forEach((opt)=>{
|
|
95
|
-
const defaultValueText = opt.defaultValue ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})` : '';
|
|
96
|
-
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})` : '';
|
|
97
155
|
const flagText = `${opt.flag}`;
|
|
98
156
|
const paddedText = formatHelpLine(flagText, defaultValueText, envVarText, maxFlagLength, maxDefaultLength);
|
|
99
157
|
helpTextLines.push(` ${paddedText}`);
|
|
@@ -152,3 +210,115 @@ export const printAztecStartHelpText = ()=>{
|
|
|
152
210
|
});
|
|
153
211
|
return relevantOptions;
|
|
154
212
|
};
|
|
213
|
+
/**
|
|
214
|
+
* Downloads just enough points to be able to verify Chonk proofs.
|
|
215
|
+
* @param opts - Whether proof are to be verifier
|
|
216
|
+
* @param log - Logging function
|
|
217
|
+
*/ export async function preloadCrsDataForVerifying({ realProofs }, log) {
|
|
218
|
+
if (realProofs) {
|
|
219
|
+
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
220
|
+
await Promise.all([
|
|
221
|
+
Crs.new(2 ** 1, undefined, log),
|
|
222
|
+
GrumpkinCrs.new(2 ** 16 + 1, undefined, log)
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Downloads enough points to be able to prove every server-side circuit
|
|
228
|
+
* @param opts - Whether real proof are to be generated
|
|
229
|
+
* @param log - Logging function
|
|
230
|
+
*/ export async function preloadCrsDataForServerSideProving({ realProofs }, log) {
|
|
231
|
+
if (realProofs) {
|
|
232
|
+
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
233
|
+
await Promise.all([
|
|
234
|
+
Crs.new(2 ** 25 + 1, undefined, log),
|
|
235
|
+
GrumpkinCrs.new(2 ** 18 + 1, undefined, log)
|
|
236
|
+
]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, followsCanonicalRollup, publicClient, registryContractAddress, signalHandlers, updateNodeConfig) {
|
|
240
|
+
const logger = createLogger('update-check');
|
|
241
|
+
const checker = await UpdateChecker.new({
|
|
242
|
+
baseURL: updatesLocation,
|
|
243
|
+
publicClient,
|
|
244
|
+
registryContractAddress
|
|
245
|
+
});
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
247
|
+
checker.on('newRollupVersion', async ({ latestVersion, currentVersion })=>{
|
|
248
|
+
if (isShuttingDown()) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
// if node follows canonical rollup then this is equivalent to a config update
|
|
252
|
+
if (!followsCanonicalRollup) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
256
|
+
logger.info(`New rollup version detected. Please restart the node`, {
|
|
257
|
+
latestVersion,
|
|
258
|
+
currentVersion
|
|
259
|
+
});
|
|
260
|
+
await shutdown(logger.info, 78, signalHandlers);
|
|
261
|
+
} else if (autoUpdateMode === 'notify') {
|
|
262
|
+
logger.warn(`New rollup detected. Please restart the node`, {
|
|
263
|
+
latestVersion,
|
|
264
|
+
currentVersion
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
269
|
+
checker.on('newNodeVersion', async ({ latestVersion, currentVersion })=>{
|
|
270
|
+
if (isShuttingDown()) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (autoUpdateMode === 'config-and-version') {
|
|
274
|
+
logger.info(`New node version detected. Please update and restart the node`, {
|
|
275
|
+
latestVersion,
|
|
276
|
+
currentVersion
|
|
277
|
+
});
|
|
278
|
+
await shutdown(logger.info, 79, signalHandlers);
|
|
279
|
+
} else if (autoUpdateMode === 'notify') {
|
|
280
|
+
logger.info(`New node version detected. Please update and restart the node`, {
|
|
281
|
+
latestVersion,
|
|
282
|
+
currentVersion
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
287
|
+
checker.on('updateNodeConfig', async (config)=>{
|
|
288
|
+
if (isShuttingDown()) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if ((autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') && updateNodeConfig) {
|
|
292
|
+
logger.warn(`Config change detected. Updating node`, config);
|
|
293
|
+
try {
|
|
294
|
+
await updateNodeConfig(config);
|
|
295
|
+
} catch (err) {
|
|
296
|
+
logger.warn('Failed to update config', {
|
|
297
|
+
err
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// don't notify on these config changes
|
|
302
|
+
});
|
|
303
|
+
checker.on('updatePublicTelemetryConfig', (config)=>{
|
|
304
|
+
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
305
|
+
logger.warn(`Public telemetry config change detected. Updating telemetry client`, config);
|
|
306
|
+
try {
|
|
307
|
+
const publicIncludeMetrics = config.publicIncludeMetrics;
|
|
308
|
+
if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every((m)=>typeof m === 'string')) {
|
|
309
|
+
getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
|
|
310
|
+
}
|
|
311
|
+
const publicMetricsCollectFrom = config.publicMetricsCollectFrom;
|
|
312
|
+
if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every((m)=>typeof m === 'string')) {
|
|
313
|
+
getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
|
|
314
|
+
}
|
|
315
|
+
} catch (err) {
|
|
316
|
+
logger.warn('Failed to update config', {
|
|
317
|
+
err
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// don't notify on these config changes
|
|
322
|
+
});
|
|
323
|
+
checker.start();
|
|
324
|
+
}
|
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,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 { 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
|
|
17
|
-
|
|
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;
|
|
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({
|
|
25
|
+
from: alice
|
|
26
|
+
}).deployed();
|
|
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
|
+
}).wait();
|
|
28
33
|
logger.info(`${ALICE_MINT_BALANCE} tokens were successfully minted by Alice and transferred to private`);
|
|
29
|
-
const balanceAfterMint = await
|
|
34
|
+
const 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
|
+
}).wait();
|
|
34
43
|
// Check the new balances
|
|
35
|
-
const aliceBalance = await
|
|
44
|
+
const 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 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,17 +1,16 @@
|
|
|
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';
|
|
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
|
|
@@ -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
|
@@ -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 { 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,9 +1,9 @@
|
|
|
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';
|
|
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,15 +43,17 @@ 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
|
+
from: admin,
|
|
51
52
|
contractAddressSalt: BANANA_COIN_SALT,
|
|
52
53
|
universalDeploy: true
|
|
53
54
|
}).deployed(),
|
|
54
|
-
FPCContract.deploy(
|
|
55
|
+
FPCContract.deploy(wallet, bananaCoinAddress, admin).send({
|
|
56
|
+
from: admin,
|
|
55
57
|
contractAddressSalt: BANANA_FPC_SALT,
|
|
56
58
|
universalDeploy: true
|
|
57
59
|
}).deployed()
|
|
@@ -59,21 +61,17 @@ export async function setupBananaFPC(initialAccounts, deployer, log) {
|
|
|
59
61
|
log(`BananaCoin: ${bananaCoin.address}`);
|
|
60
62
|
log(`FPC: ${fpc.address}`);
|
|
61
63
|
}
|
|
62
|
-
export async function
|
|
63
|
-
const initialAccounts = await
|
|
64
|
-
const bananaCoin = await
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
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;
|
|
70
70
|
}
|
|
71
|
-
export async function
|
|
72
|
-
const initialAccounts = await
|
|
71
|
+
export async function registerDeployedBananaFPCInWalletAndGetAddress(wallet) {
|
|
72
|
+
const initialAccounts = await getInitialTestAccountsData();
|
|
73
73
|
const fpc = await getBananaFPCInstance(initialAccounts);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
throw new Error('BananaFPC not deployed.');
|
|
77
|
-
}
|
|
74
|
+
// The following is no-op if the contract is already registered
|
|
75
|
+
await wallet.registerContract(fpc, FPCContract.artifact);
|
|
78
76
|
return fpc.address;
|
|
79
77
|
}
|
package/dest/sandbox/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './sandbox.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { SponsoredFeePaymentMethod } from './sponsored_fee_payment_method.js';
|
|
2
|
+
export { registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, } from './banana_fpc.js';
|
|
3
|
+
export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';
|
|
5
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,4 +1,3 @@
|
|
|
1
1
|
export * from './sandbox.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { SponsoredFeePaymentMethod } from './sponsored_fee_payment_method.js';
|
|
2
|
+
export { registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress } from './banana_fpc.js';
|
|
3
|
+
export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';
|