@aztec/cli-wallet 0.0.1-commit.d431d1c → 0.0.1-commit.dbf9cec
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/cmds/authorize_action.js +4 -2
- package/dest/cmds/check_tx.js +6 -2
- package/dest/cmds/create_account.d.ts +1 -1
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +24 -18
- package/dest/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +46 -23
- package/dest/cmds/deploy_account.d.ts +1 -1
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +24 -18
- package/dest/cmds/index.js +1 -1
- package/dest/cmds/send.d.ts +1 -1
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +28 -16
- package/dest/storage/wallet_db.d.ts +1 -1
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +46 -31
- package/dest/utils/wallet.d.ts +8 -3
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +32 -28
- package/package.json +14 -14
- package/src/cmds/authorize_action.ts +1 -1
- package/src/cmds/check_tx.ts +5 -2
- package/src/cmds/create_account.ts +23 -17
- package/src/cmds/deploy.ts +41 -22
- package/src/cmds/deploy_account.ts +23 -17
- package/src/cmds/index.ts +1 -1
- package/src/cmds/send.ts +22 -10
- package/src/storage/wallet_db.ts +49 -36
- package/src/utils/wallet.ts +53 -46
package/dest/utils/wallet.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ import type { AztecNode } from '@aztec/aztec.js/node';
|
|
|
4
4
|
import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
5
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
7
|
+
import type { AccessScopes, NotesFilter } from '@aztec/pxe/client/lazy';
|
|
7
8
|
import type { PXEConfig } from '@aztec/pxe/config';
|
|
8
9
|
import type { PXE } from '@aztec/pxe/server';
|
|
9
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
11
|
import { NoteDao } from '@aztec/stdlib/note';
|
|
11
|
-
import type { NotesFilter } from '@aztec/stdlib/note';
|
|
12
12
|
import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
14
|
-
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
14
|
+
import { BaseWallet, type FeeOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
15
15
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
16
16
|
import type { AccountType } from './constants.js';
|
|
17
17
|
export declare class CLIWallet extends BaseWallet {
|
|
@@ -28,8 +28,13 @@ export declare class CLIWallet extends BaseWallet {
|
|
|
28
28
|
createOrRetrieveAccount(address?: AztecAddress, secretKey?: Fr, type?: AccountType, salt?: Fr, publicKey?: string): Promise<AccountManager>;
|
|
29
29
|
private getFakeAccountDataFor;
|
|
30
30
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
33
|
+
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
34
|
+
*/
|
|
35
|
+
protected simulateViaEntrypoint(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions, scopes: AccessScopes, skipTxValidation?: boolean, skipFeeEnforcement?: boolean): Promise<TxSimulationResult>;
|
|
31
36
|
getContracts(): Promise<AztecAddress[]>;
|
|
32
37
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
33
38
|
getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
|
|
34
39
|
}
|
|
35
|
-
//# sourceM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AAO,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAuC7B;IAID,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAEtC;IAID,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEhD;IAID,mBAAmB,CAAC,EAAE,EAAE,EAAE,qEAEzB;CACF"}
|
package/dest/utils/wallet.js
CHANGED
|
@@ -48,7 +48,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
48
48
|
}
|
|
49
49
|
async proveCancellationTx(from, txNonce, increasedFee) {
|
|
50
50
|
const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
|
|
51
|
-
return await this.pxe.proveTx(cancellationTxRequest);
|
|
51
|
+
return await this.pxe.proveTx(cancellationTxRequest, this.scopesFrom(from));
|
|
52
52
|
}
|
|
53
53
|
async getAccountFromAddress(address) {
|
|
54
54
|
let account;
|
|
@@ -147,10 +147,22 @@ export class CLIWallet extends BaseWallet {
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
async simulateTx(executionPayload, opts) {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
const simulationResults = await super.simulateTx(executionPayload, opts);
|
|
151
|
+
if (opts.fee?.estimateGas) {
|
|
152
|
+
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
153
|
+
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
154
|
+
printGasEstimates(feeOptions, limits, this.userLog);
|
|
155
|
+
}
|
|
156
|
+
return simulationResults;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
160
|
+
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
161
|
+
*/ async simulateViaEntrypoint(executionPayload, from, feeOptions, scopes, skipTxValidation, skipFeeEnforcement) {
|
|
162
|
+
if (from.equals(AztecAddress.ZERO)) {
|
|
163
|
+
return super.simulateViaEntrypoint(executionPayload, from, feeOptions, scopes, skipTxValidation, skipFeeEnforcement);
|
|
164
|
+
}
|
|
152
165
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
153
|
-
const chainInfo = await this.getChainInfo();
|
|
154
166
|
const executionOptions = {
|
|
155
167
|
txNonce: Fr.random(),
|
|
156
168
|
cancellable: this.cancellableTransactions,
|
|
@@ -160,31 +172,23 @@ export class CLIWallet extends BaseWallet {
|
|
|
160
172
|
feeExecutionPayload,
|
|
161
173
|
executionPayload
|
|
162
174
|
]) : executionPayload;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
artifact
|
|
175
|
+
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
176
|
+
const chainInfo = await this.getChainInfo();
|
|
177
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
178
|
+
return this.pxe.simulateTx(txRequest, {
|
|
179
|
+
simulatePublic: true,
|
|
180
|
+
skipFeeEnforcement: true,
|
|
181
|
+
skipTxValidation: true,
|
|
182
|
+
overrides: {
|
|
183
|
+
contracts: {
|
|
184
|
+
[from.toString()]: {
|
|
185
|
+
instance,
|
|
186
|
+
artifact
|
|
187
|
+
}
|
|
177
188
|
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
if (opts.fee?.estimateGas) {
|
|
184
|
-
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
185
|
-
printGasEstimates(feeOptions, limits, this.userLog);
|
|
186
|
-
}
|
|
187
|
-
return simulationResults;
|
|
189
|
+
},
|
|
190
|
+
scopes
|
|
191
|
+
});
|
|
188
192
|
}
|
|
189
193
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
190
194
|
// this is just a CLI wallet.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.dbf9cec",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
71
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
72
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
73
|
-
"@aztec/cli": "0.0.1-commit.
|
|
74
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
75
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
76
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
77
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
78
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
79
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
80
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
81
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
82
|
-
"@aztec/wallet-sdk": "0.0.1-commit.
|
|
70
|
+
"@aztec/accounts": "0.0.1-commit.dbf9cec",
|
|
71
|
+
"@aztec/aztec.js": "0.0.1-commit.dbf9cec",
|
|
72
|
+
"@aztec/bb.js": "0.0.1-commit.dbf9cec",
|
|
73
|
+
"@aztec/cli": "0.0.1-commit.dbf9cec",
|
|
74
|
+
"@aztec/entrypoints": "0.0.1-commit.dbf9cec",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.dbf9cec",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.dbf9cec",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.dbf9cec",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.dbf9cec",
|
|
79
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.dbf9cec",
|
|
80
|
+
"@aztec/pxe": "0.0.1-commit.dbf9cec",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.dbf9cec",
|
|
82
|
+
"@aztec/wallet-sdk": "0.0.1-commit.dbf9cec",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
84
|
"inquirer": "^10.1.8",
|
|
85
85
|
"source-map-support": "^0.5.21",
|
|
@@ -39,7 +39,7 @@ export async function authorizeAction(
|
|
|
39
39
|
{ caller, action },
|
|
40
40
|
true,
|
|
41
41
|
);
|
|
42
|
-
const witness = await setAuthwitnessInteraction.send(
|
|
42
|
+
const witness = await setAuthwitnessInteraction.send({ wait: { timeout: DEFAULT_TX_TIMEOUT_S } });
|
|
43
43
|
|
|
44
44
|
log(`Authorized action ${functionName} on contract ${contractAddress} for caller ${caller}`);
|
|
45
45
|
|
package/src/cmds/check_tx.ts
CHANGED
|
@@ -32,7 +32,10 @@ async function inspectTx(wallet: CLIWallet, aztecNode: AztecNode, txHash: TxHash
|
|
|
32
32
|
const [receipt, effectsInBlock] = await Promise.all([aztecNode.getTxReceipt(txHash), aztecNode.getTxEffect(txHash)]);
|
|
33
33
|
// Base tx data
|
|
34
34
|
log(`Tx ${txHash.toString()}`);
|
|
35
|
-
log(` Status: ${receipt.status}
|
|
35
|
+
log(` Status: ${receipt.status}`);
|
|
36
|
+
if (receipt.executionResult) {
|
|
37
|
+
log(` Execution result: ${receipt.executionResult}`);
|
|
38
|
+
}
|
|
36
39
|
if (receipt.error) {
|
|
37
40
|
log(` Error: ${receipt.error}`);
|
|
38
41
|
}
|
|
@@ -85,7 +88,7 @@ async function inspectTx(wallet: CLIWallet, aztecNode: AztecNode, txHash: TxHash
|
|
|
85
88
|
for (const nullifier of effects.nullifiers) {
|
|
86
89
|
const deployed = deployNullifiers[nullifier.toString()];
|
|
87
90
|
const note = deployed
|
|
88
|
-
? (await wallet.getNotes({ siloedNullifier: nullifier, contractAddress: deployed }))[0]
|
|
91
|
+
? (await wallet.getNotes({ siloedNullifier: nullifier, contractAddress: deployed, scopes: 'ALL_SCOPES' }))[0]
|
|
89
92
|
: undefined;
|
|
90
93
|
const initialized = initNullifiers[nullifier.toString()];
|
|
91
94
|
const registered = classNullifiers[nullifier.toString()];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
4
|
import type { DeployAccountOptions } from '@aztec/aztec.js/wallet';
|
|
4
5
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
5
6
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
7
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
8
|
+
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
7
9
|
|
|
8
10
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
9
11
|
import type { AccountType } from '../utils/constants.js';
|
|
@@ -64,8 +66,8 @@ export async function createAccount(
|
|
|
64
66
|
log(`Init hash: ${account.getInstance().initializationHash.toString()}`);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
let
|
|
68
|
-
let txReceipt;
|
|
69
|
+
let txHash: TxHash | undefined;
|
|
70
|
+
let txReceipt: TxReceipt | undefined;
|
|
69
71
|
if (!registerOnly) {
|
|
70
72
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
71
73
|
|
|
@@ -100,7 +102,14 @@ export async function createAccount(
|
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
} else {
|
|
103
|
-
|
|
105
|
+
if (verbose) {
|
|
106
|
+
printProfileResult(stats, log);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!json) {
|
|
110
|
+
log(`\nWaiting for account contract deployment...`);
|
|
111
|
+
}
|
|
112
|
+
const result = await deployMethod.send({
|
|
104
113
|
...deployAccountOpts,
|
|
105
114
|
fee: deployAccountOpts.fee
|
|
106
115
|
? {
|
|
@@ -108,32 +117,29 @@ export async function createAccount(
|
|
|
108
117
|
gasSettings: estimatedGas,
|
|
109
118
|
}
|
|
110
119
|
: undefined,
|
|
120
|
+
wait: wait ? { timeout: DEFAULT_TX_TIMEOUT_S, returnReceipt: true } : NO_WAIT,
|
|
111
121
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const txHash = await tx.getTxHash();
|
|
117
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
118
|
-
out.txHash = txHash;
|
|
119
|
-
if (wait) {
|
|
120
|
-
if (!json) {
|
|
121
|
-
log(`\nWaiting for account contract deployment...`);
|
|
122
|
-
}
|
|
123
|
-
txReceipt = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
122
|
+
const isReceipt = (data: TxReceipt | TxHash): data is TxReceipt => 'txHash' in data;
|
|
123
|
+
if (isReceipt(result)) {
|
|
124
|
+
txReceipt = result;
|
|
125
|
+
txHash = result.txHash;
|
|
124
126
|
out.txReceipt = {
|
|
125
127
|
status: txReceipt.status,
|
|
126
128
|
transactionFee: txReceipt.transactionFee,
|
|
127
129
|
};
|
|
130
|
+
} else {
|
|
131
|
+
txHash = result;
|
|
128
132
|
}
|
|
133
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
134
|
+
out.txHash = txHash;
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
if (json) {
|
|
133
139
|
log(prettyPrintJSON(out));
|
|
134
140
|
} else {
|
|
135
|
-
if (
|
|
136
|
-
log(`Deploy tx hash: ${
|
|
141
|
+
if (txHash) {
|
|
142
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
137
143
|
}
|
|
138
144
|
if (txReceipt) {
|
|
139
145
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
package/src/cmds/deploy.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import type { DeployOptions } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { ContractDeployer } from '@aztec/aztec.js/deployment';
|
|
4
5
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
6
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
@@ -89,37 +90,55 @@ export async function deploy(
|
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
} else {
|
|
92
|
-
const tx = deploy.send(deployOpts);
|
|
93
93
|
if (verbose) {
|
|
94
94
|
printProfileResult(stats, log);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const txHash = await tx.getTxHash();
|
|
98
|
-
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
99
|
-
out.hash = txHash;
|
|
100
97
|
const { address, partialAddress } = deploy;
|
|
101
98
|
const instance = await deploy.getInstance();
|
|
102
|
-
|
|
103
|
-
log(`Contract deployed at ${address?.toString()}`);
|
|
104
|
-
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
105
|
-
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
106
|
-
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
107
|
-
log(`Deployment salt: ${salt.toString()}`);
|
|
108
|
-
log(`Deployer: ${instance.deployer.toString()}`);
|
|
109
|
-
} else {
|
|
110
|
-
out.contract = {
|
|
111
|
-
address: address?.toString(),
|
|
112
|
-
partialAddress: (await partialAddress)?.toString(),
|
|
113
|
-
initializationHash: instance.initializationHash.toString(),
|
|
114
|
-
salt: salt.toString(),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
99
|
+
|
|
117
100
|
if (wait) {
|
|
118
|
-
const
|
|
101
|
+
const receipt = await deploy.send({ ...deployOpts, wait: { timeout, returnReceipt: true } });
|
|
102
|
+
const txHash = receipt.txHash;
|
|
103
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
104
|
+
out.hash = txHash;
|
|
105
|
+
|
|
106
|
+
if (!json) {
|
|
107
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
108
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
109
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
110
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
111
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
112
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
113
|
+
log(`Transaction fee: ${receipt.transactionFee?.toString()}`);
|
|
114
|
+
} else {
|
|
115
|
+
out.contract = {
|
|
116
|
+
address: address?.toString(),
|
|
117
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
118
|
+
initializationHash: instance.initializationHash.toString(),
|
|
119
|
+
salt: salt.toString(),
|
|
120
|
+
transactionFee: receipt.transactionFee?.toString(),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
const txHash = await deploy.send({ ...deployOpts, wait: NO_WAIT });
|
|
125
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
126
|
+
out.hash = txHash;
|
|
127
|
+
|
|
119
128
|
if (!json) {
|
|
120
|
-
log(`
|
|
129
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
130
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
131
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
132
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
133
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
134
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
121
135
|
} else {
|
|
122
|
-
out.contract
|
|
136
|
+
out.contract = {
|
|
137
|
+
address: address?.toString(),
|
|
138
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
139
|
+
initializationHash: instance.initializationHash.toString(),
|
|
140
|
+
salt: salt.toString(),
|
|
141
|
+
};
|
|
123
142
|
}
|
|
124
143
|
}
|
|
125
144
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
4
|
import type { DeployAccountOptions } from '@aztec/aztec.js/wallet';
|
|
4
5
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
5
6
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
7
|
+
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
6
8
|
|
|
7
9
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
8
10
|
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
@@ -45,8 +47,8 @@ export async function deployAccount(
|
|
|
45
47
|
log(`Init hash: ${initializationHash.toString()}`);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
let
|
|
49
|
-
let txReceipt;
|
|
50
|
+
let txHash: TxHash | undefined;
|
|
51
|
+
let txReceipt: TxReceipt | undefined;
|
|
50
52
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
51
53
|
|
|
52
54
|
const delegatedDeployment = deployer && !account.address.equals(deployer);
|
|
@@ -80,7 +82,14 @@ export async function deployAccount(
|
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
} else {
|
|
83
|
-
|
|
85
|
+
if (verbose) {
|
|
86
|
+
printProfileResult(stats, log);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!json) {
|
|
90
|
+
log(`\nWaiting for account contract deployment...`);
|
|
91
|
+
}
|
|
92
|
+
const result = await deployMethod.send({
|
|
84
93
|
...deployAccountOpts,
|
|
85
94
|
fee: deployAccountOpts.fee
|
|
86
95
|
? {
|
|
@@ -88,31 +97,28 @@ export async function deployAccount(
|
|
|
88
97
|
gasSettings: estimatedGas,
|
|
89
98
|
}
|
|
90
99
|
: undefined,
|
|
100
|
+
wait: wait ? { timeout: DEFAULT_TX_TIMEOUT_S, returnReceipt: true } : NO_WAIT,
|
|
91
101
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const txHash = await tx.getTxHash();
|
|
97
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
98
|
-
out.txHash = txHash;
|
|
99
|
-
if (wait) {
|
|
100
|
-
if (!json) {
|
|
101
|
-
log(`\nWaiting for account contract deployment...`);
|
|
102
|
-
}
|
|
103
|
-
txReceipt = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
102
|
+
const isReceipt = (data: TxReceipt | TxHash): data is TxReceipt => 'txHash' in data;
|
|
103
|
+
if (isReceipt(result)) {
|
|
104
|
+
txReceipt = result;
|
|
105
|
+
txHash = result.txHash;
|
|
104
106
|
out.txReceipt = {
|
|
105
107
|
status: txReceipt.status,
|
|
106
108
|
transactionFee: txReceipt.transactionFee,
|
|
107
109
|
};
|
|
110
|
+
} else {
|
|
111
|
+
txHash = result;
|
|
108
112
|
}
|
|
113
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
114
|
+
out.txHash = txHash;
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
if (json) {
|
|
112
118
|
log(prettyPrintJSON(out));
|
|
113
119
|
} else {
|
|
114
|
-
if (
|
|
115
|
-
log(`Deploy tx hash: ${
|
|
120
|
+
if (txHash) {
|
|
121
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
116
122
|
}
|
|
117
123
|
if (txReceipt) {
|
|
118
124
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
package/src/cmds/index.ts
CHANGED
|
@@ -63,7 +63,7 @@ export function injectCommands(
|
|
|
63
63
|
const createAccountCommand = program
|
|
64
64
|
.command('create-account')
|
|
65
65
|
.description(
|
|
66
|
-
'Creates an aztec account that can be used for sending transactions. Registers the account on the PXE and deploys an account contract. Uses a Schnorr
|
|
66
|
+
'Creates an aztec account that can be used for sending transactions. Registers the account on the PXE and deploys an account contract. Uses a Schnorr account which uses an immutable key for authentication.',
|
|
67
67
|
)
|
|
68
68
|
.summary('Creates an aztec account that can be used for sending transactions.')
|
|
69
69
|
.addOption(createAccountOption('Alias or address of the account performing the deployment', !db, db))
|
package/src/cmds/send.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
3
|
-
import { Contract, type SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { Contract, NO_WAIT, type SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
4
4
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
5
|
import { prepTx } from '@aztec/cli/utils';
|
|
6
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
@@ -46,31 +46,43 @@ export async function send(
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const tx = call.send({ ...sendOptions, fee: { ...sendOptions.fee, gasSettings: estimatedGas } });
|
|
50
49
|
if (verbose) {
|
|
51
50
|
printProfileResult(stats!, log);
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
const txHash = await tx.getTxHash();
|
|
55
|
-
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
56
53
|
if (wait) {
|
|
57
54
|
try {
|
|
58
|
-
await
|
|
55
|
+
const receipt = await call.send({
|
|
56
|
+
...sendOptions,
|
|
57
|
+
fee: { ...sendOptions.fee, gasSettings: estimatedGas },
|
|
58
|
+
wait: { timeout: DEFAULT_TX_TIMEOUT_S },
|
|
59
|
+
});
|
|
59
60
|
|
|
61
|
+
const txHash = receipt.txHash;
|
|
62
|
+
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
60
63
|
log('Transaction has been mined');
|
|
61
|
-
|
|
62
|
-
const receipt = await tx.getReceipt();
|
|
63
64
|
log(` Tx fee: ${receipt.transactionFee}`);
|
|
64
65
|
log(` Status: ${receipt.status}`);
|
|
65
66
|
log(` Block number: ${receipt.blockNumber}`);
|
|
66
67
|
log(` Block hash: ${receipt.blockHash?.toString()}`);
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
txHash,
|
|
71
|
+
};
|
|
67
72
|
} catch (err: any) {
|
|
68
73
|
log(`Transaction failed\n ${err.message}`);
|
|
74
|
+
throw err;
|
|
69
75
|
}
|
|
70
76
|
} else {
|
|
77
|
+
const txHash = await call.send({
|
|
78
|
+
...sendOptions,
|
|
79
|
+
fee: { ...sendOptions.fee, gasSettings: estimatedGas },
|
|
80
|
+
wait: NO_WAIT,
|
|
81
|
+
});
|
|
82
|
+
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
71
83
|
log('Transaction pending. Check status with check-tx');
|
|
84
|
+
return {
|
|
85
|
+
txHash,
|
|
86
|
+
};
|
|
72
87
|
}
|
|
73
|
-
return {
|
|
74
|
-
txHash,
|
|
75
|
-
};
|
|
76
88
|
}
|