Skip to content

Commit

Permalink
fix: merge errors (#117)
Browse files Browse the repository at this point in the history
* update import path `shared/agent`

* fix eslint errors

* add fmt scripts
  • Loading branch information
byeongsu-hong committed Mar 8, 2024
1 parent 5111393 commit 543708c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion script/commands/context.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
12 changes: 7 additions & 5 deletions script/commands/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');

Expand All @@ -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');

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions script/shared/logger.ts
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 543708c

Please sign in to comment.