CLI tool to encode / decode payloads and work with .meta.wasm files
npm install -g @gear-js/gear-meta
or
yarn global add @gear-js/gear-meta
gear-meta --help
You can simply run these commands and you will be prompted to enter the neccessary data.
Or you can specify data through options:
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
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
# }