GithubHelp home page GithubHelp logo

abi2core's Introduction

@greymass/abi2core

Library and command line tool to generate @greymass/eosio types from EOSIO ABI definitions.

Installation

The @greymass/abi2core package is distributed as a module on npm.

yarn global add @greymass/abi2core
# or
npm install --global @greymass/abi2core

Usage

After installing the abi2core command should be available, it takes EOSIO ABI JSON on stdin and outputs @greymass/eosio TypeScript Types on stdout.

Example:

$ cleos -u https://eos.greymass.com get abi eosio.token | abi2core
// generated by @greymass/abi2core

import {Asset, Name, Struct} from '@greymass/eosio'

@Struct.type('account')
export class Account extends Struct {
    @Struct.field(Asset) balance!: Asset
}

@Struct.type('close')
export class Close extends Struct {
    @Struct.field(Name) owner!: Name
    @Struct.field(Asset.Symbol) symbol!: Asset.Symbol
}

@Struct.type('create')
export class Create extends Struct {
    @Struct.field(Name) issuer!: Name
    @Struct.field(Asset) maximum_supply!: Asset
}

@Struct.type('currency_stats')
export class CurrencyStats extends Struct {
    @Struct.field(Asset) supply!: Asset
    @Struct.field(Asset) max_supply!: Asset
    @Struct.field(Name) issuer!: Name
}

@Struct.type('issue')
export class Issue extends Struct {
    @Struct.field(Name) to!: Name
    @Struct.field(Asset) quantity!: Asset
    @Struct.field('string') memo!: string
}

@Struct.type('open')
export class Open extends Struct {
    @Struct.field(Name) owner!: Name
    @Struct.field(Asset.Symbol) symbol!: Asset.Symbol
    @Struct.field(Name) ram_payer!: Name
}

@Struct.type('retire')
export class Retire extends Struct {
    @Struct.field(Asset) quantity!: Asset
    @Struct.field('string') memo!: string
}

@Struct.type('transfer')
export class Transfer extends Struct {
    @Struct.field(Name) from!: Name
    @Struct.field(Name) to!: Name
    @Struct.field(Asset) quantity!: Asset
    @Struct.field('string') memo!: string
}

Developing

You need Make, node.js and yarn installed.

Clone the repository and run make to checkout all dependencies and build the project. See the Makefile for other useful targets. Before submitting a pull request make sure to run make lint.


Made with ☕️ & ❤️ by Greymass, if you find this useful please consider supporting us.

abi2core's People

Contributors

jnordberg 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.