@aztec/cli-wallet 0.0.1-commit.3469e52 → 0.0.1-commit.3895657bc
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.d.ts +2 -2
- package/dest/cmds/authorize_action.d.ts.map +1 -1
- 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 +31 -17
- package/dest/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +50 -24
- 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 +31 -17
- 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 +32 -17
- 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/options/fees.d.ts +1 -1
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +2 -0
- 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 +29 -18
- package/src/cmds/deploy.ts +45 -23
- package/src/cmds/deploy_account.ts +29 -18
- package/src/cmds/index.ts +1 -1
- package/src/cmds/send.ts +26 -11
- package/src/cmds/simulate.ts +1 -1
- package/src/storage/wallet_db.ts +49 -36
- package/src/utils/options/fees.ts +6 -0
- package/src/utils/wallet.ts +53 -46
|
@@ -9,6 +9,7 @@ export const Aliases = [
|
|
|
9
9
|
'authwits'
|
|
10
10
|
];
|
|
11
11
|
export class WalletDB {
|
|
12
|
+
#store;
|
|
12
13
|
#accounts;
|
|
13
14
|
#aliases;
|
|
14
15
|
#bridgedFeeJuice;
|
|
@@ -21,6 +22,7 @@ export class WalletDB {
|
|
|
21
22
|
return WalletDB.instance;
|
|
22
23
|
}
|
|
23
24
|
async init(store) {
|
|
25
|
+
this.#store = store;
|
|
24
26
|
this.#accounts = store.openMap('accounts');
|
|
25
27
|
this.#aliases = store.openMap('aliases');
|
|
26
28
|
this.#bridgedFeeJuice = store.openMap('bridgedFeeJuice');
|
|
@@ -33,13 +35,15 @@ export class WalletDB {
|
|
|
33
35
|
]));
|
|
34
36
|
}
|
|
35
37
|
async pushBridgedFeeJuice(recipient, secret, amount, leafIndex, log) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
stackPointer
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
await this.#store.transactionAsync(async ()=>{
|
|
39
|
+
let stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
40
|
+
stackPointer++;
|
|
41
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:${stackPointer}`, Buffer.from(`${amount.toString()}:${secret.toString()}:${leafIndex.toString()}`));
|
|
42
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:stackPointer`, Buffer.from([
|
|
43
|
+
stackPointer
|
|
44
|
+
]));
|
|
45
|
+
log(`Pushed ${amount} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
|
|
46
|
+
});
|
|
43
47
|
}
|
|
44
48
|
async popBridgedFeeJuice(recipient, log) {
|
|
45
49
|
let stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
@@ -59,17 +63,22 @@ export class WalletDB {
|
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
async storeAccount(address, { type, secretKey, salt, alias, publicKey }, log) {
|
|
62
|
-
|
|
63
|
-
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
64
|
-
}
|
|
65
|
-
await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
|
|
66
|
-
await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
|
|
67
|
-
await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
|
|
66
|
+
let publicSigningKey;
|
|
68
67
|
if (type === 'ecdsasecp256r1ssh' && publicKey) {
|
|
69
|
-
|
|
70
|
-
await this.storeAccountMetadata(address, 'publicSigningKey', publicSigningKey);
|
|
68
|
+
publicSigningKey = extractECDSAPublicKeyFromBase64String(publicKey);
|
|
71
69
|
}
|
|
72
|
-
await this.#
|
|
70
|
+
await this.#store.transactionAsync(async ()=>{
|
|
71
|
+
if (alias) {
|
|
72
|
+
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
73
|
+
}
|
|
74
|
+
await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
|
|
75
|
+
await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
|
|
76
|
+
await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
|
|
77
|
+
if (publicSigningKey) {
|
|
78
|
+
await this.#accounts.set(`${address.toString()}:publicSigningKey`, publicSigningKey);
|
|
79
|
+
}
|
|
80
|
+
await this.#aliases.set('accounts:last', Buffer.from(address.toString()));
|
|
81
|
+
});
|
|
73
82
|
log(`Account stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
74
83
|
await this.refreshAliasCache();
|
|
75
84
|
}
|
|
@@ -79,29 +88,35 @@ export class WalletDB {
|
|
|
79
88
|
await this.refreshAliasCache();
|
|
80
89
|
}
|
|
81
90
|
async storeContract(address, artifactPath, log, alias) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
await this.#store.transactionAsync(async ()=>{
|
|
92
|
+
if (alias) {
|
|
93
|
+
await this.#aliases.set(`contracts:${alias}`, Buffer.from(address.toString()));
|
|
94
|
+
await this.#aliases.set(`artifacts:${alias}`, Buffer.from(artifactPath));
|
|
95
|
+
}
|
|
96
|
+
await this.#aliases.set(`contracts:last`, Buffer.from(address.toString()));
|
|
97
|
+
await this.#aliases.set(`artifacts:last`, Buffer.from(artifactPath));
|
|
98
|
+
await this.#aliases.set(`artifacts:${address.toString()}`, Buffer.from(artifactPath));
|
|
99
|
+
});
|
|
89
100
|
log(`Contract stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
90
101
|
await this.refreshAliasCache();
|
|
91
102
|
}
|
|
92
103
|
async storeAuthwitness(authWit, log, alias) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
await this.#store.transactionAsync(async ()=>{
|
|
105
|
+
if (alias) {
|
|
106
|
+
await this.#aliases.set(`authwits:${alias}`, Buffer.from(authWit.toString()));
|
|
107
|
+
}
|
|
108
|
+
await this.#aliases.set(`authwits:last`, Buffer.from(authWit.toString()));
|
|
109
|
+
});
|
|
97
110
|
log(`Authorization witness stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
98
111
|
await this.refreshAliasCache();
|
|
99
112
|
}
|
|
100
113
|
async storeTx({ txHash }, log, alias) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
114
|
+
await this.#store.transactionAsync(async ()=>{
|
|
115
|
+
if (alias) {
|
|
116
|
+
await this.#aliases.set(`transactions:${alias}`, Buffer.from(txHash.toString()));
|
|
117
|
+
}
|
|
118
|
+
await this.#aliases.set(`transactions:last`, Buffer.from(txHash.toString()));
|
|
119
|
+
});
|
|
105
120
|
log(`Transaction hash stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
106
121
|
await this.refreshAliasCache();
|
|
107
122
|
}
|
|
@@ -32,4 +32,4 @@ export declare class CLIFeeArgs {
|
|
|
32
32
|
static getOptions(): Option[];
|
|
33
33
|
}
|
|
34
34
|
export declare function printGasEstimates(feeOpts: FeeOptions, gasEstimates: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>, log: LogFn): void;
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3V0aWxzL29wdGlvbnMvZmVlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRXJELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3hELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEVBQU8sT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRWhFLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFFbkMsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFJM0QsTUFBTSxNQUFNLGFBQWEsR0FBRztJQUMxQixlQUFlLEVBQUUsT0FBTyxDQUFDO0lBQ3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EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQrG;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,UAAU,CAMvE;IAED,MAAM,CAAC,UAAU,aAEhB;CACF;AAID,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB,CAAC,EAClE,GAAG,EAAE,KAAK,QAIX"}
|
|
@@ -115,6 +115,7 @@ export function parsePaymentMethod(payment, log, db) {
|
|
|
115
115
|
{
|
|
116
116
|
const fpc = getFpc();
|
|
117
117
|
const asset = getAsset();
|
|
118
|
+
log(`WARNING: fpc-public is deprecated and will not work on mainnet alpha. Use fee_juice or fpc-sponsored instead.`);
|
|
118
119
|
log(`Using public fee payment with asset ${asset} via paymaster ${fpc}`);
|
|
119
120
|
const { PublicFeePaymentMethod } = await import('@aztec/aztec.js/fee');
|
|
120
121
|
return new PublicFeePaymentMethod(fpc, from, wallet, gasSettings);
|
|
@@ -123,6 +124,7 @@ export function parsePaymentMethod(payment, log, db) {
|
|
|
123
124
|
{
|
|
124
125
|
const fpc = getFpc();
|
|
125
126
|
const asset = getAsset();
|
|
127
|
+
log(`WARNING: fpc-private is deprecated and will not work on mainnet alpha. Use fee_juice or fpc-sponsored instead.`);
|
|
126
128
|
log(`Using private fee payment with asset ${asset} via paymaster ${fpc}`);
|
|
127
129
|
const { PrivateFeePaymentMethod } = await import('@aztec/aztec.js/fee');
|
|
128
130
|
return new PrivateFeePaymentMethod(fpc, from, wallet, gasSettings);
|
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
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBMkMsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRyxPQUFPLEVBQ0wsS0FBSyxxQkFBcUIsRUFHM0IsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsY0FBYyxFQUFFLEtBQUssT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFNUYsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxXQUFXLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNuRCxPQUFPLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUU3QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFM0QsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQzdDLE9BQU8sS0FBSyxFQUFFLGVBQ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AE,UAAU,EACtB,MAAM,EAAE,YAAY,EACpB,gBAAgB,CAAC,EAAE,OAAO,EAC1B,kBAAkB,CAAC,EAAE,OAAO,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.3895657bc",
|
|
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.3895657bc",
|
|
71
|
+
"@aztec/aztec.js": "0.0.1-commit.3895657bc",
|
|
72
|
+
"@aztec/bb.js": "0.0.1-commit.3895657bc",
|
|
73
|
+
"@aztec/cli": "0.0.1-commit.3895657bc",
|
|
74
|
+
"@aztec/entrypoints": "0.0.1-commit.3895657bc",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.3895657bc",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.3895657bc",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.3895657bc",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.3895657bc",
|
|
79
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.3895657bc",
|
|
80
|
+
"@aztec/pxe": "0.0.1-commit.3895657bc",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.3895657bc",
|
|
82
|
+
"@aztec/wallet-sdk": "0.0.1-commit.3895657bc",
|
|
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
|
|
|
@@ -81,10 +83,13 @@ export async function createAccount(
|
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
const deployMethod = await account.getDeployMethod();
|
|
84
|
-
const
|
|
86
|
+
const sim = await deployMethod.simulate({
|
|
85
87
|
...deployAccountOpts,
|
|
86
88
|
fee: { ...deployAccountOpts.fee, estimateGas: true },
|
|
87
89
|
});
|
|
90
|
+
// estimateGas: true guarantees these fields are present
|
|
91
|
+
const estimatedGas = sim.estimatedGas!;
|
|
92
|
+
const stats = sim.stats!;
|
|
88
93
|
|
|
89
94
|
if (feeOpts.estimateOnly) {
|
|
90
95
|
if (json) {
|
|
@@ -100,7 +105,14 @@ export async function createAccount(
|
|
|
100
105
|
};
|
|
101
106
|
}
|
|
102
107
|
} else {
|
|
103
|
-
|
|
108
|
+
if (verbose) {
|
|
109
|
+
printProfileResult(stats, log);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!json) {
|
|
113
|
+
log(`\nWaiting for account contract deployment...`);
|
|
114
|
+
}
|
|
115
|
+
const sendOpts = {
|
|
104
116
|
...deployAccountOpts,
|
|
105
117
|
fee: deployAccountOpts.fee
|
|
106
118
|
? {
|
|
@@ -108,32 +120,31 @@ export async function createAccount(
|
|
|
108
120
|
gasSettings: estimatedGas,
|
|
109
121
|
}
|
|
110
122
|
: undefined,
|
|
111
|
-
}
|
|
112
|
-
if (verbose) {
|
|
113
|
-
printProfileResult(stats, log);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const txHash = await tx.getTxHash();
|
|
117
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
118
|
-
out.txHash = txHash;
|
|
123
|
+
};
|
|
119
124
|
if (wait) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
const { receipt } = await deployMethod.send({
|
|
126
|
+
...sendOpts,
|
|
127
|
+
wait: { timeout: DEFAULT_TX_TIMEOUT_S, returnReceipt: true },
|
|
128
|
+
});
|
|
129
|
+
txReceipt = receipt;
|
|
130
|
+
txHash = receipt.txHash;
|
|
124
131
|
out.txReceipt = {
|
|
125
132
|
status: txReceipt.status,
|
|
126
133
|
transactionFee: txReceipt.transactionFee,
|
|
127
134
|
};
|
|
135
|
+
} else {
|
|
136
|
+
({ txHash } = await deployMethod.send({ ...sendOpts, wait: NO_WAIT }));
|
|
128
137
|
}
|
|
138
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
139
|
+
out.txHash = txHash;
|
|
129
140
|
}
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
if (json) {
|
|
133
144
|
log(prettyPrintJSON(out));
|
|
134
145
|
} else {
|
|
135
|
-
if (
|
|
136
|
-
log(`Deploy tx hash: ${
|
|
146
|
+
if (txHash) {
|
|
147
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
137
148
|
}
|
|
138
149
|
if (txReceipt) {
|
|
139
150
|
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';
|
|
@@ -70,10 +71,13 @@ export async function deploy(
|
|
|
70
71
|
skipInstancePublication,
|
|
71
72
|
};
|
|
72
73
|
|
|
73
|
-
const
|
|
74
|
+
const sim = await deploy.simulate({
|
|
74
75
|
...deployOpts,
|
|
75
76
|
fee: { ...deployOpts.fee, estimateGas: true },
|
|
76
77
|
});
|
|
78
|
+
// estimateGas: true guarantees these fields are present
|
|
79
|
+
const estimatedGas = sim.estimatedGas!;
|
|
80
|
+
const stats = sim.stats!;
|
|
77
81
|
|
|
78
82
|
if (feeOpts.estimateOnly) {
|
|
79
83
|
if (json) {
|
|
@@ -89,37 +93,55 @@ export async function deploy(
|
|
|
89
93
|
};
|
|
90
94
|
}
|
|
91
95
|
} else {
|
|
92
|
-
const tx = deploy.send(deployOpts);
|
|
93
96
|
if (verbose) {
|
|
94
97
|
printProfileResult(stats, log);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
const txHash = await tx.getTxHash();
|
|
98
|
-
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
99
|
-
out.hash = txHash;
|
|
100
100
|
const { address, partialAddress } = deploy;
|
|
101
101
|
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
|
-
}
|
|
102
|
+
|
|
117
103
|
if (wait) {
|
|
118
|
-
const
|
|
104
|
+
const { receipt } = await deploy.send({ ...deployOpts, wait: { timeout, returnReceipt: true } });
|
|
105
|
+
const txHash = receipt.txHash;
|
|
106
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
107
|
+
out.hash = txHash;
|
|
108
|
+
|
|
109
|
+
if (!json) {
|
|
110
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
111
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
112
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
113
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
114
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
115
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
116
|
+
log(`Transaction fee: ${receipt.transactionFee?.toString()}`);
|
|
117
|
+
} else {
|
|
118
|
+
out.contract = {
|
|
119
|
+
address: address?.toString(),
|
|
120
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
121
|
+
initializationHash: instance.initializationHash.toString(),
|
|
122
|
+
salt: salt.toString(),
|
|
123
|
+
transactionFee: receipt.transactionFee?.toString(),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
const { txHash } = await deploy.send({ ...deployOpts, wait: NO_WAIT });
|
|
128
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
129
|
+
out.hash = txHash;
|
|
130
|
+
|
|
119
131
|
if (!json) {
|
|
120
|
-
log(`
|
|
132
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
133
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
134
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
135
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
136
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
137
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
121
138
|
} else {
|
|
122
|
-
out.contract
|
|
139
|
+
out.contract = {
|
|
140
|
+
address: address?.toString(),
|
|
141
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
142
|
+
initializationHash: instance.initializationHash.toString(),
|
|
143
|
+
salt: salt.toString(),
|
|
144
|
+
};
|
|
123
145
|
}
|
|
124
146
|
}
|
|
125
147
|
}
|