eliminate dry code

This commit is contained in:
0xmuralik
2023-03-27 18:14:42 +05:30
parent 8ebb80beed
commit 0c0eb79fa3
26 changed files with 81 additions and 149 deletions
+1
View File
@@ -1,3 +1,4 @@
export * from './fees';
export * from './config';
export * from './common';
export * from './output';
+16
View File
@@ -0,0 +1,16 @@
export const txOutput = (result:any,msg:string,output:unknown,verbose:unknown) => {
if (output=="json"){
console.log(verbose ? JSON.parse(JSON.stringify(result)) : JSON.parse(msg));
} else {
console.log(verbose ? JSON.stringify(result,undefined,2) : msg);
}
};
export const queryOutput = (result: any, output: unknown) => {
if (output=="json"){
console.log(JSON.parse(JSON.stringify(result)));
} else {
console.log(JSON.stringify(result,undefined,2));
}
}