@aztec/wallet-sdk 0.0.1-commit.5914bae → 0.0.1-commit.59a0419c6
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.
|
@@ -12,10 +12,9 @@ import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall
|
|
|
12
12
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
13
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
14
|
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
15
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
15
|
+
import { GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
|
|
16
16
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
17
|
-
import { type TxExecutionRequest, type TxProfileResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
18
|
-
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
17
|
+
import { ExecutionPayload, type TxExecutionRequest, type TxProfileResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
19
18
|
/**
|
|
20
19
|
* Options to configure fee payment for a transaction
|
|
21
20
|
*/
|
|
@@ -31,7 +30,7 @@ export type FeeOptions = {
|
|
|
31
30
|
gasSettings: GasSettings;
|
|
32
31
|
};
|
|
33
32
|
/** Options for `simulateViaEntrypoint`. */
|
|
34
|
-
export type SimulateViaEntrypointOptions = Pick<SimulateOptions, 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement'> & {
|
|
33
|
+
export type SimulateViaEntrypointOptions = Pick<SimulateOptions, 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs'> & {
|
|
35
34
|
/** Fee options for the entrypoint */
|
|
36
35
|
feeOptions: FeeOptions;
|
|
37
36
|
};
|
|
@@ -45,6 +44,11 @@ export type CompleteFeeOptionsConfig = {
|
|
|
45
44
|
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
46
45
|
/** If true, returns gas settings with high gas limits for estimation. If false, uses fallback limits. */
|
|
47
46
|
forEstimation?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Assumed network congestion level for fee prediction. Controls how aggressively the wallet
|
|
49
|
+
* estimates future fees. Defaults to Limit (worst case) when not specified.
|
|
50
|
+
*/
|
|
51
|
+
congestionEstimate?: ManaUsageEstimate;
|
|
48
52
|
};
|
|
49
53
|
/**
|
|
50
54
|
* A base class for Wallet implementations
|
|
@@ -58,6 +62,14 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
58
62
|
private nodeInfoPromise;
|
|
59
63
|
protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
|
|
60
64
|
protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes?: AztecAddress[]): AztecAddress[];
|
|
65
|
+
/**
|
|
66
|
+
* Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
|
|
67
|
+
* account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx will fail
|
|
68
|
+
* the contract-side `Sender for tags is not set` assertion unless `set_sender_for_tags` is called first.
|
|
69
|
+
* @param from - Tx sender, or `NO_FROM`.
|
|
70
|
+
* @param sendMessagesAs - Explicit override.
|
|
71
|
+
*/
|
|
72
|
+
protected senderForTagsFrom(from: AztecAddress | NoFrom, sendMessagesAs?: AztecAddress): AztecAddress | undefined;
|
|
61
73
|
protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
62
74
|
abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
63
75
|
/**
|
|
@@ -91,6 +103,12 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
91
103
|
* @param config - Fee completion config.
|
|
92
104
|
*/
|
|
93
105
|
protected completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions>;
|
|
106
|
+
/**
|
|
107
|
+
* Returns the worst-case min fee across predicted future slots.
|
|
108
|
+
* Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
|
|
109
|
+
* @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
|
|
110
|
+
*/
|
|
111
|
+
protected getMinFees(estimate?: ManaUsageEstimate): Promise<GasFees>;
|
|
94
112
|
registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
|
|
95
113
|
registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
|
|
96
114
|
/**
|
|
@@ -141,4 +159,4 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
141
159
|
isContractClassPubliclyRegistered: boolean;
|
|
142
160
|
}>;
|
|
143
161
|
}
|
|
144
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
162
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLGVBQWUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2pGLE9BQU8sRUFDTCxLQUFLLHNCQUFzQixFQUUzQixLQUFLLFVBQVUsRUFFaEIsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTVELE9BQU8sRUFDTCxLQUFLLE9BQU8sRUFDWixLQUFLLGVBQWUsRUFDcEIsS0FBSyxZQUFZLEVBQ2pCLEtBQUssYUFBYSxFQUNsQiw0QkFBNEIsRUFDNUIsS0FBSyx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AAS,sBAAsB,GAAG,SAAS,EAC9D,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA0CxB;IAED;;;OAGG;IACH,UAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAOlF;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"}
|
|
@@ -11,7 +11,7 @@ import { decodeFromAbi } from '@aztec/stdlib/abi';
|
|
|
11
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
12
|
import { computePartialAddress, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
13
13
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
14
|
-
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
14
|
+
import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
|
|
15
15
|
import { computeSiloedPrivateInitializationNullifier, computeSiloedPublicInitializationNullifier } from '@aztec/stdlib/hash';
|
|
16
16
|
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
17
17
|
import { inspect } from 'util';
|
|
@@ -46,6 +46,15 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
46
46
|
].map(AztecAddress.fromString);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
+
* Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
|
|
50
|
+
* account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx will fail
|
|
51
|
+
* the contract-side `Sender for tags is not set` assertion unless `set_sender_for_tags` is called first.
|
|
52
|
+
* @param from - Tx sender, or `NO_FROM`.
|
|
53
|
+
* @param sendMessagesAs - Explicit override.
|
|
54
|
+
*/ senderForTagsFrom(from, sendMessagesAs) {
|
|
55
|
+
return sendMessagesAs ?? (from === NO_FROM ? undefined : from);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
49
58
|
* Returns the list of aliased contacts associated with the wallet.
|
|
50
59
|
* This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
|
|
51
60
|
* - Senders: Addresses we check during synching in case they sent us notes,
|
|
@@ -132,8 +141,8 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
132
141
|
* Completes partial user-provided fee options with wallet defaults.
|
|
133
142
|
* @param config - Fee completion config.
|
|
134
143
|
*/ async completeFeeOptions(config) {
|
|
135
|
-
const { from, feePayer, gasSettings, forEstimation } = config;
|
|
136
|
-
const maxFeesPerGas = gasSettings?.maxFeesPerGas ?? (await this.
|
|
144
|
+
const { from, feePayer, gasSettings, forEstimation, congestionEstimate } = config;
|
|
145
|
+
const maxFeesPerGas = gasSettings?.maxFeesPerGas ?? (await this.getMinFees(congestionEstimate)).mul(1 + this.minFeePadding);
|
|
137
146
|
let accountFeePaymentMethodOptions;
|
|
138
147
|
// If from is an address, we need to determine the appropriate fee payment method options for the
|
|
139
148
|
// account contract entrypoint to use
|
|
@@ -164,6 +173,26 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
164
173
|
accountFeePaymentMethodOptions
|
|
165
174
|
};
|
|
166
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Returns the worst-case min fee across predicted future slots.
|
|
178
|
+
* Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
|
|
179
|
+
* @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
|
|
180
|
+
*/ async getMinFees(estimate = ManaUsageEstimate.Limit) {
|
|
181
|
+
try {
|
|
182
|
+
const predicted = await this.aztecNode.getPredictedMinFees(estimate);
|
|
183
|
+
if (predicted.length === 0) {
|
|
184
|
+
return this.aztecNode.getCurrentMinFees();
|
|
185
|
+
}
|
|
186
|
+
return predicted.reduce((worst, fees)=>fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst);
|
|
187
|
+
} catch (err) {
|
|
188
|
+
// Fallback for old nodes that don't support getPredictedMinFees.
|
|
189
|
+
// Only fall back on method-not-found errors (JSON-RPC code -32601); rethrow others.
|
|
190
|
+
if (err?.cause?.code === -32601 || err?.message?.includes('Method not found')) {
|
|
191
|
+
return this.aztecNode.getCurrentMinFees();
|
|
192
|
+
}
|
|
193
|
+
throw err;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
167
196
|
registerSender(address, _alias = '') {
|
|
168
197
|
return this.pxe.registerSender(address);
|
|
169
198
|
}
|
|
@@ -209,7 +238,8 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
209
238
|
simulatePublic: true,
|
|
210
239
|
skipTxValidation: opts.skipTxValidation,
|
|
211
240
|
skipFeeEnforcement: opts.skipFeeEnforcement,
|
|
212
|
-
scopes: this.scopesFrom(opts.from, opts.additionalScopes)
|
|
241
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
242
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
|
|
213
243
|
});
|
|
214
244
|
const appCallOffset = await this.computeAppCallOffset(opts.from, opts.feeOptions);
|
|
215
245
|
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
@@ -238,7 +268,8 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
238
268
|
from: opts.from,
|
|
239
269
|
feePayer: executionPayload.feePayer,
|
|
240
270
|
gasSettings: opts.fee?.gasSettings,
|
|
241
|
-
forEstimation: true
|
|
271
|
+
forEstimation: true,
|
|
272
|
+
congestionEstimate: opts.fee?.congestionEstimate
|
|
242
273
|
});
|
|
243
274
|
const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
|
|
244
275
|
const remainingPayload = {
|
|
@@ -262,7 +293,8 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
262
293
|
feeOptions,
|
|
263
294
|
additionalScopes: opts.additionalScopes,
|
|
264
295
|
skipTxValidation: opts.skipTxValidation,
|
|
265
|
-
skipFeeEnforcement: opts.skipFeeEnforcement ?? true
|
|
296
|
+
skipFeeEnforcement: opts.skipFeeEnforcement ?? true,
|
|
297
|
+
sendMessagesAs: opts.sendMessagesAs
|
|
266
298
|
}) : Promise.resolve(null)
|
|
267
299
|
]);
|
|
268
300
|
return buildMergedSimulationResult(optimizedResults, normalResult);
|
|
@@ -271,23 +303,29 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
271
303
|
const feeOptions = await this.completeFeeOptions({
|
|
272
304
|
from: opts.from,
|
|
273
305
|
feePayer: executionPayload.feePayer,
|
|
274
|
-
gasSettings: opts.fee?.gasSettings
|
|
306
|
+
gasSettings: opts.fee?.gasSettings,
|
|
307
|
+
congestionEstimate: opts.fee?.congestionEstimate
|
|
275
308
|
});
|
|
276
309
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
277
310
|
return this.pxe.profileTx(txRequest, {
|
|
278
311
|
profileMode: opts.profileMode,
|
|
279
312
|
skipProofGeneration: opts.skipProofGeneration ?? true,
|
|
280
|
-
scopes: this.scopesFrom(opts.from, opts.additionalScopes)
|
|
313
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
314
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
|
|
281
315
|
});
|
|
282
316
|
}
|
|
283
317
|
async sendTx(executionPayload, opts) {
|
|
284
318
|
const feeOptions = await this.completeFeeOptions({
|
|
285
319
|
from: opts.from,
|
|
286
320
|
feePayer: executionPayload.feePayer,
|
|
287
|
-
gasSettings: opts.fee?.gasSettings
|
|
321
|
+
gasSettings: opts.fee?.gasSettings,
|
|
322
|
+
congestionEstimate: opts.fee?.congestionEstimate
|
|
288
323
|
});
|
|
289
324
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
290
|
-
const provenTx = await this.pxe.proveTx(txRequest,
|
|
325
|
+
const provenTx = await this.pxe.proveTx(txRequest, {
|
|
326
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
327
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
|
|
328
|
+
});
|
|
291
329
|
const offchainOutput = extractOffchainOutput(provenTx.getOffchainEffects(), provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp);
|
|
292
330
|
const tx = await provenTx.toTx();
|
|
293
331
|
const txHash = tx.getTxHash();
|
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": "0.0.1-commit.
|
|
4
|
+
"version": "0.0.1-commit.59a0419c6",
|
|
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": "0.0.1-commit.
|
|
79
|
-
"@aztec/constants": "0.0.1-commit.
|
|
80
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
81
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
82
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
83
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
78
|
+
"@aztec/aztec.js": "0.0.1-commit.59a0419c6",
|
|
79
|
+
"@aztec/constants": "0.0.1-commit.59a0419c6",
|
|
80
|
+
"@aztec/entrypoints": "0.0.1-commit.59a0419c6",
|
|
81
|
+
"@aztec/foundation": "0.0.1-commit.59a0419c6",
|
|
82
|
+
"@aztec/pxe": "0.0.1-commit.59a0419c6",
|
|
83
|
+
"@aztec/stdlib": "0.0.1-commit.59a0419c6"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
86
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.59a0419c6",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/node": "^22.15.17",
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
getContractClassFromArtifact,
|
|
49
49
|
} from '@aztec/stdlib/contract';
|
|
50
50
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
51
|
-
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
51
|
+
import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
|
|
52
52
|
import {
|
|
53
53
|
computeSiloedPrivateInitializationNullifier,
|
|
54
54
|
computeSiloedPublicInitializationNullifier,
|
|
@@ -56,11 +56,12 @@ import {
|
|
|
56
56
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
57
57
|
import {
|
|
58
58
|
BlockHeader,
|
|
59
|
+
ExecutionPayload,
|
|
59
60
|
type TxExecutionRequest,
|
|
60
61
|
type TxProfileResult,
|
|
61
62
|
type UtilityExecutionResult,
|
|
63
|
+
mergeExecutionPayloads,
|
|
62
64
|
} from '@aztec/stdlib/tx';
|
|
63
|
-
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
64
65
|
|
|
65
66
|
import { inspect } from 'util';
|
|
66
67
|
|
|
@@ -84,7 +85,7 @@ export type FeeOptions = {
|
|
|
84
85
|
/** Options for `simulateViaEntrypoint`. */
|
|
85
86
|
export type SimulateViaEntrypointOptions = Pick<
|
|
86
87
|
SimulateOptions,
|
|
87
|
-
'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement'
|
|
88
|
+
'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs'
|
|
88
89
|
> & {
|
|
89
90
|
/** Fee options for the entrypoint */
|
|
90
91
|
feeOptions: FeeOptions;
|
|
@@ -100,6 +101,11 @@ export type CompleteFeeOptionsConfig = {
|
|
|
100
101
|
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
101
102
|
/** If true, returns gas settings with high gas limits for estimation. If false, uses fallback limits. */
|
|
102
103
|
forEstimation?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Assumed network congestion level for fee prediction. Controls how aggressively the wallet
|
|
106
|
+
* estimates future fees. Defaults to Limit (worst case) when not specified.
|
|
107
|
+
*/
|
|
108
|
+
congestionEstimate?: ManaUsageEstimate;
|
|
103
109
|
};
|
|
104
110
|
|
|
105
111
|
/**
|
|
@@ -125,6 +131,17 @@ export abstract class BaseWallet implements Wallet {
|
|
|
125
131
|
return [...scopeSet].map(AztecAddress.fromString);
|
|
126
132
|
}
|
|
127
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
|
|
136
|
+
* account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx will fail
|
|
137
|
+
* the contract-side `Sender for tags is not set` assertion unless `set_sender_for_tags` is called first.
|
|
138
|
+
* @param from - Tx sender, or `NO_FROM`.
|
|
139
|
+
* @param sendMessagesAs - Explicit override.
|
|
140
|
+
*/
|
|
141
|
+
protected senderForTagsFrom(from: AztecAddress | NoFrom, sendMessagesAs?: AztecAddress): AztecAddress | undefined {
|
|
142
|
+
return sendMessagesAs ?? (from === NO_FROM ? undefined : from);
|
|
143
|
+
}
|
|
144
|
+
|
|
128
145
|
protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
129
146
|
|
|
130
147
|
abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
@@ -229,9 +246,9 @@ export abstract class BaseWallet implements Wallet {
|
|
|
229
246
|
* @param config - Fee completion config.
|
|
230
247
|
*/
|
|
231
248
|
protected async completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions> {
|
|
232
|
-
const { from, feePayer, gasSettings, forEstimation } = config;
|
|
249
|
+
const { from, feePayer, gasSettings, forEstimation, congestionEstimate } = config;
|
|
233
250
|
const maxFeesPerGas =
|
|
234
|
-
gasSettings?.maxFeesPerGas ?? (await this.
|
|
251
|
+
gasSettings?.maxFeesPerGas ?? (await this.getMinFees(congestionEstimate)).mul(1 + this.minFeePadding);
|
|
235
252
|
let accountFeePaymentMethodOptions;
|
|
236
253
|
// If from is an address, we need to determine the appropriate fee payment method options for the
|
|
237
254
|
// account contract entrypoint to use
|
|
@@ -267,6 +284,28 @@ export abstract class BaseWallet implements Wallet {
|
|
|
267
284
|
};
|
|
268
285
|
}
|
|
269
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Returns the worst-case min fee across predicted future slots.
|
|
289
|
+
* Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
|
|
290
|
+
* @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
|
|
291
|
+
*/
|
|
292
|
+
protected async getMinFees(estimate: ManaUsageEstimate = ManaUsageEstimate.Limit): Promise<GasFees> {
|
|
293
|
+
try {
|
|
294
|
+
const predicted = await this.aztecNode.getPredictedMinFees(estimate);
|
|
295
|
+
if (predicted.length === 0) {
|
|
296
|
+
return this.aztecNode.getCurrentMinFees();
|
|
297
|
+
}
|
|
298
|
+
return predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst));
|
|
299
|
+
} catch (err: any) {
|
|
300
|
+
// Fallback for old nodes that don't support getPredictedMinFees.
|
|
301
|
+
// Only fall back on method-not-found errors (JSON-RPC code -32601); rethrow others.
|
|
302
|
+
if (err?.cause?.code === -32601 || err?.message?.includes('Method not found')) {
|
|
303
|
+
return this.aztecNode.getCurrentMinFees();
|
|
304
|
+
}
|
|
305
|
+
throw err;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
270
309
|
registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
|
|
271
310
|
return this.pxe.registerSender(address);
|
|
272
311
|
}
|
|
@@ -325,6 +364,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
325
364
|
skipTxValidation: opts.skipTxValidation,
|
|
326
365
|
skipFeeEnforcement: opts.skipFeeEnforcement,
|
|
327
366
|
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
367
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
328
368
|
});
|
|
329
369
|
const appCallOffset = await this.computeAppCallOffset(opts.from, opts.feeOptions);
|
|
330
370
|
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
@@ -361,6 +401,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
361
401
|
feePayer: executionPayload.feePayer,
|
|
362
402
|
gasSettings: opts.fee?.gasSettings,
|
|
363
403
|
forEstimation: true,
|
|
404
|
+
congestionEstimate: opts.fee?.congestionEstimate,
|
|
364
405
|
});
|
|
365
406
|
const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
|
|
366
407
|
const remainingPayload = { ...executionPayload, calls: remainingCalls };
|
|
@@ -396,6 +437,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
396
437
|
additionalScopes: opts.additionalScopes,
|
|
397
438
|
skipTxValidation: opts.skipTxValidation,
|
|
398
439
|
skipFeeEnforcement: opts.skipFeeEnforcement ?? true,
|
|
440
|
+
sendMessagesAs: opts.sendMessagesAs,
|
|
399
441
|
})
|
|
400
442
|
: Promise.resolve(null),
|
|
401
443
|
]);
|
|
@@ -408,12 +450,14 @@ export abstract class BaseWallet implements Wallet {
|
|
|
408
450
|
from: opts.from,
|
|
409
451
|
feePayer: executionPayload.feePayer,
|
|
410
452
|
gasSettings: opts.fee?.gasSettings,
|
|
453
|
+
congestionEstimate: opts.fee?.congestionEstimate,
|
|
411
454
|
});
|
|
412
455
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
413
456
|
return this.pxe.profileTx(txRequest, {
|
|
414
457
|
profileMode: opts.profileMode,
|
|
415
458
|
skipProofGeneration: opts.skipProofGeneration ?? true,
|
|
416
459
|
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
460
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
417
461
|
});
|
|
418
462
|
}
|
|
419
463
|
|
|
@@ -425,9 +469,13 @@ export abstract class BaseWallet implements Wallet {
|
|
|
425
469
|
from: opts.from,
|
|
426
470
|
feePayer: executionPayload.feePayer,
|
|
427
471
|
gasSettings: opts.fee?.gasSettings,
|
|
472
|
+
congestionEstimate: opts.fee?.congestionEstimate,
|
|
428
473
|
});
|
|
429
474
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
430
|
-
const provenTx = await this.pxe.proveTx(txRequest,
|
|
475
|
+
const provenTx = await this.pxe.proveTx(txRequest, {
|
|
476
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
477
|
+
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
478
|
+
});
|
|
431
479
|
const offchainOutput = extractOffchainOutput(
|
|
432
480
|
provenTx.getOffchainEffects(),
|
|
433
481
|
provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp,
|