# unsafe_transferSui

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://sui-mainnet.g.alchemy.com/v2/{apiKey}

Transfers SUI to a recipient using a single coin object, which is also used to pay gas. Internally performs a split and transfer using the same coin.


Reference: https://www.alchemy.com/docs/chains/sui/sui-api-endpoints/unsafe-transfer-sui

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| signer | string | Yes | The transaction signer's Sui address. |
| sui_object_id | string | Yes | The SUI coin object to use in this transaction. |
| gas_budget | string | Yes | The gas budget, the transaction will fail if exceeded. |
| recipient | string | Yes | The address receiving the SUI. |
| amount | string | Yes | The amount of SUI to transfer. |

## Result

**result** (object): Transaction bytes and related input object metadata.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "unsafe_transferSui",
  "params": [
    "0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb",
    "0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc",
    "2000",
    "0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56",
    "2"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "txBytes": "AAACACDusw9NxnWn1JuKvt9Y6y43OPrPxVTID0snq2KqAoePVgAIAgAAAAAAAAACAgABAQEAAQECAAABAABWPugdFTAy7zJ7NJQgz5Hiio1VKMvcrlwQgJOoo4eauwEAP5wPUztPcrOOTf2Q8mwp8FLrhVq4+xkS0grC45rDvCKgEAAAAAAAIPTdUyUhkhrkLz3h/2BpV7H2ZXm6WUv66fIHIPSPLJavVj7oHRUwMu8yezSUIM+R4oqNVSjL3K5cEICTqKOHmrvoAwAAAAAAANAHAAAAAAAAAA==",
    "gas": [
      {
        "objectId": "0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc",
        "version": 1089570,
        "digest": "HUrDhmdBEtQW8LBAd2fdQrqznLedy16rPjME6WdZqCsG"
      }
    ],
    "inputObjects": [
      {
        "ImmOrOwnedMoveObject": {
          "objectId": "0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc",
          "version": 1089570,
          "digest": "HUrDhmdBEtQW8LBAd2fdQrqznLedy16rPjME6WdZqCsG"
        }
      }
    ]
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://sui-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "unsafe_transferSui",
  "params": [
    "0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb",
    "0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc",
    "2000",
    "0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56",
    "2"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'unsafe_transferSui',
    params: [
      '0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb',
      '0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc',
      '2000',
      '0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56',
      '2'
    ]
  })
};

fetch('https://sui-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "unsafe_transferSui",
    "params": ["0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb", "0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc", "2000", "0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56", "2"]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"unsafe_transferSui\",\n  \"params\": [\n    \"0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb\",\n    \"0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc\",\n    \"2000\",\n    \"0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56\",\n    \"2\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://sui-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"unsafe_transferSui\",\n  \"params\": [\n    \"0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb\",\n    \"0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc\",\n    \"2000\",\n    \"0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56\",\n    \"2\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://sui-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"unsafe_transferSui\",\n  \"params\": [\n    \"0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb\",\n    \"0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc\",\n    \"2000\",\n    \"0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56\",\n    \"2\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: unsafe_transferSui
summary: Create an unsigned transaction to send a SUI coin object to a Sui address.
description: |
  Transfers SUI to a recipient using a single coin object, which is also used to pay gas. Internally performs a split and transfer using the same coin.
params:
  - name: signer
    required: true
    description: The transaction signer's Sui address.
    schema:
      type: string
  - name: sui_object_id
    required: true
    description: The SUI coin object to use in this transaction.
    schema:
      type: string
  - name: gas_budget
    required: true
    description: The gas budget, the transaction will fail if exceeded.
    schema:
      type: string
  - name: recipient
    required: true
    description: The address receiving the SUI.
    schema:
      type: string
  - name: amount
    required: true
    description: The amount of SUI to transfer.
    schema:
      type: string
result:
  name: result
  description: Transaction bytes and related input object metadata.
  schema:
    type: object
    properties:
      txBytes:
        type: string
      gas:
        type: array
        items:
          type: object
          properties:
            objectId:
              type: string
            version:
              type: integer
            digest:
              type: string
      inputObjects:
        type: array
        items:
          type: object
examples:
  - name: Transfer SUI and pay gas from same coin
    params:
      - name: signer
        value: '0x563ee81d153032ef327b349420cf91e28a8d5528cbdcae5c108093a8a3879abb'
      - name: sui_object_id
        value: '0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc'
      - name: gas_budget
        value: '2000'
      - name: recipient
        value: '0xeeb30f4dc675a7d49b8abedf58eb2e3738facfc554c80f4b27ab62aa02878f56'
      - name: amount
        value: '2'
    result:
      name: result
      value:
        txBytes: AAACACDusw9NxnWn1JuKvt9Y6y43OPrPxVTID0snq2KqAoePVgAIAgAAAAAAAAACAgABAQEAAQECAAABAABWPugdFTAy7zJ7NJQgz5Hiio1VKMvcrlwQgJOoo4eauwEAP5wPUztPcrOOTf2Q8mwp8FLrhVq4+xkS0grC45rDvCKgEAAAAAAAIPTdUyUhkhrkLz3h/2BpV7H2ZXm6WUv66fIHIPSPLJavVj7oHRUwMu8yezSUIM+R4oqNVSjL3K5cEICTqKOHmrvoAwAAAAAAANAHAAAAAAAAAA==
        gas:
          - objectId: '0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc'
            version: 1089570
            digest: HUrDhmdBEtQW8LBAd2fdQrqznLedy16rPjME6WdZqCsG
        inputObjects:
          - ImmOrOwnedMoveObject:
              objectId: '0x003f9c0f533b4f72b38e4dfd90f26c29f052eb855ab8fb1912d20ac2e39ac3bc'
              version: 1089570
              digest: HUrDhmdBEtQW8LBAd2fdQrqznLedy16rPjME6WdZqCsG
```
