Wallets guide: website, App Store, Google Play and extension links per wallet; MoonPay button
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -6,4 +6,18 @@
|
||||
const signedIn = !!(me && me.signedIn && me.email);
|
||||
document.getElementById('gate').style.display = signedIn ? 'none' : 'block';
|
||||
document.getElementById('body').style.display = signedIn ? 'block' : 'none';
|
||||
if (!signedIn) return;
|
||||
// MoonPay: same signed link the Buy pane uses, prefilled with this member's wallet when one is linked
|
||||
const mb = document.getElementById('wlMoonpay'), note = document.getElementById('wlMoonpayNote');
|
||||
if (note && !me.address) note.textContent = 'Link your wallet first (Wallet tab) and MoonPay opens with your address already filled in. Without it you paste the address yourself.';
|
||||
if (mb) mb.addEventListener('click', async () => {
|
||||
let pol = 30;
|
||||
try { const { products } = await (await fetch('/api/catalog')).json(); const p20 = (products || []).find(p => p.priceCents === 2000); if (p20 && p20.costWei) pol = Math.max(30, Math.ceil(Number(p20.costWei) / 1e18) + 3); } catch (e) {}
|
||||
try {
|
||||
const r = await (await fetch('/api/moonpay-url?pol=' + pol + (me.address ? '&address=' + encodeURIComponent(me.address) : ''))).json();
|
||||
if (!r.url) throw new Error('no url');
|
||||
window.open(r.url, '_blank', 'noopener');
|
||||
IAP.status(r.signed ? 'MoonPay opened with your wallet address pre-filled. Choose the amount, pay, and the POL lands in your wallet.' : 'MoonPay opened. Choose POL on the Polygon network and paste your own wallet address as the destination.', 'ok');
|
||||
} catch (e) { IAP.status('Could not open MoonPay. Try again in a minute.', 'bad'); }
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user