@tetherto/wdk-wallet-evm-erc-4337 1.0.0-beta.2 → 1.0.0-beta.21
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/AGENTS.md +50 -0
- package/LICENSE +176 -0
- package/README.md +93 -680
- package/hardhat.config.js +20 -0
- package/index.js +31 -1
- package/package.json +35 -13
- package/src/errors.js +35 -0
- package/src/wallet-account-evm-erc-4337.js +394 -88
- package/src/wallet-account-read-only-evm-erc-4337.js +826 -118
- package/src/wallet-manager-evm-erc-4337.js +35 -22
- package/types/index.d.ts +26 -1
- package/types/src/errors.d.ts +14 -0
- package/types/src/wallet-account-evm-erc-4337.d.ts +112 -21
- package/types/src/wallet-account-read-only-evm-erc-4337.d.ts +488 -40
- package/types/src/wallet-manager-evm-erc-4337.d.ts +11 -8
|
@@ -14,11 +14,9 @@
|
|
|
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
|
-
import WalletManagerEvm from '@tetherto/wdk-wallet-evm'
|
|
20
|
-
|
|
21
|
-
import { BrowserProvider, JsonRpcProvider } from 'ethers'
|
|
19
|
+
import WalletManagerEvm, { WalletAccountReadOnlyEvm } from '@tetherto/wdk-wallet-evm'
|
|
22
20
|
|
|
23
21
|
import WalletAccountEvmErc4337 from './wallet-account-evm-erc-4337.js'
|
|
24
22
|
|
|
@@ -29,11 +27,20 @@ import WalletAccountEvmErc4337 from './wallet-account-evm-erc-4337.js'
|
|
|
29
27
|
/** @typedef {import('./wallet-account-evm-erc-4337.js').EvmErc4337WalletConfig} EvmErc4337WalletConfig */
|
|
30
28
|
|
|
31
29
|
export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
30
|
+
/**
|
|
31
|
+
* An ethers provider to interact with a node of the blockchain.
|
|
32
|
+
*
|
|
33
|
+
* @protected
|
|
34
|
+
* @type {Provider | undefined}
|
|
35
|
+
*/
|
|
36
|
+
_provider
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* Creates a new wallet manager for evm blockchains that implements the [erc-4337](https://www.erc4337.io/docs) standard and its account abstraction features.
|
|
34
40
|
*
|
|
35
|
-
* @param {string | Uint8Array} seed -
|
|
41
|
+
* @param {string | Uint8Array} seed - A [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) mnemonic seed phrase, or a raw BIP-32 master seed (16-64 bytes).
|
|
36
42
|
* @param {EvmErc4337WalletConfig} config - The configuration object.
|
|
43
|
+
* @throws {ValueError} If the `provider` option is set to an empty list.
|
|
37
44
|
*/
|
|
38
45
|
constructor (seed, config) {
|
|
39
46
|
super(seed, config)
|
|
@@ -46,19 +53,11 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
46
53
|
*/
|
|
47
54
|
this._config = config
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (provider) {
|
|
52
|
-
/**
|
|
53
|
-
* An ethers provider to interact with a node of the blockchain.
|
|
54
|
-
*
|
|
55
|
-
* @protected
|
|
56
|
-
* @type {Provider | undefined}
|
|
57
|
-
*/
|
|
58
|
-
this._provider = typeof provider === 'string'
|
|
59
|
-
? new JsonRpcProvider(provider)
|
|
60
|
-
: new BrowserProvider(provider)
|
|
56
|
+
if (Array.isArray(config.provider) && config.provider.length === 0) {
|
|
57
|
+
throw new ValueError("The 'provider' option cannot be set to an empty list.")
|
|
61
58
|
}
|
|
59
|
+
|
|
60
|
+
this._provider = WalletAccountReadOnlyEvm._buildProvider(config)
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/**
|
|
@@ -85,7 +84,7 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
85
84
|
*/
|
|
86
85
|
async getAccountByPath (path) {
|
|
87
86
|
if (!this._accounts[path]) {
|
|
88
|
-
const account = new WalletAccountEvmErc4337(this.seed, path, this.
|
|
87
|
+
const account = new WalletAccountEvmErc4337(this.seed, path, this._accountConfig())
|
|
89
88
|
|
|
90
89
|
this._accounts[path] = account
|
|
91
90
|
}
|
|
@@ -93,21 +92,35 @@ export default class WalletManagerEvmErc4337 extends WalletManager {
|
|
|
93
92
|
return this._accounts[path]
|
|
94
93
|
}
|
|
95
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Builds the account config, injecting the manager's shared provider so accounts reuse the
|
|
97
|
+
* single ethers provider instance instead of opening their own.
|
|
98
|
+
*
|
|
99
|
+
* @private
|
|
100
|
+
* @returns {EvmErc4337WalletConfig} The account configuration.
|
|
101
|
+
*/
|
|
102
|
+
_accountConfig () {
|
|
103
|
+
return { ...this._config, provider: this._provider }
|
|
104
|
+
}
|
|
105
|
+
|
|
96
106
|
/**
|
|
97
107
|
* Returns the current fee rates.
|
|
98
108
|
*
|
|
99
109
|
* @returns {Promise<FeeRates>} The fee rates (in weis).
|
|
110
|
+
* @throws {ProviderRequiredError} If the wallet is not connected to a provider.
|
|
100
111
|
*/
|
|
101
112
|
async getFeeRates () {
|
|
102
113
|
if (!this._provider) {
|
|
103
|
-
throw new
|
|
114
|
+
throw new ProviderRequiredError('The wallet must be connected to a provider to get fee rates.')
|
|
104
115
|
}
|
|
105
116
|
|
|
106
|
-
const
|
|
117
|
+
const data = await this._provider.getFeeData()
|
|
118
|
+
|
|
119
|
+
const feeRate = data.maxFeePerGas || data.gasPrice
|
|
107
120
|
|
|
108
121
|
return {
|
|
109
|
-
normal:
|
|
110
|
-
fast:
|
|
122
|
+
normal: feeRate * WalletManagerEvm._FEE_RATE_NORMAL_MULTIPLIER / 100n,
|
|
123
|
+
fast: feeRate * WalletManagerEvm._FEE_RATE_FAST_MULTIPLIER / 100n
|
|
111
124
|
}
|
|
112
125
|
}
|
|
113
126
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
export { default } from "./src/wallet-manager-evm-erc-4337.js";
|
|
2
2
|
export { default as WalletAccountReadOnlyEvmErc4337 } from "./src/wallet-account-read-only-evm-erc-4337.js";
|
|
3
3
|
export { default as WalletAccountEvmErc4337 } from "./src/wallet-account-evm-erc-4337.js";
|
|
4
|
+
export { ConfigurationError } from "./src/errors.js";
|
|
5
|
+
export type UserOperationReceipt = import("./src/wallet-account-read-only-evm-erc-4337.js").UserOperationReceipt;
|
|
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;
|
|
4
12
|
export type FeeRates = import("@tetherto/wdk-wallet-evm").FeeRates;
|
|
5
13
|
export type KeyPair = import("@tetherto/wdk-wallet-evm").KeyPair;
|
|
6
|
-
export type
|
|
14
|
+
export type EvmErc4337Transaction = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337Transaction;
|
|
15
|
+
export type EvmErc4337GasOverrides = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337GasOverrides;
|
|
16
|
+
export type EvmErc4337TransferOptions = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337TransferOptions;
|
|
17
|
+
export type EvmErc4337ApproveOptions = import("./src/wallet-account-evm-erc-4337.js").EvmErc4337ApproveOptions;
|
|
18
|
+
export type Nonce = import("./src/wallet-account-read-only-evm-erc-4337.js").Nonce;
|
|
7
19
|
export type TransactionResult = import("@tetherto/wdk-wallet-evm").TransactionResult;
|
|
8
20
|
export type TransferOptions = import("@tetherto/wdk-wallet-evm").TransferOptions;
|
|
9
21
|
export type TransferResult = import("@tetherto/wdk-wallet-evm").TransferResult;
|
|
10
22
|
export type EvmTransactionReceipt = import("@tetherto/wdk-wallet-evm").EvmTransactionReceipt;
|
|
11
23
|
export type ApproveOptions = import("@tetherto/wdk-wallet-evm").ApproveOptions;
|
|
24
|
+
export type TypedData = import("@tetherto/wdk-wallet-evm").TypedData;
|
|
25
|
+
export type TypedDataDomain = import("@tetherto/wdk-wallet-evm").TypedDataDomain;
|
|
26
|
+
export type TypedDataField = import("@tetherto/wdk-wallet-evm").TypedDataField;
|
|
12
27
|
export type EvmErc4337WalletConfig = import("./src/wallet-manager-evm-erc-4337.js").EvmErc4337WalletConfig;
|
|
28
|
+
export type EvmErc4337WalletCommonConfig = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletCommonConfig;
|
|
29
|
+
export type EvmErc4337WalletPaymasterTokenConfig = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletPaymasterTokenConfig;
|
|
30
|
+
export type EvmErc4337WalletSponsorshipPolicyConfig = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletSponsorshipPolicyConfig;
|
|
31
|
+
export type EvmErc4337WalletNativeCoinsConfig = import("./src/wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletNativeCoinsConfig;
|
|
32
|
+
export type OnChainIdentifier = import("./src/wallet-account-read-only-evm-erc-4337.js").OnChainIdentifier;
|
|
33
|
+
export type SafeAccountV0_3_0 = import("./src/wallet-account-read-only-evm-erc-4337.js").SafeAccountV0_3_0;
|
|
34
|
+
export type UserOperationV7 = import("./src/wallet-account-read-only-evm-erc-4337.js").UserOperationV7;
|
|
35
|
+
export type TokenQuote = import("./src/wallet-account-read-only-evm-erc-4337.js").TokenQuote;
|
|
36
|
+
export type MetaTransaction = import("./src/wallet-account-read-only-evm-erc-4337.js").MetaTransaction;
|
|
37
|
+
export type InitCodeOverrides = import("./src/wallet-account-read-only-evm-erc-4337.js").InitCodeOverrides;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new configuration error.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} message - The error message.
|
|
11
|
+
*/
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
import { ValueError } from '@tetherto/wdk-wallet';
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
/** @implements {IWalletAccount} */
|
|
2
|
-
export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc4337 implements IWalletAccount {
|
|
2
|
+
export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc4337 implements IWalletAccount<UserOperationV7> {
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new evm [erc-4337](https://www.erc4337.io/docs) wallet account.
|
|
5
5
|
*
|
|
6
|
-
* @param {string | Uint8Array} seed -
|
|
6
|
+
* @param {string | Uint8Array} seed - A [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) mnemonic seed phrase, or a raw BIP-32 master seed (16-64 bytes).
|
|
7
7
|
* @param {string} path - The BIP-44 derivation path (e.g. "0'/0/0").
|
|
8
8
|
* @param {EvmErc4337WalletConfig} config - The configuration object.
|
|
9
9
|
*/
|
|
10
10
|
constructor(seed: string | Uint8Array, path: string, config: EvmErc4337WalletConfig);
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
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;
|
|
21
|
+
/**
|
|
22
|
+
* The evm erc-4337 wallet account configuration.
|
|
13
23
|
*
|
|
14
24
|
* @protected
|
|
15
25
|
* @type {EvmErc4337WalletConfig}
|
|
@@ -17,6 +27,8 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
17
27
|
protected _config: EvmErc4337WalletConfig;
|
|
18
28
|
/** @private */
|
|
19
29
|
private _ownerAccount;
|
|
30
|
+
/** @private */
|
|
31
|
+
private _quoteCache;
|
|
20
32
|
/**
|
|
21
33
|
* The derivation path's index of this account.
|
|
22
34
|
*
|
|
@@ -32,6 +44,10 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
32
44
|
/**
|
|
33
45
|
* The account's key pair.
|
|
34
46
|
*
|
|
47
|
+
* The uint8 arrays are bound to the wallet account, so any external change will reflect to the internal representation. For this reason,
|
|
48
|
+
* it's strongly recommended to treat the key pair as a read-only view of the keys. While it's still technically possible to alter their
|
|
49
|
+
* content, client code should never do so.
|
|
50
|
+
*
|
|
35
51
|
* @type {KeyPair}
|
|
36
52
|
*/
|
|
37
53
|
get keyPair(): KeyPair;
|
|
@@ -43,37 +59,86 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
43
59
|
*/
|
|
44
60
|
sign(message: string): Promise<string>;
|
|
45
61
|
/**
|
|
46
|
-
*
|
|
62
|
+
* Signs typed data according to EIP-712.
|
|
63
|
+
*
|
|
64
|
+
* @param {TypedData} typedData - The typed data to sign.
|
|
65
|
+
* @returns {Promise<string>} The typed data signature.
|
|
66
|
+
*/
|
|
67
|
+
signTypedData({ domain, types, message }: TypedData): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Signs a user operation built from the given transaction.
|
|
70
|
+
*
|
|
71
|
+
* If the transaction is not sponsored, it also estimates the transaction's costs and checks them against the transaction max. fee option.
|
|
47
72
|
*
|
|
48
|
-
* @param {
|
|
49
|
-
* @param {
|
|
50
|
-
* @returns {Promise<
|
|
73
|
+
* @param {EvmErc4337Transaction} tx - The transaction to include in the user operation.
|
|
74
|
+
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
75
|
+
* @returns {Promise<UserOperationV7>} The signed user operation.
|
|
76
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
77
|
+
* @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.
|
|
78
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transaction's cost surpasses the transaction max. fee option.
|
|
79
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
51
80
|
*/
|
|
52
|
-
|
|
81
|
+
signTransaction(tx: EvmErc4337Transaction, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<UserOperationV7>;
|
|
53
82
|
/**
|
|
54
83
|
* Approves a specific amount of tokens to a spender.
|
|
55
84
|
*
|
|
56
|
-
* @param {
|
|
57
|
-
* @returns {Promise<TransactionResult>} - The transaction
|
|
58
|
-
* @throws {
|
|
85
|
+
* @param {EvmErc4337ApproveOptions} options - The approve options, including any UserOperationV7 gas/fee overrides to apply to the underlying transaction.
|
|
86
|
+
* @returns {Promise<TransactionResult>} - The transaction's result.
|
|
87
|
+
* @throws {ProviderRequiredError} - If the wallet is not connected to a provider.
|
|
88
|
+
* @throws {ValueError} - If trying to approve usdts on ethereum with allowance not equal to zero (due to the usdt allowance reset requirement).
|
|
59
89
|
*/
|
|
60
|
-
approve(options:
|
|
90
|
+
approve(options: EvmErc4337ApproveOptions): Promise<TransactionResult>;
|
|
91
|
+
/**
|
|
92
|
+
* Quotes the costs of a send transaction operation.
|
|
93
|
+
*
|
|
94
|
+
* The result is cached internally for up to 2 minutes. A subsequent `sendTransaction` with the
|
|
95
|
+
* same transaction reuses the cached operation — skipping the gas-estimation and paymaster
|
|
96
|
+
* round-trips — after a lightweight on-chain nonce check, re-quoting only if the nonce has moved.
|
|
97
|
+
*
|
|
98
|
+
* In a batched call (`tx` passed as `[tx1, tx2, ...]`), only the gas overrides on `tx1` are
|
|
99
|
+
* honored — a UserOperation has a single set of gas fields regardless of how many calls it batches.
|
|
100
|
+
*
|
|
101
|
+
* @param {EvmErc4337Transaction | EvmErc4337Transaction[]} tx - The transaction, or an array of multiple transactions to send in batch.
|
|
102
|
+
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
103
|
+
* @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
|
|
104
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
105
|
+
* @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.
|
|
106
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
107
|
+
*/
|
|
108
|
+
quoteSendTransaction(tx: EvmErc4337Transaction | EvmErc4337Transaction[] | UserOperationV7, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<Omit<TransactionResult, "hash">>;
|
|
61
109
|
/**
|
|
62
110
|
* Sends a transaction.
|
|
63
111
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
112
|
+
* In a batched call (`tx` passed as `[tx1, tx2, ...]`), only the gas overrides on `tx1` are
|
|
113
|
+
* honored — a UserOperation has a single set of gas fields regardless of how many calls it batches.
|
|
114
|
+
*
|
|
115
|
+
* If the transaction is not sponsored, it also estimates the transaction's costs and checks them against the transaction max. fee option.
|
|
116
|
+
*
|
|
117
|
+
* @param {EvmErc4337Transaction | EvmErc4337Transaction[]} tx - The transaction, or an array of multiple transactions to send in batch.
|
|
118
|
+
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
66
119
|
* @returns {Promise<TransactionResult>} The transaction's result.
|
|
120
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
121
|
+
* @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.
|
|
122
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transaction's cost surpasses the transaction max. fee option.
|
|
123
|
+
* @throws {ValueError} If `nonceKey` is a bigint outside the uint192 range (0 to 2^192 - 1).
|
|
124
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
67
125
|
*/
|
|
68
|
-
sendTransaction(tx:
|
|
126
|
+
sendTransaction(tx: EvmErc4337Transaction | EvmErc4337Transaction[] | UserOperationV7, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<TransactionResult>;
|
|
69
127
|
/**
|
|
70
128
|
* Transfers a token to another address.
|
|
71
129
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
130
|
+
* If the transaction is not sponsored, it also estimates the transfer's costs and checks them against the transfer max. fee option.
|
|
131
|
+
*
|
|
132
|
+
* @param {EvmErc4337TransferOptions} options - The transfer's options, including any UserOperationV7 gas/fee overrides to apply to the underlying transaction.
|
|
133
|
+
* @param {Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>} [config] - If set, overrides the given configuration options.
|
|
74
134
|
* @returns {Promise<TransferResult>} The transfer's result.
|
|
135
|
+
* @throws {ConfigurationError} If the override `config` is invalid or has missing required fields.
|
|
136
|
+
* @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.
|
|
137
|
+
* @throws {MaximumFeeExceededError} If the transaction is not sponsored, and the transfer's cost surpasses the transfer max. fee option.
|
|
138
|
+
* @throws {ValueError} If `nonceKey` is a bigint outside the uint192 range (0 to 2^192 - 1).
|
|
139
|
+
* @throws {TransactionError} If the paymaster reports AA50 (the account cannot repay the paymaster).
|
|
75
140
|
*/
|
|
76
|
-
transfer(options:
|
|
141
|
+
transfer(options: EvmErc4337TransferOptions, config?: Partial<EvmErc4337WalletPaymasterTokenConfig | EvmErc4337WalletSponsorshipPolicyConfig | EvmErc4337WalletNativeCoinsConfig>): Promise<TransferResult>;
|
|
77
142
|
/**
|
|
78
143
|
* Returns a read-only copy of the account.
|
|
79
144
|
*
|
|
@@ -85,15 +150,41 @@ export default class WalletAccountEvmErc4337 extends WalletAccountReadOnlyEvmErc
|
|
|
85
150
|
*/
|
|
86
151
|
dispose(): void;
|
|
87
152
|
/** @private */
|
|
153
|
+
private _prepareForSend;
|
|
154
|
+
/** @private */
|
|
155
|
+
private _buildAtNonce;
|
|
156
|
+
/** @private */
|
|
157
|
+
private _resolveNonce;
|
|
158
|
+
/** @private */
|
|
159
|
+
private static _getTxKey;
|
|
160
|
+
/** @private */
|
|
161
|
+
private _consumeCachedQuote;
|
|
162
|
+
/** @private */
|
|
163
|
+
private _signUserOperation;
|
|
164
|
+
/** @private */
|
|
88
165
|
private _sendUserOperation;
|
|
166
|
+
private _broadcastSignedUserOperation;
|
|
167
|
+
private static _isSignedUserOperation;
|
|
168
|
+
private static _getSignedUserOperationFee;
|
|
89
169
|
}
|
|
90
170
|
export type Eip1193Provider = import("ethers").Eip1193Provider;
|
|
91
|
-
export type IWalletAccount = import("@tetherto/wdk-wallet").IWalletAccount
|
|
171
|
+
export type IWalletAccount<TSignedTransaction> = import("@tetherto/wdk-wallet").IWalletAccount<TSignedTransaction>;
|
|
92
172
|
export type KeyPair = import("@tetherto/wdk-wallet-evm").KeyPair;
|
|
93
|
-
export type
|
|
173
|
+
export type EvmErc4337Transaction = import("./wallet-account-read-only-evm-erc-4337.js").EvmErc4337Transaction;
|
|
174
|
+
export type EvmErc4337GasOverrides = import("./wallet-account-read-only-evm-erc-4337.js").EvmErc4337GasOverrides;
|
|
175
|
+
export type EvmErc4337TransferOptions = import("./wallet-account-read-only-evm-erc-4337.js").EvmErc4337TransferOptions;
|
|
94
176
|
export type TransactionResult = import("@tetherto/wdk-wallet-evm").TransactionResult;
|
|
95
|
-
export type TransferOptions = import("@tetherto/wdk-wallet-evm").TransferOptions;
|
|
96
177
|
export type TransferResult = import("@tetherto/wdk-wallet-evm").TransferResult;
|
|
97
178
|
export type ApproveOptions = import("@tetherto/wdk-wallet-evm").ApproveOptions;
|
|
98
179
|
export type EvmErc4337WalletConfig = import("./wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletConfig;
|
|
180
|
+
export type EvmErc4337WalletPaymasterTokenConfig = import("./wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletPaymasterTokenConfig;
|
|
181
|
+
export type EvmErc4337WalletSponsorshipPolicyConfig = import("./wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletSponsorshipPolicyConfig;
|
|
182
|
+
export type TypedData = import("./wallet-account-read-only-evm-erc-4337.js").TypedData;
|
|
183
|
+
export type EvmErc4337WalletNativeCoinsConfig = import("./wallet-account-read-only-evm-erc-4337.js").EvmErc4337WalletNativeCoinsConfig;
|
|
184
|
+
/**
|
|
185
|
+
* The options of a token approval, extended with the optional UserOperationV7 gas overrides.
|
|
186
|
+
*/
|
|
187
|
+
export type EvmErc4337ApproveOptions = ApproveOptions & EvmErc4337GasOverrides;
|
|
188
|
+
export type UserOperationV7 = import("abstractionkit").UserOperationV7;
|
|
189
|
+
export type SafeAccountV0_3_0 = import("abstractionkit").SafeAccountV0_3_0;
|
|
99
190
|
import WalletAccountReadOnlyEvmErc4337 from './wallet-account-read-only-evm-erc-4337.js';
|