Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion explorer/lib/nodes.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
export const nodes = [
const API_URL = "https://raas-api.weavedb-node.xyz/nodes"
const DOMAIN_URL = "raas.weavedb-node.xyz"
const PORT_NUM = "443"
const DEFAULT_NODES = [
{
endpoint: "rollup-testnet.weavedb.xyz:443",
network: "Private Alpha",
key: "alpha",
},
{ endpoint: "localhost:8080", network: "Localhost", key: "localhost" },
]

async function fetchNodes() {
try {
const response = await fetch(API_URL)
const jsonResponse = await response.json()
console.log("jsonResponse", jsonResponse)
const { rollups } = jsonResponse
console.log("rollups", rollups)

const formattedNodes = [
...DEFAULT_NODES,
...rollups.map((node) => ({
key: node.rollupId,
endpoint: `${node.rollupId}.${DOMAIN_URL}:${PORT_NUM}`,
network: node.ipAddress,
})),
]

return formattedNodes
} catch (error) {
console.error("Failed to fetch nodes:", error)
return DEFAULT_NODES
}
}

const nodes = await fetchNodes()
console.log("nodes", nodes)

export { nodes }