# unsafe_moveCall

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

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

Constructs a BCS-encoded transaction block that performs a Move call to a specific function in a Move module. This unsigned transaction must be signed and submitted separately.


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

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| signer | string | Yes | The transaction signer's Sui address. |
| package_object_id | string | Yes | The Move package ID containing the target module. |
| module | string | Yes | The name of the Move module. |
| function | string | Yes | The name of the Move function to call. |
| type_arguments | string[] | Yes | Type arguments passed to the Move function. |
| arguments | string[] | Yes | Function arguments in SuiJson format. |
| gas | string | No | Gas object to be used. Will be auto-selected if not provided. |
| gas_budget | string | Yes | Maximum gas budget for the transaction. |
| execution_mode | enum | No | Whether this is a normal execution or a dev inspect. Defaults to "Commit". |

## Result

**result** (object): An unsigned transaction block containing the Move call.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "unsafe_moveCall",
  "params": [
    "0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f",
    "0x0000000000000000000000000000000000000000000000000000000000000002",
    "bag",
    "borrow",
    [
      "0x2::devnet_nft::MintNFTEvent"
    ],
    [
      "copy",
      "drop"
    ],
    "0x30dab78d58471a78496eb71c2c6e77ba268f0390",
    "1",
    "Commit"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "gas": [
      {
        "objectId": "0x30dab78d58471a78496eb71c2c6e77ba268f0390",
        "version": "1",
        "digest": "sEnRQXe1hDGAJCFyF2ds2GmPHdvf9V6yxf24LisEsDkYt"
      }
    ],
    "inputObjects": [
      {
        "objectId": "0xa6379c19b3aa9aa878fc1deaf69c1dbb1de4224de8b62de04e4962b593e037e9",
        "version": "1",
        "digest": "EnRQXe1hDGAJCFyF2ds2GmPHdvf9V6yxf24LisEsDkYt",
        "objectType": "MoveObject"
      }
    ],
    "txBytes": "BASE64_ENCODED_TX_BYTES"
  },
  "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_moveCall",
  "params": [
    "0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f",
    "0x0000000000000000000000000000000000000000000000000000000000000002",
    "bag",
    "borrow",
    [
      "0x2::devnet_nft::MintNFTEvent"
    ],
    [
      "copy",
      "drop"
    ],
    "0x30dab78d58471a78496eb71c2c6e77ba268f0390",
    "1",
    "Commit"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'unsafe_moveCall',
    params: [
      '0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f',
      '0x0000000000000000000000000000000000000000000000000000000000000002',
      'bag',
      'borrow',
      ['0x2::devnet_nft::MintNFTEvent'],
      ['copy', 'drop'],
      '0x30dab78d58471a78496eb71c2c6e77ba268f0390',
      '1',
      'Commit'
    ]
  })
};

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_moveCall",
    "params": ["0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f", "0x0000000000000000000000000000000000000000000000000000000000000002", "bag", "borrow", ["0x2::devnet_nft::MintNFTEvent"], ["copy", "drop"], "0x30dab78d58471a78496eb71c2c6e77ba268f0390", "1", "Commit"]
}
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_moveCall\",\n  \"params\": [\n    \"0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f\",\n    \"0x0000000000000000000000000000000000000000000000000000000000000002\",\n    \"bag\",\n    \"borrow\",\n    [\n      \"0x2::devnet_nft::MintNFTEvent\"\n    ],\n    [\n      \"copy\",\n      \"drop\"\n    ],\n    \"0x30dab78d58471a78496eb71c2c6e77ba268f0390\",\n    \"1\",\n    \"Commit\"\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_moveCall\",\n  \"params\": [\n    \"0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f\",\n    \"0x0000000000000000000000000000000000000000000000000000000000000002\",\n    \"bag\",\n    \"borrow\",\n    [\n      \"0x2::devnet_nft::MintNFTEvent\"\n    ],\n    [\n      \"copy\",\n      \"drop\"\n    ],\n    \"0x30dab78d58471a78496eb71c2c6e77ba268f0390\",\n    \"1\",\n    \"Commit\"\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_moveCall\",\n  \"params\": [\n    \"0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f\",\n    \"0x0000000000000000000000000000000000000000000000000000000000000002\",\n    \"bag\",\n    \"borrow\",\n    [\n      \"0x2::devnet_nft::MintNFTEvent\"\n    ],\n    [\n      \"copy\",\n      \"drop\"\n    ],\n    \"0x30dab78d58471a78496eb71c2c6e77ba268f0390\",\n    \"1\",\n    \"Commit\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: unsafe_moveCall
summary: Create an unsigned transaction to execute a Move call
description: |
  Constructs a BCS-encoded transaction block that performs a Move call to a specific function in a Move module. This unsigned transaction must be signed and submitted separately.
params:
  - name: signer
    required: true
    description: The transaction signer's Sui address.
    schema:
      type: string
  - name: package_object_id
    required: true
    description: The Move package ID containing the target module.
    schema:
      type: string
  - name: module
    required: true
    description: The name of the Move module.
    schema:
      type: string
  - name: function
    required: true
    description: The name of the Move function to call.
    schema:
      type: string
  - name: type_arguments
    required: true
    description: Type arguments passed to the Move function.
    schema:
      type: array
      items:
        type: string
  - name: arguments
    required: true
    description: Function arguments in SuiJson format.
    schema:
      type: array
      items:
        type: string
  - name: gas
    required: false
    description: Gas object to be used. Will be auto-selected if not provided.
    schema:
      type: string
  - name: gas_budget
    required: true
    description: Maximum gas budget for the transaction.
    schema:
      type: string
  - name: execution_mode
    required: false
    description: Whether this is a normal execution or a dev inspect. Defaults to "Commit".
    schema:
      type: string
      enum:
        - Commit
        - DevInspect
result:
  name: result
  description: An unsigned transaction block containing the Move call.
  schema:
    type: object
    properties:
      gas:
        type: array
        description: The gas object(s) used.
        items:
          type: object
          properties:
            objectId:
              type: string
            version:
              type: string
            digest:
              type: string
      inputObjects:
        type: array
        description: Objects involved in the transaction.
        items:
          type: object
          properties:
            objectId:
              type: string
            version:
              type: string
            digest:
              type: string
            objectType:
              type: string
      txBytes:
        type: string
        description: Base64-encoded BCS transaction data.
examples:
  - name: Move call - borrow from bag
    params:
      - name: signer
        value: '0x00c364252964511b32b084c17a492093d5b762cbe2766d46911912718e56950f'
      - name: package_object_id
        value: '0x0000000000000000000000000000000000000000000000000000000000000002'
      - name: module
        value: bag
      - name: function
        value: borrow
      - name: type_arguments
        value:
          - 0x2::devnet_nft::MintNFTEvent
      - name: arguments
        value:
          - copy
          - drop
      - name: gas
        value: '0x30dab78d58471a78496eb71c2c6e77ba268f0390'
      - name: gas_budget
        value: '1'
      - name: execution_mode
        value: Commit
    result:
      name: result
      value:
        gas:
          - objectId: '0x30dab78d58471a78496eb71c2c6e77ba268f0390'
            version: '1'
            digest: sEnRQXe1hDGAJCFyF2ds2GmPHdvf9V6yxf24LisEsDkYt
        inputObjects:
          - objectId: '0xa6379c19b3aa9aa878fc1deaf69c1dbb1de4224de8b62de04e4962b593e037e9'
            version: '1'
            digest: EnRQXe1hDGAJCFyF2ds2GmPHdvf9V6yxf24LisEsDkYt
            objectType: MoveObject
        txBytes: BASE64_ENCODED_TX_BYTES
```
