Amoy rehearsal: faucet points testers to the public Amoy faucet

anvil_setBalance doesn't exist on Amoy. The faucet now connects the wallet,
copies the address, and opens faucet.polygon.technology so testers fund their
own wallet with test POL (choose Polygon Amoy). Server endpoint returns the
faucet link + address instead of minting balance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-08 08:33:46 -05:00
parent 9cff0dc667
commit 653a5e333a
3 changed files with 17 additions and 21 deletions
+7 -5
View File
@@ -1416,12 +1416,14 @@
await render();
}));
if ($('faucetBtn')) $('faucetBtn').addEventListener('click', busy($('faucetBtn'), async () => {
IAP.status('Connect your wallet to receive test POL…');
IAP.status('Connect your wallet first…');
const addr = await IAPWallet.connect();
const r = await api('/api/my/faucet', { address: addr });
const pol = (Number(BigInt(r.balanceWei) / (10n ** 15n)) / 1000).toFixed(3);
$('faucetInfo').textContent = 'Funded — balance ' + pol + ' test-POL. Head to Buy packages.';
IAP.status('Your wallet now holds test POL. Go buy a package.', 'ok');
let copied = false;
try { await navigator.clipboard.writeText(addr); copied = true; } catch (e) {}
window.open('https://faucet.polygon.technology/', '_blank', 'noopener');
$('faucetInfo').innerHTML = 'Your address <span class="mono">' + addr.slice(0, 8) + '…' + addr.slice(-6) + '</span>'
+ (copied ? ' is copied' : '') + '. On the faucet, choose <b>Polygon Amoy</b>, paste your address, and request POL. Then come back and buy.';
IAP.status('Faucet opened in a new tab. Choose Polygon Amoy, paste your address, and request test POL.', 'ok');
}));
$('activateBtn').addEventListener('click', busy($('activateBtn'), async () => {
const me = await (await fetch('/api/me')).json();