@aztec/cli-wallet 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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 +30 -0
- package/dest/bin/index.d.ts +1 -1
- package/dest/bin/index.js +38 -23
- package/dest/cmds/authorize_action.d.ts +4 -3
- package/dest/cmds/authorize_action.d.ts.map +1 -1
- package/dest/cmds/authorize_action.js +6 -7
- package/dest/cmds/bridge_fee_juice.d.ts +4 -4
- package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
- package/dest/cmds/bridge_fee_juice.js +9 -7
- package/dest/cmds/check_tx.d.ts +5 -3
- package/dest/cmds/check_tx.d.ts.map +1 -1
- package/dest/cmds/check_tx.js +144 -6
- package/dest/cmds/create_account.d.ts +7 -6
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +36 -48
- package/dest/cmds/create_authwit.d.ts +4 -3
- package/dest/cmds/create_authwit.d.ts.map +1 -1
- package/dest/cmds/create_authwit.js +6 -6
- package/dest/cmds/deploy.d.ts +7 -4
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +57 -46
- package/dest/cmds/deploy_account.d.ts +6 -8
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +36 -51
- package/dest/cmds/import_test_accounts.d.ts +3 -3
- package/dest/cmds/import_test_accounts.d.ts.map +1 -1
- package/dest/cmds/import_test_accounts.js +6 -9
- package/dest/cmds/index.d.ts +3 -3
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +73 -112
- package/dest/cmds/profile.d.ts +7 -4
- package/dest/cmds/profile.d.ts.map +1 -1
- package/dest/cmds/profile.js +9 -4
- package/dest/cmds/register_contract.d.ts +7 -3
- package/dest/cmds/register_contract.d.ts.map +1 -1
- package/dest/cmds/register_contract.js +5 -6
- package/dest/cmds/register_sender.d.ts +4 -3
- package/dest/cmds/register_sender.d.ts.map +1 -1
- package/dest/cmds/send.d.ts +8 -9
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +27 -24
- package/dest/cmds/simulate.d.ts +7 -4
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +9 -4
- package/dest/storage/wallet_db.d.ts +6 -16
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +2 -23
- package/dest/utils/authorizations.d.ts +3 -2
- package/dest/utils/authorizations.d.ts.map +1 -1
- package/dest/utils/authorizations.js +1 -1
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts +12 -0
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts.map +1 -0
- package/dest/utils/cli_wallet_and_node_wrapper.js +25 -0
- package/dest/utils/ecdsa.d.ts +1 -1
- package/dest/utils/options/fees.d.ts +22 -28
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +66 -133
- package/dest/utils/options/index.d.ts +1 -1
- package/dest/utils/options/options.d.ts +4 -3
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +1 -1
- package/dest/utils/profiling.d.ts +1 -1
- package/dest/utils/wallet.d.ts +36 -0
- package/dest/utils/wallet.d.ts.map +1 -0
- package/dest/utils/wallet.js +195 -0
- package/package.json +17 -14
- package/src/bin/index.ts +38 -31
- package/src/cmds/authorize_action.ts +14 -6
- package/src/cmds/bridge_fee_juice.ts +15 -11
- package/src/cmds/check_tx.ts +181 -5
- package/src/cmds/create_account.ts +43 -53
- package/src/cmds/create_authwit.ts +9 -5
- package/src/cmds/deploy.ts +58 -56
- package/src/cmds/deploy_account.ts +43 -51
- package/src/cmds/import_test_accounts.ts +7 -11
- package/src/cmds/index.ts +120 -206
- package/src/cmds/profile.ts +14 -6
- package/src/cmds/register_contract.ts +9 -11
- package/src/cmds/register_sender.ts +3 -2
- package/src/cmds/send.ts +22 -32
- package/src/cmds/simulate.ts +14 -6
- package/src/storage/wallet_db.ts +3 -31
- package/src/utils/authorizations.ts +3 -1
- package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
- package/src/utils/options/fees.ts +88 -178
- package/src/utils/options/options.ts +3 -2
- package/src/utils/wallet.ts +266 -0
- package/dest/cmds/cancel_tx.d.ts +0 -11
- package/dest/cmds/cancel_tx.d.ts.map +0 -1
- package/dest/cmds/cancel_tx.js +0 -43
- package/dest/utils/accounts.d.ts +0 -9
- package/dest/utils/accounts.d.ts.map +0 -1
- package/dest/utils/accounts.js +0 -61
- package/dest/utils/pxe_wrapper.d.ts +0 -12
- package/dest/utils/pxe_wrapper.d.ts.map +0 -1
- package/dest/utils/pxe_wrapper.js +0 -26
- package/src/cmds/cancel_tx.ts +0 -66
- package/src/utils/accounts.ts +0 -77
- package/src/utils/pxe_wrapper.ts +0 -32
package/src/cmds/profile.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
3
|
+
import { Contract } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
5
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
7
|
import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
|
|
@@ -6,27 +9,32 @@ import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
|
|
|
6
9
|
import { promises as fs } from 'fs';
|
|
7
10
|
import path from 'path';
|
|
8
11
|
|
|
9
|
-
import type {
|
|
12
|
+
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
10
13
|
import { printProfileResult } from '../utils/profiling.js';
|
|
14
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
11
15
|
|
|
12
16
|
export async function profile(
|
|
13
|
-
wallet:
|
|
17
|
+
wallet: CLIWallet,
|
|
18
|
+
node: AztecNode,
|
|
19
|
+
from: AztecAddress,
|
|
14
20
|
functionName: string,
|
|
15
21
|
functionArgsIn: any[],
|
|
16
22
|
contractArtifactPath: string,
|
|
17
23
|
contractAddress: AztecAddress,
|
|
18
24
|
debugOutputPath: string | undefined,
|
|
19
|
-
feeOpts:
|
|
25
|
+
feeOpts: CLIFeeArgs,
|
|
20
26
|
authWitnesses: AuthWitness[],
|
|
21
27
|
log: LogFn,
|
|
22
28
|
) {
|
|
23
29
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
24
30
|
|
|
25
|
-
const contract =
|
|
31
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
26
32
|
const call = contract.methods[functionName](...functionArgs);
|
|
27
33
|
|
|
34
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
|
28
35
|
const result = await call.profile({
|
|
29
|
-
|
|
36
|
+
fee: { gasSettings, paymentMethod },
|
|
37
|
+
from,
|
|
30
38
|
profileMode: 'full',
|
|
31
39
|
authWitnesses,
|
|
32
40
|
skipProofGeneration: false,
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
getContractInstanceFromInstantiationParams,
|
|
8
|
-
} from '@aztec/aztec.js';
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { PublicKeys } from '@aztec/aztec.js/keys';
|
|
5
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
7
|
import { getContractArtifact } from '@aztec/cli/cli-utils';
|
|
10
8
|
import type { LogFn } from '@aztec/foundation/log';
|
|
11
9
|
import { getAllFunctionAbis, getInitializer } from '@aztec/stdlib/abi';
|
|
12
10
|
|
|
13
11
|
export async function registerContract(
|
|
14
|
-
wallet:
|
|
12
|
+
wallet: Wallet,
|
|
15
13
|
node: AztecNode,
|
|
16
14
|
address: AztecAddress,
|
|
17
15
|
artifactPath: string,
|
|
@@ -32,14 +30,14 @@ export async function registerContract(
|
|
|
32
30
|
constructorArtifact,
|
|
33
31
|
publicKeys: publicKeys ?? PublicKeys.default(),
|
|
34
32
|
constructorArgs: rawArgs,
|
|
35
|
-
salt,
|
|
33
|
+
salt: salt ?? Fr.ZERO,
|
|
36
34
|
deployer,
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
37
|
if (!contractInstance.address.equals(address)) {
|
|
40
38
|
throw new Error(`Contract address mismatch: expected ${address}, got ${contractInstance.address}`);
|
|
41
39
|
}
|
|
42
|
-
await wallet.registerContract(
|
|
40
|
+
await wallet.registerContract(contractInstance, contractArtifact);
|
|
43
41
|
log(`Contract registered: at ${contractInstance.address}`);
|
|
44
42
|
return contractInstance;
|
|
45
43
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
2
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
4
|
|
|
4
|
-
export async function registerSender(wallet:
|
|
5
|
+
export async function registerSender(wallet: Wallet, address: AztecAddress, log: LogFn) {
|
|
5
6
|
await wallet.registerSender(address);
|
|
6
7
|
log(`Sender registered: ${address}`);
|
|
7
8
|
}
|
package/src/cmds/send.ts
CHANGED
|
@@ -1,59 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Contract,
|
|
6
|
-
Fr,
|
|
7
|
-
type SendMethodOptions,
|
|
8
|
-
} from '@aztec/aztec.js';
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
3
|
+
import { Contract, type SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
9
5
|
import { prepTx } from '@aztec/cli/utils';
|
|
10
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
11
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
12
7
|
|
|
13
|
-
import {
|
|
8
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
9
|
+
import { CLIFeeArgs } from '../utils/options/fees.js';
|
|
14
10
|
import { printProfileResult } from '../utils/profiling.js';
|
|
15
|
-
import {
|
|
11
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
16
12
|
|
|
17
13
|
export async function send(
|
|
18
|
-
wallet:
|
|
14
|
+
wallet: CLIWallet,
|
|
15
|
+
node: AztecNode,
|
|
16
|
+
from: AztecAddress,
|
|
19
17
|
functionName: string,
|
|
20
18
|
functionArgsIn: any[],
|
|
21
19
|
contractArtifactPath: string,
|
|
22
20
|
contractAddress: AztecAddress,
|
|
23
21
|
wait: boolean,
|
|
24
22
|
cancellable: boolean,
|
|
25
|
-
feeOpts:
|
|
23
|
+
feeOpts: CLIFeeArgs,
|
|
26
24
|
authWitnesses: AuthWitness[],
|
|
27
25
|
verbose: boolean,
|
|
28
26
|
log: LogFn,
|
|
29
27
|
) {
|
|
30
28
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
31
29
|
|
|
32
|
-
const contract =
|
|
30
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
33
31
|
const call = contract.methods[functionName](...functionArgs);
|
|
34
32
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
|
34
|
+
const sendOptions: SendInteractionOptions = {
|
|
35
|
+
fee: { paymentMethod, gasSettings },
|
|
36
|
+
from,
|
|
39
37
|
authWitnesses,
|
|
40
|
-
cancellable,
|
|
41
|
-
txNonce,
|
|
42
38
|
};
|
|
43
39
|
|
|
44
|
-
const
|
|
45
|
-
|
|
40
|
+
const { estimatedGas, stats } = await call.simulate({
|
|
41
|
+
...sendOptions,
|
|
42
|
+
fee: { ...sendOptions.fee, estimateGas: true },
|
|
43
|
+
});
|
|
46
44
|
|
|
47
45
|
if (feeOpts.estimateOnly) {
|
|
48
46
|
return;
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
const
|
|
49
|
+
const tx = call.send({ ...sendOptions, fee: { ...sendOptions.fee, gasSettings: estimatedGas } });
|
|
52
50
|
if (verbose) {
|
|
53
|
-
printProfileResult(
|
|
51
|
+
printProfileResult(stats!, log);
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
const tx = provenTx.send();
|
|
57
54
|
const txHash = await tx.getTxHash();
|
|
58
55
|
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
59
56
|
if (wait) {
|
|
@@ -73,14 +70,7 @@ export async function send(
|
|
|
73
70
|
} else {
|
|
74
71
|
log('Transaction pending. Check status with check-tx');
|
|
75
72
|
}
|
|
76
|
-
const gasSettings = GasSettings.from({
|
|
77
|
-
...feeOpts.gasSettings,
|
|
78
|
-
...gasLimits,
|
|
79
|
-
});
|
|
80
73
|
return {
|
|
81
74
|
txHash,
|
|
82
|
-
txNonce,
|
|
83
|
-
cancellable,
|
|
84
|
-
gasSettings,
|
|
85
75
|
};
|
|
86
76
|
}
|
package/src/cmds/simulate.ts
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
3
|
+
import { Contract } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
5
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
7
|
|
|
5
8
|
import { format } from 'util';
|
|
6
9
|
|
|
7
10
|
import { printAuthorizations } from '../utils/authorizations.js';
|
|
8
|
-
import type {
|
|
11
|
+
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
9
12
|
import { printProfileResult } from '../utils/profiling.js';
|
|
13
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
10
14
|
|
|
11
15
|
export async function simulate(
|
|
12
|
-
wallet:
|
|
16
|
+
wallet: CLIWallet,
|
|
17
|
+
node: AztecNode,
|
|
18
|
+
from: AztecAddress,
|
|
13
19
|
functionName: string,
|
|
14
20
|
functionArgsIn: any[],
|
|
15
21
|
contractArtifactPath: string,
|
|
16
22
|
contractAddress: AztecAddress,
|
|
17
|
-
feeOpts:
|
|
23
|
+
feeOpts: CLIFeeArgs,
|
|
18
24
|
authWitnesses: AuthWitness[],
|
|
19
25
|
verbose: boolean,
|
|
20
26
|
log: LogFn,
|
|
21
27
|
) {
|
|
22
28
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
23
29
|
|
|
24
|
-
const contract =
|
|
30
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
25
31
|
const call = contract.methods[functionName](...functionArgs);
|
|
32
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
|
26
33
|
const simulationResult = await call.simulate({
|
|
27
|
-
|
|
34
|
+
fee: { paymentMethod, gasSettings },
|
|
35
|
+
from,
|
|
28
36
|
authWitnesses,
|
|
29
37
|
includeMetadata: true,
|
|
30
38
|
});
|
package/src/storage/wallet_db.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
4
4
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
7
6
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
8
7
|
|
|
9
|
-
import type { AccountType } from '../utils/accounts.js';
|
|
10
8
|
import { extractECDSAPublicKeyFromBase64String } from '../utils/ecdsa.js';
|
|
9
|
+
import type { AccountType } from '../utils/wallet.js';
|
|
11
10
|
|
|
12
11
|
export const Aliases = ['accounts', 'contracts', 'artifacts', 'secrets', 'transactions', 'authwits'] as const;
|
|
13
12
|
export type AliasType = (typeof Aliases)[number];
|
|
@@ -16,7 +15,6 @@ export class WalletDB {
|
|
|
16
15
|
#accounts!: AztecAsyncMap<string, Buffer>;
|
|
17
16
|
#aliases!: AztecAsyncMap<string, Buffer>;
|
|
18
17
|
#bridgedFeeJuice!: AztecAsyncMap<string, Buffer>;
|
|
19
|
-
#transactions!: AztecAsyncMap<string, Buffer>;
|
|
20
18
|
|
|
21
19
|
private static instance: WalletDB;
|
|
22
20
|
|
|
@@ -34,7 +32,6 @@ export class WalletDB {
|
|
|
34
32
|
this.#accounts = store.openMap('accounts');
|
|
35
33
|
this.#aliases = store.openMap('aliases');
|
|
36
34
|
this.#bridgedFeeJuice = store.openMap('bridgedFeeJuice');
|
|
37
|
-
this.#transactions = store.openMap('transactions');
|
|
38
35
|
|
|
39
36
|
await this.refreshAliasCache();
|
|
40
37
|
}
|
|
@@ -125,41 +122,16 @@ export class WalletDB {
|
|
|
125
122
|
await this.refreshAliasCache();
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
async storeTx(
|
|
129
|
-
{
|
|
130
|
-
txHash,
|
|
131
|
-
txNonce,
|
|
132
|
-
cancellable,
|
|
133
|
-
gasSettings,
|
|
134
|
-
}: { txHash: TxHash; txNonce: Fr; cancellable: boolean; gasSettings: GasSettings },
|
|
135
|
-
log: LogFn,
|
|
136
|
-
alias?: string,
|
|
137
|
-
) {
|
|
125
|
+
async storeTx({ txHash }: { txHash: TxHash }, log: LogFn, alias?: string) {
|
|
138
126
|
if (alias) {
|
|
139
127
|
await this.#aliases.set(`transactions:${alias}`, Buffer.from(txHash.toString()));
|
|
140
128
|
}
|
|
141
|
-
await this.#transactions.set(`${txHash.toString()}:txNonce`, txNonce.toBuffer());
|
|
142
|
-
await this.#transactions.set(`${txHash.toString()}:cancellable`, Buffer.from(cancellable ? 'true' : 'false'));
|
|
143
|
-
await this.#transactions.set(`${txHash.toString()}:gasSettings`, gasSettings.toBuffer());
|
|
144
129
|
await this.#aliases.set(`transactions:last`, Buffer.from(txHash.toString()));
|
|
145
130
|
log(`Transaction hash stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
146
131
|
|
|
147
132
|
await this.refreshAliasCache();
|
|
148
133
|
}
|
|
149
134
|
|
|
150
|
-
async retrieveTxData(txHash: TxHash) {
|
|
151
|
-
const txNonceBuffer = await this.#transactions.getAsync(`${txHash.toString()}:txNonce`);
|
|
152
|
-
if (!txNonceBuffer) {
|
|
153
|
-
throw new Error(
|
|
154
|
-
`Could not find ${txHash.toString()}:txNonce. Transaction with hash "${txHash.toString()}" does not exist on this wallet.`,
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
const txNonce = Fr.fromBuffer(txNonceBuffer);
|
|
158
|
-
const cancellable = (await this.#transactions.getAsync(`${txHash.toString()}:cancellable`))!.toString() === 'true';
|
|
159
|
-
const gasBuffer = (await this.#transactions.getAsync(`${txHash.toString()}:gasSettings`))!;
|
|
160
|
-
return { txHash, txNonce, cancellable, gasSettings: GasSettings.fromBuffer(gasBuffer) };
|
|
161
|
-
}
|
|
162
|
-
|
|
163
135
|
tryRetrieveAlias(arg: string) {
|
|
164
136
|
try {
|
|
165
137
|
return this.retrieveAliasFromCache(arg);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { CallAuthorizationRequest } from '@aztec/aztec.js/authorization';
|
|
2
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
5
|
import { type AbiDecoded, decodeFromAbi, getFunctionArtifact } from '@aztec/stdlib/abi';
|
|
4
6
|
import type { OffchainEffect } from '@aztec/stdlib/tx';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
2
|
+
|
|
3
|
+
import { CLIWallet } from './wallet.js';
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_TX_TIMEOUT_S = 180;
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Wrapper class for CLIWallet and AztecNode, avoids initialization issues due to closures when providing CLIWallet
|
|
9
|
+
* and AztecNode to injected commander.js commands
|
|
10
|
+
*/
|
|
11
|
+
export class CliWalletAndNodeWrapper {
|
|
12
|
+
private _wallet: CLIWallet | undefined;
|
|
13
|
+
private _node: AztecNode | undefined;
|
|
14
|
+
|
|
15
|
+
constructor() {}
|
|
16
|
+
|
|
17
|
+
get wallet() {
|
|
18
|
+
if (!this._wallet) {
|
|
19
|
+
throw new Error('Wallet not initialized while it should have been initialized in preSubcommand');
|
|
20
|
+
}
|
|
21
|
+
return this._wallet;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get node(): AztecNode {
|
|
25
|
+
if (!this._node) {
|
|
26
|
+
throw new Error('Node not initialized while it should have been initialized in preSubcommand');
|
|
27
|
+
}
|
|
28
|
+
return this._node;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setNodeAndWallet(node: AztecNode, wallet: CLIWallet) {
|
|
32
|
+
this._node = node;
|
|
33
|
+
this._wallet = wallet;
|
|
34
|
+
}
|
|
35
|
+
}
|