DEV Community

darkvallen
darkvallen

Posted on

Deep Dive into Soroban-CLI : soroban lab, soroban version & soroban completion

Hi there! This is the last post of the "Deep Dive into Soroban-CLI" series where we'll explore the soroban-cli in depth. Soroban-CLI is a command-line tool for interacting with soroban smart contracts on the Stellar network. Soroban-CLI provides a set of subcommands that can be used to perform various tasks related to smart contract development and deployment on the Stellar network.

In this post i will explaining soroban lab, soroban version and soroban completion subcommands.

soroban lab Subcommands

The soroban lab subcommand provides access to experimental Soroban features and expert tools. For now, it's only had 2 subcommand, soroban lab token and soroban lab xdr.

soroban lab token subcommands

This subcommand used to wrap, create, and manage token contracts. But for now only wrap subcommand available.wrap subcommand is used to wrap stellar classic asset into soroban futurenet.

Usage:

soroban lab token wrap [OPTIONS] --asset <ASSET>

OPTIONS:
        --asset <ASSET>              ID of the Stellar classic asset to wrap, e.g. "USDC:G...5"
        --secret-key <SECRET_KEY>    Secret Key used to sign transaction sent to the rpc server
                                     [env: SOROBAN_SECRET_KEY=]
        --network <NETWORK>          Name of network to use from config
        --identity <IDENTITY>        Use specified identity to sign transaction
        --hd-path <HD_PATH>          If using a seed phrase, which hd path to use, e.g.
                                     `m/44'/148'/{hd_path}`
    -h, --help                       Print help information

OPTIONS (RPC):
        --rpc-url <RPC_URL>
            RPC server endpoint [env: SOROBAN_RPC_URL=]

        --network-passphrase <NETWORK_PASSPHRASE>
            Network passphrase to sign the transaction sent to the rpc server [env:
            SOROBAN_NETWORK_PASSPHRASE=]

OPTIONS (SANDBOX):
        --ledger-file <LEDGER_FILE>    File to persist ledger state [env: SOROBAN_LEDGER_FILE=]
                                       [default: .soroban/ledger.json]
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$ soroban lab token wrap --asset native
d98fc10ef20b3291ceb69d3170fa7965e98c67ad81983ce6d326cfbe56dfd20a
Enter fullscreen mode Exit fullscreen mode

Wrapping an asset will work exactly one time per asset (per network).

soroban lab xdr subcommands

soroban lab xdr only have 1 subcommand dec used to decode a XDR to human readable JSON-like format. XDR (eXternal Data Representation) is a key format used in the Stellar network. Many data structures on Stellar are encoded in XDR, including:

  • Transactions
  • Ledger entries
  • Operation results
  • Historical records

soroban lab xdr dec Usage :

soroban lab xdr [OPTIONS] <XDR> 
OPTIONS:
  --type <TYPE>      Type of XDR,ex:TransactionEnvelope,TransactionResult,and etc
Enter fullscreen mode Exit fullscreen mode

Usage Example:

$ soroban lab xdr dec \
>     --type TransactionEnvelope \
>     --xdr AAAAAgAAAACX9B9omDdFAmgPAcgcDWU5xeWG+4OUj3Z9bYg/HT++LwAPQkAAAAEUAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAAAAAAAD7nPzr29pRuPFM54/ZpOAtYV6alM6DZT8jXPIFiiWD7wAAABdIdugAAAAAAAAAAAIdP74vAAAAQJr4+99Ns6xajUxOpQQ6ddDZDYnvv582iUDRqrXmIvJh+ien43u+AsyhktivlNMmL5ES5fGPQTCLKu4K71U7YwCGVuCcAAAAQCjCOJlp6lsjrdgT1AGqI6zWc+WBqEIJ5HXd0FyqCNZ+cChomPRjIc1uC2pyeNvrcdpTvLMVsHJ/sWe7UxTulQY=
TransactionEnvelope(
    Tx(
        TransactionV1Envelope {
            tx: Transaction {
                source_account: Ed25519(
                    Uint256(97f41f6898374502680f01c81c0d6539c5e586fb83948f767d6d883f1d3fbe2f),
                ),
                fee: 1000000,
                seq_num: SequenceNumber(
                    1185410973697,
                ),
                cond: Time(
                    TimeBounds {
                        min_time: TimePoint(
                            0,
                        ),
                        max_time: TimePoint(
                            0,
                        ),
                    },
                ),
                memo: None,
                operations: VecM(
                    [
                        Operation {
                            source_account: Some(
                                Ed25519(
                                    Uint256(107dd16b2c383348822e811ef7aacf14d1988a6f00547254d33e1e6d8656e09c),
                                ),
                            ),
                            body: CreateAccount(
                                CreateAccountOp {
                                    destination: AccountId(
                                        PublicKeyTypeEd25519(
                                            Uint256(fb9cfcebdbda51b8f14ce78fd9a4e02d615e9a94ce83653f235cf2058a2583ef),
                                        ),
                                    ),
                                    starting_balance: 100000000000,
                                },
                            ),
                        },
                    ],
                ),
                ext: V0,
            },
            signatures: VecM(
                [
                    DecoratedSignature {
                        hint: SignatureHint(1d3fbe2f),
                        signature: Signature(
                            BytesM(9af8fbdf4db3ac5a8d4c4ea5043a75d0d90d89efbf9f368940d1aab5e622f261fa27a7e37bbe02cca192d8af94d3262f9112e5f18f41308b2aee0aef553b6300),
                        ),
                    },
                    DecoratedSignature {
                        hint: SignatureHint(8656e09c),
                        signature: Signature(
                            BytesM(28c2389969ea5b23add813d401aa23acd673e581a84209e475ddd05caa08d67e70286898f46321cd6e0b6a7278dbeb71da53bcb315b0727fb167bb5314ee9506),
                        ),
                    },
                ],
            ),
        },
    ),
)
Enter fullscreen mode Exit fullscreen mode

Example above decoding a Friendbot transaction XDR into a more human-readable format.

soroban version subcommand

This subcommand used to shows you details on the specific versions and source code state of the soroban-cli and its dependencies. This can be useful for:

  • Checking that you have the latest version installed
  • Reporting the soroban-cli and its dependencies version in bug reports
  • Knowing which new features or capabilities you have access to based on version

Usage :

soroban version
Enter fullscreen mode Exit fullscreen mode

Usage Example:

$ soroban version
soroban 0.6.0 (7ff9ac57893ba54f630a8cb3b62d76a2a1a70858)
soroban-env 0.0.14 (d06aaddca61f011cc64ec098b464233423197c3a)
soroban-env interface version 29
stellar-xdr 0.0.14 (55f47d302a3bbcd34cf32bfcd28abccfaeffc5e0)
xdr next (df18148747e807618acf4639db41c4fd6f0be9fc)
Enter fullscreen mode Exit fullscreen mode

soroban completion subcommand

The soroban completion prints out shell completion code for the soroban-cli.
Shell completion is a handy feature that provides suggestions and autocompletion for commands as you type. It allows you to:

  • Get a list of possible subcommands or options by hitting tab
  • Fill in the rest of a subcommand or option by hitting tab again

This saves you from having to remember and type out full commands and flags, and prevents typos.

Usage :

$ soroban completion --shell bash
_soroban() {
    local i cur prev opts cmds
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    cmd=""
    opts=""

    for i in ${COMP_WORDS[@]}
    do
        case "${i}" in
            "$1")
                cmd="soroban"
                ;;
            add)
                cmd+="__add"
                ;;
            address)
                cmd+="__address"
                ;;
            bindings)
                cmd+="__bindings"
                ;;
            completion)
                cmd+="__completion"
                ;;
            config)
                cmd+="__config"
                ;;
            contract)
                cmd+="__contract"
                ;;
            dec)
                cmd+="__dec"
                ;;
            deploy)
                cmd+="__deploy"
                ;;
            events)
                cmd+="__events"
                ;;
            generate)
                cmd+="__generate"
                ;;
            identity)
                cmd+="__identity"
                ;;
            inspect)
                cmd+="__inspect"
                ;;
            install)
                cmd+="__install"
                ;;
            invoke)
                cmd+="__invoke"
                ;;
            lab)
                cmd+="__lab"
                ;;
            ls)
                cmd+="__ls"
                ;;
            network)
                cmd+="__network"
                ;;
            optimize)
                cmd+="__optimize"
                ;;
            read)
                cmd+="__read"
                ;;
            rm)
                cmd+="__rm"
                ;;
            serve)
                cmd+="__serve"
                ;;
            token)
                cmd+="__token"
                ;;
            version)
                cmd+="__version"
                ;;
            wrap)
                cmd+="__wrap"
                ;;
            xdr)
                cmd+="__xdr"
                ;;
            *)
                ;;
        esac
    done

    case "${cmd}" in
        soroban)
            opts="-h --help contract config serve events lab version completion"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__completion)
            opts="-h --shell --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --shell)
                    COMPREPLY=($(compgen -W "bash elvish fish powershell zsh" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config)
            opts="-h --help identity network"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__identity)
            opts="-h --help add address generate ls rm"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__identity__add)
            opts="-h --secret-key --seed-phrase --global --help <NAME>"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__identity__address)
            opts="-h --hd-path --help <NAME>"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --hd-path)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__identity__generate)
            opts="-s -h --seed --global --help <NAME>"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --seed)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -s)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__identity__ls)
            opts="-h --global --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__identity__rm)
            opts="-h --global --help <DEFAULT_NAME>"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__network)
            opts="-h --help add rm ls"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__network__add)
            opts="-h --rpc-url --network-passphrase --global --help <NAME>"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --rpc-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network-passphrase)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__network__ls)
            opts="-h --global --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__config__network__rm)
            opts="-h --global --help <DEFAULT_NAME>"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract)
            opts="-h --help bindings deploy inspect install invoke optimize read"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract__bindings)
            opts="-h --wasm --output --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --wasm)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "rust json" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract__deploy)
            opts="-h --wasm --wasm-hash --id --salt --secret-key --rpc-url --network-passphrase --network --ledger-file --identity --hd-path --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --wasm)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --wasm-hash)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --id)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --salt)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --secret-key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rpc-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network-passphrase)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --ledger-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --identity)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --hd-path)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract__inspect)
            opts="-h --wasm --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --wasm)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract__install)
            opts="-h --wasm --secret-key --rpc-url --network-passphrase --network --ledger-file --identity --hd-path --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --wasm)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --secret-key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rpc-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network-passphrase)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --ledger-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --identity)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --hd-path)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract__invoke)
            opts="-h --id --wasm --fn --cost --unlimited-budget --footprint --auth --account --events-file --secret-key --rpc-url --network-passphrase --network --ledger-file --identity --hd-path --help <CONTRACT_FN_ARGS>..."
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --id)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --wasm)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --fn)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --account)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --events-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --secret-key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rpc-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network-passphrase)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --ledger-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --identity)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --hd-path)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract__optimize)
            opts="-h --wasm --wasm-out --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --wasm)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --wasm-out)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__contract__read)
            opts="-h --id --key --key-xdr --output --ledger-file --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --id)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --key-xdr)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "string json xdr" -- "${cur}"))
                    return 0
                    ;;
                --ledger-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__events)
            opts="-c -h --start-ledger --cursor --output --count --rpc-url --events-file --id --topic --type --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --start-ledger)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --cursor)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "pretty plain json" -- "${cur}"))
                    return 0
                    ;;
                --count)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                -c)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rpc-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --events-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --id)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --topic)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --type)
                    COMPREPLY=($(compgen -W "all contract system" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__lab)
            opts="-h --help token xdr"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__lab__token)
            opts="-h --help wrap"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__lab__token__wrap)
            opts="-h --asset --secret-key --rpc-url --network-passphrase --network --ledger-file --identity --hd-path --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --asset)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --secret-key)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --rpc-url)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network-passphrase)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --network)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --ledger-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --identity)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --hd-path)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__lab__xdr)
            opts="-h --help dec"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__lab__xdr__dec)
            opts="-h --type --xdr --output --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --type)
                    COMPREPLY=($(compgen -W "Value ScpBallot ScpStatementType ScpNomination ScpStatement ScpStatementPledges ScpStatementPrepare ScpStatementConfirm ScpStatementExternalize ScpEnvelope ScpQuorumSet ScEnvMetaKind ScEnvMetaEntry ScSpecType ScSpecTypeOption ScSpecTypeResult ScSpecTypeVec ScSpecTypeMap ScSpecTypeSet ScSpecTypeTuple ScSpecTypeBytesN ScSpecTypeUdt ScSpecTypeDef ScSpecUdtStructFieldV0 ScSpecUdtStructV0 ScSpecUdtUnionCaseVoidV0 ScSpecUdtUnionCaseTupleV0 ScSpecUdtUnionCaseV0Kind ScSpecUdtUnionCaseV0 ScSpecUdtUnionV0 ScSpecUdtEnumCaseV0 ScSpecUdtEnumV0 ScSpecUdtErrorEnumCaseV0 ScSpecUdtErrorEnumV0 ScSpecFunctionInputV0 ScSpecFunctionV0 ScSpecEntryKind ScSpecEntry ScSymbol ScValType ScStatic ScStatusType ScHostValErrorCode ScHostObjErrorCode ScHostFnErrorCode ScHostStorageErrorCode ScHostAuthErrorCode ScHostContextErrorCode ScVmErrorCode ScUnknownErrorCode ScStatus ScVal ScObjectType ScMapEntry ScVec ScMap ScContractCodeType ScContractCode Int128Parts ScAddressType ScAddress ScObject StoredTransactionSet PersistedScpStateV0 PersistedScpStateV1 PersistedScpState Thresholds String32 String64 SequenceNumber TimePoint Duration DataValue PoolId AssetCode4 AssetCode12 AssetType AssetCode AlphaNum4 AlphaNum12 Asset Price Liabilities ThresholdIndexes LedgerEntryType Signer AccountFlags SponsorshipDescriptor AccountEntryExtensionV3 AccountEntryExtensionV2 AccountEntryExtensionV2Ext AccountEntryExtensionV1 AccountEntryExtensionV1Ext AccountEntry AccountEntryExt TrustLineFlags LiquidityPoolType TrustLineAsset TrustLineEntryExtensionV2 TrustLineEntryExtensionV2Ext TrustLineEntry TrustLineEntryExt TrustLineEntryV1 TrustLineEntryV1Ext OfferEntryFlags OfferEntry OfferEntryExt DataEntry DataEntryExt ClaimPredicateType ClaimPredicate ClaimantType Claimant ClaimantV0 ClaimableBalanceIdType ClaimableBalanceId ClaimableBalanceFlags ClaimableBalanceEntryExtensionV1 ClaimableBalanceEntryExtensionV1Ext ClaimableBalanceEntry ClaimableBalanceEntryExt LiquidityPoolConstantProductParameters LiquidityPoolEntry LiquidityPoolEntryBody LiquidityPoolEntryConstantProduct ContractDataEntry ContractCodeEntry ConfigSettingType ConfigSetting ConfigSettingId ConfigSettingEntry ConfigSettingEntryExt LedgerEntryExtensionV1 LedgerEntryExtensionV1Ext LedgerEntry LedgerEntryData LedgerEntryExt LedgerKey LedgerKeyAccount LedgerKeyTrustLine LedgerKeyOffer LedgerKeyData LedgerKeyClaimableBalance LedgerKeyLiquidityPool LedgerKeyContractData LedgerKeyContractCode LedgerKeyConfigSetting EnvelopeType UpgradeType StellarValueType LedgerCloseValueSignature StellarValue StellarValueExt LedgerHeaderFlags LedgerHeaderExtensionV1 LedgerHeaderExtensionV1Ext LedgerHeader LedgerHeaderExt LedgerUpgradeType LedgerUpgrade LedgerUpgradeConfigSetting BucketEntryType BucketMetadata BucketMetadataExt BucketEntry TxSetComponentType TxSetComponent TxSetComponentTxsMaybeDiscountedFee TransactionPhase TransactionSet TransactionSetV1 GeneralizedTransactionSet TransactionResultPair TransactionResultSet TransactionHistoryEntry TransactionHistoryEntryExt TransactionHistoryResultEntry TransactionHistoryResultEntryExt TransactionResultPairV2 TransactionResultSetV2 TransactionHistoryResultEntryV2 TransactionHistoryResultEntryV2Ext LedgerHeaderHistoryEntry LedgerHeaderHistoryEntryExt LedgerScpMessages ScpHistoryEntryV0 ScpHistoryEntry LedgerEntryChangeType LedgerEntryChange LedgerEntryChanges OperationMeta TransactionMetaV1 TransactionMetaV2 ContractEventType ContractEvent ContractEventBody ContractEventV0 OperationEvents TransactionMetaV3 TransactionMeta TransactionResultMeta TransactionResultMetaV2 UpgradeEntryMeta LedgerCloseMetaV0 LedgerCloseMetaV1 LedgerCloseMetaV2 LedgerCloseMeta ErrorCode SError SendMore AuthCert Hello Auth IpAddrType PeerAddress PeerAddressIp MessageType DontHave SurveyMessageCommandType SurveyMessageResponseType SurveyRequestMessage SignedSurveyRequestMessage EncryptedBody SurveyResponseMessage SignedSurveyResponseMessage PeerStats PeerStatList TopologyResponseBodyV0 TopologyResponseBodyV1 SurveyResponseBody TxAdvertVector FloodAdvert TxDemandVector FloodDemand StellarMessage AuthenticatedMessage AuthenticatedMessageV0 LiquidityPoolParameters MuxedAccount MuxedAccountMed25519 DecoratedSignature LedgerFootprint OperationType CreateAccountOp PaymentOp PathPaymentStrictReceiveOp PathPaymentStrictSendOp ManageSellOfferOp ManageBuyOfferOp CreatePassiveSellOfferOp SetOptionsOp ChangeTrustAsset ChangeTrustOp AllowTrustOp ManageDataOp BumpSequenceOp CreateClaimableBalanceOp ClaimClaimableBalanceOp BeginSponsoringFutureReservesOp RevokeSponsorshipType RevokeSponsorshipOp RevokeSponsorshipOpSigner ClawbackOp ClawbackClaimableBalanceOp SetTrustLineFlagsOp LiquidityPoolDepositOp LiquidityPoolWithdrawOp HostFunctionType ContractIdType ContractIdPublicKeyType InstallContractCodeArgs ContractId ContractIdFromEd25519PublicKey CreateContractArgs HostFunction AuthorizedInvocation AddressWithNonce ContractAuth InvokeHostFunctionOp Operation OperationBody HashIdPreimage HashIdPreimageOperationId HashIdPreimageRevokeId HashIdPreimageEd25519ContractId HashIdPreimageContractId HashIdPreimageFromAsset HashIdPreimageSourceAccountContractId HashIdPreimageCreateContractArgs HashIdPreimageContractAuth MemoType Memo TimeBounds LedgerBounds PreconditionsV2 PreconditionType Preconditions TransactionV0 TransactionV0Ext TransactionV0Envelope Transaction TransactionExt TransactionV1Envelope FeeBumpTransaction FeeBumpTransactionInnerTx FeeBumpTransactionExt FeeBumpTransactionEnvelope TransactionEnvelope TransactionSignaturePayload TransactionSignaturePayloadTaggedTransaction ClaimAtomType ClaimOfferAtomV0 ClaimOfferAtom ClaimLiquidityAtom ClaimAtom CreateAccountResultCode CreateAccountResult PaymentResultCode PaymentResult PathPaymentStrictReceiveResultCode SimplePaymentResult PathPaymentStrictReceiveResult PathPaymentStrictReceiveResultSuccess PathPaymentStrictSendResultCode PathPaymentStrictSendResult PathPaymentStrictSendResultSuccess ManageSellOfferResultCode ManageOfferEffect ManageOfferSuccessResult ManageOfferSuccessResultOffer ManageSellOfferResult ManageBuyOfferResultCode ManageBuyOfferResult SetOptionsResultCode SetOptionsResult ChangeTrustResultCode ChangeTrustResult AllowTrustResultCode AllowTrustResult AccountMergeResultCode AccountMergeResult InflationResultCode InflationPayout InflationResult ManageDataResultCode ManageDataResult BumpSequenceResultCode BumpSequenceResult CreateClaimableBalanceResultCode CreateClaimableBalanceResult ClaimClaimableBalanceResultCode ClaimClaimableBalanceResult BeginSponsoringFutureReservesResultCode BeginSponsoringFutureReservesResult EndSponsoringFutureReservesResultCode EndSponsoringFutureReservesResult RevokeSponsorshipResultCode RevokeSponsorshipResult ClawbackResultCode ClawbackResult ClawbackClaimableBalanceResultCode ClawbackClaimableBalanceResult SetTrustLineFlagsResultCode SetTrustLineFlagsResult LiquidityPoolDepositResultCode LiquidityPoolDepositResult LiquidityPoolWithdrawResultCode LiquidityPoolWithdrawResult InvokeHostFunctionResultCode InvokeHostFunctionResult OperationResultCode OperationResult OperationResultTr TransactionResultCode InnerTransactionResult InnerTransactionResultResult InnerTransactionResultExt InnerTransactionResultPair TransactionResult TransactionResultResult TransactionResultExt Hash Uint256 Uint32 Int32 Uint64 Int64 ExtensionPoint CryptoKeyType PublicKeyType SignerKeyType PublicKey SignerKey SignerKeyEd25519SignedPayload Signature SignatureHint NodeId AccountId Curve25519Secret Curve25519Public HmacSha256Key HmacSha256Mac" -- "${cur}"))
                    return 0
                    ;;
                --xdr)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --output)
                    COMPREPLY=($(compgen -W "default json" -- "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__serve)
            opts="-h --port --ledger-file --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                --port)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --ledger-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        soroban__version)
            opts="-h --help"
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
    esac
}

complete -F _soroban -o bashdefault -o default soroban
Enter fullscreen mode Exit fullscreen mode

Conclusion

We've now explored three more soroban-cli commands: soroban lab, soroban version, and soroban completion.
soroban lab gives you access to experimental features and in-depth tools for Soroban.
soroban version simply prints the version of the soroban-cli you have installed. This is useful for checking for updates and reporting issues.
And soroban completion sets up shell autocompletion for the soroban-cli to save typing and prevent errors.
With this, you now know how to manage versions, use advanced features such as wrap token, and improve your workflow with the soroban-cli. You're well on your way to becoming a soroban-cli expert!

Top comments (0)