@tetherto/wdk-wallet-evm 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.
@@ -1,45 +1,78 @@
1
- /** @implements {IWalletAccount} */
2
- export default class WalletAccountEvm extends WalletAccountReadOnlyEvm implements IWalletAccount {
1
+ /** @implements {IWalletAccount<string>} */
2
+ export default class WalletAccountEvm extends WalletAccountReadOnlyEvm implements IWalletAccount<string> {
3
3
  /**
4
- * Creates a new evm wallet account.
4
+ * Creates a new evm wallet account from a raw private key.
5
5
  *
6
- * @param {string | Uint8Array} seed - The wallet's [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) seed phrase.
7
- * @param {string} path - The BIP-44 derivation path (e.g. "0'/0/0").
6
+ * @param {string | Uint8Array} privateKey - The raw private key (hex string with or without 0x, or 32 bytes).
8
7
  * @param {EvmWalletConfig} [config] - The configuration object.
8
+ * @returns {WalletAccountEvm} The wallet account.
9
+ */
10
+ static fromPrivateKey(privateKey: string | Uint8Array, config?: EvmWalletConfig): WalletAccountEvm;
11
+ /**
12
+ * Creates a new evm wallet account from a BIP-39 seed, deriving the account's key at the
13
+ * given BIP-44 path.
14
+ *
15
+ * @param {string | Uint8Array} seed - A BIP-39 mnemonic seed phrase, or a raw BIP-32 master seed (16-64 bytes).
16
+ * @param {string} path - The BIP-44 account path, relative to "m/44'/60'" (e.g. "0'/0/0").
17
+ * @param {EvmWalletConfig} [config] - The configuration object.
18
+ * @throws {ValueError} If the given seed phrase is invalid.
9
19
  */
10
20
  constructor(seed: string | Uint8Array, path: string, config?: EvmWalletConfig);
11
21
  /**
12
- * The wallet account configuration.
22
+ * Creates a new evm wallet account from a BIP-39 seed at path m/44'/60'/0'/0/0.
13
23
  *
14
- * @protected
15
- * @type {EvmWalletConfig}
24
+ * @param {string | Uint8Array} seed - A BIP-39 mnemonic seed phrase, or a raw BIP-32 master seed (16-64 bytes).
25
+ * @param {EvmWalletConfig} [config] - The configuration object.
26
+ * @throws {ValueError} If the given seed phrase is invalid.
16
27
  */
17
- protected _config: EvmWalletConfig;
28
+ constructor(seed: string | Uint8Array, config?: EvmWalletConfig);
29
+ /**
30
+ * Creates a new evm wallet account using a signer.
31
+ *
32
+ * @param {ISignerEvm} signer - A signer implementing the EVM signer interface.
33
+ * @param {EvmWalletConfig & SignerOptions} [config] - The configuration object.
34
+ */
35
+ constructor(signer: ISignerEvm, config?: EvmWalletConfig & SignerOptions);
18
36
  /**
19
- * The account.
37
+ * If true, disposes the signer on calls to the 'dispose' method. Always true for an
38
+ * account created from a seed, which owns its internally created signer.
20
39
  *
21
40
  * @protected
22
- * @type {HDNodeWallet}
41
+ * @type {boolean}
23
42
  */
24
- protected _account: HDNodeWallet;
43
+ protected _shouldWipeSignerOnDisposal: boolean;
25
44
  /**
26
- * The derivation path's index of this account.
45
+ * The wallet account configuration.
27
46
  *
28
- * @type {number}
47
+ * @protected
48
+ * @type {EvmWalletConfig}
29
49
  */
30
- get index(): number;
50
+ protected _config: EvmWalletConfig;
51
+ /** @private */
52
+ private _signer;
31
53
  /**
32
- * The derivation path of this account (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)).
54
+ * The derivation path of this account (see [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)),
55
+ * or null if the account's signer is not bound to a BIP-44 position (e.g. private-key signers).
33
56
  *
34
- * @type {string}
57
+ * @type {string | null}
35
58
  */
36
- get path(): string;
59
+ get path(): string | null;
37
60
  /**
38
61
  * The account's key pair.
39
62
  *
40
- * @type {KeyPair}
63
+ * The uint8 arrays are bound to the wallet account, so any external change will reflect to the internal representation. For this reason,
64
+ * 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
65
+ * content, client code should never do so.
66
+ *
67
+ * @type {KeyPair | null}
68
+ */
69
+ get keyPair(): KeyPair | null;
70
+ /**
71
+ * Returns the account's address.
72
+ *
73
+ * @returns {Promise<string>} The account's address.
41
74
  */
42
- get keyPair(): KeyPair;
75
+ getAddress(): Promise<string>;
43
76
  /**
44
77
  * Signs a message.
45
78
  *
@@ -48,27 +81,66 @@ export default class WalletAccountEvm extends WalletAccountReadOnlyEvm implement
48
81
  */
49
82
  sign(message: string): Promise<string>;
50
83
  /**
51
- * Verifies a message's signature.
84
+ * Signs typed data according to EIP-712.
52
85
  *
53
- * @param {string} message - The original message.
54
- * @param {string} signature - The signature to verify.
55
- * @returns {Promise<boolean>} True if the signature is valid.
86
+ * @param {TypedData} typedData - The typed data to sign.
87
+ * @returns {Promise<string>} The typed data signature.
56
88
  */
57
- verify(message: string, signature: string): Promise<boolean>;
89
+ signTypedData({ domain, types, message }: TypedData): Promise<string>;
90
+ /**
91
+ * Signs a transaction.
92
+ *
93
+ * If a provider is set, it also estimates the transaction's costs and checks them against the transaction max. fee option.
94
+ *
95
+ * @param {EvmTransaction} tx - The transaction to sign.
96
+ * @returns {Promise<string>} The signed transaction as a hex string.
97
+ * @throws {MaximumFeeExceededError} If a provider is set, and the transaction's cost surpasses the transaction max. fee option.
98
+ */
99
+ signTransaction(tx: EvmTransaction): Promise<string>;
58
100
  /**
59
101
  * Sends a transaction.
60
102
  *
61
- * @param {EvmTransaction} tx - The transaction.
103
+ * @param {EvmTransaction | string} tx - The transaction, or a signed raw transaction as a hex string.
62
104
  * @returns {Promise<TransactionResult>} The transaction's result.
105
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
106
+ * @throws {MaximumFeeExceededError} If the transaction's cost exceeds the maximum transaction fee option.
107
+ * @throws {ValueError} If the transaction mixes fee fields that its type doesn't support, or a type 3 transaction omits `maxFeePerBlobGas`.
63
108
  */
64
- sendTransaction(tx: EvmTransaction): Promise<TransactionResult>;
109
+ sendTransaction(tx: EvmTransaction | string): Promise<TransactionResult>;
110
+ /**
111
+ * Quotes the costs of a send transaction operation.
112
+ *
113
+ * The transaction is always simulated through gas estimation, so one that would revert is rejected here instead of
114
+ * reaching the signer. A `gasLimit` set on the transaction replaces the estimated gas in the quote, and a `maxFeePerGas`
115
+ * (or `gasPrice`) set on it replaces the fee rate fetched from the provider, so the quote is the transaction's maximum
116
+ * cost as it will be sent.
117
+ * A signed raw transaction is simulated the same way and quoted from its own gas limit and fee cap.
118
+ *
119
+ * @param {EvmTransaction | string} tx - The transaction, or a signed raw transaction as a hex string.
120
+ * @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
121
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
122
+ * @throws {ValueError} If the transaction mixes fee fields that its type doesn't support, or a type 3 transaction omits `maxFeePerBlobGas`.
123
+ * @throws {Error} If the simulation of the transaction reverts, as an ethers error with code `CALL_EXCEPTION`.
124
+ */
125
+ quoteSendTransaction(tx: EvmTransaction | string): Promise<Omit<TransactionResult, "hash">>;
65
126
  /**
66
127
  * Transfers a token to another address.
67
128
  *
68
- * @param {TransferOptions} options - The transfer's options.
129
+ * @param {EvmTransferOptions} options - The transfer's options, including any gas overrides to carry onto the transaction.
69
130
  * @returns {Promise<TransferResult>} The transfer's result.
131
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
132
+ * @throws {MaximumFeeExceededError} If the transfer's cost exceeds the maximum transfer fee option.
70
133
  */
71
- transfer(options: TransferOptions): Promise<TransferResult>;
134
+ transfer(options: EvmTransferOptions): Promise<TransferResult>;
135
+ /**
136
+ * Approves a specific amount of tokens to a spender.
137
+ *
138
+ * @param {EvmApproveOptions} options - The approve options, including any gas overrides to carry onto the transaction.
139
+ * @returns {Promise<TransactionResult>} The transaction's result.
140
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
141
+ * @throws {ValueError} If trying to approve usdts on ethereum with allowance not equal to zero (due to the usdt allowance reset requirement).
142
+ */
143
+ approve(options: EvmApproveOptions): Promise<TransactionResult>;
72
144
  /**
73
145
  * Returns a read-only copy of the account.
74
146
  *
@@ -76,16 +148,78 @@ export default class WalletAccountEvm extends WalletAccountReadOnlyEvm implement
76
148
  */
77
149
  toReadOnlyAccount(): Promise<WalletAccountReadOnlyEvm>;
78
150
  /**
79
- * Disposes the wallet account, erasing the private key from the memory.
151
+ * Signs an ERC-7702 authorization tuple.
152
+ *
153
+ * The chainId and nonce are populated from the provider when not explicitly provided.
154
+ *
155
+ * @param {AuthorizationRequest} auth - The authorization request.
156
+ * @returns {Promise<Authorization>} The signed authorization.
157
+ * @throws {ProviderRequiredError} If the chainId or nonce are not provided and the wallet is not connected to a provider.
158
+ */
159
+ signAuthorization(auth: AuthorizationRequest): Promise<Authorization>;
160
+ /**
161
+ * Delegates this EOA to a smart contract via an ERC-7702 type 4 transaction.
162
+ *
163
+ * The transaction is sent to the EOA itself with zero value and no data.
164
+ * A fixed gas limit is used because `eth_estimateGas` may revert when
165
+ * the delegate contract lacks a `receive`/`fallback` function.
166
+ *
167
+ * @param {string} delegateAddress - The address of the contract to delegate to.
168
+ * @returns {Promise<TransactionResult>} The transaction result.
169
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
170
+ */
171
+ delegate(delegateAddress: string): Promise<TransactionResult>;
172
+ /**
173
+ * Revokes any active ERC-7702 delegation by delegating to the zero address.
174
+ *
175
+ * @returns {Promise<TransactionResult>} The transaction result.
176
+ */
177
+ revokeDelegation(): Promise<TransactionResult>;
178
+ /**
179
+ * Disposes the wallet account, erasing the private key from the memory. The signer is
180
+ * wiped only if the account owns it: always for an account created from a seed, otherwise
181
+ * only when `shouldWipeSignerOnDisposal` was set in the config -- a caller-supplied signer
182
+ * is left untouched by default.
80
183
  */
81
184
  dispose(): void;
82
185
  }
186
+ export type ISignerEvm = import("./signers/signer-evm.js").ISignerEvm;
83
187
  export type HDNodeWallet = import("ethers").HDNodeWallet;
84
- export type IWalletAccount = import("@tetherto/wdk-wallet").IWalletAccount;
188
+ export type AuthorizationRequest = import("ethers").AuthorizationRequest;
189
+ export type Authorization = import("ethers").Authorization;
190
+ export type AuthorizationLike = import("ethers").AuthorizationLike;
191
+ export type IWalletAccount<TSignedTransaction> = import("@tetherto/wdk-wallet").IWalletAccount<TSignedTransaction>;
85
192
  export type KeyPair = import("@tetherto/wdk-wallet").KeyPair;
193
+ export type ProviderRequiredError = import("@tetherto/wdk-wallet").ProviderRequiredError;
86
194
  export type TransactionResult = import("@tetherto/wdk-wallet").TransactionResult;
87
- export type TransferOptions = import("@tetherto/wdk-wallet").TransferOptions;
88
195
  export type TransferResult = import("@tetherto/wdk-wallet").TransferResult;
196
+ export type TypedData = import("./wallet-account-read-only-evm.js").TypedData;
89
197
  export type EvmTransaction = import("./wallet-account-read-only-evm.js").EvmTransaction;
198
+ export type EvmTransferOptions = import("./wallet-account-read-only-evm.js").EvmTransferOptions;
199
+ export type EvmGasOverrides = import("./wallet-account-read-only-evm.js").EvmGasOverrides;
90
200
  export type EvmWalletConfig = import("./wallet-account-read-only-evm.js").EvmWalletConfig;
201
+ export type ApproveOptions = {
202
+ /**
203
+ * - The address of the token to approve.
204
+ */
205
+ token: string;
206
+ /**
207
+ * - The spender's address.
208
+ */
209
+ spender: string;
210
+ /**
211
+ * - The amount of tokens to approve to the spender.
212
+ */
213
+ amount: number | bigint;
214
+ };
215
+ export type SignerOptions = {
216
+ /**
217
+ * - If true, wipes the signer given at construction on calls to the 'dispose' method.
218
+ */
219
+ shouldWipeSignerOnDisposal?: boolean;
220
+ };
221
+ /**
222
+ * The options of a token approval, extended with the optional gas overrides of an evm transaction.
223
+ */
224
+ export type EvmApproveOptions = ApproveOptions & EvmGasOverrides;
91
225
  import WalletAccountReadOnlyEvm from './wallet-account-read-only-evm.js';
@@ -1,26 +1,62 @@
1
1
  export default class WalletAccountReadOnlyEvm extends WalletAccountReadOnly {
2
+ /**
3
+ * Extracts the gas and fee overrides set on transfer or approve options.
4
+ *
5
+ * @protected
6
+ * @param {EvmGasOverrides} options - The options to read the overrides from.
7
+ * @returns {EvmGasOverrides} Only the gas and fee fields that are set on the options.
8
+ */
9
+ protected static _getGasOverrides(options: EvmGasOverrides): EvmGasOverrides;
10
+ /**
11
+ * Whether a value is an EIP-1193 provider (e.g. a browser wallet).
12
+ *
13
+ * @protected
14
+ * @param {string | Eip1193Provider | Provider} value - The value to inspect.
15
+ * @returns {boolean} True if the value is an EIP-1193 provider.
16
+ */
17
+ protected static _isEip1193Provider(value: string | Eip1193Provider | Provider): boolean;
18
+ /**
19
+ * Builds an ethers provider from the wallet configuration:
20
+ * - a url string -> a new `JsonRpcProvider`
21
+ * - an already-built ethers provider (or failover wrapper) -> reused as-is
22
+ * - anything else (EIP-1193 / browser wallet) -> wrapped in a `BrowserProvider`
23
+ * - an array of the above -> a `FailoverProvider` across each entry
24
+ *
25
+ * @protected
26
+ * @param {Omit<EvmWalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} [config] - The configuration object.
27
+ * @returns {Provider | undefined} The provider, or undefined if none is configured.
28
+ */
29
+ protected static _buildProvider(config?: Omit<EvmWalletConfig, "transferMaxFee" | "transactionMaxFee">): Provider | undefined;
30
+ /**
31
+ * Validates that a transaction does not mix fee fields its type doesn't support.
32
+ *
33
+ * @protected
34
+ * @param {EvmTransaction} tx - The transaction to validate.
35
+ * @throws {ValueError} If the transaction mixes fee fields that its type doesn't support, or a type 3 transaction omits `maxFeePerBlobGas`.
36
+ */
37
+ protected static _validateFeeFields(tx: EvmTransaction): void;
2
38
  /**
3
39
  * Returns an evm transaction to execute the given token transfer.
4
40
  *
5
41
  * @protected
6
- * @param {TransferOptions} options - The transfer's options.
7
- * @returns {Promise<EvmTransaction>} The evm transaction.
42
+ * @param {EvmTransferOptions} options - The transfer's options, including any gas overrides and ERC-7702 authorizations to carry onto the transaction.
43
+ * @returns {Promise<EvmTransaction>} The ERC-20 transfer call as an evm transaction, with the options' gas overrides and authorizations applied.
8
44
  */
9
- protected static _getTransferTransaction(options: TransferOptions): Promise<EvmTransaction>;
45
+ protected static _getTransferTransaction(options: EvmTransferOptions): Promise<EvmTransaction>;
10
46
  /**
11
47
  * Creates a new evm read-only wallet account.
12
48
  *
13
49
  * @param {string} address - The account's address.
14
- * @param {Omit<EvmWalletConfig, 'transferMaxFee'>} [config] - The configuration object.
50
+ * @param {Omit<EvmWalletConfig, 'transferMaxFee' | 'transactionMaxFee'>} [config] - The configuration object.
15
51
  */
16
- constructor(address: string, config?: Omit<EvmWalletConfig, "transferMaxFee">);
52
+ constructor(address: string, config?: Omit<EvmWalletConfig, "transferMaxFee" | "transactionMaxFee">);
17
53
  /**
18
54
  * The read-only wallet account configuration.
19
55
  *
20
56
  * @protected
21
- * @type {Omit<EvmWalletConfig, 'transferMaxFee'>}
57
+ * @type {Omit<EvmWalletConfig, 'transferMaxFee' | 'transactionMaxFee'>}
22
58
  */
23
- protected _config: Omit<EvmWalletConfig, "transferMaxFee">;
59
+ protected _config: Omit<EvmWalletConfig, "transferMaxFee" | "transactionMaxFee">;
24
60
  /**
25
61
  * An ethers provider to interact with a node of the blockchain.
26
62
  *
@@ -28,10 +64,20 @@ export default class WalletAccountReadOnlyEvm extends WalletAccountReadOnly {
28
64
  * @type {Provider | undefined}
29
65
  */
30
66
  protected _provider: Provider | undefined;
67
+ /**
68
+ * The account's address, or undefined if the account's signer doesn't expose its address
69
+ * synchronously.
70
+ *
71
+ * @deprecated Use {@link getAddress} instead. This property will be removed in an upcoming
72
+ * release: not all signers (e.g. hardware signers) can expose the address synchronously.
73
+ * @type {string | undefined}
74
+ */
75
+ get address(): string | undefined;
31
76
  /**
32
77
  * Returns the account's eth balance.
33
78
  *
34
79
  * @returns {Promise<bigint>} The eth balance (in weis).
80
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
35
81
  */
36
82
  getBalance(): Promise<bigint>;
37
83
  /**
@@ -39,41 +85,192 @@ export default class WalletAccountReadOnlyEvm extends WalletAccountReadOnly {
39
85
  *
40
86
  * @param {string} tokenAddress - The smart contract address of the token.
41
87
  * @returns {Promise<bigint>} The token balance (in base unit).
88
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
42
89
  */
43
90
  getTokenBalance(tokenAddress: string): Promise<bigint>;
91
+ /**
92
+ * Returns the account balances for multiple tokens.
93
+ *
94
+ * @param {string[]} tokenAddresses - The smart contract addresses of the tokens.
95
+ * @returns {Promise<Record<string, bigint>>} A mapping of token addresses to their balances (in base units).
96
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
97
+ */
98
+ getTokenBalances(tokenAddresses: string[]): Promise<Record<string, bigint>>;
44
99
  /**
45
100
  * Quotes the costs of a send transaction operation.
46
101
  *
102
+ * The transaction is always simulated through gas estimation, so one that would revert is rejected here instead of
103
+ * reaching the signer. A `gasLimit` set on the transaction replaces the estimated gas in the quote, and a `maxFeePerGas`
104
+ * (or `gasPrice`) set on it replaces the fee rate fetched from the provider, so the quote is the transaction's maximum
105
+ * cost as it will be sent.
106
+ *
47
107
  * @param {EvmTransaction} tx - The transaction.
48
108
  * @returns {Promise<Omit<TransactionResult, 'hash'>>} The transaction's quotes.
109
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
110
+ * @throws {ValueError} If the transaction mixes fee fields that its type doesn't support, or a type 3 transaction omits `maxFeePerBlobGas`.
111
+ * @throws {Error} If the simulation of the transaction reverts, as an ethers error with code `CALL_EXCEPTION`.
49
112
  */
50
113
  quoteSendTransaction(tx: EvmTransaction): Promise<Omit<TransactionResult, "hash">>;
51
114
  /**
52
115
  * Quotes the costs of a transfer operation.
53
116
  *
54
- * @param {TransferOptions} options - The transfer's options.
117
+ * @param {EvmTransferOptions} options - The transfer's options, including any gas overrides to carry onto the transaction.
55
118
  * @returns {Promise<Omit<TransferResult, 'hash'>>} The transfer's quotes.
119
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
120
+ * @throws {ValueError} If the options mix gas override fields that the transaction's type doesn't support.
121
+ * @throws {Error} If the simulation of the transfer reverts, as an ethers error with code `CALL_EXCEPTION`.
56
122
  */
57
- quoteTransfer(options: TransferOptions): Promise<Omit<TransferResult, "hash">>;
123
+ quoteTransfer(options: EvmTransferOptions): Promise<Omit<TransferResult, "hash">>;
58
124
  /**
59
125
  * Returns a transaction's receipt.
60
126
  *
127
+ * @deprecated Use {@link getTransaction} instead, which returns a normalized, finality-based receipt. The raw ethers receipt remains available on its `receipt` property.
61
128
  * @param {string} hash - The transaction's hash.
62
129
  * @returns {Promise<EvmTransactionReceipt | null>} – The receipt, or null if the transaction has not been included in a block yet.
130
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
63
131
  */
64
132
  getTransactionReceipt(hash: string): Promise<EvmTransactionReceipt | null>;
133
+ /**
134
+ * Returns a normalized, finality-based receipt for a transaction.
135
+ *
136
+ * @param {string} hash - The transaction's hash.
137
+ * @returns {Promise<TransactionReceipt & EvmTransactionDetails>} The normalized receipt.
138
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
139
+ * @throws {ValueError} If the hash is not a valid transaction hash.
140
+ * @throws {NoSuchElementError} If no transaction has been found for the given hash.
141
+ */
142
+ getTransaction(hash: string): Promise<TransactionReceipt & EvmTransactionDetails>;
143
+ /**
144
+ * Blocks until a transaction reaches a terminal state (the requested finality target or `dropped`), or times out.
145
+ *
146
+ * @param {string} hash - The transaction's hash.
147
+ * @param {WaitForTransactionOptions} [options] - The wait options.
148
+ * @returns {Promise<TransactionReceipt & EvmTransactionDetails>} The terminal receipt: the finality target reached (inspect `success` to tell success from revert), or `dropped`.
149
+ * @throws {TimeoutError} If the target is not reached before the timeout.
150
+ */
151
+ waitForTransaction(hash: string, options?: WaitForTransactionOptions): Promise<TransactionReceipt & EvmTransactionDetails>;
152
+ /**
153
+ * Returns whether a block is at or below the chain's `finalized` block. Chains that don't support the tag are treated as not finalized.
154
+ *
155
+ * @protected
156
+ * @param {number} blockNumber - The block number to check.
157
+ * @returns {Promise<boolean>} True if the block is finalized.
158
+ */
159
+ protected _isFinalized(blockNumber: number): Promise<boolean>;
160
+ /**
161
+ * Returns whether an unmined transaction has been replaced, i.e. its sender's mined nonce has already advanced past the transaction's nonce.
162
+ *
163
+ * @protected
164
+ * @param {EvmTransactionResponse} transaction - The unmined transaction.
165
+ * @returns {Promise<boolean>} True if the transaction's nonce slot is already taken.
166
+ */
167
+ protected _isReplaced(transaction: EvmTransactionResponse): Promise<boolean>;
168
+ /**
169
+ * Overrides the base default to allow for slower EVM inclusion and confirmation.
170
+ *
171
+ * @type {number}
172
+ */
173
+ get defaultWaitTimeout(): number;
174
+ /**
175
+ * Returns the current allowance for the given token and spender.
176
+ * @param {string} token The token's address.
177
+ * @param {string} spender The spender's address.
178
+ * @returns {Promise<bigint>} The allowance.
179
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
180
+ */
181
+ getAllowance(token: string, spender: string): Promise<bigint>;
182
+ /**
183
+ * Verifies a message's signature.
184
+ *
185
+ * @param {string} message - The original message.
186
+ * @param {string} signature - The signature to verify.
187
+ * @returns {Promise<boolean>} True if the signature is valid.
188
+ */
189
+ verify(message: string, signature: string): Promise<boolean>;
190
+ /**
191
+ * Verifies a typed data signature.
192
+ *
193
+ * @param {TypedData} typedData - The typed data to verify.
194
+ * @param {string} signature - The signature to verify.
195
+ * @returns {Promise<boolean>} True if the signature is valid.
196
+ */
197
+ verifyTypedData(typedData: TypedData, signature: string): Promise<boolean>;
198
+ /**
199
+ * Checks if this account has an active ERC-7702 delegation.
200
+ *
201
+ * @returns {Promise<DelegationInfo>} The delegation info.
202
+ * @throws {ProviderRequiredError} If the wallet is not connected to a provider.
203
+ */
204
+ getDelegation(): Promise<DelegationInfo>;
205
+ /** @private */
206
+ private _estimateGasWithAuthList;
207
+ /**
208
+ * Estimates the gas of a transaction by simulating it against the connected provider, using the authorization-list
209
+ * aware estimation for ERC-7702 transactions.
210
+ *
211
+ * @protected
212
+ * @param {EvmTransactionRequest} tx - The transaction to simulate, including its `from` address.
213
+ * @returns {Promise<bigint>} The gas units the simulated transaction consumed.
214
+ */
215
+ protected _estimateGas(tx: EvmTransactionRequest): Promise<bigint>;
216
+ private _getFeeRate;
65
217
  }
66
218
  export type Provider = import("ethers").Provider;
67
219
  export type Eip1193Provider = import("ethers").Eip1193Provider;
220
+ export type TypedDataDomain = import("ethers").TypedDataDomain;
221
+ export type TypedDataField = import("ethers").TypedDataField;
222
+ export type BlobLike = import("ethers").BlobLike;
223
+ export type AuthorizationLike = import("ethers").AuthorizationLike;
68
224
  export type EvmTransactionReceipt = import("ethers").TransactionReceipt;
225
+ export type EvmTransactionResponse = import("ethers").TransactionResponse;
226
+ export type EvmTransactionRequest = import("ethers").TransactionRequest;
69
227
  export type TransactionResult = import("@tetherto/wdk-wallet").TransactionResult;
70
- export type TransferOptions = import("@tetherto/wdk-wallet").TransferOptions;
71
228
  export type TransferResult = import("@tetherto/wdk-wallet").TransferResult;
229
+ export type TransactionReceipt = import("@tetherto/wdk-wallet").TransactionReceipt;
230
+ export type WaitForTransactionOptions = import("@tetherto/wdk-wallet").WaitForTransactionOptions;
231
+ export type TransferOptions = import("@tetherto/wdk-wallet").TransferOptions;
232
+ /**
233
+ * The EVM-specific fields added to a normalized transaction receipt.
234
+ */
235
+ export type EvmTransactionDetails = {
236
+ /**
237
+ * - The number of confirmations (0 while pending or dropped).
238
+ */
239
+ confirmations: number;
240
+ /**
241
+ * - The native ethers receipt, or null while the transaction is pending or dropped.
242
+ */
243
+ receipt: EvmTransactionReceipt | null;
244
+ };
245
+ export type TypedData = {
246
+ /**
247
+ * - The domain separator.
248
+ */
249
+ domain: TypedDataDomain;
250
+ /**
251
+ * - The type definitions.
252
+ */
253
+ types: Record<string, TypedDataField[]>;
254
+ /**
255
+ * - The message data.
256
+ */
257
+ message: Record<string, unknown>;
258
+ };
259
+ export type DelegationInfo = {
260
+ /**
261
+ * - Whether the account has an active ERC-7702 delegation.
262
+ */
263
+ isDelegated: boolean;
264
+ /**
265
+ * - The address of the delegate contract, or null if not delegated.
266
+ */
267
+ delegateAddress: string | null;
268
+ };
72
269
  export type EvmTransaction = {
73
270
  /**
74
- * - The transaction's recipient.
271
+ * - The transaction's recipient. Omit or pass null to deploy a contract.
75
272
  */
76
- to: string;
273
+ to?: string | null;
77
274
  /**
78
275
  * - The amount of ethers to send to the recipient (in weis).
79
276
  */
@@ -98,15 +295,64 @@ export type EvmTransaction = {
98
295
  * - The price (in wei) per unit of gas this transaction will allow in addition to the [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) block's base fee to bribe miners into giving this transaction priority. This is included in the maxFeePerGas, so this will not affect the total maximum cost set with maxFeePerGas.
99
296
  */
100
297
  maxPriorityFeePerGas?: number | bigint;
298
+ /**
299
+ * - The transaction type (e.g. 4 for ERC-7702).
300
+ */
301
+ type?: number;
302
+ /**
303
+ * - The transaction nonce.
304
+ */
305
+ nonce?: number;
306
+ /**
307
+ * - The chain ID of the network.
308
+ */
309
+ chainId?: number | bigint;
310
+ /**
311
+ * - The maximum price (in wei) per unit of blob gas this transaction will pay for [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) blob data. Required for type 3 (blob) transactions.
312
+ */
313
+ maxFeePerBlobGas?: number | bigint;
314
+ /**
315
+ * - The blobs of an [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) type 3 transaction.
316
+ */
317
+ blobs?: BlobLike[];
318
+ /**
319
+ * - The versioned hashes of the blobs of an [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) type 3 transaction.
320
+ */
321
+ blobVersionedHashes?: string[];
322
+ /**
323
+ * - An optional list of ERC-7702 signed authorizations for type 4 transactions.
324
+ */
325
+ authorizationList?: AuthorizationLike[];
101
326
  };
327
+ /**
328
+ * The gas and fee fields of an evm transaction that can be set on transfer and approve options.
329
+ */
330
+ export type EvmGasOverrides = Pick<EvmTransaction, "gasLimit" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas">;
331
+ /**
332
+ * The options of a token transfer, extended with the optional gas overrides and ERC-7702 authorizations of an evm
333
+ * transaction.
334
+ */
335
+ export type EvmTransferOptions = TransferOptions & EvmGasOverrides & Pick<EvmTransaction, "authorizationList">;
102
336
  export type EvmWalletConfig = {
103
337
  /**
104
- * - The url of the rpc provider, or an instance of a class that implements eip-1193.
338
+ * - The url of the rpc provider, an already-built ethers provider (e.g. a `JsonRpcProvider` or a failover wrapper), or an instance of a class that implements eip-1193. It's also possible to provide an array of these instead. In such case, connection errors will cause the wallet to automatically fallback on the next provider in the list. An already-built provider is reused as-is, which lets a manager share a single provider across all the accounts it creates.
105
339
  */
106
- provider?: string | Eip1193Provider;
340
+ provider?: string | Provider | Eip1193Provider | Array<string | Provider | Eip1193Provider>;
341
+ /**
342
+ * - If set and if 'provider' is a list of urls or EIP 1193 providers, the number of additional retry attempts after the initial call fails. Total attempts = `1 + retries`. For example, `retries: 3` with 4 providers will try each provider once before throwing. If `retries` exceeds the number of providers, the failover will loop back and retry already-failed providers in round-robin order. Default: 3.
343
+ */
344
+ retries?: number;
345
+ /**
346
+ * - The chain ID of the network. When provided, skips automatic chain ID detection from the provider.
347
+ */
348
+ chainId?: number;
107
349
  /**
108
350
  * - The maximum fee amount for transfer operations.
109
351
  */
110
352
  transferMaxFee?: number | bigint;
353
+ /**
354
+ * - The maximum fee amount for sendTransaction and signTransaction operations.
355
+ */
356
+ transactionMaxFee?: number | bigint;
111
357
  };
112
358
  import { WalletAccountReadOnly } from '@tetherto/wdk-wallet';