# `send`

Executes a Safe transaction from the connected Safe or sends it to the Safe Transaction Service if it isn't executable.

- If the `threshold` of the connected Safe is greater than `1`, it creates the Safe transaction and submits it to the Safe Transaction Service to collect the signatures from the Safe owners.
- If the `threshold` of the connected Safe is `1`, it executes the Safe transaction.
- If the connected Safe is not deployed, it deploys it using the funds from the connected signer to pay for the transaction fees, and executes the transaction or sends it to the Safe Transaction Service, depending on the `threshold`.


## Usage


<Tabs items={['example.ts', 'setup.ts']}>
  <Tabs.Tab>
    ```typescript
    import { safeClient } from './setup.ts'

    const transactions = [{
      to: '0x...',
      data: '0x...',
      value: '0',
      operation: 1 // Optional
    },
    {
      to: '0x...',
      data: '0x...',
      value: '0',
      operation: 1 // Optional
    }]

    const txResult = await safeClient.send({
      transactions,
      from: '0x...', // Optional
      gasLimit: '123', // Optional
      gasPrice: '123', // Optional
      maxFeePerGas: '123', // Optional
      maxPriorityFeePerGas: '123', // Optional
      nonce: 123 // Optional
    })
    ```
  </Tabs.Tab>
  <Tabs.Tab>
    ```typescript
    import { createSafeClient } from '@safe-global/sdk-starter-kit'

    export const safeClient = await createSafeClient({
      provider,
      signer,
      safeAddress: '0x...'
    })
    ```
  </Tabs.Tab>
</Tabs>


## Returns

`Promise<SafeClientResult>`

The result of the Safe transaction sent.

## Parameters

### `transactions.to`

- **Type:** `string`

The address of the recipient.

```typescript focus=3
const txResult = await safeClient.send({
  transactions: [{
    to: '0x...',
    value: '123',
    data: '0x'
  }]
})
```

### `transactions.value`

- **Type:** `string`

The amount of native tokens that are transferred.

```typescript focus=4
const txResult = await safeClient.send({
  transactions: [{
    to: '0x...',
    value: '123',
    data: '0x'
  }]
})
```

### `transactions.data`

- **Type:** `string`

The encoded transaction data.

```typescript focus=5
const txResult = await safeClient.send({
  transactions: [{
    to: '0x...',
    value: '123',
    data: '0x'
  }]
})
```

### `transactions.operation` (Optional)

- **Type:** `OperationType`

- **Default:** `1`

The operation of the Safe transaction.

```typescript focus=6
const txResult = await safeClient.send({
  transactions: [{
    to: '0x...',
    value: '123',
    data: '0x',
    operation: 0
  }]
})
```

### `from` (Optional)

- **Type:** `string`

The address of the transaction sender.

```typescript focus=3
const txResult = await safeClient.send({
  transactions,
  from: '0x...'
})
```

### `gasLimit` (Optional)

- **Type:** `stringnumber | string | bigint`

The maximum amount of gas the transaction can use.

```typescript focus=3
const txResult = await safeClient.send({
  transactions,
  gasLimit: '123'
})
```

### `gasPrice` (Optional)

- **Type:** `number | string`

The price in wei that the sender is willing to pay for each unit of gas.

```typescript focus=3
const txResult = await safeClient.send({
  transactions,
  gasPrice: '123'
})
```

### `maxFeePerGas` (Optional)

- **Type:** `number | string`

The maximum fee per gas the sender is willing to pay.

```typescript focus=3
const txResult = await safeClient.send({
  transactions,
  maxFeePerGas: '123'
})
```

### `maxPriorityFeePerGas` (Optional)

- **Type:** `number | string`

The maximum priority fee per gas the sender is willing to pay.

```typescript focus=3
const txResult = await safeClient.send({
  maxPriorityFeePerGas: '123'
})
```

### `nonce` (Optional)

- **Type:** `number | string`

The nonce of the transaction.

```typescript focus=3
const txResult = await safeClient.send({
  transactions,
  nonce: 123
})
```
