Skip to content
Open
132 changes: 132 additions & 0 deletions content/api-reference/sui-grpc/move-packages.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
title: Move packages
description: Sui gRPC MovePackageService API reference
slug: reference/sui-grpc-move-packages
---

The `MovePackageService` provides methods for inspecting Move packages, functions, and data types.

## GetPackage

Fetches a Move package by its ID.

**Request**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `package_id` | string | Yes | The Move package ID |

**Response**:

| Field | Type | Description |
| --- | --- | --- |
| `package` | Package | The Move package including its modules |

```bash cURL
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/move_package_service.proto \
-d '{"package_id": "0x2"}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.MovePackageService/GetPackage
```

***

## GetFunction

Fetches a Move function definition by package, module, and function name.

**Request**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `package_id` | string | Yes | The Move package ID |
| `module_name` | string | Yes | The module name |
| `name` | string | Yes | The function name |

**Response**:

| Field | Type | Description |
| --- | --- | --- |
| `function` | FunctionDescriptor | The function definition including parameters and return types |

```bash cURL
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/move_package_service.proto \
-d '{
"package_id": "0x2",
"module_name": "coin",
"name": "balance"
}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.MovePackageService/GetFunction
```

***

## GetDatatype

Fetches a Move struct or enum definition by package, module, and name.

**Request**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `package_id` | string | Yes | The Move package ID |
| `module_name` | string | Yes | The module name |
| `name` | string | Yes | The datatype name |

**Response**:

| Field | Type | Description |
| --- | --- | --- |
| `datatype` | DatatypeDescriptor | The datatype definition including fields and abilities |

```bash cURL
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/move_package_service.proto \
-d '{
"package_id": "0x2",
"module_name": "coin",
"name": "Coin"
}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.MovePackageService/GetDatatype
```

***

## ListPackageVersions

Lists all versions of a Move package with pagination.

**Request**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `package_id` | string | Yes | The Move package ID |
| `page_size` | uint32 | No | Maximum results to return |
| `page_token` | bytes | No | Pagination token from a previous response |

**Response**:

| Field | Type | Description |
| --- | --- | --- |
| `versions` | repeated PackageVersion | List of package versions |
| `next_page_token` | bytes | Token for the next page of results |

```bash cURL
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/move_package_service.proto \
-d '{"package_id": "0x2"}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.MovePackageService/ListPackageVersions
```
61 changes: 61 additions & 0 deletions content/api-reference/sui-grpc/name-service.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Name service
description: Sui gRPC NameService API reference
slug: reference/sui-grpc-name-service
---

The `NameService` provides methods for resolving SuiNS names to addresses and vice versa.

## LookupName

Resolves a SuiNS name to its record, including the associated address.

**Request**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | The SuiNS name to look up (e.g., `example.sui`) |

**Response**:

| Field | Type | Description |
| --- | --- | --- |
| `record` | NameRecord | The name record including the resolved address |

```bash cURL
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/name_service.proto \
-d '{"name": "example.sui"}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.NameService/LookupName
```

***

## ReverseLookupName

Resolves an address to its SuiNS name.

**Request**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `address` | string | Yes | The address to reverse-lookup |

**Response**:

| Field | Type | Description |
| --- | --- | --- |
| `record` | NameRecord | The name record for the address |

```bash cURL
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/name_service.proto \
-d '{"address": "0xYOUR_ADDRESS"}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.NameService/ReverseLookupName
```
Loading
Loading