Git Product home page Git Product logo

typechain-polkadot's Introduction

Logo

πŸ“’ πŸ“’ πŸ“’ We are thrilled to announce Patron, which brings smart contract verification functionality to the Polkadot ecosystem. πŸ“’ πŸ“’ πŸ“’

Smart contract verification ensures the security, reliability, and trustworthiness of dApps and blockchain platforms. With Patron, you can simplify the deployment flow, manage your builds and make the Polkadot ecosystem more secure and transparent.


So, in other words, Patron is an all-in-one contracts platform, which allows you to build and verify ink! smart contracts inside of an isolated environment, explore contract verification details.

Typechain

GitHub

If you have any questions regarding Typechain-Polkadot, you can join the Brushfam Element channel to find your answers and meet other ink! smart contracts developers.

Latest releases:

  • Typechain-Polkadot npm version
  • Typechain-Compiler npm version
  • Typechain-Types npm version

Overview πŸ“„

Typechain is maintained by Brushfam team to improve developers’ experience working with ink! smart contracts.

Nowadays, when technologies are growing faster and faster, we should think about optimizations of different routine processes and making older stuff better. One of these optimizations is to make code typesafe that will be flexible in different situations.

When a smart contract is being written, front-end developer receives file representation of it in the format called Application Binary Interface (ABI). One ABI per each contract, new ABI for every update of a contract.

Information about how to interact with a contract (methods names, arguments & returns types etc.) is included in this ABI file. It is not quite human-readable, so extraction of that information becomes a challenge. We need to have correct type definitions for each contract in TypeScript.

Interaction with blockchain is done with polkadot.js library, which only has abstract definitions for the contract in use, thus users' code cannot be typesafe. And Typechain-Polkadot can change it.

Installation & import

Install the package as dependency:

npm i @727-ventures/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):

npx @727-ventures/typechain-polkadot --in artifacts --out typed_contracts

Import the contract what you want to use(in the example it is my_psp22):

import MyPSP22 from "../typed_contracts/contracts/my_psp22"

In the code you can find all available methods and constructors.

Right now, you can't instantiate the contract via typechain(coming soon), but you can wrap any already deployed contract. If in the code you already have instantiated contract then you can easily wrap it:

const typed_contract = new MyPSP22(
    contract.address.toString(),
    signer /* who will sign transactions*/,
    contract.api
);

More information you can find in docs.

Usage of Typechain-compiler

npx typechain-compiler --config config.json

Also you can set some additional arguments like --noCompile, --noTypechain, --release

Config interface will be something like this:

export interface Config {
    projectFiles: string[]; // Path to all project files, everystring in glob format
    skipLinting : boolean; // Skip linting of project files
    artifactsPath : string; // Path to artifacts folder, where artifacts will be stored it will save both .contract and .json (contract ABI)
    typechainGeneratedPath : string; // Path to typechain generated folder
}

Project Details

Typesafe contracts' descriptions can be generated automatically by a script, taking a list of ABIs as an input, giving usable TS type definitions and even runtime code as its output.

Given, that a front-end developer needs to do this with every contracts update, such tool would save a lot of time and prevent mistakes of misusing smart contracts. It is installed as a package with built-in CLI.

When contracts descriptions come both with ABI and source code (*.contract files), our tool will provide means for deployment as well.

Also, Typechain-Polkadot uses awesome tool Handlebars for generating code from templates. It is a very flexible and powerful tool, which allows to generate code from templates with a lot of different logic. For example, you can generate code for different contracts with different logic, or you can generate code for different methods with different logic.

Documentation πŸ“š

Roadmap πŸš—

Typechain participates in the Web3 Grants, you can find the roadmap there:

typechain-polkadot's People

Contributors

varex83 avatar artemka374 avatar alex-tsx avatar coreggon11 avatar ttomas7 avatar shunsukew avatar snyk-bot avatar forgetso avatar flebed avatar hyunggyujang avatar 0xmarkian avatar qudacki avatar xgreenx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.