import { Orderbook } from '@imtbl/orderbook';
// Prepare a collection bid
const { orderComponents, orderHash, typedData } = await orderbook.prepareCollectionBid({
makerAddress: address,
buy: {
type: 'ERC721_COLLECTION',
contractAddress: NFT_CONTRACT,
amount: '1', // Bidding on 1 NFT from the collection
},
sell: {
type: 'NATIVE',
amount: '500000000000000000', // Offering 0.5 IMX
},
});
// Sign the bid (gasless)
const signature = await walletClient.signTypedData({
account: address,
...typedData,
});
// Submit the bid
const { result } = await orderbook.createCollectionBid({
orderComponents,
orderHash,
orderSignature: signature,
makerFees: [],
});
console.log('Collection bid created:', result.id);