How It Works
The build-raw flow:- Accepts pre-encoded calldata - Raw hex strings representing complete function calls
- Validates calldata format - Ensures proper hex encoding
- Generates instructions - Creates executable MEE instructions
- Enables composition - Combines with other flow types seamlessly
When to Use BuildRaw
✅ Use BuildRaw When
- You have pre-generated calldata from another system
- You need exact control over the calldata format
- You’re migrating from a system that already encodes calldata
- You want to avoid ABI parsing overhead client-side
❌ Use /instructions/build Instead
- You need runtime balance injection
- You want the API to handle encoding
- You prefer working with function signatures
- You want more readable code
Key Differences from Build
Feature | /instructions/build | /instructions/build-raw |
---|---|---|
Input | Function signature + args | Pre-encoded calldata |
Runtime Balance | ✅ Supported | ❌ NOT Supported |
Client Encoding | API encodes | Client encodes |
Use Case | Most common operations | Advanced/custom calldata |
Critical Limitation: BuildRaw does NOT support runtime balance injection. The calldata must be fully encoded client-side with concrete values. If you need runtime balance (e.g., transferring all remaining tokens), use
/instructions/build
instead.Parameters
When using/instructions/build-raw
in your composeFlows
array:
Parameter | Type | Required | Description |
---|---|---|---|
data | string | Yes | Pre-encoded calldata as hex string (e.g., “0xa9059cbb…”) |
to | string | Yes | Target contract address (checksummed) |
chainId | number | Yes | Chain ID for execution |
value | string | No | Native token value in wei (default: “0”) |
gasLimit | string | No | Gas limit override |
Complete Workflow Examples
- Simple ERC20 Transfer
- WETH Deposit with Value
- Combining with /build
Transfer tokens using pre-encoded calldata
BuildRaw vs Build Decision Guide
Best Practices
Validate Encoded Calldata
Validate Encoded Calldata
Always validate your encoded calldata before sending:
Set Appropriate Gas Limits
Set Appropriate Gas Limits
Override gas limits for complex operations:
Know When to Use Build Instead
Know When to Use Build Instead
Use
/instructions/build
when you need:- Runtime balance injection for dynamic amounts
- Better code readability with function signatures
- API-side encoding to reduce client complexity
/instructions/build-raw
when you need:- Pre-encoded calldata from external systems
- Exact control over calldata format
- Migration from existing systems with encoded data
Test with Small Amounts First
Test with Small Amounts First
Always test your encoded calldata with small amounts:
Common Use Cases
Pre-generated Transaction Data
Multicall Operations
Troubleshooting
Invalid calldata format
Invalid calldata format
Ensure your calldata:
- Starts with
0x
- Is a valid hex string
- Has even length (excluding
0x
) - Matches the expected function selector
Transaction reverted
Transaction reverted
Common causes:
- Incorrect calldata encoding
- Wrong function parameters or order
- Insufficient balance for operation
- Missing approvals for token operations
- Gas limit too low
Cannot use runtime balance
Cannot use runtime balance
BuildRaw does NOT support runtime balance injection. If you need dynamic amounts:
Calldata encoding mismatch
Calldata encoding mismatch
Verify your encoding matches the contract ABI: