Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mgpai22 committed Jan 25, 2024
1 parent 1085292 commit a8549bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: bahmutov/npm-install@v1

- name: Lint
run: yarn lint
run: yarn test:lint

- name: Test
run: yarn test --ci --coverage --maxWorkers=2
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"format": "prettier --loglevel silent --write src/**/*.ts test/**/*.ts",
"format": "prettier --log-level silent --write src/**/*.ts test/**/*.ts",
"test": "vitest",
"lint": "tsdx lint",
"fix:lint": "eslint ./ --ext .ts --fix",
"test:lint": "eslint ./ --ext .ts",
"prepare": "tsdx build",
"size": "size-limit",
"analyze": "size-limit --why"
Expand Down
16 changes: 9 additions & 7 deletions src/koios/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type ScriptInfo = {
script_hash: string;
creation_tx_hash: string;
type: string;
value: any;
value: never;
bytes: string;
size: number;
};
Expand All @@ -11,31 +11,33 @@ export class Koios {
private readonly baseUrl: string;

constructor(baseUrl: string) {
this.baseUrl = baseUrl;
this.baseUrl = baseUrl.replace(/[\\/]+$/, '');
}

async scriptInfo(scriptHashes: string[]): Promise<ScriptInfo[]> {
const url = `${this.baseUrl}script_info`;
const url = `${this.baseUrl}/script_info`;
const headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
'Content-Type': 'application/json'
};
const body = JSON.stringify({ _script_hashes: scriptHashes });

// eslint-disable-next-line no-useless-catch
try {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: body,
body: body
});

if (!response.ok) {
throw new Error(`Error: ${response.status}`);
throw new Error(`Server responded with status: ${response.status}`);
}

return response.json() as Promise<ScriptInfo[]>;
return response.json();
} catch (error) {
throw error;
}
}

}

0 comments on commit a8549bb

Please sign in to comment.