GetPackage - Sui

GetPackage. Returns a Move package with its modules.

GetPackage - sui [Value: 20CU]
Returns a Move package with its modules, datatypes, functions, type origins and linkage table.
gRPC: sui.rpc.v2.MovePackageService/GetPackage
Use cases

Use cases

  • Inspect a package's modules
  • Resolve a specific package version
  • Build ABI-aware tooling
Constraints

Constraints

  • Package id is required
  • Set version or at_checkpoint, not both
  • Without selector returns exactly package_id
Get started
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
grpcurl \
  -H "x-drpc-key: {API-KEY}" \
  -H "x-drpc-chain: sui" \
  -d '{
  "package_id": "0x1"
}' \
  grpc.drpc.live:443 \
  sui.rpc.v2.MovePackageService/GetPackage
Copy
Response
200
{
  "package": {
    "storage_id": "0x0000000000000000000000000000000000000000000000000000000000000001",
    "original_id": "0x0000000000000000000000000000000000000000000000000000000000000001",
    "version": "1",
    "modules": [
      {
        "name": "address",
        "functions": [
          {
            "name": "length",
            "visibility": "PUBLIC",
            "is_entry": false,
            "returns": [ { "body": { "type": "U64" } } ]
          }
        ]
      }
    ]
  }
}
Copy

Request params

Parametersobject
object
package_idstring
Required. Storage id of any version of the package.
versionstring
Optional. Return the package with exactly this version in the upgrade lineage of `package_id`. Mutually exclusive with `at_checkpoint`.
at_checkpointstring
Optional. Return the latest package version in the lineage that existed at or before this checkpoint. Checkpoints above the highest indexed one fail with `NOT_FOUND`. Mutually exclusive with `version`.

Response

200
Returns a Move package with its modules, datatypes, functions, type origins and linkage table.

Response params

object
packageobject
The package.
object
storage_idstring
On-chain object id of this package version.
original_idstring
`storage_id` of the first published version. Stable across all versions.
versionstring
Version of the package.
modulesarray_of_objects
Modules of the package.
object
namestring
Module name.
contentsstring
Serialized bytecode of the module (bytes, base64).
datatypesarray_of_objects
Structs and enums defined in the module.
functionsarray_of_objects
Functions defined in the module.
type_originsarray_of_objects
Where each datatype was first defined: `module_name`, `datatype_name`, `package_id`.
linkagearray_of_objects
Transitive dependencies: `original_id`, `upgraded_id`, `upgraded_version`.