โฑ Scheduling Transactions with Time Bounds
MEE supports time-bounded execution windows using lowerBoundTimestamp
and upperBoundTimestamp
. These parameters let you defer execution or enforce expiration on quotes, enabling powerful UX like scheduled actions, delayed bridging, market timing, and more.
๐ Why Use Time Bounds?
- Scheduled execution (e.g. trigger after a certain amount of time)
- Custom expiry (e.g. keep trying to execute for five minutes, if simulation is error still - then discard)
- Sequential execution (e.g. execute a transaction every five minutes)
๐ Setup
import { createMeeClient, toMultichainNexusAccount } from "@biconomy/abstractjs";
import { http, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base, optimism } from "viem/chains";
const eoa = privateKeyToAccount(Bun.env.PRIVATE_KEY as Hex);
const orchestrator = await toMultichainNexusAccount({
chains: [optimism, base],
transports: [http(), http()],
signer: eoa
});
const date = new Date();
const meeClient = await createMeeClient({
account: orchestrator
});
const minutesToSeconds = (input: number) => input * 60;
โก Instant Execution (Default Expiry)
Executes immediately and simulates until it passes or hits a 2-minute timeout.
const instantTxDefaultExpiryTime = await meeClient.getQuote({
instructions: [],
feeToken: {
address: '0xYourFeeTokenAddress',
chainId: base.id
},
});
โก Instant Execution with Custom Expiry
Runs immediately but expires 1 minute after quote creation if it still errors.
const instantTxCustomExpiry = await meeClient.getQuote({
instructions: [],
feeToken: {
address: '0xYourFeeTokenAddress',
chainId: base.id
},
upperBoundTimestamp: Date.now() + minutesToSeconds(1)
});
โณ Scheduled Execution
Quote wonโt be eligible to run until 5 minutes from now.
const scheduledTxQuote = await meeClient.getQuote({
instructions: [],
feeToken: {
address: '0xYourFeeTokenAddress',
chainId: base.id
},
lowerBoundTimestamp: Date.now() + minutesToSeconds(5)
});
๐ Bounded Window Execution
Will only attempt execution between 2 and 5 minutes from quote creation.
const boundedTx = await meeClient.getQuote({
instructions: [],
feeToken: {
address: '0xYourFeeTokenAddress',
chainId: base.id
},
lowerBoundTimestamp: Date.now() + minutesToSeconds(2),
upperBoundTimestamp: Date.now() + minutesToSeconds(5)
});
๐ง Developer Tips
- Timestamps are expected in seconds, not milliseconds.
- Quotes simulate continuously within the window. If execution fails for the full duration, they will revert.
- If both
lowerBoundTimestamp
andupperBoundTimestamp
are omitted, quotes execute immediately with a 2-minute fallback. - Use in combination with cleanup for robust, failure-tolerant flows.
Time-bounded scheduling unlocks a whole new level of control over supertransactionsโgiving developers precision orchestration primitives without needing custom schedulers or off-chain cron jobs.