Links
Comment on page

/v1/accounts/{address}/module/{module_name}

Get account module
Retrieves an individual module from a given account and at a specific ledger version. If the ledger version is not specified in the request, the latest ledger version is used.
The Aptos nodes prune account state history, via a configurable time window. If the requested ledger version has been pruned, the server responds with a 410.

Parameters

  • address REQUIRED: (string) - Address of account with or without a 0x prefix
  • module_name REQUIRED: (string) - Name of module to retrieve e.g. coin
  • ledger_version OPTIONAL: (string)- Ledger version to get the state of the account

Returns

  • array of:
    • bytecode (string<hex>)
      • All bytes (Vec) data is represented as hex-encoded string prefixed with 0x and fulfilled with two hex digits per byte.
    • abi (object)
      • A Move module
        • address (string<hex>) REQUIRED
          A hex encoded 32 byte Aptos account address.
        • name (string) REQUIRED
        • friends array[string] REQUIRED
          Friends of the module
        • exposed_functions array[object] REQUIRED
          Public functions of the module
        • structs array[object] REQUIRED
          Structs of the module

Example

Request
curl --request GET \
--url https://aptos-mainnet.blastapi.io/<project-id>/v1/accounts/0x1d8727df513fa2a8785d0834e40b34223daff1affc079574082baadb74b66ee4/module/{module_name} \
--header 'Content-Type: application/json'
Result
{
"bytecode": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
"abi": {
"address": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
"name": "string",
"friends": [
"0x1::aptos_coin"
],
"exposed_functions": [
{
"name": "string",
"visibility": "private",
"is_entry": true,
"generic_type_params": [
{
"constraints": [
"string"
]
}
],
"params": [
"string"
],
"return": [
"string"
]
}
],
"structs": [
{
"name": "string",
"is_native": true,
"abilities": [
"string"
],
"generic_type_params": [
{
"constraints": [
"string"
]
}
],
"fields": [
{
"name": "string",
"type": "string"
}
]
}
]
}
}