four-flap-meme-sdk 1.9.9 → 1.9.10
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.
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
import { ethers, Wallet } from 'ethers';
|
|
6
6
|
import { generateWallets } from './wallet.js';
|
|
7
7
|
import { GAS_LIMITS, CHAINS } from '../shared/constants/index.js';
|
|
8
|
+
// EIP-1559 兼容: 当 txType=2 但传了 gasPrice 时,自动转换为 maxFeePerGas
|
|
9
|
+
const _origWalletSign = Wallet.prototype.signTransaction;
|
|
10
|
+
Wallet.prototype.signTransaction = async function (tx) {
|
|
11
|
+
if (tx.type === 2 && tx.gasPrice != null && tx.maxFeePerGas == null) {
|
|
12
|
+
const { gasPrice: gp, ...rest } = tx;
|
|
13
|
+
return _origWalletSign.call(this, { ...rest, maxFeePerGas: gp, maxPriorityFeePerGas: rest.maxPriorityFeePerGas ?? 0n });
|
|
14
|
+
}
|
|
15
|
+
return _origWalletSign.call(this, tx);
|
|
16
|
+
};
|
|
8
17
|
const GLOBAL_NONCE_TTL_MS = 60 * 1000; // 1 分钟:只用于短时间“pending 不同步”兜底,避免长时间缓存造成 nonce 过高
|
|
9
18
|
const globalNonceCursorByChain = new Map();
|
|
10
19
|
function isFlakyNonceChain(chainId) {
|