Buy flow: balance pre-flight; Trust Wallet users get a drain-warning heads-up
Stops early when the wallet lacks the POL. Only Trust Wallet users see the proportion warning (smaller package / add POL / other wallet); everyone else goes straight to the wallet confirmation. Buy-pane tip + chatbot reworded. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -221,5 +221,12 @@ window.IAPWallet = (function () {
|
||||
try { Object.keys(localStorage).forEach(k => { if (/wc@2|walletconnect|w3m|wcm|reown|wagmi|appkit/i.test(k)) localStorage.removeItem(k); }); } catch (e) {}
|
||||
}
|
||||
|
||||
return { connect, signIn, buy, activate, waitTx, disconnect };
|
||||
// native balance of the connected wallet (pre-flight check before a buy)
|
||||
async function balance(addr) {
|
||||
await connect();
|
||||
const h = await eth().request({ method: 'eth_getBalance', params: [addr || currentAddress(), 'latest'] });
|
||||
return BigInt(h);
|
||||
}
|
||||
function walletName() { try { const w = modal && modal.getWalletInfo && modal.getWalletInfo(); return (w && w.name) || ''; } catch (e) { return ''; } }
|
||||
return { connect, signIn, buy, activate, waitTx, disconnect, balance, address: currentAddress, walletName };
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user