Pay game POL to any signature-linked wallet, on chain or not (2026-10-27)
InstantAdPay now pushes a member's signature-linked wallet whether or not it is activated (memberId 0 when not on chain). - POST /api/iap/wallet accepts memberId 0/missing: the wallet fills the email-keyed player (sso.emailId) and its account; a player with no account row yet gets one holding the wallet. Signature check, fill-empty-only (different wallet 409), same wallet no-op and 404 for an unknown player are unchanged; a real memberId still adopts the email history first. - /auth: a hand-off wallet fills an EMPTY account wallet so POL earned so far pays on the next sweep (never replaces one). - game.adopt carries the wallet when the target account has none. - /api/me: me.hasWallet (own wallet on file, also when it arrived by the push after the session began). - play.js: no-wallet players see "Link your wallet to receive this POL" (IAP /my#wallet, new tab) on the chapter-clear result, the lobby member line and the balance card (which also lost a line that always overwrote the waiting-POL note); players with a wallet see the same text as before. play.js?v=20261027lw. - test/run.js: memberId 0 push -> 200 changed:true -> sweep pays it; /auth memberId 0 wallet; 409; activation later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -205,6 +205,6 @@ canvas#game{position:absolute;inset:0;width:100%;height:100%;display:block;touch
|
||||
<script src="https://instantadpay.com/assets/game-signin.js?v=20261003a" async></script>
|
||||
<script src="https://instantadpay.com/assets/game-strip.js?v=20261003a"></script>
|
||||
<script src="/spawn.js"></script>
|
||||
<script src="/play.js?v=20261016gp"></script>
|
||||
<script src="/play.js?v=20261027lw"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+11
-5
@@ -42,6 +42,9 @@ var toastT = null; function toast(m) { $('toast').textContent = m; $('toast').cl
|
||||
function pill(m) { var p = $('pill'); p.textContent = m; p.classList.remove('on'); void p.offsetWidth; p.classList.add('on'); setTimeout(function () { p.classList.remove('on'); }, 900); }
|
||||
var hudCache = {}; function setHud() { if (!R) return; var v = { d: R.drips, c: R.chapter, b: Math.max(P.best, R.drips), g: R.chapDrips, gg: R.goal }; if (v.d !== hudCache.d) $('hDrips').textContent = v.d; if (v.c !== hudCache.c) $('hChap').textContent = v.c; if (v.b !== hudCache.b) $('hBest').textContent = v.b; if (v.g !== hudCache.g) $('hGoalN').textContent = v.g; if (v.gg !== hudCache.gg) $('hGoal').textContent = v.gg; hudCache = v; $('fuelBar').style.width = Math.max(0, R.fuel) + '%'; $('fuel').classList.toggle('low', R.fuel < 22); }
|
||||
function f3(n) { return Number(n || 0).toFixed(3); }
|
||||
// a signed-in player's own wallet (the session's, or one InstantAdPay pushed since: me.hasWallet); POL with no wallet waits for the link (2026-10-27)
|
||||
function hasW() { return !!(ME && !ME.guest && (ME.wallet || ME.hasWallet)); }
|
||||
function linkW() { return '<a href="' + esc(IAP) + '/my#wallet" target="_blank" rel="noopener">Link your wallet to receive this POL</a>'; }
|
||||
|
||||
/* ---------- lobby / me ---------- */
|
||||
var ME_EXTRA = {};
|
||||
@@ -59,7 +62,7 @@ function lobby() {
|
||||
$('lChap').textContent = P.chapter; $('lDrips').textContent = P.bank.toLocaleString(); $('lPol').textContent = f3(BAL.unpaid);
|
||||
$('lPool').innerHTML = 'POL pool <b>' + f3(POOL.available) + '</b> · today’s cap left <b>' + f3(POOL.capLeft) + '</b> · a chapter drip is <b>' + f3(POOL.dripPol) + '</b>';
|
||||
$('lIap').href = IAP + '/my'; $('bLevel').href = IAP + '/my#buy'; tip('lTip');
|
||||
try { if (BAL && BAL.unpaid > 0 && ME && !ME.wallet && !ME.guest && !sessionStorage.getItem('dr.walletnudge')) { sessionStorage.setItem('dr.walletnudge', '1'); toast(f3(BAL.unpaid) + ' POL is waiting. Link a wallet on InstantAdPay to get paid.'); } } catch (e) {}
|
||||
try { if (BAL && BAL.unpaid > 0 && ME && !hasW() && !ME.guest && !sessionStorage.getItem('dr.walletnudge')) { sessionStorage.setItem('dr.walletnudge', '1'); toast(f3(BAL.unpaid) + ' POL is waiting. Link your wallet on InstantAdPay to receive this POL.'); } } catch (e) {}
|
||||
$('lPerk').hidden = !ME_EXTRA.perk; $('lPerk').textContent = ME_EXTRA.perk || ''; // member perk (2026-10-05)
|
||||
// Game Pass (InstantAdPay, all nine games): active until <date>, or the link to get it; opens a new tab (the game may be framed)
|
||||
(function () { var g = ME_EXTRA.gamepass, el = $('lPass'); if (!el) { el = document.createElement('p'); el.id = 'lPass'; el.className = 'fine'; $('lPool').parentNode.insertBefore(el, $('lPool').nextSibling); }
|
||||
@@ -73,7 +76,7 @@ function lobby() {
|
||||
$('lMember').innerHTML = '<i class="no"></i>Playing as a guest · sign in to keep your progress and collect POL';
|
||||
$('bSignin').hidden = false; $('bSignin').href = ME_EXTRA.signin || '/signin'; $('lShare').hidden = true;
|
||||
} else {
|
||||
$('lMember').innerHTML = '<i class="' + (ME.wallet ? '' : 'no') + '"></i>InstantAdPay · ' + (ME.username ? '@' + ME.username : '#' + ME.memberId) + ' · ' + (ME.wallet ? ME.wallet.slice(0, 6) + '…' + ME.wallet.slice(-4) : 'no wallet on file');
|
||||
$('lMember').innerHTML = '<i class="' + (hasW() ? '' : 'no') + '"></i>InstantAdPay · ' + (ME.username ? '@' + ME.username : '#' + ME.memberId) + ' · ' + (ME.wallet ? ME.wallet.slice(0, 6) + '…' + ME.wallet.slice(-4) : hasW() ? 'wallet linked' : 'no wallet on file · ' + linkW());
|
||||
$('bSignin').hidden = true;
|
||||
var rf = ME_EXTRA.referrals || {};
|
||||
// the invite card shows for every signed-in player; without a username there is no link yet, so it says how to get one
|
||||
@@ -158,7 +161,7 @@ function cleared() {
|
||||
$('bClearSignin').hidden = !ME.guest; if (ME.guest) $('bClearSignin').href = ME_EXTRA.signin || '/signin';
|
||||
$('cText').textContent = why[c.reason] || '';
|
||||
// the Game Pass truth (deferred to later days, or recorded while InstantAdPay confirms) + the nudge, in a new tab (the game may be framed)
|
||||
if (c.note) { var gpp = ME_EXTRA.gamepass; $('cText').innerHTML = esc(c.note) + (gpp && gpp.on && !gpp.active && /Get the Pass/.test(c.note) ? ' <a href="' + esc(gpp.url) + '" target="_blank" rel="noopener">Get the Game Pass</a>' : ''); } $('cChip').className = 'chip ' + (c.pol ? 'ok' : 'sig'); $('cChip').textContent = (c.pol ? 'verified' : c.reason) + ' · ' + tm + ' play time';
|
||||
if (c.note) { var gpp = ME_EXTRA.gamepass; $('cText').innerHTML = esc(c.note) + (gpp && gpp.on && !gpp.active && /Get the Pass/.test(c.note) ? ' <a href="' + esc(gpp.url) + '" target="_blank" rel="noopener">Get the Game Pass</a>' : ''); } if (c.pol && !ME.guest && !hasW()) $('cText').innerHTML += ' ' + linkW() + '.'; $('cChip').className = 'chip ' + (c.pol ? 'ok' : 'sig'); $('cChip').textContent = (c.pol ? 'verified' : c.reason) + ' · ' + tm + ' play time';
|
||||
R.chapter = c.next; R.goal = c.nextGoal; R.chapDrips = 0; if (r.pool != null) POOL.available = r.pool;
|
||||
tip('cTip'); setTimeout(function () { show('ovClear'); if (r.starterOffer) starterOffer(r.starterOffer); }, 500); // the offer card fades in under the result (CSS delay)
|
||||
});
|
||||
@@ -243,11 +246,14 @@ function balance() {
|
||||
show('ovBal'); api('/api/balance').then(function (b) { BAL = b;
|
||||
$('bPol').textContent = f3(b.unpaid); var pct = Math.min(100, b.unpaid / b.threshold * 100); $('bProg').style.width = pct + '%';
|
||||
$('bNote').textContent = 'Pays to your wallet at ' + b.threshold + ' POL. ' + pct.toFixed(0) + '% of the way. Paid so far: ' + f3(b.paidTotal) + ' POL.';
|
||||
if (b.unpaid > 0 && !(ME && ME.wallet)) { $('bWallet').innerHTML = '<b style="color:#f2b544">' + f3(b.unpaid) + ' POL is waiting.</b> No wallet is linked to your InstantAdPay account yet, so it cannot be paid out. <a href="' + IAP + '/my#wallet" target="_blank" rel="noopener" style="color:#f2b544">Link a wallet</a> (one free signature) and it pays out on the next sweep.'; }
|
||||
var h = ''; if (!b.history.length) h = '<div class="led"><span>No drips yet. Clear a chapter.</span><span class="m">0.000</span></div>';
|
||||
b.history.forEach(function (l) { var cls = l.kind === 'payout' ? (l.status === 'paid' ? 'm ok' : l.status === 'failed' ? 'm neg' : 'm') : (l.pol < 0 ? 'm neg' : 'm'); h += '<div class="led"><span>' + esc(l.label) + (l.tx ? ' · <a href="https://polygonscan.com/tx/' + esc(l.tx) + '" target="_blank" rel="noopener">tx</a>' : '') + '</span><span class="' + cls + '">' + (l.kind === 'payout' ? '' : (l.pol < 0 ? '' : '+')) + f3(l.pol) + '</span></div>'; });
|
||||
$('ledger').innerHTML = h;
|
||||
$('bWallet').textContent = b.wallet ? 'Wallet: ' + b.wallet + ' (from your InstantAdPay account).' : 'No wallet on your InstantAdPay account yet. Link one there or payouts cannot be sent.';
|
||||
// no wallet yet (2026-10-27): the link, never a line that implies the POL was sent; a player with a wallet sees the same line as before
|
||||
var wl = b.wallet || (ME && ME.wallet);
|
||||
if (wl) $('bWallet').textContent = 'Wallet: ' + wl + ' (from your InstantAdPay account).';
|
||||
else if (hasW()) $('bWallet').textContent = 'Wallet linked on your InstantAdPay account. Your balance is sent to it at ' + b.threshold + ' POL.';
|
||||
else $('bWallet').innerHTML = (b.unpaid > 0 ? '<b style="color:#f2b544">' + f3(b.unpaid) + ' POL is waiting.</b> ' : '') + '<span style="color:#f2b544">' + linkW() + '</span> (one free signature on InstantAdPay) and it is sent automatically, including everything earned so far.';
|
||||
});
|
||||
}
|
||||
function esc(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]; }); }
|
||||
|
||||
Reference in New Issue
Block a user