@aztec/cli-wallet 0.0.1-commit.96bb3f7 → 0.0.1-commit.9d2bcf6d
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 +8 -5
- 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/create_authwit.d.ts +2 -2
- package/dest/cmds/create_authwit.d.ts.map +1 -1
- 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/send.d.ts +2 -2
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +28 -16
- package/dest/cmds/simulate.d.ts +1 -1
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +3 -3
- 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/options.d.ts +2 -2
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/profiling.d.ts +1 -1
- package/dest/utils/profiling.d.ts.map +1 -1
- package/dest/utils/profiling.js +9 -1
- package/dest/utils/wallet.d.ts +2 -1
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +25 -9
- package/package.json +15 -15
- package/src/cmds/authorize_action.ts +1 -1
- package/src/cmds/check_tx.ts +7 -8
- 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/send.ts +22 -10
- package/src/cmds/simulate.ts +3 -6
- package/src/storage/wallet_db.ts +49 -36
- package/src/utils/profiling.ts +15 -1
- package/src/utils/wallet.ts +27 -6
|
@@ -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
|
}
|
|
@@ -8,7 +8,7 @@ export declare function integerArgParser(value: string, argName: string, min?: n
|
|
|
8
8
|
export declare function aliasedTxHashParser(txHash: string, db?: WalletDB): TxHash;
|
|
9
9
|
export declare function aliasedAuthWitParser(witnesses: string, db?: WalletDB): AuthWitness[];
|
|
10
10
|
export declare function aliasedAddressParser(defaultPrefix: AliasType, address: string, db?: WalletDB): AztecAddress;
|
|
11
|
-
export declare function aliasedSecretKeyParser(sk: string, db?: WalletDB): import("
|
|
11
|
+
export declare function aliasedSecretKeyParser(sk: string, db?: WalletDB): import("@aztec/foundation/schemas").Fr;
|
|
12
12
|
export declare function createAliasOption(description: string, hide: boolean): Option;
|
|
13
13
|
export declare function createAccountOption(description: string, hide: boolean, db?: WalletDB): Option;
|
|
14
14
|
export declare function createAuthwitnessOption(description: string, hide: boolean, db?: WalletDB): Option;
|
|
@@ -21,4 +21,4 @@ export declare function artifactPathParser(filePath: string, db?: WalletDB): Pro
|
|
|
21
21
|
export declare function artifactPathFromPromiseOrAlias(artifactPathPromise: Promise<string>, contractAddress: AztecAddress, db?: WalletDB): Promise<string>;
|
|
22
22
|
export declare function createArtifactOption(db?: WalletDB): Option;
|
|
23
23
|
export declare function cleanupAuthWitnesses(authWitnesses: AuthWitness[] | undefined): AuthWitness[];
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3V0aWxzL29wdGlvbnMvb3B0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sb0JBQ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S,GAAG,WAAW,EAAE,CAE5F"}
|
|
@@ -2,4 +2,4 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
2
2
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
3
3
|
import type { ProvingStats, SimulationStats } from '@aztec/stdlib/tx';
|
|
4
4
|
export declare function printProfileResult(stats: ProvingStats | SimulationStats, log: LogFn, printOracles?: boolean, executionSteps?: PrivateExecutionStep[]): void;
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsaW5nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvcHJvZmlsaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFrQixlQUFlLEVBQXFCLE1BQU0sa0JBQWtCLENBQUM7QUFVekcsd0JBQWdCLGtCQUFrQixDQUNoQyxLQUFLLEVBQUUsWUFBWSxHQUFHLGVBQWUsRUFDckMsR0FBRyxFQUFFLEtBQUssRUFDVixZQUFZLEdBQUUsT0FBZSxFQUM3QixjQUFjLENBQUMsRUFBRSxvQkFBb0IsRUFBRSxRQTJKeEMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,YAAY,GAAE,OAAe,EAC7B,cAAc,CAAC,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,YAAY,GAAE,OAAe,EAC7B,cAAc,CAAC,EAAE,oBAAoB,EAAE,QA2JxC"}
|
package/dest/utils/profiling.js
CHANGED
|
@@ -35,7 +35,7 @@ export function printProfileResult(stats, log, printOracles = false, executionSt
|
|
|
35
35
|
}
|
|
36
36
|
if (stats.nodeRPCCalls) {
|
|
37
37
|
log(format('\nRPC calls:\n'));
|
|
38
|
-
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)){
|
|
38
|
+
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls.perMethod)){
|
|
39
39
|
const calls = times.length;
|
|
40
40
|
const total = times.reduce((acc, time)=>acc + time, 0);
|
|
41
41
|
const avg = total / calls;
|
|
@@ -43,6 +43,14 @@ export function printProfileResult(stats, log, printOracles = false, executionSt
|
|
|
43
43
|
const max = Math.max(...times);
|
|
44
44
|
log(format(method.padEnd(ORACLE_NAME_PADDING), `${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH)));
|
|
45
45
|
}
|
|
46
|
+
const { roundTrips } = stats.nodeRPCCalls;
|
|
47
|
+
log(format('\nRound trips (actual blocking waits):\n'));
|
|
48
|
+
log(format('Round trips:'.padEnd(25), `${roundTrips.roundTrips}`.padStart(COLUMN_MAX_WIDTH)));
|
|
49
|
+
log(format('Total blocking time:'.padEnd(25), `${roundTrips.totalBlockingTime.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
50
|
+
if (roundTrips.roundTrips > 0) {
|
|
51
|
+
const avgRoundTrip = roundTrips.totalBlockingTime / roundTrips.roundTrips;
|
|
52
|
+
log(format('Avg round trip:'.padEnd(25), `${avgRoundTrip.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
|
|
48
56
|
log(format('Private simulation time:'.padEnd(25), `${timings.perFunction.reduce((acc, { time })=>acc + time, 0).toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
package/dest/utils/wallet.d.ts
CHANGED
|
@@ -30,5 +30,6 @@ export declare class CLIWallet extends BaseWallet {
|
|
|
30
30
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
31
31
|
getContracts(): Promise<AztecAddress[]>;
|
|
32
32
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
33
|
+
getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
|
|
33
34
|
}
|
|
34
|
-
//# sourceMappingURL=data:application/json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E,EAAE,EACX,YAAY,EAAE,qBAAqB,GAClC,OAAO,CAAC,eAAe,CAAC,CAG1B;IAEc,qBAAqB,CAAC,OAAO,EAAE,YAAY,oBAezD;YAEa,aAAa;IAWrB,uBAAuB,CAC3B,OAAO,CAAC,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,EAAE,EACd,IAAI,GAAE,WAAuB,EAC7B,IAAI,CAAC,EAAE,EAAE,EACT,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC,CAmDzB;YAQa,qBAAqB;IAwBpB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsDhH;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
|
@@ -38,12 +38,13 @@ export class CLIWallet extends BaseWallet {
|
|
|
38
38
|
const feeOptions = await this.completeFeeOptions(from, executionPayload.feePayer, increasedFee.gasSettings);
|
|
39
39
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
40
40
|
const fromAccount = await this.getAccountFromAddress(from);
|
|
41
|
+
const chainInfo = await this.getChainInfo();
|
|
41
42
|
const executionOptions = {
|
|
42
43
|
txNonce,
|
|
43
44
|
cancellable: this.cancellableTransactions,
|
|
44
45
|
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
|
|
45
46
|
};
|
|
46
|
-
return await fromAccount.createTxExecutionRequest(feeExecutionPayload ?? executionPayload, feeOptions.gasSettings, executionOptions);
|
|
47
|
+
return await fromAccount.createTxExecutionRequest(feeExecutionPayload ?? executionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
47
48
|
}
|
|
48
49
|
async proveCancellationTx(from, txNonce, increasedFee) {
|
|
49
50
|
const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
|
|
@@ -52,8 +53,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
52
53
|
async getAccountFromAddress(address) {
|
|
53
54
|
let account;
|
|
54
55
|
if (address.equals(AztecAddress.ZERO)) {
|
|
55
|
-
|
|
56
|
-
account = new SignerlessAccount(chainInfo);
|
|
56
|
+
account = new SignerlessAccount();
|
|
57
57
|
} else if (this.accountCache.has(address.toString())) {
|
|
58
58
|
return this.accountCache.get(address.toString());
|
|
59
59
|
} else {
|
|
@@ -118,15 +118,25 @@ export class CLIWallet extends BaseWallet {
|
|
|
118
118
|
}
|
|
119
119
|
return account;
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
123
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
124
|
+
* @param address - The address of the account to impersonate
|
|
125
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
126
|
+
*/ async getFakeAccountDataFor(address) {
|
|
123
127
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
128
|
+
// Account contracts can only be overridden if they have an associated address
|
|
129
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
130
|
+
// since it has no authorization mechanism.
|
|
131
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
132
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
133
|
+
}
|
|
124
134
|
const originalAddress = originalAccount.getCompleteAddress();
|
|
125
|
-
const
|
|
135
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
126
136
|
if (!contractInstance) {
|
|
127
137
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
128
138
|
}
|
|
129
|
-
const stubAccount = createStubAccount(originalAddress
|
|
139
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
130
140
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
131
141
|
salt: Fr.random()
|
|
132
142
|
});
|
|
@@ -140,6 +150,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
140
150
|
let simulationResults;
|
|
141
151
|
const feeOptions = opts.fee?.estimateGas ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings) : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
142
152
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
153
|
+
const chainInfo = await this.getChainInfo();
|
|
143
154
|
const executionOptions = {
|
|
144
155
|
txNonce: Fr.random(),
|
|
145
156
|
cancellable: this.cancellableTransactions,
|
|
@@ -154,11 +165,11 @@ export class CLIWallet extends BaseWallet {
|
|
|
154
165
|
// TODO: allow disabling kernels even when no overrides are necessary
|
|
155
166
|
if (opts.from.equals(AztecAddress.ZERO)) {
|
|
156
167
|
const fromAccount = await this.getAccountFromAddress(opts.from);
|
|
157
|
-
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
|
|
168
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
158
169
|
simulationResults = await this.pxe.simulateTx(txRequest, true, opts?.skipTxValidation, opts?.skipFeeEnforcement ?? true);
|
|
159
170
|
} else {
|
|
160
171
|
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
|
|
161
|
-
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
|
|
172
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
162
173
|
const contractOverrides = {
|
|
163
174
|
[opts.from.toString()]: {
|
|
164
175
|
instance,
|
|
@@ -185,4 +196,9 @@ export class CLIWallet extends BaseWallet {
|
|
|
185
196
|
getNotes(filter) {
|
|
186
197
|
return this.pxe.debug.getNotes(filter);
|
|
187
198
|
}
|
|
199
|
+
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
200
|
+
// this is just a CLI wallet.
|
|
201
|
+
getContractArtifact(id) {
|
|
202
|
+
return this.pxe.getContractArtifact(id);
|
|
203
|
+
}
|
|
188
204
|
}
|
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.9d2bcf6d",
|
|
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.9d2bcf6d",
|
|
71
|
+
"@aztec/aztec.js": "0.0.1-commit.9d2bcf6d",
|
|
72
|
+
"@aztec/bb.js": "0.0.1-commit.9d2bcf6d",
|
|
73
|
+
"@aztec/cli": "0.0.1-commit.9d2bcf6d",
|
|
74
|
+
"@aztec/entrypoints": "0.0.1-commit.9d2bcf6d",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.9d2bcf6d",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.9d2bcf6d",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.9d2bcf6d",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.9d2bcf6d",
|
|
79
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.9d2bcf6d",
|
|
80
|
+
"@aztec/pxe": "0.0.1-commit.9d2bcf6d",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.9d2bcf6d",
|
|
82
|
+
"@aztec/wallet-sdk": "0.0.1-commit.9d2bcf6d",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
84
|
"inquirer": "^10.1.8",
|
|
85
85
|
"source-map-support": "^0.5.21",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@types/jest": "^30.0.0",
|
|
91
91
|
"@types/node": "^22.15.17",
|
|
92
92
|
"@types/source-map-support": "^0.5.10",
|
|
93
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
93
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
94
94
|
"jest": "^30.0.0",
|
|
95
95
|
"jest-mock-extended": "^4.0.0",
|
|
96
96
|
"ts-jest": "^29.4.0",
|
|
@@ -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
|
}
|
|
@@ -164,15 +167,11 @@ async function getKnownArtifacts(wallet: CLIWallet): Promise<ArtifactMap> {
|
|
|
164
167
|
const knownContractAddresses = await wallet.getContracts();
|
|
165
168
|
const knownContracts = (
|
|
166
169
|
await Promise.all(knownContractAddresses.map(contractAddress => wallet.getContractMetadata(contractAddress)))
|
|
167
|
-
).map(contractMetadata => contractMetadata.
|
|
170
|
+
).map(contractMetadata => contractMetadata.instance);
|
|
168
171
|
const classIds = [...new Set(knownContracts.map(contract => contract?.currentContractClassId))];
|
|
169
172
|
const knownArtifacts = (
|
|
170
|
-
await Promise.all(classIds.map(classId => (classId ? wallet.
|
|
171
|
-
).map(
|
|
172
|
-
contractClassMetadata
|
|
173
|
-
? { ...contractClassMetadata.artifact, classId: contractClassMetadata.contractClass?.id }
|
|
174
|
-
: undefined,
|
|
175
|
-
);
|
|
173
|
+
await Promise.all(classIds.map(classId => (classId ? wallet.getContractArtifact(classId) : undefined)))
|
|
174
|
+
).map((artifact, index) => (artifact ? { ...artifact, classId: classIds[index] } : undefined));
|
|
176
175
|
const map: Record<string, ContractArtifactWithClassId> = {};
|
|
177
176
|
for (const instance of knownContracts) {
|
|
178
177
|
if (instance) {
|
|
@@ -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
|
}
|