Explorer
Encode Contract Function Data
Learn how to encode function data for smart contract interactions using the Okto SDK.
Examples
Methods Overview
Methods | Description |
---|---|
EncodeFunctionData | Encode function data for smart contract interactions |
Encode Function Data
EncodeFunctionData(string abiJson, string functionName, object[] parameters)
encodes function data based on the provided ABI and parameters.
Parameters
Parameter | Type | Description |
---|---|---|
abiJson | string | The JSON ABI of the contract function |
functionName | string | The name of the function to encode |
parameters | object[] | Array of parameters for the function |
For numeric types:
- Large numbers should be passed as strings to avoid precision loss
- Hex values can be used with "0x" prefix
- Values must be within the valid range for each type
For bytes types:
- All bytes values must be hex-encoded
- Must include "0x" prefix