mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-22 21:15:21 -04:00
feat(gui): Connect to preset rendezvous nodes at startup (#162)
This commit is contained in:
parent
7ebe59bc8d
commit
163f6fa94d
5 changed files with 37 additions and 19 deletions
|
@ -11,7 +11,7 @@ export default function DaemonStatusAlert() {
|
|||
const navigate = useNavigate();
|
||||
|
||||
if (contextStatus === null) {
|
||||
return <Alert severity="info">The daemon is not running</Alert>;
|
||||
return <LoadingSpinnerAlert severity="warning">Checking for available remote nodes</LoadingSpinnerAlert>;
|
||||
}
|
||||
|
||||
switch (contextStatus.type) {
|
||||
|
|
|
@ -16,16 +16,11 @@ import { useSnackbar } from "notistack";
|
|||
import { ChangeEvent, useState } from "react";
|
||||
import TruncatedText from "renderer/components/other/TruncatedText";
|
||||
import PromiseInvokeButton from "renderer/components/PromiseInvokeButton";
|
||||
import { listSellersAtRendezvousPoint } from "renderer/rpc";
|
||||
import { listSellersAtRendezvousPoint, PRESET_RENDEZVOUS_POINTS } from "renderer/rpc";
|
||||
import { discoveredProvidersByRendezvous } from "store/features/providersSlice";
|
||||
import { useAppDispatch } from "store/hooks";
|
||||
import { isValidMultiAddressWithPeerId } from "utils/parseUtils";
|
||||
|
||||
const PRESET_RENDEZVOUS_POINTS = [
|
||||
"/dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE",
|
||||
"/dns4/eratosthen.es/tcp/7798/p2p/12D3KooWAh7EXXa2ZyegzLGdjvj1W4G3EXrTGrf6trraoT1MEobs",
|
||||
];
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
chipOuter: {
|
||||
display: "flex",
|
||||
|
|
|
@ -48,6 +48,21 @@ import logger from "utils/logger";
|
|||
import { getNetwork, getNetworkName, isTestnet } from "store/config";
|
||||
import { Blockchain } from "store/features/settingsSlice";
|
||||
import { setStatus } from "store/features/nodesSlice";
|
||||
import { discoveredProvidersByRendezvous } from "store/features/providersSlice";
|
||||
|
||||
export const PRESET_RENDEZVOUS_POINTS = [
|
||||
"/dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE",
|
||||
];
|
||||
|
||||
export async function fetchSellersAtPresetRendezvousPoints() {
|
||||
await Promise.all(PRESET_RENDEZVOUS_POINTS.map(async (rendezvousPoint) => {
|
||||
const response = await listSellersAtRendezvousPoint(rendezvousPoint);
|
||||
store.dispatch(discoveredProvidersByRendezvous(response.sellers));
|
||||
|
||||
console.log(`Discovered ${response.sellers.length} sellers at rendezvous point ${rendezvousPoint} during startup fetch`);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export async function initEventListeners() {
|
||||
// This operation is in-expensive
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue