@microcosmmoney/auth-core 1.0.1 → 1.0.3

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.
@@ -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
  }
@@ -47,6 +47,12 @@ class ApiClient {
47
47
  body: JSON.stringify(body),
48
48
  });
49
49
  }
50
+ async put(path, body) {
51
+ return this.fetch(path, {
52
+ method: 'PUT',
53
+ body: JSON.stringify(body),
54
+ });
55
+ }
50
56
  async patch(path, body) {
51
57
  return this.fetch(path, {
52
58
  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, } from './types';
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, MiningRequest, MiningConfirmData, MiningRequestResult, MiningConfig, BuybackRecordInput, ReincarnationConfig, MCCHistoryRecord, CycleHistory, AuctionHistory, } from './types';
@@ -13,23 +13,98 @@ export declare class MicrocosmAPI {
13
13
  getPrice: () => Promise<ApiRes<any>>;
14
14
  getStats: () => Promise<ApiRes<any>>;
15
15
  getBalance: (token: string) => Promise<ApiRes<any>>;
16
+ getBalanceByAddress: (address: string) => Promise<ApiRes<any>>;
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>>;
16
27
  getHolders: () => Promise<ApiRes<any>>;
17
28
  getMiningHistory: (days?: number) => Promise<ApiRes<any>>;
18
29
  };
19
30
  readonly mcd: {
20
31
  getBalance: (token: string) => Promise<ApiRes<any>>;
21
32
  getStats: () => Promise<ApiRes<any>>;
33
+ getTransactions: (token: string, params?: {
34
+ page?: number;
35
+ page_size?: number;
36
+ type?: string;
37
+ }) => Promise<ApiRes<any>>;
38
+ getRewards: (token: string, params?: {
39
+ page?: number;
40
+ page_size?: number;
41
+ start_date?: string;
42
+ end_date?: string;
43
+ }) => Promise<ApiRes<any>>;
44
+ };
45
+ readonly wallets: {
46
+ list: (token: string) => Promise<ApiRes<any>>;
47
+ getTokens: (address: string) => Promise<ApiRes<any>>;
22
48
  };
23
49
  readonly reincarnation: {
24
50
  getPool: () => Promise<ApiRes<any>>;
25
51
  getBuybackPrice: () => Promise<ApiRes<any>>;
52
+ getQuote: (mccAmount: number) => Promise<ApiRes<any>>;
53
+ getUserHistory: (token: string, params?: {
54
+ page?: number;
55
+ page_size?: number;
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>>;
26
69
  };
27
70
  readonly mining: {
28
71
  getRecords: (token: string, params?: {
72
+ page?: number;
73
+ page_size?: number;
74
+ }) => Promise<ApiRes<any>>;
75
+ getStats: (token: string) => Promise<ApiRes<any>>;
76
+ getGlobalStats: () => Promise<ApiRes<any>>;
77
+ getRatio: () => Promise<ApiRes<any>>;
78
+ getDistribution: (token: string, params?: {
79
+ page?: number;
80
+ page_size?: number;
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?: {
29
104
  limit?: number;
30
105
  offset?: number;
31
106
  }) => Promise<ApiRes<any>>;
32
- getStats: (token: string) => Promise<ApiRes<any>>;
107
+ getConfig: () => Promise<ApiRes<any>>;
33
108
  };
34
109
  readonly users: {
35
110
  getProfile: (token: string) => Promise<ApiRes<any>>;
@@ -39,17 +114,76 @@ export declare class MicrocosmAPI {
39
114
  getMarket: () => Promise<ApiRes<any>>;
40
115
  getPlatform: () => Promise<ApiRes<any>>;
41
116
  getUserSummary: (wallet: string) => Promise<ApiRes<any>>;
117
+ getUserStats: () => Promise<ApiRes<any>>;
118
+ getTerritoryStats: () => Promise<ApiRes<any>>;
119
+ getMiningHistory: (days?: number) => Promise<ApiRes<any>>;
120
+ };
121
+ readonly territories: {
122
+ list: (token: string, params?: {
123
+ unit_type?: string;
124
+ parent_id?: string;
125
+ page?: number;
126
+ page_size?: number;
127
+ }) => Promise<ApiRes<any>>;
128
+ getSummary: (token: string) => Promise<ApiRes<any>>;
129
+ getDetail: (token: string, id: string) => Promise<ApiRes<any>>;
130
+ getStats: (token: string, id: string) => Promise<ApiRes<any>>;
131
+ getMembers: (token: string, id: string, params?: {
132
+ page?: number;
133
+ page_size?: number;
134
+ }) => Promise<ApiRes<any>>;
135
+ getIncomeChart: (token: string, id: string, period?: string) => Promise<ApiRes<any>>;
136
+ getKpiHistory: (token: string, id: string) => Promise<ApiRes<any>>;
137
+ getMemberRanking: (token: string, id: string, params?: {
138
+ page?: number;
139
+ page_size?: number;
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>>;
42
147
  };
43
148
  readonly territory: {
44
149
  getCollection: () => Promise<ApiRes<any>>;
45
150
  getNft: (mint: string) => Promise<ApiRes<any>>;
46
151
  getUserNfts: (wallet: string) => Promise<ApiRes<any>>;
47
152
  };
153
+ readonly voting: {
154
+ getProposals: (token: string, params?: {
155
+ status?: string;
156
+ page?: number;
157
+ page_size?: number;
158
+ }) => Promise<ApiRes<any>>;
159
+ getDetail: (token: string, id: string) => Promise<ApiRes<any>>;
160
+ getPower: (token: string) => Promise<ApiRes<any>>;
161
+ createProposal: (token: string, data: {
162
+ title: string;
163
+ description: string;
164
+ proposal_type?: string;
165
+ voting_hours?: number;
166
+ options: string[];
167
+ }) => Promise<ApiRes<any>>;
168
+ castVote: (token: string, proposalId: string, data: {
169
+ option_index: number;
170
+ vote_count?: number;
171
+ }) => Promise<ApiRes<any>>;
172
+ };
48
173
  readonly auctions: {
49
174
  getConfig: () => Promise<ApiRes<any>>;
50
175
  getActive: () => Promise<ApiRes<any>>;
51
176
  getDetails: (id: number) => Promise<ApiRes<any>>;
52
177
  getBids: (id: number) => Promise<ApiRes<any>>;
178
+ getUserBids: (wallet: string) => Promise<ApiRes<any>>;
179
+ getUserAuctions: (wallet: string) => Promise<ApiRes<any>>;
180
+ getMyBids: (token: string) => Promise<ApiRes<any>>;
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>>;
53
187
  };
54
188
  readonly techTree: {
55
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 postRequest(baseUrl, path, body, token) {
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: 'POST',
29
+ method,
30
30
  headers,
31
31
  body: JSON.stringify(body),
32
32
  });
@@ -35,29 +35,94 @@ 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 = {
41
47
  getPrice: () => request(this.base, '/mcc/price'),
42
48
  getStats: () => request(this.base, '/mcc/stats'),
43
49
  getBalance: (token) => request(this.base, '/mcc/balance', token),
50
+ getBalanceByAddress: (address) => request(this.base, `/mcc/balance/${address}`),
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
+ },
44
63
  getHolders: () => request(this.base, '/reincarnation/holders'),
45
64
  getMiningHistory: (days = 30) => request(this.base, `/reincarnation/mining-history?days=${days}`),
46
65
  };
47
66
  this.mcd = {
48
67
  getBalance: (token) => request(this.base, '/mcd/balance', token),
49
68
  getStats: () => request(this.base, '/mcd/stats'),
69
+ getTransactions: (token, params) => {
70
+ const p = params || {};
71
+ let qs = `?page=${p.page || 1}&page_size=${p.page_size || 20}`;
72
+ if (p.type)
73
+ qs += `&type=${p.type}`;
74
+ return request(this.base, `/mcd/transactions${qs}`, token);
75
+ },
76
+ getRewards: (token, params) => {
77
+ const p = params || {};
78
+ let qs = `?page=${p.page || 1}&page_size=${p.page_size || 20}`;
79
+ if (p.start_date)
80
+ qs += `&start_date=${p.start_date}`;
81
+ if (p.end_date)
82
+ qs += `&end_date=${p.end_date}`;
83
+ return request(this.base, `/mcd/rewards${qs}`, token);
84
+ },
85
+ };
86
+ this.wallets = {
87
+ list: (token) => request(this.base, '/wallets', token),
88
+ getTokens: (address) => request(this.base, `/wallets/${address}/tokens`),
50
89
  };
51
90
  this.reincarnation = {
52
91
  getPool: () => request(this.base, '/reincarnation/pool'),
53
92
  getBuybackPrice: () => request(this.base, '/reincarnation/buyback-price'),
93
+ getQuote: (mccAmount) => postRequest(this.base, '/reincarnation/quote', { mcc_amount: mccAmount }),
94
+ getUserHistory: (token, params) => {
95
+ const p = params || {};
96
+ return request(this.base, `/reincarnation/user-history?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
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
+ },
54
104
  };
55
105
  this.mining = {
56
106
  getRecords: (token, params) => {
57
- const qs = params ? `?limit=${params.limit || 20}&offset=${params.offset || 0}` : '';
58
- return request(this.base, `/mining/records${qs}`, token);
107
+ const p = params || {};
108
+ return request(this.base, `/mining/records?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
59
109
  },
60
110
  getStats: (token) => request(this.base, '/mining/stats', token),
111
+ getGlobalStats: () => request(this.base, '/mining/global-stats'),
112
+ getRatio: () => request(this.base, '/mining/ratio'),
113
+ getDistribution: (token, params) => {
114
+ const p = params || {};
115
+ return request(this.base, `/mining/distribution?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
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'),
61
126
  };
62
127
  this.users = {
63
128
  getProfile: (token) => request(this.base, '/users/me', token),
@@ -67,17 +132,68 @@ class MicrocosmAPI {
67
132
  getMarket: () => request(this.base, '/dashboard/market'),
68
133
  getPlatform: () => request(this.base, '/dashboard/platform'),
69
134
  getUserSummary: (wallet) => request(this.base, `/dashboard/user/${wallet}`),
135
+ getUserStats: () => request(this.base, '/dashboard/stats/users'),
136
+ getTerritoryStats: () => request(this.base, '/dashboard/stats/territories'),
137
+ getMiningHistory: (days = 30) => request(this.base, `/dashboard/stats/mining-history?days=${days}`),
138
+ };
139
+ this.territories = {
140
+ list: (token, params) => {
141
+ const p = params || {};
142
+ let qs = `?page=${p.page || 1}&page_size=${p.page_size || 20}`;
143
+ if (p.unit_type)
144
+ qs += `&unit_type=${p.unit_type}`;
145
+ if (p.parent_id)
146
+ qs += `&parent_id=${p.parent_id}`;
147
+ return request(this.base, `/territories${qs}`, token);
148
+ },
149
+ getSummary: (token) => request(this.base, '/territories/summary', token),
150
+ getDetail: (token, id) => request(this.base, `/territories/${id}`, token),
151
+ getStats: (token, id) => request(this.base, `/territories/${id}/stats`, token),
152
+ getMembers: (token, id, params) => {
153
+ const p = params || {};
154
+ return request(this.base, `/territories/${id}/members?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
155
+ },
156
+ getIncomeChart: (token, id, period = '30d') => request(this.base, `/territories/${id}/income-chart?period=${period}`, token),
157
+ getKpiHistory: (token, id) => request(this.base, `/territories/${id}/kpi-history`, token),
158
+ getMemberRanking: (token, id, params) => {
159
+ const p = params || {};
160
+ return request(this.base, `/territories/${id}/member-ranking?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
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),
70
164
  };
71
165
  this.territory = {
72
166
  getCollection: () => request(this.base, '/territory/collection'),
73
167
  getNft: (mint) => request(this.base, `/territory/nft/${mint}`),
74
168
  getUserNfts: (wallet) => request(this.base, `/territory/nfts/${wallet}`),
75
169
  };
170
+ this.voting = {
171
+ getProposals: (token, params) => {
172
+ const p = params || {};
173
+ let qs = `?page=${p.page || 1}&page_size=${p.page_size || 20}`;
174
+ if (p.status)
175
+ qs += `&status=${p.status}`;
176
+ return request(this.base, `/voting/proposals${qs}`, token);
177
+ },
178
+ getDetail: (token, id) => request(this.base, `/voting/proposals/${id}`, token),
179
+ getPower: (token) => request(this.base, '/voting/power', token),
180
+ createProposal: (token, data) => postRequest(this.base, '/voting/proposals', data, token),
181
+ castVote: (token, proposalId, data) => postRequest(this.base, `/voting/proposals/${proposalId}/vote`, data, token),
182
+ };
76
183
  this.auctions = {
77
184
  getConfig: () => request(this.base, '/auction-solana/config'),
78
185
  getActive: () => request(this.base, '/auction-solana/active'),
79
186
  getDetails: (id) => request(this.base, `/auction-solana/auction/${id}`),
80
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}`),
190
+ getMyBids: (token) => request(this.base, '/auction-solana/my-bids', token),
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
+ },
81
197
  };
82
198
  this.techTree = {
83
199
  getConfig: () => request(this.base, '/tech-tree/config'),
package/dist/types.d.ts CHANGED
@@ -80,3 +80,213 @@ export interface MCCPrice {
80
80
  source: string;
81
81
  updated_at: string;
82
82
  }
83
+ export interface Wallet {
84
+ wallet_address: string;
85
+ wallet_type: string;
86
+ is_primary: boolean;
87
+ created_at: string;
88
+ }
89
+ export interface TokenPortfolio {
90
+ sol_balance?: number;
91
+ mcc_balance?: number;
92
+ usdt_balance?: number;
93
+ usdc_balance?: number;
94
+ [key: string]: number | undefined;
95
+ }
96
+ export interface MCCLock {
97
+ lock_id: string;
98
+ amount: number;
99
+ reason: string;
100
+ lock_start: string;
101
+ lock_end: string;
102
+ status: string;
103
+ }
104
+ export interface MiningRatio {
105
+ current_stage?: number;
106
+ total_minted?: number;
107
+ ratio?: number;
108
+ usdc_per_mcc?: number;
109
+ current_rate?: number;
110
+ }
111
+ export interface MiningDistribution {
112
+ user_mcc: number;
113
+ team_mcc: number;
114
+ magistrate_mcc: number;
115
+ vault_mcd: number;
116
+ source: string;
117
+ territory_id?: string;
118
+ tx_signature?: string;
119
+ created_at: string;
120
+ }
121
+ export interface BuybackQuote {
122
+ mcc_amount: number;
123
+ market_price: number;
124
+ buyback_price: number;
125
+ usdc_amount: number;
126
+ premium_amount: number;
127
+ }
128
+ export interface BuybackRecord {
129
+ mcc_amount: number;
130
+ usdc_amount: number;
131
+ stablecoin: string;
132
+ tx_signature?: string;
133
+ buyback_price?: number;
134
+ created_at: string;
135
+ }
136
+ export interface Territory {
137
+ unit_id: string;
138
+ unit_name: string;
139
+ short_id?: string;
140
+ unit_type: string;
141
+ description?: string;
142
+ location?: string;
143
+ image_url?: string;
144
+ parent_id?: string;
145
+ member_count?: number;
146
+ max_capacity?: number;
147
+ vault_balance?: number;
148
+ manager_uid?: string;
149
+ }
150
+ export interface TerritorySummary {
151
+ total_stations: number;
152
+ total_members: number;
153
+ total_vault_mcd: number;
154
+ avg_kpi_score?: number;
155
+ }
156
+ export interface TerritoryStats {
157
+ member_count: number;
158
+ max_capacity: number;
159
+ vault_mcd: number;
160
+ occupancy_rate: number;
161
+ }
162
+ export interface TerritoryMember {
163
+ uid: string;
164
+ display_name?: string;
165
+ level?: string;
166
+ mcd_received?: number;
167
+ joined_at?: string;
168
+ }
169
+ export interface Proposal {
170
+ id: string;
171
+ title: string;
172
+ description: string;
173
+ proposal_type: string;
174
+ status: string;
175
+ options: string[];
176
+ min_votes?: number;
177
+ ends_at: string;
178
+ created_at: string;
179
+ }
180
+ export interface ProposalDetail extends Proposal {
181
+ vote_results: VoteResult[];
182
+ }
183
+ export interface VoteResult {
184
+ option: string;
185
+ votes: number;
186
+ mcc_total: number;
187
+ voter_count: number;
188
+ }
189
+ export interface VotePower {
190
+ vote_power: number;
191
+ user_rank?: string;
192
+ cost_per_vote_mcc?: number;
193
+ mcc_balance?: number;
194
+ max_votes?: number;
195
+ can_vote: boolean;
196
+ }
197
+ export interface AuctionBid {
198
+ bid_id?: string;
199
+ auction_id: number;
200
+ unit_name?: string;
201
+ bid_amount: number;
202
+ deposit_amount?: number;
203
+ status: string;
204
+ created_at: string;
205
+ }
206
+ export interface MCDTransaction {
207
+ id: string;
208
+ tx_type: string;
209
+ amount: number;
210
+ from_account_type?: string;
211
+ to_account_type?: string;
212
+ created_at: string;
213
+ }
214
+ export interface MCDReward {
215
+ id: string;
216
+ reward_date: string;
217
+ territory_id?: string;
218
+ mcd_received: number;
219
+ created_at: string;
220
+ }
221
+ export interface MiningRequest {
222
+ mcc_amount: number;
223
+ stablecoin?: string;
224
+ wallet_address: string;
225
+ }
226
+ export interface MiningConfirmData {
227
+ request_id: string;
228
+ tx_signature: string;
229
+ mcc_amount: number;
230
+ usdc_amount: number;
231
+ stablecoin_type?: string;
232
+ }
233
+ export interface MiningRequestResult {
234
+ request_id: string;
235
+ mcc_amount: number;
236
+ usdc_amount: number;
237
+ mining_price: number;
238
+ stablecoin: string;
239
+ payment_address: string;
240
+ expires_at: string;
241
+ }
242
+ export interface MiningConfig {
243
+ program_id: string;
244
+ pool_address: string;
245
+ mcc_mint: string;
246
+ usdt_mint: string;
247
+ usdc_mint: string;
248
+ distribution_ratios: Record<string, number>;
249
+ min_amount: number;
250
+ max_amount: number;
251
+ }
252
+ export interface BuybackRecordInput {
253
+ tx_signature: string;
254
+ wallet_address: string;
255
+ mcc_amount: number;
256
+ usdc_amount: number;
257
+ stablecoin?: string;
258
+ }
259
+ export interface ReincarnationConfig {
260
+ program_id: string;
261
+ pool_address: string;
262
+ mcc_vault: string;
263
+ usdc_vault: string;
264
+ usdt_vault: string;
265
+ min_buyback: number;
266
+ max_buyback: number;
267
+ premium_rate: number;
268
+ }
269
+ export interface MCCHistoryRecord {
270
+ mcc_amount: number;
271
+ stablecoin_amount: number;
272
+ stablecoin: string;
273
+ tx_signature: string;
274
+ type: string;
275
+ wallet_address?: string;
276
+ created_at: string;
277
+ }
278
+ export interface CycleHistory {
279
+ cycle_id: number;
280
+ executed_at: string;
281
+ mcc_returned: number;
282
+ mcd_returned: number;
283
+ status: string;
284
+ }
285
+ export interface AuctionHistory {
286
+ auction_id: number;
287
+ unit_name: string;
288
+ winner_wallet?: string;
289
+ winning_bid?: number;
290
+ status: string;
291
+ ended_at: string;
292
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microcosmmoney/auth-core",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Microcosm OAuth 2.0 authentication core library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",