Skip to content

Commit

Permalink
link list
Browse files Browse the repository at this point in the history
  • Loading branch information
mfahampshire committed Dec 5, 2024
1 parent c3d8761 commit de7ef03
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
52 changes: 52 additions & 0 deletions documentation/docs/components/api-table.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React, { useState, useEffect } from "react";

export default function NymDealersAddresses({
endpoint,
}: {
endpoint: string;
}) {
const [announceAddresses, setAnnounceAddresses] = useState<string[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);

useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch(endpoint);

if (!response.ok) {
throw new Error("Failed to fetch data");
}

const jsonData = await response.json();

const addresses = jsonData.data.dealers.map(
(dealer: any) => dealer.announce_address
);

setAnnounceAddresses(addresses);
setIsLoading(false);
} catch (error) {
setError(error instanceof Error ? error.message : "Unknown error");
setIsLoading(false);
}
};

fetchData();
}, [endpoint]);

if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;

return (
<table>
<tbody>
{announceAddresses.map((address, index) => (
<tr key={index}>
<a href={address}>{address}</a>
</tr>
))}
</tbody>
</table>
);
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Thursday, December 5th 2024, 10:36:14 UTC
Thursday, December 5th 2024, 14:53:00 UTC
7 changes: 7 additions & 0 deletions documentation/docs/pages/apis/nym-api/mainnet.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import APITable from 'components/api-table.tsx';

The information below is generated with [Redoc](https://redocly.com/docs/redoc) consuming the OpenAPI spec found at [https://validator.nymtech.net/api-docs/openapi.json](https://validator.nymtech.net/api-docs/openapi.json) which is also used to generate the Swagger docs deployed at [https://validator.nymtech.net/api/swagger/index.html](https://validator.nymtech.net/api/swagger/index.html).

You can find the Swagger endpoints of other NymAPI instances at the following endpoints:
<APITable endpoint="https://api.nymtech.net/cosmwasm/wasm/v1/contract/n19604yflqggs9mk2z26mqygq43q2kr3n932egxx630svywd5mpxjsztfpvx/smart/eyJnZXRfY3VycmVudF9kZWFsZXJzIjogeyJsaW1pdCI6IDMwfX0=" />

There is also an overview of endpoints at [https://cosmos.directory/nyx](https://cosmos.directory/nyx).

> Redoc Component using `specUrl` goes here once spec is fixed

0 comments on commit de7ef03

Please sign in to comment.