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:
martbost
2026-09-08 09:38:15 -05:00
parent 952f2367d6
commit b0f807f6a5
3 changed files with 5 additions and 9 deletions
+3 -7
View File
@@ -165,13 +165,9 @@ window.IAPWallet = (function () {
await ensureChain(c);
const tx = { from: addr, to: c.contract, data };
if (valueWei) tx.value = '0x' + BigInt(valueWei).toString(16);
// Polygon (mainnet + Amoy) enforce a ~25 gwei minimum priority fee; wallets
// routinely lowball it and the RPC rejects "gas tip below minimum". Set
// explicit EIP-1559 fees above the floor, plus a safe gas limit so the wallet
// 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
// Let the wallet set its own gas/fees. Setting them here makes MetaMask flag
// a "site-suggested fee" alert the user can't easily clear; MetaMask's own
// estimate already meets Amoy's minimum priority fee.
return eth().request({ method: 'eth_sendTransaction', params: [tx] });
}
async function waitTx(hash) {
+1 -1
View File
@@ -439,7 +439,7 @@
</section>
<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/chat.js?v=20260906m"></script>
</body>
+1 -1
View File
@@ -696,7 +696,7 @@
</div>
</div>
<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/chat.js?v=20260907l"></script>
</body>