diff --git a/.gitignore b/.gitignore index 4aba9fa3..9c494b77 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ node_modules /dist lerna-debug.log -/wip \ No newline at end of file +/wip +chain-data \ No newline at end of file diff --git a/README.md b/README.md index 34176baa..aea10e65 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ npm i @prosopo/typechain-polkadot Pass the folder with artifacts(in the example it is `artifacts`) as input argument and the output folder(in the example it is `typed_contracts`): ```bash -npx @prosopo/typechain-polkadot --in artifacts --out typed_contracts +npx typechain-polkadot --in artifacts --out typed_contracts ``` Import the contract what you want to use(in the example it is [`my_psp22`](https://github.com/727-Ventures/openbrush-contracts/tree/main/examples/psp22)): diff --git a/docs/about.md b/docs/about.md index b0df88fc..357eb0f0 100644 --- a/docs/about.md +++ b/docs/about.md @@ -166,7 +166,7 @@ And install it with `npm install`. 7) Now, let's run `typechain-compiler`: ```bash -$ npx @prosopo/typechain-compiler --config typechain.config.json +$ npx typechain-compiler --config typechain.config.json ``` 8) And now, you can use generated code in your project. For example, you can create a file `index.ts`: @@ -406,7 +406,7 @@ $ cp ./contracts/psp22/target/ink/metadata.json artifacts/psp22.json 5) Let's run `typechain-polkadot`: ```bash -$ npx @prosopo/typechain-polkadot --in ./artifacts --out ./typechain-generated +$ npx typechain-polkadot --in ./artifacts --out ./typechain-generated ``` Wow! We've just generated code for our contracts using typechain directly! 🎉 diff --git a/examples/README.md b/examples/README.md index 7e5e2cc3..31366d7d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -20,7 +20,7 @@ This directory contains examples of parsed contracts and pieces of advice how to ``` - Run typechain with ```bash -npx @prosopo/typechain-polkadot --in path/to/artifacts --out path/to/output +npx typechain-polkadot --in path/to/artifacts --out path/to/output ``` > Note: you should move metadata.json to artifacts directory and rename it to .json, also if you want to deploy the contract you should also move .contract to artifacts directory from your target dir diff --git a/examples/plugins/package.json b/examples/plugins/package.json index d985b965..5a2a8c2c 100644 --- a/examples/plugins/package.json +++ b/examples/plugins/package.json @@ -1,11 +1,15 @@ { "name": "plugins-typechain-example", "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, + "private": true, "description": "", "main": "index.js", "scripts": { "generate": "echo No generate script", - "start": "npx @prosopo/typechain-polkadot --plugins ./plugins --input ./artifacts --output ./output" + "start": "npx typechain-polkadot --plugins ./plugins --input ./artifacts --output ./output" }, "dependencies": { "@prosopo/typechain-polkadot": "1.1.13", diff --git a/examples/psp22/package.json b/examples/psp22/package.json index fbfc4cbf..eb7e77cd 100644 --- a/examples/psp22/package.json +++ b/examples/psp22/package.json @@ -1,6 +1,10 @@ { "name": "psp22", "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, + "private": true, "description": "", "main": "index.js", "scripts": { diff --git a/examples/psp34/package.json b/examples/psp34/package.json index 78565273..3fc1ff0e 100644 --- a/examples/psp34/package.json +++ b/examples/psp34/package.json @@ -1,22 +1,26 @@ { - "name": "psp34", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "generate": "npx typechain-polkadot --in ./artifacts --out ./out", - "start": "ts-node index.ts" - }, - "dependencies": { - "@prosopo/typechain-polkadot": "1.1.13", - "@prosopo/typechain-types": "1.1.13", - "@types/node": "^18.8.0", - "ts-node": "^10.7.0", - "typescript": "^5.2.2", - "@polkadot/api": "10.11.1", - "@polkadot/api-contract": "10.11.1", - "@types/bn.js": "^5.1.1" - }, - "author": "Supercolony-net", - "license": "ISC" + "name": "psp34", + "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, + "private": true, + "description": "", + "main": "index.js", + "scripts": { + "generate": "npx typechain-polkadot --in ./artifacts --out ./out", + "start": "ts-node index.ts" + }, + "dependencies": { + "@prosopo/typechain-polkadot": "1.1.13", + "@prosopo/typechain-types": "1.1.13", + "@types/node": "^18.8.0", + "ts-node": "^10.7.0", + "typescript": "^5.2.2", + "@polkadot/api": "10.11.1", + "@polkadot/api-contract": "10.11.1", + "@types/bn.js": "^5.1.1" + }, + "author": "Supercolony-net", + "license": "ISC" } diff --git a/examples/psp34_enumerable/package.json b/examples/psp34_enumerable/package.json index 5ace36ec..3efdd089 100644 --- a/examples/psp34_enumerable/package.json +++ b/examples/psp34_enumerable/package.json @@ -1,22 +1,26 @@ { - "name": "psp34_enumerable", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "generate": "npx typechain-polkadot --in ./artifacts --out ./out", - "start": "ts-node index.ts" - }, - "dependencies": { - "@prosopo/typechain-polkadot": "1.1.13", - "@prosopo/typechain-types": "1.1.13", - "@types/node": "^18.8.0", - "ts-node": "^10.7.0", - "typescript": "^5.2.2", - "@polkadot/api": "10.11.1", - "@polkadot/api-contract": "10.11.1", - "@types/bn.js": "^5.1.0" - }, - "author": "Supercolony-net", - "license": "ISC" + "name": "psp34_enumerable", + "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, + "private": true, + "description": "", + "main": "index.js", + "scripts": { + "generate": "npx typechain-polkadot --in ./artifacts --out ./out", + "start": "ts-node index.ts" + }, + "dependencies": { + "@prosopo/typechain-polkadot": "1.1.13", + "@prosopo/typechain-types": "1.1.13", + "@types/node": "^18.8.0", + "ts-node": "^10.7.0", + "typescript": "^5.2.2", + "@polkadot/api": "10.11.1", + "@polkadot/api-contract": "10.11.1", + "@types/bn.js": "^5.1.0" + }, + "author": "Supercolony-net", + "license": "ISC" } diff --git a/package.json b/package.json index 4660acbc..3c20eea4 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ ], "private": true, "scripts": { - "start-typechain": "npx @prosopo/typechain-polkadot --in ./artifacts --out ./out", + "start-typechain": "npx typechain-polkadot --in ./artifacts --out ./out", "build:all": "npm run --workspaces --if-present build", "publish:dry-run": "npm --workspaces publish --dry-run", "publish": "npm --workspaces publish --access=public", - "gen-test-ts": "npx @prosopo/typechain-polkadot --in tests/artifacts --out tests/generated", + "gen-test-ts": "npx typechain-polkadot --in tests/artifacts --out tests/generated", "only-test": "npx jest --no-cache --maxWorkers 1", "test": "npm run gen-test-ts && npm run only-test", "lint": "eslint \"{packages, examples}/**/*.ts\"", diff --git a/packages/typechain-compiler/README.md b/packages/typechain-compiler/README.md index a5341fdd..f7b7bff4 100644 --- a/packages/typechain-compiler/README.md +++ b/packages/typechain-compiler/README.md @@ -37,7 +37,7 @@ Also you can override the config value via CLI arguments. To compile your project, and generate TS definitions & runtime code for it, run the following command: ```bash -npx @prosopo/typechain-compiler --config path/to/config.json +npx typechain-compiler --config path/to/config.json ``` Also you can provide additional arguments to the compiler: diff --git a/packages/typechain-compiler/index.ts b/packages/typechain-compiler/index.ts index 208e6400..b4a10597 100644 --- a/packages/typechain-compiler/index.ts +++ b/packages/typechain-compiler/index.ts @@ -13,7 +13,7 @@ function Typechain( input: string, output: string ) { - execSync(`npx @prosopo/typechain-polkadot --in ${input} --out ${output}`); + execSync(`npx typechain-polkadot --in ${input} --out ${output}`); } function main() { diff --git a/packages/typechain-compiler/package.json b/packages/typechain-compiler/package.json index 94548df6..5e4c8ad8 100644 --- a/packages/typechain-compiler/package.json +++ b/packages/typechain-compiler/package.json @@ -5,7 +5,9 @@ "access": "public" }, "description": "Util to test and compile your rust project", - "bin": "bin/index.js", + "bin": { + "typechain-compiler": "bin/index.js" + }, "scripts": { "build": "npx tsc", "start": "ts-node ./index.ts --config config.json" diff --git a/packages/typechain-polkadot/README.md b/packages/typechain-polkadot/README.md index b7ac717d..85243419 100644 --- a/packages/typechain-polkadot/README.md +++ b/packages/typechain-polkadot/README.md @@ -28,7 +28,7 @@ Typechain can be used in two ways: After installing the package, you can use it as a CLI tool. To use it, run the following command: ```bash -npx @prosopo/typechain-polkadot --input path/to/abis --output path/to/output +npx typechain-polkadot --input path/to/abis --output path/to/output ``` ## Methods and namespaces used in the typechain, and their description @@ -244,7 +244,7 @@ typechain.loadPlugins(new MyPlugin()); Or you can load them via cli: ```bash -npx @prosopo/typechain-polkadot --input path/to/abis --output path/to/output --plugins ./plugins-directory +npx typechain-polkadot --input path/to/abis --output path/to/output --plugins ./plugins-directory ``` > Note: if you're using the cli, every plugin should end with `.plugin.ts` and have default export of the plugin itself. diff --git a/packages/typechain-polkadot/index.ts b/packages/typechain-polkadot/index.ts index c90a6f18..05275d06 100644 --- a/packages/typechain-polkadot/index.ts +++ b/packages/typechain-polkadot/index.ts @@ -34,7 +34,7 @@ * # Usage from CLI * ```bash * $ npm i @prosopo/typechain-polkadot - * $ npx @prosopo/typechain-polkadot --in path/to/abis --out path/to/output/folder + * $ npx typechain-polkadot --in path/to/abis --out path/to/output/folder * ``` * * @packageDocumentation diff --git a/packages/typechain-polkadot/package.json b/packages/typechain-polkadot/package.json index e9db4bb5..54448ab5 100644 --- a/packages/typechain-polkadot/package.json +++ b/packages/typechain-polkadot/package.json @@ -10,7 +10,9 @@ "lint": "eslint \"{src,tests}/**/*.{js,jsx,ts,tsx}\"", "lint:fix": "eslint --fix \"{src,tests}/**/*.{js,jsx,ts,tsx}\"" }, - "bin": "bin/index.js", + "bin": { + "typechain-polkadot": "bin/index.js" + }, "files": [ "index.ts", "src",