render_example_test.gno
7.38 Kb · 124 lines
1package zones
2
3// ExampleRender pins the index: the four seeded zones, official.
4func ExampleRender() {
5 reset()
6 print(Render(""))
7 // Output:
8 // # Zones
9 //
10 // A curated registry of gno.land networks and the endpoints that reach them. Anybody can propose a zone, and register endpoints on an official one; a curator approves, rejects or retires a zone and verifies or flags its endpoints, and every rejection, retirement and flag says why, in public.
11 //
12 // ## Official
13 //
14 // | zone | chain id | kind | rpc | endpoints |
15 // | --- | --- | --- | --- | --- |
16 // | [gno\.land mainnet](/r/moul/zones/v0:zone/mainnet) | `gnoland-1` | mainnet | `https://rpc.gno.land` | 6 verified of 6 |
17 // | [Onyx testnet](/r/moul/zones/v0:zone/onyx) | `onyx-1` | testnet | `https://rpc.onyx.testnets.gno.land` | 7 verified of 7 |
18 // | [gno\.land staging](/r/moul/zones/v0:zone/staging) | `staging` | devnet | `https://rpc.staging.gno.land` ⚠️ flagged | 0 verified of 2 |
19 // | [moul's gnodev staging](/r/moul/zones/v0:zone/moul-staging) | `moulstaging-1` | devnet | `https://rpc.gno-staging.moul.p2p.team` | 3 verified of 3 |
20 //
21 // [0 proposal\(s\) waiting for review](/r/moul/zones/v0:proposals) · [Propose a zone](/r/moul/zones/v0$help&func=ProposeZone&chainID=&description=&genesisURL=&gnowebURL=&kind=testnet&rpcURL=&slug=&title=)
22 //
23 // ## Read it from a node
24 //
25 // Every list is a plain function, so a node operator or a script can ask for it directly. An empty kind or status matches anything.
26 //
27 // ```
28 // gnokey query vm/qeval -data 'gno.land/r/moul/zones/v0.ListAddresses("onyx", "peer", "verified")'
29 // ```
30 //
31 // - `ListZones(status, kind)`: `approved` is the official list
32 // - `GetZone(slug)`
33 // - `ListEndpoints(slug, kind, status)`: kind is rpc, gnoweb, seed, peer, indexer, faucet or explorer
34 // - `ListAddresses(slug, kind, status)`: the same, reduced to what a config file wants
35 //
36 // Curated by `g1manfred47kzduec920z88wfr64ylksmdcedlf5`.
37}
38
39// ExampleRender_zone pins one zone's page: its facts, a link per endpoint kind,
40// and its endpoints in id order.
41func ExampleRender_zone() {
42 reset()
43 print(Render("zone/onyx"))
44 // Output:
45 // # Onyx testnet
46 //
47 // ✅ **official** · `onyx`
48 //
49 // The gno\.land testnet, launched 2026\-09\-28: mainnet's code, upgraded whenever mainnet is\.
50 //
51 // - **chain id**: `onyx-1`
52 // - **kind**: testnet
53 // - **rpc**: `https://rpc.onyx.testnets.gno.land`
54 // - **gnoweb**: [https://onyx\.testnets\.gno\.land](https://onyx.testnets.gno.land)
55 // - **genesis**: [https://github\.com/gnolang/gno/releases/download/chain/onyx/genesis\.json](https://github.com/gnolang/gno/releases/download/chain/onyx/genesis.json)
56 // - **proposed** by `g1manfred47kzduec920z88wfr64ylksmdcedlf5` at block 123
57 // - **revision**: 16
58 // - **last reviewed** by `g1manfred47kzduec920z88wfr64ylksmdcedlf5` at block 123: seeded at deploy; probed 2026\-10\-01
59 //
60 // ## Endpoints
61 //
62 // **all (7)** · [rpc \(1\)](/r/moul/zones/v0:zone/onyx?kind=rpc) · [gnoweb \(1\)](/r/moul/zones/v0:zone/onyx?kind=gnoweb) · [peer \(2\)](/r/moul/zones/v0:zone/onyx?kind=peer) · [indexer \(1\)](/r/moul/zones/v0:zone/onyx?kind=indexer) · [faucet \(1\)](/r/moul/zones/v0:zone/onyx?kind=faucet) · [explorer \(1\)](/r/moul/zones/v0:zone/onyx?kind=explorer)
63 //
64 // | # | revision | kind | address | label | status | registered by |
65 // | --- | --- | --- | --- | --- | --- | --- |
66 // | 7 | 18 | rpc | `https://rpc.onyx.testnets.gno.land` | gno core | ✅ verified: seeded at deploy; probed 2026\-10\-01 (`g1manfred47kzduec920z88wfr64ylksmdcedlf5`, block 123) | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` |
67 // | 8 | 20 | gnoweb | `https://onyx.testnets.gno.land` | gno core | ✅ verified: seeded at deploy; probed 2026\-10\-01 (`g1manfred47kzduec920z88wfr64ylksmdcedlf5`, block 123) | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` |
68 // | 9 | 22 | peer | `g1x5mlj5ava0dw9vkf4j6admjlzswm6f06p44krn@seed-1.onyx.testnets.gno.land:26656` | seed\-1, gno core | ✅ verified: seeded at deploy; probed 2026\-10\-01 (`g1manfred47kzduec920z88wfr64ylksmdcedlf5`, block 123) | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` |
69 // | 10 | 24 | peer | `g1grq5zswt0dlwwe7clr4359w70k2ewgse0gcwck@seed-2.onyx.testnets.gno.land:26656` | seed\-2, gno core | ✅ verified: seeded at deploy; probed 2026\-10\-01 (`g1manfred47kzduec920z88wfr64ylksmdcedlf5`, block 123) | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` |
70 // | 11 | 26 | indexer | `https://indexer.onyx.testnets.gno.land/graphql/query` | gno core tx\-indexer | ✅ verified: seeded at deploy; probed 2026\-10\-01 (`g1manfred47kzduec920z88wfr64ylksmdcedlf5`, block 123) | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` |
71 // | 12 | 28 | faucet | `https://onyx.testnets.gno.land/faucet` | gno core | ✅ verified: seeded at deploy; probed 2026\-10\-01 (`g1manfred47kzduec920z88wfr64ylksmdcedlf5`, block 123) | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` |
72 // | 13 | 30 | explorer | `https://gnoscope.com/?network=onyx` | gnoscope | ✅ verified: seeded at deploy; probed 2026\-10\-01 (`g1manfred47kzduec920z88wfr64ylksmdcedlf5`, block 123) | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` |
73 //
74 // [Register an endpoint](/r/moul/zones/v0$help&func=RegisterEndpoint&addr=&kind=rpc&label=&slug=onyx) · [Retire](/r/moul/zones/v0$help&func=RetireZone&reason=&revision=16&slug=onyx)
75 //
76 // ```
77 // gnokey query vm/qeval -data 'gno.land/r/moul/zones/v0.GetZone("onyx")'
78 // ```
79 //
80 // [All zones](/r/moul/zones/v0)
81}
82
83// ExampleRender_proposals pins the proposals page with one pending and one
84// rejected zone, written straight to the registry: an Example has no realm
85// token to cross with.
86func ExampleRender_proposals() {
87 reset()
88 must(reg.Propose(alice, 200, "alice-dev", info("alicedev-1", "Alice's devnet", "", "devnet", "", "https://rpc.alice.example.com", "")))
89 must(reg.Propose(bob, 201, "fake-mainnet", info("gnoland-1", "Mainnet (faster!)", "", "mainnet", "", "https://rpc.fake.example.com", "")))
90 must(reg.ReviewZone("fake-mainnet", "rejected", zrev("fake-mainnet"), Admin, 202, "not the mainnet RPC"))
91 print(Render("proposals"))
92 // Output:
93 // # Proposals
94 //
95 // Zones somebody proposed and no curator has approved. Only an approved zone is official.
96 //
97 // ## Pending
98 //
99 // | zone | chain id | kind | proposed by | review |
100 // | --- | --- | --- | --- | --- |
101 // | [Alice's devnet](/r/moul/zones/v0:zone/alice-dev) | `alicedev-1` | devnet | `g1v9kxjcm9ta047h6lta047h6lta047h6lzd40gh` | [review](/r/moul/zones/v0:zone/alice-dev) |
102 //
103 // [1 rejected](/r/moul/zones/v0:proposals?status=rejected) · [All zones](/r/moul/zones/v0)
104}
105
106// ExampleRender_rejected pins the rejected list, which carries the reasons.
107func ExampleRender_rejected() {
108 reset()
109 must(reg.Propose(bob, 201, "fake-mainnet", info("gnoland-1", "Mainnet (faster!)", "", "mainnet", "", "https://rpc.fake.example.com", "")))
110 must(reg.ReviewZone("fake-mainnet", "rejected", zrev("fake-mainnet"), Admin, 202, "not the mainnet RPC"))
111 print(Render("proposals?status=rejected"))
112 // Output:
113 // # Proposals
114 //
115 // Zones somebody proposed and no curator has approved. Only an approved zone is official.
116 //
117 // ## Rejected
118 //
119 // | zone | chain id | proposed by | why | |
120 // | --- | --- | --- | --- | --- |
121 // | [Mainnet \(faster\!\)](/r/moul/zones/v0:zone/fake-mainnet) | `gnoland-1` | `g1vfhkyh6lta047h6lta047h6lta047h6l03vdhu` | not the mainnet RPC | [Remove](/r/moul/zones/v0$help&func=RemoveZone&revision=46&slug=fake-mainnet) |
122 //
123 // [pending](/r/moul/zones/v0:proposals) · [All zones](/r/moul/zones/v0)
124}