Skip to content

Commit

Permalink
Fix host (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
hundredark authored Feb 8, 2024
1 parent a90c202 commit da7445b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/client/blaze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { BlazeOptions, BlazeHandler } from './types';
import { websocket } from './ws';
import { sendRaw } from './utils';

const wsHostURL = ['wss://mixin-blaze.zeromesh.net', 'wss://blaze.mixin.one/'];

export const BlazeKeystoreClient = (keystore: Keystore | undefined, wsOptions: BlazeOptions | undefined) => {
let url = wsHostURL[0];
const url = 'wss://blaze.mixin.one';

let ws: WebSocket | undefined;
let pingTimeout: ReturnType<typeof setTimeout> | undefined;

Expand Down Expand Up @@ -43,7 +42,6 @@ export const BlazeKeystoreClient = (keystore: Keystore | undefined, wsOptions: B

ws.onerror = e => {
if (e.message !== 'Opening handshake has timed out') return;
url = url === wsHostURL[0] ? wsHostURL[1] : wsHostURL[0];
terminate();
};
};
Expand Down
9 changes: 1 addition & 8 deletions src/client/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { Keystore } from './types/keystore';
import { RequestConfig } from './types/client';
import { signAccessToken } from './utils/auth';

const hostURL = ['https://api.mixin.one', 'https://mixin-api.zeromesh.net'];

axios.defaults.headers.post['Content-Type'] = 'application/json';
axios.defaults.headers.put['Content-Type'] = 'application/json';
axios.defaults.headers.patch['Content-Type'] = 'application/json';
Expand All @@ -17,7 +15,7 @@ export function http(keystore?: Keystore, config?: RequestConfig): AxiosInstance
const retries = config?.retry || 5;

const ins = axios.create({
baseURL: hostURL[0],
baseURL: 'https://api.mixin.one',
timeout,
...config,
});
Expand Down Expand Up @@ -57,11 +55,6 @@ export function http(keystore?: Keystore, config?: RequestConfig): AxiosInstance
Boolean(error.code) && // Prevents retrying cancelled requests
isRetryAllowed(error)) ||
isIdempotentRequestError(error),
onRetry: (_count, err, requestConfig) => {
if (config?.baseURL) return;
requestConfig.baseURL = err.config?.baseURL === hostURL[0] ? hostURL[1] : hostURL[0];
ins.defaults.baseURL = err.config?.baseURL === hostURL[0] ? hostURL[1] : hostURL[0];
},
});

return ins;
Expand Down

0 comments on commit da7445b

Please sign in to comment.