@tetherto/wdk-wallet-evm-erc-4337 1.0.0-beta.17 → 1.0.0-beta.19
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tetherto/wdk-wallet-evm-erc-4337",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.19",
|
|
4
4
|
"description": "A simple package to manage BIP-32 wallets for evm blockchains, which implement the erc-4337 standard and its account abstraction features",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wdk",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { Contract, hexlify, keccak256, randomBytes, toUtf8Bytes } from 'ethers'
|
|
18
18
|
|
|
19
|
-
import { MaximumFeeExceededError, ProviderRequiredError, TransactionError, TransactionErrorReason, ValueError } from '@tetherto/wdk-wallet'
|
|
19
|
+
import { MaximumFeeExceededError, ProviderRequiredError, TransactionError, TransactionErrorReason, UnsupportedOperationError, ValueError } from '@tetherto/wdk-wallet'
|
|
20
20
|
|
|
21
21
|
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'
|
|
22
22
|
|
|
@@ -95,6 +95,19 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
95
95
|
this._quoteCache = new Map()
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Creates a read-only account for a safe whose address is already known. Not supported on the writable
|
|
100
|
+
* account: a safe address cannot produce a signer. Use {@link WalletAccountReadOnlyEvmErc4337.fromSafeAddress}.
|
|
101
|
+
*
|
|
102
|
+
* @param {string} safeAddress - The safe's evm address.
|
|
103
|
+
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} config - The configuration object.
|
|
104
|
+
* @throws {UnsupportedOperationError} Always; a writable account cannot be created from a safe address.
|
|
105
|
+
* @returns {never}
|
|
106
|
+
*/
|
|
107
|
+
static fromSafeAddress (safeAddress, config) {
|
|
108
|
+
throw new UnsupportedOperationError('fromSafeAddress(safeAddress, config)')
|
|
109
|
+
}
|
|
110
|
+
|
|
98
111
|
/**
|
|
99
112
|
* The derivation path's index of this account.
|
|
100
113
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict'
|
|
16
16
|
|
|
17
|
-
import { isHexString, JsonRpcProvider } from 'ethers'
|
|
17
|
+
import { getAddress, isAddress, isHexString, JsonRpcProvider } from 'ethers'
|
|
18
18
|
|
|
19
|
-
import { WalletAccountReadOnly, NoSuchElementError, TransactionError, TransactionErrorReason, ValueError } from '@tetherto/wdk-wallet'
|
|
19
|
+
import { WalletAccountReadOnly, NoSuchElementError, TransactionError, TransactionErrorReason, UnsupportedOperationError, ValueError } from '@tetherto/wdk-wallet'
|
|
20
20
|
|
|
21
21
|
import { WalletAccountReadOnlyEvm } from '@tetherto/wdk-wallet-evm'
|
|
22
22
|
|
|
@@ -180,12 +180,19 @@ const SAFE_MODULES_MAP = {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
const PINNED_SAFE_ADDRESS = Symbol('pinnedSafeAddress')
|
|
184
|
+
|
|
183
185
|
export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOnly {
|
|
184
186
|
/**
|
|
185
187
|
* Creates a new read-only evm [erc-4337](https://www.erc4337.io/docs) wallet account.
|
|
186
188
|
*
|
|
187
|
-
*
|
|
189
|
+
* `address` is the safe owner's address; the account's own address is the counterfactual safe address derived
|
|
190
|
+
* from it. To read a safe whose address is already known, use {@link fromSafeAddress}.
|
|
191
|
+
*
|
|
192
|
+
* @param {string} address - The safe owner's evm address.
|
|
188
193
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} config - The configuration object.
|
|
194
|
+
* @throws {ValueError} If `address` is not a well-formed evm address.
|
|
195
|
+
* @throws {ValueError} If the `provider` option is set to an empty array.
|
|
189
196
|
* @throws {ConfigurationError} If `config.safeModulesVersion` is not in the supported set.
|
|
190
197
|
*/
|
|
191
198
|
constructor (address, config) {
|
|
@@ -193,9 +200,12 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
193
200
|
throw new ConfigurationError(`Unsupported safe modules version: ${config.safeModulesVersion}`)
|
|
194
201
|
}
|
|
195
202
|
|
|
196
|
-
const
|
|
203
|
+
const { [PINNED_SAFE_ADDRESS]: pinnedSafeAddress, ...unpinnedConfig } = config
|
|
204
|
+
const [accountConfig, ownerAccountAddress] = pinnedSafeAddress === undefined
|
|
205
|
+
? [config, address]
|
|
206
|
+
: [unpinnedConfig, undefined]
|
|
197
207
|
|
|
198
|
-
super(
|
|
208
|
+
super(pinnedSafeAddress ?? WalletAccountReadOnlyEvmErc4337.predictSafeAddress(address, config))
|
|
199
209
|
|
|
200
210
|
/**
|
|
201
211
|
* The read-only evm erc-4337 wallet account configuration.
|
|
@@ -203,7 +213,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
203
213
|
* @protected
|
|
204
214
|
* @type {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>}
|
|
205
215
|
*/
|
|
206
|
-
this._config =
|
|
216
|
+
this._config = accountConfig
|
|
207
217
|
|
|
208
218
|
/**
|
|
209
219
|
* Cached AbstractionKit bundler.
|
|
@@ -229,8 +239,13 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
229
239
|
*/
|
|
230
240
|
this._paymasters = new Map()
|
|
231
241
|
|
|
232
|
-
/**
|
|
233
|
-
|
|
242
|
+
/**
|
|
243
|
+
* The safe owner's address, or `undefined` when the account was created from a safe address.
|
|
244
|
+
*
|
|
245
|
+
* @protected
|
|
246
|
+
* @type {string | undefined}
|
|
247
|
+
*/
|
|
248
|
+
this._ownerAccountAddress = ownerAccountAddress
|
|
234
249
|
|
|
235
250
|
/**
|
|
236
251
|
* An EIP-1193–compatible provider used to interact with the blockchain.
|
|
@@ -257,13 +272,40 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
257
272
|
*
|
|
258
273
|
* @param {string} owner - The safe owner's address.
|
|
259
274
|
* @param {Pick<EvmErc4337WalletConfig, 'safeModulesVersion' | 'onChainIdentifier'>} config - The safe configuration.
|
|
275
|
+
* @throws {ValueError} If `owner` is not a well-formed evm address.
|
|
260
276
|
* @returns {string} The Safe address.
|
|
261
277
|
*/
|
|
262
278
|
static predictSafeAddress (owner, config) {
|
|
279
|
+
if (!isAddress(owner)) {
|
|
280
|
+
throw new ValueError(`Invalid owner address: '${owner}'.`)
|
|
281
|
+
}
|
|
282
|
+
|
|
263
283
|
const overrides = WalletAccountReadOnlyEvmErc4337._getInitCodeOverrides(config)
|
|
264
284
|
return SafeAccount030.createAccountAddress([owner], overrides)
|
|
265
285
|
}
|
|
266
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Creates a read-only account for a safe whose address is already known.
|
|
289
|
+
*
|
|
290
|
+
* The address is used as the account's own address, so balances, allowances and quotes resolve against that
|
|
291
|
+
* safe. Its owner is unknown to the account: {@link verify} and {@link verifyTypedData} throw, and the safe must
|
|
292
|
+
* already be deployed for {@link quoteSendTransaction} and {@link quoteTransfer}.
|
|
293
|
+
*
|
|
294
|
+
* @param {string} safeAddress - The safe's evm address. Normalized to its checksummed form.
|
|
295
|
+
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} config - The configuration object.
|
|
296
|
+
* @throws {ValueError} If `safeAddress` is not a well-formed evm address.
|
|
297
|
+
* @throws {ValueError} If the `provider` option is set to an empty array.
|
|
298
|
+
* @throws {ConfigurationError} If `config.safeModulesVersion` is not in the supported set.
|
|
299
|
+
* @returns {WalletAccountReadOnlyEvmErc4337} A read-only account whose address is `safeAddress`.
|
|
300
|
+
*/
|
|
301
|
+
static fromSafeAddress (safeAddress, config) {
|
|
302
|
+
if (!isAddress(safeAddress)) {
|
|
303
|
+
throw new ValueError(`Invalid safe address: '${safeAddress}'.`)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return new WalletAccountReadOnlyEvmErc4337(undefined, { ...config, [PINNED_SAFE_ADDRESS]: getAddress(safeAddress) })
|
|
307
|
+
}
|
|
308
|
+
|
|
267
309
|
/**
|
|
268
310
|
* Returns the account's eth balance.
|
|
269
311
|
*
|
|
@@ -330,6 +372,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
330
372
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
331
373
|
* @throws {ConfigurationError} If, in token mode, the configured `paymasterAddress` does not match the paymaster address returned by the paymaster RPC. This guards against the auto-generated ERC-20 approval targeting an unexpected paymaster contract.
|
|
332
374
|
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
375
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
333
376
|
*/
|
|
334
377
|
async quoteSendTransaction (tx, config) {
|
|
335
378
|
const mergedConfig = { ...this._config, ...config }
|
|
@@ -364,6 +407,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
364
407
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
365
408
|
* @throws {ConfigurationError} If, in token mode, the configured `paymasterAddress` does not match the paymaster address returned by the paymaster RPC. This guards against the auto-generated ERC-20 approval targeting an unexpected paymaster contract.
|
|
366
409
|
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
410
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
367
411
|
*/
|
|
368
412
|
async quoteTransfer (options, config, txOverrides) {
|
|
369
413
|
const baseTx = await WalletAccountReadOnlyEvm._getTransferTransaction(options)
|
|
@@ -488,9 +532,14 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
488
532
|
*
|
|
489
533
|
* @param {string} message - The original message.
|
|
490
534
|
* @param {string} signature - The signature to verify.
|
|
535
|
+
* @throws {UnsupportedOperationError} If the account was created from a safe address, whose owner is unknown.
|
|
491
536
|
* @returns {Promise<boolean>} True if the signature is valid.
|
|
492
537
|
*/
|
|
493
538
|
async verify (message, signature) {
|
|
539
|
+
if (this._ownerAccountAddress === undefined) {
|
|
540
|
+
throw new UnsupportedOperationError('verify(message, signature)')
|
|
541
|
+
}
|
|
542
|
+
|
|
494
543
|
const evmReadOnlyAccount = new WalletAccountReadOnlyEvm(this._ownerAccountAddress, this._config)
|
|
495
544
|
return await evmReadOnlyAccount.verify(message, signature)
|
|
496
545
|
}
|
|
@@ -500,9 +549,14 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
500
549
|
*
|
|
501
550
|
* @param {TypedData} typedData - The typed data to verify.
|
|
502
551
|
* @param {string} signature - The signature to verify.
|
|
552
|
+
* @throws {UnsupportedOperationError} If the account was created from a safe address, whose owner is unknown.
|
|
503
553
|
* @returns {Promise<boolean>} True if the signature is valid.
|
|
504
554
|
*/
|
|
505
555
|
async verifyTypedData (typedData, signature) {
|
|
556
|
+
if (this._ownerAccountAddress === undefined) {
|
|
557
|
+
throw new UnsupportedOperationError('verifyTypedData(typedData, signature)')
|
|
558
|
+
}
|
|
559
|
+
|
|
506
560
|
const evmReadOnlyAccount = new WalletAccountReadOnlyEvm(this._ownerAccountAddress, this._config)
|
|
507
561
|
|
|
508
562
|
return await evmReadOnlyAccount.verifyTypedData(typedData, signature)
|
|
@@ -554,6 +608,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
554
608
|
*
|
|
555
609
|
* @protected
|
|
556
610
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} [config] - The wallet configuration. Defaults to the instance configuration.
|
|
611
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
557
612
|
* @returns {Promise<SafeAccountV0_3_0>} The safe account instance.
|
|
558
613
|
*/
|
|
559
614
|
async _getSmartAccount (config = this._config) {
|
|
@@ -567,6 +622,10 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
567
622
|
return this._deployedSmartAccount
|
|
568
623
|
}
|
|
569
624
|
|
|
625
|
+
if (this._ownerAccountAddress === undefined) {
|
|
626
|
+
throw new ConfigurationError(`The safe at '${safeAddress}' is not deployed. Deploying it requires the owner's address, which an account created from a safe address does not have.`)
|
|
627
|
+
}
|
|
628
|
+
|
|
570
629
|
return SafeAccount030.initializeNewAccount([this._ownerAccountAddress], overrides)
|
|
571
630
|
}
|
|
572
631
|
|
|
@@ -593,16 +652,29 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
593
652
|
}
|
|
594
653
|
|
|
595
654
|
/**
|
|
596
|
-
* Returns the chain id.
|
|
655
|
+
* Returns the chain id, asserting the provider is on the configured network.
|
|
656
|
+
*
|
|
657
|
+
* The value is read once from the provider (`eth_chainId`), checked against
|
|
658
|
+
* `config.chainId`, and cached. Every UserOperation is built and signed against
|
|
659
|
+
* this value, so a provider reporting a different chain than the one the
|
|
660
|
+
* application configured must fail here rather than produce a signature for the
|
|
661
|
+
* wrong network.
|
|
597
662
|
*
|
|
598
663
|
* @protected
|
|
599
664
|
* @returns {Promise<bigint>} - The chain id.
|
|
665
|
+
* @throws {ConfigurationError} If the provider's chain id does not match `config.chainId`.
|
|
600
666
|
*/
|
|
601
667
|
async _getChainId () {
|
|
602
668
|
if (!this._chainId) {
|
|
603
|
-
const chainId = await this._provider.request({ method: 'eth_chainId' })
|
|
669
|
+
const chainId = BigInt(await this._provider.request({ method: 'eth_chainId' }))
|
|
670
|
+
|
|
671
|
+
if (this._config.chainId !== undefined && chainId !== BigInt(this._config.chainId)) {
|
|
672
|
+
throw new ConfigurationError(
|
|
673
|
+
`Provider is on chain ${chainId} but the wallet is configured for chain ${this._config.chainId}`
|
|
674
|
+
)
|
|
675
|
+
}
|
|
604
676
|
|
|
605
|
-
this._chainId =
|
|
677
|
+
this._chainId = chainId
|
|
606
678
|
}
|
|
607
679
|
|
|
608
680
|
return this._chainId
|
|
@@ -715,10 +787,11 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
715
787
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} config - The wallet configuration.
|
|
716
788
|
* @param {EvmErc4337GasOverrides & Nonce} [txOverrides] - Optional UserOperationV7 gas overrides extracted from the input transaction(s), plus an optional explicit lane `nonce`.
|
|
717
789
|
* @returns {Promise<BuiltUserOperation>} The built operation, signing context, and (in token mode) the paymaster quote.
|
|
790
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
718
791
|
*/
|
|
719
792
|
async _buildUserOperation (calls, config, txOverrides = {}) {
|
|
720
|
-
const smartAccount = await this._getSmartAccount(config)
|
|
721
793
|
const chainId = await this._getChainId()
|
|
794
|
+
const smartAccount = await this._getSmartAccount(config)
|
|
722
795
|
|
|
723
796
|
const mode = WalletAccountReadOnlyEvmErc4337._resolvePaymasterMode(config)
|
|
724
797
|
const provider = mode !== PaymasterMode.NATIVE
|
|
@@ -8,6 +8,16 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
8
8
|
* @param {EvmErc4337WalletConfig} config - The configuration object.
|
|
9
9
|
*/
|
|
10
10
|
constructor(seed: string | Uint8Array, path: string, config: EvmErc4337WalletConfig);
|
|
11
|
+
/**
|
|
12
|
+
* Creates a read-only account for a safe whose address is already known. Not supported on the writable
|
|
13
|
+
* account: a safe address cannot produce a signer. Use {@link WalletAccountReadOnlyEvmErc4337.fromSafeAddress}.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} safeAddress - The safe's evm address.
|
|
16
|
+
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} config - The configuration object.
|
|
17
|
+
* @throws {UnsupportedOperationError} Always; a writable account cannot be created from a safe address.
|
|
18
|
+
* @returns {never}
|
|
19
|
+
*/
|
|
20
|
+
static fromSafeAddress(safeAddress: string, config: Omit<EvmErc4337WalletConfig, "transferMaxFee" | "transactionMaxFee">): never;
|
|
11
21
|
/**
|
|
12
22
|
* The evm erc-4337 wallet account configuration.
|
|
13
23
|
*
|
|
@@ -6,9 +6,25 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
6
6
|
*
|
|
7
7
|
* @param {string} owner - The safe owner's address.
|
|
8
8
|
* @param {Pick<EvmErc4337WalletConfig, 'safeModulesVersion' | 'onChainIdentifier'>} config - The safe configuration.
|
|
9
|
+
* @throws {ValueError} If `owner` is not a well-formed evm address.
|
|
9
10
|
* @returns {string} The Safe address.
|
|
10
11
|
*/
|
|
11
12
|
static predictSafeAddress(owner: string, config: Pick<EvmErc4337WalletConfig, "safeModulesVersion" | "onChainIdentifier">): string;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a read-only account for a safe whose address is already known.
|
|
15
|
+
*
|
|
16
|
+
* The address is used as the account's own address, so balances, allowances and quotes resolve against that
|
|
17
|
+
* safe. Its owner is unknown to the account: {@link verify} and {@link verifyTypedData} throw, and the safe must
|
|
18
|
+
* already be deployed for {@link quoteSendTransaction} and {@link quoteTransfer}.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} safeAddress - The safe's evm address. Normalized to its checksummed form.
|
|
21
|
+
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} config - The configuration object.
|
|
22
|
+
* @throws {ValueError} If `safeAddress` is not a well-formed evm address.
|
|
23
|
+
* @throws {ValueError} If the `provider` option is set to an empty array.
|
|
24
|
+
* @throws {ConfigurationError} If `config.safeModulesVersion` is not in the supported set.
|
|
25
|
+
* @returns {WalletAccountReadOnlyEvmErc4337} A read-only account whose address is `safeAddress`.
|
|
26
|
+
*/
|
|
27
|
+
static fromSafeAddress(safeAddress: string, config: Omit<EvmErc4337WalletConfig, "transferMaxFee" | "transactionMaxFee">): WalletAccountReadOnlyEvmErc4337;
|
|
12
28
|
/**
|
|
13
29
|
* Builds the init code overrides from the wallet configuration.
|
|
14
30
|
*
|
|
@@ -20,8 +36,13 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
20
36
|
/**
|
|
21
37
|
* Creates a new read-only evm [erc-4337](https://www.erc4337.io/docs) wallet account.
|
|
22
38
|
*
|
|
23
|
-
*
|
|
39
|
+
* `address` is the safe owner's address; the account's own address is the counterfactual safe address derived
|
|
40
|
+
* from it. To read a safe whose address is already known, use {@link fromSafeAddress}.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} address - The safe owner's evm address.
|
|
24
43
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee'>} config - The configuration object.
|
|
44
|
+
* @throws {ValueError} If `address` is not a well-formed evm address.
|
|
45
|
+
* @throws {ValueError} If the `provider` option is set to an empty array.
|
|
25
46
|
* @throws {ConfigurationError} If `config.safeModulesVersion` is not in the supported set.
|
|
26
47
|
*/
|
|
27
48
|
constructor(address: string, config: Omit<EvmErc4337WalletConfig, "transferMaxFee" | "transactionMaxFee">);
|
|
@@ -58,8 +79,13 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
58
79
|
* @type {bigint | undefined}
|
|
59
80
|
*/
|
|
60
81
|
protected _chainId: bigint | undefined;
|
|
61
|
-
/**
|
|
62
|
-
|
|
82
|
+
/**
|
|
83
|
+
* The safe owner's address, or `undefined` when the account was created from a safe address.
|
|
84
|
+
*
|
|
85
|
+
* @protected
|
|
86
|
+
* @type {string | undefined}
|
|
87
|
+
*/
|
|
88
|
+
protected _ownerAccountAddress: string | undefined;
|
|
63
89
|
/**
|
|
64
90
|
* Returns the account's eth balance.
|
|
65
91
|
*
|
|
@@ -102,6 +128,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
102
128
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
103
129
|
* @throws {ConfigurationError} If, in token mode, the configured `paymasterAddress` does not match the paymaster address returned by the paymaster RPC. This guards against the auto-generated ERC-20 approval targeting an unexpected paymaster contract.
|
|
104
130
|
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
131
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
105
132
|
*/
|
|
106
133
|
quoteSendTransaction(tx: EvmErc4337Transaction | EvmErc4337Transaction[], config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<Omit<TransactionResult, "hash">>;
|
|
107
134
|
/**
|
|
@@ -117,6 +144,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
117
144
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
118
145
|
* @throws {ConfigurationError} If, in token mode, the configured `paymasterAddress` does not match the paymaster address returned by the paymaster RPC. This guards against the auto-generated ERC-20 approval targeting an unexpected paymaster contract.
|
|
119
146
|
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
147
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
120
148
|
*/
|
|
121
149
|
quoteTransfer(options: TransferOptions, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>, txOverrides?: EvmErc4337GasOverrides): Promise<Omit<TransferResult, "hash">>;
|
|
122
150
|
/**
|
|
@@ -171,6 +199,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
171
199
|
*
|
|
172
200
|
* @param {string} message - The original message.
|
|
173
201
|
* @param {string} signature - The signature to verify.
|
|
202
|
+
* @throws {UnsupportedOperationError} If the account was created from a safe address, whose owner is unknown.
|
|
174
203
|
* @returns {Promise<boolean>} True if the signature is valid.
|
|
175
204
|
*/
|
|
176
205
|
verify(message: string, signature: string): Promise<boolean>;
|
|
@@ -179,6 +208,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
179
208
|
*
|
|
180
209
|
* @param {TypedData} typedData - The typed data to verify.
|
|
181
210
|
* @param {string} signature - The signature to verify.
|
|
211
|
+
* @throws {UnsupportedOperationError} If the account was created from a safe address, whose owner is unknown.
|
|
182
212
|
* @returns {Promise<boolean>} True if the signature is valid.
|
|
183
213
|
*/
|
|
184
214
|
verifyTypedData(typedData: TypedData, signature: string): Promise<boolean>;
|
|
@@ -196,6 +226,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
196
226
|
*
|
|
197
227
|
* @protected
|
|
198
228
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee'>} [config] - The wallet configuration. Defaults to the instance configuration.
|
|
229
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
199
230
|
* @returns {Promise<SafeAccountV0_3_0>} The safe account instance.
|
|
200
231
|
*/
|
|
201
232
|
protected _getSmartAccount(config?: Omit<EvmErc4337WalletConfig, "transferMaxFee" | "transactionMaxFee">): Promise<import('abstractionkit').SafeAccountV0_3_0>;
|
|
@@ -240,6 +271,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
240
271
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee'>} config - The wallet configuration.
|
|
241
272
|
* @param {EvmErc4337GasOverrides & Nonce} [txOverrides] - Optional UserOperationV7 gas overrides extracted from the input transaction(s), plus an optional explicit lane `nonce`.
|
|
242
273
|
* @returns {Promise<BuiltUserOperation>} The built operation, signing context, and (in token mode) the paymaster quote.
|
|
274
|
+
* @throws {ConfigurationError} If the account was created from a safe address that is not deployed.
|
|
243
275
|
*/
|
|
244
276
|
protected _buildUserOperation(calls: import('abstractionkit').MetaTransaction[], config: Omit<EvmErc4337WalletConfig, "transferMaxFee" | "transactionMaxFee">, txOverrides?: EvmErc4337GasOverrides & Nonce): Promise<BuiltUserOperation>;
|
|
245
277
|
/**
|