2020-09-03 10:33:43 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as System from "~/components/system";
|
|
|
|
|
|
|
|
import Section from "~/components/core/Section";
|
|
|
|
import ScenePage from "~/components/core/ScenePage";
|
|
|
|
import ScenePageHeader from "~/components/core/ScenePageHeader";
|
|
|
|
|
2020-09-23 12:46:59 +03:00
|
|
|
let mounted = false;
|
|
|
|
|
2020-09-03 10:33:43 +03:00
|
|
|
export default class SceneSentinel extends React.Component {
|
|
|
|
state = { routes: [] };
|
|
|
|
|
|
|
|
async componentDidMount() {
|
2020-09-23 12:46:59 +03:00
|
|
|
if (mounted) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
mounted = true;
|
|
|
|
|
2020-09-03 10:33:43 +03:00
|
|
|
let routes;
|
|
|
|
try {
|
|
|
|
const response = await fetch("https://sentinel.slate.host/api");
|
|
|
|
const json = await response.json();
|
|
|
|
routes = json.data;
|
|
|
|
} catch (e) {}
|
|
|
|
|
|
|
|
this.setState({ routes });
|
|
|
|
}
|
|
|
|
|
2020-09-23 12:46:59 +03:00
|
|
|
componentWillUnmount() {
|
|
|
|
mounted = false;
|
|
|
|
}
|
|
|
|
|
2020-09-03 10:33:43 +03:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<ScenePage>
|
2020-09-23 05:35:56 +03:00
|
|
|
<ScenePageHeader title="Network API">
|
2020-10-18 22:57:39 +03:00
|
|
|
Slate provides access to recent data on the Filecoin Network through Sentinel. Each of
|
|
|
|
these API endpoints can be used programatically.
|
2020-09-03 10:33:43 +03:00
|
|
|
</ScenePageHeader>
|
|
|
|
|
2020-10-18 22:57:39 +03:00
|
|
|
<Section title="Filecoin API routes" style={{ maxWidth: 960, minWidth: "auto" }}>
|
2020-09-03 10:33:43 +03:00
|
|
|
<System.Table
|
|
|
|
data={{
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
key: "route",
|
|
|
|
name: "Route",
|
|
|
|
width: "100%",
|
2020-09-03 10:50:36 +03:00
|
|
|
name: "URL",
|
|
|
|
type: "NEW_WINDOW",
|
2020-09-03 10:33:43 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
rows: this.state.routes.map((r) => {
|
|
|
|
const route = `https://sentinel.slate.host${r}?offset=0&limit=200`;
|
|
|
|
return {
|
2020-09-03 10:50:36 +03:00
|
|
|
route,
|
2020-09-03 10:33:43 +03:00
|
|
|
};
|
|
|
|
}),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Section>
|
|
|
|
</ScenePage>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|