Game Pass bridge (GAMEPASS=on): finds and Ad Detective cases via InstantAdPay polgrant (daily, fail closed), 5 missions + 2 cases perks, Pass Tournament prize payer from this faucet (claims before send, dry run, alerts), tests

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-16 09:11:27 -05:00
parent 816417d172
commit 73b6cf74db
10 changed files with 488 additions and 39 deletions
+18 -1
View File
@@ -91,4 +91,21 @@ async function tick(notify) {
return { paid };
}
module.exports = { enabled, init, address, balance, tick };
// one plain POL transfer for a non-drip payment (the weekly Pass Tournament prizes, lib/tournament.js): the same wallet, the same
// RPC rotation on a node hiccup. onHash fires the moment the chain has the transaction, BEFORE the receipt wait, so the caller can
// record the hash durably and never send the same prize twice. Returns { tx, ok } or { tx, pending: true } when the wait timed out.
async function send(to, pol, onHash) {
if (!wallet) throw new Error('faucet is off (HUNT_WALLET_KEY / HUNT_RPC)');
if (!to || !/^0x[a-f0-9]{40}$/i.test(to)) throw new Error('bad wallet');
if (!(Number(pol) > 0)) throw new Error('bad amount');
try {
const tx = await wallet.sendTransaction({ to, value: ethers.parseEther(String(pol)) });
if (onHash) { try { await onHash(tx.hash); } catch (e) {} }
let rc = null; try { rc = await tx.wait(1, 90000); } catch (e) { if (e && e.code === 'TIMEOUT') return { tx: tx.hash, pending: true }; throw e; }
return { tx: tx.hash, ok: !!(rc && rc.status === 1) };
} catch (e) { const msg = String(e && e.message || e); if (TRANSIENT.test(msg)) rotate(msg); throw e; }
}
// HUNT_DRY_RUN=on: the tournament payer records what it would pay and sends nothing (the find faucet is not affected)
const dry = () => String(process.env.HUNT_DRY_RUN || 'off').trim().toLowerCase() !== 'off';
module.exports = { enabled, init, address, balance, tick, send, dry };