' + (p.costWei ? IAP.fmtPol(p.costWei) + ' POL right now' : 'paused') + '
'
+ + '';
+ wrap.appendChild(div);
+ }
+ wrap.querySelectorAll('button[data-id]').forEach(b => b.addEventListener('click', async () => {
+ try {
+ b.disabled = true;
+ 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);
+ if (r.status !== '0x1' && r.receipt && r.receipt.status !== '0x1') throw new Error('Transaction reverted.');
+ IAP.status('Purchase settled on-chain. Credits are in your account.', 'ok');
+ await render();
+ loadBuyTiles();
+ } catch (e) { IAP.status('Purchase failed: ' + ((e && e.message) || e), 'bad'); }
+ finally { b.disabled = false; }
+ }));
+ } catch (e) {}
+ }
+ loadBuyTiles();
+
// ── earn-by-viewing: daily ad set with dwell, then claim ──
const earnState = { types: ['banner', 'text'], i: 0, timer: null };
async function earnRefresh() {
diff --git a/public/contract.html b/public/contract.html
index a2a84eb..7230098 100644
--- a/public/contract.html
+++ b/public/contract.html
@@ -5,7 +5,7 @@
The contract | InstantAdPay
-
+
@@ -129,8 +129,8 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.