命令行接口(CLI)

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

查询

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

交易

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

transfer

transfer 命令允许用户通过发送链上的源端口 ID 和通道 ID 执行跨链代币转账。
simd tx ibc-transfer transfer [src-port] [src-channel] [receiver] [coins] [flags]
coins 参数接受要转账代币的数量和面额(例如 100uatom)。 可与该命令一起使用的附加标志包括:
  • --packet-timeout-height:用于以 {revision}-{height} 格式指定超时区块高度。默认值为 0-0,这实际上会禁用该超时。超时高度只能是绝对值,因此此选项必须与设置为 true 的 --absolute-timeouts 一起使用。在 IBC v1 协议中,必须设置 --packet-timeout-height 或 --packet-timeout-timestamp 之一。在 IBC v2 协议中,必须设置 --packet-timeout-timestamp。
  • --packet-timeout-timestamp:用于以纳秒指定超时时间戳。该超时既可以是相对值(相对于当前 UTC 时间),也可以是绝对值。默认值为 10 分钟(因此为相对值)。在 IBC v1 协议中,必须设置 --packet-timeout-height 或 --packet-timeout-timestamp 之一。在 IBC v2 协议中,必须设置 --packet-timeout-timestamp。
  • --absolute-timeouts:用于将超时时间戳解释为绝对值(设置为 true 时生效)。默认值为 false(因此超时会被视为相对于当前 UTC 时间的相对值)。
  • --memo:用于指定随转账数据包一同发送的 memo 字符串。如果使用了转发,则该 memo 字符串会通过中间链传递到最终目标。

total-escrow

total-escrow 命令允许用户查询某个特定代币面额的总托管数量,而不受代币是从哪个转账通道发出的影响。
simd query ibc-transfer total-escrow [denom] [flags]
示例:
simd query ibc-transfer total-escrow samoleans
示例输出:
amount: "100"

gRPC

用户可以通过 gRPC 端点查询 transfer 模块。

TotalEscrowForDenom

TotalEscrowForDenom 端点允许用户查询某个特定代币面额的总托管数量,而不受代币是从哪个转账通道发出的影响。
ibc.applications.transfer.v1.Query/TotalEscrowForDenom
示例:
grpcurl -plaintext \
  -d '{"denom":"samoleans"}' \
  localhost:9090 \
  ibc.applications.transfer.v1.Query/TotalEscrowForDenom
示例输出:
{
  "amount": "100"
}

CLI

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

Query

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

Transactions

The tx commands allow users to interact with the controller submodule.
simd tx ibc-transfer --help

transfer

The transfer command allows users to execute cross-chain token transfers from the source port ID and channel ID on the sending chain.
simd tx ibc-transfer transfer [src-port] [src-channel] [receiver] [coins] [flags]
The coins parameter accepts the amount and denomination (e.g. 100uatom) of the tokens to be transferred. The additional flags that can be used with the command are:
  • --packet-timeout-height to specify the timeout block height in the format {revision}-{height}. The default value is 0-0, which effectively disables the timeout. Timeout height can only be absolute, therefore this option must be used in combination with --absolute-timeouts set to true. On IBC v1 protocol, either --packet-timeout-height or --packet-timeout-timestamp must be set. On IBC v2 protocol --packet-timeout-timestamp must be set.
  • --packet-timeout-timestamp to specify the timeout timestamp in nanoseconds. The timeout can be either relative (from the current UTC time) or absolute. The default value is 10 minutes (and thus relative). On IBC v1 protocol, either --packet-timeout-height or --packet-timeout-timestamp must be set. On IBC v2 protocol --packet-timeout-timestamp must be set.
  • --absolute-timeouts to interpret the timeout timestamp as an absolute value (when set to true). The default value is false (and thus the timeout is considered relative to current UTC time).
  • --memo to specify the memo string to be sent along with the transfer packet. If forwarding is used, then the memo string will be carried through the intermediary chains to the final destination.

total-escrow

The total-escrow command allows users to query the total amount in escrow for a particular coin denomination regardless of the transfer channel from where the coins were sent out.
simd query ibc-transfer total-escrow [denom] [flags]
Example:
simd query ibc-transfer total-escrow samoleans
Example Output:
amount: "100"

gRPC

A user can query the transfer module using gRPC endpoints.

TotalEscrowForDenom

The TotalEscrowForDenom endpoint allows users to query the total amount in escrow for a particular coin denomination regardless of the transfer channel from where the coins were sent out.
ibc.applications.transfer.v1.Query/TotalEscrowForDenom
Example:
grpcurl -plaintext \
  -d '{"denom":"samoleans"}' \
  localhost:9090 \
  ibc.applications.transfer.v1.Query/TotalEscrowForDenom
Example output:
{
  "amount": "100"
}