@microcosmmoney/auth-react 1.0.3 → 1.1.0

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.
Files changed (131) hide show
  1. package/dist/hooks/use-auction-bid.d.ts +5 -0
  2. package/dist/hooks/use-auction-bid.js +34 -0
  3. package/dist/hooks/use-auction-bids.d.ts +4 -0
  4. package/dist/hooks/use-auction-bids.js +12 -0
  5. package/dist/hooks/use-auction-cancel.d.ts +5 -0
  6. package/dist/hooks/use-auction-cancel.js +34 -0
  7. package/dist/hooks/use-auction-config.d.ts +3 -0
  8. package/dist/hooks/use-auction-config.js +11 -0
  9. package/dist/hooks/use-auction-detail.d.ts +2 -1
  10. package/dist/hooks/use-auction-end.d.ts +5 -0
  11. package/dist/hooks/use-auction-end.js +32 -0
  12. package/dist/hooks/use-auction-history.d.ts +9 -0
  13. package/dist/hooks/use-auction-history.js +41 -0
  14. package/dist/hooks/use-auction-refund.d.ts +5 -0
  15. package/dist/hooks/use-auction-refund.js +32 -0
  16. package/dist/hooks/use-auctions.d.ts +10 -2
  17. package/dist/hooks/use-auctions.js +14 -1
  18. package/dist/hooks/use-buyback-action.d.ts +6 -0
  19. package/dist/hooks/use-buyback-action.js +34 -0
  20. package/dist/hooks/use-buyback-flow.d.ts +22 -0
  21. package/dist/hooks/use-buyback-flow.js +46 -0
  22. package/dist/hooks/use-create-auction.d.ts +6 -0
  23. package/dist/hooks/use-create-auction.js +32 -0
  24. package/dist/hooks/use-cycle-history.d.ts +13 -0
  25. package/dist/hooks/use-cycle-history.js +41 -0
  26. package/dist/hooks/use-dashboard-mining-history.d.ts +3 -0
  27. package/dist/hooks/use-dashboard-mining-history.js +11 -0
  28. package/dist/hooks/use-dashboard-summary.d.ts +4 -14
  29. package/dist/hooks/use-dashboard-territory-stats.d.ts +3 -0
  30. package/dist/hooks/use-dashboard-territory-stats.js +11 -0
  31. package/dist/hooks/use-dashboard-user-stats.d.ts +4 -0
  32. package/dist/hooks/use-dashboard-user-stats.js +11 -0
  33. package/dist/hooks/use-fragment-config.d.ts +3 -0
  34. package/dist/hooks/use-fragment-config.js +11 -0
  35. package/dist/hooks/use-fragment-vault-detail.d.ts +3 -0
  36. package/dist/hooks/use-fragment-vault-detail.js +12 -0
  37. package/dist/hooks/use-fragment-vaults.d.ts +3 -0
  38. package/dist/hooks/use-fragment-vaults.js +11 -0
  39. package/dist/hooks/use-lending-pool.d.ts +3 -0
  40. package/dist/hooks/use-lending-pool.js +11 -0
  41. package/dist/hooks/use-lending-position.d.ts +3 -0
  42. package/dist/hooks/use-lending-position.js +13 -0
  43. package/dist/hooks/use-lending-stats.d.ts +3 -0
  44. package/dist/hooks/use-lending-stats.js +11 -0
  45. package/dist/hooks/use-manager-income.d.ts +9 -0
  46. package/dist/hooks/use-manager-income.js +11 -0
  47. package/dist/hooks/use-market-data.d.ts +4 -0
  48. package/dist/hooks/use-market-data.js +11 -0
  49. package/dist/hooks/use-mcc-history.d.ts +11 -0
  50. package/dist/hooks/use-mcc-history.js +50 -0
  51. package/dist/hooks/use-mcc-holders.d.ts +3 -0
  52. package/dist/hooks/use-mcc-holders.js +11 -0
  53. package/dist/hooks/use-mcc-mining-history.d.ts +3 -0
  54. package/dist/hooks/use-mcc-mining-history.js +11 -0
  55. package/dist/hooks/use-mcc-stats.d.ts +2 -1
  56. package/dist/hooks/use-mcd.js +1 -1
  57. package/dist/hooks/use-mining-action.d.ts +20 -0
  58. package/dist/hooks/use-mining-action.js +55 -0
  59. package/dist/hooks/use-mining-config.d.ts +7 -0
  60. package/dist/hooks/use-mining-config.js +38 -0
  61. package/dist/hooks/use-mining-distribution.d.ts +2 -2
  62. package/dist/hooks/use-mining-flow.d.ts +22 -0
  63. package/dist/hooks/use-mining-flow.js +46 -0
  64. package/dist/hooks/use-mining-history.d.ts +10 -0
  65. package/dist/hooks/use-mining-history.js +46 -0
  66. package/dist/hooks/use-mining-records.d.ts +2 -1
  67. package/dist/hooks/use-mining-stats.d.ts +2 -1
  68. package/dist/hooks/use-multi-wallet-balance.d.ts +15 -0
  69. package/dist/hooks/use-multi-wallet-balance.js +53 -0
  70. package/dist/hooks/use-notification-action.d.ts +10 -0
  71. package/dist/hooks/use-notification-action.js +49 -0
  72. package/dist/hooks/use-notifications.d.ts +13 -0
  73. package/dist/hooks/use-notifications.js +15 -0
  74. package/dist/hooks/use-organization-summary.d.ts +12 -0
  75. package/dist/hooks/use-organization-summary.js +12 -0
  76. package/dist/hooks/use-organization-tree.d.ts +4 -0
  77. package/dist/hooks/use-organization-tree.js +13 -0
  78. package/dist/hooks/use-organizations.d.ts +2 -1
  79. package/dist/hooks/use-platform-stats.d.ts +3 -0
  80. package/dist/hooks/use-platform-stats.js +11 -0
  81. package/dist/hooks/use-price-history.d.ts +2 -1
  82. package/dist/hooks/use-proposal-settle.d.ts +5 -0
  83. package/dist/hooks/use-proposal-settle.js +32 -0
  84. package/dist/hooks/use-public-mining.d.ts +12 -0
  85. package/dist/hooks/use-public-mining.js +54 -0
  86. package/dist/hooks/use-reincarnation-config.d.ts +7 -0
  87. package/dist/hooks/use-reincarnation-config.js +38 -0
  88. package/dist/hooks/use-solana-wallet.d.ts +16 -0
  89. package/dist/hooks/use-solana-wallet.js +56 -0
  90. package/dist/hooks/use-station-join.d.ts +5 -0
  91. package/dist/hooks/use-station-join.js +32 -0
  92. package/dist/hooks/use-station-leave.d.ts +5 -0
  93. package/dist/hooks/use-station-leave.js +32 -0
  94. package/dist/hooks/use-station-queue.d.ts +3 -0
  95. package/dist/hooks/use-station-queue.js +12 -0
  96. package/dist/hooks/use-team-custody.d.ts +18 -0
  97. package/dist/hooks/use-team-custody.js +11 -0
  98. package/dist/hooks/use-tech-tree-action.d.ts +6 -0
  99. package/dist/hooks/use-tech-tree-action.js +51 -0
  100. package/dist/hooks/use-tech-tree-bonus.d.ts +4 -0
  101. package/dist/hooks/use-tech-tree-bonus.js +12 -0
  102. package/dist/hooks/use-tech-tree-config.d.ts +4 -0
  103. package/dist/hooks/use-tech-tree-config.js +11 -0
  104. package/dist/hooks/use-tech-tree.d.ts +2 -1
  105. package/dist/hooks/use-territory-detailed-stats.d.ts +9 -0
  106. package/dist/hooks/use-territory-detailed-stats.js +12 -0
  107. package/dist/hooks/use-territory-distribution-plan.d.ts +16 -0
  108. package/dist/hooks/use-territory-distribution-plan.js +41 -0
  109. package/dist/hooks/use-territory-income.d.ts +6 -0
  110. package/dist/hooks/use-territory-income.js +43 -0
  111. package/dist/hooks/use-territory-kpi.d.ts +6 -0
  112. package/dist/hooks/use-territory-kpi.js +43 -0
  113. package/dist/hooks/use-territory-name-status.d.ts +10 -0
  114. package/dist/hooks/use-territory-name-status.js +13 -0
  115. package/dist/hooks/use-territory-nft-action.d.ts +15 -0
  116. package/dist/hooks/use-territory-nft-action.js +51 -0
  117. package/dist/hooks/use-territory-nft-collection.d.ts +3 -0
  118. package/dist/hooks/use-territory-nft-collection.js +11 -0
  119. package/dist/hooks/use-territory-nft-mint.d.ts +12 -0
  120. package/dist/hooks/use-territory-nft-mint.js +32 -0
  121. package/dist/hooks/use-territory-ranking.d.ts +9 -0
  122. package/dist/hooks/use-territory-ranking.js +46 -0
  123. package/dist/hooks/use-territory-update.d.ts +12 -0
  124. package/dist/hooks/use-territory-update.js +56 -0
  125. package/dist/hooks/use-user-level.d.ts +2 -8
  126. package/dist/hooks/use-user-stats.d.ts +2 -1
  127. package/dist/hooks/use-vote-action.d.ts +14 -0
  128. package/dist/hooks/use-vote-action.js +58 -0
  129. package/dist/index.d.ts +59 -1
  130. package/dist/index.js +116 -1
  131. package/package.json +2 -2
@@ -0,0 +1,5 @@
1
+ export declare function useAuctionBid(): {
2
+ placeBid: (auctionId: number, bidAmount: number) => Promise<any>;
3
+ loading: boolean;
4
+ error: Error | null;
5
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuctionBid = useAuctionBid;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useAuctionBid() {
8
+ const { client, isAuthenticated } = (0, provider_1.useAuth)();
9
+ const [loading, setLoading] = (0, react_1.useState)(false);
10
+ const [error, setError] = (0, react_1.useState)(null);
11
+ const mountedRef = (0, react_1.useRef)(true);
12
+ const placeBid = (0, react_1.useCallback)(async (auctionId, bidAmount) => {
13
+ if (!isAuthenticated)
14
+ throw new Error('Authentication required');
15
+ const api = client.getApiClient();
16
+ try {
17
+ setLoading(true);
18
+ setError(null);
19
+ const res = await api.post(`/auction-solana/auction/${auctionId}/bid`, { bid_amount: bidAmount });
20
+ return res.data;
21
+ }
22
+ catch (err) {
23
+ const e = err instanceof Error ? err : new Error(String(err));
24
+ if (mountedRef.current)
25
+ setError(e);
26
+ throw e;
27
+ }
28
+ finally {
29
+ if (mountedRef.current)
30
+ setLoading(false);
31
+ }
32
+ }, [client, isAuthenticated]);
33
+ return { placeBid, loading, error };
34
+ }
@@ -0,0 +1,4 @@
1
+ import type { AuctionBid } from '@microcosmmoney/auth-core';
2
+ export declare function useAuctionBids(auctionId?: number, options?: {
3
+ refetchInterval?: number;
4
+ }): import("./use-api-query").UseApiQueryResult<AuctionBid[]>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuctionBids = useAuctionBids;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useAuctionBids(auctionId, options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: `/auction-solana/auction/${auctionId}/bids`,
9
+ skip: auctionId === undefined || auctionId === null,
10
+ refetchInterval: options?.refetchInterval ?? 30000,
11
+ });
12
+ }
@@ -0,0 +1,5 @@
1
+ export declare function useAuctionCancel(): {
2
+ prepareCancelBid: (auctionId: number) => Promise<any>;
3
+ loading: boolean;
4
+ error: Error | null;
5
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuctionCancel = useAuctionCancel;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useAuctionCancel() {
8
+ const { client, isAuthenticated } = (0, provider_1.useAuth)();
9
+ const [loading, setLoading] = (0, react_1.useState)(false);
10
+ const [error, setError] = (0, react_1.useState)(null);
11
+ const mountedRef = (0, react_1.useRef)(true);
12
+ const prepareCancelBid = (0, react_1.useCallback)(async (auctionId) => {
13
+ if (!isAuthenticated)
14
+ throw new Error('Authentication required');
15
+ const api = client.getApiClient();
16
+ try {
17
+ setLoading(true);
18
+ setError(null);
19
+ const res = await api.post('/auction-solana/bid/cancel/prepare', { auction_id: auctionId });
20
+ return res.data;
21
+ }
22
+ catch (err) {
23
+ const e = err instanceof Error ? err : new Error(String(err));
24
+ if (mountedRef.current)
25
+ setError(e);
26
+ throw e;
27
+ }
28
+ finally {
29
+ if (mountedRef.current)
30
+ setLoading(false);
31
+ }
32
+ }, [client, isAuthenticated]);
33
+ return { prepareCancelBid, loading, error };
34
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useAuctionConfig(options?: {
2
+ refetchInterval?: number;
3
+ }): import("./use-api-query").UseApiQueryResult<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuctionConfig = useAuctionConfig;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useAuctionConfig(options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: '/auction-solana/config',
9
+ refetchInterval: options?.refetchInterval ?? 300000,
10
+ });
11
+ }
@@ -1,3 +1,4 @@
1
+ import type { AuctionDetail } from '@microcosmmoney/auth-core';
1
2
  export declare function useAuctionDetail(id?: number, options?: {
2
3
  refetchInterval?: number;
3
- }): import("./use-api-query").UseApiQueryResult<any>;
4
+ }): import("./use-api-query").UseApiQueryResult<AuctionDetail>;
@@ -0,0 +1,5 @@
1
+ export declare function useAuctionEnd(): {
2
+ endAuction: (auctionId: number) => Promise<any>;
3
+ loading: boolean;
4
+ error: Error | null;
5
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuctionEnd = useAuctionEnd;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useAuctionEnd() {
8
+ const { client } = (0, provider_1.useAuth)();
9
+ const [loading, setLoading] = (0, react_1.useState)(false);
10
+ const [error, setError] = (0, react_1.useState)(null);
11
+ const mountedRef = (0, react_1.useRef)(true);
12
+ const endAuction = (0, react_1.useCallback)(async (auctionId) => {
13
+ const api = client.getApiClient();
14
+ try {
15
+ setLoading(true);
16
+ setError(null);
17
+ const res = await api.post(`/auction-solana/auction/${auctionId}/end`, {});
18
+ return res.data;
19
+ }
20
+ catch (err) {
21
+ const e = err instanceof Error ? err : new Error(String(err));
22
+ if (mountedRef.current)
23
+ setError(e);
24
+ throw e;
25
+ }
26
+ finally {
27
+ if (mountedRef.current)
28
+ setLoading(false);
29
+ }
30
+ }, [client]);
31
+ return { endAuction, loading, error };
32
+ }
@@ -0,0 +1,9 @@
1
+ export declare function useAuctionHistory(params?: {
2
+ page?: number;
3
+ page_size?: number;
4
+ }): {
5
+ data: any;
6
+ loading: boolean;
7
+ error: Error | null;
8
+ refresh: () => Promise<void>;
9
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuctionHistory = useAuctionHistory;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useAuctionHistory(params) {
8
+ const { client } = (0, provider_1.useAuth)();
9
+ const [data, setData] = (0, react_1.useState)(null);
10
+ const [loading, setLoading] = (0, react_1.useState)(true);
11
+ const [error, setError] = (0, react_1.useState)(null);
12
+ const mountedRef = (0, react_1.useRef)(true);
13
+ const p = params || {};
14
+ const page = p.page || 1;
15
+ const pageSize = p.page_size || 20;
16
+ const fetchData = (0, react_1.useCallback)(async () => {
17
+ const api = client.getApiClient();
18
+ try {
19
+ setLoading(true);
20
+ const res = await api.get(`/auction-solana/history?page=${page}&page_size=${pageSize}`);
21
+ if (mountedRef.current) {
22
+ setData(res.data);
23
+ setError(null);
24
+ }
25
+ }
26
+ catch (err) {
27
+ if (mountedRef.current)
28
+ setError(err instanceof Error ? err : new Error(String(err)));
29
+ }
30
+ finally {
31
+ if (mountedRef.current)
32
+ setLoading(false);
33
+ }
34
+ }, [client, page, pageSize]);
35
+ (0, react_1.useEffect)(() => {
36
+ mountedRef.current = true;
37
+ fetchData();
38
+ return () => { mountedRef.current = false; };
39
+ }, [fetchData]);
40
+ return { data, loading, error, refresh: fetchData };
41
+ }
@@ -0,0 +1,5 @@
1
+ export declare function useAuctionRefund(): {
2
+ prepareRefund: (auctionId: number) => Promise<any>;
3
+ loading: boolean;
4
+ error: Error | null;
5
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuctionRefund = useAuctionRefund;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useAuctionRefund() {
8
+ const { client } = (0, provider_1.useAuth)();
9
+ const [loading, setLoading] = (0, react_1.useState)(false);
10
+ const [error, setError] = (0, react_1.useState)(null);
11
+ const mountedRef = (0, react_1.useRef)(true);
12
+ const prepareRefund = (0, react_1.useCallback)(async (auctionId) => {
13
+ const api = client.getApiClient();
14
+ try {
15
+ setLoading(true);
16
+ setError(null);
17
+ const res = await api.post('/auction-solana/bid/cancel/prepare', { auction_id: auctionId });
18
+ return res.data;
19
+ }
20
+ catch (err) {
21
+ const e = err instanceof Error ? err : new Error(String(err));
22
+ if (mountedRef.current)
23
+ setError(e);
24
+ throw e;
25
+ }
26
+ finally {
27
+ if (mountedRef.current)
28
+ setLoading(false);
29
+ }
30
+ }, [client]);
31
+ return { prepareRefund, loading, error };
32
+ }
@@ -1,3 +1,11 @@
1
- export declare function useAuctions(options?: {
1
+ import type { Auction } from '@microcosmmoney/auth-core';
2
+ interface AuctionFilters {
3
+ status?: string;
4
+ unit_type?: string;
5
+ sort_by?: string;
6
+ page?: number;
7
+ limit?: number;
2
8
  refetchInterval?: number;
3
- }): import("./use-api-query").UseApiQueryResult<any>;
9
+ }
10
+ export declare function useAuctions(options?: AuctionFilters): import("./use-api-query").UseApiQueryResult<Auction[]>;
11
+ export {};
@@ -4,8 +4,21 @@ exports.useAuctions = useAuctions;
4
4
  // AI-generated · AI-managed · AI-maintained
5
5
  const use_api_query_1 = require("./use-api-query");
6
6
  function useAuctions(options) {
7
+ const params = new URLSearchParams();
8
+ if (options?.status)
9
+ params.set('status', options.status);
10
+ if (options?.unit_type)
11
+ params.set('unit_type', options.unit_type);
12
+ if (options?.sort_by)
13
+ params.set('sort_by', options.sort_by);
14
+ if (options?.page)
15
+ params.set('page', String(options.page));
16
+ if (options?.limit)
17
+ params.set('limit', String(options.limit));
18
+ const qs = params.toString();
19
+ const path = qs ? `/auction-solana/active?${qs}` : '/auction-solana/active';
7
20
  return (0, use_api_query_1.useApiQuery)({
8
- path: '/auction-solana/active',
21
+ path,
9
22
  refetchInterval: options?.refetchInterval ?? 60000,
10
23
  });
11
24
  }
@@ -0,0 +1,6 @@
1
+ import type { BuybackRecordInput } from '@microcosmmoney/auth-core';
2
+ export declare function useBuybackAction(): {
3
+ record: (params: BuybackRecordInput) => Promise<any>;
4
+ loading: boolean;
5
+ error: Error | null;
6
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useBuybackAction = useBuybackAction;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useBuybackAction() {
8
+ const { client, isAuthenticated } = (0, provider_1.useAuth)();
9
+ const [loading, setLoading] = (0, react_1.useState)(false);
10
+ const [error, setError] = (0, react_1.useState)(null);
11
+ const mountedRef = (0, react_1.useRef)(true);
12
+ const record = (0, react_1.useCallback)(async (params) => {
13
+ if (!isAuthenticated)
14
+ throw new Error('Authentication required');
15
+ const api = client.getApiClient();
16
+ try {
17
+ setLoading(true);
18
+ setError(null);
19
+ const res = await api.post('/reincarnation/record', params);
20
+ return res.data;
21
+ }
22
+ catch (err) {
23
+ const e = err instanceof Error ? err : new Error(String(err));
24
+ if (mountedRef.current)
25
+ setError(e);
26
+ throw e;
27
+ }
28
+ finally {
29
+ if (mountedRef.current)
30
+ setLoading(false);
31
+ }
32
+ }, [client, isAuthenticated]);
33
+ return { record, loading, error };
34
+ }
@@ -0,0 +1,22 @@
1
+ export type BuybackFlowStep = 'idle' | 'quoting' | 'executing' | 'signing' | 'completed' | 'error';
2
+ export interface BuybackFlowState {
3
+ step: BuybackFlowStep;
4
+ quote: any | null;
5
+ result: any | null;
6
+ txSignature: string | null;
7
+ error: string | null;
8
+ }
9
+ export declare function useBuybackFlow(): {
10
+ getQuote: (params: {
11
+ amount: number;
12
+ wallet_address: string;
13
+ stablecoin?: "USDT" | "USDC";
14
+ }) => Promise<any>;
15
+ executeBuyback: (quoteId: string, txSignature: string) => Promise<any>;
16
+ reset: () => void;
17
+ step: BuybackFlowStep;
18
+ quote: any | null;
19
+ result: any | null;
20
+ txSignature: string | null;
21
+ error: string | null;
22
+ };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useBuybackFlow = useBuybackFlow;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useBuybackFlow() {
8
+ const { client } = (0, provider_1.useAuth)();
9
+ const [state, setState] = (0, react_1.useState)({
10
+ step: 'idle',
11
+ quote: null,
12
+ result: null,
13
+ txSignature: null,
14
+ error: null,
15
+ });
16
+ const reset = (0, react_1.useCallback)(() => {
17
+ setState({ step: 'idle', quote: null, result: null, txSignature: null, error: null });
18
+ }, []);
19
+ const getQuote = (0, react_1.useCallback)(async (params) => {
20
+ const api = client.getApiClient();
21
+ setState(s => ({ ...s, step: 'quoting', error: null }));
22
+ try {
23
+ const q = await api.post('/mcc/buyback/quote', params);
24
+ setState(s => ({ ...s, step: 'executing', quote: q.data }));
25
+ return q.data;
26
+ }
27
+ catch (e) {
28
+ setState(s => ({ ...s, step: 'error', error: e.message }));
29
+ throw e;
30
+ }
31
+ }, [client]);
32
+ const executeBuyback = (0, react_1.useCallback)(async (quoteId, txSignature) => {
33
+ const api = client.getApiClient();
34
+ setState(s => ({ ...s, step: 'signing' }));
35
+ try {
36
+ const res = await api.post('/mcc/buyback/execute', { quote_id: quoteId, tx_signature: txSignature });
37
+ setState(s => ({ ...s, step: 'completed', result: res.data, txSignature }));
38
+ return res.data;
39
+ }
40
+ catch (e) {
41
+ setState(s => ({ ...s, step: 'error', error: e.message }));
42
+ throw e;
43
+ }
44
+ }, [client]);
45
+ return { ...state, getQuote, executeBuyback, reset };
46
+ }
@@ -0,0 +1,6 @@
1
+ import type { AuctionCreateInput } from '@microcosmmoney/auth-core';
2
+ export declare function useCreateAuction(): {
3
+ createAuction: (input: AuctionCreateInput) => Promise<any>;
4
+ loading: boolean;
5
+ error: Error | null;
6
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCreateAuction = useCreateAuction;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useCreateAuction() {
8
+ const { client } = (0, provider_1.useAuth)();
9
+ const [loading, setLoading] = (0, react_1.useState)(false);
10
+ const [error, setError] = (0, react_1.useState)(null);
11
+ const mountedRef = (0, react_1.useRef)(true);
12
+ const createAuction = (0, react_1.useCallback)(async (input) => {
13
+ const api = client.getApiClient();
14
+ try {
15
+ setLoading(true);
16
+ setError(null);
17
+ const res = await api.post('/auction-solana/create', input);
18
+ return res.data;
19
+ }
20
+ catch (err) {
21
+ const e = err instanceof Error ? err : new Error(String(err));
22
+ if (mountedRef.current)
23
+ setError(e);
24
+ throw e;
25
+ }
26
+ finally {
27
+ if (mountedRef.current)
28
+ setLoading(false);
29
+ }
30
+ }, [client]);
31
+ return { createAuction, loading, error };
32
+ }
@@ -0,0 +1,13 @@
1
+ import type { CycleHistory } from '@microcosmmoney/auth-core';
2
+ export declare function useCycleHistory(params?: {
3
+ page?: number;
4
+ page_size?: number;
5
+ }): {
6
+ data: {
7
+ records: CycleHistory[];
8
+ total: number;
9
+ } | null;
10
+ loading: boolean;
11
+ error: Error | null;
12
+ refresh: () => Promise<void>;
13
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCycleHistory = useCycleHistory;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useCycleHistory(params) {
8
+ const { client } = (0, provider_1.useAuth)();
9
+ const [data, setData] = (0, react_1.useState)(null);
10
+ const [loading, setLoading] = (0, react_1.useState)(true);
11
+ const [error, setError] = (0, react_1.useState)(null);
12
+ const mountedRef = (0, react_1.useRef)(true);
13
+ const p = params || {};
14
+ const page = p.page || 1;
15
+ const pageSize = p.page_size || 20;
16
+ const fetchData = (0, react_1.useCallback)(async () => {
17
+ const api = client.getApiClient();
18
+ try {
19
+ setLoading(true);
20
+ const res = await api.get(`/reincarnation/cycle-history?page=${page}&page_size=${pageSize}`);
21
+ if (mountedRef.current) {
22
+ setData(res.data);
23
+ setError(null);
24
+ }
25
+ }
26
+ catch (err) {
27
+ if (mountedRef.current)
28
+ setError(err instanceof Error ? err : new Error(String(err)));
29
+ }
30
+ finally {
31
+ if (mountedRef.current)
32
+ setLoading(false);
33
+ }
34
+ }, [client, page, pageSize]);
35
+ (0, react_1.useEffect)(() => {
36
+ mountedRef.current = true;
37
+ fetchData();
38
+ return () => { mountedRef.current = false; };
39
+ }, [fetchData]);
40
+ return { data, loading, error, refresh: fetchData };
41
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useDashboardMiningHistory(days?: number, options?: {
2
+ refetchInterval?: number;
3
+ }): import("./use-api-query").UseApiQueryResult<any[]>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDashboardMiningHistory = useDashboardMiningHistory;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useDashboardMiningHistory(days = 30, options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: `/dashboard/stats/mining-history?days=${days}`,
9
+ refetchInterval: options?.refetchInterval ?? 300000,
10
+ });
11
+ }
@@ -1,16 +1,7 @@
1
- interface DashboardSummary {
2
- market: {
3
- price_usd: number;
4
- price_change_24h: number;
5
- volume_24h: number;
6
- liquidity_usd: number;
7
- fdv: number;
8
- market_cap: number;
9
- } | null;
10
- user: {
11
- level: any;
12
- mcc_balance: any;
13
- } | null;
1
+ import type { DashboardMarketSummary, DashboardUserSummary } from '@microcosmmoney/auth-core';
2
+ export interface DashboardSummary {
3
+ market: DashboardMarketSummary | null;
4
+ user: DashboardUserSummary | null;
14
5
  }
15
6
  export declare function useDashboardSummary(wallet?: string, options?: {
16
7
  refetchInterval?: number;
@@ -20,4 +11,3 @@ export declare function useDashboardSummary(wallet?: string, options?: {
20
11
  error: Error | null;
21
12
  refresh: () => Promise<void>;
22
13
  };
23
- export {};
@@ -0,0 +1,3 @@
1
+ export declare function useDashboardTerritoryStats(options?: {
2
+ refetchInterval?: number;
3
+ }): import("./use-api-query").UseApiQueryResult<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDashboardTerritoryStats = useDashboardTerritoryStats;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useDashboardTerritoryStats(options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: '/dashboard/stats/territories',
9
+ refetchInterval: options?.refetchInterval ?? 300000,
10
+ });
11
+ }
@@ -0,0 +1,4 @@
1
+ import type { UserStats } from '@microcosmmoney/auth-core';
2
+ export declare function useDashboardUserStats(options?: {
3
+ refetchInterval?: number;
4
+ }): import("./use-api-query").UseApiQueryResult<UserStats>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDashboardUserStats = useDashboardUserStats;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useDashboardUserStats(options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: '/dashboard/stats/users',
9
+ refetchInterval: options?.refetchInterval ?? 300000,
10
+ });
11
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useFragmentConfig(options?: {
2
+ refetchInterval?: number;
3
+ }): import("./use-api-query").UseApiQueryResult<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFragmentConfig = useFragmentConfig;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useFragmentConfig(options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: '/fragment/config',
9
+ refetchInterval: options?.refetchInterval ?? 300000,
10
+ });
11
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useFragmentVaultDetail(vaultId?: string, options?: {
2
+ refetchInterval?: number;
3
+ }): import("./use-api-query").UseApiQueryResult<any>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFragmentVaultDetail = useFragmentVaultDetail;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useFragmentVaultDetail(vaultId, options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: `/fragment/vault/${vaultId}`,
9
+ skip: !vaultId,
10
+ refetchInterval: options?.refetchInterval ?? 60000,
11
+ });
12
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useFragmentVaults(options?: {
2
+ refetchInterval?: number;
3
+ }): import("./use-api-query").UseApiQueryResult<any[]>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFragmentVaults = useFragmentVaults;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useFragmentVaults(options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: '/fragment/vaults',
9
+ refetchInterval: options?.refetchInterval ?? 120000,
10
+ });
11
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useLendingPool(options?: {
2
+ refetchInterval?: number;
3
+ }): import("./use-api-query").UseApiQueryResult<any>;