Build low-level custom instructions for your supertransaction
Overview
The/v1/instructions/build
endpoint enables direct control over contract interactions by specifying exact function calls. Users provide ABI signatures and arguments to generate MEE instructions for precise contract execution.
How It Works
The build endpoint creates instructions by:- Accepting function signatures - ABI-formatted function definitions
- Processing arguments - Supporting various data types and dynamic values
- Generating MEE instructions - Creates composable instructions for execution
Request Structure
Request Body
Parameter | Type | Required | Description |
---|---|---|---|
functionSignature | string | Yes | Function signature (e.g., function transfer(address to, uint256 amount) ) |
args | array | Yes | Function arguments array |
to | string | Yes | Target contract address (checksummed) |
chainId | number | Yes | Chain ID where the transaction will be executed |
value | string | No | Native token value in wei (default: “0”) |
gasLimit | string | No | Gas limit for the transaction |
Example Requests
Response
Returns an array of MEE instructions ready for execution:Response Fields
Field | Type | Description |
---|---|---|
instructions | array | Array of MEE instruction objects |
instructions[].calls | array | Array of contract calls within the instruction |
instructions[].calls[].to | string | Target contract address |
instructions[].calls[].value | string | Native token value in wei |
instructions[].calls[].functionSig | string | Function signature without “function” keyword |
instructions[].calls[].inputParams | array | Encoded input parameters |
instructions[].calls[].outputParams | array | Output parameter specifications |
instructions[].chainId | number | Chain ID for execution |
instructions[].isComposable | boolean | Whether this instruction can be composed with others |
Input Parameter Structure
Each input parameter contains:Field | Type | Description |
---|---|---|
fetcherType | number | Type of parameter fetcher (0 = static, 1 = dynamic) |
paramData | string | Encoded parameter data |
constraints | array | Optional constraints for the parameter |
Supported Argument Types
Theargs
array supports various JavaScript/TypeScript types:
-
Address: Ethereum addresses (0x-prefixed, 40 hex characters)
-
Numbers: Can be passed as strings or numbers
-
Boolean: Standard boolean values
-
Arrays: Nested arrays of any supported type
-
Bytes: Hex-encoded byte arrays
Common Use Cases
ERC20 Token Transfer
ERC20 Token Approval
Multi-Parameter Functions
Authentication
All requests require an API key to be passed in the header:Error Responses
400 Bad Request
Returned when the request is malformed or contains invalid parameters:500 Internal Server Error
Returned when the server encounters an unexpected error:Best Practices
- Use string format for large numbers: To avoid JavaScript number precision issues, pass large numbers as strings
- Verify contract addresses: Ensure all addresses are checksummed and valid
- Test on testnets first: Always test your function calls on testnets before mainnet
- Set appropriate gas limits: Include a
gasLimit
parameter for complex operations - Check function signatures: Ensure your function signature matches the target contract’s ABI exactly