Arbitrary Transaction Capability
Submit raw EVM transactions with explicit calldata via the Bankr API.
What You Can Do
| Operation |
Description |
| Submit calldata |
Execute pre-built calldata on any supported chain |
| Custom contract calls |
Interact with any contract using raw function calls |
| Value transfers with data |
Send ETH/MATIC while executing calldata |
JSON Schema
{
"to": "0x...",
"data": "0x...",
"value": "0",
"chainId": 8453
}
| Field |
Type |
Required |
Description |
to |
string |
Yes |
Contract address (0x + 40 hex chars) |
data |
string |
Yes |
Calldata (0x + hex, or "0x" for empty) |
value |
string |
Yes |
Wei amount as string |
chainId |
number |
Yes |
Target chain (1, 137, or 8453) |
Supported Chains
| Chain |
Chain ID |
| Ethereum |
1 |
| Polygon |
137 |
| Base |
8453 |
| Unichain |
130 |
Usage
import { execute } from "./bankr-client";
const txJson = {
to: "0x1234567890abcdef1234567890abcdef12345678",
data: "0xa9059cbb...",
value: "0",
chainId: 8453
};
await execute(`Submit this transaction: ${JSON.stringify(txJson)}`);
Integration Pattern
import { execute } from "./bankr-client";
interface ArbitraryTx {
to: string;
data: string;
value: string;
chainId: number;
}
async function submitArbitraryTx(tx: ArbitraryTx): Promise<void> {
if (!tx.to.match(/^0x[a-fA-F0-9]{40}$/)) {
throw new Error("Invalid address format");
}
if (!tx.data.startsWith("0x")) {
throw new Error("Calldata must start with 0x");
}
if (![1, 137, 8453, 130].includes(tx.chainId)) {
throw new Error("Unsupported chain");
}
const prompt = `Submit this transaction: ${JSON.stringify(tx)}`;
await execute(prompt);
}
await submitArbitraryTx({
to: "0xTokenContractAddress...",
data: "0xa9059cbb000000000000000000000000...",
value: "0",
chainId: 8453
});
Error Handling
try {
await submitArbitraryTx(tx);
} catch (error) {
if (error.message.includes("reverted")) {
console.error("Transaction reverted:", error);
} else if (error.message.includes("insufficient")) {
console.error("Insufficient funds:", error);
} else if (error.message.includes("unsupported")) {
console.error("Unsupported chain:", error);
}
}
Related Skills
bankr-client-patterns - Client setup and execute function
bankr-api-basics - API fundamentals
bankr-token-trading - Higher-level trading operations