Skip to content

Commit

Permalink
chore: use localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
yHSJ committed Nov 21, 2024
1 parent dd1bf98 commit bab329c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion referee/referee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as bech32 from "bech32-buffer";
import * as ed25519 from "@noble/ed25519";
import { blake2b } from "@noble/hashes/blake2b";

const HYDRA_NODE = "https://a0.us-east-1.hydra-doom.sundae.fi/";
const HYDRA_NODE = "http://localhost:4001/";
const RECORD_STATS = true;
const API_KEY = process.env.API_KEY;

Expand Down
17 changes: 7 additions & 10 deletions src/utils/hydra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,21 @@ export class Hydra {
private initConnection(filterAddress?: string) {
const websocketUrl = new URL(this.url);
websocketUrl.protocol = websocketUrl.protocol.replace("https", "wss");
console.log(
const finalUrl =
websocketUrl +
(websocketUrl.toString().endsWith("/") ? "" : "/") +
`?${filterAddress ? `address=${filterAddress}&` : ""}history=no`,
);
this.connection = new WebSocket(
websocketUrl +
(websocketUrl.toString().endsWith("/") ? "" : "/") +
`?${filterAddress ? `address=${filterAddress}&` : ""}history=no`,
);
(websocketUrl.toString().endsWith("/") ? "" : "/") +
`?${filterAddress ? `address=${filterAddress}&` : ""}history=no`;

console.log("Connecting to websocket", finalUrl);
this.connection = new WebSocket(finalUrl);
this.connection.onopen = () => {
console.log("Connected to Hydra");
};
this.connection.onerror = (error) => {
console.error("Error on Hydra websocket: ", error);
};
this.connection.onclose = (event) => {
console.warn("Hydra connection closed:", event.reason);
console.warn("Hydra connection closed:", event.reason ?? "no reason");
console.log("Retrying connection in 3000 ms...");
setTimeout(() => this.initConnection(filterAddress));
};
Expand Down

0 comments on commit bab329c

Please sign in to comment.