WalletConnect buy: stop overriding gas (let wallet set fees)
Setting fees made MetaMask show an unclearable "site-suggested fee" alert. Hand fee control back to the wallet; its own estimate meets Amoy's minimum. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -165,13 +165,9 @@ window.IAPWallet = (function () {
|
|||||||
await ensureChain(c);
|
await ensureChain(c);
|
||||||
const tx = { from: addr, to: c.contract, data };
|
const tx = { from: addr, to: c.contract, data };
|
||||||
if (valueWei) tx.value = '0x' + BigInt(valueWei).toString(16);
|
if (valueWei) tx.value = '0x' + BigInt(valueWei).toString(16);
|
||||||
// Polygon (mainnet + Amoy) enforce a ~25 gwei minimum priority fee; wallets
|
// Let the wallet set its own gas/fees. Setting them here makes MetaMask flag
|
||||||
// routinely lowball it and the RPC rejects "gas tip below minimum". Set
|
// a "site-suggested fee" alert the user can't easily clear; MetaMask's own
|
||||||
// explicit EIP-1559 fees above the floor, plus a safe gas limit so the wallet
|
// estimate already meets Amoy's minimum priority fee.
|
||||||
// doesn't mis-estimate. Unused gas is never charged.
|
|
||||||
tx.maxPriorityFeePerGas = '0x' + (30n * 10n ** 9n).toString(16); // 30 gwei (> Polygon's ~25 gwei floor)
|
|
||||||
tx.maxFeePerGas = '0x' + (50n * 10n ** 9n).toString(16); // 50 gwei ceiling (Amoy base fee is ~0; avoids MetaMask "fee too high" alert)
|
|
||||||
tx.gas = '0x' + (600000n).toString(16); // 600k limit
|
|
||||||
return eth().request({ method: 'eth_sendTransaction', params: [tx] });
|
return eth().request({ method: 'eth_sendTransaction', params: [tx] });
|
||||||
}
|
}
|
||||||
async function waitTx(hash) {
|
async function waitTx(hash) {
|
||||||
|
|||||||
+1
-1
@@ -439,7 +439,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script src="/assets/common.js?v=20260908c"></script>
|
<script src="/assets/common.js?v=20260908c"></script>
|
||||||
<script src="/assets/wallet.js?v=20260908i"></script>
|
<script src="/assets/wallet.js?v=20260908j"></script>
|
||||||
<script src="/assets/home.js?v=20260906m"></script>
|
<script src="/assets/home.js?v=20260906m"></script>
|
||||||
<script src="/assets/chat.js?v=20260906m"></script>
|
<script src="/assets/chat.js?v=20260906m"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+1
-1
@@ -696,7 +696,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/assets/common.js?v=20260908c"></script>
|
<script src="/assets/common.js?v=20260908c"></script>
|
||||||
<script src="/assets/wallet.js?v=20260908i"></script>
|
<script src="/assets/wallet.js?v=20260908j"></script>
|
||||||
<script src="/assets/my.js?v=20260908k"></script>
|
<script src="/assets/my.js?v=20260908k"></script>
|
||||||
<script src="/assets/chat.js?v=20260907l"></script>
|
<script src="/assets/chat.js?v=20260907l"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user