@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,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTerritoryIncome = useTerritoryIncome;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useTerritoryIncome(territoryId, period = '30d') {
8
+ const { client, isAuthenticated } = (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 fetchData = (0, react_1.useCallback)(async () => {
14
+ if (!isAuthenticated || !territoryId) {
15
+ setData(null);
16
+ setLoading(false);
17
+ return;
18
+ }
19
+ const api = client.getApiClient();
20
+ try {
21
+ setLoading(true);
22
+ const res = await api.get(`/territories/${territoryId}/income-chart?period=${period}`);
23
+ if (mountedRef.current) {
24
+ setData(res.data);
25
+ setError(null);
26
+ }
27
+ }
28
+ catch (err) {
29
+ if (mountedRef.current)
30
+ setError(err instanceof Error ? err : new Error(String(err)));
31
+ }
32
+ finally {
33
+ if (mountedRef.current)
34
+ setLoading(false);
35
+ }
36
+ }, [client, isAuthenticated, territoryId, period]);
37
+ (0, react_1.useEffect)(() => {
38
+ mountedRef.current = true;
39
+ fetchData();
40
+ return () => { mountedRef.current = false; };
41
+ }, [fetchData]);
42
+ return { data, loading, error, refresh: fetchData };
43
+ }
@@ -0,0 +1,6 @@
1
+ export declare function useTerritoryKPI(territoryId?: string): {
2
+ data: any;
3
+ loading: boolean;
4
+ error: Error | null;
5
+ refresh: () => Promise<void>;
6
+ };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTerritoryKPI = useTerritoryKPI;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useTerritoryKPI(territoryId) {
8
+ const { client, isAuthenticated } = (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 fetchData = (0, react_1.useCallback)(async () => {
14
+ if (!isAuthenticated || !territoryId) {
15
+ setData(null);
16
+ setLoading(false);
17
+ return;
18
+ }
19
+ const api = client.getApiClient();
20
+ try {
21
+ setLoading(true);
22
+ const res = await api.get(`/territories/${territoryId}/kpi-history`);
23
+ if (mountedRef.current) {
24
+ setData(res.data);
25
+ setError(null);
26
+ }
27
+ }
28
+ catch (err) {
29
+ if (mountedRef.current)
30
+ setError(err instanceof Error ? err : new Error(String(err)));
31
+ }
32
+ finally {
33
+ if (mountedRef.current)
34
+ setLoading(false);
35
+ }
36
+ }, [client, isAuthenticated, territoryId]);
37
+ (0, react_1.useEffect)(() => {
38
+ mountedRef.current = true;
39
+ fetchData();
40
+ return () => { mountedRef.current = false; };
41
+ }, [fetchData]);
42
+ return { data, loading, error, refresh: fetchData };
43
+ }
@@ -0,0 +1,10 @@
1
+ interface TerritoryNameStatus {
2
+ current_name: string;
3
+ last_changed_at: string | null;
4
+ cooldown_ends_at: string | null;
5
+ can_change: boolean;
6
+ }
7
+ export declare function useTerritoryNameStatus(territoryId?: string, options?: {
8
+ refetchInterval?: number;
9
+ }): import("./use-api-query").UseApiQueryResult<TerritoryNameStatus>;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTerritoryNameStatus = useTerritoryNameStatus;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useTerritoryNameStatus(territoryId, options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: `/territories/${territoryId}/name-status`,
9
+ skip: !territoryId,
10
+ requireAuth: true,
11
+ refetchInterval: options?.refetchInterval ?? 0,
12
+ });
13
+ }
@@ -0,0 +1,15 @@
1
+ export declare function useTerritoryNFTAction(): {
2
+ transferNFT: (params: {
3
+ territory_id: string;
4
+ nft_mint: string;
5
+ to_wallet: string;
6
+ tx_signature?: string;
7
+ }) => Promise<any>;
8
+ burnNFT: (params: {
9
+ territory_id: string;
10
+ nft_mint: string;
11
+ tx_signature?: string;
12
+ }) => Promise<any>;
13
+ loading: boolean;
14
+ error: Error | null;
15
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTerritoryNFTAction = useTerritoryNFTAction;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useTerritoryNFTAction() {
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 transferNFT = (0, react_1.useCallback)(async (params) => {
13
+ const api = client.getApiClient();
14
+ try {
15
+ setLoading(true);
16
+ setError(null);
17
+ const res = await api.post(`/territories/${params.territory_id}/nft/transfer`, params);
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
+ const burnNFT = (0, react_1.useCallback)(async (params) => {
32
+ const api = client.getApiClient();
33
+ try {
34
+ setLoading(true);
35
+ setError(null);
36
+ const res = await api.post(`/territories/${params.territory_id}/nft/burn`, params);
37
+ return res.data;
38
+ }
39
+ catch (err) {
40
+ const e = err instanceof Error ? err : new Error(String(err));
41
+ if (mountedRef.current)
42
+ setError(e);
43
+ throw e;
44
+ }
45
+ finally {
46
+ if (mountedRef.current)
47
+ setLoading(false);
48
+ }
49
+ }, [client]);
50
+ return { transferNFT, burnNFT, loading, error };
51
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useTerritoryNFTCollection(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.useTerritoryNFTCollection = useTerritoryNFTCollection;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const use_api_query_1 = require("./use-api-query");
6
+ function useTerritoryNFTCollection(options) {
7
+ return (0, use_api_query_1.useApiQuery)({
8
+ path: '/territory/collection',
9
+ refetchInterval: options?.refetchInterval ?? 300000,
10
+ });
11
+ }
@@ -0,0 +1,12 @@
1
+ export interface NFTMintInput {
2
+ territory_id: string;
3
+ name: string;
4
+ symbol: string;
5
+ uri: string;
6
+ recipient_wallet?: string;
7
+ }
8
+ export declare function useTerritoryNFTMint(): {
9
+ mint: (input: NFTMintInput) => Promise<any>;
10
+ loading: boolean;
11
+ error: Error | null;
12
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTerritoryNFTMint = useTerritoryNFTMint;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useTerritoryNFTMint() {
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 mint = (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(`/territories/${input.territory_id}/nft/mint`, 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 { mint, loading, error };
32
+ }
@@ -0,0 +1,9 @@
1
+ export declare function useTerritoryRanking(territoryId?: string, 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,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTerritoryRanking = useTerritoryRanking;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useTerritoryRanking(territoryId, params) {
8
+ const { client, isAuthenticated } = (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
+ if (!isAuthenticated || !territoryId) {
18
+ setData(null);
19
+ setLoading(false);
20
+ return;
21
+ }
22
+ const api = client.getApiClient();
23
+ try {
24
+ setLoading(true);
25
+ const res = await api.get(`/territories/${territoryId}/member-ranking?page=${page}&page_size=${pageSize}`);
26
+ if (mountedRef.current) {
27
+ setData(res.data);
28
+ setError(null);
29
+ }
30
+ }
31
+ catch (err) {
32
+ if (mountedRef.current)
33
+ setError(err instanceof Error ? err : new Error(String(err)));
34
+ }
35
+ finally {
36
+ if (mountedRef.current)
37
+ setLoading(false);
38
+ }
39
+ }, [client, isAuthenticated, territoryId, page, pageSize]);
40
+ (0, react_1.useEffect)(() => {
41
+ mountedRef.current = true;
42
+ fetchData();
43
+ return () => { mountedRef.current = false; };
44
+ }, [fetchData]);
45
+ return { data, loading, error, refresh: fetchData };
46
+ }
@@ -0,0 +1,12 @@
1
+ interface TerritoryUpdateData {
2
+ unit_name?: string;
3
+ description?: string;
4
+ image_url?: string;
5
+ }
6
+ export declare function useTerritoryUpdate(): {
7
+ update: (territoryId: string, data: TerritoryUpdateData) => Promise<any>;
8
+ updateName: (territoryId: string, name: string, force?: boolean) => Promise<any>;
9
+ loading: boolean;
10
+ error: Error | null;
11
+ };
12
+ export {};
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTerritoryUpdate = useTerritoryUpdate;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useTerritoryUpdate() {
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 update = (0, react_1.useCallback)(async (territoryId, data) => {
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.put(`/territories/${territoryId}`, data);
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
+ const updateName = (0, react_1.useCallback)(async (territoryId, name, force = false) => {
34
+ if (!isAuthenticated)
35
+ throw new Error('Authentication required');
36
+ const api = client.getApiClient();
37
+ try {
38
+ setLoading(true);
39
+ setError(null);
40
+ const qs = force ? '?force=true' : '';
41
+ const res = await api.put(`/territories/${territoryId}/name${qs}`, { name });
42
+ return res.data;
43
+ }
44
+ catch (err) {
45
+ const e = err instanceof Error ? err : new Error(String(err));
46
+ if (mountedRef.current)
47
+ setError(e);
48
+ throw e;
49
+ }
50
+ finally {
51
+ if (mountedRef.current)
52
+ setLoading(false);
53
+ }
54
+ }, [client, isAuthenticated]);
55
+ return { update, updateName, loading, error };
56
+ }
@@ -1,10 +1,4 @@
1
- interface UserLevelData {
2
- level: string;
3
- title?: string | null;
4
- upgrade_progress?: Record<string, any>;
5
- mining_weight?: Record<string, number>;
6
- }
1
+ import type { UserLevel } from '@microcosmmoney/auth-core';
7
2
  export declare function useUserLevel(options?: {
8
3
  refetchInterval?: number;
9
- }): import("./use-api-query").UseApiQueryResult<UserLevelData>;
10
- export {};
4
+ }): import("./use-api-query").UseApiQueryResult<UserLevel>;
@@ -1,3 +1,4 @@
1
+ import type { UserStats } from '@microcosmmoney/auth-core';
1
2
  export declare function useUserStats(options?: {
2
3
  refetchInterval?: number;
3
- }): import("./use-api-query").UseApiQueryResult<any>;
4
+ }): import("./use-api-query").UseApiQueryResult<UserStats>;
@@ -0,0 +1,14 @@
1
+ interface CreateProposalParams {
2
+ title: string;
3
+ description: string;
4
+ proposal_type?: string;
5
+ voting_hours?: number;
6
+ options: string[];
7
+ }
8
+ export declare function useVoteAction(): {
9
+ createProposal: (params: CreateProposalParams) => Promise<any>;
10
+ castVote: (proposalId: string, optionIndex: number, voteCount?: number) => Promise<any>;
11
+ loading: boolean;
12
+ error: Error | null;
13
+ };
14
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useVoteAction = useVoteAction;
4
+ // AI-generated · AI-managed · AI-maintained
5
+ const react_1 = require("react");
6
+ const provider_1 = require("../provider");
7
+ function useVoteAction() {
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 createProposal = (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('/voting/proposals', 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
+ const castVote = (0, react_1.useCallback)(async (proposalId, optionIndex, voteCount) => {
34
+ if (!isAuthenticated)
35
+ throw new Error('Authentication required');
36
+ const api = client.getApiClient();
37
+ try {
38
+ setLoading(true);
39
+ setError(null);
40
+ const body = { option_index: optionIndex };
41
+ if (voteCount !== undefined)
42
+ body.vote_count = voteCount;
43
+ const res = await api.post(`/voting/proposals/${proposalId}/vote`, body);
44
+ return res.data;
45
+ }
46
+ catch (err) {
47
+ const e = err instanceof Error ? err : new Error(String(err));
48
+ if (mountedRef.current)
49
+ setError(e);
50
+ throw e;
51
+ }
52
+ finally {
53
+ if (mountedRef.current)
54
+ setLoading(false);
55
+ }
56
+ }, [client, isAuthenticated]);
57
+ return { createProposal, castVote, loading, error };
58
+ }
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export { useOrganizations } from './hooks/use-organizations';
19
19
  export { useTechTree } from './hooks/use-tech-tree';
20
20
  export { usePriceHistory } from './hooks/use-price-history';
21
21
  export { useDashboardSummary } from './hooks/use-dashboard-summary';
22
+ export type { DashboardSummary } from './hooks/use-dashboard-summary';
22
23
  export { useWallets } from './hooks/use-wallets';
23
24
  export { useTokenPortfolio } from './hooks/use-token-portfolio';
24
25
  export { useMCCLocks } from './hooks/use-mcc-locks';
@@ -39,4 +40,61 @@ export { useVotePower } from './hooks/use-vote-power';
39
40
  export { useMyBids } from './hooks/use-my-bids';
40
41
  export { useAuctionDetail } from './hooks/use-auction-detail';
41
42
  export { useUserStats } from './hooks/use-user-stats';
42
- export type { MicrocosmAuthConfig, MicrocosmAPIConfig, User, AuthState, LoginOptions, MCDBalance, MCCBalance, MCCPrice, Wallet, TokenPortfolio, MCCLock, MiningRatio, MiningDistribution, BuybackQuote, BuybackRecord, Territory, TerritorySummary, TerritoryStats, TerritoryMember, Proposal, ProposalDetail, VoteResult, VotePower, AuctionBid, MCDTransaction, MCDReward, } from '@microcosmmoney/auth-core';
43
+ export { useMiningAction } from './hooks/use-mining-action';
44
+ export { usePublicMining } from './hooks/use-public-mining';
45
+ export { useBuybackAction } from './hooks/use-buyback-action';
46
+ export { useTerritoryUpdate } from './hooks/use-territory-update';
47
+ export { useAuctionCancel } from './hooks/use-auction-cancel';
48
+ export { useAuctionBid } from './hooks/use-auction-bid';
49
+ export { useAuctionHistory } from './hooks/use-auction-history';
50
+ export { useVoteAction } from './hooks/use-vote-action';
51
+ export { useMCCHistory } from './hooks/use-mcc-history';
52
+ export { useMiningConfig } from './hooks/use-mining-config';
53
+ export { useMiningHistory } from './hooks/use-mining-history';
54
+ export { useReincarnationConfig } from './hooks/use-reincarnation-config';
55
+ export { useCycleHistory } from './hooks/use-cycle-history';
56
+ export { useTerritoryIncome } from './hooks/use-territory-income';
57
+ export { useTerritoryKPI } from './hooks/use-territory-kpi';
58
+ export { useTerritoryRanking } from './hooks/use-territory-ranking';
59
+ export { useCreateAuction } from './hooks/use-create-auction';
60
+ export { useAuctionRefund } from './hooks/use-auction-refund';
61
+ export { useMarketData } from './hooks/use-market-data';
62
+ export { useOrganizationTree } from './hooks/use-organization-tree';
63
+ export { useOrganizationSummary } from './hooks/use-organization-summary';
64
+ export { useMultiWalletBalance } from './hooks/use-multi-wallet-balance';
65
+ export { useAuctionBids } from './hooks/use-auction-bids';
66
+ export { useStationJoin } from './hooks/use-station-join';
67
+ export { useStationLeave } from './hooks/use-station-leave';
68
+ export { useStationQueue } from './hooks/use-station-queue';
69
+ export { useTechTreeAction } from './hooks/use-tech-tree-action';
70
+ export { useTechTreeConfig } from './hooks/use-tech-tree-config';
71
+ export { useTechTreeBonus } from './hooks/use-tech-tree-bonus';
72
+ export { useTerritoryNFTCollection } from './hooks/use-territory-nft-collection';
73
+ export { useTerritoryNameStatus } from './hooks/use-territory-name-status';
74
+ export { useTerritoryDistributionPlan } from './hooks/use-territory-distribution-plan';
75
+ export { useFragmentVaults } from './hooks/use-fragment-vaults';
76
+ export { useFragmentVaultDetail } from './hooks/use-fragment-vault-detail';
77
+ export { useLendingPool } from './hooks/use-lending-pool';
78
+ export { useLendingPosition } from './hooks/use-lending-position';
79
+ export { useMCCHolders } from './hooks/use-mcc-holders';
80
+ export { usePlatformStats } from './hooks/use-platform-stats';
81
+ export { useDashboardMiningHistory } from './hooks/use-dashboard-mining-history';
82
+ export { useAuctionConfig } from './hooks/use-auction-config';
83
+ export { useFragmentConfig } from './hooks/use-fragment-config';
84
+ export { useLendingStats } from './hooks/use-lending-stats';
85
+ export { useMCCMiningHistory } from './hooks/use-mcc-mining-history';
86
+ export { useDashboardUserStats } from './hooks/use-dashboard-user-stats';
87
+ export { useDashboardTerritoryStats } from './hooks/use-dashboard-territory-stats';
88
+ export { useTerritoryDetailedStats } from './hooks/use-territory-detailed-stats';
89
+ export { useTerritoryNFTMint } from './hooks/use-territory-nft-mint';
90
+ export { useManagerIncome } from './hooks/use-manager-income';
91
+ export { useProposalSettle } from './hooks/use-proposal-settle';
92
+ export { useAuctionEnd } from './hooks/use-auction-end';
93
+ export { useNotifications } from './hooks/use-notifications';
94
+ export { useNotificationAction } from './hooks/use-notification-action';
95
+ export { useTeamCustody } from './hooks/use-team-custody';
96
+ export { useSolanaWallet } from './hooks/use-solana-wallet';
97
+ export { useMiningFlow } from './hooks/use-mining-flow';
98
+ export { useBuybackFlow } from './hooks/use-buyback-flow';
99
+ export { useTerritoryNFTAction } from './hooks/use-territory-nft-action';
100
+ export type { MicrocosmAuthConfig, MicrocosmAPIConfig, User, AuthState, LoginOptions, MCDBalance, MCCBalance, MCCWalletBalance, MCCPrice, Wallet, TokenPortfolio, MCCLock, MiningRatio, MiningDistribution, BuybackQuote, BuybackRecord, Territory, TerritorySummary, TerritoryStats, TerritoryMember, Proposal, ProposalDetail, VoteResult, VotePower, AuctionBid, MCDTransaction, MCDReward, MiningRequest, MiningConfirmData, MiningRequestResult, MiningConfig, BuybackRecordInput, ReincarnationConfig, MCCHistoryRecord, CycleHistory, AuctionHistory, PaginatedResult, MCCStats, MiningStats, TechTreeNode, TechTree, TechTreeBonus, UserStats, Organization, OrganizationTreeNode, MiningRecord, MiningHistoryItem, PriceHistoryPoint, Auction, AuctionDetail, AuctionCreateInput, TerritoryIncome, TerritoryKPI, UserLevel, DashboardMarketSummary, DashboardUserSummary, PublicMiningRequest, UnitType, } from '@microcosmmoney/auth-core';