@0xmonaco/react 1.0.36 → 1.0.38
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/dist/coverage.d.ts +3 -3
- package/dist/coverage.js +3 -3
- package/dist/hooks/usePitpass/index.d.ts +4 -1
- package/dist/hooks/usePitpass/index.js +3 -0
- package/dist/hooks/usePitpass/types.d.ts +13 -1
- package/dist/hooks/usePitpass/useRewardsBalance.d.ts +8 -0
- package/dist/hooks/usePitpass/useRewardsBalance.js +17 -0
- package/dist/hooks/usePitpass/useTraderCodeInfo.d.ts +9 -0
- package/dist/hooks/usePitpass/useTraderCodeInfo.js +18 -0
- package/dist/hooks/usePitpass/useTransferRewards.d.ts +9 -0
- package/dist/hooks/usePitpass/useTransferRewards.js +19 -0
- package/dist/hooks/useTrade/types.d.ts +1 -0
- package/dist/hooks/useUserOrders/useUserOrders.js +1 -1
- package/package.json +3 -3
package/dist/coverage.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export declare const COVERED: {
|
|
|
33
33
|
get_position: string;
|
|
34
34
|
get_position_pnl_history: string;
|
|
35
35
|
get_position_risk: string;
|
|
36
|
+
get_rewards_balance: string;
|
|
37
|
+
get_trader_code_info: string;
|
|
36
38
|
get_trades: string;
|
|
37
39
|
get_user_balance_by_asset: string;
|
|
38
40
|
get_user_balances: string;
|
|
@@ -51,6 +53,7 @@ export declare const COVERED: {
|
|
|
51
53
|
replace_order: string;
|
|
52
54
|
revoke_session: string;
|
|
53
55
|
simulate_fees: string;
|
|
56
|
+
transfer_rewards: string;
|
|
54
57
|
};
|
|
55
58
|
/** operationId → reason it is intentionally not covered by @0xmonaco/react. */
|
|
56
59
|
export declare const INTENTIONALLY_EXCLUDED: {
|
|
@@ -74,11 +77,9 @@ export declare const INTENTIONALLY_EXCLUDED: {
|
|
|
74
77
|
get_portfolio_realized_pnl: string;
|
|
75
78
|
get_portfolio_stats: string;
|
|
76
79
|
get_portfolio_summary: string;
|
|
77
|
-
get_rewards_balance: string;
|
|
78
80
|
get_screener: string;
|
|
79
81
|
get_sub_account_limits: string;
|
|
80
82
|
get_trade_by_id: string;
|
|
81
|
-
get_trader_code_info: string;
|
|
82
83
|
get_trading_pair_by_id: string;
|
|
83
84
|
get_user_trades: string;
|
|
84
85
|
health_check: string;
|
|
@@ -104,7 +105,6 @@ export declare const INTENTIONALLY_EXCLUDED: {
|
|
|
104
105
|
transfer_collateral_to_margin_account: string;
|
|
105
106
|
transfer_collateral_to_parent_margin_account: string;
|
|
106
107
|
transfer_collateral_to_risk_bucket: string;
|
|
107
|
-
transfer_rewards: string;
|
|
108
108
|
update_sub_account_limit: string;
|
|
109
109
|
upsert_delegated_agent: string;
|
|
110
110
|
verify_signature: string;
|
package/dist/coverage.js
CHANGED
|
@@ -33,6 +33,8 @@ export const COVERED = {
|
|
|
33
33
|
get_position: "usePositions",
|
|
34
34
|
get_position_pnl_history: "usePositionPnlHistory",
|
|
35
35
|
get_position_risk: "usePositions",
|
|
36
|
+
get_rewards_balance: "useRewardsBalance",
|
|
37
|
+
get_trader_code_info: "useTraderCodeInfo",
|
|
36
38
|
get_trades: "useTradeFeed",
|
|
37
39
|
get_user_balance_by_asset: "useProfile",
|
|
38
40
|
get_user_balances: "useUserBalances",
|
|
@@ -51,6 +53,7 @@ export const COVERED = {
|
|
|
51
53
|
replace_order: "useTrade",
|
|
52
54
|
revoke_session: "useAuth",
|
|
53
55
|
simulate_fees: "useFees",
|
|
56
|
+
transfer_rewards: "useTransferRewards",
|
|
54
57
|
};
|
|
55
58
|
/** operationId → reason it is intentionally not covered by @0xmonaco/react. */
|
|
56
59
|
export const INTENTIONALLY_EXCLUDED = {
|
|
@@ -74,11 +77,9 @@ export const INTENTIONALLY_EXCLUDED = {
|
|
|
74
77
|
get_portfolio_realized_pnl: "Authoritative portfolio analytics is available through @0xmonaco/core; no dedicated React hook in this release.",
|
|
75
78
|
get_portfolio_stats: "Portfolio analytics endpoint; no React hook yet.",
|
|
76
79
|
get_portfolio_summary: "Authoritative portfolio analytics is available through @0xmonaco/core; no dedicated React hook in this release.",
|
|
77
|
-
get_rewards_balance: "PitPass rewards-balance read is available via @0xmonaco/core; no dedicated React hook.",
|
|
78
80
|
get_screener: "Market lookup available via the core client / list+symbol hooks; no dedicated React hook.",
|
|
79
81
|
get_sub_account_limits: "Sub-account administration; no React hook.",
|
|
80
82
|
get_trade_by_id: "Trade-history lookup with a core client method but no dedicated React hook yet.",
|
|
81
|
-
get_trader_code_info: "Public PitPass TraderCode lookup is available via @0xmonaco/core; no dedicated React hook.",
|
|
82
83
|
get_trading_pair_by_id: "Market lookup available via the core client / list+symbol hooks; no dedicated React hook.",
|
|
83
84
|
get_user_trades: "Trade-history lookup with a core client method but no dedicated React hook yet.",
|
|
84
85
|
health_check: "Infrastructure liveness probe (GET /health); not part of the data SDK surface.",
|
|
@@ -104,7 +105,6 @@ export const INTENTIONALLY_EXCLUDED = {
|
|
|
104
105
|
transfer_collateral_to_margin_account: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
105
106
|
transfer_collateral_to_parent_margin_account: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
106
107
|
transfer_collateral_to_risk_bucket: "Margin-account management/collateral/simulation endpoint; no React hook yet.",
|
|
107
|
-
transfer_rewards: "PitPass rewards transfer is available via @0xmonaco/core; no dedicated React hook.",
|
|
108
108
|
update_sub_account_limit: "Sub-account administration; no React hook.",
|
|
109
109
|
upsert_delegated_agent: "Delegated-agent management is an automation/agent surface, not a UI workflow; no React hook.",
|
|
110
110
|
verify_signature: "Auth verification runs inside login()/authenticate(); useAuth does not expose verifySignature as its own hook method.",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export type { UseClearTraderCodeReturn, UseMyTraderCodeReturn, UseSetTraderCodeReturn, UseTraderCodeAvailabilityReturn } from "./types";
|
|
1
|
+
export type { UseClearTraderCodeReturn, UseMyTraderCodeReturn, UseRewardsBalanceReturn, UseSetTraderCodeReturn, UseTraderCodeAvailabilityReturn, UseTraderCodeInfoReturn, UseTransferRewardsReturn, } from "./types";
|
|
2
2
|
export { useClearTraderCode } from "./useClearTraderCode";
|
|
3
3
|
export { useMyTraderCode } from "./useMyTraderCode";
|
|
4
|
+
export { useRewardsBalance } from "./useRewardsBalance";
|
|
4
5
|
export { useSetTraderCode } from "./useSetTraderCode";
|
|
5
6
|
export { useTraderCodeAvailability } from "./useTraderCodeAvailability";
|
|
7
|
+
export { useTraderCodeInfo } from "./useTraderCodeInfo";
|
|
8
|
+
export { useTransferRewards } from "./useTransferRewards";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { useClearTraderCode } from "./useClearTraderCode";
|
|
2
2
|
export { useMyTraderCode } from "./useMyTraderCode";
|
|
3
|
+
export { useRewardsBalance } from "./useRewardsBalance";
|
|
3
4
|
export { useSetTraderCode } from "./useSetTraderCode";
|
|
4
5
|
export { useTraderCodeAvailability } from "./useTraderCodeAvailability";
|
|
6
|
+
export { useTraderCodeInfo } from "./useTraderCodeInfo";
|
|
7
|
+
export { useTransferRewards } from "./useTransferRewards";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TraderCodeAvailabilityResponse, TraderCodeResponse } from "@0xmonaco/types";
|
|
1
|
+
import type { 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>;
|
|
@@ -15,3 +15,15 @@ export interface UseTraderCodeAvailabilityReturn {
|
|
|
15
15
|
/** Public advisory check of whether a custom TraderCode handle is available. */
|
|
16
16
|
checkTraderCodeAvailability: (code: string) => Promise<TraderCodeAvailabilityResponse>;
|
|
17
17
|
}
|
|
18
|
+
export interface UseRewardsBalanceReturn {
|
|
19
|
+
/** Read the caller's current PitPass rewards-bucket balances. */
|
|
20
|
+
getRewardsBalance: () => Promise<GetRewardsBalanceResponse>;
|
|
21
|
+
}
|
|
22
|
+
export interface UseTraderCodeInfoReturn {
|
|
23
|
+
/** Public lookup of a TraderCode by wallet address (bare or `Monaco - <address>` display form). */
|
|
24
|
+
getTraderCodeInfo: (code: string) => Promise<TraderCodeInfoResponse>;
|
|
25
|
+
}
|
|
26
|
+
export interface UseTransferRewardsReturn {
|
|
27
|
+
/** Transfer earned PitPass rewards into a tradeable balance. */
|
|
28
|
+
transferRewards: (params: TransferRewardsParams) => Promise<TransferRewardsResponse>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UseRewardsBalanceReturn } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Read the authenticated caller's current PitPass rewards-bucket balances.
|
|
4
|
+
*
|
|
5
|
+
* Rewards accrue in a separate bucket per token; call
|
|
6
|
+
* {@link useTransferRewards} to move them into a tradeable balance.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useRewardsBalance: () => UseRewardsBalanceReturn;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useMonacoSDK } from "../useMonaco";
|
|
3
|
+
/**
|
|
4
|
+
* Read the authenticated caller's current PitPass rewards-bucket balances.
|
|
5
|
+
*
|
|
6
|
+
* Rewards accrue in a separate bucket per token; call
|
|
7
|
+
* {@link useTransferRewards} to move them into a tradeable balance.
|
|
8
|
+
*/
|
|
9
|
+
export const useRewardsBalance = () => {
|
|
10
|
+
const { sdk } = useMonacoSDK();
|
|
11
|
+
const getRewardsBalance = useCallback(async () => {
|
|
12
|
+
if (!sdk)
|
|
13
|
+
throw new Error("SDK not available");
|
|
14
|
+
return await sdk.pitpass.getRewardsBalance();
|
|
15
|
+
}, [sdk]);
|
|
16
|
+
return { getRewardsBalance };
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UseTraderCodeInfoReturn } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Public lookup of a PitPass TraderCode by wallet address.
|
|
4
|
+
*
|
|
5
|
+
* Accepts the bare address or the `Monaco - <address>` display form. Used at
|
|
6
|
+
* sign-up to validate a referral code before it is applied. No authentication
|
|
7
|
+
* required.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTraderCodeInfo: () => UseTraderCodeInfoReturn;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useMonacoSDK } from "../useMonaco";
|
|
3
|
+
/**
|
|
4
|
+
* Public lookup of a PitPass TraderCode by wallet address.
|
|
5
|
+
*
|
|
6
|
+
* Accepts the bare address or the `Monaco - <address>` display form. Used at
|
|
7
|
+
* sign-up to validate a referral code before it is applied. No authentication
|
|
8
|
+
* required.
|
|
9
|
+
*/
|
|
10
|
+
export const useTraderCodeInfo = () => {
|
|
11
|
+
const { sdk } = useMonacoSDK();
|
|
12
|
+
const getTraderCodeInfo = useCallback(async (code) => {
|
|
13
|
+
if (!sdk)
|
|
14
|
+
throw new Error("SDK not available");
|
|
15
|
+
return await sdk.pitpass.getTraderCodeInfo(code);
|
|
16
|
+
}, [sdk]);
|
|
17
|
+
return { getTraderCodeInfo };
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UseTransferRewardsReturn } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Transfer the authenticated caller's earned PitPass rewards into a tradeable
|
|
4
|
+
* balance.
|
|
5
|
+
*
|
|
6
|
+
* Parameters (`token`, `amount`) are validated by the SDK core using Zod; the
|
|
7
|
+
* response echoes the remaining rewards balance. Requires authentication.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTransferRewards: () => UseTransferRewardsReturn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useMonacoSDK } from "../useMonaco";
|
|
3
|
+
/**
|
|
4
|
+
* Transfer the authenticated caller's earned PitPass rewards into a tradeable
|
|
5
|
+
* balance.
|
|
6
|
+
*
|
|
7
|
+
* Parameters (`token`, `amount`) are validated by the SDK core using Zod; the
|
|
8
|
+
* response echoes the remaining rewards balance. Requires authentication.
|
|
9
|
+
*/
|
|
10
|
+
export const useTransferRewards = () => {
|
|
11
|
+
const { sdk } = useMonacoSDK();
|
|
12
|
+
const transferRewards = useCallback(async (params) => {
|
|
13
|
+
if (!sdk)
|
|
14
|
+
throw new Error("SDK not available");
|
|
15
|
+
// Parameter validation is handled by the SDK core using Zod
|
|
16
|
+
return await sdk.pitpass.transferRewards(params);
|
|
17
|
+
}, [sdk]);
|
|
18
|
+
return { transferRewards };
|
|
19
|
+
};
|
|
@@ -23,6 +23,7 @@ export interface UseTradeReturn {
|
|
|
23
23
|
price?: string;
|
|
24
24
|
quantity?: string;
|
|
25
25
|
useMasterBalance?: boolean;
|
|
26
|
+
postOnly?: boolean;
|
|
26
27
|
}) => Promise<ReplaceOrderResponse>;
|
|
27
28
|
/** Batch create multiple orders */
|
|
28
29
|
batchCreate: (orders: BatchCreateOrderParams[]) => Promise<BatchCreateOrdersResponse>;
|
|
@@ -120,7 +120,7 @@ function orderFromEvent(event) {
|
|
|
120
120
|
if (event.eventType !== "OrderPlaced")
|
|
121
121
|
return null;
|
|
122
122
|
const { data } = event;
|
|
123
|
-
const tradingPairId = data.tradingPairId || data.
|
|
123
|
+
const tradingPairId = data.tradingPairId || data.tradingPair;
|
|
124
124
|
if (!tradingPairId)
|
|
125
125
|
return null;
|
|
126
126
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.38",
|
|
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": "1.0.
|
|
24
|
-
"@0xmonaco/types": "1.0.
|
|
23
|
+
"@0xmonaco/core": "1.0.38",
|
|
24
|
+
"@0xmonaco/types": "1.0.38"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^19.1.12",
|