@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.
- package/dist/hooks/use-auction-bid.d.ts +5 -0
- package/dist/hooks/use-auction-bid.js +34 -0
- package/dist/hooks/use-auction-bids.d.ts +4 -0
- package/dist/hooks/use-auction-bids.js +12 -0
- package/dist/hooks/use-auction-cancel.d.ts +5 -0
- package/dist/hooks/use-auction-cancel.js +34 -0
- package/dist/hooks/use-auction-config.d.ts +3 -0
- package/dist/hooks/use-auction-config.js +11 -0
- package/dist/hooks/use-auction-detail.d.ts +2 -1
- package/dist/hooks/use-auction-end.d.ts +5 -0
- package/dist/hooks/use-auction-end.js +32 -0
- package/dist/hooks/use-auction-history.d.ts +9 -0
- package/dist/hooks/use-auction-history.js +41 -0
- package/dist/hooks/use-auction-refund.d.ts +5 -0
- package/dist/hooks/use-auction-refund.js +32 -0
- package/dist/hooks/use-auctions.d.ts +10 -2
- package/dist/hooks/use-auctions.js +14 -1
- package/dist/hooks/use-buyback-action.d.ts +6 -0
- package/dist/hooks/use-buyback-action.js +34 -0
- package/dist/hooks/use-buyback-flow.d.ts +22 -0
- package/dist/hooks/use-buyback-flow.js +46 -0
- package/dist/hooks/use-create-auction.d.ts +6 -0
- package/dist/hooks/use-create-auction.js +32 -0
- package/dist/hooks/use-cycle-history.d.ts +13 -0
- package/dist/hooks/use-cycle-history.js +41 -0
- package/dist/hooks/use-dashboard-mining-history.d.ts +3 -0
- package/dist/hooks/use-dashboard-mining-history.js +11 -0
- package/dist/hooks/use-dashboard-summary.d.ts +4 -14
- package/dist/hooks/use-dashboard-territory-stats.d.ts +3 -0
- package/dist/hooks/use-dashboard-territory-stats.js +11 -0
- package/dist/hooks/use-dashboard-user-stats.d.ts +4 -0
- package/dist/hooks/use-dashboard-user-stats.js +11 -0
- package/dist/hooks/use-fragment-config.d.ts +3 -0
- package/dist/hooks/use-fragment-config.js +11 -0
- package/dist/hooks/use-fragment-vault-detail.d.ts +3 -0
- package/dist/hooks/use-fragment-vault-detail.js +12 -0
- package/dist/hooks/use-fragment-vaults.d.ts +3 -0
- package/dist/hooks/use-fragment-vaults.js +11 -0
- package/dist/hooks/use-lending-pool.d.ts +3 -0
- package/dist/hooks/use-lending-pool.js +11 -0
- package/dist/hooks/use-lending-position.d.ts +3 -0
- package/dist/hooks/use-lending-position.js +13 -0
- package/dist/hooks/use-lending-stats.d.ts +3 -0
- package/dist/hooks/use-lending-stats.js +11 -0
- package/dist/hooks/use-manager-income.d.ts +9 -0
- package/dist/hooks/use-manager-income.js +11 -0
- package/dist/hooks/use-market-data.d.ts +4 -0
- package/dist/hooks/use-market-data.js +11 -0
- package/dist/hooks/use-mcc-history.d.ts +11 -0
- package/dist/hooks/use-mcc-history.js +50 -0
- package/dist/hooks/use-mcc-holders.d.ts +3 -0
- package/dist/hooks/use-mcc-holders.js +11 -0
- package/dist/hooks/use-mcc-mining-history.d.ts +3 -0
- package/dist/hooks/use-mcc-mining-history.js +11 -0
- package/dist/hooks/use-mcc-stats.d.ts +2 -1
- package/dist/hooks/use-mcd.js +1 -1
- package/dist/hooks/use-mining-action.d.ts +20 -0
- package/dist/hooks/use-mining-action.js +55 -0
- package/dist/hooks/use-mining-config.d.ts +7 -0
- package/dist/hooks/use-mining-config.js +38 -0
- package/dist/hooks/use-mining-distribution.d.ts +2 -2
- package/dist/hooks/use-mining-flow.d.ts +22 -0
- package/dist/hooks/use-mining-flow.js +46 -0
- package/dist/hooks/use-mining-history.d.ts +10 -0
- package/dist/hooks/use-mining-history.js +46 -0
- package/dist/hooks/use-mining-records.d.ts +2 -1
- package/dist/hooks/use-mining-stats.d.ts +2 -1
- package/dist/hooks/use-multi-wallet-balance.d.ts +15 -0
- package/dist/hooks/use-multi-wallet-balance.js +53 -0
- package/dist/hooks/use-notification-action.d.ts +10 -0
- package/dist/hooks/use-notification-action.js +49 -0
- package/dist/hooks/use-notifications.d.ts +13 -0
- package/dist/hooks/use-notifications.js +15 -0
- package/dist/hooks/use-organization-summary.d.ts +12 -0
- package/dist/hooks/use-organization-summary.js +12 -0
- package/dist/hooks/use-organization-tree.d.ts +4 -0
- package/dist/hooks/use-organization-tree.js +13 -0
- package/dist/hooks/use-organizations.d.ts +2 -1
- package/dist/hooks/use-platform-stats.d.ts +3 -0
- package/dist/hooks/use-platform-stats.js +11 -0
- package/dist/hooks/use-price-history.d.ts +2 -1
- package/dist/hooks/use-proposal-settle.d.ts +5 -0
- package/dist/hooks/use-proposal-settle.js +32 -0
- package/dist/hooks/use-public-mining.d.ts +12 -0
- package/dist/hooks/use-public-mining.js +54 -0
- package/dist/hooks/use-reincarnation-config.d.ts +7 -0
- package/dist/hooks/use-reincarnation-config.js +38 -0
- package/dist/hooks/use-solana-wallet.d.ts +16 -0
- package/dist/hooks/use-solana-wallet.js +56 -0
- package/dist/hooks/use-station-join.d.ts +5 -0
- package/dist/hooks/use-station-join.js +32 -0
- package/dist/hooks/use-station-leave.d.ts +5 -0
- package/dist/hooks/use-station-leave.js +32 -0
- package/dist/hooks/use-station-queue.d.ts +3 -0
- package/dist/hooks/use-station-queue.js +12 -0
- package/dist/hooks/use-team-custody.d.ts +18 -0
- package/dist/hooks/use-team-custody.js +11 -0
- package/dist/hooks/use-tech-tree-action.d.ts +6 -0
- package/dist/hooks/use-tech-tree-action.js +51 -0
- package/dist/hooks/use-tech-tree-bonus.d.ts +4 -0
- package/dist/hooks/use-tech-tree-bonus.js +12 -0
- package/dist/hooks/use-tech-tree-config.d.ts +4 -0
- package/dist/hooks/use-tech-tree-config.js +11 -0
- package/dist/hooks/use-tech-tree.d.ts +2 -1
- package/dist/hooks/use-territory-detailed-stats.d.ts +9 -0
- package/dist/hooks/use-territory-detailed-stats.js +12 -0
- package/dist/hooks/use-territory-distribution-plan.d.ts +16 -0
- package/dist/hooks/use-territory-distribution-plan.js +41 -0
- package/dist/hooks/use-territory-income.d.ts +6 -0
- package/dist/hooks/use-territory-income.js +43 -0
- package/dist/hooks/use-territory-kpi.d.ts +6 -0
- package/dist/hooks/use-territory-kpi.js +43 -0
- package/dist/hooks/use-territory-name-status.d.ts +10 -0
- package/dist/hooks/use-territory-name-status.js +13 -0
- package/dist/hooks/use-territory-nft-action.d.ts +15 -0
- package/dist/hooks/use-territory-nft-action.js +51 -0
- package/dist/hooks/use-territory-nft-collection.d.ts +3 -0
- package/dist/hooks/use-territory-nft-collection.js +11 -0
- package/dist/hooks/use-territory-nft-mint.d.ts +12 -0
- package/dist/hooks/use-territory-nft-mint.js +32 -0
- package/dist/hooks/use-territory-ranking.d.ts +9 -0
- package/dist/hooks/use-territory-ranking.js +46 -0
- package/dist/hooks/use-territory-update.d.ts +12 -0
- package/dist/hooks/use-territory-update.js +56 -0
- package/dist/hooks/use-user-level.d.ts +2 -8
- package/dist/hooks/use-user-stats.d.ts +2 -1
- package/dist/hooks/use-vote-action.d.ts +14 -0
- package/dist/hooks/use-vote-action.js +58 -0
- package/dist/index.d.ts +59 -1
- package/dist/index.js +116 -1
- package/package.json +2 -2
|
@@ -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,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,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,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<
|
|
4
|
+
}): import("./use-api-query").UseApiQueryResult<AuctionDetail>;
|
|
@@ -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,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,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
|
-
|
|
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
|
-
}
|
|
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
|
|
21
|
+
path,
|
|
9
22
|
refetchInterval: options?.refetchInterval ?? 60000,
|
|
10
23
|
});
|
|
11
24
|
}
|
|
@@ -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,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,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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,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,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,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,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,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
|
+
}
|