From 6feed8db1ec80247de8ee693f4380a266623c681 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 28 Nov 2023 15:57:12 +0000 Subject: [PATCH 1/6] Selective publish --- .gitignore | 3 +- examples/plugins/package.json | 1 + examples/psp22/package.json | 1 + examples/psp34/package.json | 41 ++++++++++++------------ examples/psp34_enumerable/package.json | 41 ++++++++++++------------ package.json | 4 +-- packages/typechain-compiler/package.json | 4 ++- 7 files changed, 51 insertions(+), 44 deletions(-) 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/examples/plugins/package.json b/examples/plugins/package.json index d985b965..44f6d91b 100644 --- a/examples/plugins/package.json +++ b/examples/plugins/package.json @@ -1,6 +1,7 @@ { "name": "plugins-typechain-example", "version": "1.0.0", + "private": true, "description": "", "main": "index.js", "scripts": { diff --git a/examples/psp22/package.json b/examples/psp22/package.json index fbfc4cbf..5ad6533e 100644 --- a/examples/psp22/package.json +++ b/examples/psp22/package.json @@ -1,6 +1,7 @@ { "name": "psp22", "version": "1.0.0", + "private": true, "description": "", "main": "index.js", "scripts": { diff --git a/examples/psp34/package.json b/examples/psp34/package.json index 78565273..13ed4de6 100644 --- a/examples/psp34/package.json +++ b/examples/psp34/package.json @@ -1,22 +1,23 @@ { - "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", + "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..da40b7b7 100644 --- a/examples/psp34_enumerable/package.json +++ b/examples/psp34_enumerable/package.json @@ -1,22 +1,23 @@ { - "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", + "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..4bcc5939 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "scripts": { "start-typechain": "npx @prosopo/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", + "publish:dry-run": "npm -w @prosopo/typechain-polkadot -w @prosopo/typechain-polkadot-parser -w @prosopo/typechain-types -w @prosopo/typechain-compiler publish --dry-run", + "publish": "npm -w @prosopo/typechain-polkadot -w @prosopo/typechain-polkadot-parser -w @prosopo/typechain-types -w @prosopo/typechain-compiler publish --access=public", "gen-test-ts": "npx @prosopo/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", 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" From 68db54913ea0c34f24ff9ed9ff64bee02c16d5ae Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 28 Nov 2023 15:58:09 +0000 Subject: [PATCH 2/6] Run pkg fix --- packages/typechain-polkadot/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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", From 6dbf825f756a59cc67b58361e4a8658fcbd162c9 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 28 Nov 2023 16:02:00 +0000 Subject: [PATCH 3/6] Set publishConfig --- examples/plugins/package.json | 3 +++ examples/psp22/package.json | 3 +++ examples/psp34/package.json | 3 +++ examples/psp34_enumerable/package.json | 3 +++ package.json | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/plugins/package.json b/examples/plugins/package.json index 44f6d91b..0e78d3a9 100644 --- a/examples/plugins/package.json +++ b/examples/plugins/package.json @@ -1,6 +1,9 @@ { "name": "plugins-typechain-example", "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, "private": true, "description": "", "main": "index.js", diff --git a/examples/psp22/package.json b/examples/psp22/package.json index 5ad6533e..eb7e77cd 100644 --- a/examples/psp22/package.json +++ b/examples/psp22/package.json @@ -1,6 +1,9 @@ { "name": "psp22", "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, "private": true, "description": "", "main": "index.js", diff --git a/examples/psp34/package.json b/examples/psp34/package.json index 13ed4de6..3fc1ff0e 100644 --- a/examples/psp34/package.json +++ b/examples/psp34/package.json @@ -1,6 +1,9 @@ { "name": "psp34", "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, "private": true, "description": "", "main": "index.js", diff --git a/examples/psp34_enumerable/package.json b/examples/psp34_enumerable/package.json index da40b7b7..3efdd089 100644 --- a/examples/psp34_enumerable/package.json +++ b/examples/psp34_enumerable/package.json @@ -1,6 +1,9 @@ { "name": "psp34_enumerable", "version": "1.0.0", + "publishConfig": { + "access": "restricted" + }, "private": true, "description": "", "main": "index.js", diff --git a/package.json b/package.json index 4bcc5939..efe76a50 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "scripts": { "start-typechain": "npx @prosopo/typechain-polkadot --in ./artifacts --out ./out", "build:all": "npm run --workspaces --if-present build", - "publish:dry-run": "npm -w @prosopo/typechain-polkadot -w @prosopo/typechain-polkadot-parser -w @prosopo/typechain-types -w @prosopo/typechain-compiler publish --dry-run", + "publish:dry-run": "npm --workspaces publish --dry-run", "publish": "npm -w @prosopo/typechain-polkadot -w @prosopo/typechain-polkadot-parser -w @prosopo/typechain-types -w @prosopo/typechain-compiler publish --access=public", "gen-test-ts": "npx @prosopo/typechain-polkadot --in tests/artifacts --out tests/generated", "only-test": "npx jest --no-cache --maxWorkers 1", From 942ee372983357ff1c98312233a31ccf01607206 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 28 Nov 2023 16:02:17 +0000 Subject: [PATCH 4/6] revert to workspaces command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index efe76a50..4660acbc 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "start-typechain": "npx @prosopo/typechain-polkadot --in ./artifacts --out ./out", "build:all": "npm run --workspaces --if-present build", "publish:dry-run": "npm --workspaces publish --dry-run", - "publish": "npm -w @prosopo/typechain-polkadot -w @prosopo/typechain-polkadot-parser -w @prosopo/typechain-types -w @prosopo/typechain-compiler publish --access=public", + "publish": "npm --workspaces publish --access=public", "gen-test-ts": "npx @prosopo/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", From fc4a4bdb9c1273d962e96b09d2443cd6f13b6201 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 28 Nov 2023 16:06:47 +0000 Subject: [PATCH 5/6] Update README with new bin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)): From 2948bf59d130fabc7c03f65fa2590d7a8ac74773 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 28 Nov 2023 16:21:28 +0000 Subject: [PATCH 6/6] Fix bin commands --- docs/about.md | 4 ++-- examples/README.md | 2 +- examples/plugins/package.json | 2 +- package.json | 4 ++-- packages/typechain-compiler/README.md | 2 +- packages/typechain-compiler/index.ts | 2 +- packages/typechain-polkadot/README.md | 4 ++-- packages/typechain-polkadot/index.ts | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) 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 0e78d3a9..5a2a8c2c 100644 --- a/examples/plugins/package.json +++ b/examples/plugins/package.json @@ -9,7 +9,7 @@ "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/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-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