{"_id":"@dpowxconsensus/typechain-polkadot","_rev":"6-a214821424e457dda85cb42e957409d4","time":{"created":"2024-05-15T22:16:15.072Z","1.2.1":"2024-05-15T22:12:15.913Z","modified":"2024-05-17T10:18:00.960Z","1.2.2":"2024-05-15T22:16:15.400Z","1.2.4":"2024-05-15T22:49:36.366Z","1.2.5":"2024-05-17T10:11:48.462Z","1.2.6":"2024-05-17T10:18:00.755Z"},"name":"@dpowxconsensus/typechain-polkadot","dist-tags":{"latest":"1.2.6"},"versions":{"1.2.2":{"name":"@dpowxconsensus/typechain-polkadot","version":"1.2.2","scripts":{"start":"ts-node index.ts --in artifacts --out out","lint":"eslint \"{src,tests}/**/*.{js,jsx,ts,tsx}\"","lint:fix":"eslint --fix \"{src,tests}/**/*.{js,jsx,ts,tsx}\""},"bin":{"typechain-polkadot":"bin/index.js"},"engines":{"node":">=16.0.0","npm":">=7.0.0"},"engineStrict":true,"dependencies":{"@727-ventures/typechain-polkadot-parser":"1.0.2","@polkadot/api":"^10.12.1","@polkadot/api-contract":"^10.12.1","@polkadot/keyring":"^12.2.2","@types/fs-extra":"^9.0.13","@types/node":"^18.11.18","@types/yargs":"^17.0.10","camelcase":"^6.3.0","eslint":"^8.18.0","fs-extra":"^9.1.0","handlebars":"^4.7.7","prettier":"^2.7.1","ts-node":"^10.7.0","yargs":"^17.5.1"},"devDependencies":{"@727-ventures/typechain-types":"^1.1.0","@types/bn.js":"^5.1.0","@types/eslint":"^8.4.3","@types/jest":"^27.5.2","@typescript-eslint/eslint-plugin":"^5.25.0","@typescript-eslint/parser":"^5.25.0","eslint-import-resolver-typescript":"^2.7.1","eslint-plugin-import":"^2.26.0","eslint-plugin-node":"^11.1.0","hjson":"^3.2.2","ts-jest":"^28.0.3","typescript":"^4.7.4"},"author":{"name":"Brushfam"},"homepage":"https://github.com/dpowxconsensus/typechain-polkadot#readme","repository":{"type":"git","url":"git+https://github.com/dpowxconsensus/typechain-polkadot.git"},"bugs":{"url":"https://github.com/dpowxconsensus/typechain-polkadot/issues"},"gitHead":"fe4c3cbc02a1c7f85a0e1fa390bb74b3cb9d6867","description":"---","licenseText":"// Copyright (c) 2012-2022 Supercolony\n//\n// Permission is hereby granted, free of charge, to any person obtaining\n// a copy of this software and associated documentation files (the\"Software\"),\n// to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to\n// the following conditions:\n//\n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","license":"MIT","_id":"@dpowxconsensus/typechain-polkadot@1.2.2","dist":{"shasum":"0ec245181adffe4c5680e00182ee5d195d324a42","integrity":"sha512-g+klxdAIFKGXgYksCRhv04j3D9mAh71SGPuyfcibKPDxGjfroKbbOmIRAxWkHcvgFFLvD4d09IFgOFZeEBudzw==","tarball":"https://registry.npmjs.org/@dpowxconsensus/typechain-polkadot/-/typechain-polkadot-1.2.2.tgz","fileCount":50,"unpackedSize":86055,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHE3LzRXxmOCsB/CCvFzBRvhOw06izwa1tcQIZvrkMPWAiEAnDM+UNbQmFpdyKPzkqYOHyHxacOIvjqinnba4SqsfSw="}]},"_npmUser":{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"},"directories":{},"maintainers":[{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typechain-polkadot_1.2.2_1715811375193_0.7550593093022095"},"_hasShrinkwrap":false},"1.2.4":{"name":"@dpowxconsensus/typechain-polkadot","version":"1.2.4","scripts":{"start":"ts-node index.ts --in artifacts --out out","lint":"eslint \"{src,tests}/**/*.{js,jsx,ts,tsx}\"","lint:fix":"eslint --fix \"{src,tests}/**/*.{js,jsx,ts,tsx}\""},"bin":{"typechain-polkadot":"bin/index.js"},"engines":{"node":">=16.0.0","npm":">=7.0.0"},"engineStrict":true,"dependencies":{"@dpowxconsensus/typechain-polkadot-parser":"1.2.4","@polkadot/api":"^10.12.1","@polkadot/api-contract":"^10.12.1","@polkadot/keyring":"^12.2.2","@types/fs-extra":"^9.0.13","@types/node":"^18.11.18","@types/yargs":"^17.0.10","camelcase":"^6.3.0","eslint":"^8.18.0","fs-extra":"^9.1.0","handlebars":"^4.7.7","prettier":"^2.7.1","ts-node":"^10.7.0","yargs":"^17.5.1"},"devDependencies":{"@dpowxconsensus/typechain-types":"^1.2.4","@types/bn.js":"^5.1.0","@types/eslint":"^8.4.3","@types/jest":"^27.5.2","@typescript-eslint/eslint-plugin":"^5.25.0","@typescript-eslint/parser":"^5.25.0","eslint-import-resolver-typescript":"^2.7.1","eslint-plugin-import":"^2.26.0","eslint-plugin-node":"^11.1.0","hjson":"^3.2.2","ts-jest":"^28.0.3","typescript":"^4.7.4"},"author":{"name":"Brushfam"},"homepage":"https://github.com/dpowxconsensus/typechain-polkadot#readme","repository":{"type":"git","url":"git+https://github.com/dpowxconsensus/typechain-polkadot.git"},"bugs":{"url":"https://github.com/dpowxconsensus/typechain-polkadot/issues"},"gitHead":"fe4c3cbc02a1c7f85a0e1fa390bb74b3cb9d6867","description":"---","licenseText":"// Copyright (c) 2012-2022 Supercolony\n//\n// Permission is hereby granted, free of charge, to any person obtaining\n// a copy of this software and associated documentation files (the\"Software\"),\n// to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to\n// the following conditions:\n//\n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","license":"MIT","_id":"@dpowxconsensus/typechain-polkadot@1.2.4","dist":{"shasum":"60d80dc2dd599dd556109876dfacda7186a430a2","integrity":"sha512-EC6lEECpPLh4eQjLbebtnsiIRKQ0yYCjxcVSZhMzF6EcPDG+w55yZZKZipV6pU+sSbHteRnATXsJl0qxPBnOWw==","tarball":"https://registry.npmjs.org/@dpowxconsensus/typechain-polkadot/-/typechain-polkadot-1.2.4.tgz","fileCount":50,"unpackedSize":86845,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9QWyPX/QPBa4VraLFrHOG/LsO6GUdQGMRr4Rq7lpDIgIgHVKeS5Ra7TYQU20ROYpjyMqVQoKDYrXJORrNnhvYCpM="}]},"_npmUser":{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"},"directories":{},"maintainers":[{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typechain-polkadot_1.2.4_1715813376211_0.07741818028854741"},"_hasShrinkwrap":false},"1.2.5":{"name":"@dpowxconsensus/typechain-polkadot","version":"1.2.5","scripts":{"start":"ts-node index.ts --in artifacts --out out","lint":"eslint \"{src,tests}/**/*.{js,jsx,ts,tsx}\"","lint:fix":"eslint --fix \"{src,tests}/**/*.{js,jsx,ts,tsx}\""},"bin":{"typechain-polkadot":"bin/index.js"},"engines":{"node":">=16.0.0","npm":">=7.0.0"},"engineStrict":true,"dependencies":{"@dpowxconsensus/typechain-polkadot-parser":"1.2.5","@polkadot/api":"^10.12.1","@polkadot/api-contract":"^10.12.1","@polkadot/keyring":"^12.2.2","@types/fs-extra":"^9.0.13","@types/node":"^18.11.18","@types/yargs":"^17.0.10","camelcase":"^6.3.0","eslint":"^8.18.0","fs-extra":"^9.1.0","handlebars":"^4.7.7","prettier":"^2.7.1","ts-node":"^10.7.0","yargs":"^17.5.1"},"devDependencies":{"@dpowxconsensus/typechain-types":"^1.2.4","@types/bn.js":"^5.1.0","@types/eslint":"^8.4.3","@types/jest":"^27.5.2","@typescript-eslint/eslint-plugin":"^5.25.0","@typescript-eslint/parser":"^5.25.0","eslint-import-resolver-typescript":"^2.7.1","eslint-plugin-import":"^2.26.0","eslint-plugin-node":"^11.1.0","hjson":"^3.2.2","ts-jest":"^28.0.3","typescript":"^4.7.4"},"author":{"name":"Brushfam"},"homepage":"https://github.com/dpowxconsensus/typechain-polkadot#readme","repository":{"type":"git","url":"git+https://github.com/dpowxconsensus/typechain-polkadot.git"},"bugs":{"url":"https://github.com/dpowxconsensus/typechain-polkadot/issues"},"gitHead":"fe4c3cbc02a1c7f85a0e1fa390bb74b3cb9d6867","description":"---","licenseText":"// Copyright (c) 2012-2022 Supercolony\n//\n// Permission is hereby granted, free of charge, to any person obtaining\n// a copy of this software and associated documentation files (the\"Software\"),\n// to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to\n// the following conditions:\n//\n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","license":"MIT","_id":"@dpowxconsensus/typechain-polkadot@1.2.5","dist":{"shasum":"c7c1c9ca1c6269da17686f03f30b199c73139e74","integrity":"sha512-bePCbePGfq2cV7Wm7ildFd0eydiZJzqpMqDmjmnKXjvVdTLpC++UG0B3bui2AJDIC0exgSnPytsNFtN0cFbBcQ==","tarball":"https://registry.npmjs.org/@dpowxconsensus/typechain-polkadot/-/typechain-polkadot-1.2.5.tgz","fileCount":50,"unpackedSize":86960,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyNFm4nEoDVR57kcZbipyd5JmfOn0sGSdH71LC4GaTTgIgW3zig5mX3XDq/A6JNMU9snN5VVXTOcs4Gu90xYTZbKA="}]},"_npmUser":{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"},"directories":{},"maintainers":[{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typechain-polkadot_1.2.5_1715940708283_0.9176996642552266"},"_hasShrinkwrap":false},"1.2.6":{"name":"@dpowxconsensus/typechain-polkadot","version":"1.2.6","scripts":{"start":"ts-node index.ts --in artifacts --out out","lint":"eslint \"{src,tests}/**/*.{js,jsx,ts,tsx}\"","lint:fix":"eslint --fix \"{src,tests}/**/*.{js,jsx,ts,tsx}\""},"bin":{"typechain-polkadot":"bin/index.js"},"engines":{"node":">=16.0.0","npm":">=7.0.0"},"engineStrict":true,"dependencies":{"@dpowxconsensus/typechain-polkadot-parser":"1.2.6","@polkadot/api":"^10.12.1","@polkadot/api-contract":"^10.12.1","@polkadot/keyring":"^12.2.2","@types/fs-extra":"^9.0.13","@types/node":"^18.11.18","@types/yargs":"^17.0.10","camelcase":"^6.3.0","eslint":"^8.18.0","fs-extra":"^9.1.0","handlebars":"^4.7.7","prettier":"^2.7.1","ts-node":"^10.7.0","yargs":"^17.5.1"},"devDependencies":{"@dpowxconsensus/typechain-types":"^1.2.4","@types/bn.js":"^5.1.0","@types/eslint":"^8.4.3","@types/jest":"^27.5.2","@typescript-eslint/eslint-plugin":"^5.25.0","@typescript-eslint/parser":"^5.25.0","eslint-import-resolver-typescript":"^2.7.1","eslint-plugin-import":"^2.26.0","eslint-plugin-node":"^11.1.0","hjson":"^3.2.2","ts-jest":"^28.0.3","typescript":"^4.7.4"},"author":{"name":"Brushfam"},"homepage":"https://github.com/dpowxconsensus/typechain-polkadot#readme","repository":{"type":"git","url":"git+https://github.com/dpowxconsensus/typechain-polkadot.git"},"bugs":{"url":"https://github.com/dpowxconsensus/typechain-polkadot/issues"},"gitHead":"fe4c3cbc02a1c7f85a0e1fa390bb74b3cb9d6867","description":"---","licenseText":"// Copyright (c) 2012-2022 Supercolony\n//\n// Permission is hereby granted, free of charge, to any person obtaining\n// a copy of this software and associated documentation files (the\"Software\"),\n// to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to\n// the following conditions:\n//\n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","license":"MIT","_id":"@dpowxconsensus/typechain-polkadot@1.2.6","dist":{"shasum":"cfb4e6efbb5500111e9fe657c5397133b6d54c3b","integrity":"sha512-P2wj9qaPs9oSNkISFeByXcsRqDCN7uFHw8AuNgXD2/L1VQzO725SdjQJqP3vJpdpJRbqwfHY8E01VvQBsQQLlg==","tarball":"https://registry.npmjs.org/@dpowxconsensus/typechain-polkadot/-/typechain-polkadot-1.2.6.tgz","fileCount":50,"unpackedSize":86960,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBrS6JyttfMISIjRsZS4uSWMMB5Tx5wsLw/6HFaiI2HzAiB1YoDBIBA0rxqlrMWqaPbXZvbKz6Z+1sw8ZdSrxd08xg=="}]},"_npmUser":{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"},"directories":{},"maintainers":[{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typechain-polkadot_1.2.6_1715941080623_0.022427237411100975"},"_hasShrinkwrap":false}},"maintainers":[{"name":"dpowxconsensus","email":"priyanshu@routerprotocol.com"}],"description":"---","homepage":"https://github.com/dpowxconsensus/typechain-polkadot#readme","repository":{"type":"git","url":"git+https://github.com/dpowxconsensus/typechain-polkadot.git"},"author":{"name":"Brushfam"},"bugs":{"url":"https://github.com/dpowxconsensus/typechain-polkadot/issues"},"license":"MIT","readme":"# Typechain-polkadot\n\n---\n\nPackage for generating TypeScript definitions & runtime code for Polkadot smart contracts.\n\n---\n\n## Usage\n\nIn your project install this package:\n\n```bash\nnpm i -D @dpowxconsensus/typechain-polkadot\n```\n\nNow you can use it to generate TS definitions & runtime code for Polkadot smart contracts. To use typechain-polkadot.\n\n> Note, that ink! contracts generate two files: `metadata.json` and `<contract-name>.contract`. You need to provide both of them to typechain-polkadot, and rename `metadata.json` to `<contract-name>.json`.\n\nTypechain can be used in two ways:\n\n- As a CLI tool\n- As a library\n\n### CLI tool\n\nAfter installing the package, you can use it as a CLI tool. To use it, run the following command:\n\n```bash\nnpx @dpowxconsensus/typechain-polkadot --input path/to/abis --output path/to/output\n```\n\n## Methods and namespaces used in the typechain, and their description\n\n### build-extrinsic\n\nIn this namespace you can find all the functions that are related to building extrinsics.\n\n```typescript\nconst tx = contract.buildExtrinsic.<methodName>(...args, options);\n\ntx.signAndSend(account, (result) => {\n\t// Handle result\n});\n```\n\n### constructors\nUsed to deploy contracts, using different constructors.\n\nLet's deploy the following contract:\n```rust\n#![cfg_attr(not(feature = \"std\"), no_std)]\n#![feature(min_specialization)]\n\n#[openbrush::contract]\npub mod my_psp22 {\n\n    // imports from openbrush\n\tuse openbrush::contracts::psp22::*;\n\tuse openbrush::traits::Storage;\n\n    #[ink(storage)]\n    #[derive(Default, Storage)]\n    pub struct Contract {\n    \t#[storage_field]\n\t\tpsp22: psp22::Data,\n    }\n\n    // Section contains default implementation without any modifications\n\timpl PSP22 for Contract {}\n\n    impl Contract {\n        #[ink(constructor)]\n        pub fn new(initial_supply: Balance) -> Self {\n            let mut _instance = Self::default();\n\t\t\t_instance._mint_to(_instance.env().caller(), initial_supply).expect(\"Should mint\");\n\t\t\t_instance\n        }\n    }\n}\n```\nThis contract has a constructor `new` with one argument `initial_supply`.\nTo deploy this contract, you need to use the following code:\n```typescript\n// Import here Constructors and Contract classes\n\n// Here we are creating an instance of the Constructors class, which is used to deploy contracts,\n// Constructors is typechain-generated class that contains all the constructors of the contract\nconst factory = new Constructors(api, UserAlice);\n\n// You can access to the different constructors using the name of the constructor, here we will use \"new\"\nconst {result, address} = await factory.new('10', {});\n\n// Here we are creating an instance of the Contract class, which is used to interact with the deployed contract\ncontract = new Contract(address, UserAlice, api);\n```\n\n### contract\n\nContract is the main namespace for interacting with contracts. It contains all the functions that are related to contracts.\n\n```typescript\nconst contract = new Contract(\n\t\taddress,\n\t\tsigner,\n\t\tnativeAPI,\n)\n\ncontract.name() // get the name of the contract\n\ncontract.address() // get the address of the contract\n\ncontract.abi() // get the abi of the contract\n\ncontract.<namespace>.<functionName>(...args, options) // call a function from a namespace\n// namespace can be tx, query, events, etc.\n\ncontract.withSigner(signer)\n// change the signer of the contract in the current context,\n// basically it will create a new contract with the new signer\n\ncontract.withAddress(address)\n// change the address of the contract in the current context,\n// basically it will create a new contract with the new address\n// useful for proxy contracts\n\ncontract.withAPI(api)\n// change the api of the contract in the current context\n// basically it will create a new contract with the new api\n\n```\n\n### data\nUtility file. Contains all info about types. It's used in runtime to parse return values from contracts.\n\n### mixed-methods\nThis namespace contains both tx and query methods.\n\n```typescript\ncontract.mixedMethods.<functionName>(...args, options)\n```\n\n### query\nThis namepsace contains all query methods\n\n```typescript\nconst result = contract.query.<functionName>(...args, options)\n\nconsole.log(result.value)\n```\n\nYou can also use it to get errors from contracts\n\n```typescript\ntry {\n\tawait contract.withSigner(UserBob).query.transfer(UserAlice.address, '10', []);\n} catch ({ _err }) {\n\tconsole.log(_err);\n}\n```\n```bash\nconsole.log\n\t{ insufficientBalance: null }\n```\n\n### tx-sign-and-send\n\nThis namespace is used send transactions.\n\n```typescript\nconst result = await contract.tx.<functionName>(...args, options)\n```\n\n### Library\n\nYou can also use typechain-polkadot as a library. To use it, you need to import it in your code:\n\n```typescript\nimport {Typechain} from '@dpowxconsensus/typechain-polkadot/src/types/typechain';\nimport {testPathPatternToRegExp} from \"jest-util\";\n\nconst typechain = new Typechain();\n\ntypechain.loadDefaultPlugins();\n\ntypechain.run(\n\tpathToInput,\n\tpathToOutput\n)\n```\n\n## Plugins\n\nTypechain-polkadot uses plugins to generate code. By default, it uses the following plugins:\n\n- build-extrinsic [docs](./docs/build-extrinsic.md)\n- constructors [docs](./docs/constructors.md)\n- contract [docs](./docs/contract.md)\n- data [docs](./docs/data.md)\n- events [docs](./docs/events.md)\n- events-types [docs](./docs/events-types.md)\n- mixed-methods [docs](./docs/mixed-methods.md)\n- query [docs](./docs/query.md)\n- tx-sign-and-send [docs](./docs/tx-sign-and-send.md)\n\n\n\nYou can also create your own plugins to add some custom logic to the typechain-polkadot. To do this, you need to create a class that implements the `TypechainPlugin` interface:\n\n```typescript\nimport {TypechainPlugin} from '@dpowxconsensus/typechain-polkadot/src/types/interfaces';\nimport {Abi} from \"@polkadot/api-contract\";\n\n/**\n * generates a contract file\n *\n * @param abi - The ABI of the contract\n * @param fileName - The name of the file to write to\n * @param absPathToOutput - The absolute path to the output directory\n * @param absPathToABIs - The absolute path to the ABIs directory\n */\nfunction generate(abi: Abi, fileName: string, absPathToOutput: string, absPathToABIs: string) {\n\tconsole.log('Hello World!');\n}\n\nexport default class HelloWorldPlugin implements TypechainPlugin {\n\n\tname: string = 'HelloWorld';\n\toutputDir: string = 'HelloWorld';\n\n\tgenerate(abi: Abi, fileName: string, absPathToABIs: string, absPathToOutput: string): void {\n\t\tgenerate(abi, fileName, absPathToOutput, absPathToABIs);\n\t}\n}\n```\n\nThen you need to add your plugin to the list of plugins:\n\n```typescript\ntypechain.loadPlugins(new MyPlugin());\n```\n\nOr you can load them via cli:\n\n```bash\nnpx @dpowxconsensus/typechain-polkadot --input path/to/abis --output path/to/output --plugins ./plugins-directory\n```\n> Note: if you're using the cli, every plugin should end with `.plugin.ts` and have default export of the plugin itself.\n\nAlso you can use `loadPluginsFromFiles` method to load plugins from files:\n\n```typescript\ntypechain.loadPluginsFromFiles(\n\t'./plugins-directory'\n)\n```\n\n## Example of plugins usage\n\nYou can find an example of plugins usage in the [examples](../../examples) directory.\n\n","readmeFilename":"README.md"}