@aztec/end-to-end 0.0.1-commit.f2ce05ee → 0.0.1-commit.f5d02921e
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/bench/client_flows/client_flows_benchmark.d.ts +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +21 -28
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +22 -12
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +11 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +61 -34
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +18 -11
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/inactivity_slash_test.js +1 -1
- package/dest/e2e_p2p/p2p_network.d.ts +5 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +24 -7
- package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +45 -8
- package/dest/e2e_p2p/shared.d.ts +22 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +35 -3
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +19 -9
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +7 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +36 -48
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +1 -1
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +3 -1
- package/dest/fixtures/setup.d.ts +44 -23
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +70 -156
- package/dest/fixtures/setup_p2p_test.d.ts +6 -3
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +12 -9
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +5 -7
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +2 -2
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +15 -18
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +4 -4
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +110 -17
- package/dest/spartan/tx_metrics.js +1 -1
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +7 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +3 -1
- package/dest/spartan/utils/index.d.ts +4 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +5 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -0
- package/dest/spartan/utils/nodes.d.ts +4 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +9 -9
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +76 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +213 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +42 -43
- package/src/bench/client_flows/client_flows_benchmark.ts +30 -17
- package/src/bench/utils.ts +8 -3
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +28 -15
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +4 -4
- package/src/e2e_deploy_contract/deploy_test.ts +3 -3
- package/src/e2e_epochs/epochs_test.ts +82 -61
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +20 -28
- package/src/e2e_nested_contract/nested_contract_test.ts +7 -5
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -5
- package/src/e2e_p2p/p2p_network.ts +36 -10
- package/src/e2e_p2p/reqresp/utils.ts +61 -12
- package/src/e2e_p2p/shared.ts +57 -3
- package/src/e2e_token_contract/token_contract_test.ts +26 -9
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +42 -54
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +3 -1
- package/src/fixtures/setup.ts +106 -217
- package/src/fixtures/setup_p2p_test.ts +9 -17
- package/src/fixtures/token_utils.ts +3 -3
- package/src/guides/up_quick_start.sh +3 -3
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +3 -2
- package/src/shared/uniswap_l1_l2.ts +37 -30
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +148 -13
- package/src/spartan/tx_metrics.ts +1 -1
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +7 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/spartan/utils/nodes.ts +15 -10
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +301 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +213 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { parseWithOptionals, schemaHasMethod } from '@aztec/foundation/schemas';
|
|
5
|
+
import { NodeListener, TransportServer } from '@aztec/foundation/transport';
|
|
6
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
7
|
+
import { workerData } from 'worker_threads';
|
|
8
|
+
import { TestWallet } from './test_wallet.js';
|
|
9
|
+
import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
10
|
+
const logger = createLogger('e2e:test-wallet:worker');
|
|
11
|
+
try {
|
|
12
|
+
const { nodeUrl, pxeConfig } = workerData;
|
|
13
|
+
logger.info('Initializing worker wallet', {
|
|
14
|
+
nodeUrl
|
|
15
|
+
});
|
|
16
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
17
|
+
const wallet = await TestWallet.create(node, pxeConfig);
|
|
18
|
+
logger.info('Worker wallet initialized');
|
|
19
|
+
const customMethods = {
|
|
20
|
+
proveTx: async (exec, opts)=>{
|
|
21
|
+
const provenTx = await wallet.proveTx(exec, opts);
|
|
22
|
+
return new Tx(provenTx.getTxHash(), provenTx.data, provenTx.chonkProof, provenTx.contractClassLogFields, provenTx.publicFunctionCalldata);
|
|
23
|
+
},
|
|
24
|
+
registerAccount: async (secret, salt)=>{
|
|
25
|
+
const manager = await wallet.createSchnorrAccount(secret, salt);
|
|
26
|
+
return manager.address;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const schema = WorkerWalletSchema;
|
|
30
|
+
const listener = new NodeListener();
|
|
31
|
+
const server = new TransportServer(listener, async (msg)=>{
|
|
32
|
+
if (!schemaHasMethod(schema, msg.fn)) {
|
|
33
|
+
throw new Error(`Unknown method: ${msg.fn}`);
|
|
34
|
+
}
|
|
35
|
+
const jsonParams = JSON.parse(msg.args);
|
|
36
|
+
const args = await parseWithOptionals(jsonParams, schema[msg.fn].parameters());
|
|
37
|
+
// we have to erase the fn type in order to be able to spread ...args
|
|
38
|
+
const handler = msg.fn in customMethods ? customMethods[msg.fn] : undefined;
|
|
39
|
+
const result = handler ? await handler(...args) : await wallet[msg.fn](...args);
|
|
40
|
+
return jsonStringify(result);
|
|
41
|
+
});
|
|
42
|
+
server.start();
|
|
43
|
+
} catch (err) {
|
|
44
|
+
logger.error('Worker wallet initialization failed', {
|
|
45
|
+
error: err instanceof Error ? err.stack : String(err)
|
|
46
|
+
});
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
|
|
2
|
+
import type { InteractionWaitOptions, SendReturn } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import type { Aliased, AppCapabilities, BatchResults, BatchedMethod, ContractClassMetadata, ContractMetadata, ExecuteUtilityOptions, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions, Wallet, WalletCapabilities } from '@aztec/aztec.js/wallet';
|
|
4
|
+
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
5
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
+
import type { PXEConfig } from '@aztec/pxe/config';
|
|
7
|
+
import type { ContractArtifact, EventMetadataDefinition, FunctionCall } from '@aztec/stdlib/abi';
|
|
8
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
9
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
11
|
+
import type { ExecutionPayload, TxProfileResult, TxSimulationResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
12
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
13
|
+
/**
|
|
14
|
+
* Wallet implementation that offloads all work to a worker thread.
|
|
15
|
+
* Implements the Wallet interface by proxying calls over a transport layer
|
|
16
|
+
* using JSON serialization with Zod schema parsing on both ends.
|
|
17
|
+
*/
|
|
18
|
+
export declare class WorkerWallet implements Wallet {
|
|
19
|
+
private worker;
|
|
20
|
+
private client;
|
|
21
|
+
private constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Creates a WorkerWallet by spawning a worker thread that creates a TestWallet internally.
|
|
24
|
+
* @param nodeUrl - URL of the Aztec node to connect to.
|
|
25
|
+
* @param pxeConfig - Optional PXE configuration overrides.
|
|
26
|
+
* @returns A WorkerWallet ready to use.
|
|
27
|
+
*/
|
|
28
|
+
static create(nodeUrl: string, pxeConfig?: Partial<PXEConfig>): Promise<WorkerWallet>;
|
|
29
|
+
private callRaw;
|
|
30
|
+
private call;
|
|
31
|
+
getChainInfo(): Promise<ChainInfo>;
|
|
32
|
+
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
33
|
+
getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
|
|
34
|
+
getPrivateEvents<T>(eventMetadata: EventMetadataDefinition, eventFilter: PrivateEventFilter): Promise<PrivateEvent<T>[]>;
|
|
35
|
+
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
|
|
36
|
+
getAddressBook(): Promise<Aliased<AztecAddress>[]>;
|
|
37
|
+
getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
38
|
+
registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
|
|
39
|
+
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
40
|
+
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
|
|
41
|
+
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
42
|
+
sendTx<W extends InteractionWaitOptions = undefined>(exec: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
|
|
43
|
+
proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<Tx>;
|
|
44
|
+
/** Registers an account inside the worker's TestWallet, populating its accounts map. */
|
|
45
|
+
registerAccount(secret: Fr, salt: Fr): Promise<AztecAddress>;
|
|
46
|
+
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
|
|
47
|
+
requestCapabilities(manifest: AppCapabilities): Promise<WalletCapabilities>;
|
|
48
|
+
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
|
|
49
|
+
/** Shuts down the worker thread and closes the transport. */
|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,KAAK,CAAC,CAAC,SAAS,SAAS,aAAa,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAEpF;IAED,6DAA6D;IACvD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAG1B;CACF"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
4
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
5
|
+
import { NodeConnector, TransportClient } from '@aztec/foundation/transport';
|
|
6
|
+
import { Worker } from 'worker_threads';
|
|
7
|
+
import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
8
|
+
const log = createLogger('e2e:test-wallet:worker-wallet');
|
|
9
|
+
const WORKER_READY_TIMEOUT_MS = 120_000;
|
|
10
|
+
/**
|
|
11
|
+
* Wallet implementation that offloads all work to a worker thread.
|
|
12
|
+
* Implements the Wallet interface by proxying calls over a transport layer
|
|
13
|
+
* using JSON serialization with Zod schema parsing on both ends.
|
|
14
|
+
*/ export class WorkerWallet {
|
|
15
|
+
worker;
|
|
16
|
+
client;
|
|
17
|
+
constructor(worker, client){
|
|
18
|
+
this.worker = worker;
|
|
19
|
+
this.client = client;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a WorkerWallet by spawning a worker thread that creates a TestWallet internally.
|
|
23
|
+
* @param nodeUrl - URL of the Aztec node to connect to.
|
|
24
|
+
* @param pxeConfig - Optional PXE configuration overrides.
|
|
25
|
+
* @returns A WorkerWallet ready to use.
|
|
26
|
+
*/ static async create(nodeUrl, pxeConfig) {
|
|
27
|
+
// replace stc/ with dest/ so the wallet works in Jest tests
|
|
28
|
+
const workerUrl = new URL('./wallet_worker_script.js', import.meta.url);
|
|
29
|
+
workerUrl.pathname = workerUrl.pathname.replace('/src/', '/dest/');
|
|
30
|
+
// remove JEST_WORKER_ID so the worker uses pino-pretty transport instead of Jest's raw output.
|
|
31
|
+
const { JEST_WORKER_ID: _, ...parentEnv } = process.env;
|
|
32
|
+
const worker = new Worker(workerUrl, {
|
|
33
|
+
workerData: {
|
|
34
|
+
nodeUrl,
|
|
35
|
+
pxeConfig
|
|
36
|
+
},
|
|
37
|
+
env: {
|
|
38
|
+
...parentEnv,
|
|
39
|
+
...process.stderr.isTTY || process.env.FORCE_COLOR ? {
|
|
40
|
+
FORCE_COLOR: '1'
|
|
41
|
+
} : {},
|
|
42
|
+
LOG_LEVEL: process.env.WORKER_LOG_LEVEL ?? 'warn'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const connector = new NodeConnector(worker);
|
|
46
|
+
const client = new TransportClient(connector);
|
|
47
|
+
await client.open();
|
|
48
|
+
const wallet = new WorkerWallet(worker, client);
|
|
49
|
+
const { promise: workerDied, reject: rejectWorkerDied } = promiseWithResolvers();
|
|
50
|
+
// reject if the worker exits or errors before the warmup completes.
|
|
51
|
+
const onError = (err)=>{
|
|
52
|
+
worker.off('exit', onExit);
|
|
53
|
+
rejectWorkerDied(new Error(`Worker wallet thread error: ${err.message}`));
|
|
54
|
+
};
|
|
55
|
+
const onExit = (code)=>{
|
|
56
|
+
worker.off('error', onError);
|
|
57
|
+
rejectWorkerDied(new Error(`Worker wallet thread exited with code ${code} before becoming ready`));
|
|
58
|
+
};
|
|
59
|
+
worker.once('error', onError);
|
|
60
|
+
worker.once('exit', onExit);
|
|
61
|
+
const timeout = sleep(WORKER_READY_TIMEOUT_MS).then(()=>{
|
|
62
|
+
throw new Error(`Worker wallet creation timed out after ${WORKER_READY_TIMEOUT_MS / 1000}s`);
|
|
63
|
+
});
|
|
64
|
+
try {
|
|
65
|
+
// wait for worker wallet to start
|
|
66
|
+
await Promise.race([
|
|
67
|
+
wallet.getChainInfo(),
|
|
68
|
+
workerDied,
|
|
69
|
+
timeout
|
|
70
|
+
]);
|
|
71
|
+
} catch (err) {
|
|
72
|
+
log.error('Worker wallet creation failed, cleaning up', {
|
|
73
|
+
error: String(err)
|
|
74
|
+
});
|
|
75
|
+
client.close();
|
|
76
|
+
await worker.terminate();
|
|
77
|
+
throw err;
|
|
78
|
+
} finally{
|
|
79
|
+
worker.off('error', onError);
|
|
80
|
+
worker.off('exit', onExit);
|
|
81
|
+
}
|
|
82
|
+
return wallet;
|
|
83
|
+
}
|
|
84
|
+
async callRaw(fn, ...args) {
|
|
85
|
+
const argsJson = jsonStringify(args);
|
|
86
|
+
return await this.client.request({
|
|
87
|
+
fn,
|
|
88
|
+
args: argsJson
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async call(fn, ...args) {
|
|
92
|
+
const resultJson = await this.callRaw(fn, ...args);
|
|
93
|
+
const methodSchema = WorkerWalletSchema[fn];
|
|
94
|
+
return methodSchema.returnType().parseAsync(JSON.parse(resultJson));
|
|
95
|
+
}
|
|
96
|
+
getChainInfo() {
|
|
97
|
+
return this.call('getChainInfo');
|
|
98
|
+
}
|
|
99
|
+
getContractMetadata(address) {
|
|
100
|
+
return this.call('getContractMetadata', address);
|
|
101
|
+
}
|
|
102
|
+
getContractClassMetadata(id) {
|
|
103
|
+
return this.call('getContractClassMetadata', id);
|
|
104
|
+
}
|
|
105
|
+
getPrivateEvents(eventMetadata, eventFilter) {
|
|
106
|
+
return this.call('getPrivateEvents', eventMetadata, eventFilter);
|
|
107
|
+
}
|
|
108
|
+
registerSender(address, alias) {
|
|
109
|
+
return this.call('registerSender', address, alias);
|
|
110
|
+
}
|
|
111
|
+
getAddressBook() {
|
|
112
|
+
return this.call('getAddressBook');
|
|
113
|
+
}
|
|
114
|
+
getAccounts() {
|
|
115
|
+
return this.call('getAccounts');
|
|
116
|
+
}
|
|
117
|
+
registerContract(instance, artifact, secretKey) {
|
|
118
|
+
return this.call('registerContract', instance, artifact, secretKey);
|
|
119
|
+
}
|
|
120
|
+
simulateTx(exec, opts) {
|
|
121
|
+
return this.call('simulateTx', exec, opts);
|
|
122
|
+
}
|
|
123
|
+
executeUtility(call, opts) {
|
|
124
|
+
return this.call('executeUtility', call, opts);
|
|
125
|
+
}
|
|
126
|
+
profileTx(exec, opts) {
|
|
127
|
+
return this.call('profileTx', exec, opts);
|
|
128
|
+
}
|
|
129
|
+
sendTx(exec, opts) {
|
|
130
|
+
return this.call('sendTx', exec, opts);
|
|
131
|
+
}
|
|
132
|
+
proveTx(exec, opts) {
|
|
133
|
+
return this.call('proveTx', exec, opts);
|
|
134
|
+
}
|
|
135
|
+
/** Registers an account inside the worker's TestWallet, populating its accounts map. */ registerAccount(secret, salt) {
|
|
136
|
+
return this.call('registerAccount', secret, salt);
|
|
137
|
+
}
|
|
138
|
+
createAuthWit(from, messageHashOrIntent) {
|
|
139
|
+
return this.call('createAuthWit', from, messageHashOrIntent);
|
|
140
|
+
}
|
|
141
|
+
requestCapabilities(manifest) {
|
|
142
|
+
return this.call('requestCapabilities', manifest);
|
|
143
|
+
}
|
|
144
|
+
batch(methods) {
|
|
145
|
+
return this.call('batch', methods);
|
|
146
|
+
}
|
|
147
|
+
/** Shuts down the worker thread and closes the transport. */ async stop() {
|
|
148
|
+
this.client.close();
|
|
149
|
+
await this.worker.terminate();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/** Schema for the WorkerWallet API — extends WalletSchema with proveTx and registerAccount. */
|
|
5
|
+
export declare const WorkerWalletSchema: {
|
|
6
|
+
getPrivateEvents: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/abi").EventMetadataDefinition, z.ZodTypeDef, any>, eventFilter: z.ZodType<import("@aztec/aztec.js/wallet").PrivateEventFilter, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").PrivateEvent<unknown>[], z.ZodTypeDef, any>>;
|
|
7
|
+
getChainInfo: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<import("@aztec/entrypoints/interfaces").ChainInfo, z.ZodTypeDef, any>>;
|
|
8
|
+
getContractMetadata: z.ZodFunction<z.ZodTuple<[z.ZodType<AztecAddress, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").ContractMetadata, z.ZodTypeDef, any>>;
|
|
9
|
+
getContractClassMetadata: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/foundation/schemas").Fr, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").ContractClassMetadata, z.ZodTypeDef, any>>;
|
|
10
|
+
registerSender: z.ZodFunction<z.ZodTuple<[z.ZodType<AztecAddress, z.ZodTypeDef, any>, alias?: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodType<string | undefined, z.ZodTypeDef, any>> | undefined], z.ZodUnknown>, z.ZodType<AztecAddress, z.ZodTypeDef, any>>;
|
|
11
|
+
getAddressBook: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").Aliased<AztecAddress>[], z.ZodTypeDef, any>>;
|
|
12
|
+
getAccounts: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").Aliased<AztecAddress>[], z.ZodTypeDef, any>>;
|
|
13
|
+
registerContract: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/contract").ContractInstanceWithAddress, z.ZodTypeDef, any>, artifact?: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodType<import("@aztec/stdlib/abi").ContractArtifact | undefined, z.ZodTypeDef, any>> | undefined, secretKey?: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodType<import("@aztec/foundation/schemas").Fr | undefined, z.ZodTypeDef, any>> | undefined], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/contract").ContractInstanceWithAddress, z.ZodTypeDef, any>>;
|
|
14
|
+
simulateTx: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/tx").ExecutionPayload, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").SimulateOptions, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/tx").TxSimulationResult, z.ZodTypeDef, any>>;
|
|
15
|
+
executeUtility: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/abi").FunctionCall, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").ExecuteUtilityOptions, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/tx").UtilityExecutionResult, z.ZodTypeDef, any>>;
|
|
16
|
+
profileTx: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/tx").ExecutionPayload, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").ProfileOptions, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/tx").TxProfileResult, z.ZodTypeDef, any>>;
|
|
17
|
+
sendTx: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/tx").ExecutionPayload, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").SendOptions<import("@aztec/aztec.js/contracts").InteractionWaitOptions>, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/contracts").TxSendResultImmediate | import("@aztec/aztec.js/contracts").TxSendResultMined<import("@aztec/stdlib/tx").TxReceipt>, z.ZodTypeDef, any>>;
|
|
18
|
+
createAuthWit: z.ZodFunction<z.ZodTuple<[z.ZodType<AztecAddress, z.ZodTypeDef, any>, messageHashOrIntent: z.ZodType<import("@aztec/aztec.js/authorization").CallIntent | import("@aztec/aztec.js/authorization").IntentInnerHash, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/auth-witness").AuthWitness, z.ZodTypeDef, any>>;
|
|
19
|
+
requestCapabilities: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/aztec.js/wallet").AppCapabilities, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").WalletCapabilities, z.ZodTypeDef, any>>;
|
|
20
|
+
batch: z.ZodFunction<z.ZodTuple<[z.ZodType<readonly import("@aztec/aztec.js/wallet").BatchedMethod[], z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<readonly import("@aztec/aztec.js/wallet").BatchedMethodResultWrapper<import("@aztec/aztec.js/wallet").BatchedMethod>[], z.ZodTypeDef, any>>;
|
|
21
|
+
proveTx: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
22
|
+
calls: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
to: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
|
|
25
|
+
selector: import("@aztec/foundation/schemas").ZodFor<import("@aztec/stdlib/abi").FunctionSelector>;
|
|
26
|
+
type: z.ZodNativeEnum<typeof import("@aztec/stdlib/abi").FunctionType>;
|
|
27
|
+
isStatic: z.ZodBoolean;
|
|
28
|
+
hideMsgSender: z.ZodBoolean;
|
|
29
|
+
args: z.ZodArray<import("@aztec/foundation/schemas").ZodFor<import("@aztec/foundation/schemas").Fr>, "many">;
|
|
30
|
+
returnTypes: z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiType, z.ZodTypeDef, import("@aztec/stdlib/abi").AbiType>, "many">;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
name: string;
|
|
33
|
+
to: AztecAddress;
|
|
34
|
+
selector: import("@aztec/stdlib/abi").FunctionSelector;
|
|
35
|
+
type: import("@aztec/stdlib/abi").FunctionType;
|
|
36
|
+
isStatic: boolean;
|
|
37
|
+
hideMsgSender: boolean;
|
|
38
|
+
args: import("@aztec/foundation/schemas").Fr[];
|
|
39
|
+
returnTypes: import("@aztec/stdlib/abi").AbiType[];
|
|
40
|
+
}, {
|
|
41
|
+
name: string;
|
|
42
|
+
to?: any;
|
|
43
|
+
selector?: any;
|
|
44
|
+
type: import("@aztec/stdlib/abi").FunctionType;
|
|
45
|
+
isStatic: boolean;
|
|
46
|
+
hideMsgSender: boolean;
|
|
47
|
+
args: any[];
|
|
48
|
+
returnTypes: import("@aztec/stdlib/abi").AbiType[];
|
|
49
|
+
}>, import("@aztec/stdlib/abi").FunctionCall, {
|
|
50
|
+
name: string;
|
|
51
|
+
to?: any;
|
|
52
|
+
selector?: any;
|
|
53
|
+
type: import("@aztec/stdlib/abi").FunctionType;
|
|
54
|
+
isStatic: boolean;
|
|
55
|
+
hideMsgSender: boolean;
|
|
56
|
+
args: any[];
|
|
57
|
+
returnTypes: import("@aztec/stdlib/abi").AbiType[];
|
|
58
|
+
}>, "many">;
|
|
59
|
+
authWitnesses: z.ZodArray<z.ZodType<import("@aztec/stdlib/auth-witness").AuthWitness, any, string>, "many">;
|
|
60
|
+
capsules: z.ZodArray<z.ZodType<import("@aztec/stdlib/tx").Capsule, any, string>, "many">;
|
|
61
|
+
extraHashedArgs: z.ZodArray<import("@aztec/foundation/schemas").ZodFor<import("@aztec/stdlib/tx").HashedValues>, "many">;
|
|
62
|
+
feePayer: import("@aztec/foundation/schemas").ZodNullableOptional<import("@aztec/foundation/schemas").ZodFor<AztecAddress>>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
calls: import("@aztec/stdlib/abi").FunctionCall[];
|
|
65
|
+
authWitnesses: import("@aztec/stdlib/auth-witness").AuthWitness[];
|
|
66
|
+
capsules: import("@aztec/stdlib/tx").Capsule[];
|
|
67
|
+
extraHashedArgs: import("@aztec/stdlib/tx").HashedValues[];
|
|
68
|
+
feePayer?: AztecAddress | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
calls: {
|
|
71
|
+
name: string;
|
|
72
|
+
to?: any;
|
|
73
|
+
selector?: any;
|
|
74
|
+
type: import("@aztec/stdlib/abi").FunctionType;
|
|
75
|
+
isStatic: boolean;
|
|
76
|
+
hideMsgSender: boolean;
|
|
77
|
+
args: any[];
|
|
78
|
+
returnTypes: import("@aztec/stdlib/abi").AbiType[];
|
|
79
|
+
}[];
|
|
80
|
+
authWitnesses: string[];
|
|
81
|
+
capsules: string[];
|
|
82
|
+
extraHashedArgs: any[];
|
|
83
|
+
feePayer?: any;
|
|
84
|
+
}>, z.ZodObject<{
|
|
85
|
+
from: z.ZodUnion<[import("@aztec/foundation/schemas").ZodFor<AztecAddress>, z.ZodLiteral<"NO_FROM">]>;
|
|
86
|
+
authWitnesses: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodArray<z.ZodType<import("@aztec/stdlib/auth-witness").AuthWitness, any, string>, "many">>;
|
|
87
|
+
capsules: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodArray<z.ZodType<import("@aztec/stdlib/tx").Capsule, any, string>, "many">>;
|
|
88
|
+
fee: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodObject<{
|
|
89
|
+
gasSettings: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodObject<{
|
|
90
|
+
gasLimits: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodEffects<z.ZodObject<{
|
|
91
|
+
daGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
92
|
+
l2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
daGas: number;
|
|
95
|
+
l2Gas: number;
|
|
96
|
+
}, {
|
|
97
|
+
daGas: string | number | bigint;
|
|
98
|
+
l2Gas: string | number | bigint;
|
|
99
|
+
}>, import("@aztec/stdlib/gas").Gas, {
|
|
100
|
+
daGas: string | number | bigint;
|
|
101
|
+
l2Gas: string | number | bigint;
|
|
102
|
+
}>>;
|
|
103
|
+
teardownGasLimits: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodEffects<z.ZodObject<{
|
|
104
|
+
daGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
105
|
+
l2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
daGas: number;
|
|
108
|
+
l2Gas: number;
|
|
109
|
+
}, {
|
|
110
|
+
daGas: string | number | bigint;
|
|
111
|
+
l2Gas: string | number | bigint;
|
|
112
|
+
}>, import("@aztec/stdlib/gas").Gas, {
|
|
113
|
+
daGas: string | number | bigint;
|
|
114
|
+
l2Gas: string | number | bigint;
|
|
115
|
+
}>>;
|
|
116
|
+
maxFeePerGas: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodObject<{
|
|
117
|
+
feePerDaGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
118
|
+
feePerL2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
feePerDaGas: bigint;
|
|
121
|
+
feePerL2Gas: bigint;
|
|
122
|
+
}, {
|
|
123
|
+
feePerDaGas: string | number | bigint;
|
|
124
|
+
feePerL2Gas: string | number | bigint;
|
|
125
|
+
}>>;
|
|
126
|
+
maxPriorityFeePerGas: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodObject<{
|
|
127
|
+
feePerDaGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
128
|
+
feePerL2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
feePerDaGas: bigint;
|
|
131
|
+
feePerL2Gas: bigint;
|
|
132
|
+
}, {
|
|
133
|
+
feePerDaGas: string | number | bigint;
|
|
134
|
+
feePerL2Gas: string | number | bigint;
|
|
135
|
+
}>>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
gasLimits?: import("@aztec/stdlib/gas").Gas | undefined;
|
|
138
|
+
teardownGasLimits?: import("@aztec/stdlib/gas").Gas | undefined;
|
|
139
|
+
maxFeePerGas?: {
|
|
140
|
+
feePerDaGas: bigint;
|
|
141
|
+
feePerL2Gas: bigint;
|
|
142
|
+
} | undefined;
|
|
143
|
+
maxPriorityFeePerGas?: {
|
|
144
|
+
feePerDaGas: bigint;
|
|
145
|
+
feePerL2Gas: bigint;
|
|
146
|
+
} | undefined;
|
|
147
|
+
}, {
|
|
148
|
+
gasLimits?: {
|
|
149
|
+
daGas: string | number | bigint;
|
|
150
|
+
l2Gas: string | number | bigint;
|
|
151
|
+
} | undefined;
|
|
152
|
+
teardownGasLimits?: {
|
|
153
|
+
daGas: string | number | bigint;
|
|
154
|
+
l2Gas: string | number | bigint;
|
|
155
|
+
} | undefined;
|
|
156
|
+
maxFeePerGas?: {
|
|
157
|
+
feePerDaGas: string | number | bigint;
|
|
158
|
+
feePerL2Gas: string | number | bigint;
|
|
159
|
+
} | undefined;
|
|
160
|
+
maxPriorityFeePerGas?: {
|
|
161
|
+
feePerDaGas: string | number | bigint;
|
|
162
|
+
feePerL2Gas: string | number | bigint;
|
|
163
|
+
} | undefined;
|
|
164
|
+
}>>;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
gasSettings?: {
|
|
167
|
+
gasLimits?: import("@aztec/stdlib/gas").Gas | undefined;
|
|
168
|
+
teardownGasLimits?: import("@aztec/stdlib/gas").Gas | undefined;
|
|
169
|
+
maxFeePerGas?: {
|
|
170
|
+
feePerDaGas: bigint;
|
|
171
|
+
feePerL2Gas: bigint;
|
|
172
|
+
} | undefined;
|
|
173
|
+
maxPriorityFeePerGas?: {
|
|
174
|
+
feePerDaGas: bigint;
|
|
175
|
+
feePerL2Gas: bigint;
|
|
176
|
+
} | undefined;
|
|
177
|
+
} | undefined;
|
|
178
|
+
}, {
|
|
179
|
+
gasSettings?: {
|
|
180
|
+
gasLimits?: {
|
|
181
|
+
daGas: string | number | bigint;
|
|
182
|
+
l2Gas: string | number | bigint;
|
|
183
|
+
} | undefined;
|
|
184
|
+
teardownGasLimits?: {
|
|
185
|
+
daGas: string | number | bigint;
|
|
186
|
+
l2Gas: string | number | bigint;
|
|
187
|
+
} | undefined;
|
|
188
|
+
maxFeePerGas?: {
|
|
189
|
+
feePerDaGas: string | number | bigint;
|
|
190
|
+
feePerL2Gas: string | number | bigint;
|
|
191
|
+
} | undefined;
|
|
192
|
+
maxPriorityFeePerGas?: {
|
|
193
|
+
feePerDaGas: string | number | bigint;
|
|
194
|
+
feePerL2Gas: string | number | bigint;
|
|
195
|
+
} | undefined;
|
|
196
|
+
} | undefined;
|
|
197
|
+
}>>;
|
|
198
|
+
wait: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodUnion<[z.ZodLiteral<"NO_WAIT">, z.ZodObject<{
|
|
199
|
+
ignoreDroppedReceiptsFor: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodNumber>;
|
|
200
|
+
timeout: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodNumber>;
|
|
201
|
+
interval: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodNumber>;
|
|
202
|
+
dontThrowOnRevert: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodBoolean>;
|
|
203
|
+
}, "strip", z.ZodTypeAny, {
|
|
204
|
+
ignoreDroppedReceiptsFor?: number | undefined;
|
|
205
|
+
timeout?: number | undefined;
|
|
206
|
+
interval?: number | undefined;
|
|
207
|
+
dontThrowOnRevert?: boolean | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
ignoreDroppedReceiptsFor?: number | undefined;
|
|
210
|
+
timeout?: number | undefined;
|
|
211
|
+
interval?: number | undefined;
|
|
212
|
+
dontThrowOnRevert?: boolean | undefined;
|
|
213
|
+
}>]>>;
|
|
214
|
+
additionalScopes: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodArray<import("@aztec/foundation/schemas").ZodFor<AztecAddress>, "many">>;
|
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
|
216
|
+
from: "NO_FROM" | AztecAddress;
|
|
217
|
+
authWitnesses?: import("@aztec/stdlib/auth-witness").AuthWitness[] | undefined;
|
|
218
|
+
capsules?: import("@aztec/stdlib/tx").Capsule[] | undefined;
|
|
219
|
+
fee?: {
|
|
220
|
+
gasSettings?: {
|
|
221
|
+
gasLimits?: import("@aztec/stdlib/gas").Gas | undefined;
|
|
222
|
+
teardownGasLimits?: import("@aztec/stdlib/gas").Gas | undefined;
|
|
223
|
+
maxFeePerGas?: {
|
|
224
|
+
feePerDaGas: bigint;
|
|
225
|
+
feePerL2Gas: bigint;
|
|
226
|
+
} | undefined;
|
|
227
|
+
maxPriorityFeePerGas?: {
|
|
228
|
+
feePerDaGas: bigint;
|
|
229
|
+
feePerL2Gas: bigint;
|
|
230
|
+
} | undefined;
|
|
231
|
+
} | undefined;
|
|
232
|
+
} | undefined;
|
|
233
|
+
wait?: "NO_WAIT" | {
|
|
234
|
+
ignoreDroppedReceiptsFor?: number | undefined;
|
|
235
|
+
timeout?: number | undefined;
|
|
236
|
+
interval?: number | undefined;
|
|
237
|
+
dontThrowOnRevert?: boolean | undefined;
|
|
238
|
+
} | undefined;
|
|
239
|
+
additionalScopes?: AztecAddress[] | undefined;
|
|
240
|
+
}, {
|
|
241
|
+
from?: any;
|
|
242
|
+
authWitnesses?: string[] | undefined;
|
|
243
|
+
capsules?: string[] | undefined;
|
|
244
|
+
fee?: {
|
|
245
|
+
gasSettings?: {
|
|
246
|
+
gasLimits?: {
|
|
247
|
+
daGas: string | number | bigint;
|
|
248
|
+
l2Gas: string | number | bigint;
|
|
249
|
+
} | undefined;
|
|
250
|
+
teardownGasLimits?: {
|
|
251
|
+
daGas: string | number | bigint;
|
|
252
|
+
l2Gas: string | number | bigint;
|
|
253
|
+
} | undefined;
|
|
254
|
+
maxFeePerGas?: {
|
|
255
|
+
feePerDaGas: string | number | bigint;
|
|
256
|
+
feePerL2Gas: string | number | bigint;
|
|
257
|
+
} | undefined;
|
|
258
|
+
maxPriorityFeePerGas?: {
|
|
259
|
+
feePerDaGas: string | number | bigint;
|
|
260
|
+
feePerL2Gas: string | number | bigint;
|
|
261
|
+
} | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
} | undefined;
|
|
264
|
+
wait?: "NO_WAIT" | {
|
|
265
|
+
ignoreDroppedReceiptsFor?: number | undefined;
|
|
266
|
+
timeout?: number | undefined;
|
|
267
|
+
interval?: number | undefined;
|
|
268
|
+
dontThrowOnRevert?: boolean | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
additionalScopes?: any[] | undefined;
|
|
271
|
+
}>], z.ZodUnknown>, import("@aztec/foundation/schemas").ZodFor<Tx>>;
|
|
272
|
+
registerAccount: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>, z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>], z.ZodUnknown>, import("@aztec/foundation/schemas").ZodFor<AztecAddress>>;
|
|
273
|
+
};
|
|
274
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyX3dhbGxldF9zY2hlbWEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0LXdhbGxldC93b3JrZXJfd2FsbGV0X3NjaGVtYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQUUsWUFBWSxFQU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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExecutionPayloadSchema, SendOptionsSchema, WalletSchema } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/** Schema for the WorkerWallet API — extends WalletSchema with proveTx and registerAccount. */ export const WorkerWalletSchema = {
|
|
7
|
+
...WalletSchema,
|
|
8
|
+
proveTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(Tx.schema),
|
|
9
|
+
registerAccount: z.function().args(schemas.Fr, schemas.Fr).returns(AztecAddress.schema)
|
|
10
|
+
};
|