Payouts switch on automatically when a wallet is linked (wallet screen, wallet sign-in, InstantAdPay sync): engine activateFor, gas on us, sponsors first; quiet in-app notice, email held by the pre-launch gate

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-17 18:44:00 -05:00
parent 4743c7f8a9
commit 36611218ad
3 changed files with 201 additions and 192 deletions
+8 -2
View File
@@ -440,10 +440,16 @@ async function downline(email, depth = 3) {
}
return levels;
}
// wallet-linked hook (Marty, 2026-10-17): the engine switches payouts on as soon as a wallet lands on an account, however
// it got there (wallet screen, wallet sign-in, InstantAdPay sync). Set by server.js; runs after the link, never blocks it.
let walletHook = null;
function onWalletLinked(f) { walletHook = f; }
async function linkWallet(email, address) {
const a = normAddr(address);
if (!/^0x[0-9a-f]{40}$/.test(a)) return { error: 'Bad wallet address.' };
return impl().linkWallet(normEmail(email), a).then(tap(normEmail(email)));
const r = await impl().linkWallet(normEmail(email), a).then(tap(normEmail(email)));
if (r && !r.error && walletHook) { try { Promise.resolve(walletHook(normEmail(email))).catch(e => console.error('wallet hook', e.message)); } catch (e) {} }
return r;
}
async function count() { return impl().count(); }
// admin: newest-first account list, and re-pointing a member's sponsor (a
@@ -474,7 +480,7 @@ async function getChatSettings(email) {
}
module.exports = { init, signup, login, ensure, onChange, byEmail, byAddress, byCode, byUsername, byMemberId: id => impl().byMemberId(Number(id) || 0), listAll, setSponsorRef,
setUsername, setMemberId, namesForMembers, listByReferrer, downline, linkWallet, count,
setUsername, setMemberId, namesForMembers, listByReferrer, downline, linkWallet, onWalletLinked, count,
setLineBanner: (e, b, t) => impl().setLineBanner(String(e || '').toLowerCase(), b, t),
setWallOffers: (e, j) => impl().setWallOffers(String(e || '').toLowerCase(), j),
setProfile: (e, a, bio, socials) => impl().setProfile(String(e || '').toLowerCase(), a, bio, socials).then(tap(String(e || '').toLowerCase())),