Documentation Index
Fetch the complete documentation index at: https://docs.biconomy.io/llms.txt
Use this file to discover all available pages before exploring further.
Transactions wait until conditions are met before executing—enabling limit orders, price triggers, and safe operations.
Quick Example
import { createCondition, ConditionType } from '@biconomy/abstractjs';
import { erc20Abi, parseUnits } from 'viem';
// Only execute if balance >= 100 USDC
const minBalance = createCondition({
targetContract: USDC,
functionAbi: erc20Abi,
functionName: 'balanceOf',
args: [userAddress],
value: parseUnits('100', 6),
type: ConditionType.GTE
});
// Add condition to any instruction
const instruction = await account.buildComposable({
type: 'transfer',
data: {
tokenAddress: USDC,
recipient: recipientAddress,
amount: transferAmount,
chainId: base.id,
conditions: [minBalance] // ← Waits until satisfied
}
});
How It Works
Submit Transaction → Check Conditions → Pass? Execute : Wait (PENDING)
↓
MEE rechecks periodically
↓
Conditions pass → Execute
Condition Types
| Type | Meaning | Use Case |
|---|
GTE | ≥ value | Minimum balance |
LTE | ≤ value | Maximum price |
EQ | = value | Exact state (e.g., not paused) |
Common Patterns
Minimum Balance
createCondition({
targetContract: USDC,
functionAbi: erc20Abi,
functionName: 'balanceOf',
args: [userAddress],
value: parseUnits('50', 6),
type: ConditionType.GTE
})
Contract Not Paused
createCondition({
targetContract: protocolAddress,
functionAbi: pausableAbi,
functionName: 'paused',
args: [],
value: 0n, // false
type: ConditionType.EQ
})
Multiple Conditions (AND)
All conditions must pass:
const instruction = await account.buildComposable({
type: 'default',
data: {
to: lendingProtocol,
abi: lendingAbi,
functionName: 'borrow',
args: [amount],
chainId: base.id,
conditions: [
// Must have collateral
createCondition({
targetContract: collateralToken,
functionAbi: erc20Abi,
functionName: 'balanceOf',
args: [userAddress],
value: minCollateral,
type: ConditionType.GTE
}),
// Must be healthy
createCondition({
targetContract: lendingProtocol,
functionAbi: lendingAbi,
functionName: 'getHealthFactor',
args: [userAddress],
value: parseUnits('1.5', 18),
type: ConditionType.GTE
})
]
}
});
Waiting for Conditions
Set a timeout for how long to wait:
const quote = await meeClient.getFusionQuote({
trigger: { chainId: base.id, tokenAddress: USDC, amount },
instructions: [instruction],
feeToken: { chainId: base.id, address: USDC },
upperBoundTimestamp: Math.floor(Date.now() / 1000) + 300 // Wait up to 5 min
});
const { hash } = await meeClient.executeFusionQuote({ fusionQuote: quote });
// Transaction stays PENDING until condition met or timeout
Use Cases
- Limit orders: Wait for price target
- Balance triggers: Execute when funds arrive
- Safety checks: Verify contract state before executing
- Slippage protection: Only swap at acceptable prices
Best Practices
Match Decimals
USDC = 6, WETH = 18
Limit Conditions
1-3 conditions optimal
Set Timeouts
Always set upperBoundTimestamp
Use `as const`
For type-safe ABIs