@microcosmmoney/auth-react 2.1.0 → 2.2.1
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-fragment-vault-holders.d.ts +10 -0
- package/dist/hooks/use-fragment-vault-holders.js +14 -0
- package/dist/hooks/use-lending-interest.d.ts +23 -0
- package/dist/hooks/use-lending-interest.js +23 -0
- package/dist/hooks/use-lending-loan-detail.d.ts +15 -0
- package/dist/hooks/use-lending-loan-detail.js +13 -0
- package/dist/hooks/use-mcc-supply.d.ts +21 -0
- package/dist/hooks/use-mcc-supply.js +28 -0
- package/dist/hooks/use-nft-metadata.d.ts +24 -0
- package/dist/hooks/use-nft-metadata.js +21 -0
- package/dist/hooks/use-project-apply.d.ts +22 -0
- package/dist/hooks/{use-buyback-action.js → use-project-apply.js} +15 -5
- package/dist/hooks/use-public-profile.d.ts +18 -0
- package/dist/hooks/use-public-profile.js +22 -0
- package/dist/index.d.ts +21 -8
- package/dist/index.js +31 -17
- package/package.json +41 -39
- package/dist/hooks/use-buyback-action.d.ts +0 -6
- package/dist/hooks/use-buyback-flow.d.ts +0 -22
- package/dist/hooks/use-buyback-flow.js +0 -44
- package/dist/hooks/use-buyback-history.d.ts +0 -6
- package/dist/hooks/use-buyback-history.js +0 -15
- package/dist/hooks/use-buyback-quote.d.ts +0 -7
- package/dist/hooks/use-buyback-quote.js +0 -43
- package/dist/hooks/use-cycle-history.d.ts +0 -13
- package/dist/hooks/use-cycle-history.js +0 -40
- package/dist/hooks/use-reincarnation-config.d.ts +0 -7
- package/dist/hooks/use-reincarnation-config.js +0 -37
- package/dist/hooks/use-reincarnation-pool.d.ts +0 -10
- package/dist/hooks/use-reincarnation-pool.js +0 -11
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface FragmentVaultHolder {
|
|
2
|
+
wallet: string;
|
|
3
|
+
uid?: string;
|
|
4
|
+
display_name?: string;
|
|
5
|
+
fragments: number;
|
|
6
|
+
percentage: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function useFragmentVaultHolders(vaultId?: string, options?: {
|
|
9
|
+
refetchInterval?: number;
|
|
10
|
+
}): import("./use-api-query").UseApiQueryResult<FragmentVaultHolder[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFragmentVaultHolders = useFragmentVaultHolders;
|
|
4
|
+
// AI-generated · AI-managed · AI-maintained
|
|
5
|
+
const use_api_query_1 = require("./use-api-query");
|
|
6
|
+
function useFragmentVaultHolders(vaultId, options) {
|
|
7
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
8
|
+
path: `/fragment/vaults/${vaultId}/holders`,
|
|
9
|
+
requireAuth: false,
|
|
10
|
+
skip: !vaultId,
|
|
11
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
12
|
+
select: (d) => Array.isArray(d) ? d : d?.holders ?? [],
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface InterestCalculation {
|
|
2
|
+
principal: number;
|
|
3
|
+
rate: number;
|
|
4
|
+
duration_days: number;
|
|
5
|
+
total_interest: number;
|
|
6
|
+
total_repayment: number;
|
|
7
|
+
}
|
|
8
|
+
export interface BorrowCostEstimate {
|
|
9
|
+
nft_value: number;
|
|
10
|
+
max_borrow: number;
|
|
11
|
+
ltv_ratio: number;
|
|
12
|
+
estimated_interest: number;
|
|
13
|
+
estimated_total: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function useLendingInterest(params?: {
|
|
16
|
+
amount: number;
|
|
17
|
+
duration_days: number;
|
|
18
|
+
}, options?: {
|
|
19
|
+
refetchInterval?: number;
|
|
20
|
+
}): import("./use-api-query").UseApiQueryResult<InterestCalculation>;
|
|
21
|
+
export declare function useLendingBorrowCost(nftMint?: string, options?: {
|
|
22
|
+
refetchInterval?: number;
|
|
23
|
+
}): import("./use-api-query").UseApiQueryResult<BorrowCostEstimate>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLendingInterest = useLendingInterest;
|
|
4
|
+
exports.useLendingBorrowCost = useLendingBorrowCost;
|
|
5
|
+
// AI-generated · AI-managed · AI-maintained
|
|
6
|
+
const use_api_query_1 = require("./use-api-query");
|
|
7
|
+
function useLendingInterest(params, options) {
|
|
8
|
+
const qs = params ? `?amount=${params.amount}&duration_days=${params.duration_days}` : '';
|
|
9
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
10
|
+
path: `/lending/calculate-interest${qs}`,
|
|
11
|
+
requireAuth: false,
|
|
12
|
+
skip: !params,
|
|
13
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function useLendingBorrowCost(nftMint, options) {
|
|
17
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
18
|
+
path: `/lending/estimate-borrow-cost/${nftMint}`,
|
|
19
|
+
requireAuth: false,
|
|
20
|
+
skip: !nftMint,
|
|
21
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LendingLoanDetail {
|
|
2
|
+
loan_id: string;
|
|
3
|
+
nft_mint: string;
|
|
4
|
+
borrower: string;
|
|
5
|
+
amount: number;
|
|
6
|
+
interest_rate: number;
|
|
7
|
+
duration_days: number;
|
|
8
|
+
start_time: string;
|
|
9
|
+
end_time: string;
|
|
10
|
+
status: 'active' | 'repaid' | 'liquidated' | 'extended';
|
|
11
|
+
collateral_value: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function useLendingLoanDetail(loanId?: string, options?: {
|
|
14
|
+
refetchInterval?: number;
|
|
15
|
+
}): import("./use-api-query").UseApiQueryResult<LendingLoanDetail>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLendingLoanDetail = useLendingLoanDetail;
|
|
4
|
+
// AI-generated · AI-managed · AI-maintained
|
|
5
|
+
const use_api_query_1 = require("./use-api-query");
|
|
6
|
+
function useLendingLoanDetail(loanId, options) {
|
|
7
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
8
|
+
path: `/lending/loans/${loanId}`,
|
|
9
|
+
requireAuth: false,
|
|
10
|
+
skip: !loanId,
|
|
11
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface MCCTokenInfo {
|
|
2
|
+
mint: string;
|
|
3
|
+
name: string;
|
|
4
|
+
symbol: string;
|
|
5
|
+
decimals: number;
|
|
6
|
+
total_supply: number;
|
|
7
|
+
circulating_supply: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function useMCCCirculatingSupply(options?: {
|
|
10
|
+
refetchInterval?: number;
|
|
11
|
+
}): import("./use-api-query").UseApiQueryResult<{
|
|
12
|
+
circulating_supply: number;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function useMCCTotalSupply(options?: {
|
|
15
|
+
refetchInterval?: number;
|
|
16
|
+
}): import("./use-api-query").UseApiQueryResult<{
|
|
17
|
+
total_supply: number;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function useMCCTokenInfo(options?: {
|
|
20
|
+
refetchInterval?: number;
|
|
21
|
+
}): import("./use-api-query").UseApiQueryResult<MCCTokenInfo>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMCCCirculatingSupply = useMCCCirculatingSupply;
|
|
4
|
+
exports.useMCCTotalSupply = useMCCTotalSupply;
|
|
5
|
+
exports.useMCCTokenInfo = useMCCTokenInfo;
|
|
6
|
+
// AI-generated · AI-managed · AI-maintained
|
|
7
|
+
const use_api_query_1 = require("./use-api-query");
|
|
8
|
+
function useMCCCirculatingSupply(options) {
|
|
9
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
10
|
+
path: '/mcc/circulating-supply',
|
|
11
|
+
requireAuth: false,
|
|
12
|
+
refetchInterval: options?.refetchInterval ?? 60000,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function useMCCTotalSupply(options) {
|
|
16
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
17
|
+
path: '/mcc/total-supply',
|
|
18
|
+
requireAuth: false,
|
|
19
|
+
refetchInterval: options?.refetchInterval ?? 300000,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function useMCCTokenInfo(options) {
|
|
23
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
24
|
+
path: '/mcc/token-info',
|
|
25
|
+
requireAuth: false,
|
|
26
|
+
refetchInterval: options?.refetchInterval ?? 300000,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface NFTCollectionMetadata {
|
|
2
|
+
name: string;
|
|
3
|
+
symbol: string;
|
|
4
|
+
description: string;
|
|
5
|
+
image: string;
|
|
6
|
+
external_url: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TerritoryNFTMetadata {
|
|
9
|
+
name: string;
|
|
10
|
+
symbol: string;
|
|
11
|
+
description: string;
|
|
12
|
+
image: string;
|
|
13
|
+
attributes: Array<{
|
|
14
|
+
trait_type: string;
|
|
15
|
+
value: string | number;
|
|
16
|
+
}>;
|
|
17
|
+
properties?: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
export declare function useNFTCollectionMetadata(options?: {
|
|
20
|
+
refetchInterval?: number;
|
|
21
|
+
}): import("./use-api-query").UseApiQueryResult<NFTCollectionMetadata>;
|
|
22
|
+
export declare function useTerritoryNFTMetadata(territoryId?: string, options?: {
|
|
23
|
+
refetchInterval?: number;
|
|
24
|
+
}): import("./use-api-query").UseApiQueryResult<TerritoryNFTMetadata>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNFTCollectionMetadata = useNFTCollectionMetadata;
|
|
4
|
+
exports.useTerritoryNFTMetadata = useTerritoryNFTMetadata;
|
|
5
|
+
// AI-generated · AI-managed · AI-maintained
|
|
6
|
+
const use_api_query_1 = require("./use-api-query");
|
|
7
|
+
function useNFTCollectionMetadata(options) {
|
|
8
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
9
|
+
path: '/nft/metadata/collection.json',
|
|
10
|
+
requireAuth: false,
|
|
11
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function useTerritoryNFTMetadata(territoryId, options) {
|
|
15
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
16
|
+
path: `/nft/metadata/${territoryId}.json`,
|
|
17
|
+
requireAuth: false,
|
|
18
|
+
skip: !territoryId,
|
|
19
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ProjectApplication {
|
|
2
|
+
id: string;
|
|
3
|
+
project_name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
status: 'pending' | 'approved' | 'rejected';
|
|
6
|
+
client_id?: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function useProjectApplications(options?: {
|
|
10
|
+
refetchInterval?: number;
|
|
11
|
+
}): import("./use-api-query").UseApiQueryResult<ProjectApplication[]>;
|
|
12
|
+
export declare function useProjectApply(): {
|
|
13
|
+
apply: (data: {
|
|
14
|
+
project_name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
redirect_uris: string[];
|
|
17
|
+
domains: string[];
|
|
18
|
+
mcd_wallet?: string;
|
|
19
|
+
}) => Promise<any>;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: Error | null;
|
|
22
|
+
};
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useProjectApplications = useProjectApplications;
|
|
4
|
+
exports.useProjectApply = useProjectApply;
|
|
4
5
|
// AI-generated · AI-managed · AI-maintained
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const microcosm_context_1 = require("../microcosm-context");
|
|
7
|
-
|
|
8
|
+
const use_api_query_1 = require("./use-api-query");
|
|
9
|
+
function useProjectApplications(options) {
|
|
10
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
11
|
+
path: '/open/projects/applications/mine',
|
|
12
|
+
requireAuth: true,
|
|
13
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
14
|
+
select: (d) => Array.isArray(d) ? d : d?.applications ?? [],
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function useProjectApply() {
|
|
8
18
|
const api = (0, microcosm_context_1.useMicrocosmApi)();
|
|
9
19
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
10
20
|
const [error, setError] = (0, react_1.useState)(null);
|
|
11
21
|
const mountedRef = (0, react_1.useRef)(true);
|
|
12
|
-
const
|
|
22
|
+
const apply = (0, react_1.useCallback)(async (data) => {
|
|
13
23
|
try {
|
|
14
24
|
setLoading(true);
|
|
15
25
|
setError(null);
|
|
16
|
-
const res = await api.post('/
|
|
26
|
+
const res = await api.post('/open/projects/apply', data);
|
|
17
27
|
return res.data;
|
|
18
28
|
}
|
|
19
29
|
catch (err) {
|
|
@@ -27,5 +37,5 @@ function useBuybackAction() {
|
|
|
27
37
|
setLoading(false);
|
|
28
38
|
}
|
|
29
39
|
}, [api]);
|
|
30
|
-
return {
|
|
40
|
+
return { apply, loading, error };
|
|
31
41
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PublicProfile {
|
|
2
|
+
uid: string;
|
|
3
|
+
display_name: string | null;
|
|
4
|
+
avatar_url: string | null;
|
|
5
|
+
level: number;
|
|
6
|
+
title: string | null;
|
|
7
|
+
territory_id: string | null;
|
|
8
|
+
joined_at: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function usePublicProfile(uid?: string, options?: {
|
|
11
|
+
refetchInterval?: number;
|
|
12
|
+
}): import("./use-api-query").UseApiQueryResult<PublicProfile>;
|
|
13
|
+
export declare function useDetailedProfile(uid?: string, options?: {
|
|
14
|
+
refetchInterval?: number;
|
|
15
|
+
}): import("./use-api-query").UseApiQueryResult<PublicProfile & {
|
|
16
|
+
mining_stats?: any;
|
|
17
|
+
wallet?: string;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePublicProfile = usePublicProfile;
|
|
4
|
+
exports.useDetailedProfile = useDetailedProfile;
|
|
5
|
+
// AI-generated · AI-managed · AI-maintained
|
|
6
|
+
const use_api_query_1 = require("./use-api-query");
|
|
7
|
+
function usePublicProfile(uid, options) {
|
|
8
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
9
|
+
path: `/users/${uid}/profile`,
|
|
10
|
+
requireAuth: false,
|
|
11
|
+
skip: !uid,
|
|
12
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function useDetailedProfile(uid, options) {
|
|
16
|
+
return (0, use_api_query_1.useApiQuery)({
|
|
17
|
+
path: `/users/${uid}/profile/detailed`,
|
|
18
|
+
requireAuth: true,
|
|
19
|
+
skip: !uid,
|
|
20
|
+
refetchInterval: options?.refetchInterval ?? 0,
|
|
21
|
+
});
|
|
22
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export { useMCDStats } from './hooks/use-mcd-stats';
|
|
|
15
15
|
export { useMiningStats } from './hooks/use-mining-stats';
|
|
16
16
|
export { useMiningRecords } from './hooks/use-mining-records';
|
|
17
17
|
export { useUserLevel } from './hooks/use-user-level';
|
|
18
|
-
export { useReincarnationPool } from './hooks/use-reincarnation-pool';
|
|
19
18
|
export { useTerritoryNFTs } from './hooks/use-territory-nfts';
|
|
20
19
|
export { useAuctions } from './hooks/use-auctions';
|
|
21
20
|
export { useOrganizations } from './hooks/use-organizations';
|
|
@@ -30,8 +29,6 @@ export { useMiningRatio } from './hooks/use-mining-ratio';
|
|
|
30
29
|
export { useMiningDistribution } from './hooks/use-mining-distribution';
|
|
31
30
|
export { useMCDTransactions } from './hooks/use-mcd-transactions';
|
|
32
31
|
export { useMCDRewards } from './hooks/use-mcd-rewards';
|
|
33
|
-
export { useBuybackQuote } from './hooks/use-buyback-quote';
|
|
34
|
-
export { useBuybackHistory } from './hooks/use-buyback-history';
|
|
35
32
|
export { useTerritories } from './hooks/use-territories';
|
|
36
33
|
export { useTerritorySummary } from './hooks/use-territory-summary';
|
|
37
34
|
export { useTerritoryDetail } from './hooks/use-territory-detail';
|
|
@@ -45,7 +42,6 @@ export { useAuctionDetail } from './hooks/use-auction-detail';
|
|
|
45
42
|
export { useUserStats } from './hooks/use-user-stats';
|
|
46
43
|
export { useMiningAction } from './hooks/use-mining-action';
|
|
47
44
|
export { usePublicMining } from './hooks/use-public-mining';
|
|
48
|
-
export { useBuybackAction } from './hooks/use-buyback-action';
|
|
49
45
|
export { useTerritoryUpdate } from './hooks/use-territory-update';
|
|
50
46
|
export { useAuctionCancel } from './hooks/use-auction-cancel';
|
|
51
47
|
export { useAuctionBid } from './hooks/use-auction-bid';
|
|
@@ -54,8 +50,6 @@ export { useVoteAction } from './hooks/use-vote-action';
|
|
|
54
50
|
export { useMCCHistory } from './hooks/use-mcc-history';
|
|
55
51
|
export { useMiningConfig } from './hooks/use-mining-config';
|
|
56
52
|
export { useMiningHistory } from './hooks/use-mining-history';
|
|
57
|
-
export { useReincarnationConfig } from './hooks/use-reincarnation-config';
|
|
58
|
-
export { useCycleHistory } from './hooks/use-cycle-history';
|
|
59
53
|
export { useTerritoryIncome } from './hooks/use-territory-income';
|
|
60
54
|
export { useTerritoryKPI } from './hooks/use-territory-kpi';
|
|
61
55
|
export { useTerritoryRanking } from './hooks/use-territory-ranking';
|
|
@@ -101,7 +95,8 @@ export { useAuctionEnd } from './hooks/use-auction-end';
|
|
|
101
95
|
export { useTeamCustody } from './hooks/use-team-custody';
|
|
102
96
|
export { useRefundDeposit } from './hooks/use-refund-deposit';
|
|
103
97
|
export { useMiningFlow } from './hooks/use-mining-flow';
|
|
104
|
-
export {
|
|
98
|
+
export { useSolanaWallet } from './hooks/use-solana-wallet';
|
|
99
|
+
export type { SolanaWalletState } from './hooks/use-solana-wallet';
|
|
105
100
|
export { useTerritoryNFTAction } from './hooks/use-territory-nft-action';
|
|
106
101
|
export { useTerritoryImage } from './hooks/use-territory-image';
|
|
107
102
|
export { useTerritoryUserStatus } from './hooks/use-territory-user-status';
|
|
@@ -113,4 +108,22 @@ export { useLendingLoans } from './hooks/use-lending-loans';
|
|
|
113
108
|
export { useLendingLPBalance } from './hooks/use-lending-lp-balance';
|
|
114
109
|
export { useFragmentAction } from './hooks/use-fragment-action';
|
|
115
110
|
export { useLendingAction } from './hooks/use-lending-action';
|
|
116
|
-
export
|
|
111
|
+
export { useNotifications } from './hooks/use-notifications';
|
|
112
|
+
export type { Notification } from './hooks/use-notifications';
|
|
113
|
+
export { useNotificationCount } from './hooks/use-notification-count';
|
|
114
|
+
export { useNotificationAction } from './hooks/use-notification-action';
|
|
115
|
+
export { usePublicProfile, useDetailedProfile } from './hooks/use-public-profile';
|
|
116
|
+
export type { PublicProfile } from './hooks/use-public-profile';
|
|
117
|
+
export { useProjectApply, useProjectApplications } from './hooks/use-project-apply';
|
|
118
|
+
export type { ProjectApplication } from './hooks/use-project-apply';
|
|
119
|
+
export { useNFTCollectionMetadata, useTerritoryNFTMetadata } from './hooks/use-nft-metadata';
|
|
120
|
+
export type { NFTCollectionMetadata, TerritoryNFTMetadata } from './hooks/use-nft-metadata';
|
|
121
|
+
export { useMCCCirculatingSupply, useMCCTotalSupply, useMCCTokenInfo } from './hooks/use-mcc-supply';
|
|
122
|
+
export type { MCCTokenInfo } from './hooks/use-mcc-supply';
|
|
123
|
+
export { useLendingLoanDetail } from './hooks/use-lending-loan-detail';
|
|
124
|
+
export type { LendingLoanDetail } from './hooks/use-lending-loan-detail';
|
|
125
|
+
export { useLendingInterest, useLendingBorrowCost } from './hooks/use-lending-interest';
|
|
126
|
+
export type { InterestCalculation, BorrowCostEstimate } from './hooks/use-lending-interest';
|
|
127
|
+
export { useFragmentVaultHolders } from './hooks/use-fragment-vault-holders';
|
|
128
|
+
export type { FragmentVaultHolder } from './hooks/use-fragment-vault-holders';
|
|
129
|
+
export type { MicrocosmAuthConfig, MicrocosmAPIConfig, User, AuthState, LoginOptions, MCDBalance, MCCBalance, MCCWalletBalance, MCCPrice, Wallet, TokenPortfolio, MCCLock, MiningRatio, MiningDistribution, Territory, TerritorySummary, TerritoryStats, TerritoryMember, Proposal, ProposalDetail, VoteResult, VotePower, AuctionBid, MCDTransaction, MCDReward, MiningRequest, MiningConfirmData, MiningRequestResult, MiningConfig, MCCHistoryRecord, AuctionHistory, PaginatedResult, MCCStats, MiningStats, TechTreeNode, TechTree, TechTreeBonus, UserStats, Organization, OrganizationTreeNode, MiningRecord, MiningHistoryItem, PriceHistoryPoint, Auction, AuctionDetail, AuctionCreateInput, TerritoryIncome, TerritoryKPI, UserLevel, DashboardMarketSummary, DashboardUserSummary, PublicMiningRequest, UnitType, OrganizationSummary, TerritoryDetailedStats, ManagerIncomeRecord, TeamCustodySummary, FragmentBuyInput, FragmentizeInput, FragmentRedeemInput, FragmentBuyoutInitiateInput, FragmentBuyoutAcceptInput, FragmentBuyoutCompleteInput, FragmentBuyoutCancelInput, LendingDepositInput, LendingWithdrawInput, LendingBorrowInput, LendingRepayInput, LendingExtendInput, LendingLiquidateInput, } from '@microcosmmoney/auth-core';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.useProposalSettle = exports.useManagerIncome = exports.useTerritoryNFTMint = exports.useTerritoryDetailedStats = exports.useDashboardTerritoryStats = exports.useDashboardUserStats = exports.useMCCMiningHistory = exports.useLendingStats = exports.useFragmentConfig = exports.useAuctionConfig = exports.useDashboardMiningHistory = exports.usePlatformStats = exports.useMCCHolders = exports.useLendingPosition = exports.useLendingOracle = exports.useLendingPool = exports.useFragmentVaultDetail = exports.useFragmentVaults = exports.useTerritoryDistributionPlan = exports.useTerritoryNameStatus = exports.useTerritoryNFTCollection = exports.useTechTreeBonus = exports.useTechTreeConfig = exports.useTechTreeAction = exports.useTerritoryQueue = exports.useTerritoryLeave = exports.useTerritoryJoin = exports.useStationQueue = exports.useStationLeave = exports.useStationJoin = exports.useAuctionBids = exports.useMultiWalletBalance = exports.useOrganizationSummary = exports.useOrganizationTree = exports.useMarketData = exports.useAuctionRefund = exports.useCreateAuction = exports.useTerritoryRanking = exports.useTerritoryKPI = exports.useTerritoryIncome = exports.
|
|
5
|
-
exports.
|
|
3
|
+
exports.useAuctionHistory = exports.useAuctionBid = exports.useAuctionCancel = exports.useTerritoryUpdate = exports.usePublicMining = exports.useMiningAction = exports.useUserStats = exports.useAuctionDetail = exports.useMyBids = exports.useVotePower = exports.useProposalDetail = exports.useProposals = exports.useTerritoryMembers = exports.useTerritoryStats = exports.useTerritoryDetail = exports.useTerritorySummary = exports.useTerritories = exports.useMCDRewards = exports.useMCDTransactions = exports.useMiningDistribution = exports.useMiningRatio = exports.useMCCLocks = exports.useTokenPortfolio = exports.useWallets = exports.useDashboardSummary = exports.usePriceHistory = exports.useTechTree = exports.useOrganizations = exports.useAuctions = exports.useTerritoryNFTs = exports.useUserLevel = exports.useMiningRecords = exports.useMiningStats = exports.useMCDStats = exports.useMCCStats = exports.useMCCPrice = exports.useApiQuery = exports.useProfile = exports.useMCC = exports.useMCD = exports.RequireRole = exports.withAuth = exports.AuthCallback = exports.useMicrocosmApi = exports.useMicrocosmContext = exports.MicrocosmProvider = exports.useAuthOptional = exports.useAuth = exports.MicrocosmAuthProvider = exports.UserRank = void 0;
|
|
4
|
+
exports.useTerritoryNFTAction = exports.useSolanaWallet = exports.useMiningFlow = exports.useRefundDeposit = exports.useTeamCustody = exports.useAuctionEnd = exports.useProposalSettle = exports.useManagerIncome = exports.useTerritoryNFTMint = exports.useTerritoryDetailedStats = exports.useDashboardTerritoryStats = exports.useDashboardUserStats = exports.useMCCMiningHistory = exports.useLendingStats = exports.useFragmentConfig = exports.useAuctionConfig = exports.useDashboardMiningHistory = exports.usePlatformStats = exports.useMCCHolders = exports.useLendingPosition = exports.useLendingOracle = exports.useLendingPool = exports.useFragmentVaultDetail = exports.useFragmentVaults = exports.useTerritoryDistributionPlan = exports.useTerritoryNameStatus = exports.useTerritoryNFTCollection = exports.useTechTreeBonus = exports.useTechTreeConfig = exports.useTechTreeAction = exports.useTerritoryQueue = exports.useTerritoryLeave = exports.useTerritoryJoin = exports.useStationQueue = exports.useStationLeave = exports.useStationJoin = exports.useAuctionBids = exports.useMultiWalletBalance = exports.useOrganizationSummary = exports.useOrganizationTree = exports.useMarketData = exports.useAuctionRefund = exports.useCreateAuction = exports.useTerritoryRanking = exports.useTerritoryKPI = exports.useTerritoryIncome = exports.useMiningHistory = exports.useMiningConfig = exports.useMCCHistory = exports.useVoteAction = void 0;
|
|
5
|
+
exports.useFragmentVaultHolders = exports.useLendingBorrowCost = exports.useLendingInterest = exports.useLendingLoanDetail = exports.useMCCTokenInfo = exports.useMCCTotalSupply = exports.useMCCCirculatingSupply = exports.useTerritoryNFTMetadata = exports.useNFTCollectionMetadata = exports.useProjectApplications = exports.useProjectApply = exports.useDetailedProfile = exports.usePublicProfile = exports.useNotificationAction = exports.useNotificationCount = exports.useNotifications = exports.useLendingAction = exports.useFragmentAction = exports.useLendingLPBalance = exports.useLendingLoans = exports.useFragmentHoldings = exports.useOrganizationStats = exports.useOrganizationMembers = exports.useOrganizationDetail = exports.useTerritoryUserStatus = exports.useTerritoryImage = void 0;
|
|
6
6
|
// AI-generated · AI-managed · AI-maintained
|
|
7
7
|
var auth_core_1 = require("@microcosmmoney/auth-core");
|
|
8
8
|
Object.defineProperty(exports, "UserRank", { enumerable: true, get: function () { return auth_core_1.UserRank; } });
|
|
@@ -40,8 +40,6 @@ var use_mining_records_1 = require("./hooks/use-mining-records");
|
|
|
40
40
|
Object.defineProperty(exports, "useMiningRecords", { enumerable: true, get: function () { return use_mining_records_1.useMiningRecords; } });
|
|
41
41
|
var use_user_level_1 = require("./hooks/use-user-level");
|
|
42
42
|
Object.defineProperty(exports, "useUserLevel", { enumerable: true, get: function () { return use_user_level_1.useUserLevel; } });
|
|
43
|
-
var use_reincarnation_pool_1 = require("./hooks/use-reincarnation-pool");
|
|
44
|
-
Object.defineProperty(exports, "useReincarnationPool", { enumerable: true, get: function () { return use_reincarnation_pool_1.useReincarnationPool; } });
|
|
45
43
|
var use_territory_nfts_1 = require("./hooks/use-territory-nfts");
|
|
46
44
|
Object.defineProperty(exports, "useTerritoryNFTs", { enumerable: true, get: function () { return use_territory_nfts_1.useTerritoryNFTs; } });
|
|
47
45
|
var use_auctions_1 = require("./hooks/use-auctions");
|
|
@@ -68,10 +66,6 @@ var use_mcd_transactions_1 = require("./hooks/use-mcd-transactions");
|
|
|
68
66
|
Object.defineProperty(exports, "useMCDTransactions", { enumerable: true, get: function () { return use_mcd_transactions_1.useMCDTransactions; } });
|
|
69
67
|
var use_mcd_rewards_1 = require("./hooks/use-mcd-rewards");
|
|
70
68
|
Object.defineProperty(exports, "useMCDRewards", { enumerable: true, get: function () { return use_mcd_rewards_1.useMCDRewards; } });
|
|
71
|
-
var use_buyback_quote_1 = require("./hooks/use-buyback-quote");
|
|
72
|
-
Object.defineProperty(exports, "useBuybackQuote", { enumerable: true, get: function () { return use_buyback_quote_1.useBuybackQuote; } });
|
|
73
|
-
var use_buyback_history_1 = require("./hooks/use-buyback-history");
|
|
74
|
-
Object.defineProperty(exports, "useBuybackHistory", { enumerable: true, get: function () { return use_buyback_history_1.useBuybackHistory; } });
|
|
75
69
|
var use_territories_1 = require("./hooks/use-territories");
|
|
76
70
|
Object.defineProperty(exports, "useTerritories", { enumerable: true, get: function () { return use_territories_1.useTerritories; } });
|
|
77
71
|
var use_territory_summary_1 = require("./hooks/use-territory-summary");
|
|
@@ -98,8 +92,6 @@ var use_mining_action_1 = require("./hooks/use-mining-action");
|
|
|
98
92
|
Object.defineProperty(exports, "useMiningAction", { enumerable: true, get: function () { return use_mining_action_1.useMiningAction; } });
|
|
99
93
|
var use_public_mining_1 = require("./hooks/use-public-mining");
|
|
100
94
|
Object.defineProperty(exports, "usePublicMining", { enumerable: true, get: function () { return use_public_mining_1.usePublicMining; } });
|
|
101
|
-
var use_buyback_action_1 = require("./hooks/use-buyback-action");
|
|
102
|
-
Object.defineProperty(exports, "useBuybackAction", { enumerable: true, get: function () { return use_buyback_action_1.useBuybackAction; } });
|
|
103
95
|
var use_territory_update_1 = require("./hooks/use-territory-update");
|
|
104
96
|
Object.defineProperty(exports, "useTerritoryUpdate", { enumerable: true, get: function () { return use_territory_update_1.useTerritoryUpdate; } });
|
|
105
97
|
var use_auction_cancel_1 = require("./hooks/use-auction-cancel");
|
|
@@ -116,10 +108,6 @@ var use_mining_config_1 = require("./hooks/use-mining-config");
|
|
|
116
108
|
Object.defineProperty(exports, "useMiningConfig", { enumerable: true, get: function () { return use_mining_config_1.useMiningConfig; } });
|
|
117
109
|
var use_mining_history_1 = require("./hooks/use-mining-history");
|
|
118
110
|
Object.defineProperty(exports, "useMiningHistory", { enumerable: true, get: function () { return use_mining_history_1.useMiningHistory; } });
|
|
119
|
-
var use_reincarnation_config_1 = require("./hooks/use-reincarnation-config");
|
|
120
|
-
Object.defineProperty(exports, "useReincarnationConfig", { enumerable: true, get: function () { return use_reincarnation_config_1.useReincarnationConfig; } });
|
|
121
|
-
var use_cycle_history_1 = require("./hooks/use-cycle-history");
|
|
122
|
-
Object.defineProperty(exports, "useCycleHistory", { enumerable: true, get: function () { return use_cycle_history_1.useCycleHistory; } });
|
|
123
111
|
var use_territory_income_1 = require("./hooks/use-territory-income");
|
|
124
112
|
Object.defineProperty(exports, "useTerritoryIncome", { enumerable: true, get: function () { return use_territory_income_1.useTerritoryIncome; } });
|
|
125
113
|
var use_territory_kpi_1 = require("./hooks/use-territory-kpi");
|
|
@@ -208,8 +196,8 @@ var use_refund_deposit_1 = require("./hooks/use-refund-deposit");
|
|
|
208
196
|
Object.defineProperty(exports, "useRefundDeposit", { enumerable: true, get: function () { return use_refund_deposit_1.useRefundDeposit; } });
|
|
209
197
|
var use_mining_flow_1 = require("./hooks/use-mining-flow");
|
|
210
198
|
Object.defineProperty(exports, "useMiningFlow", { enumerable: true, get: function () { return use_mining_flow_1.useMiningFlow; } });
|
|
211
|
-
var
|
|
212
|
-
Object.defineProperty(exports, "
|
|
199
|
+
var use_solana_wallet_1 = require("./hooks/use-solana-wallet");
|
|
200
|
+
Object.defineProperty(exports, "useSolanaWallet", { enumerable: true, get: function () { return use_solana_wallet_1.useSolanaWallet; } });
|
|
213
201
|
var use_territory_nft_action_1 = require("./hooks/use-territory-nft-action");
|
|
214
202
|
Object.defineProperty(exports, "useTerritoryNFTAction", { enumerable: true, get: function () { return use_territory_nft_action_1.useTerritoryNFTAction; } });
|
|
215
203
|
var use_territory_image_1 = require("./hooks/use-territory-image");
|
|
@@ -232,3 +220,29 @@ var use_fragment_action_1 = require("./hooks/use-fragment-action");
|
|
|
232
220
|
Object.defineProperty(exports, "useFragmentAction", { enumerable: true, get: function () { return use_fragment_action_1.useFragmentAction; } });
|
|
233
221
|
var use_lending_action_1 = require("./hooks/use-lending-action");
|
|
234
222
|
Object.defineProperty(exports, "useLendingAction", { enumerable: true, get: function () { return use_lending_action_1.useLendingAction; } });
|
|
223
|
+
var use_notifications_1 = require("./hooks/use-notifications");
|
|
224
|
+
Object.defineProperty(exports, "useNotifications", { enumerable: true, get: function () { return use_notifications_1.useNotifications; } });
|
|
225
|
+
var use_notification_count_1 = require("./hooks/use-notification-count");
|
|
226
|
+
Object.defineProperty(exports, "useNotificationCount", { enumerable: true, get: function () { return use_notification_count_1.useNotificationCount; } });
|
|
227
|
+
var use_notification_action_1 = require("./hooks/use-notification-action");
|
|
228
|
+
Object.defineProperty(exports, "useNotificationAction", { enumerable: true, get: function () { return use_notification_action_1.useNotificationAction; } });
|
|
229
|
+
var use_public_profile_1 = require("./hooks/use-public-profile");
|
|
230
|
+
Object.defineProperty(exports, "usePublicProfile", { enumerable: true, get: function () { return use_public_profile_1.usePublicProfile; } });
|
|
231
|
+
Object.defineProperty(exports, "useDetailedProfile", { enumerable: true, get: function () { return use_public_profile_1.useDetailedProfile; } });
|
|
232
|
+
var use_project_apply_1 = require("./hooks/use-project-apply");
|
|
233
|
+
Object.defineProperty(exports, "useProjectApply", { enumerable: true, get: function () { return use_project_apply_1.useProjectApply; } });
|
|
234
|
+
Object.defineProperty(exports, "useProjectApplications", { enumerable: true, get: function () { return use_project_apply_1.useProjectApplications; } });
|
|
235
|
+
var use_nft_metadata_1 = require("./hooks/use-nft-metadata");
|
|
236
|
+
Object.defineProperty(exports, "useNFTCollectionMetadata", { enumerable: true, get: function () { return use_nft_metadata_1.useNFTCollectionMetadata; } });
|
|
237
|
+
Object.defineProperty(exports, "useTerritoryNFTMetadata", { enumerable: true, get: function () { return use_nft_metadata_1.useTerritoryNFTMetadata; } });
|
|
238
|
+
var use_mcc_supply_1 = require("./hooks/use-mcc-supply");
|
|
239
|
+
Object.defineProperty(exports, "useMCCCirculatingSupply", { enumerable: true, get: function () { return use_mcc_supply_1.useMCCCirculatingSupply; } });
|
|
240
|
+
Object.defineProperty(exports, "useMCCTotalSupply", { enumerable: true, get: function () { return use_mcc_supply_1.useMCCTotalSupply; } });
|
|
241
|
+
Object.defineProperty(exports, "useMCCTokenInfo", { enumerable: true, get: function () { return use_mcc_supply_1.useMCCTokenInfo; } });
|
|
242
|
+
var use_lending_loan_detail_1 = require("./hooks/use-lending-loan-detail");
|
|
243
|
+
Object.defineProperty(exports, "useLendingLoanDetail", { enumerable: true, get: function () { return use_lending_loan_detail_1.useLendingLoanDetail; } });
|
|
244
|
+
var use_lending_interest_1 = require("./hooks/use-lending-interest");
|
|
245
|
+
Object.defineProperty(exports, "useLendingInterest", { enumerable: true, get: function () { return use_lending_interest_1.useLendingInterest; } });
|
|
246
|
+
Object.defineProperty(exports, "useLendingBorrowCost", { enumerable: true, get: function () { return use_lending_interest_1.useLendingBorrowCost; } });
|
|
247
|
+
var use_fragment_vault_holders_1 = require("./hooks/use-fragment-vault-holders");
|
|
248
|
+
Object.defineProperty(exports, "useFragmentVaultHolders", { enumerable: true, get: function () { return use_fragment_vault_holders_1.useFragmentVaultHolders; } });
|
package/package.json
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@microcosmmoney/auth-react",
|
|
3
|
-
"version": "2.1
|
|
4
|
-
"description": "Microcosm OAuth 2.0 React/Next.js adapter",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"default": "./dist/index.js"
|
|
11
|
-
},
|
|
12
|
-
"./server": {
|
|
13
|
-
"types": "./dist/server/index.d.ts",
|
|
14
|
-
"default": "./dist/server/index.js"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@microcosmmoney/auth-react",
|
|
3
|
+
"version": "2.2.1",
|
|
4
|
+
"description": "Microcosm OAuth 2.0 React/Next.js adapter",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./server": {
|
|
13
|
+
"types": "./dist/server/index.d.ts",
|
|
14
|
+
"default": "./dist/server/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"dev": "tsc --watch"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": ">=18.0.0",
|
|
26
|
+
"react-dom": ">=18.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@microcosmmoney/auth-core": "^2.2.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/react": "^18.0.0",
|
|
33
|
+
"react": "^18.0.0",
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/MicrocosmMoney/Microcosm"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
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 microcosm_context_1 = require("../microcosm-context");
|
|
7
|
-
function useBuybackFlow() {
|
|
8
|
-
const api = (0, microcosm_context_1.useMicrocosmApi)();
|
|
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
|
-
setState(s => ({ ...s, step: 'quoting', error: null }));
|
|
21
|
-
try {
|
|
22
|
-
const q = await api.post('/mcc/buyback/quote', params);
|
|
23
|
-
setState(s => ({ ...s, step: 'executing', quote: q.data }));
|
|
24
|
-
return q.data;
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
setState(s => ({ ...s, step: 'error', error: e.message }));
|
|
28
|
-
throw e;
|
|
29
|
-
}
|
|
30
|
-
}, [api]);
|
|
31
|
-
const executeBuyback = (0, react_1.useCallback)(async (quoteId, txSignature) => {
|
|
32
|
-
setState(s => ({ ...s, step: 'signing' }));
|
|
33
|
-
try {
|
|
34
|
-
const res = await api.post('/mcc/buyback/execute', { quote_id: quoteId, tx_signature: txSignature });
|
|
35
|
-
setState(s => ({ ...s, step: 'completed', result: res.data, txSignature }));
|
|
36
|
-
return res.data;
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
setState(s => ({ ...s, step: 'error', error: e.message }));
|
|
40
|
-
throw e;
|
|
41
|
-
}
|
|
42
|
-
}, [api]);
|
|
43
|
-
return { ...state, getQuote, executeBuyback, reset };
|
|
44
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useBuybackHistory = useBuybackHistory;
|
|
4
|
-
// AI-generated · AI-managed · AI-maintained
|
|
5
|
-
const use_api_query_1 = require("./use-api-query");
|
|
6
|
-
function useBuybackHistory(options) {
|
|
7
|
-
const page = options?.page ?? 1;
|
|
8
|
-
const pageSize = options?.pageSize ?? 20;
|
|
9
|
-
return (0, use_api_query_1.useApiQuery)({
|
|
10
|
-
path: `/reincarnation/user-history?page=${page}&page_size=${pageSize}`,
|
|
11
|
-
requireAuth: true,
|
|
12
|
-
refetchInterval: options?.refetchInterval ?? 0,
|
|
13
|
-
select: (d) => Array.isArray(d) ? d : d?.records ?? [],
|
|
14
|
-
});
|
|
15
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useBuybackQuote = useBuybackQuote;
|
|
4
|
-
// AI-generated · AI-managed · AI-maintained
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const microcosm_context_1 = require("../microcosm-context");
|
|
7
|
-
function useBuybackQuote(mccAmount) {
|
|
8
|
-
const api = (0, microcosm_context_1.useMicrocosmApi)();
|
|
9
|
-
const [data, setData] = (0, react_1.useState)(null);
|
|
10
|
-
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
11
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
12
|
-
const mountedRef = (0, react_1.useRef)(true);
|
|
13
|
-
const fetchQuote = (0, react_1.useCallback)(async () => {
|
|
14
|
-
if (!mccAmount || mccAmount <= 0) {
|
|
15
|
-
setData(null);
|
|
16
|
-
setLoading(false);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
setLoading(true);
|
|
21
|
-
const res = await api.post('/reincarnation/quote', { mcc_amount: mccAmount });
|
|
22
|
-
if (mountedRef.current) {
|
|
23
|
-
setData(res.data);
|
|
24
|
-
setError(null);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
if (mountedRef.current) {
|
|
29
|
-
setError(err instanceof Error ? err : new Error(String(err)));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
finally {
|
|
33
|
-
if (mountedRef.current)
|
|
34
|
-
setLoading(false);
|
|
35
|
-
}
|
|
36
|
-
}, [api, mccAmount]);
|
|
37
|
-
(0, react_1.useEffect)(() => {
|
|
38
|
-
mountedRef.current = true;
|
|
39
|
-
fetchQuote();
|
|
40
|
-
return () => { mountedRef.current = false; };
|
|
41
|
-
}, [fetchQuote]);
|
|
42
|
-
return { data, loading, error, refresh: fetchQuote };
|
|
43
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
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 microcosm_context_1 = require("../microcosm-context");
|
|
7
|
-
function useCycleHistory(params) {
|
|
8
|
-
const api = (0, microcosm_context_1.useMicrocosmApi)();
|
|
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
|
-
try {
|
|
18
|
-
setLoading(true);
|
|
19
|
-
const res = await api.get(`/reincarnation/cycle-history?page=${page}&page_size=${pageSize}`);
|
|
20
|
-
if (mountedRef.current) {
|
|
21
|
-
setData(res.data);
|
|
22
|
-
setError(null);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
if (mountedRef.current)
|
|
27
|
-
setError(err instanceof Error ? err : new Error(String(err)));
|
|
28
|
-
}
|
|
29
|
-
finally {
|
|
30
|
-
if (mountedRef.current)
|
|
31
|
-
setLoading(false);
|
|
32
|
-
}
|
|
33
|
-
}, [api, page, pageSize]);
|
|
34
|
-
(0, react_1.useEffect)(() => {
|
|
35
|
-
mountedRef.current = true;
|
|
36
|
-
fetchData();
|
|
37
|
-
return () => { mountedRef.current = false; };
|
|
38
|
-
}, [fetchData]);
|
|
39
|
-
return { data, loading, error, refresh: fetchData };
|
|
40
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useReincarnationConfig = useReincarnationConfig;
|
|
4
|
-
// AI-generated · AI-managed · AI-maintained
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const microcosm_context_1 = require("../microcosm-context");
|
|
7
|
-
function useReincarnationConfig() {
|
|
8
|
-
const api = (0, microcosm_context_1.useMicrocosmApi)();
|
|
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
|
-
try {
|
|
15
|
-
setLoading(true);
|
|
16
|
-
const res = await api.get('/reincarnation/config');
|
|
17
|
-
if (mountedRef.current) {
|
|
18
|
-
setData(res.data);
|
|
19
|
-
setError(null);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
if (mountedRef.current)
|
|
24
|
-
setError(err instanceof Error ? err : new Error(String(err)));
|
|
25
|
-
}
|
|
26
|
-
finally {
|
|
27
|
-
if (mountedRef.current)
|
|
28
|
-
setLoading(false);
|
|
29
|
-
}
|
|
30
|
-
}, [api]);
|
|
31
|
-
(0, react_1.useEffect)(() => {
|
|
32
|
-
mountedRef.current = true;
|
|
33
|
-
fetchData();
|
|
34
|
-
return () => { mountedRef.current = false; };
|
|
35
|
-
}, [fetchData]);
|
|
36
|
-
return { data, loading, error, refresh: fetchData };
|
|
37
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface PoolData {
|
|
2
|
-
usdc_balance?: number;
|
|
3
|
-
usdt_balance?: number;
|
|
4
|
-
mcc_balance?: number;
|
|
5
|
-
total_stablecoin?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function useReincarnationPool(options?: {
|
|
8
|
-
refetchInterval?: number;
|
|
9
|
-
}): import("./use-api-query").UseApiQueryResult<PoolData>;
|
|
10
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useReincarnationPool = useReincarnationPool;
|
|
4
|
-
// AI-generated · AI-managed · AI-maintained
|
|
5
|
-
const use_api_query_1 = require("./use-api-query");
|
|
6
|
-
function useReincarnationPool(options) {
|
|
7
|
-
return (0, use_api_query_1.useApiQuery)({
|
|
8
|
-
path: '/reincarnation/pool',
|
|
9
|
-
refetchInterval: options?.refetchInterval ?? 300000,
|
|
10
|
-
});
|
|
11
|
-
}
|