@aztec/cli-wallet 0.0.1-commit.cb6bed7c2 → 0.0.1-commit.cbf2c2d5d
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/check_tx.d.ts +1 -1
- package/dest/cmds/check_tx.d.ts.map +1 -1
- package/dest/cmds/check_tx.js +34 -8
- package/dest/utils/wallet.d.ts +4 -4
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +18 -12
- package/package.json +14 -14
- package/src/cmds/check_tx.ts +40 -9
- package/src/utils/wallet.ts +16 -21
package/dest/cmds/check_tx.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import type { TxHash } from '@aztec/aztec.js/tx';
|
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
import type { CLIWallet } from '../utils/wallet.js';
|
|
5
5
|
export declare function checkTx(wallet: CLIWallet, aztecNode: AztecNode, txHash: TxHash, statusOnly: boolean, log: LogFn): Promise<import("@aztec/aztec.js/tx").TxStatus | undefined>;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbWRzL2NoZWNrX3R4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRXRELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2pELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBUW5ELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXBELHdCQUFzQixPQUFPLENBQzNCLE1BQU0sRUFBRSxTQUFTLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLE1BQU0sRUFBRSxNQUFNLEVBQ2QsVUFBVSxFQUFFLE9BQU8sRUFDbkIsR0FBRyxFQUFFLEtBQUssOERBUVgifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/check_tx.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"check_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/check_tx.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,OAAO,EACnB,GAAG,EAAE,KAAK,8DAQX"}
|
package/dest/cmds/check_tx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
|
|
2
|
-
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
2
|
+
import { computeSiloedPrivateInitializationNullifier, computeSiloedPublicInitializationNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
3
3
|
export async function checkTx(wallet, aztecNode, txHash, statusOnly, log) {
|
|
4
4
|
if (statusOnly) {
|
|
5
5
|
const receipt = await aztecNode.getTxReceipt(txHash);
|
|
@@ -112,17 +112,22 @@ function toFriendlyAddress(address, artifactMap) {
|
|
|
112
112
|
}
|
|
113
113
|
async function getKnownNullifiers(wallet, artifactMap) {
|
|
114
114
|
const knownContracts = await wallet.getContracts();
|
|
115
|
-
const
|
|
116
|
-
|
|
115
|
+
const [contractResults, classResults] = await Promise.all([
|
|
116
|
+
Promise.all(knownContracts.map((contract)=>getContractNullifiers(wallet, contract))),
|
|
117
|
+
Promise.all(Object.values(artifactMap).map((artifact)=>getClassNullifier(artifact)))
|
|
118
|
+
]);
|
|
117
119
|
const initNullifiers = {};
|
|
118
120
|
const deployNullifiers = {};
|
|
119
121
|
const classNullifiers = {};
|
|
120
|
-
for (const contract of
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
for (const { contract, deployNullifier, privateInitNullifier, publicInitNullifier } of contractResults){
|
|
123
|
+
deployNullifiers[deployNullifier.toString()] = contract;
|
|
124
|
+
if (privateInitNullifier) {
|
|
125
|
+
initNullifiers[privateInitNullifier.toString()] = contract;
|
|
126
|
+
}
|
|
127
|
+
initNullifiers[publicInitNullifier.toString()] = contract;
|
|
123
128
|
}
|
|
124
|
-
for (const
|
|
125
|
-
classNullifiers[
|
|
129
|
+
for (const { nullifier, label } of classResults){
|
|
130
|
+
classNullifiers[nullifier.toString()] = label;
|
|
126
131
|
}
|
|
127
132
|
return {
|
|
128
133
|
initNullifiers,
|
|
@@ -130,6 +135,27 @@ async function getKnownNullifiers(wallet, artifactMap) {
|
|
|
130
135
|
classNullifiers
|
|
131
136
|
};
|
|
132
137
|
}
|
|
138
|
+
async function getContractNullifiers(wallet, contract) {
|
|
139
|
+
const deployerAddress = ProtocolContractAddress.ContractInstanceRegistry;
|
|
140
|
+
const deployNullifier = await siloNullifier(deployerAddress, contract.toField());
|
|
141
|
+
const metadata = await wallet.getContractMetadata(contract);
|
|
142
|
+
const privateInitNullifier = metadata.instance ? await computeSiloedPrivateInitializationNullifier(contract, metadata.instance.initializationHash) : undefined;
|
|
143
|
+
const publicInitNullifier = await computeSiloedPublicInitializationNullifier(contract);
|
|
144
|
+
return {
|
|
145
|
+
contract,
|
|
146
|
+
deployNullifier,
|
|
147
|
+
privateInitNullifier,
|
|
148
|
+
publicInitNullifier
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async function getClassNullifier(artifact) {
|
|
152
|
+
const classRegistryAddress = ProtocolContractAddress.ContractClassRegistry;
|
|
153
|
+
const nullifier = await siloNullifier(classRegistryAddress, artifact.classId);
|
|
154
|
+
return {
|
|
155
|
+
nullifier,
|
|
156
|
+
label: `${artifact.name}Class<${artifact.classId}>`
|
|
157
|
+
};
|
|
158
|
+
}
|
|
133
159
|
async function getKnownArtifacts(wallet) {
|
|
134
160
|
const knownContractAddresses = await wallet.getContracts();
|
|
135
161
|
const knownContracts = (await Promise.all(knownContractAddresses.map((contractAddress)=>wallet.getContractMetadata(contractAddress)))).map((contractMetadata)=>contractMetadata.instance);
|
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 {
|
|
7
|
+
import type { NotesFilter } from '@aztec/pxe/client/lazy';
|
|
8
8
|
import type { PXEConfig } from '@aztec/pxe/config';
|
|
9
9
|
import type { PXE } from '@aztec/pxe/server';
|
|
10
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
11
|
import { NoteDao } 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, type
|
|
14
|
+
import { BaseWallet, type SimulateViaEntrypointOptions } 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 {
|
|
@@ -32,9 +32,9 @@ export declare class CLIWallet extends BaseWallet {
|
|
|
32
32
|
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
33
33
|
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
34
34
|
*/
|
|
35
|
-
protected simulateViaEntrypoint(executionPayload: ExecutionPayload,
|
|
35
|
+
protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<TxSimulationResult>;
|
|
36
36
|
getContracts(): Promise<AztecAddress[]>;
|
|
37
37
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
38
38
|
getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBMkMsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRyxPQUFPLEVBQ0wsS0FBSyxxQkFBcUIsRUFHM0IsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsY0FBYyxFQUFFLEtBQUssT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFNUYsT0FBTyx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BQUMsWUFBWSxFQUFFLENBQUMsQ0FFdEM7SUFJRCxRQUFRLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FFaEQ7SUFJRCxtQkFBbUIsQ0FBQyxFQUFFLEVBQUUsRUFBRSxxRUFFekI7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAA2C,MAAM,yBAAyB,CAAC;AAChG,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAA2C,MAAM,yBAAyB,CAAC;AAChG,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,O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AC,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,CAShH;IAED;;;OAGG;IACH,UAAyB,qBAAqB,CAC5C,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAsC7B;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
|
@@ -158,9 +158,23 @@ export class CLIWallet extends BaseWallet {
|
|
|
158
158
|
/**
|
|
159
159
|
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
160
160
|
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
161
|
-
*/ async simulateViaEntrypoint(executionPayload,
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
*/ async simulateViaEntrypoint(executionPayload, opts) {
|
|
162
|
+
const { from, feeOptions, scopes } = opts;
|
|
163
|
+
let overrides;
|
|
164
|
+
let fromAccount;
|
|
165
|
+
if (!from.equals(AztecAddress.ZERO)) {
|
|
166
|
+
const { account, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
167
|
+
fromAccount = account;
|
|
168
|
+
overrides = {
|
|
169
|
+
contracts: {
|
|
170
|
+
[from.toString()]: {
|
|
171
|
+
instance,
|
|
172
|
+
artifact
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
} else {
|
|
177
|
+
fromAccount = await this.getAccountFromAddress(from);
|
|
164
178
|
}
|
|
165
179
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
166
180
|
const executionOptions = {
|
|
@@ -172,21 +186,13 @@ export class CLIWallet extends BaseWallet {
|
|
|
172
186
|
feeExecutionPayload,
|
|
173
187
|
executionPayload
|
|
174
188
|
]) : executionPayload;
|
|
175
|
-
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
176
189
|
const chainInfo = await this.getChainInfo();
|
|
177
190
|
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
178
191
|
return this.pxe.simulateTx(txRequest, {
|
|
179
192
|
simulatePublic: true,
|
|
180
193
|
skipFeeEnforcement: true,
|
|
181
194
|
skipTxValidation: true,
|
|
182
|
-
overrides
|
|
183
|
-
contracts: {
|
|
184
|
-
[from.toString()]: {
|
|
185
|
-
instance,
|
|
186
|
-
artifact
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
},
|
|
195
|
+
overrides,
|
|
190
196
|
scopes
|
|
191
197
|
});
|
|
192
198
|
}
|
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.cbf2c2d5d",
|
|
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.cbf2c2d5d",
|
|
71
|
+
"@aztec/aztec.js": "0.0.1-commit.cbf2c2d5d",
|
|
72
|
+
"@aztec/bb.js": "0.0.1-commit.cbf2c2d5d",
|
|
73
|
+
"@aztec/cli": "0.0.1-commit.cbf2c2d5d",
|
|
74
|
+
"@aztec/entrypoints": "0.0.1-commit.cbf2c2d5d",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.cbf2c2d5d",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.cbf2c2d5d",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.cbf2c2d5d",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.cbf2c2d5d",
|
|
79
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.cbf2c2d5d",
|
|
80
|
+
"@aztec/pxe": "0.0.1-commit.cbf2c2d5d",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.cbf2c2d5d",
|
|
82
|
+
"@aztec/wallet-sdk": "0.0.1-commit.cbf2c2d5d",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
84
|
"inquirer": "^10.1.8",
|
|
85
85
|
"source-map-support": "^0.5.21",
|
package/src/cmds/check_tx.ts
CHANGED
|
@@ -5,7 +5,11 @@ import type { AztecNode } from '@aztec/aztec.js/node';
|
|
|
5
5
|
import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
|
|
6
6
|
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
7
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
computeSiloedPrivateInitializationNullifier,
|
|
10
|
+
computeSiloedPublicInitializationNullifier,
|
|
11
|
+
siloNullifier,
|
|
12
|
+
} from '@aztec/stdlib/hash';
|
|
9
13
|
import { NoteDao } from '@aztec/stdlib/note';
|
|
10
14
|
|
|
11
15
|
import type { CLIWallet } from '../utils/wallet.js';
|
|
@@ -144,22 +148,49 @@ function toFriendlyAddress(address: AztecAddress, artifactMap: ArtifactMap) {
|
|
|
144
148
|
|
|
145
149
|
async function getKnownNullifiers(wallet: CLIWallet, artifactMap: ArtifactMap) {
|
|
146
150
|
const knownContracts = await wallet.getContracts();
|
|
147
|
-
|
|
148
|
-
const
|
|
151
|
+
|
|
152
|
+
const [contractResults, classResults] = await Promise.all([
|
|
153
|
+
Promise.all(knownContracts.map(contract => getContractNullifiers(wallet, contract))),
|
|
154
|
+
Promise.all(Object.values(artifactMap).map(artifact => getClassNullifier(artifact))),
|
|
155
|
+
]);
|
|
156
|
+
|
|
149
157
|
const initNullifiers: Record<string, AztecAddress> = {};
|
|
150
158
|
const deployNullifiers: Record<string, AztecAddress> = {};
|
|
151
159
|
const classNullifiers: Record<string, string> = {};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
deployNullifiers[
|
|
160
|
+
|
|
161
|
+
for (const { contract, deployNullifier, privateInitNullifier, publicInitNullifier } of contractResults) {
|
|
162
|
+
deployNullifiers[deployNullifier.toString()] = contract;
|
|
163
|
+
if (privateInitNullifier) {
|
|
164
|
+
initNullifiers[privateInitNullifier.toString()] = contract;
|
|
165
|
+
}
|
|
166
|
+
initNullifiers[publicInitNullifier.toString()] = contract;
|
|
155
167
|
}
|
|
156
|
-
for (const
|
|
157
|
-
classNullifiers[
|
|
158
|
-
`${artifact.name}Class<${artifact.classId}>`;
|
|
168
|
+
for (const { nullifier, label } of classResults) {
|
|
169
|
+
classNullifiers[nullifier.toString()] = label;
|
|
159
170
|
}
|
|
171
|
+
|
|
160
172
|
return { initNullifiers, deployNullifiers, classNullifiers };
|
|
161
173
|
}
|
|
162
174
|
|
|
175
|
+
async function getContractNullifiers(wallet: CLIWallet, contract: AztecAddress) {
|
|
176
|
+
const deployerAddress = ProtocolContractAddress.ContractInstanceRegistry;
|
|
177
|
+
const deployNullifier = await siloNullifier(deployerAddress, contract.toField());
|
|
178
|
+
|
|
179
|
+
const metadata = await wallet.getContractMetadata(contract);
|
|
180
|
+
const privateInitNullifier = metadata.instance
|
|
181
|
+
? await computeSiloedPrivateInitializationNullifier(contract, metadata.instance.initializationHash)
|
|
182
|
+
: undefined;
|
|
183
|
+
const publicInitNullifier = await computeSiloedPublicInitializationNullifier(contract);
|
|
184
|
+
|
|
185
|
+
return { contract, deployNullifier, privateInitNullifier, publicInitNullifier };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async function getClassNullifier(artifact: ContractArtifactWithClassId) {
|
|
189
|
+
const classRegistryAddress = ProtocolContractAddress.ContractClassRegistry;
|
|
190
|
+
const nullifier = await siloNullifier(classRegistryAddress, artifact.classId);
|
|
191
|
+
return { nullifier, label: `${artifact.name}Class<${artifact.classId}>` };
|
|
192
|
+
}
|
|
193
|
+
|
|
163
194
|
type ArtifactMap = Record<string, ContractArtifactWithClassId>;
|
|
164
195
|
type ContractArtifactWithClassId = ContractArtifact & { classId: Fr };
|
|
165
196
|
|
package/src/utils/wallet.ts
CHANGED
|
@@ -13,16 +13,16 @@ import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec
|
|
|
13
13
|
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
14
14
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
15
15
|
import type { LogFn } from '@aztec/foundation/log';
|
|
16
|
-
import type {
|
|
16
|
+
import type { NotesFilter } from '@aztec/pxe/client/lazy';
|
|
17
17
|
import type { PXEConfig } from '@aztec/pxe/config';
|
|
18
18
|
import type { PXE } from '@aztec/pxe/server';
|
|
19
19
|
import { createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
20
20
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
21
21
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
22
22
|
import { NoteDao } from '@aztec/stdlib/note';
|
|
23
|
-
import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
23
|
+
import type { SimulationOverrides, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
24
24
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
25
|
-
import { BaseWallet, type
|
|
25
|
+
import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
26
26
|
|
|
27
27
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
28
28
|
import type { AccountType } from './constants.js';
|
|
@@ -224,21 +224,19 @@ export class CLIWallet extends BaseWallet {
|
|
|
224
224
|
*/
|
|
225
225
|
protected override async simulateViaEntrypoint(
|
|
226
226
|
executionPayload: ExecutionPayload,
|
|
227
|
-
|
|
228
|
-
feeOptions: FeeOptions,
|
|
229
|
-
scopes: AccessScopes,
|
|
230
|
-
skipTxValidation?: boolean,
|
|
231
|
-
skipFeeEnforcement?: boolean,
|
|
227
|
+
opts: SimulateViaEntrypointOptions,
|
|
232
228
|
): Promise<TxSimulationResult> {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
229
|
+
const { from, feeOptions, scopes } = opts;
|
|
230
|
+
let overrides: SimulationOverrides | undefined;
|
|
231
|
+
let fromAccount: Account;
|
|
232
|
+
if (!from.equals(AztecAddress.ZERO)) {
|
|
233
|
+
const { account, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
234
|
+
fromAccount = account;
|
|
235
|
+
overrides = {
|
|
236
|
+
contracts: { [from.toString()]: { instance, artifact } },
|
|
237
|
+
};
|
|
238
|
+
} else {
|
|
239
|
+
fromAccount = await this.getAccountFromAddress(from);
|
|
242
240
|
}
|
|
243
241
|
|
|
244
242
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
@@ -251,7 +249,6 @@ export class CLIWallet extends BaseWallet {
|
|
|
251
249
|
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
252
250
|
: executionPayload;
|
|
253
251
|
|
|
254
|
-
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
255
252
|
const chainInfo = await this.getChainInfo();
|
|
256
253
|
const txRequest = await fromAccount.createTxExecutionRequest(
|
|
257
254
|
finalExecutionPayload,
|
|
@@ -263,9 +260,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
263
260
|
simulatePublic: true,
|
|
264
261
|
skipFeeEnforcement: true,
|
|
265
262
|
skipTxValidation: true,
|
|
266
|
-
overrides
|
|
267
|
-
contracts: { [from.toString()]: { instance, artifact } },
|
|
268
|
-
},
|
|
263
|
+
overrides,
|
|
269
264
|
scopes,
|
|
270
265
|
});
|
|
271
266
|
}
|