-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3d8761
commit de7ef03
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
2 changes: 1 addition & 1 deletion
2
documentation/docs/components/outputs/api-scraping-outputs/time-now.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |