Coder Social home page Coder Social logo

tankofzion / txwrapper-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paritytech/txwrapper-core

0.0 0.0 0.0 4.65 MB

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.

License: Apache License 2.0

JavaScript 0.08% TypeScript 99.92%

txwrapper-core's Introduction

txwrapper-core

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.

Table of contents

Overview

The polkadot.js based txwrapper suite of packages provides chain builders with the tools to quickly create, test, and maintain a library of helper functions for offline transaction generation with their chain. End users can then use these chain specific packages to create an offline transaction workflow. (We sometimes refer to chain specific libs as txwrappers.)

For example, those looking to construct a transaction offline on Polkadot would require @substrate/txwrapper-polkadot. @substrate/txwrapper-polkadot is built by requiring @substrate/txwrapper-core, @substrate/txwrapper-registry, @substrate/txwrapper-substrate and re-exporting utilities and dispatchables relevant to Polkadot.

Packages

Published

Non-published

  • @substrate/txwrapper-example Usage examples including how to construct, sign, and decode an extrinsic with @substrate/txwrapper-polkadot.
  • @substrate/txwrapper-template Template package for chain builders.
  • txwrapper-acala PoC of how a FRAME-based chain can leverage txwrapper packages to create a txwrapper. N.B. This is only for PoC usage and not intended to be published by txwrapper-core repo maintainers.

End user examples

Click here for examples on how to use txwrappers for constructing, signing, and decoding transactions.

Chain builder guide

Click here to find our guide for chain builders. The guide explains how to make a chain specific txwrapper.

Develop, contribute, and maintain

Develop

Install dependencies:

yarn install

Build all packages:

yarn run build

Contribute

We welcome contributions!

Before submitting your PR, make sure to run the following commands

Run all tests:

yarn run test

Run the linter:

yarn run lint

# or to automatically fix warnings:

yarn run lint --fix

Release & Publishing

Preparation

  1. Ensure that your version of npm is 7 or above. Check with npm --version and, if needed, upgrade with npm install -g npm (which may need to be prefixed with sudo depending on the permissions set on your global node_modules folder). If this is not true, an empty binary will be pushed on publish.

  2. Checkout a branch name-update-deps, and ensure we have the latest polkadot-js dependencies by running the command below. If all packages are already up to date you may skip to the "Publishing" section below. Note: what follows assumes yarn at version 2.4.2 or above.

    yarn up "@polkadot/*"
  3. Ensure there are no issues by running the following commands. If any type errors occur due to the updated dependencies, you may file an issue here.

    yarn run build
    yarn dedupe
    yarn run test
    yarn run lint

    Note: some tests in txwrapper-orml/src/methods/currencies/transferNativeCurrency.spec.ts and txwrapper-orml/src/methods/currencies/transfer.spec.ts emit warnings that look like:

    REGISTRY: Unknown signed extensions SetEvmOrigin found, treating them as no-effect
    

    These are expected, and can be ignored.

  4. If all tests pass and all packages build successfully, commit your changes with the following format fix(types): Update polkadot-js deps to get the latest types. Then push your branch up to Github for review, then merge. The release tooling takes care of bumping the version so no need for a manual update (see below).

Publishing

This libraries release process uses Lerna, and the following below is required to have a successful release.

  • N.B. Ensure you have GH_TOKEN env variable set to a GitHub personal access token (PAT) so lerna can publish the release on github.

  • The publisher will need publishing permissions to the @substrate npm org.

  1. Make sure you're logged in to npm using npm login.

  2. Make sure to be in the main branch, and git pull origin main.

  3. Before deploying a new release run the following sanity checks.

    yarn run build
    yarn run test
  4. Deploy the new release.

    yarn run deploy

    NOTES:

    This repo requires signed and verified commits, so when using a yubikey there are several points where you are required to sign a commit while Lerna sets up the github release. The output from Lerna won't warn you that you have to sign it, so the deploy step will error if you forget. I'd advise keeping an eye on your Yubikey; it'll start flashing when it's needed to sign something.

    If you don't sign a commit in time and get an error, you may need to "undo" some steps:

    • If a new commit was created locally, git reset --hard HEAD~1 to undo it.
    • If a new tag was created locally, git tag -d <new-version> to remove it.
    • If lerna-debug.log was created, rm -rf lerna-debug.log to remove it.

    If you forget to login to NPM, the GitHub steps will all complete successfully, but the publishing step will fail. In that case, you can do the following:

    • run yarn run build to ensure that all packages are built and ready to be published (This is important; yarn run deploy does this for us, but if we skip to publishing, we must ensure that the packages are in a good state ourselves).
    • run npx lerna publish from-package to publish the packages.

    If you don't have the permissions you need on the GitHub repository, you may find that you're able to push a tag but not the actual commit. In this case, you can delete the version tag on GitHub with git push origin :<new-version>.

txwrapper-core's People

Contributors

dvdplm avatar emostov avatar github-actions[bot] avatar insipx avatar jsdw avatar masterdubs avatar tarikgul avatar xlc 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.