Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
fix ci issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Meyer committed Oct 5, 2023
1 parent ada6946 commit 7a17b0d
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
node_modules/
.vscode
.github
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "use-defi-monorepo",
"version": "0.2.3",
"version": "0.2.4",
"description": "React hooks library to use with enso shortcuts infrastructure",
"main": "index.js",
"scripts": {
"preinstall": "npx only-allow pnpm",
"postinstall": "pnpm generate",
"lint": "pnpm eslint src/*",
"test": "pnpm vitest run --root ./test --config ./vitest.config.ts",
"lint": "pnpm eslint .",
"test": "pnpm vitest run --root ./use-defi/test --config ./vitest.config.ts",
"generate": "npx openapi-typescript https://api.enso.finance/api-json -o use-defi/src/generated/api.d.ts",
"build": "pnpm generate && pnpm build:setup && rollup -c",
"build:setup": "pnpm gts clean && mkdir dist && jq 'del(.scripts) | del(.devDependencies) | del(.private) | del(.pnpm)' package.json > dist/package.json && cp README.md dist/README.md",
Expand Down
6 changes: 3 additions & 3 deletions playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ function App() {
</div>
)}
</LoadingGuard>
<button onClick={executeMultichainRoute}>Execute Multichain Route</button>
<button onClick={() => executeMultichainRoute}>Execute Multichain Route</button>
<LoadingGuard isLoading={executePositionStatus === 'loading'}>
{hasRoute ? (
<>
<div className="code-block">Route found for shortcut. Click to run</div>
<div>
{!!executionDetails?.approvals?.length && (
<button onClick={executeApprovalsOrTransfers}>Run Approvals</button>
<button onClick={() => executeApprovalsOrTransfers}>Run Approvals</button>
)}
<button onClick={executeRoute}>Run Transaction</button>
<button onClick={() => executeRoute}>Run Transaction</button>
<br />
</div>
</>
Expand Down
5 changes: 3 additions & 2 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"compilerOptions": {
"paths": {
"@ensofinance/use-defi": [
"../use-defi/src/index.ts"
"./use-defi/src/index.ts"
]
}
},
"include": [
"src",
"../use-defi/src"
"../use-defi/src",
"vite.config.ts"
],
"references": [
{
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
"noUnusedLocals": true,
"emitDeclarationOnly": true,
"allowJs": true,
"composite": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"outDir": "./dist",
"types": [
"vitest/globals"
],
},
"include": [],
"files": [],
"references": [
{
Expand Down
6 changes: 6 additions & 0 deletions use-defi/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ module.exports = {
'@typescript-eslint/no-explicit-any': ['warn'],
'@typescript-eslint/no-unsafe-assignment': 'off',
},
overrides: [
{
files: ['src/**/*.ts', 'test/**/*.ts'],
excludedFiles: ['.eslintrc.cjs', 'package.json'],
},
],
};
2 changes: 1 addition & 1 deletion use-defi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ensofinance/use-defi",
"version": "0.2.3",
"version": "0.2.4",
"description": "React hooks library to use with enso shortcuts infrastructure",
"main": "index.js",
"module": "index.esm.js",
Expand Down
6 changes: 2 additions & 4 deletions use-defi/src/utils/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { URLSearchParams } from 'url';

import { ENSO_API } from '../constants';

import { parseApiErrorOrReturn } from './parseApiError';

export const apiFetchGet = async <T>(apiPath: string, qsParams: Record<string, string>): Promise<T> => {
const response = await fetch(`${ENSO_API}/${apiPath}?${new URLSearchParams(qsParams).toString()}`);
const response = await fetch(`${ENSO_API}/${apiPath}?${new window.URLSearchParams(qsParams).toString()}`);
const data = await response.json();

return parseApiErrorOrReturn(data as T);
Expand All @@ -24,7 +22,7 @@ export const apiFetchPost = async <T>(
headers.set('Authorization', `Bearer ${apiKey}`);
}

const response = await fetch(`${ENSO_API}/${apiPath}?${new URLSearchParams(qsParams).toString()}`, {
const response = await fetch(`${ENSO_API}/${apiPath}?${new window.URLSearchParams(qsParams).toString()}`, {
method: 'POST',
headers,
body: body ? JSON.stringify(body) : undefined,
Expand Down
13 changes: 11 additions & 2 deletions use-defi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {},
"compilerOptions": {
"paths": {
"@ensofinance/use-defi": [
"./use-defi/src/index.ts"
]
}
},
"include": [
"**/*.ts"
"src/**/*.ts",
"src/**/*.tsx",
"test/**/*.ts",
"vitest.config.ts"
]
}

0 comments on commit 7a17b0d

Please sign in to comment.