https://*.lootex.dev
domain if you are developing client-side applicationsnpm install lootex
First, initialize the Lootex client:
import { createLootexClient } from 'lootex';
const lootex = createLootexClient({
environment: 'development',
apiKey: 'your-api-key', // currently not required
});
You can fetch orders using the API client:
const { orders } = await lootex.apiClient.getOrders({
chainId: 137,
limit: 10,
page: 1,
});
To fulfill orders, create an aggregator instance:
import { createAggregator } from 'lootex/aggregator';
const aggregator = createAggregator({
client: lootex,
});
The fulfillment process typically involves multiple steps:
const execution = await aggregator.fulfillOrders([orders[0]]);
const approveTxData = await execution.actions[0].buildTransaction();
const approveTx = await yourWallet.sendTransaction(approveTxData);
// Wait for approval transaction to be confirmed
const exchangeTxData = await execution.actions[1].buildTransaction();
const exchangeTx = await yourWallet.sendTransaction(exchangeTxData);
// Wait for exchange transaction to be confirmed
Once all transactions are confirmed, the order fulfillment is complete!