#钱包 #发送 #格式 #mel #cli #接口 #melwallet

程序 melwallet-cli

melwallet-cli 库

3 个版本

0.8.4 2024 年 5 月 15 日
0.8.3 2024 年 5 月 15 日
0.8.0 2024 年 4 月 17 日

#9 in #mel

MPL-2.0 许可证

47KB
914

melwallet-cli(ent)

melwallet 官方库的默认 CLI 接口,melwalletmelwallet-cli 格式化并发送区块链请求,在必要时提示用户。此工具旨在提供与 melwalletd REST API 直接交互的灵活性,并具有许多附加优势,包括

  • 有用的帮助信息
  • 自动响应输出格式化
  • 自动交易准备和请求格式化

安装

melwallet-client 是一个 Rust crate,因此最简单的安装方法是使用 cargo

cargo install --locked melwallet-cli

要了解如何快速使用此软件,请查看 Mel 文档中的此快速指南

使用 melwallet-cli

要显示 melwallet-cli 功能的完整描述,请使用 --help 标志

$ melwallet-cli --help

Mel Wallet Command Line Interface

Usage: melwallet-cli --wallet-path <WALLET_PATH> <COMMAND>

Commands:
  create                 Create a wallet.  Ex: `melwallet-cli --wallet-path wallet123 create`
  send-faucet            Send a 1000 MEL faucet transaction for a testnet wallet
  summary                Details of a wallet
  send                   Send a transaction to the network
  pool                   Checks a pool.
  swap                   Swaps money from one denomination to another
  liq-deposit            Supplies liquidity to Melswap
  wait-confirmation      Wait for a particular transaction to confirm
  send-raw               Sends a raw transaction in hex, with no customization options
  export-sk              Exports the secret key of a wallet
  import-sk              Provide a secret key to import an existing wallet
  autoswap               Automatically executes arbitrage trades on the core, "triangular" MEL/SYM/ERG pairs
  stake                  Stakes a certain number of syms
  network-summary        
  generate-autocomplete  Generate bash autocompletions
  help                   Print this message or the help of the given subcommand(s)

如上所述,所有 melwallet-cli 功能都可通过使用子命令来访问。查看其中一个子命令

$ melwallet-cli send --help

Send a transaction to the network

Usage: melwallet-cli --wallet-path <WALLET_PATH> send [OPTIONS]

Options:
      --to <TO>                      FORMAT: `destination,amount[,denom[,additional_data]]`
                                     Specifies where to send funds; denom and additional_data are optional.
                                     For example, `--to $ADDRESS,100.0` sends 100 MEL to $ADDRESS.
                                     Amounts must be specified with numbers on either side of the decimal. Ex: 10.0, 0.1
                                     Can be specified multiple times to send money to multiple addresses.
                                     `denom` defaults to MEL
                                     `additional_data` must be hex encoded by default, but allows passsing ascii with `ascii=""`
      --force-spend <FORCE_SPEND>    Force the selection of a coin
      --add-covenant <ADD_COVENANT>  Additional covenants. This often must be specified if we are spending coins that belong to other addresses, like covenant coins
      --hex-data <HEX_DATA>          The contents of the data field, in hexadecimal [default: ]
      --dry-run                      Dumps the transaction as a hex string
      --wait                         Whether or not to wait for the the transaction to confirm
      --fee-ballast <FEE_BALLAST>    "Ballast" to add to the fee; 50 is plenty for an extra ed25519 signature added manually later [default: 0]
  -h, --help                         Print help

高级用法

melwallet-cli 可用于在 Mel 上部署称为契约的脚本。有关部署契约的更多信息,请参阅此处

依赖项

~31–73MB
~1.5M SLoC