Chain ID to network
The module normalizes common chain IDs to network names so callers can use chainId for Ethereum, Base, Polygon, Arbitrum, and Optimism without manual translation.
Use direct execution when a task is too small for a workflow but still needs the SDK's typed transport, chain normalization, and completion polling. This module covers transfers, contract calls, and conditional check-and-execute flows.
The namespaced directExecute module exposes both action methods and a polling helper for completion status.
| Method | Purpose | Notes |
|---|---|---|
| transfer(input) | Send native currency or ERC-20 tokens | Use tokenAddress for ERC-20s; omit it for native transfers |
| contractCall(input) | Call a contract function | Provide ABI, function name, args, and optional value |
| checkAndExecute(input) | Read a value and execute conditionally | Useful for guard-rail automation |
| getStatus(executionId) | Read direct execution state | Returns the current direct execution object |
| waitForCompletion(executionId, options) | Poll until terminal | Stops when status is completed or failed |
The module normalizes common chain IDs to network names so callers can use chainId for Ethereum, Base, Polygon, Arbitrum, and Optimism without manual translation.
When a direct execution API key is provided, the module sends it as X-API-Key on requests that need it.
These examples mirror the README while staying focused on the two most common direct execution use cases.
const transfer = await client.directExecute.transfer({
chainId: 8453,
to: "0xRecipientAddress",
amount: "1000000",
tokenAddress: "0xTokenAddress",
});
const transferResult = await client.directExecute.waitForCompletion(transfer.id);
const call = await client.directExecute.contractCall({
chainId: 1,
contractAddress: "0xContractAddress",
functionName: "approve",
abi: [/* ABI array */],
args: ["0xSpender", "1000000000000000000"],
});
The conditional flow reads on-chain state first, compares it against a condition, and only sends the write call when the predicate is satisfied.
waitForCompletion hides the polling loop and returns the final execution object when the action reaches a completed or failed state.
Use the smallest unit for amounts and remember that direct execution is intended for operations that do not need a full workflow graph or marketplace publication.