@gear-js/gear-meta

0.2.2 • Public • Published

GEAR


Description

CLI tool to encode / decode payloads and work with .meta.wasm files

Installation

npm install -g @gear-js/gear-meta

or

yarn global add @gear-js/gear-meta

Usage

Full list of commmands

gear-meta --help

Available commands

  • decode - Decode payload from hex
  • encode - Encode payload to hex
  • meta - Display metadata from .meta.wasm
  • type - Display type structure for particular type from .meta.wasm

You can simply run these commands and you will be prompted to enter the neccessary data.
Or you can specify data through options:

  • -t, --type - Type to encode or decode the payload. If it will not specified you can select it later
  • -m, --meta - Path to .meta.wasm file with program's metadata
  • -o --output - Output json file. If it doesn't exist it will be created
  • -j --payloadFromJson - If need to take the payload from json

All of these options are available for decode and encode commands
-o --output option is available for meta command
-m, --meta option is available for type command

Examples

gear-meta encode '{"amount": 8, "currency": "GRT"}' -t init_input -m ./path/to/demo_meta.meta.wasm

# Output:
  # Result:
  # 0x080c475254
gear-meta decode '0x080c475254' -t init_input -m ./path/to/demo_meta.meta.wasm

# Output:
  # Result:
  # { amount: '8', currency: 'GRT' }
gear-meta type handle_input -m ./path/to/demo_meta.meta.wasm

# Output:
  # TypeName:  MessageIn
  # { id: { decimal: 'u64', hex: 'Bytes' } }
gear-meta meta ./path/to/demo_meta.meta.wasm

# Output:
  # Result:
  # {
  #   types: '0x50000824646...0000023800',
  #   init_input: 'MessageInitIn',
  #   init_output: 'MessageInitOut',
  #   async_init_input: 'MessageInitAsyncIn',
  #   async_init_output: 'MessageInitAsyncOut',
  #   handle_input: 'MessageIn',
  #   handle_output: 'MessageOut',
  #   async_handle_input: 'MessageHandleAsyncIn',
  #   async_handle_output: 'MessageHandleAsyncOut',
  #   title: 'Example program with metadata',
  #   meta_state_input: 'Option<Id>',
  #   meta_state_output: 'Vec<Wallet>',
  #   meta_state: undefined
  # }

Package Sidebar

Install

npm i @gear-js/gear-meta

Weekly Downloads

0

Version

0.2.2

License

GPL-3.0

Unpacked Size

12.5 kB

Total Files

8

Last publish

Collaborators

  • osipov-mit