@aztec/wallet-sdk 5.0.0-rc.1 → 5.0.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/README.md
CHANGED
|
@@ -324,7 +324,7 @@ function useWalletDiscovery(chainInfo: ChainInfo, appId: string) {
|
|
|
324
324
|
|
|
325
325
|
Your wallet and the PXE it embeds persist state through a pluggable key-value store (`@aztec/kv-store`). In the browser there are two backends:
|
|
326
326
|
|
|
327
|
-
- **IndexedDB** (`@aztec/kv-store/indexeddb`): the default in browser environments up to Aztec Alpha v4
|
|
327
|
+
- **IndexedDB** (`@aztec/kv-store/deprecated/indexeddb`): the default in browser environments up to Aztec Alpha v4, now moved to a deprecated subpath. We plan to remove this backend, so new browser code should use the SQLite backend below.
|
|
328
328
|
- **SQLite-OPFS** (`@aztec/kv-store/sqlite-opfs`): the default KV store backend from Aztec Alpha v5 on. It's backed by the durable Origin Private File System web standard, and it offers a number of advantages over IndexedDB: a sane transaction model (IDB transactions auto-close the moment the event loop yields, which constrains the store layer), support for encryption at rest, and better performance in the access patterns we exercise the most from both wallet and PXE.
|
|
329
329
|
|
|
330
330
|
The backend is chosen by *which store you construct and hand to the wallet* there is no runtime flag or environment variable.
|
|
@@ -11,9 +11,10 @@ import type { PXE } from '@aztec/pxe/server';
|
|
|
11
11
|
import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall } from '@aztec/stdlib/abi';
|
|
12
12
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
13
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
-
import { type
|
|
14
|
+
import { type ContractInstancePreimage } from '@aztec/stdlib/contract';
|
|
15
15
|
import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
|
|
16
16
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
17
|
+
import { type MasterSecretKeys } from '@aztec/stdlib/keys';
|
|
17
18
|
import { ExecutionPayload, type TxExecutionRequest, type TxProfileResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
18
19
|
/**
|
|
19
20
|
* Options to configure fee payment for a transaction
|
|
@@ -59,6 +60,7 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
59
60
|
protected log: import("@aztec/foundation/log").Logger;
|
|
60
61
|
protected minFeePadding: number;
|
|
61
62
|
protected cancellableTransactions: boolean;
|
|
63
|
+
protected defaultWaitInterval?: number;
|
|
62
64
|
private nodeInfoPromise;
|
|
63
65
|
protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
|
|
64
66
|
protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes?: AztecAddress[]): AztecAddress[];
|
|
@@ -124,7 +126,7 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
124
126
|
*/
|
|
125
127
|
protected getMinFees(estimate?: ManaUsageEstimate): Promise<GasFees>;
|
|
126
128
|
registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
|
|
127
|
-
registerContract(instance:
|
|
129
|
+
registerContract(instance: ContractInstancePreimage, artifact?: ContractArtifact, secretKeyOrKeys?: Fr | MasterSecretKeys): Promise<void>;
|
|
128
130
|
registerContractClass(artifact: ContractArtifact): Promise<void>;
|
|
129
131
|
/**
|
|
130
132
|
* Simulates calls through the standard PXE path (account entrypoint).
|
|
@@ -163,7 +165,7 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
163
165
|
* @param address - The contract address to query.
|
|
164
166
|
*/
|
|
165
167
|
getContractMetadata(address: AztecAddress): Promise<{
|
|
166
|
-
instance:
|
|
168
|
+
instance: import("@aztec/stdlib/contract").ContractInstancePreimageWithAddress | undefined;
|
|
167
169
|
initializationStatus: ContractInitializationStatus;
|
|
168
170
|
isContractPublished: boolean;
|
|
169
171
|
isContractUpdated: boolean;
|
|
@@ -174,4 +176,4 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
174
176
|
isContractClassPubliclyRegistered: boolean;
|
|
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,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAMzG;IAED;;;;;;;OAOG;IACG,UAAU,CACd,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,+BAA+B,CAAC,CAkD1C;IAEK,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAclG;IAEY,MAAM,CAAC,CAAC,SAAS,sBAAsB,GAAG,SAAS,EAC9D,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA8CxB;IAED;;;OAGG;IACH,UAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAWlF;IAED,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAYpE;IAED,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAE/F;IAEK,gBAAgB,CAAC,CAAC,EACtB,QAAQ,EAAE,uBAAuB,EACjC,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAe5B;IAED;;;OAGG;IACG,mBAAmB,CAAC,OAAO,EAAE,YAAY;;;;;;OAiC9C;IAEK,wBAAwB,CAAC,EAAE,EAAE,EAAE;;;OAMpC;CACF"}
|
|
@@ -9,10 +9,11 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
9
9
|
import { displayDebugLogs } from '@aztec/pxe/client/lazy';
|
|
10
10
|
import { decodeFromAbi } from '@aztec/stdlib/abi';
|
|
11
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
-
import { computePartialAddress
|
|
12
|
+
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
13
13
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
14
14
|
import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
|
|
15
15
|
import { computeSiloedPrivateInitializationNullifier, computeSiloedPublicInitializationNullifier } from '@aztec/stdlib/hash';
|
|
16
|
+
import { deriveKeys, deriveKeysFromMasterSecretKeys } from '@aztec/stdlib/keys';
|
|
16
17
|
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
17
18
|
import { inspect } from 'util';
|
|
18
19
|
import { assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
|
|
@@ -25,6 +26,9 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
25
26
|
log;
|
|
26
27
|
minFeePadding;
|
|
27
28
|
cancellableTransactions;
|
|
29
|
+
// Poll interval (in seconds) injected into sendTx waits when the caller does not specify one. Left undefined on
|
|
30
|
+
// production wallets so the DefaultWaitOpts 1s cadence stands; test wallets talking to in-process nodes lower it.
|
|
31
|
+
defaultWaitInterval;
|
|
28
32
|
// A wallet is instantiated for a particular chain, so chain info never changes during its lifetime.
|
|
29
33
|
// We cache it here because getChainInfo is called frequently (every tx simulation, send, auth wit, etc.).
|
|
30
34
|
nodeInfoPromise;
|
|
@@ -44,7 +48,7 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
44
48
|
const scopeSet = new Set(allScopes.map((address)=>address.toString()));
|
|
45
49
|
return [
|
|
46
50
|
...scopeSet
|
|
47
|
-
].map(AztecAddress.
|
|
51
|
+
].map(AztecAddress.fromStringUnsafe);
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
|
|
@@ -62,9 +66,11 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
62
66
|
* - Contacts: more general concept akin to a phone's contact list.
|
|
63
67
|
* @returns The aliased collection of AztecAddresses that form this wallet's address book
|
|
64
68
|
*/ async getAddressBook() {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
const sources = await this.pxe.getTaggingSecretSources({
|
|
70
|
+
kind: 'address-derived'
|
|
71
|
+
});
|
|
72
|
+
return sources.map((source)=>({
|
|
73
|
+
item: source.sender,
|
|
68
74
|
alias: ''
|
|
69
75
|
}));
|
|
70
76
|
}
|
|
@@ -231,40 +237,34 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
231
237
|
throw err;
|
|
232
238
|
}
|
|
233
239
|
}
|
|
234
|
-
registerSender(address, _alias = '') {
|
|
235
|
-
|
|
240
|
+
async registerSender(address, _alias = '') {
|
|
241
|
+
await this.pxe.registerTaggingSecretSource({
|
|
242
|
+
kind: 'address-derived',
|
|
243
|
+
sender: address
|
|
244
|
+
});
|
|
245
|
+
return address;
|
|
236
246
|
}
|
|
237
|
-
async registerContract(instance, artifact,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (!thisContractClass.id.equals(existingInstance.currentContractClassId)) {
|
|
244
|
-
// wallet holds an outdated version of this contract
|
|
245
|
-
await this.pxe.updateContract(instance.address, artifact);
|
|
246
|
-
instance.currentContractClassId = thisContractClass.id;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
// If no artifact provided, we just use the existing registration
|
|
250
|
-
} else {
|
|
251
|
-
// Instance not registered yet
|
|
252
|
-
if (!artifact) {
|
|
253
|
-
// Try to get the artifact from the wallet's contract class storage
|
|
254
|
-
artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
|
|
255
|
-
if (!artifact) {
|
|
256
|
-
throw new Error(`Cannot register contract at ${instance.address.toString()}: artifact is required but not provided, and wallet does not have the artifact for contract class ${instance.currentContractClassId.toString()}`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
await this.pxe.registerContract({
|
|
260
|
-
artifact,
|
|
261
|
-
instance
|
|
262
|
-
});
|
|
247
|
+
async registerContract(instance, artifact, secretKeyOrKeys) {
|
|
248
|
+
// Classes and instances are registered independently: register the artifact (if provided) then the instance.
|
|
249
|
+
// Neither call validates that the artifact matches the class the instance runs, a missing artifact only surfaces
|
|
250
|
+
// when the contract is later simulated.
|
|
251
|
+
if (artifact) {
|
|
252
|
+
await this.pxe.registerContractClass(artifact);
|
|
263
253
|
}
|
|
264
|
-
|
|
265
|
-
|
|
254
|
+
const contractAddress = await this.pxe.registerContract(instance);
|
|
255
|
+
if (secretKeyOrKeys) {
|
|
256
|
+
// PXE never receives the account seed (from which the message-signing/fallback secret keys could be re-derived):
|
|
257
|
+
// the wallet derives the keys here. Of these, PXE only reads and stores the four privacy secret keys and the
|
|
258
|
+
// message-signing and fallback *public* keys — it never touches the message-signing or fallback secret keys.
|
|
259
|
+
//
|
|
260
|
+
// Since PXE recomputes the address from those keys, we assert it matches the instance's address: a mismatch means
|
|
261
|
+
// the provided keys don't correspond to this account.
|
|
262
|
+
const derivedKeys = secretKeyOrKeys instanceof Fr ? await deriveKeys(secretKeyOrKeys) : await deriveKeysFromMasterSecretKeys(secretKeyOrKeys);
|
|
263
|
+
const { address } = await this.pxe.registerAccount(derivedKeys, await computePartialAddress(instance));
|
|
264
|
+
if (!address.equals(contractAddress)) {
|
|
265
|
+
throw new Error(`Registered account address ${address.toString()} does not match contract instance address ${contractAddress.toString()}: the provided keys do not correspond to this account.`);
|
|
266
|
+
}
|
|
266
267
|
}
|
|
267
|
-
return instance;
|
|
268
268
|
}
|
|
269
269
|
registerContractClass(artifact) {
|
|
270
270
|
return this.pxe.registerContractClass(artifact);
|
|
@@ -388,7 +388,11 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
391
|
-
const
|
|
391
|
+
const callerWaitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
392
|
+
const waitOpts = this.defaultWaitInterval !== undefined && callerWaitOpts?.interval === undefined ? {
|
|
393
|
+
...callerWaitOpts,
|
|
394
|
+
interval: this.defaultWaitInterval
|
|
395
|
+
} : callerWaitOpts;
|
|
392
396
|
const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
|
|
393
397
|
// Display debug logs from public execution if present (served in test mode only)
|
|
394
398
|
if (receipt.isMined() && receipt.debugLogs?.length) {
|
|
@@ -407,7 +411,11 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
407
411
|
if (!instance) {
|
|
408
412
|
return undefined;
|
|
409
413
|
}
|
|
410
|
-
|
|
414
|
+
// Contract names are class-stable (an upgrade preserves the contract name), so the original class artifact is a
|
|
415
|
+
// sufficient source for the display name without resolving the current class against the node.
|
|
416
|
+
// TODO: if a contract were to be upgraded and its original artifact never registered, then this would fail and we'd
|
|
417
|
+
// want to fallback to the current class.
|
|
418
|
+
const artifact = await this.pxe.getContractArtifact(instance.originalContractClassId);
|
|
411
419
|
return artifact?.name;
|
|
412
420
|
}
|
|
413
421
|
contextualizeError(err, ...context) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/wallet-sdk",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/wallet-sdk",
|
|
4
|
-
"version": "5.0.0
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./base-wallet": "./dest/base-wallet/index.js",
|
|
@@ -75,15 +75,15 @@
|
|
|
75
75
|
]
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@aztec/aztec.js": "5.0.0
|
|
79
|
-
"@aztec/constants": "5.0.0
|
|
80
|
-
"@aztec/entrypoints": "5.0.0
|
|
81
|
-
"@aztec/foundation": "5.0.0
|
|
82
|
-
"@aztec/pxe": "5.0.0
|
|
83
|
-
"@aztec/stdlib": "5.0.0
|
|
78
|
+
"@aztec/aztec.js": "5.0.0",
|
|
79
|
+
"@aztec/constants": "5.0.0",
|
|
80
|
+
"@aztec/entrypoints": "5.0.0",
|
|
81
|
+
"@aztec/foundation": "5.0.0",
|
|
82
|
+
"@aztec/pxe": "5.0.0",
|
|
83
|
+
"@aztec/stdlib": "5.0.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@aztec/noir-contracts.js": "5.0.0
|
|
86
|
+
"@aztec/noir-contracts.js": "5.0.0",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/node": "^22.15.17",
|
|
@@ -41,12 +41,7 @@ import {
|
|
|
41
41
|
} from '@aztec/stdlib/abi';
|
|
42
42
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
43
43
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
44
|
-
import {
|
|
45
|
-
type ContractInstanceWithAddress,
|
|
46
|
-
type NodeInfo,
|
|
47
|
-
computePartialAddress,
|
|
48
|
-
getContractClassFromArtifact,
|
|
49
|
-
} from '@aztec/stdlib/contract';
|
|
44
|
+
import { type ContractInstancePreimage, type NodeInfo, computePartialAddress } from '@aztec/stdlib/contract';
|
|
50
45
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
51
46
|
import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
|
|
52
47
|
import {
|
|
@@ -54,6 +49,7 @@ import {
|
|
|
54
49
|
computeSiloedPublicInitializationNullifier,
|
|
55
50
|
} from '@aztec/stdlib/hash';
|
|
56
51
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
52
|
+
import { type MasterSecretKeys, deriveKeys, deriveKeysFromMasterSecretKeys } from '@aztec/stdlib/keys';
|
|
57
53
|
import {
|
|
58
54
|
BlockHeader,
|
|
59
55
|
ExecutionPayload,
|
|
@@ -115,6 +111,9 @@ export type CompleteFeeOptionsConfig = {
|
|
|
115
111
|
export abstract class BaseWallet implements Wallet {
|
|
116
112
|
protected minFeePadding = 0.5;
|
|
117
113
|
protected cancellableTransactions = false;
|
|
114
|
+
// Poll interval (in seconds) injected into sendTx waits when the caller does not specify one. Left undefined on
|
|
115
|
+
// production wallets so the DefaultWaitOpts 1s cadence stands; test wallets talking to in-process nodes lower it.
|
|
116
|
+
protected defaultWaitInterval?: number;
|
|
118
117
|
// A wallet is instantiated for a particular chain, so chain info never changes during its lifetime.
|
|
119
118
|
// We cache it here because getChainInfo is called frequently (every tx simulation, send, auth wit, etc.).
|
|
120
119
|
private nodeInfoPromise: Promise<NodeInfo> | undefined;
|
|
@@ -129,7 +128,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
129
128
|
protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes: AztecAddress[] = []): AztecAddress[] {
|
|
130
129
|
const allScopes = from === NO_FROM ? additionalScopes : [from, ...additionalScopes];
|
|
131
130
|
const scopeSet = new Set(allScopes.map(address => address.toString()));
|
|
132
|
-
return [...scopeSet].map(AztecAddress.
|
|
131
|
+
return [...scopeSet].map(AztecAddress.fromStringUnsafe);
|
|
133
132
|
}
|
|
134
133
|
|
|
135
134
|
/**
|
|
@@ -155,8 +154,8 @@ export abstract class BaseWallet implements Wallet {
|
|
|
155
154
|
* @returns The aliased collection of AztecAddresses that form this wallet's address book
|
|
156
155
|
*/
|
|
157
156
|
async getAddressBook(): Promise<Aliased<AztecAddress>[]> {
|
|
158
|
-
const
|
|
159
|
-
return
|
|
157
|
+
const sources = await this.pxe.getTaggingSecretSources({ kind: 'address-derived' });
|
|
158
|
+
return sources.map(source => ({ item: source.sender, alias: '' }));
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
/**
|
|
@@ -346,46 +345,42 @@ export abstract class BaseWallet implements Wallet {
|
|
|
346
345
|
}
|
|
347
346
|
}
|
|
348
347
|
|
|
349
|
-
registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
|
|
350
|
-
|
|
348
|
+
async registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
|
|
349
|
+
await this.pxe.registerTaggingSecretSource({ kind: 'address-derived', sender: address });
|
|
350
|
+
return address;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
async registerContract(
|
|
354
|
-
instance:
|
|
354
|
+
instance: ContractInstancePreimage,
|
|
355
355
|
artifact?: ContractArtifact,
|
|
356
|
-
|
|
357
|
-
): Promise<
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const thisContractClass = await getContractClassFromArtifact(artifact);
|
|
364
|
-
if (!thisContractClass.id.equals(existingInstance.currentContractClassId)) {
|
|
365
|
-
// wallet holds an outdated version of this contract
|
|
366
|
-
await this.pxe.updateContract(instance.address, artifact);
|
|
367
|
-
instance.currentContractClassId = thisContractClass.id;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
// If no artifact provided, we just use the existing registration
|
|
371
|
-
} else {
|
|
372
|
-
// Instance not registered yet
|
|
373
|
-
if (!artifact) {
|
|
374
|
-
// Try to get the artifact from the wallet's contract class storage
|
|
375
|
-
artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
|
|
376
|
-
if (!artifact) {
|
|
377
|
-
throw new Error(
|
|
378
|
-
`Cannot register contract at ${instance.address.toString()}: artifact is required but not provided, and wallet does not have the artifact for contract class ${instance.currentContractClassId.toString()}`,
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
await this.pxe.registerContract({ artifact, instance });
|
|
356
|
+
secretKeyOrKeys?: Fr | MasterSecretKeys,
|
|
357
|
+
): Promise<void> {
|
|
358
|
+
// Classes and instances are registered independently: register the artifact (if provided) then the instance.
|
|
359
|
+
// Neither call validates that the artifact matches the class the instance runs, a missing artifact only surfaces
|
|
360
|
+
// when the contract is later simulated.
|
|
361
|
+
if (artifact) {
|
|
362
|
+
await this.pxe.registerContractClass(artifact);
|
|
383
363
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
364
|
+
const contractAddress = await this.pxe.registerContract(instance);
|
|
365
|
+
|
|
366
|
+
if (secretKeyOrKeys) {
|
|
367
|
+
// PXE never receives the account seed (from which the message-signing/fallback secret keys could be re-derived):
|
|
368
|
+
// the wallet derives the keys here. Of these, PXE only reads and stores the four privacy secret keys and the
|
|
369
|
+
// message-signing and fallback *public* keys — it never touches the message-signing or fallback secret keys.
|
|
370
|
+
//
|
|
371
|
+
// Since PXE recomputes the address from those keys, we assert it matches the instance's address: a mismatch means
|
|
372
|
+
// the provided keys don't correspond to this account.
|
|
373
|
+
const derivedKeys =
|
|
374
|
+
secretKeyOrKeys instanceof Fr
|
|
375
|
+
? await deriveKeys(secretKeyOrKeys)
|
|
376
|
+
: await deriveKeysFromMasterSecretKeys(secretKeyOrKeys);
|
|
377
|
+
const { address } = await this.pxe.registerAccount(derivedKeys, await computePartialAddress(instance));
|
|
378
|
+
if (!address.equals(contractAddress)) {
|
|
379
|
+
throw new Error(
|
|
380
|
+
`Registered account address ${address.toString()} does not match contract instance address ${contractAddress.toString()}: the provided keys do not correspond to this account.`,
|
|
381
|
+
);
|
|
382
|
+
}
|
|
387
383
|
}
|
|
388
|
-
return instance;
|
|
389
384
|
}
|
|
390
385
|
|
|
391
386
|
registerContractClass(artifact: ContractArtifact): Promise<void> {
|
|
@@ -544,7 +539,11 @@ export abstract class BaseWallet implements Wallet {
|
|
|
544
539
|
}
|
|
545
540
|
|
|
546
541
|
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
547
|
-
const
|
|
542
|
+
const callerWaitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
543
|
+
const waitOpts =
|
|
544
|
+
this.defaultWaitInterval !== undefined && callerWaitOpts?.interval === undefined
|
|
545
|
+
? { ...callerWaitOpts, interval: this.defaultWaitInterval }
|
|
546
|
+
: callerWaitOpts;
|
|
548
547
|
const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
|
|
549
548
|
|
|
550
549
|
// Display debug logs from public execution if present (served in test mode only)
|
|
@@ -564,7 +563,11 @@ export abstract class BaseWallet implements Wallet {
|
|
|
564
563
|
if (!instance) {
|
|
565
564
|
return undefined;
|
|
566
565
|
}
|
|
567
|
-
|
|
566
|
+
// Contract names are class-stable (an upgrade preserves the contract name), so the original class artifact is a
|
|
567
|
+
// sufficient source for the display name without resolving the current class against the node.
|
|
568
|
+
// TODO: if a contract were to be upgraded and its original artifact never registered, then this would fail and we'd
|
|
569
|
+
// want to fallback to the current class.
|
|
570
|
+
const artifact = await this.pxe.getContractArtifact(instance.originalContractClassId);
|
|
568
571
|
return artifact?.name;
|
|
569
572
|
}
|
|
570
573
|
|