Skip to content

Commit

Permalink
Add tables listing rest and rpc endpoints for each network (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
emperorjm authored Aug 14, 2024
1 parent 107190a commit 5afe26b
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 6 deletions.
114 changes: 114 additions & 0 deletions components/content/Endpoints/RpcTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<script setup lang="ts">
import { PropType, computed } from 'vue';
import { useQuery } from '@tanstack/vue-query';
import axios from 'axios';
interface APIEndpoint {
address: string;
provider?: string;
}
interface ChainAPIs {
rpc: APIEndpoint[];
rest: APIEndpoint[];
grpc?: APIEndpoint[];
}
interface ChainInfo {
chain_name: string;
apis: ChainAPIs;
}
// Props
const props = defineProps({
file: { type: String, required: true },
endpointType: { type: String as PropType<'rpc' | 'rest'>, default: 'rpc' }, // Prop to select RPC or REST
});
// Function to fetch chain info
const fetchChainInfo = async (url: string): Promise<ChainInfo> => {
const response = await axios.get<ChainInfo>(url);
return response.data;
};
// Use Vue Query to fetch the data
const { data: apiProviders, isLoading } = useQuery({
queryKey: ['api-providers', props.file, props.endpointType],
queryFn: () => fetchChainInfo(props.file),
});
// Computed property to generate the list of selected endpoints
const apiList = computed(() => {
if (!apiProviders.value || !apiProviders.value.apis) {
return [];
}
const selectedEndpoints = props.endpointType === 'rpc'
? apiProviders.value.apis.rpc
: apiProviders.value.apis.rest;
return (selectedEndpoints || []).map(api => ({
provider: api.provider || 'Unknown',
address: api.address,
}));
});
</script>

<template>
<div v-if="isLoading">Loading...</div>
<div v-else-if="apiList.length === 0">No {{ endpointType.toUpperCase() }} providers available.</div>
<div v-else>
<div class="scrollable-table">
<table>
<thead>
<tr>
<th>Provider</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<tr v-for="(api, index) in apiList" :key="index">
<td>{{ api.provider }}</td>
<td>{{ api.address }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>

<style scoped>
.scrollable-table {
max-height: 200px; /* Adjust height as necessary */
overflow-y: auto;
border: 1px solid #ccc;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 0;
margin-bottom: 0;
}
th {
font-weight: bold;
}
th, td {
padding: 8px;
text-align: left;
}
/* Sticky header */
thead th {
position: sticky;
top: 0;
background-color: #f2f2f2; /* Ensure the header has a background */
z-index: 1; /* Ensure the header stays above table rows */
}
tbody tr:nth-child(even) {
}
</style>
42 changes: 36 additions & 6 deletions content/5.resources/1.networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,25 @@ Community-Driven Resources

## Triomphe (Mainnet)

Scroll to see the list of endpoints in the tables below.

### Rest endpoints

::rpcTable{:file="https://raw.githubusercontent.com/archway-network/networks/main/archway/chain.json" :endpointType="'rest'"}
::

### RPC endpoints

::rpcTable{:file="https://raw.githubusercontent.com/archway-network/networks/main/archway/chain.json" :endpointType="'rpc'"}
::

Archway's mainnet, the value-capture chain.


- Chain ID: `archway-1`
- Release: https://github.com/archway-network/archway/releases/tag/v4.0.3
- RPC: https://rpc.mainnet.archway.io:443
- GRPC: https://grpc.mainnet.archway.io:443
- GRPC-Web: https://grpc-web.mainnet.archway.io:443
- LCD: https://api.mainnet.archway.io
- Block Explorers: [Check the blockexplorers page](/resources/blockexplorers)
- Genesis: https://github.com/archway-network/networks/tree/main/archway/genesis
- Persistent Peers: https://github.com/archway-network/networks/blob/main/archway/chain.json#L203-L219
Expand All @@ -38,13 +48,23 @@ Archway's mainnet, the value-capture chain.

## Constantine (Supported Testnet)

Scroll to see the list of endpoints in the tables below.

### Rest endpoints

::rpcTable{:file="https://raw.githubusercontent.com/archway-network/networks/main/testnets/archwaytestnet/chain.json" :endpointType="'rest'"}
::

### RPC endpoints

::rpcTable{:file="https://raw.githubusercontent.com/archway-network/networks/main/testnets/archwaytestnet/chain.json" :endpointType="'rpc'"}
::

Stable testing network for dapp developers building dApps.

- Chain ID: `constantine-3`
- Release: https://github.com/archway-network/archway/releases/tag/v4.0.3
- RPC: https://rpc.constantine.archway.io:443
- GRPC: `grpc.constantine.archway.io:443`
- LCD: https://api.constantine.archway.io
- Block Explorer: https://www.mintscan.io/archway-testnet
- Genesis: https://github.com/archway-network/networks/blob/main/testnets/archwaytestnet/genesis.json
- Persistent Peers: https://github.com/archway-network/networks/blob/main/testnets/archwaytestnet/chain.json#L82-L98
Expand All @@ -53,14 +73,24 @@ Stable testing network for dapp developers building dApps.

## Titus (Devnet)

Scroll to see the list of endpoints in the tables below.

### Rest endpoints

::rpcTable{:file="https://raw.githubusercontent.com/archway-network/networks/main/devnets/archwaydevnet/chain.json" :endpointType="'rest'"}
::

### RPC endpoints

::rpcTable{:file="https://raw.githubusercontent.com/archway-network/networks/main/devnets/archwaydevnet/chain.json" :endpointType="'rpc'"}
::

Experimental testing network for testing out the newest features baked into Archway network.

- Chain ID: `titus-4`
- Release: https://github.com/archway-network/archway/releases/tag/v6.0.0-rc.1
- RPC: https://rpc.titus.archway.io:443
- GRPC: `grpc.titus.archway.io:443`
- Faucet: https://faucet.titus.archway.io
- LCD: https://api.titus.archway.io
- Block Explorer: https://explorer.nodestake.top/archway-devnet
- Genesis: https://github.com/archway-network/networks/blob/main/devnets/archwaydevnet/genesis.json
- Seeds: https://github.com/archway-network/networks/blob/main/devnets/archwaydevnet/chain.json#L86

0 comments on commit 5afe26b

Please sign in to comment.