Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greymass/abi2core
https://github.com/greymass/abi2core
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/greymass/abi2core
- Owner: greymass
- License: other
- Created: 2021-02-27T03:01:39.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-24T16:49:57.000Z (over 1 year ago)
- Last Synced: 2024-05-01T09:52:39.974Z (8 months ago)
- Language: TypeScript
- Size: 134 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-eosio - greymass/abi2core - Command line utility to convert ABI definitions to greymass/eosio type definitions. (Developers / Developer Tools)
README
# @greymass/abi2core
Library and command line tool to generate [@wharfkit/antelope](https://github.com/wharfkit/antelope) types from Antelope ABI definitions.
## Installation
The `@greymass/abi2core` package is distributed as a module on [npm](https://www.npmjs.com/package/@greymass/abi2core).
```
yarn global add @greymass/abi2core
# or
npm install --global @greymass/abi2core
```## Usage
After installing the abi2core command should be available, it takes Antelope ABI JSON on stdin and outputs @wharfkit/antelope TypeScript Types on stdout.
Example:
```sh
$ cleos -u https://eos.greymass.com get abi eosio.token | abi2core
``````ts
// generated by @greymass/abi2coreimport {Asset, Name, Struct} from '@wharfkit/antelope'
@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](https://www.gnu.org/software/make/), [node.js](https://nodejs.org/en/) and [yarn](https://classic.yarnpkg.com/en/docs/install) installed.
Clone the repository and run `make` to checkout all dependencies and build the project. See the [Makefile](./Makefile) for other useful targets. Before submitting a pull request make sure to run `make lint`.
---
Made with ☕️ & ❤️ by [Greymass](https://greymass.com), if you find this useful please consider [supporting us](https://greymass.com/support-us).