tempo_node/rpc/dex/
api.rs

1use crate::rpc::dex::{
2    OrderbooksFilter, OrdersFilters, books::OrderbooksResponse, orders::OrdersResponse,
3};
4use jsonrpsee::{core::RpcResult, proc_macros::rpc};
5use tempo_alloy::rpc::pagination::PaginationParams;
6
7/// RPC api for the `dex_` namespace
8#[rpc(server, namespace = "dex")]
9pub trait TempoDexApi {
10    /// Gets paginated orders from the Stablecoin Exchange orderbook.
11    ///
12    /// Uses cursor-based pagination for stable iteration through orders as the orderbook changes.
13    #[method(name = "getOrders")]
14    async fn orders(&self, params: PaginationParams<OrdersFilters>) -> RpcResult<OrdersResponse>;
15
16    /// Gets paginated orderbooks from the Stablecoin Exchange on Tempo.
17    ///
18    /// Uses cursor-based pagination for stable iteration through orderbooks.
19    #[method(name = "getOrderbooks")]
20    async fn orderbooks(
21        &self,
22        params: PaginationParams<OrderbooksFilter>,
23    ) -> RpcResult<OrderbooksResponse>;
24}