diff --git a/package.json b/package.json index cb94f0ef..3298a8da 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "main": "index.js", "scripts": { "clean": "rm -rf dist", + "lint": "eslint . --ext ts", + "prettier": "prettier ./script ./example ./codegen.ts --write", "build": "yarn clean && esbuild ./script --bundle --outfile=./dist/index.js --platform=node", "start": "yarn build && node ./dist/index.js", "cw-hpl": "yarn start", diff --git a/script/commands/context.ts b/script/commands/context.ts index 073f702f..35f0b1d1 100644 --- a/script/commands/context.ts +++ b/script/commands/context.ts @@ -1,6 +1,6 @@ import { Command } from 'commander'; -import { saveAgentConfig } from '../shared/context'; +import { saveAgentConfig } from '../shared/agent'; import { CONTAINER, Dependencies } from '../shared/ioc'; const contextCmd = new Command('context'); diff --git a/script/commands/warp.ts b/script/commands/warp.ts index e4ce8103..6be742c8 100644 --- a/script/commands/warp.ts +++ b/script/commands/warp.ts @@ -90,7 +90,7 @@ function checkConfigType< return config.type === tokenType && config.mode === tokenMode; } -async function handleCreate(configFile: string, _: any, cmd: Command) { +async function handleCreate(configFile: string) { const deps = CONTAINER.get(Dependencies); const warpConfigFile = readFileSync(configFile, 'utf-8'); @@ -114,7 +114,7 @@ async function handleCreate(configFile: string, _: any, cmd: Command) { }; switch (warpType) { - case 'native': + case 'native': { if (!checkConfigType(warpConfig, 'native', mode)) throw Error('Invalid wrap config type. This cannot be happended'); @@ -129,7 +129,8 @@ async function handleCreate(configFile: string, _: any, cmd: Command) { ...nativeWarp, }); break; - case 'cw20': + } + case 'cw20': { if (!checkConfigType(warpConfig, 'cw20', warpConfig.mode)) throw Error('Invalid wrap config type. This cannot be happended'); @@ -144,12 +145,13 @@ async function handleCreate(configFile: string, _: any, cmd: Command) { ...cw20Warp, }); break; + } } saveContext(deps.network.id, deps.ctx); } -async function handleLink(_: any, cmd: Command) { +async function handleLink(_: object, cmd: Command) { type Option = { assetType: 'native' | 'cw20'; assetId: string; @@ -199,7 +201,7 @@ async function handleLink(_: any, cmd: Command) { console.log(linkResp.hash); } -async function handleTransfer(_: any, cmd: Command) { +async function handleTransfer(_: object, cmd: Command) { type Option = { assetType: 'native' | 'cw20'; assetId: string; diff --git a/script/shared/logger.ts b/script/shared/logger.ts index 595df58c..5d34b96e 100644 --- a/script/shared/logger.ts +++ b/script/shared/logger.ts @@ -1,16 +1,16 @@ export class Logger { constructor(public name: string) {} - log(...args: any[]) { + log(...args: unknown[]) { console.log(`[${this.name}]`, ...args); } - debug = (...args: any[]) => + debug = (...args: unknown[]) => console.log('DEBUG]'.grey, `[${this.name}]`, ...args); - info = (...args: any[]) => + info = (...args: unknown[]) => console.log(' INFO]'.cyan, `[${this.name}]`, ...args); - error = (...args: any[]) => + error = (...args: unknown[]) => console.error('ERROR]'.red, `[${this.name}]`, ...args); }