GetFunction - Sui

GetFunction. Returns the signature of a Move function.

GetFunction - sui [Value: 20CU]
Returns the signature of a Move function: visibility, entry flag, type parameters, parameters and return types.
gRPC: sui.rpc.v2.MovePackageService/GetFunction
Use cases

Use cases

  • Build Move call transactions
  • Validate call arguments
  • Generate function bindings
Constraints

Constraints

  • Package, module and name required
  • Uses the package storage 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": "0x2",
  "module_name": "coin",
  "name": "value"
}' \
  grpc.drpc.live:443 \
  sui.rpc.v2.MovePackageService/GetFunction
Copy
Response
200
{
  "function": {
    "name": "value",
    "visibility": "PUBLIC",
    "is_entry": false,
    "type_parameters": [ {} ],
    "parameters": [
      {
        "reference": "IMMUTABLE",
        "body": {
          "type": "DATATYPE",
          "type_name": "0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin",
          "type_parameter_instantiation": [ { "type": "TYPE_PARAMETER", "type_parameter": 0 } ]
        }
      }
    ],
    "returns": [ { "body": { "type": "U64" } } ]
  }
}
Copy

Request params

Parametersobject
object
package_idstring
Required. Storage id of the package.
module_namestring
Required. Name of the module.
namestring
Required. Name of the function.

Response

200
Returns the signature of a Move function: visibility, entry flag, type parameters, parameters and return types.

Response params

object
functionobject
The function descriptor.
object
namestring
Name of the function.
visibilitystring
`PRIVATE`, `PUBLIC` or `FRIEND`.
is_entryboolean
Whether the function is an `entry` function.
type_parametersarray_of_objects
Generic type parameters: `constraints` (abilities) and `is_phantom`.
parametersarray_of_objects
Parameter types: `reference` (`IMMUTABLE`, `MUTABLE`) and `body`.
returnsarray_of_objects
Return types: `reference` and `body`.