CLI

用户可以使用 CLI 查询并与 08-wasm 模块交互。使用 --help 标志可查看可用命令:

交易

tx 命令允许用户与 08-wasm 子模块交互。
simd tx ibc-wasm --help

store-code

store-code 命令允许用户提交一个包含 MsgStoreCode 的治理提案,用于存储 Wasm 轻客户端合约的字节码。
simd tx ibc-wasm store-code [path/to/wasm-file] [flags]
path/to/wasm-file 是指向 .wasm 或 .wasm.gz 文件的路径。

migrate-contract

migrate-contract 命令允许用户广播一个包含 MsgMigrateContract 的交易,将指定轻客户端的合约迁移到由给定校验和标识的新字节码。
simd tx ibc-wasm migrate-contract [client-id] [checksum] [migrate-msg]
迁移消息不能为空,并且应为 JSON 编码字符串。

查询

query 命令允许用户查询 08-wasm 状态。
simd query ibc-wasm --help

checksums

checksums 命令允许用户查询通过 MsgStoreCode 存储在 Wasm VM 中的 Wasm 轻客户端合约校验和列表。校验和采用十六进制编码。
simd query ibc-wasm checksums [flags]
示例:
simd query ibc-wasm checksums
示例输出:
checksums:
- c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64
pagination:
  next_key: null
  total: "1"

code

code 命令允许用户根据提供的输入校验和查询轻客户端合约的 Wasm 字节码。
./simd q ibc-wasm code
示例:
simd query ibc-wasm code c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64
示例输出:
code: AGFzb...AqBBE=

gRPC

用户可以使用 gRPC 端点查询 08-wasm 模块。

Checksums

Checksums 端点允许用户查询通过 MsgStoreCode 存储在 Wasm VM 中的 Wasm 轻客户端合约校验和列表。
ibc.lightclients.wasm.v1.Query/Checksums
示例:
grpcurl -plaintext \
  -d '{}' \
  localhost:9090 \
  ibc.lightclients.wasm.v1.Query/Checksums
示例输出:
{
  "checksums": [
    "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64"
  ],
  "pagination": {
    "total": "1"
  }
}

Code

Code 端点允许用户根据提供的输入校验和查询轻客户端合约的 Wasm 字节码。
ibc.lightclients.wasm.v1.Query/Code
示例:
grpcurl -plaintext \
  -d '{"checksum":"c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64"}' \
  localhost:9090 \
  ibc.lightclients.wasm.v1.Query/Code
示例输出:
{
  "code": AGFzb...AqBBE=
}

CLI

A user can query and interact with the 08-wasm module using the CLI. Use the --help flag to discover the available commands:

Transactions

The tx commands allow users to interact with the 08-wasm submodule.
simd tx ibc-wasm --help

store-code

The store-code command allows users to submit a governance proposal with a MsgStoreCode to store the byte code of a Wasm light client contract.
simd tx ibc-wasm store-code [path/to/wasm-file] [flags]
path/to/wasm-file is the path to the .wasm or .wasm.gz file.

migrate-contract

The migrate-contract command allows users to broadcast a transaction with a MsgMigrateContract to migrate the contract for a given light client to a new byte code denoted by the given checksum.
simd tx ibc-wasm migrate-contract [client-id] [checksum] [migrate-msg]
The migrate message must not be emptied and is expected to be a JSON-encoded string.

Query

The query commands allow users to query 08-wasm state.
simd query ibc-wasm --help

checksums

The checksums command allows users to query the list of checksums of Wasm light client contracts stored in the Wasm VM via the MsgStoreCode. The checksums are hex-encoded.
simd query ibc-wasm checksums [flags]
Example:
simd query ibc-wasm checksums
Example Output:
checksums:
- c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64
pagination:
  next_key: null
  total: "1"

code

The code command allows users to query the Wasm byte code of a light client contract given the provided input checksum.
./simd q ibc-wasm code
Example:
simd query ibc-wasm code c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64
Example Output:
code: AGFzb...AqBBE=

gRPC

A user can query the 08-wasm module using gRPC endpoints.

Checksums

The Checksums endpoint allows users to query the list of checksums of Wasm light client contracts stored in the Wasm VM via the MsgStoreCode.
ibc.lightclients.wasm.v1.Query/Checksums
Example:
grpcurl -plaintext \
  -d '{}' \
  localhost:9090 \
  ibc.lightclients.wasm.v1.Query/Checksums
Example output:
{
  "checksums": [
    "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64"
  ],
  "pagination": {
    "total": "1"
  }
}

Code

The Code endpoint allows users to query the Wasm byte code of a light client contract given the provided input checksum.
ibc.lightclients.wasm.v1.Query/Code
Example:
grpcurl -plaintext \
  -d '{"checksum":"c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64"}' \
  localhost:9090 \
  ibc.lightclients.wasm.v1.Query/Code
Example output:
{
  "code": AGFzb...AqBBE=
}