# sui_getNormalizedMoveModulesByPackage

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

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

Returns a mapping of module names to their normalized structured representations for all modules  contained within the specified package.


Reference: https://www.alchemy.com/docs/chains/sui/sui-api-endpoints/sui-get-normalized-move-modules-by-package

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| package | string | Yes | The object ID of the package to query. |

## Result

**result** (object): A map of module names to their normalized module definitions.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "sui_getNormalizedMoveModulesByPackage",
  "params": [
    "0x0000000000000000000000000000000000000000000000000000000000000002"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "address": {
      "fileFormatVersion": 6,
      "address": "0x2",
      "name": "address",
      "friends": [],
      "structs": {},
      "exposedFunctions": {
        "from_ascii_bytes": {
          "visibility": "Public",
          "isEntry": false,
          "typeParameters": [],
          "parameters": [
            {
              "Reference": {
                "Vector": "U8"
              }
            }
          ],
          "return": [
            "Address"
          ]
        },
        "from_bytes": {
          "visibility": "Public",
          "isEntry": false,
          "typeParameters": [],
          "parameters": [
            {
              "Vector": "U8"
            }
          ],
          "return": [
            "Address"
          ]
        },
        "to_string": {
          "visibility": "Public",
          "isEntry": false,
          "typeParameters": [],
          "parameters": [
            "Address"
          ],
          "return": [
            {
              "Struct": {
                "address": "0x1",
                "module": "string",
                "name": "String",
                "typeArguments": []
              }
            }
          ]
        }
      }
    }
  },
  "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": "sui_getNormalizedMoveModulesByPackage",
  "params": [
    "0x0000000000000000000000000000000000000000000000000000000000000002"
  ]
}'
```

### JavaScript

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

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": "sui_getNormalizedMoveModulesByPackage",
    "params": ["0x0000000000000000000000000000000000000000000000000000000000000002"]
}
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\": \"sui_getNormalizedMoveModulesByPackage\",\n  \"params\": [\n    \"0x0000000000000000000000000000000000000000000000000000000000000002\"\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\": \"sui_getNormalizedMoveModulesByPackage\",\n  \"params\": [\n    \"0x0000000000000000000000000000000000000000000000000000000000000002\"\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\": \"sui_getNormalizedMoveModulesByPackage\",\n  \"params\": [\n    \"0x0000000000000000000000000000000000000000000000000000000000000002\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: sui_getNormalizedMoveModulesByPackage
summary: Get normalized representations of all Move modules in a package
description: |
  Returns a mapping of module names to their normalized structured representations for all modules  contained within the specified package.
params:
  - name: package
    required: true
    description: The object ID of the package to query.
    schema:
      type: string
result:
  name: result
  description: A map of module names to their normalized module definitions.
  schema:
    type: object
examples:
  - name: Get normalized modules by package
    params:
      - name: package
        value: '0x0000000000000000000000000000000000000000000000000000000000000002'
    result:
      name: result
      value:
        address:
          fileFormatVersion: 6
          address: '0x2'
          name: address
          friends: []
          structs: {}
          exposedFunctions:
            from_ascii_bytes:
              visibility: Public
              isEntry: false
              typeParameters: []
              parameters:
                - Reference:
                    Vector: U8
              return:
                - Address
            from_bytes:
              visibility: Public
              isEntry: false
              typeParameters: []
              parameters:
                - Vector: U8
              return:
                - Address
            to_string:
              visibility: Public
              isEntry: false
              typeParameters: []
              parameters:
                - Address
              return:
                - Struct:
                    address: '0x1'
                    module: string
                    name: String
                    typeArguments: []
```
