diff --git a/public/assets/my.js b/public/assets/my.js index fec1e8a..b073a20 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -1063,6 +1063,14 @@ wrap.querySelectorAll('button[data-id]').forEach(b => b.addEventListener('click', async () => { try { b.disabled = true; + // the buyer's credits are read by the member id of their LINKED wallet. + // If they only connected a wallet (e.g. for the faucet) but never linked + // it, link it first (one signature) so the purchase's credits show up. + const meNow = await (await fetch('/api/me')).json(); + if (!meNow.address) { + IAP.status('Link your wallet first — one quick signature…'); + await IAPWallet.signIn(); + } const spNow = await (await fetch('/api/sponsor')).json(); IAP.status('Confirm the purchase in your wallet…'); const r = await IAPWallet.buy(Number(b.dataset.id), spNow.sponsorId || 0, b.dataset.cost); diff --git a/public/my.html b/public/my.html index 12caa84..a7bafe9 100644 --- a/public/my.html +++ b/public/my.html @@ -4,7 +4,7 @@