@0xmonaco/react 0.0.0-develop-20260412233650 → 0.0.0-develop-20260415185155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import type { Candlestick, GetCandlesticksParams, GetTradingPairsParams, Interval, MarketMetadata, PaginatedTradingPairs, TradingPair } from "@0xmonaco/types";
1
+ import type { Candlestick, GetCandlesticksParams, GetTradingPairsParams, GetTradingPairsResponse, Interval, MarketMetadata, TradingPair } from "@0xmonaco/types";
2
2
  export interface UseMarketReturn {
3
3
  /** Get all available trading pairs with optional filtering and pagination */
4
- getPaginatedTradingPairs: (params?: GetTradingPairsParams) => Promise<PaginatedTradingPairs>;
4
+ getPaginatedTradingPairs: (params?: GetTradingPairsParams) => Promise<GetTradingPairsResponse>;
5
5
  /** Get a specific trading pair by symbol */
6
6
  getTradingPairBySymbol: (symbol: string) => Promise<TradingPair | undefined>;
7
7
  /**
@@ -5,11 +5,7 @@ export const useMarket = () => {
5
5
  const getPaginatedTradingPairs = useCallback(async (params) => {
6
6
  if (!sdk)
7
7
  throw new Error("SDK not available");
8
- const response = await sdk.market.getPaginatedTradingPairs(params);
9
- if (!response.success) {
10
- throw new Error("Failed to fetch trading pairs");
11
- }
12
- return response.data;
8
+ return await sdk.market.getPaginatedTradingPairs(params);
13
9
  }, [sdk]);
14
10
  const getTradingPairBySymbol = useCallback(async (symbol) => {
15
11
  if (!sdk)
@@ -51,8 +51,8 @@ export const useProfile = () => {
51
51
  try {
52
52
  const [userProfileResult, balancesResult, movementsResult, ordersResult] = await Promise.allSettled([
53
53
  sdk.profile.getProfile(),
54
- sdk.profile.getUserBalances({ limit: DEFAULT_PAGE_SIZE, offset: 0 }),
55
- sdk.profile.getPaginatedUserMovements({ page: 1, limit: DEFAULT_PAGE_SIZE }),
54
+ sdk.profile.getUserBalances({ page_size: DEFAULT_PAGE_SIZE, page: 1 }),
55
+ sdk.profile.getPaginatedUserMovements({ page: 1, page_size: DEFAULT_PAGE_SIZE }),
56
56
  sdk.trading.getPaginatedOrders({ page: 1, page_size: DEFAULT_PAGE_SIZE }),
57
57
  ]);
58
58
  const userProfile = getSettledValueOrThrow(userProfileResult);
@@ -19,7 +19,7 @@ export function useTradeFeed(tradingPairId) {
19
19
  if (!sdk?.ws || !sdk?.trades || !tradingPairId) {
20
20
  return;
21
21
  }
22
- const fetchInitialTrades = () => sdk.trades.getTrades(tradingPairId, { limit: MAX_TRADES });
22
+ const fetchInitialTrades = () => sdk.trades.getTrades(tradingPairId, { page_size: MAX_TRADES });
23
23
  const subscribeToWs = (handler) => sdk.ws.trades(tradingPairId, handler);
24
24
  return subscribe(tradingPairId, fetchInitialTrades, subscribeToWs);
25
25
  }, [sdk?.ws, sdk?.trades, tradingPairId, subscribe]);
@@ -10,7 +10,7 @@ import type { UseUserMovementsOptions, UseUserMovementsReturn } from "./types";
10
10
  *
11
11
  * @param options - Optional filter and pagination options
12
12
  * @param options.maxMovements - Maximum number of movements to keep in state (default: 50)
13
- * @param options.limit - Number of items per page for the API call (default: maxMovements)
13
+ * @param options.page_size - Number of items per page for the API call (default: maxMovements)
14
14
  * @param options.entry_type - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
15
15
  * @param options.transaction_type - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, etc.)
16
16
  * @param options.asset_id - Filter by asset ID (UUID)
@@ -44,7 +44,7 @@ function ledgerMovementToEvent(movement, userId) {
44
44
  *
45
45
  * @param options - Optional filter and pagination options
46
46
  * @param options.maxMovements - Maximum number of movements to keep in state (default: 50)
47
- * @param options.limit - Number of items per page for the API call (default: maxMovements)
47
+ * @param options.page_size - Number of items per page for the API call (default: maxMovements)
48
48
  * @param options.entry_type - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
49
49
  * @param options.transaction_type - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, etc.)
50
50
  * @param options.asset_id - Filter by asset ID (UUID)
@@ -52,14 +52,14 @@ function ledgerMovementToEvent(movement, userId) {
52
52
  export function useUserMovements(options = {}) {
53
53
  const { sdk } = useMonacoSDK();
54
54
  const { authenticationStatus } = useMonacoContext();
55
- const { maxMovements = 50, limit, entry_type, transaction_type, asset_id } = options;
55
+ const { maxMovements = 50, page_size, entry_type, transaction_type, asset_id } = options;
56
56
  const [movements, setMovements] = useState([]);
57
57
  const [loading, setLoading] = useState(false);
58
58
  const [error, setError] = useState(null);
59
59
  const [subscribed, setSubscribed] = useState(false);
60
60
  const clearError = useCallback(() => setError(null), []);
61
61
  const sliceSize = Number.isFinite(maxMovements) && maxMovements > 0 ? maxMovements : 50;
62
- const requestLimit = limit ?? Math.min(Math.max(Math.round(sliceSize), 1), 100);
62
+ const requestLimit = page_size ?? Math.min(Math.max(Math.round(sliceSize), 1), 100);
63
63
  // Derive userId reactively — authenticationStatus changes on login/logout, triggering a re-render
64
64
  const userId = authenticationStatus === "authenticated" ? sdk?.getAuthState()?.user.id : undefined;
65
65
  useEffect(() => {
@@ -73,7 +73,7 @@ export function useUserMovements(options = {}) {
73
73
  // Fetch initial movements via REST API, then subscribe to WebSocket updates
74
74
  let unsubscribe;
75
75
  sdk.profile
76
- .getPaginatedUserMovements({ limit: requestLimit, entry_type, transaction_type, asset_id })
76
+ .getPaginatedUserMovements({ page_size: requestLimit, entry_type, transaction_type, asset_id })
77
77
  .then(async (response) => {
78
78
  // Combine latest_movements (from Redis) with movements (from PostgreSQL)
79
79
  // latest_movements contains real-time data that may not yet be in PostgreSQL
@@ -118,12 +118,12 @@ function orderFromEvent(event) {
118
118
  if (event.eventType !== "OrderPlaced")
119
119
  return null;
120
120
  const { data } = event;
121
- const tradingPair = data.tradingPairId || data.tradingPair;
122
- if (!tradingPair)
121
+ const tradingPairId = data.tradingPairId || data.symbol;
122
+ if (!tradingPairId)
123
123
  return null;
124
124
  return {
125
125
  id: event.orderId,
126
- trading_pair: tradingPair,
126
+ trading_pair_id: tradingPairId,
127
127
  order_type: (data.orderType || "LIMIT"),
128
128
  side: (data.side || "BUY"),
129
129
  price: data.price,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/react",
3
- "version": "0.0.0-develop-20260412233650",
3
+ "version": "0.0.0-develop-20260415185155",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,8 +20,8 @@
20
20
  "lint": "biome lint ."
21
21
  },
22
22
  "dependencies": {
23
- "@0xmonaco/core": "0.0.0-develop-20260412233650",
24
- "@0xmonaco/types": "0.0.0-develop-20260412233650"
23
+ "@0xmonaco/core": "0.0.0-develop-20260415185155",
24
+ "@0xmonaco/types": "0.0.0-develop-20260415185155"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "^19.1.12",