# `encodeTransactionData`

Encodes the transaction data for `execTransaction`.

## Usage


<Tabs items={['example.sol']}>
  <Tabs.Tab>
    ```solidity
    interface ISafe {
        function encodeTransactionData(
            address to,
            uint256 value,
            bytes data,
            Enum.Operation operation,
            uint256 safeTxGas,
            uint256 baseGas,
            uint256 gasPrice,
            address gasToken,
            address refundReceiver,
            uint256 _nonce
        ) external view returns (bytes);
    }

    contract Example {
        function example() ... {
            (ISafe safe).encodeTransactionData(
                0x...,
                0,
                "0x...",
                Enum.Operation.Call,
                100000,
                0,
                0,
                0x...,
                0x...,
                1
            );
        }
    }
    ```
  </Tabs.Tab>
</Tabs>


## Returns

- **Type:** `bytes`

Encoded transaction data.

## Parameters

### `to`

- **Type:** `address`

Destination address.

```solidity focus=2
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `value`

- **Type:** `uint256`

Native token value.

```solidity focus=3
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `data`

- **Type:** `bytes`

Data payload.

```solidity focus=4
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `operation`

- **Type:** `enum Enum.Operation`

Operation type.

```solidity focus=5
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `safeTxGas`

- **Type:** `uint256`

Gas that should be used for the Safe transaction.

```solidity focus=6
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `baseGas`

- **Type:** `uint256`

Gas costs for data used to trigger the Safe transaction.

```solidity focus=7
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `gasPrice`

- **Type:** `uint256`

Maximum gas price that should be used for this transaction.

```solidity focus=8
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `gasToken`

- **Type:** `address`

Token address (or `address(0)` if native token) that is used for the payment.

```solidity focus=9
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `refundReceiver`

- **Type:** `address`

Address of receiver of gas payment (or `address(0)` if `tx.origin`).

```solidity focus=10
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```

### `_nonce`

- **Type:** `uint256`

Transaction nonce.

```solidity focus=11
(ISafe safe).encodeTransactionData(
    0x...,
    0,
    "0x...",
    Enum.Operation.Call,
    100000,
    0,
    0,
    0x...,
    0x...,
    1
);
```
