# Sui

### /getsuibalance

Get the balance or number of the given token in the requested public address.

<mark style="color:blue;">`GET`</mark> `https://historicallp.api.expand.network/chain/getsuibalance`

#### Query Parameters

| Name                                      | Type   | Description                                                                                                                                 |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| rpc                                       | String | Remote procedural call URL                                                                                                                  |
| chainId<mark style="color:red;">\*</mark> | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                        |
| chainSymbol                               | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                        |
| blockNumber                               | String | <p>Block number for which the balance needs to be retrieved.</p><p>By default, it will pick the latest block number when not specified.</p> |
| address<mark style="color:red;">\*</mark> | String | The public address to get the balance of.                                                                                                   |
| tokenAddress                              | String | The address of token to get the balance of.                                                                                                 |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://historicallp.api.expand.network/chain/getsuibalance?chainId=101&address=0x160d7516429e4b5c6e593ab4b5c162484b4719961f5411f1ad48670278334eec&blockNumber=34214422
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "balance": "61175416762399"
    }
}
```

{% endtab %}
{% endtabs %}

### /getblock

Get details of a block.

<mark style="color:blue;">`GET`</mark> `https://historicallp.api.expand.network/chain/getblock`

#### Query Parameters

| Name                                          | Type   | Description                                                                          |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                           | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark>     | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                   | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| blockNumber<mark style="color:red;">\*</mark> | String | The block(Checkpoint) number or block hash.                                          |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://historicallp.api.expand.network/chain/getblock?blockNumber=4925305&chainId=101
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "difficulty": null,
        "gasLimit": null,
        "gasUsed": {
            "computationFee": "319667546316",
            "storageFee": "1667423348400",
            "storageRebate": "1188416311632",
            "nonRefundableStorageFee": "12004205168"
        },
        "hash": "gZArqpuwddYeuxyK582fs5tTYeagBw6NBU1RD314hzC",
        "miner": null,
        "nonce": null,
        "number": "4925305",
        "parentHash": "8cFaKwc7s52Mt8csDbcqRizCTXGzRLFFkUf8cpw7pb2D",
        "size": null,
        "timestamp": "1686567354670",
        "totalDifficulty": null,
        "transactions": [
            "8SoUvGSix7Ds3qnLRh2Pe2dGHPsnMWM6wv7j8g2XBBs8",
            "8zEWsQkgTdFtqzeGu6aBUgDe6Hysqdfv7LEhDxt4so8p",
            "C8j1ZR3immv3a6bGRUwFnEZ8SNd794nKFL4acLu4pg1C",
            "CaYL9Vg57rHSwsgaHhT8WoXXDfftcozbtaKiJVgk7qA7",
            "Fkm8avKi2qxeTS8aDKeohyn4DT1psoC8Et8jPEXQuxhS",
            "GECi5Pe5MNgUzPSUcwDp1CcBxUiHiZegs4LPvRb21wTU",
            "JAznEFvDf3Wm3C8uyPi1kNEBJcj88x4HgfyPATUUjEGz"
        ],
        "transactionsRoot": null,
        "uncles": null
    }
}
```

{% endtab %}
{% endtabs %}

### /getgasprice

Get the current gas price from the network.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/chain/getgasprice`

#### Query Parameters

| Name                                      | Type   | Description                                                                          |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                       | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark> | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                               | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/chain/getgasprice?chainId=101
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "gasPrice": 820
    }
}
```

{% endtab %}
{% endtabs %}

### /getstorage

Get data stored in the given slot.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/chain/getstorage`

#### Query Parameters

| Name                                      | Type   | Description                                                                          |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                       | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark> | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                               | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| address<mark style="color:red;">\*</mark> | String | Object Id whose storage is needed.                                                   |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/chain/getstorage?chainId=101&address=0x2c0c60250556852f3391645418c3a1939557ef3f86197bfd8d5f08e42bf8a562
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "data": {
            "data": {
                "objectId": "0x2c0c60250556852f3391645418c3a1939557ef3f86197bfd8d5f08e42bf8a562",
                "version": "5832321",
                "digest": "4U8VJLHhmwcSLQKZ4E94i3LpVkfTEgqTs2JvJnaHjAWE",
                "type": "0x2::coin::Coin<0x2::sui::SUI>",
                "owner": {
                    "AddressOwner": "0x4e6c09c10308e273b01f9be9f4eebc4cd47408156dcf580036946ca17468efbd"
                },
                "previousTransaction": "BTA1oPx1mxoh8eE7abaZjn68661kmK5HR778Xh5wnDhV",
                "content": {
                    "dataType": "moveObject",
                    "type": "0x2::coin::Coin<0x2::sui::SUI>",
                    "hasPublicTransfer": true,
                    "fields": {
                        "balance": "3247896304",
                        "id": {
                            "id": "0x2c0c60250556852f3391645418c3a1939557ef3f86197bfd8d5f08e42bf8a562"
                        }
                    }
                }
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

### /gettransaction

Get details of a transaction.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/chain/gettransaction`

#### Query Parameters

| Name                                              | Type   | Description                                                                          |
| ------------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                               | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark>         | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                       | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| transactionHash<mark style="color:red;">\*</mark> | String | The transaction(digest) hash.                                                        |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/chain/gettransaction?chainId=101&transactionHash=fcT9BaBGgRXHo2ngJAVAPACnYVUPtu1qAmUqLACNGZ2
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "hash": "fcT9BaBGgRXHo2ngJAVAPACnYVUPtu1qAmUqLACNGZ2",
        "transactionStatus": "success",
        "blockNumber": "5851982",
        "timestamp": "1687511099697",
        "from": "0x3171f5feed9f73a6ce73764c8c713816c8ad02b3cd2c72bfb46421bee417f488",
        "to": null,
        "value": null,
        "transactionFees": {
            "computationFee": "820000",
            "storageFee": "8048400",
            "storageRebate": "6568452",
            "nonRefundableStorageFee": "66348"
        },
        "gas": {
            "payment": [
                {
                    "objectId": "0xe68aa8790c973b9b56de6082570aa24a6b07827e11e8d7c76de36c8a55f7e1a2",
                    "version": 5752185,
                    "digest": "DUGMzaGpSsQHS5DvcZmCTFupJxRWEmjm1H3YcCyNRv4p"
                }
            ],
            "owner": "0x1d632d46ff70491033fefc4e6398dceaa4943dcf62512b4d57378b5ab703bc5e",
            "price": "820",
            "budget": "10000000"
        },
        "gasPrice": 820,
        "input": [
            {
                "type": "object",
                "objectType": "sharedObject",
                "objectId": "0xa12497d95f761a3d7337e1f690c4dbbee5bc6fa52302a97d10249e856062aee5",
                "initialSharedVersion": "4338970",
                "mutable": true
            }
        ],
        "nonce": null,
        "network": null
    }
}
```

{% endtab %}
{% endtabs %}

### **/sendtransaction**

Send transaction on the chain.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/chain/sendtransaction`

#### Request Body

| Name                                             | Type   | Description                                                                          |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------ |
| rpc                                              | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark>        | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                      | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| rawTransaction<mark style="color:red;">\*</mark> | String | The encoded transaction, obtained from the signed transaction.                       |
| signature<mark style="color:red;">\*</mark>      | String | Signature, received after signing the transaction.                                   |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "chainId": "101",
    "rawTransaction": "AAACAAjoAwAAAAAAAAAgjoLsljoRhNzWIhv109/7Y5u+3rE+m3cIAS6+9fY1CV0CAgABAQAAAQEDAAAAAAEBAHU9KMxqJHko4cO7vudRc1fUWhlgTsWqhC49Sd/RqeJ3AWLHsjiaUXCf24QTPngz4YscltY7WXx8EEvwMWY3bQi2EgAAAAAAAAAgAnvVen24ygZdxuPGTP5c0y9v4Q6gBEBrVZToO1VwKO91PSjMaiR5KOHDu77nUXNX1FoZYE7FqoQuPUnf0anid+gDAAAAAAAAEJAtAAAAAAAA",
    "signature": "AIZ7D4E4VKOy2biUd2O7Wayjjj+voVX1fUtX7Hx5Ga/twHIZ1BbfMrMoPDLIWU774K0199NZXrFIw+aILTTj7Q5Dii+a4T1FLWxQvLizpwhD6VXBW4qPG0vYYOJ2O0GuhQ=="
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "101",
        "transactionHash": "67yEnYvTfkNnKPtxrLfYomhWoi5cH7XCPbVQtjJ3UAW9" 
    }
}
```

{% endtab %}
{% endtabs %}
