GET /api/admin/member-lookup (Marty 2026-11-14, network hub member lookup): read-only, behind the admin token; ?q=<wallet> | #<banner id> | <username> answers myData (banners, credits, rewards) plus known, record, purchases and sponsored (VBBShop Purchase rows with tx), contract, explorer. Smoke 245/245
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -393,6 +393,12 @@ async function main() {
|
||||
my = await V.json('/api/my'); ok(my.credits === credits0 + 60, 'another contract log is ignored; a second order (same tx, other log index) credits 40', my.credits);
|
||||
const ads = await anon.json('/api/admin/status', undefined, { 'x-admin-token': ADMIN });
|
||||
ok(ads.shop && ads.shop.watching && ads.shop.vouchers && ads.shop.purchases === 2 && ads.shop.creditsSold === 60 && ads.shop.dupes >= 2 && ads.shop.lastBlock === 12 && ads.shop.keeper === keeperAddr && !JSON.stringify(ads).includes(KEEPER_PK.slice(2, 12)), 'admin sees the watcher: 2 purchases, 60 credits, duplicates skipped, no key', ads.shop);
|
||||
// the network hub's member lookup (2026-11-14, read-only)
|
||||
const ml = await anon.json('/api/admin/member-lookup?q=' + V.address, undefined, { 'x-admin-token': ADMIN });
|
||||
ok(ml._status === 200 && ml.known && ml.record && ml.purchases.length === 2 && ml.purchases.every(x => x.tx === tx1) && ml.credits === credits0 + 60 && ml.contract === ethers.getAddress(SHOP), 'admin member lookup by wallet: record, credits, 2 purchases with tx', ml);
|
||||
const mls = await anon.json('/api/admin/member-lookup?q=' + spW, undefined, { 'x-admin-token': ADMIN });
|
||||
ok(mls._status === 200 && mls.sponsored.length === 2 && !mls.record, 'admin member lookup: the sponsor wallet shows the sales it was paid on', mls);
|
||||
r = await anon.req('/api/admin/member-lookup?q=' + V.address, { headers: { 'x-admin-token': 'wrong-token-x' } }); ok(r.status === 401, 'admin member lookup refuses a wrong token');
|
||||
// restart: the dedupe marks survive, the replaying RPC still credits nothing
|
||||
await sleep(1200); await stop(); await boot(); await sleep(900);
|
||||
my = await V.json('/api/my'); ok(my.credits === credits0 + 60, 'after a restart the replayed logs still credit nothing', my.credits);
|
||||
|
||||
Reference in New Issue
Block a user