@microcosmmoney/auth-core 1.0.2 → 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/api-client.d.ts +1 -0
- package/dist/api-client.js +13 -1
- package/dist/index.d.ts +1 -1
- package/dist/open-api.d.ts +60 -0
- package/dist/open-api.js +43 -2
- package/dist/types.d.ts +271 -9
- package/package.json +1 -1
package/dist/api-client.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export declare class ApiClient {
|
|
|
5
5
|
fetch<T>(path: string, options?: RequestInit): Promise<T>;
|
|
6
6
|
get<T>(path: string): Promise<T>;
|
|
7
7
|
post<T>(path: string, body: unknown): Promise<T>;
|
|
8
|
+
put<T>(path: string, body: unknown): Promise<T>;
|
|
8
9
|
patch<T>(path: string, body: unknown): Promise<T>;
|
|
9
10
|
}
|
package/dist/api-client.js
CHANGED
|
@@ -34,7 +34,13 @@ class ApiClient {
|
|
|
34
34
|
}
|
|
35
35
|
const data = await response.json();
|
|
36
36
|
if (!response.ok) {
|
|
37
|
-
|
|
37
|
+
const detail = data.detail;
|
|
38
|
+
const msg = typeof detail === 'string'
|
|
39
|
+
? detail
|
|
40
|
+
: typeof detail === 'object' && detail !== null
|
|
41
|
+
? (detail.msg || detail.message || JSON.stringify(detail))
|
|
42
|
+
: (data.error?.message || data.message || `API error ${response.status}`);
|
|
43
|
+
throw new Error(msg);
|
|
38
44
|
}
|
|
39
45
|
return data;
|
|
40
46
|
}
|
|
@@ -47,6 +53,12 @@ class ApiClient {
|
|
|
47
53
|
body: JSON.stringify(body),
|
|
48
54
|
});
|
|
49
55
|
}
|
|
56
|
+
async put(path, body) {
|
|
57
|
+
return this.fetch(path, {
|
|
58
|
+
method: 'PUT',
|
|
59
|
+
body: JSON.stringify(body),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
50
62
|
async patch(path, body) {
|
|
51
63
|
return this.fetch(path, {
|
|
52
64
|
method: 'PATCH',
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { Storage, STORAGE_KEYS } from './storage';
|
|
|
4
4
|
export { ApiClient } from './api-client';
|
|
5
5
|
export { MicrocosmAPI } from './open-api';
|
|
6
6
|
export type { MicrocosmAPIConfig } from './open-api';
|
|
7
|
-
export type { MicrocosmAuthConfig, ResolvedConfig, User, TokenData, AuthState, LoginOptions, TokenExchangeResponse, UserProfileResponse, ApiResponse, MCDBalance, MCCBalance, MCCPrice, Wallet, TokenPortfolio, MCCLock, MiningRatio, MiningDistribution, BuybackQuote, BuybackRecord, Territory, TerritorySummary, TerritoryStats, TerritoryMember, Proposal, ProposalDetail, VoteResult, VotePower, AuctionBid, MCDTransaction, MCDReward, } from './types';
|
|
7
|
+
export type { MicrocosmAuthConfig, ResolvedConfig, User, TokenData, AuthState, LoginOptions, TokenExchangeResponse, UserProfileResponse, ApiResponse, MCDBalance, MCCBalance, MCCWalletBalance, MCCPrice, Wallet, TokenPortfolio, MCCLock, MiningRatio, MiningDistribution, BuybackQuote, BuybackRecord, Territory, TerritorySummary, TerritoryStats, TerritoryMember, Proposal, ProposalDetail, VoteResult, VotePower, AuctionBid, MCDTransaction, MCDReward, MiningRequest, MiningConfirmData, MiningRequestResult, MiningConfig, BuybackRecordInput, ReincarnationConfig, MCCHistoryRecord, CycleHistory, AuctionHistory, PaginatedResult, MCCStats, MiningStats, TechTreeNode, TechTree, TechTreeBonus, UserStats, Organization, OrganizationTreeNode, MiningRecord, MiningHistoryItem, PriceHistoryPoint, Auction, AuctionDetail, AuctionCreateInput, TerritoryIncome, TerritoryKPI, UserLevel, DashboardMarketSummary, DashboardUserSummary, PublicMiningRequest, UnitType, } from './types';
|
package/dist/open-api.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export declare class MicrocosmAPI {
|
|
|
15
15
|
getBalance: (token: string) => Promise<ApiRes<any>>;
|
|
16
16
|
getBalanceByAddress: (address: string) => Promise<ApiRes<any>>;
|
|
17
17
|
getLocks: (token: string) => Promise<ApiRes<any>>;
|
|
18
|
+
getTransactions: (token: string, params?: {
|
|
19
|
+
page?: number;
|
|
20
|
+
page_size?: number;
|
|
21
|
+
}) => Promise<ApiRes<any>>;
|
|
22
|
+
getHistory: (token: string, params?: {
|
|
23
|
+
tx_type?: string;
|
|
24
|
+
page?: number;
|
|
25
|
+
page_size?: number;
|
|
26
|
+
}) => Promise<ApiRes<any>>;
|
|
18
27
|
getHolders: () => Promise<ApiRes<any>>;
|
|
19
28
|
getMiningHistory: (days?: number) => Promise<ApiRes<any>>;
|
|
20
29
|
};
|
|
@@ -45,6 +54,18 @@ export declare class MicrocosmAPI {
|
|
|
45
54
|
page?: number;
|
|
46
55
|
page_size?: number;
|
|
47
56
|
}) => Promise<ApiRes<any>>;
|
|
57
|
+
record: (token: string, data: {
|
|
58
|
+
tx_signature: string;
|
|
59
|
+
wallet_address: string;
|
|
60
|
+
mcc_amount: number;
|
|
61
|
+
usdc_amount: number;
|
|
62
|
+
stablecoin?: string;
|
|
63
|
+
}) => Promise<ApiRes<any>>;
|
|
64
|
+
getConfig: () => Promise<ApiRes<any>>;
|
|
65
|
+
getCycleHistory: (params?: {
|
|
66
|
+
page?: number;
|
|
67
|
+
page_size?: number;
|
|
68
|
+
}) => Promise<ApiRes<any>>;
|
|
48
69
|
};
|
|
49
70
|
readonly mining: {
|
|
50
71
|
getRecords: (token: string, params?: {
|
|
@@ -58,6 +79,32 @@ export declare class MicrocosmAPI {
|
|
|
58
79
|
page?: number;
|
|
59
80
|
page_size?: number;
|
|
60
81
|
}) => Promise<ApiRes<any>>;
|
|
82
|
+
createRequest: (token: string, data: {
|
|
83
|
+
mcc_amount: number;
|
|
84
|
+
stablecoin?: string;
|
|
85
|
+
wallet_address: string;
|
|
86
|
+
}) => Promise<ApiRes<any>>;
|
|
87
|
+
confirm: (token: string, data: {
|
|
88
|
+
request_id: string;
|
|
89
|
+
tx_signature: string;
|
|
90
|
+
mcc_amount: number;
|
|
91
|
+
usdc_amount: number;
|
|
92
|
+
stablecoin_type?: string;
|
|
93
|
+
}) => Promise<ApiRes<any>>;
|
|
94
|
+
publicRequest: (data: {
|
|
95
|
+
wallet_address: string;
|
|
96
|
+
mcc_amount: number;
|
|
97
|
+
stablecoin?: string;
|
|
98
|
+
}) => Promise<ApiRes<any>>;
|
|
99
|
+
publicVerify: (data: {
|
|
100
|
+
request_id: string;
|
|
101
|
+
tx_signature: string;
|
|
102
|
+
}) => Promise<ApiRes<any>>;
|
|
103
|
+
getHistory: (token: string, params?: {
|
|
104
|
+
limit?: number;
|
|
105
|
+
offset?: number;
|
|
106
|
+
}) => Promise<ApiRes<any>>;
|
|
107
|
+
getConfig: () => Promise<ApiRes<any>>;
|
|
61
108
|
};
|
|
62
109
|
readonly users: {
|
|
63
110
|
getProfile: (token: string) => Promise<ApiRes<any>>;
|
|
@@ -91,6 +138,12 @@ export declare class MicrocosmAPI {
|
|
|
91
138
|
page?: number;
|
|
92
139
|
page_size?: number;
|
|
93
140
|
}) => Promise<ApiRes<any>>;
|
|
141
|
+
update: (token: string, id: string, data: {
|
|
142
|
+
unit_name?: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
image_url?: string;
|
|
145
|
+
}) => Promise<ApiRes<any>>;
|
|
146
|
+
updateName: (token: string, id: string, name: string, force?: boolean) => Promise<ApiRes<any>>;
|
|
94
147
|
};
|
|
95
148
|
readonly territory: {
|
|
96
149
|
getCollection: () => Promise<ApiRes<any>>;
|
|
@@ -122,8 +175,15 @@ export declare class MicrocosmAPI {
|
|
|
122
175
|
getActive: () => Promise<ApiRes<any>>;
|
|
123
176
|
getDetails: (id: number) => Promise<ApiRes<any>>;
|
|
124
177
|
getBids: (id: number) => Promise<ApiRes<any>>;
|
|
178
|
+
getUserBids: (wallet: string) => Promise<ApiRes<any>>;
|
|
179
|
+
getUserAuctions: (wallet: string) => Promise<ApiRes<any>>;
|
|
125
180
|
getMyBids: (token: string) => Promise<ApiRes<any>>;
|
|
126
181
|
placeBid: (token: string, auctionId: number, bidAmount: number) => Promise<ApiRes<any>>;
|
|
182
|
+
prepareCancelBid: (token: string, auctionId: number) => Promise<ApiRes<any>>;
|
|
183
|
+
getHistory: (params?: {
|
|
184
|
+
page?: number;
|
|
185
|
+
page_size?: number;
|
|
186
|
+
}) => Promise<ApiRes<any>>;
|
|
127
187
|
};
|
|
128
188
|
readonly techTree: {
|
|
129
189
|
getConfig: () => Promise<ApiRes<any>>;
|
package/dist/open-api.js
CHANGED
|
@@ -18,7 +18,7 @@ async function request(baseUrl, path, token) {
|
|
|
18
18
|
throw new Error(data.detail || `API error ${res.status}`);
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
21
|
+
async function mutateRequest(baseUrl, method, path, body, token) {
|
|
22
22
|
const headers = {
|
|
23
23
|
'Accept': 'application/json',
|
|
24
24
|
'Content-Type': 'application/json',
|
|
@@ -26,7 +26,7 @@ async function postRequest(baseUrl, path, body, token) {
|
|
|
26
26
|
if (token)
|
|
27
27
|
headers['Authorization'] = `Bearer ${token}`;
|
|
28
28
|
const res = await fetch(`${baseUrl}${path}`, {
|
|
29
|
-
method
|
|
29
|
+
method,
|
|
30
30
|
headers,
|
|
31
31
|
body: JSON.stringify(body),
|
|
32
32
|
});
|
|
@@ -35,6 +35,12 @@ async function postRequest(baseUrl, path, body, token) {
|
|
|
35
35
|
throw new Error(data.detail || `API error ${res.status}`);
|
|
36
36
|
return data;
|
|
37
37
|
}
|
|
38
|
+
async function postRequest(baseUrl, path, body, token) {
|
|
39
|
+
return mutateRequest(baseUrl, 'POST', path, body, token);
|
|
40
|
+
}
|
|
41
|
+
async function putRequest(baseUrl, path, body, token) {
|
|
42
|
+
return mutateRequest(baseUrl, 'PUT', path, body, token);
|
|
43
|
+
}
|
|
38
44
|
class MicrocosmAPI {
|
|
39
45
|
constructor(config) {
|
|
40
46
|
this.mcc = {
|
|
@@ -43,6 +49,17 @@ class MicrocosmAPI {
|
|
|
43
49
|
getBalance: (token) => request(this.base, '/mcc/balance', token),
|
|
44
50
|
getBalanceByAddress: (address) => request(this.base, `/mcc/balance/${address}`),
|
|
45
51
|
getLocks: (token) => request(this.base, '/mcc/locks', token),
|
|
52
|
+
getTransactions: (token, params) => {
|
|
53
|
+
const p = params || {};
|
|
54
|
+
return request(this.base, `/mcc/transactions?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
|
|
55
|
+
},
|
|
56
|
+
getHistory: (token, params) => {
|
|
57
|
+
const p = params || {};
|
|
58
|
+
let qs = `?page=${p.page || 1}&page_size=${p.page_size || 20}`;
|
|
59
|
+
if (p.tx_type)
|
|
60
|
+
qs += `&tx_type=${p.tx_type}`;
|
|
61
|
+
return request(this.base, `/mcc/history${qs}`, token);
|
|
62
|
+
},
|
|
46
63
|
getHolders: () => request(this.base, '/reincarnation/holders'),
|
|
47
64
|
getMiningHistory: (days = 30) => request(this.base, `/reincarnation/mining-history?days=${days}`),
|
|
48
65
|
};
|
|
@@ -78,6 +95,12 @@ class MicrocosmAPI {
|
|
|
78
95
|
const p = params || {};
|
|
79
96
|
return request(this.base, `/reincarnation/user-history?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
|
|
80
97
|
},
|
|
98
|
+
record: (token, data) => postRequest(this.base, '/reincarnation/record', data, token),
|
|
99
|
+
getConfig: () => request(this.base, '/reincarnation/config'),
|
|
100
|
+
getCycleHistory: (params) => {
|
|
101
|
+
const p = params || {};
|
|
102
|
+
return request(this.base, `/reincarnation/cycle-history?page=${p.page || 1}&page_size=${p.page_size || 20}`);
|
|
103
|
+
},
|
|
81
104
|
};
|
|
82
105
|
this.mining = {
|
|
83
106
|
getRecords: (token, params) => {
|
|
@@ -91,6 +114,15 @@ class MicrocosmAPI {
|
|
|
91
114
|
const p = params || {};
|
|
92
115
|
return request(this.base, `/mining/distribution?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
|
|
93
116
|
},
|
|
117
|
+
createRequest: (token, data) => postRequest(this.base, '/mining/request', data, token),
|
|
118
|
+
confirm: (token, data) => postRequest(this.base, '/mining/confirm', data, token),
|
|
119
|
+
publicRequest: (data) => postRequest(this.base, '/mining/public/request', data),
|
|
120
|
+
publicVerify: (data) => postRequest(this.base, '/mining/public/verify', data),
|
|
121
|
+
getHistory: (token, params) => {
|
|
122
|
+
const p = params || {};
|
|
123
|
+
return request(this.base, `/mining/history?limit=${p.limit || 20}&offset=${p.offset || 0}`, token);
|
|
124
|
+
},
|
|
125
|
+
getConfig: () => request(this.base, '/mining/config'),
|
|
94
126
|
};
|
|
95
127
|
this.users = {
|
|
96
128
|
getProfile: (token) => request(this.base, '/users/me', token),
|
|
@@ -127,6 +159,8 @@ class MicrocosmAPI {
|
|
|
127
159
|
const p = params || {};
|
|
128
160
|
return request(this.base, `/territories/${id}/member-ranking?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
|
|
129
161
|
},
|
|
162
|
+
update: (token, id, data) => putRequest(this.base, `/territories/${id}`, data, token),
|
|
163
|
+
updateName: (token, id, name, force = false) => putRequest(this.base, `/territories/${id}/name${force ? '?force=true' : ''}`, { name }, token),
|
|
130
164
|
};
|
|
131
165
|
this.territory = {
|
|
132
166
|
getCollection: () => request(this.base, '/territory/collection'),
|
|
@@ -151,8 +185,15 @@ class MicrocosmAPI {
|
|
|
151
185
|
getActive: () => request(this.base, '/auction-solana/active'),
|
|
152
186
|
getDetails: (id) => request(this.base, `/auction-solana/auction/${id}`),
|
|
153
187
|
getBids: (id) => request(this.base, `/auction-solana/auction/${id}/bids`),
|
|
188
|
+
getUserBids: (wallet) => request(this.base, `/auction-solana/bids/${wallet}`),
|
|
189
|
+
getUserAuctions: (wallet) => request(this.base, `/auction-solana/auctions/${wallet}`),
|
|
154
190
|
getMyBids: (token) => request(this.base, '/auction-solana/my-bids', token),
|
|
155
191
|
placeBid: (token, auctionId, bidAmount) => postRequest(this.base, `/auction-solana/auction/${auctionId}/bid`, { bid_amount: bidAmount }, token),
|
|
192
|
+
prepareCancelBid: (token, auctionId) => postRequest(this.base, '/auction-solana/bid/cancel/prepare', { auction_id: auctionId }, token),
|
|
193
|
+
getHistory: (params) => {
|
|
194
|
+
const p = params || {};
|
|
195
|
+
return request(this.base, `/auction-solana/history?page=${p.page || 1}&page_size=${p.page_size || 20}`);
|
|
196
|
+
},
|
|
156
197
|
};
|
|
157
198
|
this.techTree = {
|
|
158
199
|
getConfig: () => request(this.base, '/tech-tree/config'),
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type UnitType = 'station' | 'matrix' | 'sector' | 'system';
|
|
1
2
|
export interface MicrocosmAuthConfig {
|
|
2
3
|
clientId: string;
|
|
3
4
|
redirectUri: string;
|
|
@@ -65,20 +66,30 @@ export interface MCDBalance {
|
|
|
65
66
|
available_balance: string;
|
|
66
67
|
frozen_balance: string;
|
|
67
68
|
}
|
|
69
|
+
export interface MCCWalletBalance {
|
|
70
|
+
wallet_address: string;
|
|
71
|
+
is_primary: boolean;
|
|
72
|
+
balance: number;
|
|
73
|
+
raw_balance: number;
|
|
74
|
+
}
|
|
68
75
|
export interface MCCBalance {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
wallet_address?: string;
|
|
76
|
+
balance: number;
|
|
77
|
+
raw_balance: number;
|
|
78
|
+
decimals: number;
|
|
79
|
+
symbol: string;
|
|
80
|
+
wallet_address?: string | null;
|
|
81
|
+
wallets?: MCCWalletBalance[];
|
|
82
|
+
mint?: string;
|
|
74
83
|
}
|
|
75
84
|
export interface MCCPrice {
|
|
76
85
|
price: number;
|
|
77
|
-
price_change_24h?: number;
|
|
78
|
-
volume_24h?: number;
|
|
79
|
-
market_cap?: number;
|
|
86
|
+
price_change_24h?: number | null;
|
|
87
|
+
volume_24h?: number | null;
|
|
88
|
+
market_cap?: number | null;
|
|
80
89
|
source: string;
|
|
81
90
|
updated_at: string;
|
|
91
|
+
buyback_price?: number;
|
|
92
|
+
premium_rate?: number;
|
|
82
93
|
}
|
|
83
94
|
export interface Wallet {
|
|
84
95
|
wallet_address: string;
|
|
@@ -124,6 +135,12 @@ export interface BuybackQuote {
|
|
|
124
135
|
buyback_price: number;
|
|
125
136
|
usdc_amount: number;
|
|
126
137
|
premium_amount: number;
|
|
138
|
+
fee?: number;
|
|
139
|
+
fee_rate?: number;
|
|
140
|
+
slippage?: number;
|
|
141
|
+
net_amount?: number;
|
|
142
|
+
vault_type?: string;
|
|
143
|
+
pool_remaining?: number;
|
|
127
144
|
}
|
|
128
145
|
export interface BuybackRecord {
|
|
129
146
|
mcc_amount: number;
|
|
@@ -137,7 +154,7 @@ export interface Territory {
|
|
|
137
154
|
unit_id: string;
|
|
138
155
|
unit_name: string;
|
|
139
156
|
short_id?: string;
|
|
140
|
-
unit_type:
|
|
157
|
+
unit_type: UnitType;
|
|
141
158
|
description?: string;
|
|
142
159
|
location?: string;
|
|
143
160
|
image_url?: string;
|
|
@@ -190,9 +207,17 @@ export interface VotePower {
|
|
|
190
207
|
vote_power: number;
|
|
191
208
|
user_rank?: string;
|
|
192
209
|
cost_per_vote_mcc?: number;
|
|
210
|
+
mcd_cost_per_vote?: number;
|
|
193
211
|
mcc_balance?: number;
|
|
194
212
|
max_votes?: number;
|
|
195
213
|
can_vote: boolean;
|
|
214
|
+
reason?: string;
|
|
215
|
+
source?: string;
|
|
216
|
+
details?: {
|
|
217
|
+
base_power?: number;
|
|
218
|
+
mcc_bonus?: number;
|
|
219
|
+
level_bonus?: number;
|
|
220
|
+
};
|
|
196
221
|
}
|
|
197
222
|
export interface AuctionBid {
|
|
198
223
|
bid_id?: string;
|
|
@@ -218,3 +243,240 @@ export interface MCDReward {
|
|
|
218
243
|
mcd_received: number;
|
|
219
244
|
created_at: string;
|
|
220
245
|
}
|
|
246
|
+
export interface MiningRequest {
|
|
247
|
+
mcc_amount: number;
|
|
248
|
+
stablecoin?: string;
|
|
249
|
+
wallet_address: string;
|
|
250
|
+
}
|
|
251
|
+
export interface MiningConfirmData {
|
|
252
|
+
request_id: string;
|
|
253
|
+
tx_signature: string;
|
|
254
|
+
mcc_amount: number;
|
|
255
|
+
usdc_amount: number;
|
|
256
|
+
stablecoin_type?: string;
|
|
257
|
+
}
|
|
258
|
+
export interface MiningRequestResult {
|
|
259
|
+
request_id: string;
|
|
260
|
+
mcc_amount: number;
|
|
261
|
+
usdc_amount: number;
|
|
262
|
+
mining_price: number;
|
|
263
|
+
stablecoin: string;
|
|
264
|
+
payment_address: string;
|
|
265
|
+
expires_at: string;
|
|
266
|
+
}
|
|
267
|
+
export interface MiningConfig {
|
|
268
|
+
program_id: string;
|
|
269
|
+
pool_address: string;
|
|
270
|
+
mcc_mint: string;
|
|
271
|
+
usdt_mint: string;
|
|
272
|
+
usdc_mint: string;
|
|
273
|
+
distribution_ratios: Record<string, number>;
|
|
274
|
+
min_amount: number;
|
|
275
|
+
max_amount: number;
|
|
276
|
+
}
|
|
277
|
+
export interface BuybackRecordInput {
|
|
278
|
+
tx_signature: string;
|
|
279
|
+
wallet_address: string;
|
|
280
|
+
mcc_amount: number;
|
|
281
|
+
usdc_amount: number;
|
|
282
|
+
stablecoin?: string;
|
|
283
|
+
}
|
|
284
|
+
export interface ReincarnationConfig {
|
|
285
|
+
program_id: string;
|
|
286
|
+
pool_address: string;
|
|
287
|
+
mcc_vault: string;
|
|
288
|
+
usdc_vault: string;
|
|
289
|
+
usdt_vault: string;
|
|
290
|
+
min_buyback: number;
|
|
291
|
+
max_buyback: number;
|
|
292
|
+
premium_rate: number;
|
|
293
|
+
}
|
|
294
|
+
export interface MCCHistoryRecord {
|
|
295
|
+
mcc_amount: number;
|
|
296
|
+
stablecoin_amount: number;
|
|
297
|
+
stablecoin: string;
|
|
298
|
+
tx_signature: string;
|
|
299
|
+
type: string;
|
|
300
|
+
wallet_address?: string;
|
|
301
|
+
created_at: string;
|
|
302
|
+
}
|
|
303
|
+
export interface CycleHistory {
|
|
304
|
+
cycle_id: number;
|
|
305
|
+
executed_at: string;
|
|
306
|
+
mcc_returned: number;
|
|
307
|
+
mcd_returned: number;
|
|
308
|
+
status: string;
|
|
309
|
+
}
|
|
310
|
+
export interface AuctionHistory {
|
|
311
|
+
auction_id: number;
|
|
312
|
+
unit_name: string;
|
|
313
|
+
winner_wallet?: string;
|
|
314
|
+
winning_bid?: number;
|
|
315
|
+
status: string;
|
|
316
|
+
ended_at: string;
|
|
317
|
+
}
|
|
318
|
+
export interface PaginatedResult<T> {
|
|
319
|
+
records: T[];
|
|
320
|
+
total: number;
|
|
321
|
+
page: number;
|
|
322
|
+
page_size: number;
|
|
323
|
+
}
|
|
324
|
+
export interface MCCStats {
|
|
325
|
+
total_supply: number;
|
|
326
|
+
circulating_supply: number;
|
|
327
|
+
holder_count: number;
|
|
328
|
+
total_mined: number;
|
|
329
|
+
price?: number;
|
|
330
|
+
market_cap?: number | null;
|
|
331
|
+
locked_amount?: number;
|
|
332
|
+
}
|
|
333
|
+
export interface MiningStats {
|
|
334
|
+
total_mined: number;
|
|
335
|
+
total_paid: number;
|
|
336
|
+
mining_count: number;
|
|
337
|
+
today_mined: number;
|
|
338
|
+
last_30d_mined: number;
|
|
339
|
+
active_days_30d: number;
|
|
340
|
+
last_mined_at: string | null;
|
|
341
|
+
}
|
|
342
|
+
export interface TechTreeNode {
|
|
343
|
+
node_id: string;
|
|
344
|
+
name: string;
|
|
345
|
+
level: number;
|
|
346
|
+
max_level: number;
|
|
347
|
+
unlocked: boolean;
|
|
348
|
+
prerequisites?: string[];
|
|
349
|
+
bonus?: Record<string, number>;
|
|
350
|
+
}
|
|
351
|
+
export interface TechTree {
|
|
352
|
+
nodes: TechTreeNode[];
|
|
353
|
+
total_unlocked: number;
|
|
354
|
+
total_nodes: number;
|
|
355
|
+
}
|
|
356
|
+
export interface TechTreeBonus {
|
|
357
|
+
bonus_multiplier: number;
|
|
358
|
+
active_bonuses?: Record<string, number>;
|
|
359
|
+
}
|
|
360
|
+
export interface UserStats {
|
|
361
|
+
total_users: number;
|
|
362
|
+
by_level: {
|
|
363
|
+
recruit: number;
|
|
364
|
+
prospect: number;
|
|
365
|
+
miner: number;
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
export interface Organization {
|
|
369
|
+
id: string;
|
|
370
|
+
name: string;
|
|
371
|
+
unit_type: UnitType;
|
|
372
|
+
parent_id?: string | null;
|
|
373
|
+
depth?: number;
|
|
374
|
+
children_count?: number;
|
|
375
|
+
member_count?: number;
|
|
376
|
+
children?: Organization[];
|
|
377
|
+
}
|
|
378
|
+
export interface OrganizationTreeNode {
|
|
379
|
+
id: string;
|
|
380
|
+
name: string;
|
|
381
|
+
unit_type: UnitType;
|
|
382
|
+
depth: number;
|
|
383
|
+
children: OrganizationTreeNode[];
|
|
384
|
+
member_count?: number;
|
|
385
|
+
vault_balance?: number;
|
|
386
|
+
}
|
|
387
|
+
export interface MiningRecord {
|
|
388
|
+
mcc_amount: number;
|
|
389
|
+
paid_amount: number;
|
|
390
|
+
stablecoin: string;
|
|
391
|
+
tx_signature: string;
|
|
392
|
+
mined_at: string | null;
|
|
393
|
+
status?: string;
|
|
394
|
+
}
|
|
395
|
+
export interface MiningHistoryItem {
|
|
396
|
+
mcc_amount: number;
|
|
397
|
+
usdc_amount: number;
|
|
398
|
+
stablecoin: string;
|
|
399
|
+
mining_price: number;
|
|
400
|
+
tx_signature: string;
|
|
401
|
+
wallet_address?: string;
|
|
402
|
+
status: string;
|
|
403
|
+
created_at: string;
|
|
404
|
+
}
|
|
405
|
+
export interface PriceHistoryPoint {
|
|
406
|
+
timestamp: string;
|
|
407
|
+
price: number;
|
|
408
|
+
volume?: number;
|
|
409
|
+
}
|
|
410
|
+
export interface Auction {
|
|
411
|
+
auction_id: number;
|
|
412
|
+
unit_name: string;
|
|
413
|
+
unit_type: UnitType;
|
|
414
|
+
starting_price: number;
|
|
415
|
+
current_bid?: number;
|
|
416
|
+
bid_count: number;
|
|
417
|
+
status: string;
|
|
418
|
+
start_time: string;
|
|
419
|
+
end_time: string;
|
|
420
|
+
}
|
|
421
|
+
export interface AuctionDetail extends Auction {
|
|
422
|
+
description?: string;
|
|
423
|
+
unit_id?: string;
|
|
424
|
+
winner_wallet?: string;
|
|
425
|
+
bids?: AuctionBid[];
|
|
426
|
+
deposit_amount?: number;
|
|
427
|
+
min_increment?: number;
|
|
428
|
+
}
|
|
429
|
+
export interface AuctionCreateInput {
|
|
430
|
+
unit_id: string;
|
|
431
|
+
unit_name: string;
|
|
432
|
+
unit_type: UnitType;
|
|
433
|
+
starting_price: number;
|
|
434
|
+
deposit_amount: number;
|
|
435
|
+
duration_hours: number;
|
|
436
|
+
description?: string;
|
|
437
|
+
}
|
|
438
|
+
export interface TerritoryIncome {
|
|
439
|
+
date: string;
|
|
440
|
+
amount: number;
|
|
441
|
+
source: string;
|
|
442
|
+
territory_id?: string;
|
|
443
|
+
}
|
|
444
|
+
export interface TerritoryKPI {
|
|
445
|
+
date: string;
|
|
446
|
+
kpi_score: number;
|
|
447
|
+
member_count: number;
|
|
448
|
+
vault_balance: number;
|
|
449
|
+
daily_distribution: number;
|
|
450
|
+
mining_activity: number;
|
|
451
|
+
}
|
|
452
|
+
export interface UserLevel {
|
|
453
|
+
level: string;
|
|
454
|
+
title?: string | null;
|
|
455
|
+
upgrade_progress?: {
|
|
456
|
+
current_days?: number;
|
|
457
|
+
required_days?: number;
|
|
458
|
+
percentage?: number;
|
|
459
|
+
};
|
|
460
|
+
mining_weight?: Record<string, number>;
|
|
461
|
+
}
|
|
462
|
+
export interface DashboardMarketSummary {
|
|
463
|
+
price_usd: number;
|
|
464
|
+
price_change_24h: number;
|
|
465
|
+
volume_24h: number;
|
|
466
|
+
liquidity_usd: number;
|
|
467
|
+
fdv: number;
|
|
468
|
+
market_cap: number;
|
|
469
|
+
}
|
|
470
|
+
export interface DashboardUserSummary {
|
|
471
|
+
level: string;
|
|
472
|
+
title?: string | null;
|
|
473
|
+
mcc_balance: number;
|
|
474
|
+
mcd_balance?: number;
|
|
475
|
+
territory_id?: string | null;
|
|
476
|
+
mining_count?: number;
|
|
477
|
+
}
|
|
478
|
+
export interface PublicMiningRequest {
|
|
479
|
+
wallet_address: string;
|
|
480
|
+
mcc_amount: number;
|
|
481
|
+
stablecoin?: string;
|
|
482
|
+
}
|