ReadonlyactiveReadonlychainReadonlyidReadonlyinputsReadonlyinputsReadonlymetaReadonlyorderbookReadonlyorderReadonlyorderReadonlyoutputsReadonlyownerReadonlyrainlangReadonlytimestampReadonlytradesReadonlytransactionReadonlyvaultsConverts the order from RaindexOrder to an SgOrder type
const sgOrder = await order.convertToSgOrder();
// Do something with sgOrder
Order as SgOrder type
Executes quotes directly from complete order objects without additional data fetching
This function performs quote calculations using complete order data structures that typically come from previous subgraph queries. It generates quotes for all possible input/output token pairs within each order, providing comprehensive trading information without requiring additional network calls for order data.
const result = await getOrderQuote();
if (result.error) {
console.error("Error:", result.error.readableMsg);
return;
}
const quoteResponses = result.value;
// Do something with the quoteResponses
OptionalblockNumber: null | bigintOptional specific block number for historical quotes (uses latest if None)
Optionalgas: null | stringOptional gas limit as string for quote simulations (uses default if None)
List of batch quote responses with trading pair information
Generates ABI-encoded calldata for the removeOrder2() function on the orderbook contract
Takes an existing order from the subgraph and creates the transaction calldata needed to remove it from the orderbook. The order must be active and owned by the caller.
// Generate calldata for removing an order
const result = await order.getRemoveCalldata();
if (result.error) {
console.error('Failed:', result.error.readableMsg);
} else {
const calldata = result.value;
// Do something with the calldata
}
ABI-encoded calldata ready for blockchain submission
Counts total trades for an order within a time range
Efficiently counts the total number of trades executed by an order without fetching all trade details.
const result = await order.getTradeCount();
if (result.error) {
console.error("Cannot count trades:", result.error.readableMsg);
return;
}
const count = result.value;
// Do something with the count
OptionalstartTimestamp: null | bigintOptional start time filter (Unix timestamp in seconds)
OptionalendTimestamp: null | bigintOptional end time filter (Unix timestamp in seconds)
Total trade count as number
Fetches detailed information for a specific trade
Retrieves complete information about a single trade including vault changes and transaction details.
const result = await order.getTradeDetail("0x1234567890abcdef1234567890abcdef12345678");
if (result.error) {
console.error("Trade not found:", result.error.readableMsg);
return;
}
const trade = result.value;
// Do something with the trade
Unique trade identifier
Complete trade information
Fetches trade history with optional time filtering
Retrieves a chronological list of trades executed by an order within an optional time range.
const result = await order.getTradesList();
if (result.error) {
console.error("Cannot fetch trades:", result.error.readableMsg);
return;
}
const trades = result.value;
// Do something with the trades
OptionalstartTimestamp: null | bigintOptional start time filter (Unix timestamp in seconds)
OptionalendTimestamp: null | bigintOptional end time filter (Unix timestamp in seconds)
Optionalpage: null | numberOptional page number (defaults to 1)
Array of trade records with complete details
A single order representation within a given orderbook.
RaindexOrder represents a trading order on a specific blockchain with its associated input and output vaults, metadata, and performance tracking capabilities. Each order is deployed on a specific orderbook contract and can be queried for volume and performance metrics over time.
The order contains both the raw order data (bytes and hash) and structured access to its vaults, which define what tokens can be traded and their current balances.