Shield is source-agnostic. Any valid EVM transaction calldata can be simulated and validated, regardless of where it came from.
Supported Sources
DEX Aggregators
1inch, 0x Protocol, Paraswap, Odos, KyberSwap, OpenOcean
DeFi Protocols
Aave, Compound, Uniswap, Yearn, Morpho, Maker
Custom Contracts
Your own smart contracts, multisig wallets, ERC-4337 UserOps
Example: Custom Contract Interaction
Encode a contract call with viem and simulate it with Shield.
import { encodeFunctionData, parseAbi } from "viem";
// Step 1: Encode your contract call
const data = encodeFunctionData({
abi: parseAbi(["function deposit(uint256 amount, address receiver) returns (uint256)"]),
functionName: "deposit",
args: [1000000000n, "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"],
});
// Step 2: Simulate with Shield
const simulation = await fetch("https://shield.api.enso.build/api/v1/simulate", {
method: "POST",
headers: {
"Authorization": `Bearer ${ENSO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
chainId: 1,
transaction: {
data,
value: "0",
to: "0xa354F35829Ae975e850e23e9615b11Da1B3dC4DE",
from: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
},
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"],
tokenOut: ["0xa354F35829Ae975e850e23e9615b11Da1B3dC4DE"],
amountIn: ["1000000000"],
}),
}).then((res) => res.json());
Mapping Transaction Fields
When working with different web3 libraries, here’s how to extract the fields Shield expects:
| Shield Field | viem | ethers.js v6 | web3.js |
|---|
data | tx.data | tx.data | tx.data |
to | tx.to | tx.to | tx.to |
from | tx.from | tx.from | tx.from |
value | tx.value.toString() | tx.value.toString() | tx.value |
Shield does not modify your transaction. It only simulates and validates. The transaction you submit on-chain is exactly what you built.