@aztec/wallet-sdk 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928
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 +157 -0
- package/dest/base-wallet/base_wallet.d.ts +79 -42
- package/dest/base-wallet/base_wallet.d.ts.map +1 -1
- package/dest/base-wallet/base_wallet.js +268 -120
- package/dest/base-wallet/get_gas_limits.d.ts +36 -0
- package/dest/base-wallet/get_gas_limits.d.ts.map +1 -0
- package/dest/base-wallet/get_gas_limits.js +55 -0
- package/dest/base-wallet/index.d.ts +3 -2
- package/dest/base-wallet/index.d.ts.map +1 -1
- package/dest/base-wallet/index.js +1 -0
- package/dest/base-wallet/utils.d.ts +7 -4
- package/dest/base-wallet/utils.d.ts.map +1 -1
- package/dest/base-wallet/utils.js +11 -5
- package/dest/crypto.d.ts +39 -1
- package/dest/crypto.d.ts.map +1 -1
- package/dest/crypto.js +88 -0
- package/dest/extension/handlers/background_connection_handler.d.ts +12 -2
- package/dest/extension/handlers/background_connection_handler.d.ts.map +1 -1
- package/dest/extension/handlers/background_connection_handler.js +44 -8
- package/dest/extension/handlers/content_script_connection_handler.d.ts +2 -1
- package/dest/extension/handlers/content_script_connection_handler.d.ts.map +1 -1
- package/dest/extension/handlers/content_script_connection_handler.js +19 -0
- package/dest/extension/handlers/internal_message_types.d.ts +3 -1
- package/dest/extension/handlers/internal_message_types.d.ts.map +1 -1
- package/dest/extension/handlers/internal_message_types.js +3 -1
- package/dest/extension/provider/extension_wallet.d.ts +26 -6
- package/dest/extension/provider/extension_wallet.d.ts.map +1 -1
- package/dest/extension/provider/extension_wallet.js +80 -9
- package/dest/extension/provider/index.d.ts +2 -2
- package/dest/extension/provider/index.d.ts.map +1 -1
- package/dest/iframe/handlers/iframe_connection_handler.d.ts +122 -0
- package/dest/iframe/handlers/iframe_connection_handler.d.ts.map +1 -0
- package/dest/iframe/handlers/iframe_connection_handler.js +239 -0
- package/dest/iframe/handlers/index.d.ts +2 -0
- package/dest/iframe/handlers/index.d.ts.map +1 -0
- package/dest/iframe/handlers/index.js +1 -0
- package/dest/iframe/provider/iframe_discovery.d.ts +25 -0
- package/dest/iframe/provider/iframe_discovery.d.ts.map +1 -0
- package/dest/iframe/provider/iframe_discovery.js +167 -0
- package/dest/iframe/provider/iframe_provider.d.ts +65 -0
- package/dest/iframe/provider/iframe_provider.d.ts.map +1 -0
- package/dest/iframe/provider/iframe_provider.js +257 -0
- package/dest/iframe/provider/iframe_wallet.d.ts +85 -0
- package/dest/iframe/provider/iframe_wallet.d.ts.map +1 -0
- package/dest/iframe/provider/iframe_wallet.js +269 -0
- package/dest/iframe/provider/index.d.ts +4 -0
- package/dest/iframe/provider/index.d.ts.map +1 -0
- package/dest/iframe/provider/index.js +3 -0
- package/dest/manager/types.d.ts +3 -2
- package/dest/manager/types.d.ts.map +1 -1
- package/dest/manager/wallet_manager.d.ts +1 -1
- package/dest/manager/wallet_manager.d.ts.map +1 -1
- package/dest/manager/wallet_manager.js +46 -16
- package/dest/types.d.ts +64 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/types.js +29 -0
- package/package.json +12 -8
- package/src/base-wallet/base_wallet.ts +346 -175
- package/src/base-wallet/get_gas_limits.ts +88 -0
- package/src/base-wallet/index.ts +7 -1
- package/src/base-wallet/utils.ts +15 -5
- package/src/crypto.ts +104 -0
- package/src/extension/handlers/background_connection_handler.ts +42 -9
- package/src/extension/handlers/content_script_connection_handler.ts +18 -0
- package/src/extension/handlers/internal_message_types.ts +2 -0
- package/src/extension/provider/extension_wallet.ts +94 -13
- package/src/extension/provider/index.ts +1 -1
- package/src/iframe/handlers/iframe_connection_handler.ts +341 -0
- package/src/iframe/handlers/index.ts +7 -0
- package/src/iframe/provider/iframe_discovery.ts +185 -0
- package/src/iframe/provider/iframe_provider.ts +331 -0
- package/src/iframe/provider/iframe_wallet.ts +323 -0
- package/src/iframe/provider/index.ts +3 -0
- package/src/manager/types.ts +2 -1
- package/src/manager/wallet_manager.ts +48 -14
- package/src/types.ts +72 -0
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import type { Account } from '@aztec/aztec.js/account';
|
|
1
|
+
import type { Account, NoFrom } from '@aztec/aztec.js/account';
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
3
|
import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
|
|
3
4
|
import {
|
|
5
|
+
DefaultWaitOpts,
|
|
4
6
|
type InteractionWaitOptions,
|
|
5
7
|
NO_WAIT,
|
|
6
8
|
type SendReturn,
|
|
9
|
+
type WaitOpts,
|
|
7
10
|
extractOffchainOutput,
|
|
8
11
|
} from '@aztec/aztec.js/contracts';
|
|
9
12
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
10
13
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
11
|
-
import type {
|
|
12
|
-
Aliased,
|
|
13
|
-
AppCapabilities,
|
|
14
|
-
BatchResults,
|
|
15
|
-
BatchedMethod,
|
|
16
|
-
ExecuteUtilityOptions,
|
|
17
|
-
PrivateEvent,
|
|
18
|
-
PrivateEventFilter,
|
|
19
|
-
ProfileOptions,
|
|
20
|
-
SendOptions,
|
|
21
|
-
SimulateOptions,
|
|
22
|
-
Wallet,
|
|
23
|
-
WalletCapabilities,
|
|
24
|
-
} from '@aztec/aztec.js/wallet';
|
|
25
14
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
type Aliased,
|
|
16
|
+
type AppCapabilities,
|
|
17
|
+
type BatchResults,
|
|
18
|
+
type BatchedMethod,
|
|
19
|
+
ContractInitializationStatus,
|
|
20
|
+
type ExecuteUtilityOptions,
|
|
21
|
+
type PrivateEvent,
|
|
22
|
+
type PrivateEventFilter,
|
|
23
|
+
type ProfileOptions,
|
|
24
|
+
type SendOptions,
|
|
25
|
+
type SimulateOptions,
|
|
26
|
+
TxSimulationResultWithAppOffset,
|
|
27
|
+
type Wallet,
|
|
28
|
+
type WalletCapabilities,
|
|
29
|
+
} from '@aztec/aztec.js/wallet';
|
|
31
30
|
import { AccountFeePaymentMethodOptions, type DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
31
|
+
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
32
32
|
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
33
33
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
34
34
|
import { createLogger } from '@aztec/foundation/log';
|
|
35
35
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
36
|
-
import {
|
|
36
|
+
import { displayDebugLogs } from '@aztec/pxe/client/lazy';
|
|
37
37
|
import type { PXE, PackedPrivateEvent } from '@aztec/pxe/server';
|
|
38
38
|
import {
|
|
39
39
|
type ContractArtifact,
|
|
@@ -43,26 +43,27 @@ import {
|
|
|
43
43
|
} from '@aztec/stdlib/abi';
|
|
44
44
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
45
45
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
46
|
-
import {
|
|
47
|
-
type ContractInstanceWithAddress,
|
|
48
|
-
computePartialAddress,
|
|
49
|
-
getContractClassFromArtifact,
|
|
50
|
-
} from '@aztec/stdlib/contract';
|
|
46
|
+
import { type ContractInstancePreimage, type NodeInfo, computePartialAddress } from '@aztec/stdlib/contract';
|
|
51
47
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
52
|
-
import { Gas, GasSettings } from '@aztec/stdlib/gas';
|
|
53
|
-
import {
|
|
48
|
+
import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
|
|
49
|
+
import {
|
|
50
|
+
computeSiloedPrivateInitializationNullifier,
|
|
51
|
+
computeSiloedPublicInitializationNullifier,
|
|
52
|
+
} from '@aztec/stdlib/hash';
|
|
54
53
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
54
|
+
import { type MasterSecretKeys, deriveKeys, deriveKeysFromMasterSecretKeys } from '@aztec/stdlib/keys';
|
|
55
55
|
import {
|
|
56
56
|
BlockHeader,
|
|
57
|
+
ExecutionPayload,
|
|
57
58
|
type TxExecutionRequest,
|
|
58
59
|
type TxProfileResult,
|
|
59
|
-
TxSimulationResult,
|
|
60
60
|
type UtilityExecutionResult,
|
|
61
|
+
mergeExecutionPayloads,
|
|
61
62
|
} from '@aztec/stdlib/tx';
|
|
62
|
-
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
63
63
|
|
|
64
64
|
import { inspect } from 'util';
|
|
65
65
|
|
|
66
|
+
import { assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
|
|
66
67
|
import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simulateViaNode } from './utils.js';
|
|
67
68
|
|
|
68
69
|
/**
|
|
@@ -75,17 +76,49 @@ export type FeeOptions = {
|
|
|
75
76
|
*/
|
|
76
77
|
walletFeePaymentMethod?: FeePaymentMethod;
|
|
77
78
|
/** Configuration options for the account to properly handle the selected fee payment method */
|
|
78
|
-
accountFeePaymentMethodOptions
|
|
79
|
+
accountFeePaymentMethodOptions?: AccountFeePaymentMethodOptions;
|
|
79
80
|
/** The gas settings to use for the transaction */
|
|
80
81
|
gasSettings: GasSettings;
|
|
81
82
|
};
|
|
82
83
|
|
|
84
|
+
/** Options for `simulateViaEntrypoint`. */
|
|
85
|
+
export type SimulateViaEntrypointOptions = Pick<
|
|
86
|
+
SimulateOptions,
|
|
87
|
+
'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs' | 'overrides'
|
|
88
|
+
> & {
|
|
89
|
+
/** Fee options for the entrypoint */
|
|
90
|
+
feeOptions: FeeOptions;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** Options for `completeFeeOptions`. */
|
|
94
|
+
export type CompleteFeeOptionsConfig = {
|
|
95
|
+
/** The address where the transaction is being sent from. */
|
|
96
|
+
from: AztecAddress | NoFrom;
|
|
97
|
+
/** The address paying for fees (if any fee payment method is embedded in the execution payload). */
|
|
98
|
+
feePayer?: AztecAddress;
|
|
99
|
+
/** User-provided partial gas settings. */
|
|
100
|
+
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
101
|
+
/** If true, returns gas settings with high gas limits for estimation. If false, uses fallback limits. */
|
|
102
|
+
forEstimation?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Assumed network congestion level for fee prediction. Controls how aggressively the wallet
|
|
105
|
+
* estimates future fees. Defaults to Limit (worst case) when not specified.
|
|
106
|
+
*/
|
|
107
|
+
congestionEstimate?: ManaUsageEstimate;
|
|
108
|
+
};
|
|
109
|
+
|
|
83
110
|
/**
|
|
84
111
|
* A base class for Wallet implementations
|
|
85
112
|
*/
|
|
86
113
|
export abstract class BaseWallet implements Wallet {
|
|
87
114
|
protected minFeePadding = 0.5;
|
|
88
115
|
protected cancellableTransactions = false;
|
|
116
|
+
// Poll interval (in seconds) injected into sendTx waits when the caller does not specify one. Left undefined on
|
|
117
|
+
// production wallets so the DefaultWaitOpts 1s cadence stands; test wallets talking to in-process nodes lower it.
|
|
118
|
+
protected defaultWaitInterval?: number;
|
|
119
|
+
// A wallet is instantiated for a particular chain, so chain info never changes during its lifetime.
|
|
120
|
+
// We cache it here because getChainInfo is called frequently (every tx simulation, send, auth wit, etc.).
|
|
121
|
+
private nodeInfoPromise: Promise<NodeInfo> | undefined;
|
|
89
122
|
|
|
90
123
|
// Protected because we want to force wallets to instantiate their own PXE.
|
|
91
124
|
protected constructor(
|
|
@@ -94,10 +127,28 @@ export abstract class BaseWallet implements Wallet {
|
|
|
94
127
|
protected log = createLogger('wallet-sdk:base_wallet'),
|
|
95
128
|
) {}
|
|
96
129
|
|
|
97
|
-
protected scopesFrom(
|
|
98
|
-
|
|
130
|
+
protected scopesFrom(
|
|
131
|
+
from: AztecAddress | NoFrom,
|
|
132
|
+
additionalScopes: AztecAddress[],
|
|
133
|
+
sendMessagesAs: AztecAddress | undefined,
|
|
134
|
+
): AztecAddress[] {
|
|
135
|
+
// The sendMessagesAs account must be in scope so that its tagging secrets can be accessed.
|
|
136
|
+
const tagSenderScopes = sendMessagesAs ? [sendMessagesAs] : [];
|
|
137
|
+
const baseScopes = from === NO_FROM ? [] : [from];
|
|
138
|
+
const allScopes = [...baseScopes, ...additionalScopes, ...tagSenderScopes];
|
|
99
139
|
const scopeSet = new Set(allScopes.map(address => address.toString()));
|
|
100
|
-
return [...scopeSet].map(AztecAddress.
|
|
140
|
+
return [...scopeSet].map(AztecAddress.fromStringUnsafe);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
|
|
145
|
+
* account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx using
|
|
146
|
+
* the wallet-supplied default sender will fail the "Sender for tags is not set" assertion.
|
|
147
|
+
* @param from - Tx sender, or `NO_FROM`.
|
|
148
|
+
* @param sendMessagesAs - Explicit override.
|
|
149
|
+
*/
|
|
150
|
+
protected senderForTagsFrom(from: AztecAddress | NoFrom, sendMessagesAs?: AztecAddress): AztecAddress | undefined {
|
|
151
|
+
return sendMessagesAs ?? (from === NO_FROM ? undefined : from);
|
|
101
152
|
}
|
|
102
153
|
|
|
103
154
|
protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
@@ -112,37 +163,71 @@ export abstract class BaseWallet implements Wallet {
|
|
|
112
163
|
* @returns The aliased collection of AztecAddresses that form this wallet's address book
|
|
113
164
|
*/
|
|
114
165
|
async getAddressBook(): Promise<Aliased<AztecAddress>[]> {
|
|
115
|
-
const
|
|
116
|
-
return
|
|
166
|
+
const sources = await this.pxe.getTaggingSecretSources({ kind: 'address-derived' });
|
|
167
|
+
return sources.map(source => ({ item: source.sender, alias: '' }));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Fetches and caches the node info for the wallet's lifetime, since a wallet talks to a single network and
|
|
172
|
+
* node info never changes. A rejected fetch clears the cache so the next call retries instead of replaying
|
|
173
|
+
* the cached rejection forever — important because the gas-limit fill-in and validation (run on every send)
|
|
174
|
+
* depend on it.
|
|
175
|
+
*/
|
|
176
|
+
private getNodeInfo(): Promise<NodeInfo> {
|
|
177
|
+
if (!this.nodeInfoPromise) {
|
|
178
|
+
this.nodeInfoPromise = this.aztecNode.getNodeInfo().catch(err => {
|
|
179
|
+
this.nodeInfoPromise = undefined;
|
|
180
|
+
throw err;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return this.nodeInfoPromise;
|
|
117
184
|
}
|
|
118
185
|
|
|
119
186
|
async getChainInfo(): Promise<ChainInfo> {
|
|
120
|
-
const { l1ChainId, rollupVersion } = await this.
|
|
187
|
+
const { l1ChainId, rollupVersion } = await this.getNodeInfo();
|
|
121
188
|
return { chainId: new Fr(l1ChainId), version: new Fr(rollupVersion) };
|
|
122
189
|
}
|
|
123
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Returns the maximum gas limits a single transaction may declare on this wallet's network (the
|
|
193
|
+
* node-advertised `txsLimits.gas`). Internal helper used to fill in default gas limits when sending a
|
|
194
|
+
* transaction without explicit limits, and to validate caller-provided limits before sending. Backed by
|
|
195
|
+
* the cached node info, since a wallet talks to a single network.
|
|
196
|
+
*/
|
|
197
|
+
protected async getMaxTxGasLimits(): Promise<Gas> {
|
|
198
|
+
const { txsLimits } = await this.getNodeInfo();
|
|
199
|
+
return new Gas(txsLimits.gas.daGas, txsLimits.gas.l2Gas);
|
|
200
|
+
}
|
|
201
|
+
|
|
124
202
|
protected async createTxExecutionRequestFromPayloadAndFee(
|
|
125
203
|
executionPayload: ExecutionPayload,
|
|
126
|
-
from: AztecAddress,
|
|
204
|
+
from: AztecAddress | NoFrom,
|
|
127
205
|
feeOptions: FeeOptions,
|
|
128
206
|
): Promise<TxExecutionRequest> {
|
|
129
207
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
130
|
-
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
131
|
-
txNonce: Fr.random(),
|
|
132
|
-
cancellable: this.cancellableTransactions,
|
|
133
|
-
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions,
|
|
134
|
-
};
|
|
135
208
|
const finalExecutionPayload = feeExecutionPayload
|
|
136
209
|
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
137
210
|
: executionPayload;
|
|
138
|
-
const fromAccount = await this.getAccountFromAddress(from);
|
|
139
211
|
const chainInfo = await this.getChainInfo();
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
chainInfo
|
|
144
|
-
|
|
145
|
-
|
|
212
|
+
|
|
213
|
+
if (from === NO_FROM) {
|
|
214
|
+
const entrypoint = new DefaultEntrypoint();
|
|
215
|
+
return entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
|
|
216
|
+
} else {
|
|
217
|
+
const fromAccount = await this.getAccountFromAddress(from);
|
|
218
|
+
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
219
|
+
txNonce: Fr.random(),
|
|
220
|
+
cancellable: this.cancellableTransactions,
|
|
221
|
+
// If from is an address, feeOptions include the way the account contract should handle the fee payment
|
|
222
|
+
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions!,
|
|
223
|
+
};
|
|
224
|
+
return fromAccount.createTxExecutionRequest(
|
|
225
|
+
finalExecutionPayload,
|
|
226
|
+
feeOptions.gasSettings,
|
|
227
|
+
chainInfo,
|
|
228
|
+
executionOptions,
|
|
229
|
+
);
|
|
230
|
+
}
|
|
146
231
|
}
|
|
147
232
|
|
|
148
233
|
public async createAuthWit(
|
|
@@ -191,31 +276,54 @@ export abstract class BaseWallet implements Wallet {
|
|
|
191
276
|
|
|
192
277
|
/**
|
|
193
278
|
* Completes partial user-provided fee options with wallet defaults.
|
|
194
|
-
* @param
|
|
195
|
-
* @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
|
|
196
|
-
* @param gasSettings - User-provided partial gas settings
|
|
197
|
-
* @returns - Complete fee options that can be used to create a transaction execution request
|
|
279
|
+
* @param config - Fee completion config.
|
|
198
280
|
*/
|
|
199
|
-
protected async completeFeeOptions(
|
|
200
|
-
from
|
|
201
|
-
feePayer?: AztecAddress,
|
|
202
|
-
gasSettings?: Partial<FieldsOf<GasSettings>>,
|
|
203
|
-
): Promise<FeeOptions> {
|
|
281
|
+
protected async completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions> {
|
|
282
|
+
const { from, feePayer, gasSettings, forEstimation, congestionEstimate } = config;
|
|
204
283
|
const maxFeesPerGas =
|
|
205
|
-
gasSettings?.maxFeesPerGas ?? (await this.
|
|
284
|
+
gasSettings?.maxFeesPerGas ?? (await this.getMinFees(congestionEstimate)).mul(1 + this.minFeePadding);
|
|
206
285
|
let accountFeePaymentMethodOptions;
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
if (
|
|
210
|
-
|
|
286
|
+
// If from is an address, we need to determine the appropriate fee payment method options for the
|
|
287
|
+
// account contract entrypoint to use
|
|
288
|
+
if (from !== NO_FROM) {
|
|
289
|
+
if (!feePayer) {
|
|
290
|
+
// The transaction does not include a fee payment method, so we set the flag
|
|
291
|
+
// for the account to use its fee juice balance
|
|
292
|
+
accountFeePaymentMethodOptions = AccountFeePaymentMethodOptions.PREEXISTING_FEE_JUICE;
|
|
293
|
+
} else {
|
|
294
|
+
// The transaction includes fee payment method, so we check if we are the fee payer for it
|
|
295
|
+
// (this can only happen if the embedded payment method is FeeJuiceWithClaim)
|
|
296
|
+
accountFeePaymentMethodOptions = from.equals(feePayer)
|
|
297
|
+
? AccountFeePaymentMethodOptions.FEE_JUICE_WITH_CLAIM
|
|
298
|
+
: AccountFeePaymentMethodOptions.EXTERNAL;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const gasSettingsOverrides = {
|
|
302
|
+
gasLimits: gasSettings?.gasLimits ? Gas.from(gasSettings.gasLimits) : undefined,
|
|
303
|
+
teardownGasLimits: gasSettings?.teardownGasLimits ? Gas.from(gasSettings.teardownGasLimits) : undefined,
|
|
304
|
+
maxFeesPerGas,
|
|
305
|
+
maxPriorityFeesPerGas: gasSettings?.maxPriorityFeesPerGas ?? GasFees.empty(),
|
|
306
|
+
};
|
|
307
|
+
// When estimating gas (simulation), use high limits so the simulation doesn't run out of gas.
|
|
308
|
+
// When sending for real without explicit limits, declare the most a single tx may use on this network
|
|
309
|
+
// (the node's per-tx admission limit), so the proposer does not skip the tx for over-declaring gas.
|
|
310
|
+
let fullGasSettings;
|
|
311
|
+
if (forEstimation) {
|
|
312
|
+
// Estimation deliberately uses very high internal limits and skips tx validation, so we do not
|
|
313
|
+
// validate against the network admission limit here.
|
|
314
|
+
fullGasSettings = GasSettings.forEstimation(gasSettingsOverrides);
|
|
211
315
|
} else {
|
|
212
|
-
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
316
|
+
const maxTxGasLimits = await this.getMaxTxGasLimits();
|
|
317
|
+
// If the caller declared explicit gas limits, reject them up front when they exceed the network's
|
|
318
|
+
// per-tx admission limit (mirroring the node's GasLimitsValidator). Otherwise fill in the limit.
|
|
319
|
+
if (gasSettingsOverrides.gasLimits) {
|
|
320
|
+
assertGasLimitsWithinNetworkLimits(gasSettingsOverrides.gasLimits, maxTxGasLimits);
|
|
321
|
+
}
|
|
322
|
+
fullGasSettings = GasSettings.fallback({
|
|
323
|
+
...gasSettingsOverrides,
|
|
324
|
+
gasLimits: gasSettingsOverrides.gasLimits ?? maxTxGasLimits,
|
|
325
|
+
});
|
|
217
326
|
}
|
|
218
|
-
const fullGasSettings: GasSettings = GasSettings.default({ ...gasSettings, maxFeesPerGas });
|
|
219
327
|
this.log.debug(`Using L2 gas settings`, fullGasSettings);
|
|
220
328
|
return {
|
|
221
329
|
gasSettings: fullGasSettings,
|
|
@@ -225,97 +333,104 @@ export abstract class BaseWallet implements Wallet {
|
|
|
225
333
|
}
|
|
226
334
|
|
|
227
335
|
/**
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* to
|
|
231
|
-
* @param from - The address where the transaction is being sent from
|
|
232
|
-
* @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
|
|
233
|
-
* @param gasSettings - User-provided partial gas settings
|
|
336
|
+
* Returns the worst-case min fee across predicted future slots.
|
|
337
|
+
* Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
|
|
338
|
+
* @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
|
|
234
339
|
*/
|
|
235
|
-
protected async
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
maxPriorityFeesPerGas,
|
|
251
|
-
);
|
|
252
|
-
return {
|
|
253
|
-
...defaultFeeOptions,
|
|
254
|
-
gasSettings: gasSettingsForEstimation,
|
|
255
|
-
};
|
|
340
|
+
protected async getMinFees(estimate: ManaUsageEstimate = ManaUsageEstimate.Limit): Promise<GasFees> {
|
|
341
|
+
try {
|
|
342
|
+
const predicted = await this.aztecNode.getPredictedMinFees(estimate);
|
|
343
|
+
if (predicted.length === 0) {
|
|
344
|
+
return this.aztecNode.getCurrentMinFees();
|
|
345
|
+
}
|
|
346
|
+
return predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst));
|
|
347
|
+
} catch (err: any) {
|
|
348
|
+
// Fallback for old nodes that don't support getPredictedMinFees.
|
|
349
|
+
// Only fall back on method-not-found errors (JSON-RPC code -32601); rethrow others.
|
|
350
|
+
if (err?.cause?.code === -32601 || err?.message?.includes('Method not found')) {
|
|
351
|
+
return this.aztecNode.getCurrentMinFees();
|
|
352
|
+
}
|
|
353
|
+
throw err;
|
|
354
|
+
}
|
|
256
355
|
}
|
|
257
356
|
|
|
258
|
-
registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
|
|
259
|
-
|
|
357
|
+
async registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
|
|
358
|
+
await this.pxe.registerTaggingSecretSource({ kind: 'address-derived', sender: address });
|
|
359
|
+
return address;
|
|
260
360
|
}
|
|
261
361
|
|
|
262
362
|
async registerContract(
|
|
263
|
-
instance:
|
|
363
|
+
instance: ContractInstancePreimage,
|
|
264
364
|
artifact?: ContractArtifact,
|
|
265
|
-
|
|
266
|
-
): Promise<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
365
|
+
secretKeyOrKeys?: Fr | MasterSecretKeys,
|
|
366
|
+
): Promise<void> {
|
|
367
|
+
// Classes and instances are registered independently: register the artifact (if provided) then the instance.
|
|
368
|
+
// Neither call validates that the artifact matches the class the instance runs, a missing artifact only surfaces
|
|
369
|
+
// when the contract is later simulated.
|
|
370
|
+
if (artifact) {
|
|
371
|
+
await this.pxe.registerContractClass(artifact);
|
|
372
|
+
}
|
|
373
|
+
const contractAddress = await this.pxe.registerContract(instance);
|
|
374
|
+
|
|
375
|
+
if (secretKeyOrKeys) {
|
|
376
|
+
// PXE never receives the account seed (from which the message-signing/fallback secret keys could be re-derived):
|
|
377
|
+
// the wallet derives the keys here. Of these, PXE only reads and stores the four privacy secret keys and the
|
|
378
|
+
// message-signing and fallback *public* keys — it never touches the message-signing or fallback secret keys.
|
|
379
|
+
//
|
|
380
|
+
// Since PXE recomputes the address from those keys, we assert it matches the instance's address: a mismatch means
|
|
381
|
+
// the provided keys don't correspond to this account.
|
|
382
|
+
const derivedKeys =
|
|
383
|
+
secretKeyOrKeys instanceof Fr
|
|
384
|
+
? await deriveKeys(secretKeyOrKeys)
|
|
385
|
+
: await deriveKeysFromMasterSecretKeys(secretKeyOrKeys);
|
|
386
|
+
const { address } = await this.pxe.registerAccount(derivedKeys, await computePartialAddress(instance));
|
|
387
|
+
if (!address.equals(contractAddress)) {
|
|
388
|
+
throw new Error(
|
|
389
|
+
`Registered account address ${address.toString()} does not match contract instance address ${contractAddress.toString()}: the provided keys do not correspond to this account.`,
|
|
390
|
+
);
|
|
290
391
|
}
|
|
291
|
-
await this.pxe.registerContract({ artifact, instance });
|
|
292
392
|
}
|
|
393
|
+
}
|
|
293
394
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
return instance;
|
|
395
|
+
registerContractClass(artifact: ContractArtifact): Promise<void> {
|
|
396
|
+
return this.pxe.registerContractClass(artifact);
|
|
298
397
|
}
|
|
299
398
|
|
|
300
399
|
/**
|
|
301
400
|
* Simulates calls through the standard PXE path (account entrypoint).
|
|
302
401
|
* @param executionPayload - The execution payload to simulate.
|
|
303
|
-
* @param
|
|
304
|
-
* @param feeOptions - Fee options for the transaction.
|
|
305
|
-
* @param skipTxValidation - Whether to skip tx validation.
|
|
306
|
-
* @param skipFeeEnforcement - Whether to skip fee enforcement.
|
|
307
|
-
* @param scopes - The scopes to use for the simulation.
|
|
402
|
+
* @param opts - Simulation options.
|
|
308
403
|
*/
|
|
309
|
-
protected async simulateViaEntrypoint(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
404
|
+
protected async simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions) {
|
|
405
|
+
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(
|
|
406
|
+
executionPayload,
|
|
407
|
+
opts.from,
|
|
408
|
+
opts.feeOptions,
|
|
409
|
+
);
|
|
410
|
+
const result = await this.pxe.simulateTx(txRequest, {
|
|
411
|
+
simulatePublic: true,
|
|
412
|
+
skipTxValidation: opts.skipTxValidation,
|
|
413
|
+
skipFeeEnforcement: opts.skipFeeEnforcement,
|
|
414
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes ?? [], opts.sendMessagesAs),
|
|
415
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
416
|
+
overrides: opts.overrides,
|
|
417
|
+
});
|
|
418
|
+
const appCallOffset = await this.computeAppCallOffset(opts.from, opts.feeOptions);
|
|
419
|
+
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Computes the index where the app's calls begin in the flattened array of calls (0 = entrypoint/root, 1..N = fee
|
|
424
|
+
* calls, N+1 = app).
|
|
425
|
+
* @param from - The sender address, or NO_FROM for the default entrypoint.
|
|
426
|
+
* @param feeOptions - Fee options containing the wallet fee payment method.
|
|
427
|
+
*/
|
|
428
|
+
protected async computeAppCallOffset(from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<number> {
|
|
429
|
+
if (from === NO_FROM) {
|
|
430
|
+
return 0;
|
|
431
|
+
}
|
|
432
|
+
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
433
|
+
return (feeExecutionPayload?.calls.length ?? 0) + 1; // +1 for entrypoint
|
|
319
434
|
}
|
|
320
435
|
|
|
321
436
|
/**
|
|
@@ -326,10 +441,17 @@ export abstract class BaseWallet implements Wallet {
|
|
|
326
441
|
* @param opts - Simulation options (from address, fee settings, etc.).
|
|
327
442
|
* @returns The merged simulation result.
|
|
328
443
|
*/
|
|
329
|
-
async simulateTx(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
444
|
+
async simulateTx(
|
|
445
|
+
executionPayload: ExecutionPayload,
|
|
446
|
+
opts: SimulateOptions,
|
|
447
|
+
): Promise<TxSimulationResultWithAppOffset> {
|
|
448
|
+
const feeOptions = await this.completeFeeOptions({
|
|
449
|
+
from: opts.from,
|
|
450
|
+
feePayer: executionPayload.feePayer,
|
|
451
|
+
gasSettings: opts.fee?.gasSettings,
|
|
452
|
+
forEstimation: true,
|
|
453
|
+
congestionEstimate: opts.fee?.congestionEstimate,
|
|
454
|
+
});
|
|
333
455
|
const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
|
|
334
456
|
const remainingPayload = { ...executionPayload, calls: remainingCalls };
|
|
335
457
|
|
|
@@ -340,31 +462,34 @@ export abstract class BaseWallet implements Wallet {
|
|
|
340
462
|
try {
|
|
341
463
|
blockHeader = await this.pxe.getSyncedBlockHeader();
|
|
342
464
|
} catch {
|
|
343
|
-
blockHeader = (await this.aztecNode.
|
|
465
|
+
blockHeader = (await this.aztecNode.getBlockData('latest'))!.header;
|
|
344
466
|
}
|
|
345
467
|
|
|
468
|
+
const simulationOrigin = opts.from === NO_FROM ? AztecAddress.ZERO : opts.from;
|
|
346
469
|
const [optimizedResults, normalResult] = await Promise.all([
|
|
347
470
|
optimizableCalls.length > 0
|
|
348
471
|
? simulateViaNode(
|
|
349
472
|
this.aztecNode,
|
|
350
473
|
optimizableCalls,
|
|
351
|
-
|
|
474
|
+
simulationOrigin,
|
|
352
475
|
chainInfo,
|
|
353
476
|
feeOptions.gasSettings,
|
|
354
477
|
blockHeader,
|
|
355
478
|
opts.skipFeeEnforcement ?? true,
|
|
356
479
|
this.getContractName.bind(this),
|
|
480
|
+
opts.overrides,
|
|
357
481
|
)
|
|
358
482
|
: Promise.resolve([]),
|
|
359
483
|
remainingCalls.length > 0
|
|
360
|
-
? this.simulateViaEntrypoint(
|
|
361
|
-
|
|
362
|
-
opts.from,
|
|
484
|
+
? this.simulateViaEntrypoint(remainingPayload, {
|
|
485
|
+
from: opts.from,
|
|
363
486
|
feeOptions,
|
|
364
|
-
|
|
365
|
-
opts.skipTxValidation,
|
|
366
|
-
opts.skipFeeEnforcement ?? true,
|
|
367
|
-
|
|
487
|
+
additionalScopes: opts.additionalScopes,
|
|
488
|
+
skipTxValidation: opts.skipTxValidation,
|
|
489
|
+
skipFeeEnforcement: opts.skipFeeEnforcement ?? true,
|
|
490
|
+
sendMessagesAs: opts.sendMessagesAs,
|
|
491
|
+
overrides: opts.overrides,
|
|
492
|
+
})
|
|
368
493
|
: Promise.resolve(null),
|
|
369
494
|
]);
|
|
370
495
|
|
|
@@ -372,12 +497,18 @@ export abstract class BaseWallet implements Wallet {
|
|
|
372
497
|
}
|
|
373
498
|
|
|
374
499
|
async profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult> {
|
|
375
|
-
const feeOptions = await this.completeFeeOptions(
|
|
500
|
+
const feeOptions = await this.completeFeeOptions({
|
|
501
|
+
from: opts.from,
|
|
502
|
+
feePayer: executionPayload.feePayer,
|
|
503
|
+
gasSettings: opts.fee?.gasSettings,
|
|
504
|
+
congestionEstimate: opts.fee?.congestionEstimate,
|
|
505
|
+
});
|
|
376
506
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
377
507
|
return this.pxe.profileTx(txRequest, {
|
|
378
508
|
profileMode: opts.profileMode,
|
|
379
509
|
skipProofGeneration: opts.skipProofGeneration ?? true,
|
|
380
|
-
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
510
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes ?? [], opts.sendMessagesAs),
|
|
511
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
381
512
|
});
|
|
382
513
|
}
|
|
383
514
|
|
|
@@ -385,15 +516,23 @@ export abstract class BaseWallet implements Wallet {
|
|
|
385
516
|
executionPayload: ExecutionPayload,
|
|
386
517
|
opts: SendOptions<W>,
|
|
387
518
|
): Promise<SendReturn<W>> {
|
|
388
|
-
const feeOptions = await this.completeFeeOptions(
|
|
519
|
+
const feeOptions = await this.completeFeeOptions({
|
|
520
|
+
from: opts.from,
|
|
521
|
+
feePayer: executionPayload.feePayer,
|
|
522
|
+
gasSettings: opts.fee?.gasSettings,
|
|
523
|
+
congestionEstimate: opts.fee?.congestionEstimate,
|
|
524
|
+
});
|
|
389
525
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
390
|
-
const provenTx = await this.pxe.proveTx(txRequest,
|
|
391
|
-
|
|
526
|
+
const provenTx = await this.pxe.proveTx(txRequest, {
|
|
527
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes ?? [], opts.sendMessagesAs),
|
|
528
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
529
|
+
});
|
|
530
|
+
const offchainOutput = extractOffchainOutput(
|
|
531
|
+
provenTx.getOffchainEffects(),
|
|
532
|
+
provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp,
|
|
533
|
+
);
|
|
392
534
|
const tx = await provenTx.toTx();
|
|
393
535
|
const txHash = tx.getTxHash();
|
|
394
|
-
if (await this.aztecNode.getTxEffect(txHash)) {
|
|
395
|
-
throw new Error(`A settled tx with equal hash ${txHash.toString()} exists.`);
|
|
396
|
-
}
|
|
397
536
|
this.log.debug(`Sending transaction ${txHash}`);
|
|
398
537
|
await this.aztecNode.sendTx(tx).catch(err => {
|
|
399
538
|
throw this.contextualizeError(err, inspect(tx));
|
|
@@ -406,11 +545,17 @@ export abstract class BaseWallet implements Wallet {
|
|
|
406
545
|
}
|
|
407
546
|
|
|
408
547
|
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
409
|
-
const
|
|
410
|
-
const
|
|
548
|
+
const callerWaitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
549
|
+
const waitOpts: WaitOpts | undefined =
|
|
550
|
+
this.defaultWaitInterval !== undefined && callerWaitOpts?.interval === undefined
|
|
551
|
+
? { ...callerWaitOpts, interval: this.defaultWaitInterval }
|
|
552
|
+
: callerWaitOpts;
|
|
553
|
+
// The tx was just sent, so an immediate first poll cannot find it mined; skip one poll interval up front.
|
|
554
|
+
const initialDelay = waitOpts?.initialDelay ?? waitOpts?.interval ?? DefaultWaitOpts.interval;
|
|
555
|
+
const receipt = await waitForTx(this.aztecNode, txHash, { ...waitOpts, initialDelay });
|
|
411
556
|
|
|
412
557
|
// Display debug logs from public execution if present (served in test mode only)
|
|
413
|
-
if (receipt.debugLogs?.length) {
|
|
558
|
+
if (receipt.isMined() && receipt.debugLogs?.length) {
|
|
414
559
|
await displayDebugLogs(receipt.debugLogs, this.getContractName.bind(this));
|
|
415
560
|
}
|
|
416
561
|
|
|
@@ -426,7 +571,11 @@ export abstract class BaseWallet implements Wallet {
|
|
|
426
571
|
if (!instance) {
|
|
427
572
|
return undefined;
|
|
428
573
|
}
|
|
429
|
-
|
|
574
|
+
// Contract names are class-stable (an upgrade preserves the contract name), so the original class artifact is a
|
|
575
|
+
// sufficient source for the display name without resolving the current class against the node.
|
|
576
|
+
// TODO: if a contract were to be upgraded and its original artifact never registered, then this would fail and we'd
|
|
577
|
+
// want to fallback to the current class.
|
|
578
|
+
const artifact = await this.pxe.getContractArtifact(instance.originalContractClassId);
|
|
430
579
|
return artifact?.name;
|
|
431
580
|
}
|
|
432
581
|
|
|
@@ -445,7 +594,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
445
594
|
}
|
|
446
595
|
|
|
447
596
|
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult> {
|
|
448
|
-
return this.pxe.executeUtility(call, { authwits: opts.authWitnesses, scopes:
|
|
597
|
+
return this.pxe.executeUtility(call, { authwits: opts.authWitnesses, scopes: opts.scopes });
|
|
449
598
|
}
|
|
450
599
|
|
|
451
600
|
async getPrivateEvents<T>(
|
|
@@ -468,17 +617,39 @@ export abstract class BaseWallet implements Wallet {
|
|
|
468
617
|
return decodedEvents;
|
|
469
618
|
}
|
|
470
619
|
|
|
620
|
+
/**
|
|
621
|
+
* Returns metadata about a contract, including whether it has been initialized, published, and updated.
|
|
622
|
+
* @param address - The contract address to query.
|
|
623
|
+
*/
|
|
471
624
|
async getContractMetadata(address: AztecAddress) {
|
|
472
625
|
const instance = await this.pxe.getContractInstance(address);
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
|
|
626
|
+
const publiclyRegisteredContractPromise = this.aztecNode.getContract(address);
|
|
627
|
+
|
|
628
|
+
let initializationStatus: ContractInitializationStatus;
|
|
629
|
+
if (instance) {
|
|
630
|
+
// We have the instance, so we can compute the private initialization nullifier (which includes init_hash and is
|
|
631
|
+
// emitted by both private and public initializers) and get a definitive INITIALIZED/UNINITIALIZED answer.
|
|
632
|
+
const initNullifier = await computeSiloedPrivateInitializationNullifier(address, instance.initializationHash);
|
|
633
|
+
const witness = await this.aztecNode.getNullifierMembershipWitness('latest', initNullifier);
|
|
634
|
+
initializationStatus = witness
|
|
635
|
+
? ContractInitializationStatus.INITIALIZED
|
|
636
|
+
: ContractInitializationStatus.UNINITIALIZED;
|
|
637
|
+
} else {
|
|
638
|
+
// Without the instance we lack the init_hash needed for the private nullifier. We fall back to checking the
|
|
639
|
+
// public initialization nullifier (computed from address alone). Not all contracts emit it (only those with
|
|
640
|
+
// public functions that require initialization checks), so its absence doesn't mean the contract is
|
|
641
|
+
// uninitialized.
|
|
642
|
+
const publicNullifier = await computeSiloedPublicInitializationNullifier(address);
|
|
643
|
+
const witness = await this.aztecNode.getNullifierMembershipWitness('latest', publicNullifier);
|
|
644
|
+
initializationStatus = witness ? ContractInitializationStatus.INITIALIZED : ContractInitializationStatus.UNKNOWN;
|
|
645
|
+
}
|
|
646
|
+
const publiclyRegisteredContract = await publiclyRegisteredContractPromise;
|
|
476
647
|
const isContractUpdated =
|
|
477
648
|
publiclyRegisteredContract &&
|
|
478
649
|
!publiclyRegisteredContract.currentContractClassId.equals(publiclyRegisteredContract.originalContractClassId);
|
|
479
650
|
return {
|
|
480
651
|
instance: instance ?? undefined,
|
|
481
|
-
|
|
652
|
+
initializationStatus,
|
|
482
653
|
isContractPublished: !!publiclyRegisteredContract,
|
|
483
654
|
isContractUpdated: !!isContractUpdated,
|
|
484
655
|
updatedContractClassId: isContractUpdated ? publiclyRegisteredContract.currentContractClassId : undefined,
|