const routerAbi = [
"function limitBid((address market, uint64 deadline, address user, uint16 priceIndex, uint64 rawAmount, bool postOnly, bool useNative, uint256 baseAmount) params) payable returns (uint256)"
];
const router = new ethers.Contract(
SERA_CONTRACTS.MARKET_ROUTER,
routerAbi,
signer
);
const params = {
market: "0x...", // Market address
deadline: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now
user: await signer.getAddress(),
priceIndex: 6500, // Price book index
rawAmount: 1000000n, // Quote amount in raw units
postOnly: false, // Set true to ensure no immediate fill
useNative: false, // Set true if using ETH
baseAmount: 0n // Not used for bids
};
const tx = await router.limitBid(params);
const receipt = await tx.wait();
console.log("Order placed! TX:", receipt.hash);