@0xmonaco/react 1.0.73 → 1.0.74-develop.367860f
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.
- package/README.md +15 -9
- package/dist/coverage.d.ts +7 -0
- package/dist/coverage.js +13 -6
- package/dist/hooks/usePitpass/index.d.ts +2 -1
- package/dist/hooks/usePitpass/index.js +1 -0
- package/dist/hooks/usePitpass/types.d.ts +8 -4
- package/dist/hooks/usePitpass/useMyReferralDownline.d.ts +5 -3
- package/dist/hooks/usePitpass/useMyReferralDownline.js +7 -5
- package/dist/hooks/usePitpass/useMyReferralTree.d.ts +10 -0
- package/dist/hooks/usePitpass/useMyReferralTree.js +19 -0
- package/dist/hooks/useProfile/useProfile.js +8 -4
- package/dist/hooks/useTradeFeed/useTradeFeed.js +4 -1
- package/dist/hooks/useUserBalances/useUserBalances.js +19 -17
- package/dist/hooks/useUserMovements/types.d.ts +8 -1
- package/dist/hooks/useUserOrders/useUserOrders.js +5 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -234,22 +234,28 @@ await withdraw(assetId, amount);
|
|
|
234
234
|
Access user profile and account information.
|
|
235
235
|
|
|
236
236
|
```tsx
|
|
237
|
-
const {
|
|
237
|
+
const { fetchProfile, getUserBalances, getPaginatedUserMovements } = useProfile();
|
|
238
238
|
|
|
239
|
-
// Get profile
|
|
240
|
-
const profile = await
|
|
239
|
+
// Get profile (also populates the hook's balances/movements/orders state)
|
|
240
|
+
const profile = await fetchProfile();
|
|
241
241
|
|
|
242
|
-
// Get balances
|
|
242
|
+
// Get balances — cursor paged: omit pageToken to start, then follow
|
|
243
|
+
// nextPageToken until it comes back empty.
|
|
243
244
|
const balances = await getUserBalances({
|
|
244
|
-
|
|
245
|
-
page_size: 10,
|
|
245
|
+
pageSize: 10,
|
|
246
246
|
});
|
|
247
247
|
|
|
248
248
|
// Get movements (transaction history)
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
page_size: 20,
|
|
249
|
+
const firstPage = await getPaginatedUserMovements({
|
|
250
|
+
pageSize: 20,
|
|
252
251
|
});
|
|
252
|
+
|
|
253
|
+
// Walk the rest
|
|
254
|
+
let pageToken = firstPage.nextPageToken;
|
|
255
|
+
while (pageToken) {
|
|
256
|
+
const next = await getPaginatedUserMovements({ pageSize: 20, pageToken });
|
|
257
|
+
pageToken = next.nextPageToken;
|
|
258
|
+
}
|
|
253
259
|
```
|
|
254
260
|
|
|
255
261
|
### WebSocket Hooks
|
package/dist/coverage.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare const COVERED: {
|
|
|
51
51
|
get_rewards_balance: string;
|
|
52
52
|
get_my_referral_position: string;
|
|
53
53
|
get_my_referral_downline: string;
|
|
54
|
+
get_my_referral_tree: string;
|
|
54
55
|
get_trader_code_info: string;
|
|
55
56
|
get_trades: string;
|
|
56
57
|
get_user_balance_by_asset: string;
|
|
@@ -139,6 +140,12 @@ export declare const INTENTIONALLY_EXCLUDED: {
|
|
|
139
140
|
transfer_collateral_to_margin_account: string;
|
|
140
141
|
transfer_collateral_to_parent_margin_account: string;
|
|
141
142
|
transfer_collateral_to_risk_bucket: string;
|
|
143
|
+
create_sub_account: string;
|
|
144
|
+
close_sub_account: string;
|
|
145
|
+
get_margin_account_pnl: string;
|
|
146
|
+
transfer_collateral: string;
|
|
147
|
+
transfer_collateral_to_sub_account: string;
|
|
148
|
+
transfer_collateral_from_sub_account: string;
|
|
142
149
|
update_sub_account_limit: string;
|
|
143
150
|
upsert_delegated_agent: string;
|
|
144
151
|
verify_signature: string;
|
package/dist/coverage.js
CHANGED
|
@@ -51,6 +51,7 @@ export const COVERED = {
|
|
|
51
51
|
get_rewards_balance: "useRewardsBalance",
|
|
52
52
|
get_my_referral_position: "useMyReferralPosition",
|
|
53
53
|
get_my_referral_downline: "useMyReferralDownline",
|
|
54
|
+
get_my_referral_tree: "useMyReferralTree",
|
|
54
55
|
get_trader_code_info: "useTraderCodeInfo",
|
|
55
56
|
get_trades: "useTradeFeed",
|
|
56
57
|
get_user_balance_by_asset: "useProfile",
|
|
@@ -83,8 +84,8 @@ export const INTENTIONALLY_EXCLUDED = {
|
|
|
83
84
|
create_twap_order: "TWAP parent orders are an advanced execution-algo surface (covered by @0xmonaco/core); no React hook yet.",
|
|
84
85
|
create_sub_account_limit: "Sub-account administration; no React hook.",
|
|
85
86
|
delete_sub_account_limit: "Sub-account administration; no React hook.",
|
|
86
|
-
get_application_config: "Application
|
|
87
|
-
get_application_stats: "Application
|
|
87
|
+
get_application_config: "Application operator configuration endpoint; not a user-wallet React workflow.",
|
|
88
|
+
get_application_stats: "Application reporting endpoint (public, selected by clientId) for frontend operators; not a user-wallet React workflow.",
|
|
88
89
|
get_available_collateral: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
89
90
|
get_buildercode_payout_summary: "BuilderCodes frontend-operator reporting is covered by @0xmonaco/core; no React hook.",
|
|
90
91
|
get_buildercode_rewards_balance: "BuilderCodes frontend-operator reporting is covered by @0xmonaco/core; no React hook.",
|
|
@@ -114,10 +115,10 @@ export const INTENTIONALLY_EXCLUDED = {
|
|
|
114
115
|
get_twap_order_tca: "TWAP parent orders are an advanced execution-algo surface (covered by @0xmonaco/core); no React hook yet.",
|
|
115
116
|
get_user_trades: "Trade-history lookup with a core client method but no dedicated React hook yet.",
|
|
116
117
|
health_check: "Infrastructure liveness probe (GET /health); not part of the data SDK surface.",
|
|
117
|
-
list_application_balances: "Application
|
|
118
|
-
list_application_movements: "Application
|
|
119
|
-
list_application_orders: "Application
|
|
120
|
-
list_application_users: "Application
|
|
118
|
+
list_application_balances: "Application reporting endpoint (public, selected by clientId) for frontend operators; not a user-wallet React workflow.",
|
|
119
|
+
list_application_movements: "Application reporting endpoint (public, selected by clientId) for frontend operators; not a user-wallet React workflow.",
|
|
120
|
+
list_application_orders: "Application reporting endpoint (public, selected by clientId) for frontend operators; not a user-wallet React workflow.",
|
|
121
|
+
list_application_users: "Application reporting endpoint (public, selected by clientId) for frontend operators; not a user-wallet React workflow.",
|
|
121
122
|
list_buildercode_payouts: "BuilderCodes frontend-operator reporting is covered by @0xmonaco/core; no React hook.",
|
|
122
123
|
list_builder_fee_changes: "BuilderCodes frontend-operator audit reporting is covered by @0xmonaco/core; no React hook.",
|
|
123
124
|
list_delegated_agent_owners: "Delegated-agent management is an automation/agent surface, not a UI workflow; no React hook.",
|
|
@@ -139,6 +140,12 @@ export const INTENTIONALLY_EXCLUDED = {
|
|
|
139
140
|
transfer_collateral_to_margin_account: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
140
141
|
transfer_collateral_to_parent_margin_account: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
141
142
|
transfer_collateral_to_risk_bucket: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
143
|
+
create_sub_account: "Margin sub-account management; no React hook yet.",
|
|
144
|
+
close_sub_account: "Margin sub-account management; no React hook yet.",
|
|
145
|
+
get_margin_account_pnl: "Margin sub-account read; no React hook yet.",
|
|
146
|
+
transfer_collateral: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
147
|
+
transfer_collateral_to_sub_account: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
148
|
+
transfer_collateral_from_sub_account: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
142
149
|
update_sub_account_limit: "Sub-account administration; no React hook.",
|
|
143
150
|
upsert_delegated_agent: "Delegated-agent management is an automation/agent surface, not a UI workflow; no React hook.",
|
|
144
151
|
verify_signature: "Auth verification runs inside login()/authenticate(); useAuth does not expose verifySignature as its own hook method.",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export type { UseClearTraderCodeReturn, UseMyReferralDownlineReturn, UseMyReferralPositionReturn, UseMyTraderCodeReturn, UseRewardsBalanceReturn, UseSetTraderCodeReturn, UseTraderCodeAvailabilityReturn, UseTraderCodeInfoReturn, UseTransferRewardsReturn, } from "./types";
|
|
1
|
+
export type { UseClearTraderCodeReturn, UseMyReferralDownlineReturn, UseMyReferralPositionReturn, UseMyReferralTreeReturn, UseMyTraderCodeReturn, UseRewardsBalanceReturn, UseSetTraderCodeReturn, UseTraderCodeAvailabilityReturn, UseTraderCodeInfoReturn, UseTransferRewardsReturn, } from "./types";
|
|
2
2
|
export { useClearTraderCode } from "./useClearTraderCode";
|
|
3
3
|
export { useMyReferralDownline } from "./useMyReferralDownline";
|
|
4
4
|
export { useMyReferralPosition } from "./useMyReferralPosition";
|
|
5
|
+
export { useMyReferralTree } from "./useMyReferralTree";
|
|
5
6
|
export { useMyTraderCode } from "./useMyTraderCode";
|
|
6
7
|
export { useRewardsBalance } from "./useRewardsBalance";
|
|
7
8
|
export { useSetTraderCode } from "./useSetTraderCode";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { useClearTraderCode } from "./useClearTraderCode";
|
|
2
2
|
export { useMyReferralDownline } from "./useMyReferralDownline";
|
|
3
3
|
export { useMyReferralPosition } from "./useMyReferralPosition";
|
|
4
|
+
export { useMyReferralTree } from "./useMyReferralTree";
|
|
4
5
|
export { useMyTraderCode } from "./useMyTraderCode";
|
|
5
6
|
export { useRewardsBalance } from "./useRewardsBalance";
|
|
6
7
|
export { useSetTraderCode } from "./useSetTraderCode";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetRewardsBalanceResponse, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "@0xmonaco/types";
|
|
1
|
+
import type { GetMyReferralDownlineParams, GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetMyReferralTreeParams, GetMyReferralTreeResponse, GetRewardsBalanceResponse, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "@0xmonaco/types";
|
|
2
2
|
export interface UseMyTraderCodeReturn {
|
|
3
3
|
/** Read the caller's TraderCode identity (wallet-derived `code` plus the custom-handle fields). */
|
|
4
4
|
getMyTraderCode: () => Promise<TraderCodeResponse>;
|
|
@@ -28,10 +28,14 @@ export interface UseTransferRewardsReturn {
|
|
|
28
28
|
transferRewards: (params: TransferRewardsParams) => Promise<TransferRewardsResponse>;
|
|
29
29
|
}
|
|
30
30
|
export interface UseMyReferralPositionReturn {
|
|
31
|
-
/** Read the caller's own referral position: L1 referrer, total earned, and recent rewards. */
|
|
31
|
+
/** Read the caller's own referral position: upline (as deep as PitPass rewards), L1 referrer, total earned, and recent rewards. */
|
|
32
32
|
getMyReferralPosition: () => Promise<GetMyReferralPositionResponse>;
|
|
33
33
|
}
|
|
34
34
|
export interface UseMyReferralDownlineReturn {
|
|
35
|
-
/** Read the caller's own downline: earnings by source (
|
|
36
|
-
getMyReferralDownline: () => Promise<GetMyReferralDownlineResponse>;
|
|
35
|
+
/** Read the caller's own downline: one page of earnings by source (every level), L1 roster, and per-level summary. */
|
|
36
|
+
getMyReferralDownline: (params?: GetMyReferralDownlineParams) => Promise<GetMyReferralDownlineResponse>;
|
|
37
|
+
}
|
|
38
|
+
export interface UseMyReferralTreeReturn {
|
|
39
|
+
/** Read one level of the caller's own referral tree: `parent`'s direct referees (the caller when omitted), paginated. */
|
|
40
|
+
getMyReferralTree: (params?: GetMyReferralTreeParams) => Promise<GetMyReferralTreeResponse>;
|
|
37
41
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { UseMyReferralDownlineReturn } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
* Read the authenticated caller's own downline: earnings by source
|
|
4
|
-
*
|
|
5
|
-
* traded yet), and a per-level earnings summary
|
|
3
|
+
* Read the authenticated caller's own downline: one page of earnings by source
|
|
4
|
+
* across every reward level, their L1 direct-referee roster (including
|
|
5
|
+
* referees who have not traded yet), and a per-level earnings summary covering
|
|
6
|
+
* every level. Pass `pageToken` from the previous response's `nextPageToken`
|
|
7
|
+
* to read the next page.
|
|
6
8
|
*
|
|
7
9
|
* Self-scoped and read-only. Every source and referee is a public wallet
|
|
8
10
|
* address plus a `display` handle-or-wallet variant, never an internal id.
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
2
|
import { useMonacoSDK } from "../useMonaco";
|
|
3
3
|
/**
|
|
4
|
-
* Read the authenticated caller's own downline: earnings by source
|
|
5
|
-
*
|
|
6
|
-
* traded yet), and a per-level earnings summary
|
|
4
|
+
* Read the authenticated caller's own downline: one page of earnings by source
|
|
5
|
+
* across every reward level, their L1 direct-referee roster (including
|
|
6
|
+
* referees who have not traded yet), and a per-level earnings summary covering
|
|
7
|
+
* every level. Pass `pageToken` from the previous response's `nextPageToken`
|
|
8
|
+
* to read the next page.
|
|
7
9
|
*
|
|
8
10
|
* Self-scoped and read-only. Every source and referee is a public wallet
|
|
9
11
|
* address plus a `display` handle-or-wallet variant, never an internal id.
|
|
10
12
|
*/
|
|
11
13
|
export const useMyReferralDownline = () => {
|
|
12
14
|
const { sdk } = useMonacoSDK();
|
|
13
|
-
const getMyReferralDownline = useCallback(async () => {
|
|
15
|
+
const getMyReferralDownline = useCallback(async (params) => {
|
|
14
16
|
if (!sdk)
|
|
15
17
|
throw new Error("SDK not available");
|
|
16
|
-
return await sdk.pitpass.getMyReferralDownline();
|
|
18
|
+
return await sdk.pitpass.getMyReferralDownline(params);
|
|
17
19
|
}, [sdk]);
|
|
18
20
|
return { getMyReferralDownline };
|
|
19
21
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UseMyReferralTreeReturn } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Read one level of the authenticated caller's own referral tree: the wallets
|
|
4
|
+
* `parent` directly referred (the caller when omitted), a page at a time,
|
|
5
|
+
* newest first. Expand a node by calling again with `parent` set to its wallet.
|
|
6
|
+
*
|
|
7
|
+
* Self-scoped and read-only: `parent` must be the caller or one of their own
|
|
8
|
+
* L1/L2 referees, otherwise the request fails with a 404.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useMyReferralTree: () => UseMyReferralTreeReturn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useMonacoSDK } from "../useMonaco";
|
|
3
|
+
/**
|
|
4
|
+
* Read one level of the authenticated caller's own referral tree: the wallets
|
|
5
|
+
* `parent` directly referred (the caller when omitted), a page at a time,
|
|
6
|
+
* newest first. Expand a node by calling again with `parent` set to its wallet.
|
|
7
|
+
*
|
|
8
|
+
* Self-scoped and read-only: `parent` must be the caller or one of their own
|
|
9
|
+
* L1/L2 referees, otherwise the request fails with a 404.
|
|
10
|
+
*/
|
|
11
|
+
export const useMyReferralTree = () => {
|
|
12
|
+
const { sdk } = useMonacoSDK();
|
|
13
|
+
const getMyReferralTree = useCallback(async (params) => {
|
|
14
|
+
if (!sdk)
|
|
15
|
+
throw new Error("SDK not available");
|
|
16
|
+
return await sdk.pitpass.getMyReferralTree(params);
|
|
17
|
+
}, [sdk]);
|
|
18
|
+
return { getMyReferralTree };
|
|
19
|
+
};
|
|
@@ -51,10 +51,14 @@ export const useProfile = () => {
|
|
|
51
51
|
try {
|
|
52
52
|
const [userProfileResult, balancesResult, movementsResult, ordersResult] = await Promise.allSettled([
|
|
53
53
|
sdk.profile.getProfile(),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
//
|
|
54
|
+
// Cursor mode (pageToken "") reads the first page of balances;
|
|
55
|
+
// page-number mode was removed (0XM-2821).
|
|
56
|
+
sdk.profile.getUserBalances({ pageToken: "", pageSize: DEFAULT_PAGE_SIZE }),
|
|
57
|
+
// Cursor mode (pageToken "") reads the newest movements; page-number
|
|
58
|
+
// mode was removed (0XM-2820).
|
|
59
|
+
sdk.profile.getPaginatedUserMovements({ pageToken: "", pageSize: DEFAULT_PAGE_SIZE }),
|
|
60
|
+
// Cursor mode (pageToken "") reads the newest orders; page-number
|
|
61
|
+
// mode was removed (0XM-2963).
|
|
58
62
|
sdk.trading.getPaginatedOrders({ pageSize: DEFAULT_PAGE_SIZE, pageToken: "" }),
|
|
59
63
|
]);
|
|
60
64
|
const userProfile = getSettledValueOrThrow(userProfileResult);
|
|
@@ -19,7 +19,10 @@ export function useTradeFeed(tradingPairId) {
|
|
|
19
19
|
if (!sdk?.ws || !sdk?.trades || !tradingPairId) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
// One page is the whole need here: the provider keeps only the newest
|
|
23
|
+
// MAX_TRADES and the WebSocket feed takes over from there, so the cursor
|
|
24
|
+
// (0XM-2821) is not walked — just unwrapped.
|
|
25
|
+
const fetchInitialTrades = async () => (await sdk.trades.getTrades(tradingPairId, { pageSize: MAX_TRADES })).trades;
|
|
23
26
|
const subscribeToWs = (handler) => sdk.ws.trades(tradingPairId, handler);
|
|
24
27
|
return subscribe(tradingPairId, fetchInitialTrades, subscribeToWs);
|
|
25
28
|
}, [sdk?.ws, sdk?.trades, tradingPairId, subscribe]);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import { useMonacoSDK } from "../useMonaco";
|
|
3
3
|
/**
|
|
4
|
-
* Page size for the balance read. The endpoint caps it at
|
|
5
|
-
*
|
|
4
|
+
* Page size for the balance read. The endpoint caps it at 1000, and 100 keeps
|
|
5
|
+
* a full account to one request in practice.
|
|
6
6
|
*/
|
|
7
7
|
const BALANCES_PAGE_SIZE = 100;
|
|
8
8
|
/**
|
|
9
9
|
* Hard ceiling on pages walked, mirroring the server snapshot's own guard: a
|
|
10
|
-
*
|
|
11
|
-
* size above this covers far more assets than an account can hold.
|
|
10
|
+
* server that kept minting tokens must not drive an unbounded read loop. At
|
|
11
|
+
* the page size above this covers far more assets than an account can hold.
|
|
12
12
|
*/
|
|
13
13
|
const MAX_BALANCE_PAGES = 20;
|
|
14
14
|
/**
|
|
@@ -19,22 +19,23 @@ const MAX_BALANCE_PAGES = 20;
|
|
|
19
19
|
* page permanently unreachable, and a snapshot naming one would ask for a
|
|
20
20
|
* repair read that could never satisfy it.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Cursor paged (0XM-2788/0XM-2821): the walk follows `nextPageToken` until it
|
|
23
|
+
* comes back empty. The server over-fetches, so an empty token is the
|
|
24
|
+
* definitive end — this no longer has to infer the end from a short page or
|
|
25
|
+
* trust `totalPages`. The page ceiling still bounds the loop.
|
|
25
26
|
*
|
|
26
|
-
* Rows are deduplicated by token, keeping the first occurrence, the same
|
|
27
|
-
* `useUserOrders` deduplicates its paginated read.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* update would find.
|
|
27
|
+
* Rows are still deduplicated by token, keeping the first occurrence, the same
|
|
28
|
+
* way `useUserOrders` deduplicates its paginated read. The cursor walks an
|
|
29
|
+
* immutable key now, so a row that moves between two reads is no longer served
|
|
30
|
+
* twice — but a duplicate here would become two list entries for one asset,
|
|
31
|
+
* only the first of which any later update would find, so the guard stays.
|
|
32
32
|
*/
|
|
33
33
|
async function readAllBalances(profile) {
|
|
34
34
|
const all = [];
|
|
35
35
|
const seen = new Set();
|
|
36
|
+
let pageToken = "";
|
|
36
37
|
for (let page = 1; page <= MAX_BALANCE_PAGES; page++) {
|
|
37
|
-
const response = await profile.getUserBalances({
|
|
38
|
+
const response = await profile.getUserBalances({ pageToken, pageSize: BALANCES_PAGE_SIZE });
|
|
38
39
|
for (const row of response.balances) {
|
|
39
40
|
const token = row.token.toLowerCase();
|
|
40
41
|
if (seen.has(token))
|
|
@@ -42,10 +43,11 @@ async function readAllBalances(profile) {
|
|
|
42
43
|
seen.add(token);
|
|
43
44
|
all.push(row);
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
46
|
+
// A server that predates the cursor contract sends no token at all; treat
|
|
47
|
+
// that as the end rather than re-reading the first page forever.
|
|
48
|
+
if (!response.nextPageToken)
|
|
48
49
|
break;
|
|
50
|
+
pageToken = response.nextPageToken;
|
|
49
51
|
}
|
|
50
52
|
return all;
|
|
51
53
|
}
|
|
@@ -2,7 +2,14 @@ import type { GetUserMovementsParams, UserMovementEvent } from "@0xmonaco/types"
|
|
|
2
2
|
/**
|
|
3
3
|
* Options for the useUserMovements hook
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* `pageToken` and `orderBy` are omitted deliberately. The hook reads one
|
|
7
|
+
* newest-first page and then keeps it current from the `movements` WebSocket
|
|
8
|
+
* channel, so there is no walk for a cursor to resume and no way to honour a
|
|
9
|
+
* different sort — exposing either would let a caller set a value the hook
|
|
10
|
+
* silently ignores.
|
|
11
|
+
*/
|
|
12
|
+
export interface UseUserMovementsOptions extends Omit<GetUserMovementsParams, "pageToken" | "orderBy"> {
|
|
6
13
|
/** Maximum number of movements to keep in state (default: 50) */
|
|
7
14
|
maxMovements?: number;
|
|
8
15
|
}
|
|
@@ -849,8 +849,11 @@ export function orderFromEvent(event) {
|
|
|
849
849
|
side,
|
|
850
850
|
price: data.price,
|
|
851
851
|
quantity: data.quantity || "0",
|
|
852
|
-
|
|
853
|
-
|
|
852
|
+
// An edit's replacement is acknowledged with the fill carried over from
|
|
853
|
+
// the original order and its average, as REST reports the edited order;
|
|
854
|
+
// any other placement omits both and starts unfilled.
|
|
855
|
+
filledQuantity: typeof data.filledQuantity === "string" ? data.filledQuantity : "0",
|
|
856
|
+
averageFillPrice: typeof data.averageFillPrice === "string" ? data.averageFillPrice : undefined,
|
|
854
857
|
// Not an invented value: an `OrderPlaced` event IS a submitted order by
|
|
855
858
|
// construction, whatever status string it carries.
|
|
856
859
|
status: asOrderStatus(data.status) ?? "SUBMITTED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.74-develop.367860f",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://docs.0xmonaco.com/sdk/typescript",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"lint": "biome lint ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@0xmonaco/core": "1.0.
|
|
20
|
-
"@0xmonaco/types": "1.0.
|
|
19
|
+
"@0xmonaco/core": "1.0.74-develop.367860f",
|
|
20
|
+
"@0xmonaco/types": "1.0.74-develop.367860f"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "^19.2.18",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"viem": "^2.45.2",
|
|
29
|
+
"wagmi": "^2.0.0 || ^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|