mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-05-02 23:05:10 -04:00
refactor(docs): move source for doc pages here (#119)
* docs: move dev docs to dev-docs folder * docs: move source for doc pages here * docs: improve docs
This commit is contained in:
parent
5341587dfa
commit
bfc82c0534
46 changed files with 6307 additions and 0 deletions
55
docs/components/SwapProviderTable.tsx
Normal file
55
docs/components/SwapProviderTable.tsx
Normal file
|
@ -0,0 +1,55 @@
|
|||
import { useState, useEffect } from "react";
|
||||
|
||||
export default function SwapProviderTable() {
|
||||
function satsToBtc(sats) {
|
||||
return sats / 100000000;
|
||||
}
|
||||
|
||||
async function getProviders() {
|
||||
// from https://unstoppableswap.net/api/list with cors disabled
|
||||
const response = await fetch("https://api.unstoppableswap.net/api/list");
|
||||
const data = await response.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
const [providers, setProviders] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
getProviders().then((data) => {
|
||||
setProviders(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
overflowX: "scroll",
|
||||
}}
|
||||
>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Multiaddress</th>
|
||||
<th>Peer ID</th>
|
||||
<th>Minimum Amount</th>
|
||||
<th>Maximum Amount</th>
|
||||
<th>Exchange Rate</th>
|
||||
<th>Uptime</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{providers.map((provider) => (
|
||||
<tr key={provider.peerId}>
|
||||
<td>{provider.multiAddr}</td>
|
||||
<td>{provider.peerId}</td>
|
||||
<td>{satsToBtc(provider.minSwapAmount)} BTC</td>
|
||||
<td>{satsToBtc(provider.maxSwapAmount)} BTC</td>
|
||||
<td>{satsToBtc(provider.price)} XMR/BTC</td>
|
||||
<td>{(provider.uptime * 100).toFixed(1)}%</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue