Wallet sends carry an explicit gas limit from the server's estimate (wallets that cannot estimate showed 'unable to get a gas fee' on buy and activate); Control Room rail expanded by default with a remembered Collapse toggle
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -262,6 +262,11 @@ function init(opts) {
|
||||
// We hand the wallet correct fees so the tx clears the floor: a priority tip at
|
||||
// or above the network suggestion (floored at 30 gwei for headroom) and a
|
||||
// maxFee that covers 2x base + tip so MetaMask never flags "max fee too low".
|
||||
// eth_estimateGas for a prepared call, padded 30%: handed to the wallet as an explicit gas limit so wallets whose own
|
||||
// estimation fails ('unable to get a gas fee', Marty 2026-10-08) can still sign. null when the call would revert.
|
||||
async function estimateGas(tx) {
|
||||
try { const g = BigInt(await rpc('eth_estimateGas', [tx])); return '0x' + (g + g * 30n / 100n).toString(16); } catch (e) { return null; }
|
||||
}
|
||||
async function suggestedFees() {
|
||||
let tip = 0n, base = 0n;
|
||||
try { tip = BigInt(await rpc('eth_maxPriorityFeePerGas', [])); } catch (e) {}
|
||||
@@ -272,5 +277,5 @@ async function suggestedFees() {
|
||||
return { maxPriorityFeePerGas: '0x' + priority.toString(16), maxFeePerGas: '0x' + maxFee.toString(16) };
|
||||
}
|
||||
|
||||
module.exports = { init, getConfig, reloadConfig, memberIdByAccount, memberCount, member,
|
||||
module.exports = { init, getConfig, reloadConfig, memberIdByAccount, memberCount, member, estimateGas,
|
||||
product, productCount, quoteWei, creditBalance, catalog, recentEvents, totals, rpc, decodeLog, suggestedFees };
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Ads · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20260929d"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/ads-screen.js?v=20260929c"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -43,13 +43,14 @@ window.CR = (function () {
|
||||
}
|
||||
function mount(o) {
|
||||
const page = $('page'); if (!page) return;
|
||||
const app = document.createElement('div'); app.className = 'app';
|
||||
const app = document.createElement('div'); app.className = 'app'; let railWide = true; try { railWide = localStorage.getItem('cr.rail') !== 'narrow'; } catch (e) {} if (railWide) app.classList.add('wide'); // expanded by default (Marty 2026-10-08), the choice remembered per browser
|
||||
app.innerHTML = '<nav class="rail" aria-label="LinkSpin"><a class="mark" href="/" aria-label="LinkSpin home" title="LinkSpin"></a>'
|
||||
+ NAV.map(([k, label, href, svg]) => '<a href="' + (BUILT.has(k) ? href : FALLBACK[k]) + '"' + (k === o.active ? ' class="on" aria-current="page"' : '') + ' title="' + label + '" aria-label="' + label + '"><svg viewBox="0 0 24 24">' + svg + '</svg></a>').join('')
|
||||
+ '<span class="sp"></span></nav>'
|
||||
+ NAV.map(([k, label, href, svg]) => '<a href="' + (BUILT.has(k) ? href : FALLBACK[k]) + '"' + (k === o.active ? ' class="on" aria-current="page"' : '') + ' title="' + label + '" aria-label="' + label + '"><svg viewBox="0 0 24 24">' + svg + '</svg><span class="lbl">' + label + '</span></a>').join('')
|
||||
+ '<span class="sp"></span><button class="railtog" type="button" id="crRailTog" title="Collapse or expand the menu" aria-label="Collapse or expand the menu"><svg viewBox="0 0 24 24"><path d="M15 6l-6 6 6 6"/></svg><span class="lbl">Collapse</span></button></nav>'
|
||||
+ '<div class="main"><div class="topbar"><div><div class="crumb">' + esc(o.crumb || 'Control room') + '</div><h1>' + esc(o.title || '') + '</h1></div><span class="readout" id="crSub">' + esc(o.sub || '') + '</span><span class="grow"></span><span id="crActions">' + (o.actions || '') + '</span><button class="who" type="button" id="crUserBtn" title="Account"><i id="crAv"></i><span id="crWho">Sign in</span></button></div><div id="crBody"></div>'
|
||||
+ '<div class="strip" id="crStrip"><span><span class="dot off" id="stDot"></span>rotator <b id="stHealth">checking</b></span><span>served today <b id="stServed">·</b></span><span>zones live <b id="stZones">·</b></span><span>network <b id="stNet">·</b></span><span class="grow"></span><span id="stClock"></span></div></div>';
|
||||
page.parentNode.insertBefore(app, page); app.querySelector('#crBody').appendChild(page);
|
||||
$('crRailTog').addEventListener('click', () => { const wide = !app.classList.contains('wide'); app.classList.toggle('wide', wide); try { localStorage.setItem('cr.rail', wide ? 'wide' : 'narrow'); } catch (e) {} });
|
||||
$('crUserBtn').addEventListener('click', async e => { e.preventDefault(); if (!ME || !ME.signedIn) return signInFlow(() => location.reload()); const v = await dialog({ title: ME.username ? '@' + ME.username : (ME.email || 'Account'), text: 'Signed in on LinkSpin. Your classic dashboard is still at /my.', ok: 'Sign out', no: 'Close', danger: true }); if (v) { try { await api('/api/auth/logout'); } catch (er) {} location.reload(); } });
|
||||
clock(); setInterval(clock, 30000);
|
||||
}
|
||||
|
||||
+15
-1
@@ -40,6 +40,19 @@ button,input,select,textarea{font:inherit;color:inherit}
|
||||
.rail a.on::before{content:"";position:absolute;left:-10px;top:10px;bottom:10px;width:3px;border-radius:0 3px 3px 0;background:var(--sig)}
|
||||
.rail a:hover:not(.on){color:#fff}
|
||||
.rail .sp{flex:1}
|
||||
/* expanded rail (default since 2026-10-08): icon + label, 200px; .app without .wide is the icon-only rail */
|
||||
.rail .lbl{display:none}
|
||||
.app.wide{grid-template-columns:200px minmax(0,1fr)}
|
||||
.app.wide .rail{align-items:stretch;padding:14px 10px 12px}
|
||||
.app.wide .rail .mark{margin-left:6px;width:28px;align-self:flex-start}
|
||||
.app.wide .rail a{width:auto;justify-content:flex-start;gap:12px;padding:0 10px}
|
||||
.app.wide .rail a .lbl{display:inline;font:600 13px/1 var(--body);letter-spacing:.02em;white-space:nowrap}
|
||||
.railtog{display:flex;align-items:center;justify-content:center;gap:10px;width:40px;height:36px;margin:4px 0 0;border:1px solid var(--chrome-line);border-radius:10px;background:transparent;color:var(--chrome-sub);cursor:pointer;font:600 12px var(--body)}
|
||||
.railtog svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transform:rotate(180deg)}
|
||||
.railtog:hover{color:#fff}
|
||||
.app.wide .railtog{width:auto;justify-content:flex-start;padding:0 12px}
|
||||
.app.wide .railtog svg{transform:none}
|
||||
.app.wide .railtog .lbl{display:inline}
|
||||
.main{display:flex;flex-direction:column;min-width:0;min-height:100vh}
|
||||
.topbar{position:relative;display:flex;align-items:center;gap:16px;padding:8px 22px;border-bottom:1px solid var(--chrome-line);background:linear-gradient(180deg,var(--chrome-2),var(--chrome));color:var(--chrome-ink);min-height:58px}
|
||||
.topbar::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:1px;background:linear-gradient(90deg,var(--accent) 0,var(--sig) 28%,transparent 60%)}
|
||||
@@ -161,7 +174,8 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
|
||||
@media (max-width:760px){
|
||||
.app{grid-template-columns:1fr}
|
||||
.rail{position:fixed;top:auto;bottom:0;left:0;right:0;height:auto;flex-direction:row;justify-content:space-around;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px));border-right:0;border-top:1px solid var(--chrome-line);z-index:30}
|
||||
.rail .mark,.rail .sp{display:none} .rail a.on::before{display:none}
|
||||
.rail .mark,.rail .sp,.railtog,.rail .lbl{display:none} .rail a.on::before{display:none}
|
||||
.app.wide{grid-template-columns:1fr} .app.wide .rail{align-items:center;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px))} .app.wide .rail a{width:40px;justify-content:center;padding:0}
|
||||
.main{padding-bottom:64px;min-height:auto}
|
||||
.topbar{padding:10px 16px;flex-wrap:wrap;gap:10px 14px} .topbar .readout{display:none}
|
||||
.strip{flex-wrap:wrap;gap:8px 16px;padding:8px 16px}
|
||||
|
||||
@@ -210,12 +210,16 @@ window.IAPWallet = (function () {
|
||||
// own estimate misses ("gas tip below minimum"). Pull the network's correct
|
||||
// fees from the server and set them so the tx clears the floor.
|
||||
try {
|
||||
const g = await (await fetch('/api/gas')).json();
|
||||
const q = new URLSearchParams({ from: tx.from, to: tx.to, data: tx.data || '0x' }); if (tx.value) q.set('value', tx.value);
|
||||
const g = await (await fetch('/api/gas?' + q)).json();
|
||||
if (g && g.maxPriorityFeePerGas && g.maxFeePerGas) {
|
||||
tx.maxPriorityFeePerGas = g.maxPriorityFeePerGas;
|
||||
tx.maxFeePerGas = g.maxFeePerGas;
|
||||
}
|
||||
// an explicit gas limit: some wallets cannot estimate on their own ('unable to get a gas fee', 2026-10-08)
|
||||
if (g && g.gas) tx.gas = g.gas;
|
||||
} catch (e) {}
|
||||
if (!tx.gas) tx.gas = tx.value ? '0x61a80' : '0x30d40'; // 400k for a buy, 200k for activate: generous, the network refunds the unused part
|
||||
try {
|
||||
return await eth().request({ method: 'eth_sendTransaction', params: [tx] });
|
||||
} catch (e) {
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Credits · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;align-items:start}
|
||||
@@ -79,8 +79,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=ls20260916a"></script>
|
||||
<script src="/assets/wallet.js?v=20260911a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261007a"></script>
|
||||
<script src="/assets/wallet.js?v=20261008a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/credits-screen.js?v=20261007a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Links · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.ws{display:grid;grid-template-columns:320px minmax(0,1fr);min-height:calc(100vh - 94px)}
|
||||
.dbody .tiles{grid-template-columns:repeat(auto-fit,minmax(128px,1fr))}
|
||||
@@ -111,7 +111,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20260929d"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/links.js?v=20260929d"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -1044,7 +1044,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=ls20260916a"></script>
|
||||
<script src="/assets/wallet.js?v=20260911a"></script>
|
||||
<script src="/assets/wallet.js?v=20261008a"></script>
|
||||
<script src="/assets/promo.js?v=20260911a"></script>
|
||||
<script src="/assets/my.js?v=ls20260915a"></script>
|
||||
<script src="/assets/chat.js?v=20260907l"></script>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Pages · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.look{display:grid;gap:10px;margin:6px 0 10px}.lk-row{display:flex;gap:10px;align-items:flex-start}.lk-k{flex:none;width:64px;font:700 11px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);padding-top:9px}
|
||||
.lk-opts{display:flex;gap:6px;flex-wrap:wrap}.lk-opts button{font:600 12px var(--body);padding:7px 10px;border-radius:7px;border:1px solid var(--line);background:transparent;color:var(--fg);cursor:pointer}.lk-opts button.on{border-color:var(--accent);background:rgba(59,157,255,.12)}
|
||||
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20260929d"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/pages-screen.js?v=20261007a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Reports · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px}
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20260929d"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/reports.js?v=20260929c"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Team · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px}
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20260929d"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/team.js?v=20260929a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Wallet · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20260929d"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/wallet-screen.js?v=20260929a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Zones · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261008a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20260929d"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261008a"></script>
|
||||
<script src="/assets/zones-screen.js?v=20260929a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1308,7 +1308,12 @@ const server = http.createServer(async (req, res) => {
|
||||
return json(res, 200, { ok: true }, { 'Set-Cookie': auth.clearCookie() });
|
||||
}
|
||||
if (p === '/api/gas' && req.method === 'GET') {
|
||||
try { return json(res, 200, await chain.suggestedFees()); }
|
||||
try {
|
||||
const fees = await chain.suggestedFees();
|
||||
const from = u.searchParams.get('from'), to = u.searchParams.get('to'), data = u.searchParams.get('data'), value = u.searchParams.get('value');
|
||||
if (/^0x[0-9a-fA-F]{40}$/.test(from || '') && /^0x[0-9a-fA-F]{40}$/.test(to || '') && /^0x[0-9a-fA-F]*$/.test(data || '')) { const call = { from, to, data: data || '0x' }; if (/^0x[0-9a-fA-F]+$/.test(value || '')) call.value = value; fees.gas = await chain.estimateGas(call); }
|
||||
return json(res, 200, fees);
|
||||
}
|
||||
catch (e) { return json(res, 200, {}); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user