🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@ethernauta/cli

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethernauta/cli - npm Package Compare versions

Comparing version
0.0.40
to
0.0.41
+1
dist/bin-BVtwW2u7.d.ts
export {}
import { resolve } from "node:path"
import { DescriptionSchema } from "@ethernauta/abi"
import { generate } from "@ethernauta/abi/generator"
import { array, parse, string } from "valibot"
//#region src/execute.ts
function validate_args(args) {
if (args.length !== 4)
throw new Error(
"you must provide a valid abi and out path",
)
return {
out_dir: parse(string(), args[3]),
abi_path: parse(string(), args[1]),
}
}
async function get_descriptions(path) {
const { default: JSON_ABI } = await import(
resolve(process.cwd(), path),
{ with: { type: "json" } }
)
return parse(array(DescriptionSchema), JSON_ABI).filter(
(description) => {
return description.type === "function"
},
)
}
function pluralize(word, count) {
if (count > 1) return `${word}s`
return word
}
async function execute(_args) {
const args = validate_args(_args)
const descriptions = await get_descriptions(args.abi_path)
generate(descriptions, args.out_dir)
const count = descriptions.length
console.log(
`compiled ${count} ${pluralize("description", count)}`,
)
}
//#endregion
export { execute as t }
//# sourceMappingURL=execute-D5YzoJqc.js.map
{"version":3,"file":"execute-D5YzoJqc.js","names":[],"sources":["../src/execute.ts"],"sourcesContent":["import { resolve } from \"node:path\"\nimport {\n type Description,\n DescriptionSchema,\n} from \"@ethernauta/abi\"\nimport { generate } from \"@ethernauta/abi/generator\"\nimport { array, parse, string } from \"valibot\"\n\nfunction validate_args(args: string[]) {\n if (args.length !== 4) {\n throw new Error(\n \"you must provide a valid abi and out path\",\n )\n }\n const out_dir = parse(string(), args[3])\n const abi_path = parse(string(), args[1])\n return {\n out_dir,\n abi_path,\n }\n}\n\nasync function get_descriptions(\n path: string,\n): Promise<Description[]> {\n const absolute_path = resolve(process.cwd(), path)\n const { default: JSON_ABI } = await import(\n absolute_path,\n { with: { type: \"json\" } }\n )\n const descriptions = parse(\n array(DescriptionSchema),\n JSON_ABI,\n )\n const functions = descriptions.filter((description) => {\n return description.type === \"function\"\n })\n return functions\n}\n\nfunction pluralize(word: string, count: number) {\n if (count > 1) {\n return `${word}s`\n }\n return word\n}\n\nexport async function execute(\n _args: string[],\n): Promise<void> {\n const args = validate_args(_args)\n const descriptions = await get_descriptions(args.abi_path)\n generate(descriptions, args.out_dir)\n const count = descriptions.length\n console.log(\n `compiled ${count} ${pluralize(\"description\", count)}`,\n )\n}\n"],"mappings":";;;;;;AAQA,SAAS,cAAc,MAAgB;CACrC,IAAI,KAAK,WAAW,GAClB,MAAM,IAAI,MACR,4CACD;CAIH,OAAO;EACL,SAHc,MAAM,QAAQ,EAAE,KAAK,GAG5B;EACP,UAHe,MAAM,QAAQ,EAAE,KAAK,GAG5B;EACT;;AAGH,eAAe,iBACb,MACwB;CAExB,MAAM,EAAE,SAAS,aAAa,MAAM,OADd,QAAQ,QAAQ,KAAK,EAAE,KAE9B,EACb,EAAE,MAAM,EAAE,MAAM,QAAQ,EAAE;CAS5B,OAPqB,MACnB,MAAM,kBAAkB,EACxB,SAE4B,CAAC,QAAQ,gBAAgB;EACrD,OAAO,YAAY,SAAS;GAEd;;AAGlB,SAAS,UAAU,MAAc,OAAe;CAC9C,IAAI,QAAQ,GACV,OAAO,GAAG,KAAK;CAEjB,OAAO;;AAGT,eAAsB,QACpB,OACe;CACf,MAAM,OAAO,cAAc,MAAM;CACjC,MAAM,eAAe,MAAM,iBAAiB,KAAK,SAAS;CAC1D,SAAS,cAAc,KAAK,QAAQ;CACpC,MAAM,QAAQ,aAAa;CAC3B,QAAQ,IACN,YAAY,MAAM,GAAG,UAAU,eAAe,MAAM,GACrD"}
//#region src/execute.d.ts
declare function execute(_args: string[]): Promise<void>
//#endregion
export { execute }
//# sourceMappingURL=index-CrRXCrS2.d.ts.map
{"version":3,"file":"index-CrRXCrS2.d.ts","names":[],"sources":["../src/execute.ts"],"mappings":";iBA+CsB,OAAA,mBAEnB"}
+3
-4
#!/usr/bin/env node
import { t as execute } from "./execute-D5YzoJqc.js"
import { parseArgs } from "node:util"
import { execute } from "./execute-xr-eip-t.js"
//#region src/bin.ts
const args = parseArgs({
const command = parseArgs({
options: {

@@ -19,4 +19,3 @@ help: {

strict: false,
})
const command = args.positionals[0]
}).positionals[0]
switch (command) {

@@ -23,0 +22,0 @@ case "generate":

@@ -1,1 +0,1 @@

{"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from \"node:util\"\nimport { execute } from \"./execute\"\n\nconst args = parseArgs({\n options: {\n help: { type: \"boolean\", short: \"h\" },\n version: { type: \"boolean\", short: \"v\" },\n },\n allowPositionals: true,\n strict: false,\n})\n\nconst command = args.positionals[0]\n\nswitch (command) {\n case \"generate\":\n await execute(process.argv.slice(3))\n break\n case \"help\":\n console.log(\n `\nUsage:\n\nethernauta generate --abi SOME_ABI.abi.json --out OUT_DIR`.trim(),\n )\n break\n default:\n console.error(`Unknown command: ${command}`)\n process.exit(1)\n}\n"],"mappings":";;;;;AAIA,MAAM,OAAO,UAAU;CACrB,SAAS;EACP,MAAM;GAAE,MAAM;GAAW,OAAO;;EAChC,SAAS;GAAE,MAAM;GAAW,OAAO;;;CAErC,kBAAkB;CAClB,QAAQ;;AAGV,MAAM,UAAU,KAAK,YAAY;AAEjC,QAAQ,SAAR;CACE,KAAK;AACH,QAAM,QAAQ,QAAQ,KAAK,MAAM;AACjC;CACF,KAAK;AACH,UAAQ,IACN;;;2DAGqD;AAEvD;CACF;AACE,UAAQ,MAAM,oBAAoB;AAClC,UAAQ,KAAK"}
{"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from \"node:util\"\nimport { execute } from \"./execute\"\n\nconst args = parseArgs({\n options: {\n help: { type: \"boolean\", short: \"h\" },\n version: { type: \"boolean\", short: \"v\" },\n },\n allowPositionals: true,\n strict: false,\n})\n\nconst command = args.positionals[0]\n\nswitch (command) {\n case \"generate\":\n await execute(process.argv.slice(3))\n break\n case \"help\":\n console.log(\n `\nUsage:\n\nethernauta generate --abi SOME_ABI.abi.json --out OUT_DIR`.trim(),\n )\n break\n default:\n console.error(`Unknown command: ${command}`)\n process.exit(1)\n}\n"],"mappings":";;;;;AAaA,MAAM,UATO,UAAU;CACrB,SAAS;EACP,MAAM;GAAE,MAAM;GAAW,OAAO;GAAK;EACrC,SAAS;GAAE,MAAM;GAAW,OAAO;GAAK;EACzC;CACD,kBAAkB;CAClB,QAAQ;CACT,CAEmB,CAAC,YAAY;AAEjC,QAAQ,SAAR;CACE,KAAK;EACH,MAAM,QAAQ,QAAQ,KAAK,MAAM,EAAE,CAAC;EACpC;CACF,KAAK;EACH,QAAQ,IACN;;;2DAGqD,MAAM,CAC5D;EACD;CACF;EACE,QAAQ,MAAM,oBAAoB,UAAU;EAC5C,QAAQ,KAAK,EAAE"}

@@ -1,3 +0,3 @@

import { execute } from "./execute-xr-eip-t.js"
import { t as execute } from "./execute-D5YzoJqc.js"
export { execute }

@@ -5,3 +5,3 @@ {

"type": "module",
"version": "0.0.40",
"version": "0.0.41",
"publishConfig": {

@@ -23,3 +23,3 @@ "access": "public"

"dependencies": {
"@ethernauta/eth": "0.0.40"
"@ethernauta/eth": "0.0.41"
},

@@ -26,0 +26,0 @@ "peerDependencies": {

@@ -11,10 +11,10 @@ [![bundlejs](https://deno.bundlejs.com/badge?q=@ethernauta/eth@0.0.10&treeshake=[*])](https://deno.bundlejs.com/badge?q=@ethernauta/eth@0.0.10&treeshake=[*])

- [abi](https://github.com/niconiahi/ethernauta/blob/main/packages/abi) [NPM](https://www.npmjs.com/package/@ethernauta/abi)
- [chain](https://github.com/niconiahi/ethernauta/blob/main/packages/chain) [NPM](https://www.npmjs.com/package/@ethernauta/chain)
- [cli](https://github.com/niconiahi/ethernauta/blob/main/packages/cli) [NPM](https://www.npmjs.com/package/@ethernauta/cli)
- [erc](https://github.com/niconiahi/ethernauta/blob/main/packages/erc) [NPM](https://www.npmjs.com/package/@ethernauta/erc)
- [eth](https://github.com/niconiahi/ethernauta/blob/main/packages/eth) [NPM](https://www.npmjs.com/package/@ethernauta/eth)
- [transaction](https://github.com/niconiahi/ethernauta/blob/main/packages/transaction) [NPM](https://www.npmjs.com/package/@ethernauta/transaction)
- [utils](https://github.com/niconiahi/ethernauta/blob/main/packages/utils) [NPM](https://www.npmjs.com/package/@ethernauta/utils)
- [wallet](https://github.com/niconiahi/ethernauta/blob/main/packages/wallet) [NPM](https://www.npmjs.com/package/@ethernauta/wallet)
- [abi](https://github.com/niconiahi/ethernauta/blob/main/packages/abi) [[NPM](https://www.npmjs.com/package/@ethernauta/abi)]
- [chain](https://github.com/niconiahi/ethernauta/blob/main/packages/chain) [[NPM](https://www.npmjs.com/package/@ethernauta/chain)]
- [cli](https://github.com/niconiahi/ethernauta/blob/main/packages/cli) [[NPM](https://www.npmjs.com/package/@ethernauta/cli)]
- [erc](https://github.com/niconiahi/ethernauta/blob/main/packages/erc) [[NPM](https://www.npmjs.com/package/@ethernauta/erc)]
- [eth](https://github.com/niconiahi/ethernauta/blob/main/packages/eth) [[NPM](https://www.npmjs.com/package/@ethernauta/eth)]
- [transaction](https://github.com/niconiahi/ethernauta/blob/main/packages/transaction) [[NPM](https://www.npmjs.com/package/@ethernauta/transaction)]
- [utils](https://github.com/niconiahi/ethernauta/blob/main/packages/utils) [[NPM](https://www.npmjs.com/package/@ethernauta/utils)]
- [wallet](https://github.com/niconiahi/ethernauta/blob/main/packages/wallet)

@@ -21,0 +21,0 @@ ## Table of contents

@@ -5,4 +5,4 @@ import { resolve } from "node:path"

DescriptionSchema,
generate,
} from "@ethernauta/abi"
import { generate } from "@ethernauta/abi/generator"
import { array, parse, string } from "valibot"

@@ -9,0 +9,0 @@

#!/usr/bin/env node
export {}
import { resolve } from "node:path"
import {
DescriptionSchema,
generate,
} from "@ethernauta/abi"
import { array, parse, string } from "valibot"
//#region src/execute.ts
function validate_args(args) {
if (args.length !== 4)
throw new Error(
"you must provide a valid abi and out path",
)
const out_dir = parse(string(), args[3])
const abi_path = parse(string(), args[1])
return {
out_dir,
abi_path,
}
}
async function get_descriptions(path) {
const absolute_path = resolve(process.cwd(), path)
const { default: JSON_ABI } = await import(
absolute_path,
{ with: { type: "json" } }
)
const descriptions = parse(
array(DescriptionSchema),
JSON_ABI,
)
const functions = descriptions.filter((description) => {
return description.type === "function"
})
return functions
}
function pluralize(word, count) {
if (count > 1) return `${word}s`
return word
}
async function execute(_args) {
const args = validate_args(_args)
const descriptions = await get_descriptions(args.abi_path)
generate(descriptions, args.out_dir)
const count = descriptions.length
console.log(
`compiled ${count} ${pluralize("description", count)}`,
)
}
//#endregion
export { execute }
//# sourceMappingURL=execute-xr-eip-t.js.map
{"version":3,"file":"execute-xr-eip-t.js","names":[],"sources":["../src/execute.ts"],"sourcesContent":["import { resolve } from \"node:path\"\nimport {\n type Description,\n DescriptionSchema,\n generate,\n} from \"@ethernauta/abi\"\nimport { array, parse, string } from \"valibot\"\n\nfunction validate_args(args: string[]) {\n if (args.length !== 4) {\n throw new Error(\n \"you must provide a valid abi and out path\",\n )\n }\n const out_dir = parse(string(), args[3])\n const abi_path = parse(string(), args[1])\n return {\n out_dir,\n abi_path,\n }\n}\n\nasync function get_descriptions(\n path: string,\n): Promise<Description[]> {\n const absolute_path = resolve(process.cwd(), path)\n const { default: JSON_ABI } = await import(\n absolute_path,\n { with: { type: \"json\" } }\n )\n const descriptions = parse(\n array(DescriptionSchema),\n JSON_ABI,\n )\n const functions = descriptions.filter((description) => {\n return description.type === \"function\"\n })\n return functions\n}\n\nfunction pluralize(word: string, count: number) {\n if (count > 1) {\n return `${word}s`\n }\n return word\n}\n\nexport async function execute(\n _args: string[],\n): Promise<void> {\n const args = validate_args(_args)\n const descriptions = await get_descriptions(args.abi_path)\n generate(descriptions, args.out_dir)\n const count = descriptions.length\n console.log(\n `compiled ${count} ${pluralize(\"description\", count)}`,\n )\n}\n"],"mappings":";;;;;AAQA,SAAS,cAAc,MAAgB;AACrC,KAAI,KAAK,WAAW,EAClB,OAAM,IAAI,MACR;CAGJ,MAAM,UAAU,MAAM,UAAU,KAAK;CACrC,MAAM,WAAW,MAAM,UAAU,KAAK;AACtC,QAAO;EACL;EACA;;;AAIJ,eAAe,iBACb,MACwB;CACxB,MAAM,gBAAgB,QAAQ,QAAQ,OAAO;CAC7C,MAAM,EAAE,SAAS,aAAa,MAAM,OAClC,eACA,EAAE,MAAM,EAAE,MAAM;CAElB,MAAM,eAAe,MACnB,MAAM,oBACN;CAEF,MAAM,YAAY,aAAa,QAAQ,gBAAgB;AACrD,SAAO,YAAY,SAAS;;AAE9B,QAAO;;AAGT,SAAS,UAAU,MAAc,OAAe;AAC9C,KAAI,QAAQ,EACV,QAAO,GAAG,KAAK;AAEjB,QAAO;;AAGT,eAAsB,QACpB,OACe;CACf,MAAM,OAAO,cAAc;CAC3B,MAAM,eAAe,MAAM,iBAAiB,KAAK;AACjD,UAAS,cAAc,KAAK;CAC5B,MAAM,QAAQ,aAAa;AAC3B,SAAQ,IACN,YAAY,MAAM,GAAG,UAAU,eAAe"}
//#region src/execute.d.ts
declare function execute(_args: string[]): Promise<void>
//#endregion
export { execute }
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/execute.ts"],"sourcesContent":[],"mappings":";iBA+CsB,OAAA,mBAEnB"}