Skip to content

Commit

Permalink
chore: refactor to use constants
Browse files Browse the repository at this point in the history
  • Loading branch information
heeckhau committed Oct 4, 2024
1 parent d47cf0d commit fc2d7fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
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;
14 changes: 10 additions & 4 deletions src/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { LoggingLevel } from 'tlsn-js';
import {

Check failure on line 2 in src/utils/storage.ts

View workflow job for this annotation

GitHub Actions / build

Replace `⏎··MAX_RECV,⏎··MAX_SENT,⏎··NOTARY_API,⏎··NOTARY_PROXY⏎` with `·MAX_RECV,·MAX_SENT,·NOTARY_API,·NOTARY_PROXY·`
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 +24,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

0 comments on commit fc2d7fd

Please sign in to comment.