@aztec/cli-wallet 3.0.3 → 4.0.0-devnet.1-patch.0
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/bin/index.d.ts +1 -0
- package/dest/bin/index.js +1 -0
- 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 +3 -2
- 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 +2 -2
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +46 -31
- package/dest/utils/constants.d.ts +4 -0
- package/dest/utils/constants.d.ts.map +1 -0
- package/dest/utils/constants.js +7 -0
- package/dest/utils/options/fees.js +2 -2
- package/dest/utils/options/options.d.ts +2 -2
- 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/profiling.d.ts.map +1 -1
- package/dest/utils/profiling.js +9 -1
- package/dest/utils/wallet.d.ts +3 -4
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +26 -17
- package/package.json +15 -15
- package/src/bin/index.ts +1 -0
- package/src/cmds/authorize_action.ts +1 -1
- package/src/cmds/check_tx.ts +7 -8
- package/src/cmds/create_account.ts +25 -18
- 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/cmds/simulate.ts +3 -6
- package/src/storage/wallet_db.ts +50 -37
- package/src/utils/constants.ts +4 -0
- package/src/utils/options/fees.ts +2 -2
- package/src/utils/options/options.ts +1 -1
- package/src/utils/profiling.ts +15 -1
- package/src/utils/wallet.ts +29 -12
|
@@ -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
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const MIN_FEE_PADDING = 0.5;
|
|
2
|
+
export declare const AccountTypes: readonly ["schnorr", "ecdsasecp256r1", "ecdsasecp256r1ssh", "ecdsasecp256k1"];
|
|
3
|
+
export type AccountType = (typeof AccountTypes)[number];
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSxlQUFlLE1BQU0sQ0FBQztBQUVuQyxlQUFPLE1BQU0sWUFBWSwrRUFBZ0YsQ0FBQztBQUMxRyxNQUFNLE1BQU0sV0FBVyxHQUFHLENBQUMsT0FBTyxZQUFZLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,eAAO,MAAM,YAAY,+EAAgF,CAAC;AAC1G,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
4
4
|
import { Option } from 'commander';
|
|
5
|
-
import {
|
|
5
|
+
import { MIN_FEE_PADDING } from '../constants.js';
|
|
6
6
|
import { aliasedAddressParser } from './options.js';
|
|
7
7
|
function printOptionParams(params) {
|
|
8
8
|
const paramsWithDescription = Object.keys(params).filter((name)=>params[name].description);
|
|
@@ -190,7 +190,7 @@ export class CLIFeeArgs {
|
|
|
190
190
|
this.gasSettings = gasSettings;
|
|
191
191
|
}
|
|
192
192
|
async toUserFeeOptions(node, wallet, from) {
|
|
193
|
-
const maxFeesPerGas = (await node.
|
|
193
|
+
const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1 + MIN_FEE_PADDING);
|
|
194
194
|
const gasSettings = GasSettings.default({
|
|
195
195
|
...this.gasSettings,
|
|
196
196
|
maxFeesPerGas
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3V0aWxzL29wdGlvbnMvb3B0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFNUMsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRWhFLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFHbkMsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLFFBQVEsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBS3RFLGVBQU8sTUFBTSxvQkFBb0Isd0tBQ3NJLENBQUM7QUFFeEssd0JBQWdCLGdCQUFnQixDQUM5QixLQUFLLEVBQUUsTUFBTSxFQUNiLE9BQU8sRUFBRSxNQUFNLEVBQ2YsR0FBRyxTQUEwQixFQUM3QixHQUFHLFNBQTBCLFVBVTlCO0FBRUQsd0JBQWdCLG1CQUFtQixDQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsRUFBRSxDQUFDLEVBQUUsUUFBUSxHQUFHLE1BQU0sQ0FRekU7QUFF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AgB,CAAC,SAAS,EAAE,OAAO,UAMlD;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,QAAQ,UAQrE;AAED,wBAAgB,2BAA2B,CAAC,EAAE,CAAC,EAAE,QAAQ,UAIxD;AAED,wBAAgB,kCAAkC,WAKjD;AAED,wBAAgB,mBAAmB,WAKlC;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,mBAajE;AAED,wBAAsB,8BAA8B,CAClD,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,EACpC,eAAe,EAAE,YAAY,EAC7B,EAAE,CAAC,EAAE,QAAQ,mBAWd;AAED,wBAAgB,oBAAoB,CAAC,EAAE,CAAC,EAAE,QAAQ,UAIjD;AA6BD,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,WAAW,EAAE,GAAG,SAAS,GAAG,WAAW,EAAE,CAE5F"}
|
|
@@ -2,7 +2,7 @@ import { parseAztecAddress, parseSecretKey, parseTxHash } from '@aztec/cli/utils
|
|
|
2
2
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
3
|
import { Option } from 'commander';
|
|
4
4
|
import { readdir, stat } from 'fs/promises';
|
|
5
|
-
import { AccountTypes } from '../
|
|
5
|
+
import { AccountTypes } from '../constants.js';
|
|
6
6
|
const TARGET_DIR = 'target';
|
|
7
7
|
export const ARTIFACT_DESCRIPTION = "Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract";
|
|
8
8
|
export function integerArgParser(value, argName, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
@@ -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
|
@@ -13,9 +13,7 @@ import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
|
13
13
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
14
14
|
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
15
15
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
16
|
-
|
|
17
|
-
export type AccountType = (typeof AccountTypes)[number];
|
|
18
|
-
export declare const BASE_FEE_PADDING = 0.5;
|
|
16
|
+
import type { AccountType } from './constants.js';
|
|
19
17
|
export declare class CLIWallet extends BaseWallet {
|
|
20
18
|
private userLog;
|
|
21
19
|
private db?;
|
|
@@ -32,5 +30,6 @@ export declare class CLIWallet extends BaseWallet {
|
|
|
32
30
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
33
31
|
getContracts(): Promise<AztecAddress[]>;
|
|
34
32
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
33
|
+
getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
|
|
35
34
|
}
|
|
36
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBMkMsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRyxPQUFPLEVBQ0wsS0FBSyxxQkFBcUIsRUFHM0IsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsY0FBYyxFQUFFLEtBQUssT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFNUYsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRTdDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDN0MsT0FBTyxLQUFLLEVBQUUsV0FBV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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
|
@@ -13,13 +13,6 @@ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
|
13
13
|
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
14
14
|
import { extractECDSAPublicKeyFromBase64String } from './ecdsa.js';
|
|
15
15
|
import { printGasEstimates } from './options/fees.js';
|
|
16
|
-
export const AccountTypes = [
|
|
17
|
-
'schnorr',
|
|
18
|
-
'ecdsasecp256r1',
|
|
19
|
-
'ecdsasecp256r1ssh',
|
|
20
|
-
'ecdsasecp256k1'
|
|
21
|
-
];
|
|
22
|
-
export const BASE_FEE_PADDING = 0.5;
|
|
23
16
|
export class CLIWallet extends BaseWallet {
|
|
24
17
|
userLog;
|
|
25
18
|
db;
|
|
@@ -45,12 +38,13 @@ export class CLIWallet extends BaseWallet {
|
|
|
45
38
|
const feeOptions = await this.completeFeeOptions(from, executionPayload.feePayer, increasedFee.gasSettings);
|
|
46
39
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
47
40
|
const fromAccount = await this.getAccountFromAddress(from);
|
|
41
|
+
const chainInfo = await this.getChainInfo();
|
|
48
42
|
const executionOptions = {
|
|
49
43
|
txNonce,
|
|
50
44
|
cancellable: this.cancellableTransactions,
|
|
51
45
|
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
|
|
52
46
|
};
|
|
53
|
-
return await fromAccount.createTxExecutionRequest(feeExecutionPayload ?? executionPayload, feeOptions.gasSettings, executionOptions);
|
|
47
|
+
return await fromAccount.createTxExecutionRequest(feeExecutionPayload ?? executionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
54
48
|
}
|
|
55
49
|
async proveCancellationTx(from, txNonce, increasedFee) {
|
|
56
50
|
const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
|
|
@@ -59,8 +53,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
59
53
|
async getAccountFromAddress(address) {
|
|
60
54
|
let account;
|
|
61
55
|
if (address.equals(AztecAddress.ZERO)) {
|
|
62
|
-
|
|
63
|
-
account = new SignerlessAccount(chainInfo);
|
|
56
|
+
account = new SignerlessAccount();
|
|
64
57
|
} else if (this.accountCache.has(address.toString())) {
|
|
65
58
|
return this.accountCache.get(address.toString());
|
|
66
59
|
} else {
|
|
@@ -125,15 +118,25 @@ export class CLIWallet extends BaseWallet {
|
|
|
125
118
|
}
|
|
126
119
|
return account;
|
|
127
120
|
}
|
|
128
|
-
|
|
129
|
-
|
|
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) {
|
|
130
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
|
+
}
|
|
131
134
|
const originalAddress = originalAccount.getCompleteAddress();
|
|
132
|
-
const
|
|
135
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
133
136
|
if (!contractInstance) {
|
|
134
137
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
135
138
|
}
|
|
136
|
-
const stubAccount = createStubAccount(originalAddress
|
|
139
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
137
140
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
138
141
|
salt: Fr.random()
|
|
139
142
|
});
|
|
@@ -147,6 +150,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
147
150
|
let simulationResults;
|
|
148
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);
|
|
149
152
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
153
|
+
const chainInfo = await this.getChainInfo();
|
|
150
154
|
const executionOptions = {
|
|
151
155
|
txNonce: Fr.random(),
|
|
152
156
|
cancellable: this.cancellableTransactions,
|
|
@@ -161,11 +165,11 @@ export class CLIWallet extends BaseWallet {
|
|
|
161
165
|
// TODO: allow disabling kernels even when no overrides are necessary
|
|
162
166
|
if (opts.from.equals(AztecAddress.ZERO)) {
|
|
163
167
|
const fromAccount = await this.getAccountFromAddress(opts.from);
|
|
164
|
-
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
|
|
168
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
165
169
|
simulationResults = await this.pxe.simulateTx(txRequest, true, opts?.skipTxValidation, opts?.skipFeeEnforcement ?? true);
|
|
166
170
|
} else {
|
|
167
171
|
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
|
|
168
|
-
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
|
|
172
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
169
173
|
const contractOverrides = {
|
|
170
174
|
[opts.from.toString()]: {
|
|
171
175
|
instance,
|
|
@@ -190,6 +194,11 @@ export class CLIWallet extends BaseWallet {
|
|
|
190
194
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
191
195
|
// this is just a CLI wallet.
|
|
192
196
|
getNotes(filter) {
|
|
193
|
-
return this.pxe.getNotes(filter);
|
|
197
|
+
return this.pxe.debug.getNotes(filter);
|
|
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);
|
|
194
203
|
}
|
|
195
204
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-devnet.1-patch.0",
|
|
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": "
|
|
71
|
-
"@aztec/aztec.js": "
|
|
72
|
-
"@aztec/bb.js": "
|
|
73
|
-
"@aztec/cli": "
|
|
74
|
-
"@aztec/entrypoints": "
|
|
75
|
-
"@aztec/ethereum": "
|
|
76
|
-
"@aztec/foundation": "
|
|
77
|
-
"@aztec/kv-store": "
|
|
78
|
-
"@aztec/noir-contracts.js": "
|
|
79
|
-
"@aztec/noir-noirc_abi": "
|
|
80
|
-
"@aztec/pxe": "
|
|
81
|
-
"@aztec/stdlib": "
|
|
82
|
-
"@aztec/wallet-sdk": "
|
|
70
|
+
"@aztec/accounts": "4.0.0-devnet.1-patch.0",
|
|
71
|
+
"@aztec/aztec.js": "4.0.0-devnet.1-patch.0",
|
|
72
|
+
"@aztec/bb.js": "4.0.0-devnet.1-patch.0",
|
|
73
|
+
"@aztec/cli": "4.0.0-devnet.1-patch.0",
|
|
74
|
+
"@aztec/entrypoints": "4.0.0-devnet.1-patch.0",
|
|
75
|
+
"@aztec/ethereum": "4.0.0-devnet.1-patch.0",
|
|
76
|
+
"@aztec/foundation": "4.0.0-devnet.1-patch.0",
|
|
77
|
+
"@aztec/kv-store": "4.0.0-devnet.1-patch.0",
|
|
78
|
+
"@aztec/noir-contracts.js": "4.0.0-devnet.1-patch.0",
|
|
79
|
+
"@aztec/noir-noirc_abi": "4.0.0-devnet.1-patch.0",
|
|
80
|
+
"@aztec/pxe": "4.0.0-devnet.1-patch.0",
|
|
81
|
+
"@aztec/stdlib": "4.0.0-devnet.1-patch.0",
|
|
82
|
+
"@aztec/wallet-sdk": "4.0.0-devnet.1-patch.0",
|
|
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",
|
package/src/bin/index.ts
CHANGED
|
@@ -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,14 +1,17 @@
|
|
|
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';
|
|
11
|
+
import type { AccountType } from '../utils/constants.js';
|
|
9
12
|
import { CLIFeeArgs } from '../utils/options/fees.js';
|
|
10
13
|
import { printProfileResult } from '../utils/profiling.js';
|
|
11
|
-
import {
|
|
14
|
+
import { CLIWallet } from '../utils/wallet.js';
|
|
12
15
|
|
|
13
16
|
export async function createAccount(
|
|
14
17
|
wallet: CLIWallet,
|
|
@@ -63,8 +66,8 @@ export async function createAccount(
|
|
|
63
66
|
log(`Init hash: ${account.getInstance().initializationHash.toString()}`);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
let
|
|
67
|
-
let txReceipt;
|
|
69
|
+
let txHash: TxHash | undefined;
|
|
70
|
+
let txReceipt: TxReceipt | undefined;
|
|
68
71
|
if (!registerOnly) {
|
|
69
72
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
70
73
|
|
|
@@ -99,7 +102,14 @@ export async function createAccount(
|
|
|
99
102
|
};
|
|
100
103
|
}
|
|
101
104
|
} else {
|
|
102
|
-
|
|
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({
|
|
103
113
|
...deployAccountOpts,
|
|
104
114
|
fee: deployAccountOpts.fee
|
|
105
115
|
? {
|
|
@@ -107,32 +117,29 @@ export async function createAccount(
|
|
|
107
117
|
gasSettings: estimatedGas,
|
|
108
118
|
}
|
|
109
119
|
: undefined,
|
|
120
|
+
wait: wait ? { timeout: DEFAULT_TX_TIMEOUT_S, returnReceipt: true } : NO_WAIT,
|
|
110
121
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const txHash = await tx.getTxHash();
|
|
116
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
117
|
-
out.txHash = txHash;
|
|
118
|
-
if (wait) {
|
|
119
|
-
if (!json) {
|
|
120
|
-
log(`\nWaiting for account contract deployment...`);
|
|
121
|
-
}
|
|
122
|
-
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;
|
|
123
126
|
out.txReceipt = {
|
|
124
127
|
status: txReceipt.status,
|
|
125
128
|
transactionFee: txReceipt.transactionFee,
|
|
126
129
|
};
|
|
130
|
+
} else {
|
|
131
|
+
txHash = result;
|
|
127
132
|
}
|
|
133
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
134
|
+
out.txHash = txHash;
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
if (json) {
|
|
132
139
|
log(prettyPrintJSON(out));
|
|
133
140
|
} else {
|
|
134
|
-
if (
|
|
135
|
-
log(`Deploy tx hash: ${
|
|
141
|
+
if (txHash) {
|
|
142
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
136
143
|
}
|
|
137
144
|
if (txReceipt) {
|
|
138
145
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|