# Commands available in unattended mode

In addition to the use cases referenced in the sections [Common commands for both modes](./common-commands.mdx) and [Commands specific to the tx-service mode](./tx-service-commands.mdx) it is possible to execute some commands without using the interactive prompt. This facilitates the use of `safe-cli` in generating scripts or automated processes.

The commands available for direct execution without the use of the interactive prompt are:

- send-custom
- send-ether
- send-erc20
- send-erc721
- tx-builder

These commands are executed in the same way as the interactive prompt commands in `blockchain` mode.


## Usage and common parameters

```bash
safe-cli command [OPTIONS] ARG1 ARG2 ARGN
```

All commands available without using the interactive prompt share the following common arguments:

- `--private-key`: The list of private keys necessary for each operation. The `--private-key` option must be added as keys are often necessary. It is possible to specify the key value directly after the `--private-key`, or to pass the name of an environment variable containing the private key.
- `--interactive / --non-interactive`: Indicates if the execution of the command requires user interaction, such as a confirmation before executing a transaction. By default, it has the value `--interactive`, but it is possible to avoid any confirmation by using `--non-interactive`. This is useful for scripting and automation, where no user intervention is required.


## Transactions

### Send custom transactions

Sends a custom transaction from the Safe account to a contract. If `--delegate` is set, a `delegatecall` will be triggered.

```bash
safe-cli send-custom [OPTIONS] SAFE_ADDRESS NODE_URL TO VALUE DATA

╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    safe_address      CHECKSUMADDRESS  The address of the Safe. [required]                                  │
│ *    node_url          TEXT             Ethereum node url. [required]                                        │
│ *    to                CHECKSUMADDRESS  The address of destination. [required]                               │
│ *    value             INTEGER          Value to send. [required]                                            │
│ *    data              HEXBYTES         HexBytes data to send. [required]                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --private-key                         TEXT     List of private keys of signers.                              │
│ --safe-nonce                          INTEGER  Force nonce for tx_sender                                     │
│ --delegate       --no-delegate                 Use DELEGATE_CALL. By default use CALL [default: no-delegate] │
│ --interactive    --non-interactive             Enable/disable interactive mode.                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

### Send ether

Sends ether from the Safe to another account.

```bash
safe-cli send-ether [OPTIONS] SAFE_ADDRESS NODE_URL TO VALUE

╭─ Arguments ────────────────────────────────────────────────────────────────────────╮
│ *    safe_address      CHECKSUMADDRESS  The address of the Safe. [required]        |
│ *    node_url          TEXT             Ethereum node url. [required]              │
│ *    to                CHECKSUMADDRESS  The address of destination. [required]     │
│ *    value             INTEGER          Amount of ether in wei to send. [required] │
╰────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────╮
│ --private-key                         TEXT     List of private keys of signers.    │
│ --safe-nonce                          INTEGER  Force nonce for tx_sender           │
│ --interactive    --non-interactive             Enable/disable interactive mode.  │
╰────────────────────────────────────────────────────────────────────────────────────╯
```

### Send ERC-20 tokens

Sends an ERC-20 token from the Safe account to a different one.

```bash
safe-cli send-erc20 [OPTIONS] SAFE_ADDRESS NODE_URL TO TOKEN_ADDRESS AMOUNT

╭─ Arguments ────────────────────────────────────────────────────────────────────────────────╮
│ *    safe_address      CHECKSUMADDRESS  The address of the Safe. [required]                |
│ *    node_url          TEXT             Ethereum node url. [required]                      │
│ *    to                CHECKSUMADDRESS  The address of destination. [required]             │
│ *    token_address      CHECKSUMADDRESS  Erc20 token address. [required]                   │
│ *    amount             INTEGER          Amount of erc20 tokens in wei to send. [required] │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────╮
│ --private-key                         TEXT     List of private keys of signers.            │
│ --safe-nonce                          INTEGER  Force nonce for tx_sender                   │
│ --interactive    --non-interactive             Enable/disable interactive mode.          │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
```

### Send ERC-721 tokens

Sends an ERC-721 token from the Safe account to a different one.

```bash
safe-cli send-erc721 [OPTIONS] SAFE_ADDRESS NODE_URL TO TOKEN_ADDRESS TOKEN_ID

╭─ Arguments ───────────────────────────────────────────────────────────────────────╮
│ *    safe_address      CHECKSUMADDRESS  The address of the Safe. [required]       |
│ *    node_url          TEXT             Ethereum node url. [required]             │
│ *    to                CHECKSUMADDRESS  The address of destination. [required]    │
│ *    token_address      CHECKSUMADDRESS  Erc20 token address. [required]          │
│ *    token_id           INTEGER          Erc721 token id. [required]              │
╰───────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────╮
│ --private-key                         TEXT     List of private keys of signers.   │
│ --safe-nonce                          INTEGER  Force nonce for tx_sender          │
│ --interactive    --non-interactive             Enable/disable interactive mode. │
╰───────────────────────────────────────────────────────────────────────────────────╯
```

### Transaction builder

Execute a transaction or transaction batch from a `JSON` file. The format of the file is the same as the one used from the [Safe\{Wallet}](https://app.safe.global) website in the `Transaction Builder` application.

This [guide](https://help.safe.global/en/articles/234052-transaction-builder) explains how to use the tx-builder application.

```bash
safe-cli tx-builder [OPTIONS] SAFE_ADDRESS NODE_URL FILE_PATH

╭─ Arguments ────────────────────────────────────────────────────────────────────────╮
│ *    safe_address      CHECKSUMADDRESS  The address of the Safe. [required]        │
│ *    node_url          TEXT             Ethereum node url. [required]              │
│ *    file_path         FILE             File path with tx_builder data. [required] |
╰────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────╮
│ --private-key                         TEXT     List of private keys of signers.    │
│ --interactive    --non-interactive             Enable/disable interactive mode.  │
╰────────────────────────────────────────────────────────────────────────────────────╯
```
