flop-guild 0.2.9 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -27,6 +27,10 @@ Setup (idempotent; never overwrites keys or files)
27
27
  setup [name] [--network devnet|testnet] [--dry-run] [--presets stocks,privacy,memes]
28
28
  [--budget 0.2] [--cap 0.01] [--flow wallet|did] [--until claim] [--no-announce]
29
29
 
30
+ Testnet (read-only; never changes networks.json)
31
+ testnet-status [--check] [--verify] print the testnet candidate the watcher saved; --check fetches Flop's pages now;
32
+ --verify asks the candidate RPC for block 0 and compares it with the candidate genesis
33
+
30
34
  Miners (read-only, no key)
31
35
  miners [--limit 10] [--pages 10] rank miners by settled sessions and settlement rate
32
36
 
@@ -39,7 +43,7 @@ Secrets live in ~/.flop-guild (or FLOP_GUILD_HOME), mode 600, and are never prin
39
43
  function parse(argv) {
40
44
  const pos = [];
41
45
  const opt = {};
42
- const flags = new Set(["json", "yes", "help", "dry-run", "no-announce"]);
46
+ const flags = new Set(["json", "yes", "help", "dry-run", "no-announce", "check", "verify"]);
43
47
  for (let i = 0; i < argv.length; i++) {
44
48
  const a = argv[i];
45
49
  if (a.startsWith("--")) {
@@ -79,7 +83,7 @@ async function main() {
79
83
  const { pos, opt, get, num, need } = parse(rest);
80
84
  const key = get("key") ?? process.env.FLOP_GUILD_KEY ?? "default";
81
85
  const room = get("room") ?? DEFAULT_ROOM;
82
- const network = get("network") ?? "devnet";
86
+ const network = get("network") ?? (await import("./net.js")).activeNetwork();
83
87
  const agent = { name: pos[0] ?? key };
84
88
  const flows = (get("flow") ? [get("flow")] : undefined);
85
89
  let out;
@@ -191,6 +195,24 @@ async function main() {
191
195
  });
192
196
  break;
193
197
  }
198
+ case "testnet-status": {
199
+ const t = await import("./testnet.js");
200
+ if (get("check") === "true")
201
+ await t.checkOnce({ log: () => { } });
202
+ const { existsSync, readFileSync } = await import("node:fs");
203
+ const st = t.status();
204
+ const cand = existsSync(t.candidatePath()) ? readFileSync(t.candidatePath(), "utf8").trim() : "no candidate saved yet (the watcher runs inside the site server; or use --check)";
205
+ out = `testnet published: ${st.published}\nlast checked: ${st.lastChecked ?? "never"}\nlast changed: ${st.lastChanged ?? "never"}${st.lastError ? `\nlast error: ${st.lastError}` : ""}\ncandidate (${t.candidatePath()}):\n${cand}`;
206
+ if (get("verify") === "true") {
207
+ const v = await t.verifyCandidate();
208
+ out += v.error
209
+ ? `\nverify: NOT VERIFIED: ${v.error}`
210
+ : `\nverify: ${v.match ? "MATCH" : "MISMATCH"}\n rpc: ${v.rpc}\n candidate: ${v.expected}\n rpc says: ${v.actual}`;
211
+ if (!v.match)
212
+ process.exitCode = 1;
213
+ }
214
+ break;
215
+ }
194
216
  case "miners": {
195
217
  const { miners } = await import("./miners.js");
196
218
  out = await miners(network, num("limit") ?? 10, num("pages") ?? 10);
package/dist/content.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // Text uses a small Markdown subset: `code`, [text](url), and the word PROVISIONAL.
4
4
  import { render } from "./config.js";
5
5
  import { esc } from "./shell.js";
6
+ import { testnetLine } from "./testnet.js";
6
7
  export const ROLES = [
7
8
  {
8
9
  id: "agent",
@@ -41,7 +42,7 @@ export const ROLES = [
41
42
  { title: "Verify", before: "Find your did:key in the [{{ROOM}}]({{ROOM_URL}}) room on Technocore." },
42
43
  ],
43
44
  notes: [
44
- "This runs on devnet until Flop publishes testnet endpoints. Devnet earns nothing and no airdrop is promised.",
45
+ "{{TESTNET_LINE}} No airdrop is promised.",
45
46
  "More: [Start](/start) (make a key in the browser), [Agent quick start](/guides/agent-quickstart), [Autopilot](/guides/autopilot), [Join the guild](/guides/join-guild).",
46
47
  ],
47
48
  },
@@ -205,11 +206,15 @@ export function guidesMd() {
205
206
  return GUIDES.map((g) => `- [${g.title}]({{PUBLIC_URL}}/guides/${g.slug}) ([Markdown]({{PUBLIC_URL}}/guides/${g.slug}.md)): ${g.summary}`).join("\n");
206
207
  }
207
208
  /** Fill {{ROLES_MD}}, {{ROLE_MD:agent}}, {{GUIDES_MD}}, then the host and room placeholders. */
208
- export function expand(template) {
209
- return render(template
209
+ export function expand(template, line) {
210
+ return withTestnetLine(render(template
210
211
  .replace(/\{\{ROLE_MD:(agent|miner|validator)\}\}/g, (_m, id) => roleMd(ROLES.find((r) => r.id === id), 2))
211
212
  .replaceAll("{{ROLES_MD}}", rolesMd(2))
212
- .replaceAll("{{GUIDES_MD}}", guidesMd()));
213
+ .replaceAll("{{GUIDES_MD}}", guidesMd())), line === undefined ? undefined : render(line));
214
+ }
215
+ /** Fill {{TESTNET_LINE}} with the sentence the testnet watcher's state calls for. */
216
+ export function withTestnetLine(text, line = testnetLine()) {
217
+ return text.replaceAll("{{TESTNET_LINE}}", line);
213
218
  }
214
219
  function cmdHtml(c) {
215
220
  return `<pre${c.runin ? ` data-runin="${esc(c.runin)}"` : ""}><code>${esc(c.code)}</code></pre>`;
package/dist/mcp.js CHANGED
@@ -72,7 +72,7 @@ const tools = [
72
72
  async function withChain(network, fn) {
73
73
  const { loadNetwork, connect } = await import("./net.js");
74
74
  const f = await import("./flop.js");
75
- const net = loadNetwork(network ?? "devnet");
75
+ const net = loadNetwork(network ?? (await import("./net.js")).activeNetwork());
76
76
  const { api } = await connect(net);
77
77
  try {
78
78
  return await fn(net, api, f);
package/dist/minerpage.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // /miner: demand by UTC hour (7 days, cached 10 min) and a rent vs airdrop calculator.
2
2
  import { readFileSync } from "node:fs";
3
3
  import { CALC_DEFAULTS, loadDemand, minerCalc } from "./econ.js";
4
- import { networksPath } from "./net.js";
5
- export const TESTNET_NOTE = "Testnet is not live yet. This page reads devnet data until testnet endpoints are published.";
4
+ import { activeNetwork, networksPath } from "./net.js";
5
+ import { testnetLine } from "./testnet.js";
6
6
  export const MINER_FOOTER = "Unofficial community tool. Estimates only. Draft Flop rules may change. No airdrop promises.";
7
7
  const TTL = 10 * 60 * 1000;
8
8
  export const PARTIAL_NOTE = "Partial data, showing last complete read";
@@ -24,8 +24,20 @@ function view() {
24
24
  return undefined;
25
25
  return { shown: lastComplete ?? latest, latest, partial: !latest.complete };
26
26
  }
27
+ /**
28
+ * For the /miner page: if the explorer read times out or fails, retry twice, 3 s apart.
29
+ * Returns undefined when there is still no data; the page then shows "unavailable", never 0 miners.
30
+ */
31
+ export async function demandWithRetry(sleep = (ms) => new Promise((r) => setTimeout(r, ms)), load = demand) {
32
+ let v = await load(undefined, 20_000).catch(() => undefined);
33
+ for (let i = 0; i < 2 && !v; i++) {
34
+ await sleep(3_000);
35
+ v = await load(undefined, 8_000).catch(() => undefined);
36
+ }
37
+ return v;
38
+ }
27
39
  /** Cached demand: refresh after 10 minutes (2 after a partial read); a partial read never replaces a complete one. */
28
- export async function demand(network = process.env.MINER_NETWORK || "devnet", waitMs = 25_000) {
40
+ export async function demand(network = process.env.MINER_NETWORK || activeNetwork(), waitMs = 25_000) {
29
41
  const age = Date.now() - lastAttemptAt;
30
42
  const stale = !lastAttempt || age > (lastAttempt.complete ? TTL : PARTIAL_RETRY);
31
43
  if (stale && !inflight) {
@@ -77,15 +89,18 @@ function chart(byHour) {
77
89
  .join("");
78
90
  return `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Sessions opened per UTC hour over the last 7 days" class="chart">${bars}${ticks}</svg>`;
79
91
  }
80
- function calcRows(o) {
92
+ export const NA = "n/a (explorer unavailable)";
93
+ /** Without a miner count, every row that depends on it is n/a; only the rent is known. */
94
+ function calcRows(o, known = true) {
95
+ const k = (v) => (known ? v : NA);
81
96
  const rows = [
82
97
  ["out-rent", "Total rent", usd(o.totalRent)],
83
- ["out-share", "Your share of the miner pool (estimate)", pct(o.share)],
84
- ["out-airdrop", "Airdrop FLOP (estimate)", flop(o.airdropFlop)],
85
- ["out-liquid", "Liquid FLOP at launch (estimate)", flop(o.liquidFlop)],
86
- ["out-be-liquid", "Break-even FLOP price, liquid FLOP only", price(o.breakEvenLiquid)],
87
- ["out-be-all", "Break-even FLOP price, if all airdrop FLOP unlocked", price(o.breakEvenAll)],
88
- ["out-net", "Liquid value minus rent, at your FLOP price", o.net === null ? "enter a FLOP price" : usd(o.net)],
98
+ ["out-share", "Your share of the miner pool (estimate)", k(pct(o.share))],
99
+ ["out-airdrop", "Airdrop FLOP (estimate)", k(flop(o.airdropFlop))],
100
+ ["out-liquid", "Liquid FLOP at launch (estimate)", k(flop(o.liquidFlop))],
101
+ ["out-be-liquid", "Break-even FLOP price, liquid FLOP only", k(price(o.breakEvenLiquid))],
102
+ ["out-be-all", "Break-even FLOP price, if all airdrop FLOP unlocked", k(price(o.breakEvenAll))],
103
+ ["out-net", "Liquid value minus rent, at your FLOP price", known ? (o.net === null ? "enter a FLOP price" : usd(o.net)) : NA],
89
104
  ];
90
105
  return rows.map(([id, label, v]) => `<tr><th scope="row">${label}</th><td id="${id}">${v}</td></tr>`).join("");
91
106
  }
@@ -96,6 +111,7 @@ export const MINER_STYLE = `
96
111
  .note{font-size:.88rem}`;
97
112
  export function minerPage(v, err) {
98
113
  const d = v?.shown;
114
+ const known = !!d; // no explorer data: show "unavailable", never compute with 0 miners
99
115
  const minerCount = d?.minerCount ?? 0;
100
116
  const utc = (t) => new Date(t).toISOString().slice(0, 16).replace("T", " ");
101
117
  const partialHtml = v?.partial
@@ -111,14 +127,15 @@ ${partialHtml}
111
127
  ${chart(d.byHour)}
112
128
  <p>Busiest UTC hours: ${d.busiest.map((b) => `<strong>${hh(b.hour)}</strong> (${b.sessions.toLocaleString("en-US")})`).join(", ")}.</p>
113
129
  <p class="note">Source: ${esc(d.explorer)}/api/compute-channels, bucketed by the hour each session opened. Updated ${new Date(d.fetchedAt).toISOString().slice(11, 16)} UTC, refreshed every 10 minutes.</p>`
114
- : `<p>${err ? `The explorer did not answer (${esc(err)}).` : "Loading demand data."} Refresh in a minute.</p>`;
130
+ : `<p>The explorer is unavailable${err ? ` (${esc(err)})` : " (no answer after 3 tries)"}. Demand and the miner count cannot be shown right now.</p>
131
+ <p><a class="btn" href="/miner" role="button">Retry</a></p>`;
115
132
  return `<h1>Miner economics</h1>
116
133
  <p>What miners are paid for: how much inference demand there is, by hour, and what renting a GPU costs against an estimated airdrop share.</p>
117
134
  <h2>Demand by UTC hour, last 7 days</h2>
118
- ${d?.network === "devnet" ? `<p><strong>${TESTNET_NOTE}</strong></p>` : ""}
135
+ <p><strong>${esc(testnetLine())}</strong></p>
119
136
  ${demandHtml}
120
137
  <h2>Rent vs airdrop calculator</h2>
121
- <form id="calc" class="grid" data-miners="${minerCount}">
138
+ <form id="calc" class="grid" data-miners="${known ? minerCount : ""}">
122
139
  <label>Rent, $ per hour<input id="in-rent" type="number" step="0.01" min="0" value="${CALC_DEFAULTS.rentPerHour}"></label>
123
140
  <label>Hours per day<input id="in-hours" type="number" step="1" min="0" max="24" value="${CALC_DEFAULTS.hoursPerDay}"></label>
124
141
  <label>Days<input id="in-days" type="number" step="1" min="0" value="${CALC_DEFAULTS.days}"></label>
@@ -128,8 +145,9 @@ ${demandHtml}
128
145
  <label>Miner pool, FLOP<input id="in-pool" type="number" step="1" min="0" value="${CALC_DEFAULTS.poolFlop}"></label>
129
146
  <label>Liquid share, %<input id="in-liquid" type="number" step="1" min="0" max="100" value="${CALC_DEFAULTS.liquidShare * 100}"></label>
130
147
  </form>
131
- <p>Miners active in the last 7 days (live from the explorer): <strong id="miner-count">${minerCount.toLocaleString("en-US")}</strong>${readInfo}</p>
132
- <table><tbody>${calcRows(out)}</tbody></table>
148
+ <p>Miners active in the last 7 days (live from the explorer): <strong id="miner-count">${known ? minerCount.toLocaleString("en-US") : "unavailable"}</strong>${readInfo}</p>
149
+ ${known ? "" : '<p><a class="btn" href="/miner" role="button">Retry</a></p>'}
150
+ <table><tbody>${calcRows(out, known)}</tbody></table>
133
151
  <p class="note">Share estimate = your weight / (miner count × average weight) × (hours per day / 24). The share assumes the average miner runs 24 hours a day.</p>
134
152
  <p class="note">The real share is your verified compute divided by all verified compute, which nobody can know in advance. No FLOP token or price exists yet.</p>`;
135
153
  }
@@ -140,7 +158,10 @@ ${minerCalc.toString()}
140
158
  (function () {
141
159
  var f = document.getElementById("calc");
142
160
  if (!f) return;
143
- var miners = Number(f.getAttribute("data-miners")) || 0;
161
+ var raw = f.getAttribute("data-miners");
162
+ var known = raw !== "" && raw !== null; // empty: explorer unavailable, never treat as 0 miners
163
+ var miners = known ? Number(raw) || 0 : 0;
164
+ var NA = "n/a (explorer unavailable)";
144
165
  function v(id) { var x = document.getElementById(id).value; return x === "" ? undefined : Number(x); }
145
166
  function usd(n) { return "$" + n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }); }
146
167
  function fl(n) { return Math.round(n).toLocaleString("en-US") + " FLOP"; }
@@ -151,6 +172,10 @@ ${minerCalc.toString()}
151
172
  gpuWeight: v("in-weight") || 0, avgWeight: v("in-avg") || 0, minerCount: miners,
152
173
  poolFlop: v("in-pool") || 0, liquidShare: (v("in-liquid") || 0) / 100, flopPrice: v("in-price") });
153
174
  set("out-rent", usd(o.totalRent));
175
+ if (!known) {
176
+ ["out-share", "out-airdrop", "out-liquid", "out-be-liquid", "out-be-all", "out-net"].forEach(function (id) { set(id, NA); });
177
+ return;
178
+ }
154
179
  set("out-share", (o.share * 100).toPrecision(3) + "%");
155
180
  set("out-airdrop", fl(o.airdropFlop));
156
181
  set("out-liquid", fl(o.liquidFlop));
package/dist/net.js CHANGED
@@ -9,6 +9,19 @@ export const FLOP = 10n ** 18n;
9
9
  export function networksPath() {
10
10
  return process.env.FLOP_GUILD_NETWORKS || join(dirname(fileURLToPath(import.meta.url)), "..", "networks.json");
11
11
  }
12
+ /** The kit's active network: FLOP_NETWORK, else "default" in networks.json, else devnet. Never changed automatically. */
13
+ export function activeNetwork() {
14
+ const env = process.env.FLOP_NETWORK?.trim();
15
+ if (env)
16
+ return env;
17
+ try {
18
+ const d = JSON.parse(readFileSync(networksPath(), "utf8")).default;
19
+ if (typeof d === "string" && /^[a-z0-9_-]+$/.test(d))
20
+ return d;
21
+ }
22
+ catch { }
23
+ return "devnet";
24
+ }
12
25
  export function loadNetwork(name) {
13
26
  const all = JSON.parse(readFileSync(networksPath(), "utf8"));
14
27
  const n = all[name];
package/dist/server.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
8
8
  import { GUILD_ROOM, publicHost, render } from "./config.js";
9
9
  import { networksPath } from "./net.js";
10
10
  import { DISCLAIMER, esc, ICONS, page } from "./shell.js";
11
- import { expand, GUIDES, guidesHtml, mdToHtml, ROLES, roleMd, rolesHtml, rolesMd } from "./content.js";
11
+ import { expand, GUIDES, guidesHtml, mdToHtml, ROLES, roleMd, rolesHtml, rolesMd, withTestnetLine } from "./content.js";
12
12
  const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
13
13
  const SITE = join(ROOT, "site");
14
14
  const VERSION = JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8")).version;
@@ -43,7 +43,7 @@ async function networkStatus(network) {
43
43
  const all = JSON.parse(readFileSync(networksPath(), "utf8"));
44
44
  const net = all[network];
45
45
  if (!net)
46
- throw new Error(`unknown network "${network}"; known: ${Object.keys(all).join(", ")}`);
46
+ throw new Error(`unknown network "${network}"; known: ${Object.keys(all).filter((k) => typeof all[k] === "object").join(", ")}`);
47
47
  if (!net.faucet || !net.genesis)
48
48
  return JSON.stringify({ network, configured: false }, null, 2);
49
49
  return cached(`status:${network}`, 30_000, async () => {
@@ -128,7 +128,7 @@ const tools = [
128
128
  name: "network_status",
129
129
  description: "Public FLOP network status: genesis match (faucet and explorer vs networks.json), faucet state, indexer lag, gateway models. Cached 30 s.",
130
130
  inputSchema: { type: "object", properties: { network: { type: "string", description: "default devnet" } } },
131
- run: (a) => networkStatus(String(a.network ?? "devnet")),
131
+ run: async (a) => networkStatus(String(a.network ?? (await import("./net.js")).activeNetwork())),
132
132
  },
133
133
  {
134
134
  name: "get_role_steps",
@@ -268,7 +268,7 @@ let limitsCache;
268
268
  let limitsInflight;
269
269
  /** Faucet /limits (the same endpoint network_status reads). Never blocks a page for more than 1.5 s. */
270
270
  async function faucetLimits() {
271
- const net = JSON.parse(readFileSync(networksPath(), "utf8")).devnet;
271
+ const net = JSON.parse(readFileSync(networksPath(), "utf8"))[(await import("./net.js")).activeNetwork()];
272
272
  if ((!limitsCache || Date.now() - limitsCache.at > 60_000) && !limitsInflight && net?.faucet) {
273
273
  limitsInflight = getJson(`${net.faucet}/limits`)
274
274
  .then((v) => void (limitsCache = { at: Date.now(), v }))
@@ -288,11 +288,12 @@ async function homeStats() {
288
288
  const mp = await import("./minerpage.js");
289
289
  const [v, limits] = await Promise.all([mp.demand(undefined, 0).catch(() => undefined), faucetLimits().catch(() => undefined)]);
290
290
  const nets = JSON.parse(readFileSync(networksPath(), "utf8"));
291
- const devnet = '<span class="tag">devnet</span>';
291
+ const active = (await import("./net.js")).activeNetwork();
292
+ const devnet = `<span class="tag">${esc(active)}</span>`;
292
293
  const d = v?.shown;
293
294
  const miners = d
294
- ? stat(ICONS.miner, "Miners on devnet", d.minerCount.toLocaleString("en-US"), `active in the last 7 days${d.complete ? "" : ", partial read"} ${devnet}`, "on", "LIVE")
295
- : stat(ICONS.miner, "Miners on devnet", DASH, `explorer read in progress, refresh in a minute ${devnet}`, "off", "NO DATA");
295
+ ? stat(ICONS.miner, `Miners on ${active}`, d.minerCount.toLocaleString("en-US"), `active in the last 7 days${d.complete ? "" : ", partial read"} ${devnet}`, "on", "LIVE")
296
+ : stat(ICONS.miner, `Miners on ${active}`, DASH, `explorer read in progress, refresh in a minute ${devnet}`, "off", "NO DATA");
296
297
  const validators = stat(ICONS.validator, "Validators", DASH, `not read by this kit yet ${devnet}`, "off", "NO DATA");
297
298
  const cap = Number(limits?.faucet?.dailyCap?.limitFlop);
298
299
  const grant = Number(limits?.faucet?.anonymous?.grantFlop);
@@ -300,10 +301,12 @@ async function homeStats() {
300
301
  const faucet = Number.isFinite(cap) && cap > 0
301
302
  ? stat(ICONS.faucet, "Faucet daily limit", `${cap.toLocaleString("en-US")} FLOP`, `whole faucet per day${Number.isFinite(grant) && grant > 0 ? `, ${grant} FLOP per address${Number.isFinite(hours) && hours > 0 ? ` every ${hours} h` : ""}` : ""} ${devnet}`, "on", "LIVE")
302
303
  : stat(ICONS.faucet, "Faucet daily limit", DASH, `faucet did not answer ${devnet}`, "off", "NO DATA");
303
- const t = nets.testnet ?? {};
304
- const testnet = t.rpc && t.genesis
305
- ? stat(ICONS.clock, "Testnet status", "Endpoints configured", "from networks.json in this kit", "off", "CONFIG", true)
306
- : stat(ICONS.clock, "Testnet status", "Waiting for Flop endpoints", "no testnet endpoints in networks.json yet", "off", "CONFIG", true);
304
+ void nets;
305
+ const tn = (await import("./testnet.js")).status();
306
+ const when = (iso) => (iso ? `${iso.slice(0, 16).replace("T", " ")} UTC` : "");
307
+ const testnet = tn.published
308
+ ? stat(ICONS.clock, "Testnet status", "Endpoints published, not yet enabled in the kit", `seen on Flop's testnet page since ${when(tn.lastChanged)}`, "on", "LIVE", true)
309
+ : stat(ICONS.clock, "Testnet status", "Waiting for Flop endpoints", tn.lastChecked ? `Flop's testnet page checked ${when(tn.lastChecked)}; not yet published: ${tn.missing.join(", ")}` : "first check of Flop's testnet page pending", "off", "WATCHING", true);
307
310
  return `<div class="stats">${miners}${validators}${faucet}${testnet}</div>`;
308
311
  }
309
312
  // ---------- HTTP ----------
@@ -370,6 +373,7 @@ async function mcp(req, res) {
370
373
  }
371
374
  export function startServer(port, host = "0.0.0.0") {
372
375
  publicHost(); // fail fast on a bad PUBLIC_HOST
376
+ void import("./testnet.js").then((t) => t.startWatcher());
373
377
  const server = createServer(async (req, res) => {
374
378
  try {
375
379
  const path = new URL(req.url ?? "/", "http://x").pathname.replace(/\/+$/, "") || "/";
@@ -377,6 +381,10 @@ export function startServer(port, host = "0.0.0.0") {
377
381
  return await mcp(req, res);
378
382
  if (req.method !== "GET" && req.method !== "HEAD")
379
383
  return send(res, 405, "text/plain", "method not allowed\n", { allow: "GET, HEAD" });
384
+ if (path === "/api/status") {
385
+ const { status } = await import("./testnet.js");
386
+ return send(res, 200, "application/json", JSON.stringify(status(), null, 2), { "cache-control": "no-store" });
387
+ }
380
388
  if (path === "/healthz")
381
389
  return send(res, 200, "text/plain", "ok\n", { "cache-control": "no-store" });
382
390
  if (path === "/start") {
@@ -398,7 +406,7 @@ export function startServer(port, host = "0.0.0.0") {
398
406
  const mp = await import("./minerpage.js");
399
407
  if (path === "/miner.js")
400
408
  return send(res, 200, "text/javascript; charset=utf-8", mp.minerScript());
401
- const v = await mp.demand();
409
+ const v = path === "/miner" ? await mp.demandWithRetry() : await mp.demand();
402
410
  const d = v?.shown;
403
411
  const fresh = { "cache-control": "public, max-age=60" };
404
412
  if (path === "/api/miner-stats") {
@@ -413,7 +421,7 @@ export function startServer(port, host = "0.0.0.0") {
413
421
  if (path === "/") {
414
422
  const body = render(readFileSync(join(SITE, "index.html"), "utf8"))
415
423
  .replace(/\{\{icon:([a-z]+)\}\}/g, (_m, k) => ICONS[k] ?? "")
416
- .replace("{{ROLES}}", render(rolesHtml(ICONS)))
424
+ .replace("{{ROLES}}", withTestnetLine(render(rolesHtml(ICONS))))
417
425
  .replace("{{GUIDES}}", guidesHtml(ICONS.doc))
418
426
  .replace("{{STATS}}", await homeStats());
419
427
  return send(res, 200, "text/html; charset=utf-8", page("flopguild: pick your role", body, { footerNote: START_FOOTER, style: HOME_STYLE, script: "/tabs.js" }), { "cache-control": "public, max-age=60" });
package/dist/shell.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Shared page shell for the site: top bar, cards, terminal-style code blocks, fonts. Dark only.
2
2
  // Everything is served from this site: fonts from /fonts, scripts from /copy.js and page scripts.
3
3
  import { GUILD_ROOM, GUILD_ROOM_URL } from "./config.js";
4
+ import { activeNetwork } from "./net.js";
4
5
  export const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
5
6
  export const RUN_IN_SHELL = "Run in: Ubuntu, macOS Terminal, or WSL on Windows (not PowerShell)";
6
7
  export const RUN_IN_POWERSHELL = "Run in: PowerShell";
@@ -171,7 +172,7 @@ ${o.style ?? ""}
171
172
  </style>${copy}${o.script ? `<script ${o.module ? 'type="module"' : "defer"} src="${o.script}"></script>` : ""}</head><body>
172
173
  <header class="topbar"><div class="wrap">
173
174
  <a class="brand" href="/" aria-label="flopguild home"><img src="/logo.svg" alt="" width="28" height="28"><span class="wm"><span>flop</span><b>guild</b></span></a>
174
- <span class="pill" title="The kit runs on the Flop devnet until testnet endpoints are published">DEVNET</span>
175
+ <span class="pill" title="The network this kit is set to use (networks.json)">${esc(activeNetwork().toUpperCase())}</span>
175
176
  ${NAV}
176
177
  <a class="btn" href="/#agent">Start your agent</a>
177
178
  </div></header>
package/dist/sync-docs.js CHANGED
@@ -13,7 +13,8 @@ const a = text.indexOf(START);
13
13
  const b = text.indexOf(END);
14
14
  if (a < 0 || b < a)
15
15
  throw new Error("skill.md: generated markers not found");
16
- const body = expand("## Roles\n\n{{ROLES_MD}}\n## Guides\n\n{{GUIDES_MD}}\n");
16
+ // The package is built once; the testnet line changes over time, so point to the live status instead.
17
+ const body = expand("## Roles\n\n{{ROLES_MD}}\n## Guides\n\n{{GUIDES_MD}}\n", "Testnet status changes over time: see {{PUBLIC_URL}}/api/status. This kit runs on devnet, which earns nothing.");
17
18
  const next = `${text.slice(0, a)}${START}\n\n${body.trim()}\n\n${text.slice(b)}`;
18
19
  if (next !== text)
19
20
  writeFileSync(path, next);
@@ -0,0 +1,371 @@
1
+ // Testnet watcher. Reads Flop's official pages, extracts the testnet endpoints and keeps them as a
2
+ // candidate for a human to review. It never writes networks.json and never points the kit at them.
3
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { homeDir } from "./identity.js";
6
+ import { networksPath } from "./net.js";
7
+ export const SOURCES = {
8
+ docs: "https://docs.flop.network/networks/testnet",
9
+ releases: "https://flop.network/releases.json",
10
+ };
11
+ export const INTERVAL_MS = 5 * 60 * 1000;
12
+ export const FIELDS = ["rpc", "gateway", "faucet", "genesis", "chainId"];
13
+ // ---------- validation ----------
14
+ const isHttps = (u) => !!u && /^https:\/\/[a-z0-9.-]+(:\d+)?(\/\S*)?$/i.test(u);
15
+ const isRpc = (u) => !!u && /^(wss|https):\/\/[a-z0-9.-]+(:\d+)?(\/\S*)?$/i.test(u);
16
+ const VALID = {
17
+ rpc: isRpc, // the kit talks to the chain over WebSocket; an https RPC is accepted too
18
+ gateway: isHttps,
19
+ faucet: isHttps,
20
+ genesis: (v) => !!v && /^0x[0-9a-f]{64}$/i.test(v),
21
+ chainId: (v) => !!v && /^[a-z0-9][a-z0-9_-]{2,63}$/i.test(v),
22
+ };
23
+ export function missingFields(c) {
24
+ return FIELDS.filter((f) => !VALID[f](c[f]));
25
+ }
26
+ // ---------- extraction ----------
27
+ /** Hosts the kit already uses for devnet. A testnet field may not reuse one of them from prose. */
28
+ function devnetHosts() {
29
+ try {
30
+ const d = JSON.parse(readFileSync(networksPath(), "utf8")).devnet ?? {};
31
+ return new Set(Object.values(d).filter((v) => typeof v === "string" && /^[a-z]+:\/\//.test(v)).map((v) => new URL(v).host));
32
+ }
33
+ catch {
34
+ return new Set();
35
+ }
36
+ }
37
+ /** HTML to plain text, keeping link targets as "text (url)". */
38
+ export function pageText(html) {
39
+ return html
40
+ .replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>/gi, " ")
41
+ .replace(/<a\b[^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi, (_m, href, t) => `${t} (${href})`)
42
+ .replace(/<[^>]+>/g, " ")
43
+ .replace(/&amp;/g, "&")
44
+ .replace(/&lt;/g, "<")
45
+ .replace(/&gt;/g, ">")
46
+ .replace(/&quot;/g, '"')
47
+ .replace(/&#39;|&#x27;/g, "'")
48
+ .replace(/\s+/g, " ")
49
+ .trim();
50
+ }
51
+ const KEYWORDS = {
52
+ rpc: /\bRPC\b/,
53
+ gateway: /\bgateway\b/i,
54
+ faucet: /\bfaucet\b/i,
55
+ };
56
+ /** Hosts that are never endpoints: package registries, code hosting, block explorers. */
57
+ const NOT_ENDPOINT = /(^|\.)(npmjs\.org|npmjs\.com|github\.com|githubusercontent\.com)$|scan\b|explorer/i;
58
+ const NEAR = 60; // max characters between the keyword and the URL, with no other URL in between
59
+ /**
60
+ * From the docs page: a URL counts for a field only when it is close to a word naming the field,
61
+ * in a sentence that does not mention devnet, and its host is neither a devnet host of the kit nor
62
+ * a registry, code host or explorer. For the RPC a wss:// URL wins over https://.
63
+ */
64
+ export function fromDocs(html, devHosts = devnetHosts()) {
65
+ const text = pageText(html);
66
+ const c = {};
67
+ const sentences = text.split(/(?<=[.?!])\s+(?=[A-Z])/);
68
+ for (const field of ["rpc", "gateway", "faucet"]) {
69
+ const found = [];
70
+ for (const s of sentences) {
71
+ if (/devnet/i.test(s))
72
+ continue;
73
+ const urls = [...s.matchAll(/\b(?:https|wss):\/\/[^\s()<>"',]+/g)].map((m) => ({ u: m[0].replace(/[.;:]+$/, ""), at: m.index, end: m.index + m[0].length }));
74
+ const keys = [...s.matchAll(new RegExp(KEYWORDS[field].source, KEYWORDS[field].flags.includes("i") ? "gi" : "g"))].map((m) => ({ at: m.index, end: m.index + m[0].length }));
75
+ for (const x of urls) {
76
+ let host;
77
+ try {
78
+ host = new URL(x.u).host;
79
+ }
80
+ catch {
81
+ continue;
82
+ }
83
+ if (devHosts.has(host) || NOT_ENDPOINT.test(host))
84
+ continue;
85
+ if (!(field === "rpc" ? isRpc(x.u) : isHttps(x.u)))
86
+ continue;
87
+ const near = keys.some((k) => {
88
+ const [from, to] = k.at >= x.end ? [x.end, k.at] : [k.end, x.at];
89
+ if (to - from > NEAR || to < from)
90
+ return false;
91
+ return !urls.some((o) => o !== x && o.at >= from && o.end <= to);
92
+ });
93
+ if (near)
94
+ found.push(x.u);
95
+ }
96
+ }
97
+ const pick = field === "rpc" ? (found.find((u) => u.startsWith("wss:")) ?? found[0]) : found[0];
98
+ if (pick)
99
+ c[field] = pick;
100
+ }
101
+ const g = text.match(/genesis[^.]{0,80}?\b(0x[0-9a-fA-F]{64})\b/i);
102
+ if (g)
103
+ c.genesis = g[1].toLowerCase();
104
+ const id = text.match(/chain ID (?:is|:)\s*`?([A-Za-z0-9][A-Za-z0-9_-]{2,63})/i);
105
+ if (id)
106
+ c.chainId = id[1];
107
+ return c;
108
+ }
109
+ /** From releases.json: any object that names itself testnet (or sits under a "testnet" key) and carries endpoint fields. */
110
+ export function fromReleases(json) {
111
+ const c = {};
112
+ const pick = (o) => {
113
+ const get = (...keys) => keys.map((k) => o[k]).find((v) => typeof v === "string");
114
+ c.rpc ??= get("rpc", "rpcUrl", "rpc_url", "ws", "wss");
115
+ c.gateway ??= get("gateway", "gatewayUrl", "gateway_url", "api");
116
+ c.faucet ??= get("faucet", "faucetUrl", "faucet_url");
117
+ c.genesis ??= get("genesis", "genesisHash", "genesis_hash")?.toLowerCase();
118
+ c.chainId ??= get("chainId", "chain_id", "chainID");
119
+ };
120
+ const walk = (v, underTestnet, depth) => {
121
+ if (!v || typeof v !== "object" || depth > 8)
122
+ return;
123
+ if (Array.isArray(v))
124
+ return v.forEach((x) => walk(x, underTestnet, depth + 1));
125
+ const o = v;
126
+ const named = [o.network, o.name, o.id].some((x) => typeof x === "string" && x.toLowerCase() === "testnet");
127
+ if (underTestnet || named)
128
+ pick(o);
129
+ for (const [k, x] of Object.entries(o))
130
+ walk(x, underTestnet || named || k.toLowerCase() === "testnet", depth + 1);
131
+ };
132
+ walk(json, false, 0);
133
+ for (const f of FIELDS)
134
+ if (c[f] === undefined)
135
+ delete c[f];
136
+ return c;
137
+ }
138
+ /** Merge both sources: releases.json (structured) wins over prose for any field it has. */
139
+ export function extract(docsHtml, releasesJson, devHosts = devnetHosts()) {
140
+ const d = docsHtml ? fromDocs(docsHtml, devHosts) : {};
141
+ const r = releasesJson ? fromReleases(releasesJson) : {};
142
+ const candidate = {};
143
+ const sources = {};
144
+ for (const f of FIELDS) {
145
+ if (VALID[f](r[f]))
146
+ (candidate[f] = r[f]), (sources[f] = SOURCES.releases);
147
+ else if (VALID[f](d[f]))
148
+ (candidate[f] = d[f]), (sources[f] = SOURCES.docs);
149
+ }
150
+ const missing = missingFields(candidate);
151
+ return { candidate, sources, missing, published: missing.length === 0 };
152
+ }
153
+ // ---------- state ----------
154
+ export const statePath = () => join(homeDir(), "testnet-watch.json");
155
+ export const candidatePath = () => join(homeDir(), "testnet-candidate.json");
156
+ export function loadState() {
157
+ try {
158
+ return JSON.parse(readFileSync(statePath(), "utf8"));
159
+ }
160
+ catch {
161
+ return { published: false, candidate: {}, missing: [...FIELDS], sources: {} };
162
+ }
163
+ }
164
+ function writeJson(path, v) {
165
+ mkdirSync(homeDir(), { recursive: true, mode: 0o700 });
166
+ writeFileSync(path + ".tmp", JSON.stringify(v, null, 2) + "\n", { mode: 0o600 });
167
+ renameSync(path + ".tmp", path);
168
+ }
169
+ const fingerprint = (s) => JSON.stringify([s.published, FIELDS.map((f) => s.candidate[f] ?? null)]);
170
+ let warnedNoTelegram = false;
171
+ /** Telegram via FLOP_TG_TOKEN and FLOP_TG_CHAT. Unset: log once and skip. The token is never logged. */
172
+ export async function notify(text, log, fetcher = fetch) {
173
+ const token = process.env.FLOP_TG_TOKEN;
174
+ const chat = process.env.FLOP_TG_CHAT;
175
+ if (!token || !chat) {
176
+ if (!warnedNoTelegram)
177
+ log("testnet watcher: FLOP_TG_TOKEN or FLOP_TG_CHAT not set, Telegram messages skipped");
178
+ warnedNoTelegram = true;
179
+ return false;
180
+ }
181
+ try {
182
+ const f = fetcher;
183
+ const r = await f(`https://api.telegram.org/bot${token}/sendMessage`, {
184
+ method: "POST",
185
+ headers: { "content-type": "application/json" },
186
+ body: JSON.stringify({ chat_id: chat, text, disable_web_page_preview: true }),
187
+ signal: AbortSignal.timeout(15_000),
188
+ });
189
+ if (!r.ok)
190
+ log(`testnet watcher: Telegram answered HTTP ${r.status}`);
191
+ return r.ok;
192
+ }
193
+ catch (e) {
194
+ log(`testnet watcher: Telegram failed: ${e.name}`); // never the URL: it holds the token
195
+ return false;
196
+ }
197
+ }
198
+ function message(s, first) {
199
+ const lines = FIELDS.map((f) => `${f}: ${s.candidate[f] ?? "missing"}`);
200
+ const head = first
201
+ ? "flop-guild: Flop testnet endpoints are published. Not enabled in the kit; review testnet-candidate.json."
202
+ : `flop-guild: testnet candidate changed (${s.published ? "published" : "no longer complete"}). Not enabled in the kit.`;
203
+ return [head, ...lines, `source: ${SOURCES.docs}`].join("\n");
204
+ }
205
+ /** One check. Fetch errors keep the last state and record the error. */
206
+ export async function checkOnce(o = {}) {
207
+ const fetcher = o.fetcher ?? ((u) => fetch(u, { headers: { "user-agent": "flop-guild-testnet-watch" }, signal: AbortSignal.timeout(20_000) }));
208
+ const now = (o.now ?? (() => new Date()))().toISOString();
209
+ const log = o.log ?? ((s) => process.stderr.write(s + "\n"));
210
+ const prev = loadState();
211
+ const get = async (u) => {
212
+ const r = await fetcher(u);
213
+ if (!r.ok)
214
+ throw new Error(`${u}: HTTP ${r.status}`);
215
+ return r.text();
216
+ };
217
+ const [docs, rel] = await Promise.allSettled([get(SOURCES.docs), get(SOURCES.releases)]);
218
+ if (docs.status === "rejected" && rel.status === "rejected") {
219
+ const next = { ...prev, lastChecked: now, lastError: `${docs.reason?.message}; ${rel.reason?.message}` };
220
+ writeJson(statePath(), next);
221
+ return next;
222
+ }
223
+ let relJson;
224
+ try {
225
+ relJson = rel.status === "fulfilled" ? JSON.parse(rel.value) : undefined;
226
+ }
227
+ catch {
228
+ relJson = undefined;
229
+ }
230
+ const x = extract(docs.status === "fulfilled" ? docs.value : undefined, relJson, o.devHosts);
231
+ const next = {
232
+ published: x.published,
233
+ lastChecked: now,
234
+ lastChanged: prev.lastChanged,
235
+ firstPublishedAt: prev.firstPublishedAt,
236
+ candidate: x.candidate,
237
+ missing: x.missing,
238
+ sources: x.sources,
239
+ lastError: [docs, rel].filter((p) => p.status === "rejected").map((p) => p.reason?.message).join("; ") || undefined,
240
+ };
241
+ const changed = fingerprint(prev) !== fingerprint(next) || !existsSync(statePath());
242
+ if (changed)
243
+ next.lastChanged = now;
244
+ const firstFlip = next.published && !prev.firstPublishedAt;
245
+ if (firstFlip)
246
+ next.firstPublishedAt = now;
247
+ writeJson(statePath(), next);
248
+ if (changed) {
249
+ writeJson(candidatePath(), { note: "Candidate only. Not used by the kit and not written to networks.json. Review before enabling.", published: next.published, checked: now, missing: next.missing, ...next.candidate, sources: next.sources });
250
+ log(`testnet watcher: ${next.published ? "published" : `waiting (missing: ${next.missing.join(", ")})`}`);
251
+ }
252
+ // Telegram on the first flip, and on any change after that.
253
+ if (firstFlip || (changed && prev.firstPublishedAt))
254
+ await notify(message(next, firstFlip), log);
255
+ return next;
256
+ }
257
+ const LABEL = { rpc: "RPC", gateway: "gateway", faucet: "faucet", genesis: "genesis hash", chainId: "chain ID" };
258
+ const list = (xs) => (xs.length < 2 ? xs.join("") : `${xs.slice(0, -1).join(", ")} and ${xs.at(-1)}`);
259
+ /** The one sentence the site uses for testnet, from the watcher's state. Never mentions an airdrop. */
260
+ export function testnetLine(st = status()) {
261
+ if (st.published)
262
+ return "Flop has published testnet endpoints. They are not enabled in the kit yet.";
263
+ if (!st.found.length)
264
+ return "Testnet endpoints are not published yet. This kit runs on devnet, which earns nothing.";
265
+ const waitFor = st.missing.filter((f) => f === "gateway" || f === "faucet" || f === "rpc").map((f) => LABEL[f]);
266
+ const pending = waitFor.length ? waitFor : st.missing.map((f) => LABEL[f]);
267
+ return `Flop has published part of its testnet details (found: ${list(st.found.map((f) => LABEL[f]))}; missing: ${list(st.missing.map((f) => LABEL[f]))}). The kit stays on devnet until the ${list(pending)} ${pending.length > 1 ? "are" : "is"} published.`;
268
+ }
269
+ /** Public summary for /api/status and the home page card. */
270
+ export function status() {
271
+ const s = loadState();
272
+ const missing = (s.missing ?? [...FIELDS]).filter((f) => FIELDS.includes(f));
273
+ const base = {
274
+ published: !!s.published,
275
+ found: FIELDS.filter((f) => !missing.includes(f)),
276
+ lastChecked: s.lastChecked ?? null,
277
+ lastChanged: s.lastChanged ?? null,
278
+ missing,
279
+ lastError: s.lastError ?? null,
280
+ note: "Endpoints are never enabled in the kit automatically.",
281
+ };
282
+ return { ...base, line: testnetLine(base) };
283
+ }
284
+ let timer;
285
+ /** Start the 5-minute loop inside the site server. TESTNET_WATCH=0 turns it off. */
286
+ export function startWatcher(log = (s) => process.stderr.write(s + "\n")) {
287
+ if (timer || process.env.TESTNET_WATCH === "0")
288
+ return;
289
+ const run = () => checkOnce({ log }).catch((e) => log(`testnet watcher: ${e.message}`));
290
+ void run();
291
+ timer = setInterval(run, INTERVAL_MS);
292
+ timer.unref();
293
+ }
294
+ /** Ask an RPC for the hash of block 0 with one JSON-RPC call. Read-only: no keys, no writes. */
295
+ export async function genesisFromRpc(rpc, timeoutMs = 20_000) {
296
+ const req = { jsonrpc: "2.0", id: 1, method: "chain_getBlockHash", params: [0] };
297
+ const read = (j) => {
298
+ if (j?.error)
299
+ throw new Error(`RPC error: ${j.error.message ?? JSON.stringify(j.error)}`);
300
+ if (typeof j?.result !== "string")
301
+ throw new Error("RPC answer has no block hash");
302
+ return j.result.toLowerCase();
303
+ };
304
+ if (/^https:/i.test(rpc)) {
305
+ const r = await fetch(rpc, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(req), signal: AbortSignal.timeout(timeoutMs) });
306
+ if (!r.ok)
307
+ throw new Error(`RPC HTTP ${r.status}`);
308
+ return read(await r.json());
309
+ }
310
+ if (!/^wss:/i.test(rpc))
311
+ throw new Error(`not a wss:// or https:// RPC: ${rpc}`);
312
+ const { default: WS } = await import("ws");
313
+ return new Promise((resolve, reject) => {
314
+ const ws = new WS(rpc, { headers: { "user-agent": "flop-guild-testnet-verify" }, handshakeTimeout: timeoutMs });
315
+ let settled = false;
316
+ const timer = setTimeout(() => done(new Error(`no answer from ${rpc} within ${timeoutMs / 1000} s`)), timeoutMs);
317
+ const done = (err, v) => {
318
+ if (settled)
319
+ return; // terminate() can emit again; settle once
320
+ settled = true;
321
+ clearTimeout(timer);
322
+ try {
323
+ ws.terminate();
324
+ }
325
+ catch { }
326
+ err ? reject(err) : resolve(v);
327
+ };
328
+ ws.on("open", () => ws.send(JSON.stringify(req)));
329
+ ws.on("message", (data) => {
330
+ try {
331
+ const j = JSON.parse(String(data));
332
+ if (j.id === 1)
333
+ done(undefined, read(j));
334
+ }
335
+ catch (e) {
336
+ done(e);
337
+ }
338
+ });
339
+ ws.on("unexpected-response", (_req, res) => done(new Error(`${rpc} refused the connection: HTTP ${res.statusCode}${res.statusCode === 429 ? " (rate limited, try again later)" : ""}`)));
340
+ ws.on("error", (e) => done(new Error(`could not connect to ${rpc}: ${e.message}`)));
341
+ ws.on("close", () => done(new Error(`connection to ${rpc} closed before an answer`)));
342
+ });
343
+ }
344
+ /** Compare the candidate's genesis with what the candidate RPC reports. Reads the candidate file only. */
345
+ export async function verifyCandidate() {
346
+ let c = {};
347
+ try {
348
+ c = JSON.parse(readFileSync(candidatePath(), "utf8"));
349
+ }
350
+ catch {
351
+ c = loadState().candidate ?? {};
352
+ }
353
+ if (!c.rpc || !VALID.rpc(c.rpc))
354
+ return { rpc: c.rpc ?? "", expected: c.genesis ?? "", match: false, error: "the candidate has no valid RPC" };
355
+ if (!c.genesis || !VALID.genesis(c.genesis))
356
+ return { rpc: c.rpc, expected: c.genesis ?? "", match: false, error: "the candidate has no valid genesis hash" };
357
+ // A public RPC can rate-limit (HTTP 429) right after launch: try three times, 5 s then 15 s apart.
358
+ let last = "";
359
+ for (const wait of [0, 5_000, 15_000]) {
360
+ if (wait)
361
+ await new Promise((r) => setTimeout(r, wait));
362
+ try {
363
+ const actual = await genesisFromRpc(c.rpc);
364
+ return { rpc: c.rpc, expected: c.genesis.toLowerCase(), actual, match: actual === c.genesis.toLowerCase() };
365
+ }
366
+ catch (e) {
367
+ last = e.message;
368
+ }
369
+ }
370
+ return { rpc: c.rpc, expected: c.genesis, match: false, error: `${last} (3 attempts)` };
371
+ }
package/networks.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "default": "devnet",
2
3
  "devnet": {
3
4
  "rpc": "wss://rpc.devnet.flop.network",
4
5
  "faucet": "https://faucet.flop.network",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flop-guild",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Technocore guild kit: Ed25519 did:key signing CLI for technocore.chat rooms, plus an agent identity scaffold.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,8 @@
43
43
  "@polkadot/api": "17.0.2",
44
44
  "@polkadot/keyring": "14.0.3",
45
45
  "@polkadot/util": "14.0.3",
46
- "@polkadot/util-crypto": "14.0.3"
46
+ "@polkadot/util-crypto": "14.0.3",
47
+ "ws": "8.23.0"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@noble/ed25519": "3.2.0",
package/skill.md CHANGED
@@ -124,7 +124,7 @@ Run in: Ubuntu, macOS Terminal, or WSL on Windows (not PowerShell)
124
124
 
125
125
  Find your did:key in the [d-flopguild](https://technocore.chat/r/d-flopguild) room on Technocore.
126
126
 
127
- This runs on devnet until Flop publishes testnet endpoints. Devnet earns nothing and no airdrop is promised.
127
+ Testnet status changes over time: see https://flopguild.xyz/api/status. This kit runs on devnet, which earns nothing. No airdrop is promised.
128
128
 
129
129
  More: [Start](https://flopguild.xyz/start) (make a key in the browser), [Agent quick start](https://flopguild.xyz/guides/agent-quickstart), [Autopilot](https://flopguild.xyz/guides/autopilot), [Join the guild](https://flopguild.xyz/guides/join-guild).
130
130