@microcosmmoney/portal-react 3.13.0 → 3.13.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/main-portal/components/mining/MiningModal.js +1 -1
- package/dist/main-portal/components/providers/SolanaWalletProvider.js +1 -1
- package/dist/main-portal/components/resources/public-mining-modal.js +1 -1
- package/dist/main-portal/hooks/useAuth.js +3 -2
- package/dist/main-portal/lib/api/index.d.ts +2 -9
- package/dist/main-portal/lib/api/index.js +17 -210
- package/package.json +1 -1
- package/dist/main-portal/hooks/useMarketData.d.ts +0 -9
- package/dist/main-portal/hooks/useMarketData.js +0 -32
- package/dist/main-portal/hooks/usePriceHistory.d.ts +0 -9
- package/dist/main-portal/hooks/usePriceHistory.js +0 -36
- package/dist/main-portal/lib/analytics/hooks.d.ts +0 -139
- package/dist/main-portal/lib/analytics/hooks.js +0 -277
- package/dist/main-portal/lib/analytics/index.d.ts +0 -2
- package/dist/main-portal/lib/analytics/index.js +0 -19
- package/dist/main-portal/lib/analytics/types.d.ts +0 -611
- package/dist/main-portal/lib/analytics/types.js +0 -2
- package/dist/main-portal/lib/api/account.d.ts +0 -39
- package/dist/main-portal/lib/api/account.js +0 -86
- package/dist/main-portal/lib/api/admin.d.ts +0 -78
- package/dist/main-portal/lib/api/admin.js +0 -195
- package/dist/main-portal/lib/api/analytics.d.ts +0 -217
- package/dist/main-portal/lib/api/analytics.js +0 -55
- package/dist/main-portal/lib/api/dexscreener.d.ts +0 -126
- package/dist/main-portal/lib/api/dexscreener.js +0 -139
- package/dist/main-portal/lib/api/geckoterminal.d.ts +0 -10
- package/dist/main-portal/lib/api/geckoterminal.js +0 -43
- package/dist/main-portal/lib/api/mcc-holders.d.ts +0 -130
- package/dist/main-portal/lib/api/mcc-holders.js +0 -47
- package/dist/main-portal/lib/api/org-service-proxy.d.ts +0 -7
- package/dist/main-portal/lib/api/org-service-proxy.js +0 -55
- package/dist/main-portal/lib/api/strategies.d.ts +0 -101
- package/dist/main-portal/lib/api/strategies.js +0 -87
- package/dist/main-portal/lib/exchanges/config.d.ts +0 -34
- package/dist/main-portal/lib/exchanges/config.js +0 -185
- package/dist/main-portal/lib/exchanges/hooks/index.d.ts +0 -5
- package/dist/main-portal/lib/exchanges/hooks/index.js +0 -10
- package/dist/main-portal/lib/exchanges/hooks/useBinanceData.d.ts +0 -15
- package/dist/main-portal/lib/exchanges/hooks/useBinanceData.js +0 -216
- package/dist/main-portal/lib/exchanges/hooks/useBinanceDialogs.d.ts +0 -32
- package/dist/main-portal/lib/exchanges/hooks/useBinanceDialogs.js +0 -395
- package/dist/main-portal/lib/exchanges/hooks/useUserExchanges.d.ts +0 -15
- package/dist/main-portal/lib/exchanges/hooks/useUserExchanges.js +0 -51
- package/dist/main-portal/lib/exchanges/index.d.ts +0 -4
- package/dist/main-portal/lib/exchanges/index.js +0 -21
- package/dist/main-portal/lib/exchanges/types.d.ts +0 -102
- package/dist/main-portal/lib/exchanges/types.js +0 -2
- package/dist/main-portal/lib/exchanges/utils.d.ts +0 -1
- package/dist/main-portal/lib/exchanges/utils.js +0 -10
- package/dist/main-portal/lib/gcp-secrets.d.ts +0 -7
- package/dist/main-portal/lib/gcp-secrets.js +0 -45
- package/dist/main-portal/lib/mockWallet.d.ts +0 -130
- package/dist/main-portal/lib/mockWallet.js +0 -284
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
export interface HourlyVolume {
|
|
2
|
-
hour: string;
|
|
3
|
-
buyVolume: number;
|
|
4
|
-
sellVolume: number;
|
|
5
|
-
totalVolume: number;
|
|
6
|
-
tradeCount: number;
|
|
7
|
-
}
|
|
8
|
-
export interface HeatmapCell {
|
|
9
|
-
dow: number;
|
|
10
|
-
hour: number;
|
|
11
|
-
volume: number;
|
|
12
|
-
tradeCount: number;
|
|
13
|
-
}
|
|
14
|
-
export interface MCCMarketData {
|
|
15
|
-
price: number;
|
|
16
|
-
priceChange: {
|
|
17
|
-
h1: number;
|
|
18
|
-
h24: number;
|
|
19
|
-
};
|
|
20
|
-
volume: {
|
|
21
|
-
h1: number;
|
|
22
|
-
h24: number;
|
|
23
|
-
};
|
|
24
|
-
txns: {
|
|
25
|
-
h1: {
|
|
26
|
-
buys: number;
|
|
27
|
-
sells: number;
|
|
28
|
-
};
|
|
29
|
-
h24: {
|
|
30
|
-
buys: number;
|
|
31
|
-
sells: number;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
liquidityUsd: number;
|
|
35
|
-
fdvUsd: number;
|
|
36
|
-
marketCapUsd: number;
|
|
37
|
-
dailyStats: {
|
|
38
|
-
tradeCount: number;
|
|
39
|
-
miningCount: number;
|
|
40
|
-
marketMakingCount: number;
|
|
41
|
-
buyVolume: number;
|
|
42
|
-
sellVolume: number;
|
|
43
|
-
};
|
|
44
|
-
hourlyVolumes: HourlyVolume[];
|
|
45
|
-
weeklyHeatmap: HeatmapCell[];
|
|
46
|
-
updatedAt: string;
|
|
47
|
-
}
|
|
48
|
-
export declare function fetchMCCMarketData(): Promise<MCCMarketData | null>;
|
|
49
|
-
export interface CustodyVaultInfo {
|
|
50
|
-
index: number;
|
|
51
|
-
vaultPda: string;
|
|
52
|
-
gasPayer: string;
|
|
53
|
-
usdcBalance: number;
|
|
54
|
-
mccBalance: number;
|
|
55
|
-
gasPayerSol: number;
|
|
56
|
-
gasConsumed: number;
|
|
57
|
-
txCount24h: number;
|
|
58
|
-
status: "active" | "idle";
|
|
59
|
-
}
|
|
60
|
-
export interface CustodyVaultSummary {
|
|
61
|
-
totalUsdc: number;
|
|
62
|
-
totalMcc: number;
|
|
63
|
-
totalGasConsumed: number;
|
|
64
|
-
totalTx24h: number;
|
|
65
|
-
totalTrades24h: number;
|
|
66
|
-
activeVaults: number;
|
|
67
|
-
avgGasPerTx: number;
|
|
68
|
-
totalProfit: number;
|
|
69
|
-
}
|
|
70
|
-
export interface CustodyAgentRoles {
|
|
71
|
-
minerActive: boolean;
|
|
72
|
-
traderActive: boolean;
|
|
73
|
-
}
|
|
74
|
-
export interface EcosystemMining {
|
|
75
|
-
total_usd: number;
|
|
76
|
-
total_mcc: number;
|
|
77
|
-
total_count: number;
|
|
78
|
-
}
|
|
79
|
-
export interface EcosystemBuyback {
|
|
80
|
-
total_usd: number;
|
|
81
|
-
total_mcc: number;
|
|
82
|
-
total_count: number;
|
|
83
|
-
pool_usd_balance: number;
|
|
84
|
-
}
|
|
85
|
-
export interface EcosystemLp {
|
|
86
|
-
mcc_allocated: number;
|
|
87
|
-
usdc_balance: number;
|
|
88
|
-
}
|
|
89
|
-
export interface EcosystemEpoch {
|
|
90
|
-
current_epoch: number;
|
|
91
|
-
epoch_minted: number;
|
|
92
|
-
epoch_yield: number;
|
|
93
|
-
mining_vault_mcc: number;
|
|
94
|
-
}
|
|
95
|
-
export interface CustodyVaultData {
|
|
96
|
-
vaults: CustodyVaultInfo[];
|
|
97
|
-
summary: CustodyVaultSummary;
|
|
98
|
-
agentRoles: CustodyAgentRoles;
|
|
99
|
-
mining: EcosystemMining;
|
|
100
|
-
buyback: EcosystemBuyback;
|
|
101
|
-
lp: EcosystemLp;
|
|
102
|
-
epoch: EcosystemEpoch;
|
|
103
|
-
updatedAt: string;
|
|
104
|
-
}
|
|
105
|
-
export declare function fetchCustodyVaultData(): Promise<CustodyVaultData | null>;
|
|
106
|
-
export declare const SOLSCAN_LINKS: {
|
|
107
|
-
mccToken: string;
|
|
108
|
-
mcdToken: string;
|
|
109
|
-
miningVault: string;
|
|
110
|
-
buybackVault: string;
|
|
111
|
-
teamVault: string;
|
|
112
|
-
poolPda: string;
|
|
113
|
-
cpmmPool: string;
|
|
114
|
-
custodyProgram: string;
|
|
115
|
-
programId: string;
|
|
116
|
-
transaction: (sig: string) => string;
|
|
117
|
-
account: (address: string) => string;
|
|
118
|
-
};
|
|
119
|
-
/** Official Market Making Custody Vault PDAs (#0-#9) */
|
|
120
|
-
export declare const CUSTODY_VAULT_ADDRESSES: readonly ["8GgSjyrnXfxzF9A2ptTVbwr5x7HbApBZAiNfLtasZymG", "GPGfHSzEMQG1w5fCGXoM4Qyq4AJKe2jEoE5Bp7FTEvvv", "Ay6nzAC1iNqNtBDqkWvjfkZRVJaw61v4tkNKs1h5QEsx", "8H4N2rT9JT3xxxVqFRiSECHY9dcbU51KjxsEfsBJSr5N", "8TzH83qkXUn2uifjVSFsfaBzpKvpf2h1FnKkP6gx33xo", "AkCWQ1Cgef3kD33YZN6RcbNdcG2uzGPqTm298DsRpEBh", "2ts8u1L21vZsJRHmB9SvGYw715bRp9wfM9gj9P8VZhah", "FtuVwEijmLiKLFriSQaQ5mQVexHpDEjGYojiCaXzNhrp", "HJiPgHoWrjmV8cguayJu6ggaBa2Kue5cbcdnt3T3eKbe", "2H1uXk3wwrhkxssKj5dKSK8cUVq5BxeLAvgfF2CweVoc"];
|
|
121
|
-
export declare const RAYDIUM_POOL_URL = "https://raydium.io/swap/?inputMint=MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
122
|
-
export declare const JUPITER_TRADE_URL = "https://jup.ag/tokens/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb";
|
|
123
|
-
export declare const BIRDEYE_TOKEN_URL = "https://birdeye.so/token/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb?chain=solana";
|
|
124
|
-
export declare const GMGN_TOKEN_URL = "https://gmgn.ai/sol/token/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb";
|
|
125
|
-
export declare const OKX_DEX_URL = "https://web3.okx.com/zh-hans/token/solana/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb";
|
|
126
|
-
export declare const DEXSCREENER_URL = "https://dexscreener.com/solana/4AiaTd9bAWf3u8ScZWhXadJF1roc8bJKEKvaDudKacZd";
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEXSCREENER_URL = exports.OKX_DEX_URL = exports.GMGN_TOKEN_URL = exports.BIRDEYE_TOKEN_URL = exports.JUPITER_TRADE_URL = exports.RAYDIUM_POOL_URL = exports.CUSTODY_VAULT_ADDRESSES = exports.SOLSCAN_LINKS = void 0;
|
|
4
|
-
exports.fetchMCCMarketData = fetchMCCMarketData;
|
|
5
|
-
exports.fetchCustodyVaultData = fetchCustodyVaultData;
|
|
6
|
-
async function fetchMCCMarketData() {
|
|
7
|
-
try {
|
|
8
|
-
const response = await fetch('/api/stats/market');
|
|
9
|
-
if (!response.ok)
|
|
10
|
-
return null;
|
|
11
|
-
const json = await response.json();
|
|
12
|
-
if (!json.success || !json.data)
|
|
13
|
-
return null;
|
|
14
|
-
const d = json.data;
|
|
15
|
-
return {
|
|
16
|
-
price: d.price || 0,
|
|
17
|
-
priceChange: {
|
|
18
|
-
h1: d.price_change_h1 || 0,
|
|
19
|
-
h24: d.price_change_24h || 0,
|
|
20
|
-
},
|
|
21
|
-
volume: {
|
|
22
|
-
h1: d.volume?.h1 || 0,
|
|
23
|
-
h24: d.volume?.h24 || 0,
|
|
24
|
-
},
|
|
25
|
-
txns: {
|
|
26
|
-
h1: d.txns?.h1 || { buys: 0, sells: 0 },
|
|
27
|
-
h24: d.txns?.h24 || { buys: 0, sells: 0 },
|
|
28
|
-
},
|
|
29
|
-
liquidityUsd: d.liquidity_usd || 0,
|
|
30
|
-
fdvUsd: d.fdv_usd || 0,
|
|
31
|
-
marketCapUsd: d.market_cap_usd || 0,
|
|
32
|
-
dailyStats: {
|
|
33
|
-
tradeCount: d.daily_stats?.trade_count || 0,
|
|
34
|
-
miningCount: d.daily_stats?.mining_count || 0,
|
|
35
|
-
marketMakingCount: d.daily_stats?.buyback_count || 0,
|
|
36
|
-
buyVolume: d.daily_stats?.buy_volume || 0,
|
|
37
|
-
sellVolume: d.daily_stats?.sell_volume || 0,
|
|
38
|
-
},
|
|
39
|
-
hourlyVolumes: (d.hourly_volumes || []).map((h) => ({
|
|
40
|
-
hour: h.hour,
|
|
41
|
-
buyVolume: h.buy_volume || 0,
|
|
42
|
-
sellVolume: h.sell_volume || 0,
|
|
43
|
-
totalVolume: h.total_volume || 0,
|
|
44
|
-
tradeCount: h.trade_count || 0,
|
|
45
|
-
})),
|
|
46
|
-
weeklyHeatmap: (d.weekly_heatmap || []).map((h) => ({
|
|
47
|
-
dow: h.dow || 1,
|
|
48
|
-
hour: h.hour || 0,
|
|
49
|
-
volume: h.volume || 0,
|
|
50
|
-
tradeCount: h.trade_count || 0,
|
|
51
|
-
})),
|
|
52
|
-
updatedAt: d.updated_at || '',
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
console.error('Failed to fetch MCC market data:', error);
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
async function fetchCustodyVaultData() {
|
|
61
|
-
try {
|
|
62
|
-
const response = await fetch('/api/stats/custody-vaults');
|
|
63
|
-
if (!response.ok)
|
|
64
|
-
return null;
|
|
65
|
-
const json = await response.json();
|
|
66
|
-
if (!json.success || !json.data)
|
|
67
|
-
return null;
|
|
68
|
-
const d = json.data;
|
|
69
|
-
return {
|
|
70
|
-
vaults: (d.vaults || []).map((v) => ({
|
|
71
|
-
index: v.index || 0,
|
|
72
|
-
vaultPda: v.vault_pda || "",
|
|
73
|
-
gasPayer: v.gas_payer || "",
|
|
74
|
-
usdcBalance: v.usdc_balance || 0,
|
|
75
|
-
mccBalance: v.mcc_balance || 0,
|
|
76
|
-
gasPayerSol: v.gas_payer_sol || 0,
|
|
77
|
-
gasConsumed: v.gas_consumed || 0,
|
|
78
|
-
txCount24h: v.tx_count_24h || 0,
|
|
79
|
-
status: v.status === "active" ? "active" : "idle",
|
|
80
|
-
})),
|
|
81
|
-
summary: {
|
|
82
|
-
totalUsdc: d.summary?.total_usdc || 0,
|
|
83
|
-
totalMcc: d.summary?.total_mcc || 0,
|
|
84
|
-
totalGasConsumed: d.summary?.total_gas_consumed || 0,
|
|
85
|
-
totalTx24h: d.summary?.total_tx_24h || 0,
|
|
86
|
-
totalTrades24h: d.summary?.total_trades_24h || 0,
|
|
87
|
-
activeVaults: d.summary?.active_vaults || 0,
|
|
88
|
-
avgGasPerTx: d.summary?.avg_gas_per_tx || 0,
|
|
89
|
-
totalProfit: d.summary?.total_profit || 0,
|
|
90
|
-
},
|
|
91
|
-
agentRoles: {
|
|
92
|
-
minerActive: !!d.agent_roles?.miner_active,
|
|
93
|
-
traderActive: !!d.agent_roles?.trader_active,
|
|
94
|
-
},
|
|
95
|
-
mining: d.mining || { total_usd: 0, total_mcc: 0, total_count: 0 },
|
|
96
|
-
buyback: d.buyback || { total_usd: 0, total_mcc: 0, total_count: 0, pool_usd_balance: 0 },
|
|
97
|
-
lp: d.lp || { mcc_allocated: 0, usdc_balance: 0 },
|
|
98
|
-
epoch: d.epoch || { current_epoch: 0, epoch_minted: 0, epoch_yield: 0, mining_vault_mcc: 0 },
|
|
99
|
-
updatedAt: d.updated_at || '',
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
console.error('Failed to fetch custody vault data:', error);
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
// ── Solscan Links ──
|
|
108
|
-
exports.SOLSCAN_LINKS = {
|
|
109
|
-
mccToken: "https://solscan.io/token/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb",
|
|
110
|
-
mcdToken: "https://solscan.io/token/MCDAhpfpKrsvXd1i95jToVd5SRL2xrZbeEriBbBJAn2",
|
|
111
|
-
miningVault: "https://solscan.io/account/63CtMuLQTjTRctGXKEEzHu2zFWh9pbckbMDd3sqb8p3H",
|
|
112
|
-
buybackVault: "https://solscan.io/account/C4NDtuAVkGaLyGdJNARfvguHFFuKpDf8XPGkYb6QV1Ha",
|
|
113
|
-
teamVault: "https://solscan.io/account/TEA5FQrMTkmHoYCGpYfA2973xeXJ3UXHUe12oHdYoYb",
|
|
114
|
-
poolPda: "https://solscan.io/account/GSBWtaX9WcBh8jUcmbXtQ1afQPHKSUKvsTxkqpJU3G9S",
|
|
115
|
-
cpmmPool: "https://solscan.io/account/4AiaTd9bAWf3u8ScZWhXadJF1roc8bJKEKvaDudKacZd",
|
|
116
|
-
custodyProgram: "https://solscan.io/account/CUS3ZFhcYqAj95ZTbjYu1yMT8DLdAQo8kTYova4NJJtr",
|
|
117
|
-
programId: "https://solscan.io/account/REDEh89TzpwCtoWQuuNPtxskrVoUDQgowR7e7sZpWj9",
|
|
118
|
-
transaction: (sig) => `https://solscan.io/tx/${sig}`,
|
|
119
|
-
account: (address) => `https://solscan.io/account/${address}`,
|
|
120
|
-
};
|
|
121
|
-
/** Official Market Making Custody Vault PDAs (#0-#9) */
|
|
122
|
-
exports.CUSTODY_VAULT_ADDRESSES = [
|
|
123
|
-
"8GgSjyrnXfxzF9A2ptTVbwr5x7HbApBZAiNfLtasZymG",
|
|
124
|
-
"GPGfHSzEMQG1w5fCGXoM4Qyq4AJKe2jEoE5Bp7FTEvvv",
|
|
125
|
-
"Ay6nzAC1iNqNtBDqkWvjfkZRVJaw61v4tkNKs1h5QEsx",
|
|
126
|
-
"8H4N2rT9JT3xxxVqFRiSECHY9dcbU51KjxsEfsBJSr5N",
|
|
127
|
-
"8TzH83qkXUn2uifjVSFsfaBzpKvpf2h1FnKkP6gx33xo",
|
|
128
|
-
"AkCWQ1Cgef3kD33YZN6RcbNdcG2uzGPqTm298DsRpEBh",
|
|
129
|
-
"2ts8u1L21vZsJRHmB9SvGYw715bRp9wfM9gj9P8VZhah",
|
|
130
|
-
"FtuVwEijmLiKLFriSQaQ5mQVexHpDEjGYojiCaXzNhrp",
|
|
131
|
-
"HJiPgHoWrjmV8cguayJu6ggaBa2Kue5cbcdnt3T3eKbe",
|
|
132
|
-
"2H1uXk3wwrhkxssKj5dKSK8cUVq5BxeLAvgfF2CweVoc",
|
|
133
|
-
];
|
|
134
|
-
exports.RAYDIUM_POOL_URL = "https://raydium.io/swap/?inputMint=MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
135
|
-
exports.JUPITER_TRADE_URL = "https://jup.ag/tokens/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb";
|
|
136
|
-
exports.BIRDEYE_TOKEN_URL = "https://birdeye.so/token/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb?chain=solana";
|
|
137
|
-
exports.GMGN_TOKEN_URL = "https://gmgn.ai/sol/token/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb";
|
|
138
|
-
exports.OKX_DEX_URL = "https://web3.okx.com/zh-hans/token/solana/MCCn6eqiTGzaiPKECg3viPmkdkS9YmkguqKvRcTxCsb";
|
|
139
|
-
exports.DEXSCREENER_URL = "https://dexscreener.com/solana/4AiaTd9bAWf3u8ScZWhXadJF1roc8bJKEKvaDudKacZd";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface OHLCVData {
|
|
2
|
-
timestamp: number;
|
|
3
|
-
open: number;
|
|
4
|
-
high: number;
|
|
5
|
-
low: number;
|
|
6
|
-
close: number;
|
|
7
|
-
volume: number;
|
|
8
|
-
}
|
|
9
|
-
export type PriceTimeRange = "1D" | "7D" | "30D" | "1Y";
|
|
10
|
-
export declare function fetchPriceHistory(range: PriceTimeRange): Promise<OHLCVData[]>;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchPriceHistory = fetchPriceHistory;
|
|
4
|
-
// AI-generated · AI-managed · AI-maintained
|
|
5
|
-
const MCC_POOL_ADDRESS = "4AiaTd9bAWf3u8ScZWhXadJF1roc8bJKEKvaDudKacZd";
|
|
6
|
-
const API_BASE = "https://api.geckoterminal.com/api/v2";
|
|
7
|
-
function getOHLCVParams(range) {
|
|
8
|
-
switch (range) {
|
|
9
|
-
case "1D":
|
|
10
|
-
return { timeframe: "hour", aggregate: 1, limit: 24 };
|
|
11
|
-
case "7D":
|
|
12
|
-
return { timeframe: "day", aggregate: 1, limit: 7 };
|
|
13
|
-
case "30D":
|
|
14
|
-
return { timeframe: "day", aggregate: 1, limit: 30 };
|
|
15
|
-
case "1Y":
|
|
16
|
-
return { timeframe: "day", aggregate: 1, limit: 365 };
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async function fetchPriceHistory(range) {
|
|
20
|
-
const { timeframe, aggregate, limit } = getOHLCVParams(range);
|
|
21
|
-
const url = `${API_BASE}/networks/solana/pools/${MCC_POOL_ADDRESS}/ohlcv/${timeframe}?aggregate=${aggregate}&limit=${limit}¤cy=usd`;
|
|
22
|
-
const response = await fetch(url, {
|
|
23
|
-
headers: {
|
|
24
|
-
"Accept": "application/json",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
if (!response.ok) {
|
|
28
|
-
throw new Error(`GeckoTerminal API error: ${response.status}`);
|
|
29
|
-
}
|
|
30
|
-
const json = await response.json();
|
|
31
|
-
const ohlcvList = json?.data?.attributes?.ohlcv_list;
|
|
32
|
-
if (!Array.isArray(ohlcvList)) {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
return ohlcvList.map((item) => ({
|
|
36
|
-
timestamp: item[0],
|
|
37
|
-
open: item[1],
|
|
38
|
-
high: item[2],
|
|
39
|
-
low: item[3],
|
|
40
|
-
close: item[4],
|
|
41
|
-
volume: item[5],
|
|
42
|
-
})).sort((a, b) => a.timestamp - b.timestamp);
|
|
43
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
export interface MCCHolder {
|
|
2
|
-
id: number;
|
|
3
|
-
wallet_address: string;
|
|
4
|
-
token_account: string;
|
|
5
|
-
mcc_balance: number;
|
|
6
|
-
sol_balance: number;
|
|
7
|
-
usdt_balance: number;
|
|
8
|
-
usdc_balance: number;
|
|
9
|
-
first_seen_at: string | null;
|
|
10
|
-
first_tx_signature: string | null;
|
|
11
|
-
first_tx_time: string | null;
|
|
12
|
-
last_tx_time: string | null;
|
|
13
|
-
tx_count: number;
|
|
14
|
-
buy_count: number;
|
|
15
|
-
sell_count: number;
|
|
16
|
-
total_bought: number;
|
|
17
|
-
total_sold: number;
|
|
18
|
-
holder_type: 'individual' | 'whale' | 'bot' | 'exchange' | 'team' | 'unknown';
|
|
19
|
-
holder_label: string | null;
|
|
20
|
-
is_excluded: boolean;
|
|
21
|
-
exclude_reason: string | null;
|
|
22
|
-
notes: string | null;
|
|
23
|
-
balance_updated_at: string | null;
|
|
24
|
-
created_at: string;
|
|
25
|
-
updated_at: string;
|
|
26
|
-
}
|
|
27
|
-
export interface HolderListParams {
|
|
28
|
-
page?: number;
|
|
29
|
-
page_size?: number;
|
|
30
|
-
sort_by?: string;
|
|
31
|
-
sort_order?: 'asc' | 'desc';
|
|
32
|
-
holder_type?: string;
|
|
33
|
-
min_balance?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface HolderStats {
|
|
36
|
-
total_holders: number;
|
|
37
|
-
total_mcc_held: number;
|
|
38
|
-
holder_type_distribution: {
|
|
39
|
-
individual: number;
|
|
40
|
-
whale: number;
|
|
41
|
-
bot: number;
|
|
42
|
-
unknown: number;
|
|
43
|
-
};
|
|
44
|
-
new_today: number;
|
|
45
|
-
last_sync_at: string | null;
|
|
46
|
-
}
|
|
47
|
-
export interface HolderTransaction {
|
|
48
|
-
signature: string;
|
|
49
|
-
block_time: string | null;
|
|
50
|
-
slot: number;
|
|
51
|
-
err: boolean;
|
|
52
|
-
memo: string | null;
|
|
53
|
-
}
|
|
54
|
-
export interface PoolTrader {
|
|
55
|
-
wallet_address: string;
|
|
56
|
-
address_type: 'system' | 'platform' | 'external';
|
|
57
|
-
address_label: string | null;
|
|
58
|
-
buy_count: number;
|
|
59
|
-
sell_count: number;
|
|
60
|
-
trade_count: number;
|
|
61
|
-
total_mcc_bought: number;
|
|
62
|
-
total_mcc_sold: number;
|
|
63
|
-
total_usdc_spent: number;
|
|
64
|
-
total_usdc_received: number;
|
|
65
|
-
net_mcc: number;
|
|
66
|
-
net_usdc: number;
|
|
67
|
-
estimated_profit_usdc: number;
|
|
68
|
-
first_trade_time: string | null;
|
|
69
|
-
last_trade_time: string | null;
|
|
70
|
-
trades: PoolTrade[];
|
|
71
|
-
}
|
|
72
|
-
export interface PoolTrade {
|
|
73
|
-
type: 'buy' | 'sell';
|
|
74
|
-
mcc_amount: number;
|
|
75
|
-
usdc_amount: number;
|
|
76
|
-
price: number;
|
|
77
|
-
tx_signature: string;
|
|
78
|
-
time: string | null;
|
|
79
|
-
}
|
|
80
|
-
export interface AddressSearchResult {
|
|
81
|
-
wallet_address: string;
|
|
82
|
-
period: string;
|
|
83
|
-
db_info: MCCHolder | null;
|
|
84
|
-
address_classification: {
|
|
85
|
-
type: 'system' | 'platform' | 'external';
|
|
86
|
-
category: string;
|
|
87
|
-
label: string | null;
|
|
88
|
-
} | null;
|
|
89
|
-
chain_trades: PoolTrade[];
|
|
90
|
-
summary: {
|
|
91
|
-
buy_count: number;
|
|
92
|
-
sell_count: number;
|
|
93
|
-
total_mcc_bought: number;
|
|
94
|
-
total_mcc_sold: number;
|
|
95
|
-
total_usdc_spent: number;
|
|
96
|
-
total_usdc_received: number;
|
|
97
|
-
net_mcc: number;
|
|
98
|
-
net_usdc: number;
|
|
99
|
-
estimated_profit_usdc: number;
|
|
100
|
-
};
|
|
101
|
-
current_balances: {
|
|
102
|
-
sol_balance: number;
|
|
103
|
-
usdt_balance: number;
|
|
104
|
-
usdc_balance: number;
|
|
105
|
-
} | null;
|
|
106
|
-
}
|
|
107
|
-
export interface SystemAddress {
|
|
108
|
-
id: number;
|
|
109
|
-
wallet_address: string;
|
|
110
|
-
category: string;
|
|
111
|
-
label: string;
|
|
112
|
-
owner_uid: string | null;
|
|
113
|
-
owner_name: string | null;
|
|
114
|
-
notes: string | null;
|
|
115
|
-
created_at: string;
|
|
116
|
-
updated_at: string;
|
|
117
|
-
}
|
|
118
|
-
export declare const getMCCHolders: (params?: HolderListParams) => Promise<any>;
|
|
119
|
-
export declare const getMCCHolderStats: () => Promise<any>;
|
|
120
|
-
export declare const getMCCHolderTransactions: (wallet: string, limit?: number) => Promise<any>;
|
|
121
|
-
export declare const labelMCCHolder: (wallet: string, data: {
|
|
122
|
-
holder_type?: string;
|
|
123
|
-
holder_label?: string;
|
|
124
|
-
notes?: string;
|
|
125
|
-
}) => Promise<any>;
|
|
126
|
-
export declare const syncMCCHolders: () => Promise<any>;
|
|
127
|
-
export declare const getPoolTraders: (period?: string) => Promise<any>;
|
|
128
|
-
export declare const refreshPoolTraders: (period?: string) => Promise<any>;
|
|
129
|
-
export declare const searchAddress: (address: string, period?: string) => Promise<any>;
|
|
130
|
-
export declare const getSystemAddresses: (category?: string) => Promise<any>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSystemAddresses = exports.searchAddress = exports.refreshPoolTraders = exports.getPoolTraders = exports.syncMCCHolders = exports.labelMCCHolder = exports.getMCCHolderTransactions = exports.getMCCHolderStats = exports.getMCCHolders = void 0;
|
|
4
|
-
// AI-generated · AI-managed · AI-maintained
|
|
5
|
-
const core_1 = require("./core");
|
|
6
|
-
// === API 调用 ===
|
|
7
|
-
const getMCCHolders = (params) => {
|
|
8
|
-
const query = new URLSearchParams();
|
|
9
|
-
if (params?.page)
|
|
10
|
-
query.append('page', params.page.toString());
|
|
11
|
-
if (params?.page_size)
|
|
12
|
-
query.append('page_size', params.page_size.toString());
|
|
13
|
-
if (params?.sort_by)
|
|
14
|
-
query.append('sort_by', params.sort_by);
|
|
15
|
-
if (params?.sort_order)
|
|
16
|
-
query.append('sort_order', params.sort_order);
|
|
17
|
-
if (params?.holder_type)
|
|
18
|
-
query.append('holder_type', params.holder_type);
|
|
19
|
-
if (params?.min_balance !== undefined)
|
|
20
|
-
query.append('min_balance', params.min_balance.toString());
|
|
21
|
-
const qs = query.toString();
|
|
22
|
-
return (0, core_1.fetchApi)(`/blockchain/mcc/holders${qs ? '?' + qs : ''}`);
|
|
23
|
-
};
|
|
24
|
-
exports.getMCCHolders = getMCCHolders;
|
|
25
|
-
const getMCCHolderStats = () => (0, core_1.fetchApi)('/blockchain/mcc/holders/stats');
|
|
26
|
-
exports.getMCCHolderStats = getMCCHolderStats;
|
|
27
|
-
const getMCCHolderTransactions = (wallet, limit = 50) => (0, core_1.fetchApi)(`/blockchain/mcc/holders/${wallet}/transactions?limit=${limit}`);
|
|
28
|
-
exports.getMCCHolderTransactions = getMCCHolderTransactions;
|
|
29
|
-
const labelMCCHolder = (wallet, data) => (0, core_1.fetchApi)(`/blockchain/mcc/holders/${wallet}/label`, {
|
|
30
|
-
method: 'POST',
|
|
31
|
-
body: JSON.stringify(data)
|
|
32
|
-
});
|
|
33
|
-
exports.labelMCCHolder = labelMCCHolder;
|
|
34
|
-
const syncMCCHolders = () => (0, core_1.fetchApi)('/blockchain/mcc/holders/sync', { method: 'POST' });
|
|
35
|
-
exports.syncMCCHolders = syncMCCHolders;
|
|
36
|
-
// === 新增 API ===
|
|
37
|
-
const getPoolTraders = (period = '7d') => (0, core_1.fetchApi)(`/blockchain/mcc/holders/traders?period=${period}`);
|
|
38
|
-
exports.getPoolTraders = getPoolTraders;
|
|
39
|
-
const refreshPoolTraders = (period = '7d') => (0, core_1.fetchApi)(`/blockchain/mcc/holders/traders/refresh?period=${period}`, { method: 'POST' });
|
|
40
|
-
exports.refreshPoolTraders = refreshPoolTraders;
|
|
41
|
-
const searchAddress = (address, period = '24h') => (0, core_1.fetchApi)(`/blockchain/mcc/holders/search?address=${encodeURIComponent(address)}&period=${period}`);
|
|
42
|
-
exports.searchAddress = searchAddress;
|
|
43
|
-
const getSystemAddresses = (category) => {
|
|
44
|
-
const params = category ? `?category=${category}` : '';
|
|
45
|
-
return (0, core_1.fetchApi)(`/blockchain/mcc/holders/system-addresses${params}`);
|
|
46
|
-
};
|
|
47
|
-
exports.getSystemAddresses = getSystemAddresses;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.proxyToOrgService = proxyToOrgService;
|
|
4
|
-
// AI-generated · AI-managed · AI-maintained
|
|
5
|
-
async function proxyToOrgService(endpoint, options = {}) {
|
|
6
|
-
const baseUrl = process.env.ORGANIZATION_SERVICE_URL || 'http://organization-service.microcosm.svc.cluster.local';
|
|
7
|
-
const internalSecret = process.env.MICROCOSM_INTERNAL_SECRET || '';
|
|
8
|
-
let uid = options.xUserUid || null;
|
|
9
|
-
if (!uid && options.authHeader) {
|
|
10
|
-
try {
|
|
11
|
-
const token = options.authHeader.replace('Bearer ', '');
|
|
12
|
-
const response = await fetch(`${baseUrl}/auth/verify-firebase-token`, {
|
|
13
|
-
method: 'POST',
|
|
14
|
-
headers: {
|
|
15
|
-
'Content-Type': 'application/json',
|
|
16
|
-
'X-Microcosm-Internal-Secret': internalSecret,
|
|
17
|
-
},
|
|
18
|
-
body: JSON.stringify({ token })
|
|
19
|
-
});
|
|
20
|
-
if (response.ok) {
|
|
21
|
-
const data = await response.json();
|
|
22
|
-
uid = data.uid;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
console.error('Firebase token verification failed:', error);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (!uid) {
|
|
30
|
-
throw new Error('无法获取用户标识');
|
|
31
|
-
}
|
|
32
|
-
let url = `${baseUrl}${endpoint}`;
|
|
33
|
-
if (options.query) {
|
|
34
|
-
const params = new URLSearchParams(options.query);
|
|
35
|
-
url += `?${params.toString()}`;
|
|
36
|
-
}
|
|
37
|
-
const fetchOptions = {
|
|
38
|
-
method: options.method || 'GET',
|
|
39
|
-
headers: {
|
|
40
|
-
'Content-Type': 'application/json',
|
|
41
|
-
'X-User-UID': uid,
|
|
42
|
-
'X-Microcosm-Internal-Secret': internalSecret,
|
|
43
|
-
},
|
|
44
|
-
cache: 'no-store',
|
|
45
|
-
};
|
|
46
|
-
if (options.body && (options.method === 'POST' || options.method === 'PUT')) {
|
|
47
|
-
fetchOptions.body = JSON.stringify(options.body);
|
|
48
|
-
}
|
|
49
|
-
const response = await fetch(url, fetchOptions);
|
|
50
|
-
if (!response.ok) {
|
|
51
|
-
const errorText = await response.text();
|
|
52
|
-
throw new Error(`Organization service returned ${response.status}: ${errorText}`);
|
|
53
|
-
}
|
|
54
|
-
return response.json();
|
|
55
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
export declare const getStrategies: () => Promise<any>;
|
|
2
|
-
export declare const getStrategyDetails: (strategyId: string) => Promise<any>;
|
|
3
|
-
export declare const startStrategy: (strategyId: string) => Promise<any>;
|
|
4
|
-
export declare const stopStrategy: (strategyId: string) => Promise<any>;
|
|
5
|
-
export declare const createStrategy: (strategyParams: Record<string, unknown>) => Promise<any>;
|
|
6
|
-
export declare const deleteStrategy: (strategyId: string) => Promise<any>;
|
|
7
|
-
export declare const updateStrategy: (strategyId: string, params: Record<string, unknown>) => Promise<any>;
|
|
8
|
-
export declare const getEnergyOrders: (strategyId: string, includeHistory?: boolean) => Promise<any>;
|
|
9
|
-
export declare const getEnergyHistory: (strategyId: string, page?: number, pageSize?: number) => Promise<any>;
|
|
10
|
-
export declare const batchPreviewStrategies: (filters: {
|
|
11
|
-
symbol?: string;
|
|
12
|
-
status?: "active" | "inactive";
|
|
13
|
-
}) => Promise<any>;
|
|
14
|
-
export declare const batchUpdateStrategies: (strategyIds: string[], paramPath: string, paramValue: unknown, filters?: Record<string, unknown>) => Promise<any>;
|
|
15
|
-
export declare const getBatchHistory: (limit?: number) => Promise<any>;
|
|
16
|
-
export interface ParamTemplate {
|
|
17
|
-
id: number;
|
|
18
|
-
name: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
params: Array<{
|
|
21
|
-
path: string;
|
|
22
|
-
value: unknown;
|
|
23
|
-
}>;
|
|
24
|
-
use_count: number;
|
|
25
|
-
last_used_at?: string;
|
|
26
|
-
created_by_email?: string;
|
|
27
|
-
created_at?: string;
|
|
28
|
-
updated_at?: string;
|
|
29
|
-
}
|
|
30
|
-
export declare const getTemplates: () => Promise<any>;
|
|
31
|
-
export declare const getTemplate: (templateId: number) => Promise<any>;
|
|
32
|
-
export declare const createTemplate: (data: {
|
|
33
|
-
name: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
params: Array<{
|
|
36
|
-
path: string;
|
|
37
|
-
value: unknown;
|
|
38
|
-
}>;
|
|
39
|
-
}) => Promise<any>;
|
|
40
|
-
export declare const updateTemplate: (templateId: number, data: Partial<{
|
|
41
|
-
name: string;
|
|
42
|
-
description: string;
|
|
43
|
-
params: Array<{
|
|
44
|
-
path: string;
|
|
45
|
-
value: unknown;
|
|
46
|
-
}>;
|
|
47
|
-
}>) => Promise<any>;
|
|
48
|
-
export declare const deleteTemplate: (templateId: number) => Promise<any>;
|
|
49
|
-
export interface GroupCondition {
|
|
50
|
-
field: 'symbol' | 'status' | 'created_at' | 'uid';
|
|
51
|
-
operator: '=' | 'in' | 'not_in' | '>=' | '<=' | 'between';
|
|
52
|
-
value: unknown;
|
|
53
|
-
}
|
|
54
|
-
export interface GroupRules {
|
|
55
|
-
conditions: GroupCondition[];
|
|
56
|
-
logic: 'AND' | 'OR';
|
|
57
|
-
}
|
|
58
|
-
export interface StrategyGroup {
|
|
59
|
-
id: number;
|
|
60
|
-
name: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
group_type: 'auto' | 'manual' | 'hybrid';
|
|
63
|
-
auto_rules?: GroupRules;
|
|
64
|
-
strategy_count: number;
|
|
65
|
-
pending_review: number;
|
|
66
|
-
created_by_email?: string;
|
|
67
|
-
created_at?: string;
|
|
68
|
-
updated_at?: string;
|
|
69
|
-
}
|
|
70
|
-
export declare const getGroups: () => Promise<any>;
|
|
71
|
-
export declare const getGroup: (groupId: number) => Promise<any>;
|
|
72
|
-
export declare const createGroup: (data: {
|
|
73
|
-
name: string;
|
|
74
|
-
description?: string;
|
|
75
|
-
group_type: string;
|
|
76
|
-
auto_rules?: GroupRules;
|
|
77
|
-
}) => Promise<any>;
|
|
78
|
-
export declare const updateGroup: (groupId: number, data: Partial<{
|
|
79
|
-
name: string;
|
|
80
|
-
description: string;
|
|
81
|
-
auto_rules: GroupRules;
|
|
82
|
-
}>) => Promise<any>;
|
|
83
|
-
export declare const deleteGroup: (groupId: number) => Promise<any>;
|
|
84
|
-
export declare const getGroupStrategies: (groupId: number, page?: number, pageSize?: number, needsReview?: boolean) => Promise<any>;
|
|
85
|
-
export declare const addStrategiesToGroup: (groupId: number, strategyIds: string[]) => Promise<any>;
|
|
86
|
-
export declare const removeStrategiesFromGroup: (groupId: number, strategyIds: string[]) => Promise<any>;
|
|
87
|
-
export declare const reviewGroupStrategies: (groupId: number, strategyIds: string[], action: "approve" | "reject") => Promise<any>;
|
|
88
|
-
export declare const refreshGroup: (groupId: number) => Promise<any>;
|
|
89
|
-
export declare const previewGroupRules: (rules: GroupRules) => Promise<any>;
|
|
90
|
-
export interface DistributeParams {
|
|
91
|
-
template_id?: number;
|
|
92
|
-
params?: Array<{
|
|
93
|
-
path: string;
|
|
94
|
-
value: unknown;
|
|
95
|
-
}>;
|
|
96
|
-
target_type: 'group' | 'manual';
|
|
97
|
-
group_id?: number;
|
|
98
|
-
strategy_ids?: string[];
|
|
99
|
-
}
|
|
100
|
-
export declare const distributeParams: (data: DistributeParams) => Promise<any>;
|
|
101
|
-
export declare const getDistributeHistory: (limit?: number) => Promise<any>;
|