@tetherto/wdk-wallet-evm-erc-4337 1.0.0-beta.15 → 1.0.0-beta.17
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/index.js +6 -0
- package/package.json +3 -3
- package/src/errors.js +8 -1
- package/src/wallet-account-evm-erc-4337.js +37 -15
- package/src/wallet-account-read-only-evm-erc-4337.js +90 -9
- package/src/wallet-manager-evm-erc-4337.js +5 -3
- package/types/index.d.ts +5 -0
- package/types/src/errors.d.ts +7 -1
- package/types/src/wallet-account-evm-erc-4337.d.ts +19 -4
- package/types/src/wallet-account-read-only-evm-erc-4337.d.ts +50 -4
- package/types/src/wallet-manager-evm-erc-4337.d.ts +2 -0
package/index.js
CHANGED
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
/** @typedef {import('./src/wallet-account-read-only-evm-erc-4337.js').UserOperationReceipt} UserOperationReceipt */
|
|
18
18
|
/** @typedef {import('./src/wallet-account-read-only-evm-erc-4337.js').BuiltUserOperation} BuiltUserOperation */
|
|
19
|
+
/** @typedef {import('./src/wallet-account-read-only-evm-erc-4337.js').EvmErc4337TransactionDetails} EvmErc4337TransactionDetails */
|
|
20
|
+
|
|
21
|
+
/** @typedef {import('@tetherto/wdk-wallet').Finality} Finality */
|
|
22
|
+
/** @typedef {import('@tetherto/wdk-wallet').TransactionReceipt} TransactionReceipt */
|
|
23
|
+
/** @typedef {import('@tetherto/wdk-wallet').WaitForTransactionTarget} WaitForTransactionTarget */
|
|
24
|
+
/** @typedef {import('@tetherto/wdk-wallet').WaitForTransactionOptions} WaitForTransactionOptions */
|
|
19
25
|
|
|
20
26
|
/** @typedef {import('@tetherto/wdk-wallet-evm').FeeRates} FeeRates */
|
|
21
27
|
|
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.17",
|
|
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",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@tetherto/wdk-failover-provider": "1.0.0-beta.2",
|
|
34
|
-
"@tetherto/wdk-wallet": "1.0.0-beta.
|
|
35
|
-
"@tetherto/wdk-wallet-evm": "1.0.0-beta.
|
|
34
|
+
"@tetherto/wdk-wallet": "1.0.0-beta.17",
|
|
35
|
+
"@tetherto/wdk-wallet-evm": "1.0.0-beta.18",
|
|
36
36
|
"abstractionkit": "0.4.0",
|
|
37
37
|
"bare-node-runtime": "^1.4.0",
|
|
38
38
|
"ethers": "6.17.0"
|
package/src/errors.js
CHANGED
|
@@ -14,7 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict'
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
import { ValueError } from '@tetherto/wdk-wallet'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Thrown when the wallet configuration is invalid or has missing required fields.
|
|
21
|
+
*
|
|
22
|
+
* It extends {@link ValueError}, so it is also part of the `WdkError` taxonomy.
|
|
23
|
+
*/
|
|
24
|
+
export class ConfigurationError extends ValueError {
|
|
18
25
|
/**
|
|
19
26
|
* Create a new configuration error.
|
|
20
27
|
*
|
|
@@ -16,6 +16,8 @@
|
|
|
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'
|
|
20
|
+
|
|
19
21
|
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'
|
|
20
22
|
|
|
21
23
|
import { AbstractionKitError, ENTRYPOINT_V7, calculateUserOperationMaxGasCost, fetchAccountNonce } from 'abstractionkit'
|
|
@@ -152,7 +154,10 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
152
154
|
* @param {EvmErc4337Transaction} tx - The transaction to include in the user operation.
|
|
153
155
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
154
156
|
* @returns {Promise<UserOperationV7>} The signed user operation.
|
|
155
|
-
* @throws {
|
|
157
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
158
|
+
* @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.
|
|
159
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transaction's cost surpasses the transaction max. fee option.
|
|
160
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
156
161
|
*/
|
|
157
162
|
async signTransaction (tx, config) {
|
|
158
163
|
const mergedConfig = { ...this._config, ...config }
|
|
@@ -167,7 +172,7 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
167
172
|
|
|
168
173
|
const { isSponsored, transactionMaxFee } = mergedConfig
|
|
169
174
|
if (!isSponsored && transactionMaxFee !== undefined && fee > transactionMaxFee) {
|
|
170
|
-
throw new
|
|
175
|
+
throw new MaximumFeeExceededError('Exceeded maximum fee cost for transaction operation.')
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
const { userOp } = await this._signUserOperation([tx], { config: mergedConfig, cachedBuild: prepared })
|
|
@@ -183,11 +188,12 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
183
188
|
* @param {ApproveOptions} options - The approve options.
|
|
184
189
|
* @param {EvmErc4337GasOverrides} [txOverrides] - If set, applies these UserOperationV7 gas/fee overrides to the underlying transaction.
|
|
185
190
|
* @returns {Promise<TransactionResult>} - The transaction's result.
|
|
186
|
-
* @throws {
|
|
191
|
+
* @throws {ProviderRequiredError} - If the wallet is not connected to a provider.
|
|
192
|
+
* @throws {ValueError} - If trying to approve usdts on ethereum with allowance not equal to zero (due to the usdt allowance reset requirement).
|
|
187
193
|
*/
|
|
188
194
|
async approve (options, txOverrides) {
|
|
189
195
|
if (!this._ownerAccount._provider) {
|
|
190
|
-
throw new
|
|
196
|
+
throw new ProviderRequiredError('The wallet must be connected to a provider to approve funds.')
|
|
191
197
|
}
|
|
192
198
|
|
|
193
199
|
const { token, spender, amount } = options
|
|
@@ -196,7 +202,7 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
196
202
|
if (chainId === 1n && token.toLowerCase() === USDT_MAINNET_ADDRESS.toLowerCase()) {
|
|
197
203
|
const currentAllowance = await this.getAllowance(token, spender)
|
|
198
204
|
if (currentAllowance > 0n && BigInt(amount) > 0n) {
|
|
199
|
-
throw new
|
|
205
|
+
throw new ValueError(
|
|
200
206
|
'USDT requires the current allowance to be reset to 0 before setting a new non-zero value. Please send an "approve" transaction with an amount of 0 first.'
|
|
201
207
|
)
|
|
202
208
|
}
|
|
@@ -232,6 +238,9 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
232
238
|
* @param {EvmErc4337Transaction | EvmErc4337Transaction[] | UserOperationV7} tx - The transaction, an array of multiple transactions to send in batch, or an already-signed UserOperation.
|
|
233
239
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
234
240
|
* @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
|
|
241
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
242
|
+
* @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.
|
|
243
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
235
244
|
*/
|
|
236
245
|
async quoteSendTransaction (tx, config) {
|
|
237
246
|
const mergedConfig = { ...this._config, ...config }
|
|
@@ -281,8 +290,11 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
281
290
|
* @param {EvmErc4337Transaction | EvmErc4337Transaction[] | UserOperationV7} tx - The transaction, an array of multiple transactions to send in batch, or an already-signed UserOperation.
|
|
282
291
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
283
292
|
* @returns {Promise<TransactionResult>} The transaction's result.
|
|
284
|
-
* @throws {
|
|
285
|
-
* @throws {
|
|
293
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
294
|
+
* @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.
|
|
295
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transaction's cost surpasses the transaction max. fee option.
|
|
296
|
+
* @throws {ValueError} If `nonceKey` is a bigint outside the uint192 range (0 to 2^192 - 1).
|
|
297
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
286
298
|
*/
|
|
287
299
|
async sendTransaction (tx, config) {
|
|
288
300
|
const mergedConfig = { ...this._config, ...config }
|
|
@@ -304,7 +316,7 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
304
316
|
|
|
305
317
|
const { isSponsored, transactionMaxFee } = mergedConfig
|
|
306
318
|
if (!isSponsored && transactionMaxFee !== undefined && prepared.fee > transactionMaxFee) {
|
|
307
|
-
throw new
|
|
319
|
+
throw new MaximumFeeExceededError('Exceeded maximum fee cost for transaction operation.')
|
|
308
320
|
}
|
|
309
321
|
|
|
310
322
|
const hash = await this._sendUserOperation(txs, { config: mergedConfig, cachedBuild: prepared })
|
|
@@ -320,8 +332,11 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
320
332
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
321
333
|
* @param {EvmErc4337GasOverrides} [txOverrides] - If set, applies these UserOperationV7 gas/fee overrides to the underlying transaction.
|
|
322
334
|
* @returns {Promise<TransferResult>} The transfer's result.
|
|
323
|
-
* @throws {
|
|
324
|
-
* @throws {
|
|
335
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
336
|
+
* @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.
|
|
337
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transfer's cost surpasses the transfer max. fee option.
|
|
338
|
+
* @throws {ValueError} If `nonceKey` is a bigint outside the uint192 range (0 to 2^192 - 1).
|
|
339
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
325
340
|
*/
|
|
326
341
|
async transfer (options, config, txOverrides) {
|
|
327
342
|
const mergedConfig = { ...this._config, ...config }
|
|
@@ -338,8 +353,8 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
338
353
|
const txs = [tx]
|
|
339
354
|
const prepared = await this._prepareForSend(tx, txs, mergedConfig)
|
|
340
355
|
|
|
341
|
-
if (!isSponsored && transferMaxFee !== undefined && prepared.fee
|
|
342
|
-
throw new
|
|
356
|
+
if (!isSponsored && transferMaxFee !== undefined && prepared.fee > transferMaxFee) {
|
|
357
|
+
throw new MaximumFeeExceededError('Exceeded maximum fee cost for transfer operation.')
|
|
343
358
|
}
|
|
344
359
|
|
|
345
360
|
const hash = await this._sendUserOperation(txs, { config: mergedConfig, cachedBuild: prepared })
|
|
@@ -409,7 +424,7 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
409
424
|
} else {
|
|
410
425
|
key = BigInt(config.nonceKey)
|
|
411
426
|
if (key < 0n || key > MAX_UINT192) {
|
|
412
|
-
throw new
|
|
427
|
+
throw new ValueError('nonceKey must be within the uint192 range (0 to 2^192 - 1).')
|
|
413
428
|
}
|
|
414
429
|
}
|
|
415
430
|
return await fetchAccountNonce(this._provider, ENTRYPOINT_V7, this._address, key)
|
|
@@ -476,7 +491,10 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
476
491
|
return await this._getBundler().sendUserOperation(userOp, smartAccount.entrypointAddress)
|
|
477
492
|
} catch (err) {
|
|
478
493
|
if (err instanceof AbstractionKitError && err.message.includes('AA50')) {
|
|
479
|
-
throw new
|
|
494
|
+
throw new TransactionError('Not enough funds on the safe account to repay the paymaster.', {
|
|
495
|
+
reason: TransactionErrorReason.INSUFFICIENT_BALANCE,
|
|
496
|
+
cause: err
|
|
497
|
+
})
|
|
480
498
|
}
|
|
481
499
|
throw err
|
|
482
500
|
}
|
|
@@ -488,13 +506,17 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
488
506
|
* @private
|
|
489
507
|
* @param {UserOperationV7} userOp - The signed UserOperation.
|
|
490
508
|
* @returns {Promise<string>} The user operation hash.
|
|
509
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
491
510
|
*/
|
|
492
511
|
async _broadcastSignedUserOperation (userOp) {
|
|
493
512
|
try {
|
|
494
513
|
return await this._getBundler().sendUserOperation(userOp, ENTRYPOINT_V7)
|
|
495
514
|
} catch (err) {
|
|
496
515
|
if (err instanceof AbstractionKitError && err.message.includes('AA50')) {
|
|
497
|
-
throw new
|
|
516
|
+
throw new TransactionError('Not enough funds on the safe account to repay the paymaster.', {
|
|
517
|
+
reason: TransactionErrorReason.INSUFFICIENT_BALANCE,
|
|
518
|
+
cause: err
|
|
519
|
+
})
|
|
498
520
|
}
|
|
499
521
|
throw err
|
|
500
522
|
}
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict'
|
|
16
16
|
|
|
17
|
-
import { JsonRpcProvider } from 'ethers'
|
|
17
|
+
import { isHexString, JsonRpcProvider } from 'ethers'
|
|
18
18
|
|
|
19
|
-
import { WalletAccountReadOnly } from '@tetherto/wdk-wallet'
|
|
19
|
+
import { WalletAccountReadOnly, NoSuchElementError, TransactionError, TransactionErrorReason, ValueError } from '@tetherto/wdk-wallet'
|
|
20
20
|
|
|
21
21
|
import { WalletAccountReadOnlyEvm } from '@tetherto/wdk-wallet-evm'
|
|
22
22
|
|
|
@@ -60,6 +60,18 @@ export const FEE_TOLERANCE_COEFFICIENT = 120n
|
|
|
60
60
|
/** @typedef {import('abstractionkit').UserOperationV7} UserOperationV7 */
|
|
61
61
|
/** @typedef {import('abstractionkit').TokenQuote} TokenQuote */
|
|
62
62
|
|
|
63
|
+
/** @typedef {import('@tetherto/wdk-wallet').TransactionReceipt} TransactionReceipt */
|
|
64
|
+
/** @typedef {import('@tetherto/wdk-wallet').WaitForTransactionOptions} WaitForTransactionOptions */
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The ERC-4337-specific fields added to a normalized transaction receipt.
|
|
68
|
+
*
|
|
69
|
+
* @typedef {Object} EvmErc4337TransactionDetails
|
|
70
|
+
* @property {number} confirmations - The number of confirmations (0 while pending or dropped).
|
|
71
|
+
* @property {EvmTransactionReceipt | null} receipt - The native ethers receipt, or null while the user operation is pending or dropped.
|
|
72
|
+
* @property {UserOperationReceipt | null} userOperationReceipt - The user operation receipt, or null while pending or unavailable.
|
|
73
|
+
*/
|
|
74
|
+
|
|
63
75
|
/**
|
|
64
76
|
* @typedef {Object} BuiltUserOperation
|
|
65
77
|
* @property {UserOperationV7} userOp - The fully-populated UserOperation ready to sign.
|
|
@@ -317,7 +329,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
317
329
|
* @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
|
|
318
330
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
319
331
|
* @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.
|
|
320
|
-
* @throws {
|
|
332
|
+
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
321
333
|
*/
|
|
322
334
|
async quoteSendTransaction (tx, config) {
|
|
323
335
|
const mergedConfig = { ...this._config, ...config }
|
|
@@ -351,7 +363,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
351
363
|
* @returns {Promise<Omit<TransferResult, 'hash'>>} The transfer's quotes.
|
|
352
364
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
353
365
|
* @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.
|
|
354
|
-
* @throws {
|
|
366
|
+
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
355
367
|
*/
|
|
356
368
|
async quoteTransfer (options, config, txOverrides) {
|
|
357
369
|
const baseTx = await WalletAccountReadOnlyEvm._getTransferTransaction(options)
|
|
@@ -365,6 +377,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
365
377
|
/**
|
|
366
378
|
* Returns a transaction's receipt.
|
|
367
379
|
*
|
|
380
|
+
* @deprecated Use {@link getTransaction} instead, which returns a normalized, finality-based receipt. The raw ethers receipt and the user operation receipt remain available on its `receipt` and `userOperationReceipt` properties.
|
|
368
381
|
* @param {string} hash - The user operation hash.
|
|
369
382
|
* @returns {Promise<EvmTransactionReceipt | null>} – The receipt, or null if the transaction has not been included in a block yet.
|
|
370
383
|
*/
|
|
@@ -378,6 +391,73 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
378
391
|
return await evmReadOnlyAccount.getTransactionReceipt(result.transactionHash)
|
|
379
392
|
}
|
|
380
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Returns a normalized, finality-based receipt for a user operation. Finality and confirmations come from the bundling transaction; `success` and `fee` come from the user operation.
|
|
396
|
+
*
|
|
397
|
+
* @param {string} hash - The user operation hash.
|
|
398
|
+
* @returns {Promise<TransactionReceipt & EvmErc4337TransactionDetails>} The normalized receipt.
|
|
399
|
+
* @throws {ValueError} If the hash is not a valid user operation hash.
|
|
400
|
+
* @throws {NoSuchElementError} If no user operation has been found for the given hash.
|
|
401
|
+
*/
|
|
402
|
+
async getTransaction (hash) {
|
|
403
|
+
if (!isHexString(hash, 32)) {
|
|
404
|
+
throw new ValueError(`Invalid user operation hash: '${hash}'.`)
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
const bundler = this._getBundler()
|
|
408
|
+
|
|
409
|
+
const userOpByHash = await bundler.getUserOperationByHash(hash)
|
|
410
|
+
if (!userOpByHash) {
|
|
411
|
+
throw new NoSuchElementError(`No user operation found for '${hash}'.`)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (!userOpByHash.transactionHash) {
|
|
415
|
+
return {
|
|
416
|
+
hash,
|
|
417
|
+
finality: 'pending',
|
|
418
|
+
confirmations: 0,
|
|
419
|
+
receipt: null,
|
|
420
|
+
userOperationReceipt: null
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const [evmReadOnlyAccount, userOpReceipt] = await Promise.all([
|
|
425
|
+
this._getEvmReadOnlyAccount(),
|
|
426
|
+
bundler.getUserOperationReceipt(hash)
|
|
427
|
+
])
|
|
428
|
+
|
|
429
|
+
const info = await evmReadOnlyAccount.getTransaction(userOpByHash.transactionHash)
|
|
430
|
+
|
|
431
|
+
return {
|
|
432
|
+
...info,
|
|
433
|
+
hash,
|
|
434
|
+
success: userOpReceipt ? userOpReceipt.success : info.success,
|
|
435
|
+
fee: userOpReceipt ? userOpReceipt.actualGasCost : info.fee,
|
|
436
|
+
userOperationReceipt: userOpReceipt
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Blocks until a user operation reaches a terminal state (the requested finality target or `dropped`), or times out.
|
|
442
|
+
*
|
|
443
|
+
* @param {string} hash - The user operation hash.
|
|
444
|
+
* @param {WaitForTransactionOptions} [options] - The wait options.
|
|
445
|
+
* @returns {Promise<TransactionReceipt & EvmErc4337TransactionDetails>} The terminal receipt: the finality target reached (inspect `success` to tell success from revert), or `dropped`.
|
|
446
|
+
* @throws {TimeoutError} If the target is not reached before the timeout.
|
|
447
|
+
*/
|
|
448
|
+
async waitForTransaction (hash, options = {}) {
|
|
449
|
+
return await super.waitForTransaction(hash, options)
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Overrides the base default to allow for slower ERC-4337 bundling, inclusion, and confirmation.
|
|
454
|
+
*
|
|
455
|
+
* @type {number}
|
|
456
|
+
*/
|
|
457
|
+
get defaultWaitTimeout () {
|
|
458
|
+
return 180000
|
|
459
|
+
}
|
|
460
|
+
|
|
381
461
|
/**
|
|
382
462
|
* Returns a user operation's receipt.
|
|
383
463
|
*
|
|
@@ -552,14 +632,14 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
552
632
|
* @protected
|
|
553
633
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} [config] - The configuration object.
|
|
554
634
|
* @returns {Eip1193Provider} A wrapped Eip1193Provider instance.
|
|
555
|
-
* @throws {
|
|
635
|
+
* @throws {ValueError} If the `provider` option is set to an empty array.
|
|
556
636
|
*/
|
|
557
637
|
_createFailoverProvider (config = this._config) {
|
|
558
638
|
const { provider, retries = 3 } = config
|
|
559
639
|
|
|
560
640
|
if (Array.isArray(provider)) {
|
|
561
641
|
if (!provider.length) {
|
|
562
|
-
throw new
|
|
642
|
+
throw new ValueError("The 'provider' option cannot be set to an empty list.")
|
|
563
643
|
}
|
|
564
644
|
|
|
565
645
|
const failoverProvider = new FailoverProvider({ retries })
|
|
@@ -701,7 +781,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
701
781
|
* @param {EvmErc4337Transaction[]} txs - The EVM transactions to include in the UserOperation.
|
|
702
782
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} config - The wallet configuration to use for the build.
|
|
703
783
|
* @returns {Promise<BuiltUserOperation & Omit<TransactionResult, 'hash'>>} The built operation plus its raw fee (no tolerance buffer applied).
|
|
704
|
-
* @throws {
|
|
784
|
+
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
705
785
|
*/
|
|
706
786
|
async _getUserOperationGasCost (txs, config) {
|
|
707
787
|
const calls = WalletAccountReadOnlyEvmErc4337._toMetaTransactions(txs)
|
|
@@ -717,9 +797,10 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
717
797
|
return { fee, ...buildResult }
|
|
718
798
|
} catch (error) {
|
|
719
799
|
if (error instanceof AbstractionKitError && error.message.includes('AA50')) {
|
|
720
|
-
throw new
|
|
800
|
+
throw new TransactionError(
|
|
721
801
|
'Token paymaster requires the account to hold the paymaster token for fee estimation. ' +
|
|
722
|
-
'Fund the account with the paymaster token before quoting.'
|
|
802
|
+
'Fund the account with the paymaster token before quoting.',
|
|
803
|
+
{ reason: TransactionErrorReason.INSUFFICIENT_BALANCE, cause: error }
|
|
723
804
|
)
|
|
724
805
|
}
|
|
725
806
|
throw error
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict'
|
|
16
16
|
|
|
17
|
-
import WalletManager from '@tetherto/wdk-wallet'
|
|
17
|
+
import WalletManager, { ProviderRequiredError, ValueError } from '@tetherto/wdk-wallet'
|
|
18
18
|
|
|
19
19
|
import WalletManagerEvm from '@tetherto/wdk-wallet-evm'
|
|
20
20
|
|
|
@@ -44,6 +44,7 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
44
44
|
*
|
|
45
45
|
* @param {string | Uint8Array} seed - The wallet's [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
|
|
46
46
|
* @param {EvmErc4337WalletConfig} config - The configuration object.
|
|
47
|
+
* @throws {ValueError} If the `provider` option is set to an empty list.
|
|
47
48
|
*/
|
|
48
49
|
constructor (seed, config) {
|
|
49
50
|
super(seed, config)
|
|
@@ -60,7 +61,7 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
60
61
|
|
|
61
62
|
if (Array.isArray(provider)) {
|
|
62
63
|
if (!provider.length) {
|
|
63
|
-
throw new
|
|
64
|
+
throw new ValueError("The 'provider' option cannot be set to an empty list.")
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
const failoverProvider = new FailoverProvider({ retries })
|
|
@@ -116,10 +117,11 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
116
117
|
* Returns the current fee rates.
|
|
117
118
|
*
|
|
118
119
|
* @returns {Promise<FeeRates>} The fee rates (in weis).
|
|
120
|
+
* @throws {ProviderRequiredError} If the wallet is not connected to a provider.
|
|
119
121
|
*/
|
|
120
122
|
async getFeeRates () {
|
|
121
123
|
if (!this._provider) {
|
|
122
|
-
throw new
|
|
124
|
+
throw new ProviderRequiredError('The wallet must be connected to a provider to get fee rates.')
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
const data = await this._provider.getFeeData()
|
package/types/index.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ export { default as WalletAccountEvmErc4337 } from "./src/wallet-account-evm-erc
|
|
|
4
4
|
export { ConfigurationError } from "./src/errors.js";
|
|
5
5
|
export type UserOperationReceipt = import("./src/wallet-account-read-only-evm-erc-4337.js").UserOperationReceipt;
|
|
6
6
|
export type BuiltUserOperation = import("./src/wallet-account-read-only-evm-erc-4337.js").BuiltUserOperation;
|
|
7
|
+
export type EvmErc4337TransactionDetails = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337TransactionDetails;
|
|
8
|
+
export type Finality = import("@tetherto/wdk-wallet").Finality;
|
|
9
|
+
export type TransactionReceipt = import("@tetherto/wdk-wallet").TransactionReceipt;
|
|
10
|
+
export type WaitForTransactionTarget = import("@tetherto/wdk-wallet").WaitForTransactionTarget;
|
|
11
|
+
export type WaitForTransactionOptions = import("@tetherto/wdk-wallet").WaitForTransactionOptions;
|
|
7
12
|
export type FeeRates = import("@tetherto/wdk-wallet-evm").FeeRates;
|
|
8
13
|
export type KeyPair = import("@tetherto/wdk-wallet-evm").KeyPair;
|
|
9
14
|
export type EvmErc4337Transaction = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337Transaction;
|
package/types/src/errors.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when the wallet configuration is invalid or has missing required fields.
|
|
3
|
+
*
|
|
4
|
+
* It extends {@link ValueError}, so it is also part of the `WdkError` taxonomy.
|
|
5
|
+
*/
|
|
6
|
+
export class ConfigurationError extends ValueError {
|
|
2
7
|
/**
|
|
3
8
|
* Create a new configuration error.
|
|
4
9
|
*
|
|
@@ -6,3 +11,4 @@ export class ConfigurationError extends Error {
|
|
|
6
11
|
*/
|
|
7
12
|
constructor(message: string);
|
|
8
13
|
}
|
|
14
|
+
import { ValueError } from '@tetherto/wdk-wallet';
|
|
@@ -63,7 +63,10 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
63
63
|
* @param {EvmErc4337Transaction} tx - The transaction to include in the user operation.
|
|
64
64
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
65
65
|
* @returns {Promise<UserOperationV7>} The signed user operation.
|
|
66
|
-
* @throws {
|
|
66
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
67
|
+
* @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.
|
|
68
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transaction's cost surpasses the transaction max. fee option.
|
|
69
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
67
70
|
*/
|
|
68
71
|
signTransaction(tx: EvmErc4337Transaction, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<UserOperationV7>;
|
|
69
72
|
/**
|
|
@@ -72,7 +75,8 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
72
75
|
* @param {ApproveOptions} options - The approve options.
|
|
73
76
|
* @param {EvmErc4337GasOverrides} [txOverrides] - If set, applies these UserOperationV7 gas/fee overrides to the underlying transaction.
|
|
74
77
|
* @returns {Promise<TransactionResult>} - The transaction's result.
|
|
75
|
-
* @throws {
|
|
78
|
+
* @throws {ProviderRequiredError} - If the wallet is not connected to a provider.
|
|
79
|
+
* @throws {ValueError} - If trying to approve usdts on ethereum with allowance not equal to zero (due to the usdt allowance reset requirement).
|
|
76
80
|
*/
|
|
77
81
|
approve(options: ApproveOptions, txOverrides?: EvmErc4337GasOverrides): Promise<TransactionResult>;
|
|
78
82
|
/**
|
|
@@ -88,6 +92,9 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
88
92
|
* @param {EvmErc4337Transaction | EvmErc4337Transaction[]} tx - The transaction, or an array of multiple transactions to send in batch.
|
|
89
93
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
90
94
|
* @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
|
|
95
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
96
|
+
* @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.
|
|
97
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
91
98
|
*/
|
|
92
99
|
quoteSendTransaction(tx: EvmErc4337Transaction | EvmErc4337Transaction[] | UserOperationV7, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<Omit<TransactionResult, "hash">>;
|
|
93
100
|
/**
|
|
@@ -101,7 +108,11 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
101
108
|
* @param {EvmErc4337Transaction | EvmErc4337Transaction[]} tx - The transaction, or an array of multiple transactions to send in batch.
|
|
102
109
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
103
110
|
* @returns {Promise<TransactionResult>} The transaction's result.
|
|
104
|
-
* @throws {
|
|
111
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
112
|
+
* @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.
|
|
113
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transaction's cost surpasses the transaction max. fee option.
|
|
114
|
+
* @throws {ValueError} If `nonceKey` is a bigint outside the uint192 range (0 to 2^192 - 1).
|
|
115
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
105
116
|
*/
|
|
106
117
|
sendTransaction(tx: EvmErc4337Transaction | EvmErc4337Transaction[] | UserOperationV7, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<TransactionResult>;
|
|
107
118
|
/**
|
|
@@ -113,7 +124,11 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
113
124
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
114
125
|
* @param {EvmErc4337GasOverrides} [txOverrides] - If set, applies these UserOperationV7 gas/fee overrides to the underlying transaction.
|
|
115
126
|
* @returns {Promise<TransferResult>} The transfer's result.
|
|
116
|
-
* @throws {
|
|
127
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
128
|
+
* @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.
|
|
129
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transfer's cost surpasses the transfer max. fee option.
|
|
130
|
+
* @throws {ValueError} If `nonceKey` is a bigint outside the uint192 range (0 to 2^192 - 1).
|
|
131
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
117
132
|
*/
|
|
118
133
|
transfer(options: TransferOptions, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>, txOverrides?: EvmErc4337GasOverrides): Promise<TransferResult>;
|
|
119
134
|
/**
|
|
@@ -100,7 +100,8 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
100
100
|
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
101
101
|
* @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
|
|
102
102
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
103
|
-
* @throws {
|
|
103
|
+
* @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
|
+
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
104
105
|
*/
|
|
105
106
|
quoteSendTransaction(tx: EvmErc4337Transaction | EvmErc4337Transaction[], config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<Omit<TransactionResult, "hash">>;
|
|
106
107
|
/**
|
|
@@ -114,16 +115,42 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
114
115
|
* @param {EvmErc4337GasOverrides} [txOverrides] - If set, applies these UserOperationV7 gas/fee overrides to the underlying transaction.
|
|
115
116
|
* @returns {Promise<Omit<TransferResult, 'hash'>>} The transfer's quotes.
|
|
116
117
|
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
117
|
-
* @throws {
|
|
118
|
+
* @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
|
+
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
118
120
|
*/
|
|
119
121
|
quoteTransfer(options: TransferOptions, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>, txOverrides?: EvmErc4337GasOverrides): Promise<Omit<TransferResult, "hash">>;
|
|
120
122
|
/**
|
|
121
123
|
* Returns a transaction's receipt.
|
|
122
124
|
*
|
|
125
|
+
* @deprecated Use {@link getTransaction} instead, which returns a normalized, finality-based receipt. The raw ethers receipt and the user operation receipt remain available on its `receipt` and `userOperationReceipt` properties.
|
|
123
126
|
* @param {string} hash - The user operation hash.
|
|
124
127
|
* @returns {Promise<EvmTransactionReceipt | null>} – The receipt, or null if the transaction has not been included in a block yet.
|
|
125
128
|
*/
|
|
126
129
|
getTransactionReceipt(hash: string): Promise<EvmTransactionReceipt | null>;
|
|
130
|
+
/**
|
|
131
|
+
* Returns a normalized, finality-based receipt for a user operation. Finality and confirmations come from the bundling transaction; `success` and `fee` come from the user operation.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} hash - The user operation hash.
|
|
134
|
+
* @returns {Promise<TransactionReceipt & EvmErc4337TransactionDetails>} The normalized receipt.
|
|
135
|
+
* @throws {ValueError} If the hash is not a valid user operation hash.
|
|
136
|
+
* @throws {NoSuchElementError} If no user operation has been found for the given hash.
|
|
137
|
+
*/
|
|
138
|
+
getTransaction(hash: string): Promise<TransactionReceipt & EvmErc4337TransactionDetails>;
|
|
139
|
+
/**
|
|
140
|
+
* Blocks until a user operation reaches a terminal state (the requested finality target or `dropped`), or times out.
|
|
141
|
+
*
|
|
142
|
+
* @param {string} hash - The user operation hash.
|
|
143
|
+
* @param {WaitForTransactionOptions} [options] - The wait options.
|
|
144
|
+
* @returns {Promise<TransactionReceipt & EvmErc4337TransactionDetails>} The terminal receipt: the finality target reached (inspect `success` to tell success from revert), or `dropped`.
|
|
145
|
+
* @throws {TimeoutError} If the target is not reached before the timeout.
|
|
146
|
+
*/
|
|
147
|
+
waitForTransaction(hash: string, options?: WaitForTransactionOptions): Promise<TransactionReceipt & EvmErc4337TransactionDetails>;
|
|
148
|
+
/**
|
|
149
|
+
* Overrides the base default to allow for slower ERC-4337 bundling, inclusion, and confirmation.
|
|
150
|
+
*
|
|
151
|
+
* @type {number}
|
|
152
|
+
*/
|
|
153
|
+
get defaultWaitTimeout(): number;
|
|
127
154
|
/**
|
|
128
155
|
* Returns a user operation's receipt.
|
|
129
156
|
*
|
|
@@ -200,7 +227,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
200
227
|
* @protected
|
|
201
228
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee'>} [config] - The configuration object.
|
|
202
229
|
* @returns {Eip1193Provider} A wrapped Eip1193Provider instance.
|
|
203
|
-
* @throws {
|
|
230
|
+
* @throws {ValueError} If the `provider` option is set to an empty array.
|
|
204
231
|
*/
|
|
205
232
|
protected _createFailoverProvider (config?: Omit<EvmErc4337WalletConfig, "transferMaxFee" | "transactionMaxFee">): Eip1193Provider
|
|
206
233
|
/** @private */
|
|
@@ -239,7 +266,7 @@ export default class WalletAccountReadOnlyEvmErc4337 extends WalletAccountReadOn
|
|
|
239
266
|
* @param {EvmErc4337Transaction[]} txs - The EVM transactions to include in the UserOperation.
|
|
240
267
|
* @param {Omit<EvmErc4337WalletConfig, 'transferMaxFee'>} config - The wallet configuration to use for the build.
|
|
241
268
|
* @returns {Promise<BuiltUserOperation & Omit<TransactionResult, 'hash'>>} The built operation plus its raw fee (no tolerance buffer applied).
|
|
242
|
-
* @throws {
|
|
269
|
+
* @throws {TransactionError} If the token paymaster reports AA50 (account does not hold the paymaster token).
|
|
243
270
|
*/
|
|
244
271
|
protected _getUserOperationGasCost(txs: EvmErc4337Transaction[], config: Omit<EvmErc4337WalletConfig, "transferMaxFee" | "transactionMaxFee">): Promise<BuiltUserOperation & Omit<TransactionResult, "hash">>;
|
|
245
272
|
}
|
|
@@ -250,6 +277,25 @@ export type TransferResult = import("@tetherto/wdk-wallet-evm").TransferResult;
|
|
|
250
277
|
export type EvmTransactionReceipt = import("@tetherto/wdk-wallet-evm").EvmTransactionReceipt;
|
|
251
278
|
export type TypedData = import("@tetherto/wdk-wallet-evm").TypedData;
|
|
252
279
|
export type UserOperationReceipt = import('abstractionkit').UserOperationReceiptResult;
|
|
280
|
+
export type TransactionReceipt = import("@tetherto/wdk-wallet").TransactionReceipt;
|
|
281
|
+
export type WaitForTransactionOptions = import("@tetherto/wdk-wallet").WaitForTransactionOptions;
|
|
282
|
+
/**
|
|
283
|
+
* The ERC-4337-specific fields added to a normalized transaction receipt.
|
|
284
|
+
*/
|
|
285
|
+
export type EvmErc4337TransactionDetails = {
|
|
286
|
+
/**
|
|
287
|
+
* - The number of confirmations (0 while pending or dropped).
|
|
288
|
+
*/
|
|
289
|
+
confirmations: number;
|
|
290
|
+
/**
|
|
291
|
+
* - The native ethers receipt, or null while the user operation is pending or dropped.
|
|
292
|
+
*/
|
|
293
|
+
receipt: EvmTransactionReceipt | null;
|
|
294
|
+
/**
|
|
295
|
+
* - The user operation receipt, or null while pending or unavailable.
|
|
296
|
+
*/
|
|
297
|
+
userOperationReceipt: UserOperationReceipt | null;
|
|
298
|
+
};
|
|
253
299
|
export type EvmErc4337Transaction = {
|
|
254
300
|
/**
|
|
255
301
|
* - The call's recipient.
|
|
@@ -4,6 +4,7 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
4
4
|
*
|
|
5
5
|
* @param {string | Uint8Array} seed - The wallet's [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
|
|
6
6
|
* @param {EvmErc4337WalletConfig} config - The configuration object.
|
|
7
|
+
* @throws {ValueError} If the `provider` option is set to an empty list.
|
|
7
8
|
*/
|
|
8
9
|
constructor(seed: string | Uint8Array, config: EvmErc4337WalletConfig);
|
|
9
10
|
/**
|
|
@@ -37,6 +38,7 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
37
38
|
* Returns the current fee rates.
|
|
38
39
|
*
|
|
39
40
|
* @returns {Promise<FeeRates>} The fee rates (in weis).
|
|
41
|
+
* @throws {ProviderRequiredError} If the wallet is not connected to a provider.
|
|
40
42
|
*/
|
|
41
43
|
getFeeRates(): Promise<FeeRates>;
|
|
42
44
|
}
|