Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor to use constants #104

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const EXPLORER_API = 'https://explorer.tlsnotary.org';
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.5';
export const NOTARY_API = 'https://notary.pse.dev/v0.1.0-alpha.7';
export const NOTARY_PROXY = 'wss://notary.pse.dev/proxy';
export const MAX_RECV = 16384;
export const MAX_SENT = 4096;
9 changes: 5 additions & 4 deletions src/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LoggingLevel } from 'tlsn-js';
import { MAX_RECV, MAX_SENT, NOTARY_API, NOTARY_PROXY } from './constants';

export const NOTARY_API_LS_KEY = 'notary-api';
export const PROXY_API_LS_KEY = 'proxy-api';
Expand All @@ -18,19 +19,19 @@ export async function get(key: string, defaultValue?: string) {
}

export async function getMaxSent() {
return parseInt(await get(MAX_SENT_LS_KEY, '4096'));
return parseInt(await get(MAX_SENT_LS_KEY, MAX_SENT.toString()));
}

export async function getMaxRecv() {
return parseInt(await get(MAX_RECEIVED_LS_KEY, '16384'));
return parseInt(await get(MAX_RECEIVED_LS_KEY, MAX_RECV.toString()));
}

export async function getNotaryApi() {
return await get(NOTARY_API_LS_KEY, 'https://notary.pse.dev/v0.1.0-alpha.7');
return await get(NOTARY_API_LS_KEY, NOTARY_API);
}

export async function getProxyApi() {
return await get(PROXY_API_LS_KEY, 'wss://notary.pse.dev/proxy');
return await get(PROXY_API_LS_KEY, NOTARY_PROXY);
}

export async function getLoggingFilter(): Promise<LoggingLevel> {
Expand Down
Loading