@microcosmmoney/auth-core 2.0.0 → 2.2.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/index.d.ts +1 -1
- package/dist/open-api.d.ts +90 -26
- package/dist/open-api.js +74 -17
- package/dist/types.d.ts +9 -50
- package/package.json +22 -21
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { ApiClient } from './api-client';
|
|
|
5
5
|
export { MicrocosmAPI } from './open-api';
|
|
6
6
|
export type { MicrocosmAPIConfig } from './open-api';
|
|
7
7
|
export { UserRank } from './types';
|
|
8
|
-
export type { MicrocosmAuthConfig, ResolvedConfig, User, TokenData, AuthState, LoginOptions, TokenExchangeResponse, UserProfileResponse, ApiResponse, MCDBalance, MCCBalance, MCCWalletBalance, MCCPrice, Wallet, TokenPortfolio, MCCLock, MiningRatio, MiningDistribution,
|
|
8
|
+
export type { MicrocosmAuthConfig, ResolvedConfig, User, TokenData, AuthState, LoginOptions, TokenExchangeResponse, UserProfileResponse, ApiResponse, 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, Notification, OrganizationSummary, TerritoryDetailedStats, ManagerIncomeRecord, TeamCustodySummary, FragmentBuyInput, FragmentizeInput, FragmentRedeemInput, FragmentBuyoutInitiateInput, FragmentBuyoutAcceptInput, FragmentBuyoutCompleteInput, FragmentBuyoutCancelInput, LendingDepositInput, LendingWithdrawInput, LendingBorrowInput, LendingRepayInput, LendingExtendInput, LendingLiquidateInput, } from './types';
|
package/dist/open-api.d.ts
CHANGED
|
@@ -24,8 +24,10 @@ export declare class MicrocosmAPI {
|
|
|
24
24
|
page?: number;
|
|
25
25
|
page_size?: number;
|
|
26
26
|
}) => Promise<ApiRes<any>>;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
getCirculatingSupply: () => Promise<any>;
|
|
28
|
+
getTotalSupply: () => Promise<any>;
|
|
29
|
+
getTokenInfo: () => Promise<ApiRes<any>>;
|
|
30
|
+
getPriceHistory: (period?: string) => Promise<ApiRes<any>>;
|
|
29
31
|
};
|
|
30
32
|
readonly mcd: {
|
|
31
33
|
getBalance: (token: string) => Promise<ApiRes<any>>;
|
|
@@ -46,27 +48,6 @@ export declare class MicrocosmAPI {
|
|
|
46
48
|
list: (token: string) => Promise<ApiRes<any>>;
|
|
47
49
|
getTokens: (address: string) => Promise<ApiRes<any>>;
|
|
48
50
|
};
|
|
49
|
-
readonly reincarnation: {
|
|
50
|
-
getPool: () => Promise<ApiRes<any>>;
|
|
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>>;
|
|
69
|
-
};
|
|
70
51
|
readonly mining: {
|
|
71
52
|
getRecords: (token: string, params?: {
|
|
72
53
|
page?: number;
|
|
@@ -108,7 +89,13 @@ export declare class MicrocosmAPI {
|
|
|
108
89
|
};
|
|
109
90
|
readonly users: {
|
|
110
91
|
getProfile: (token: string) => Promise<ApiRes<any>>;
|
|
92
|
+
getDetailedProfile: (token: string) => Promise<ApiRes<any>>;
|
|
111
93
|
getLevel: (token: string) => Promise<ApiRes<any>>;
|
|
94
|
+
getPublicProfile: (uid: string) => Promise<ApiRes<any>>;
|
|
95
|
+
updateProfile: (token: string, data: {
|
|
96
|
+
display_name?: string;
|
|
97
|
+
}) => Promise<ApiRes<any>>;
|
|
98
|
+
uploadAvatar: (token: string, file: Blob) => Promise<ApiRes<any>>;
|
|
112
99
|
};
|
|
113
100
|
readonly dashboard: {
|
|
114
101
|
getMarket: () => Promise<ApiRes<any>>;
|
|
@@ -144,11 +131,27 @@ export declare class MicrocosmAPI {
|
|
|
144
131
|
image_url?: string;
|
|
145
132
|
}) => Promise<ApiRes<any>>;
|
|
146
133
|
updateName: (token: string, id: string, name: string, force?: boolean) => Promise<ApiRes<any>>;
|
|
134
|
+
join: (token: string, id: string) => Promise<ApiRes<any>>;
|
|
135
|
+
leave: (token: string, id: string) => Promise<ApiRes<any>>;
|
|
136
|
+
getQueue: (token: string) => Promise<ApiRes<any>>;
|
|
137
|
+
joinQueue: (token: string) => Promise<ApiRes<any>>;
|
|
138
|
+
leaveQueue: (token: string) => Promise<ApiRes<any>>;
|
|
139
|
+
getManagerIncome: (token: string) => Promise<ApiRes<any>>;
|
|
140
|
+
getTeamCustody: (token: string) => Promise<ApiRes<any>>;
|
|
141
|
+
getDetailedStats: (id: string) => Promise<ApiRes<any>>;
|
|
142
|
+
getNameStatus: (id: string) => Promise<ApiRes<any>>;
|
|
143
|
+
getDistributionPlan: (id: string) => Promise<ApiRes<any>>;
|
|
144
|
+
updateDistributionPlan: (token: string, id: string, data: Record<string, any>) => Promise<ApiRes<any>>;
|
|
147
145
|
};
|
|
148
146
|
readonly territory: {
|
|
149
147
|
getCollection: () => Promise<ApiRes<any>>;
|
|
150
148
|
getNft: (mint: string) => Promise<ApiRes<any>>;
|
|
151
149
|
getUserNfts: (wallet: string) => Promise<ApiRes<any>>;
|
|
150
|
+
getUserStatus: (uid: string) => Promise<ApiRes<any>>;
|
|
151
|
+
getUnitNft: (unitId: string) => Promise<ApiRes<any>>;
|
|
152
|
+
prepareMint: (token: string, data: Record<string, any>) => Promise<ApiRes<any>>;
|
|
153
|
+
prepareTransfer: (token: string, data: Record<string, any>) => Promise<ApiRes<any>>;
|
|
154
|
+
prepareBurn: (token: string, data: Record<string, any>) => Promise<ApiRes<any>>;
|
|
152
155
|
};
|
|
153
156
|
readonly voting: {
|
|
154
157
|
getProposals: (token: string, params?: {
|
|
@@ -184,6 +187,12 @@ export declare class MicrocosmAPI {
|
|
|
184
187
|
page?: number;
|
|
185
188
|
page_size?: number;
|
|
186
189
|
}) => Promise<ApiRes<any>>;
|
|
190
|
+
create: (token: string, data: {
|
|
191
|
+
unit_name: string;
|
|
192
|
+
unit_type: string;
|
|
193
|
+
starting_price: number;
|
|
194
|
+
duration_hours?: number;
|
|
195
|
+
}) => Promise<ApiRes<any>>;
|
|
187
196
|
};
|
|
188
197
|
readonly techTree: {
|
|
189
198
|
getConfig: () => Promise<ApiRes<any>>;
|
|
@@ -196,6 +205,8 @@ export declare class MicrocosmAPI {
|
|
|
196
205
|
getConfig: () => Promise<ApiRes<any>>;
|
|
197
206
|
getVaults: () => Promise<ApiRes<any>>;
|
|
198
207
|
getVault: (id: number) => Promise<ApiRes<any>>;
|
|
208
|
+
getVaultHolders: (id: number) => Promise<ApiRes<any>>;
|
|
209
|
+
getHoldings: (wallet: string) => Promise<ApiRes<any>>;
|
|
199
210
|
buy: (token: string, data: {
|
|
200
211
|
nft_mint: string;
|
|
201
212
|
amount: number;
|
|
@@ -227,7 +238,19 @@ export declare class MicrocosmAPI {
|
|
|
227
238
|
readonly lending: {
|
|
228
239
|
getPool: () => Promise<ApiRes<any>>;
|
|
229
240
|
getStats: () => Promise<ApiRes<any>>;
|
|
241
|
+
getOracle: () => Promise<ApiRes<any>>;
|
|
230
242
|
getPosition: (wallet: string) => Promise<ApiRes<any>>;
|
|
243
|
+
getLoans: (wallet: string) => Promise<ApiRes<any>>;
|
|
244
|
+
getLoan: (wallet: string, loanId: string) => Promise<ApiRes<any>>;
|
|
245
|
+
getLpBalance: (wallet: string) => Promise<ApiRes<any>>;
|
|
246
|
+
calculateInterest: (data: {
|
|
247
|
+
wallet: string;
|
|
248
|
+
nft_mint: string;
|
|
249
|
+
}) => Promise<ApiRes<any>>;
|
|
250
|
+
estimateBorrowCost: (data: {
|
|
251
|
+
amount: number;
|
|
252
|
+
duration_type: number;
|
|
253
|
+
}) => Promise<ApiRes<any>>;
|
|
231
254
|
deposit: (token: string, data: {
|
|
232
255
|
wallet: string;
|
|
233
256
|
amount: number;
|
|
@@ -239,21 +262,62 @@ export declare class MicrocosmAPI {
|
|
|
239
262
|
borrow: (token: string, data: {
|
|
240
263
|
wallet: string;
|
|
241
264
|
amount: number;
|
|
242
|
-
|
|
265
|
+
nft_mint: string;
|
|
266
|
+
duration_type: number;
|
|
243
267
|
}) => Promise<ApiRes<any>>;
|
|
244
268
|
repay: (token: string, data: {
|
|
245
269
|
wallet: string;
|
|
246
|
-
|
|
270
|
+
nft_mint: string;
|
|
247
271
|
amount: number;
|
|
248
272
|
}) => Promise<ApiRes<any>>;
|
|
273
|
+
extend: (token: string, data: {
|
|
274
|
+
wallet: string;
|
|
275
|
+
nft_mint: string;
|
|
276
|
+
new_duration_type: number;
|
|
277
|
+
}) => Promise<ApiRes<any>>;
|
|
249
278
|
liquidate: (token: string, data: {
|
|
250
279
|
liquidator_wallet: string;
|
|
251
280
|
borrower_wallet: string;
|
|
252
|
-
|
|
281
|
+
nft_mint: string;
|
|
253
282
|
}) => Promise<ApiRes<any>>;
|
|
254
283
|
};
|
|
255
284
|
readonly organizations: {
|
|
256
285
|
getList: (token: string) => Promise<ApiRes<any>>;
|
|
286
|
+
getTree: (token: string) => Promise<ApiRes<any>>;
|
|
287
|
+
getSummary: (token: string) => Promise<ApiRes<any>>;
|
|
288
|
+
getDetail: (token: string, id: string) => Promise<ApiRes<any>>;
|
|
289
|
+
getMembers: (token: string, id: string, params?: {
|
|
290
|
+
page?: number;
|
|
291
|
+
page_size?: number;
|
|
292
|
+
}) => Promise<ApiRes<any>>;
|
|
293
|
+
getStats: (id: string) => Promise<ApiRes<any>>;
|
|
294
|
+
};
|
|
295
|
+
readonly notifications: {
|
|
296
|
+
list: (token: string, params?: {
|
|
297
|
+
page?: number;
|
|
298
|
+
page_size?: number;
|
|
299
|
+
unread_only?: boolean;
|
|
300
|
+
}) => Promise<ApiRes<any>>;
|
|
301
|
+
getUnreadCount: (token: string) => Promise<ApiRes<any>>;
|
|
302
|
+
markRead: (token: string, ids?: string[]) => Promise<ApiRes<any>>;
|
|
303
|
+
markSingleRead: (token: string, id: string) => Promise<ApiRes<any>>;
|
|
304
|
+
};
|
|
305
|
+
readonly projects: {
|
|
306
|
+
apply: (token: string, data: {
|
|
307
|
+
project_name: string;
|
|
308
|
+
description: string;
|
|
309
|
+
redirect_uris: string[];
|
|
310
|
+
domains: string[];
|
|
311
|
+
mcd_wallet?: string;
|
|
312
|
+
}) => Promise<ApiRes<any>>;
|
|
313
|
+
getMyApplications: (token: string) => Promise<ApiRes<any>>;
|
|
314
|
+
};
|
|
315
|
+
readonly nft: {
|
|
316
|
+
getCollectionMetadata: () => Promise<any>;
|
|
317
|
+
getTerritoryMetadata: (territoryId: string) => Promise<any>;
|
|
318
|
+
getCollectionImage: () => string;
|
|
319
|
+
getDefaultImage: (typeName: string) => string;
|
|
320
|
+
getTerritoryImage: (territoryId: string) => string;
|
|
257
321
|
};
|
|
258
322
|
}
|
|
259
323
|
export {};
|
package/dist/open-api.js
CHANGED
|
@@ -60,8 +60,10 @@ class MicrocosmAPI {
|
|
|
60
60
|
qs += `&tx_type=${p.tx_type}`;
|
|
61
61
|
return request(this.base, `/mcc/history${qs}`, token);
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
getCirculatingSupply: () => request(this.base, '/mcc/circulating-supply'),
|
|
64
|
+
getTotalSupply: () => request(this.base, '/mcc/total-supply'),
|
|
65
|
+
getTokenInfo: () => request(this.base, '/mcc/token-info'),
|
|
66
|
+
getPriceHistory: (period = '7d') => request(this.base, `/mcc/price/history?period=${period}`),
|
|
65
67
|
};
|
|
66
68
|
this.mcd = {
|
|
67
69
|
getBalance: (token) => request(this.base, '/mcd/balance', token),
|
|
@@ -87,21 +89,6 @@ class MicrocosmAPI {
|
|
|
87
89
|
list: (token) => request(this.base, '/wallets', token),
|
|
88
90
|
getTokens: (address) => request(this.base, `/wallets/${address}/tokens`),
|
|
89
91
|
};
|
|
90
|
-
this.reincarnation = {
|
|
91
|
-
getPool: () => request(this.base, '/reincarnation/pool'),
|
|
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
|
-
},
|
|
104
|
-
};
|
|
105
92
|
this.mining = {
|
|
106
93
|
getRecords: (token, params) => {
|
|
107
94
|
const p = params || {};
|
|
@@ -126,7 +113,20 @@ class MicrocosmAPI {
|
|
|
126
113
|
};
|
|
127
114
|
this.users = {
|
|
128
115
|
getProfile: (token) => request(this.base, '/users/me', token),
|
|
116
|
+
getDetailedProfile: (token) => request(this.base, '/users/me/profile', token),
|
|
129
117
|
getLevel: (token) => request(this.base, '/users/me/level', token),
|
|
118
|
+
getPublicProfile: (uid) => request(this.base, `/users/${uid}`),
|
|
119
|
+
updateProfile: (token, data) => mutateRequest(this.base, 'PATCH', '/users/me/profile', data, token),
|
|
120
|
+
uploadAvatar: async (token, file) => {
|
|
121
|
+
const form = new FormData();
|
|
122
|
+
form.append('file', file);
|
|
123
|
+
const headers = { 'Authorization': `Bearer ${token}` };
|
|
124
|
+
const res = await fetch(`${this.base}/users/me/avatar`, { method: 'POST', headers, body: form });
|
|
125
|
+
const data = await res.json();
|
|
126
|
+
if (!res.ok)
|
|
127
|
+
throw new Error(data.detail || `API error ${res.status}`);
|
|
128
|
+
return data;
|
|
129
|
+
},
|
|
130
130
|
};
|
|
131
131
|
this.dashboard = {
|
|
132
132
|
getMarket: () => request(this.base, '/dashboard/market'),
|
|
@@ -161,11 +161,27 @@ class MicrocosmAPI {
|
|
|
161
161
|
},
|
|
162
162
|
update: (token, id, data) => putRequest(this.base, `/territories/${id}`, data, token),
|
|
163
163
|
updateName: (token, id, name, force = false) => putRequest(this.base, `/territories/${id}/name${force ? '?force=true' : ''}`, { name }, token),
|
|
164
|
+
join: (token, id) => postRequest(this.base, `/territories/${id}/join`, {}, token),
|
|
165
|
+
leave: (token, id) => postRequest(this.base, `/territories/${id}/leave`, {}, token),
|
|
166
|
+
getQueue: (token) => request(this.base, '/territories/queue', token),
|
|
167
|
+
joinQueue: (token) => postRequest(this.base, '/territories/queue', {}, token),
|
|
168
|
+
leaveQueue: (token) => mutateRequest(this.base, 'DELETE', '/territories/queue', {}, token),
|
|
169
|
+
getManagerIncome: (token) => request(this.base, '/territories/manager/income', token),
|
|
170
|
+
getTeamCustody: (token) => request(this.base, '/territories/team/custody', token),
|
|
171
|
+
getDetailedStats: (id) => request(this.base, `/territories/${id}/detailed-stats`),
|
|
172
|
+
getNameStatus: (id) => request(this.base, `/territories/${id}/name-status`),
|
|
173
|
+
getDistributionPlan: (id) => request(this.base, `/territories/${id}/distribution-plan`),
|
|
174
|
+
updateDistributionPlan: (token, id, data) => putRequest(this.base, `/territories/${id}/distribution-plan`, data, token),
|
|
164
175
|
};
|
|
165
176
|
this.territory = {
|
|
166
177
|
getCollection: () => request(this.base, '/territory/collection'),
|
|
167
178
|
getNft: (mint) => request(this.base, `/territory/nft/${mint}`),
|
|
168
179
|
getUserNfts: (wallet) => request(this.base, `/territory/nfts/${wallet}`),
|
|
180
|
+
getUserStatus: (uid) => request(this.base, `/territory/user-status/${uid}`),
|
|
181
|
+
getUnitNft: (unitId) => request(this.base, `/territory/unit/${unitId}/nft`),
|
|
182
|
+
prepareMint: (token, data) => postRequest(this.base, '/territory/nft/mint', data, token),
|
|
183
|
+
prepareTransfer: (token, data) => postRequest(this.base, '/territory/nft/transfer/prepare', data, token),
|
|
184
|
+
prepareBurn: (token, data) => postRequest(this.base, '/territory/nft/burn/prepare', data, token),
|
|
169
185
|
};
|
|
170
186
|
this.voting = {
|
|
171
187
|
getProposals: (token, params) => {
|
|
@@ -194,6 +210,7 @@ class MicrocosmAPI {
|
|
|
194
210
|
const p = params || {};
|
|
195
211
|
return request(this.base, `/auction-solana/history?page=${p.page || 1}&page_size=${p.page_size || 20}`);
|
|
196
212
|
},
|
|
213
|
+
create: (token, data) => postRequest(this.base, '/auction-solana/create', data, token),
|
|
197
214
|
};
|
|
198
215
|
this.techTree = {
|
|
199
216
|
getConfig: () => request(this.base, '/tech-tree/config'),
|
|
@@ -206,6 +223,8 @@ class MicrocosmAPI {
|
|
|
206
223
|
getConfig: () => request(this.base, '/fragment/config'),
|
|
207
224
|
getVaults: () => request(this.base, '/fragment/vaults'),
|
|
208
225
|
getVault: (id) => request(this.base, `/fragment/vault/${id}`),
|
|
226
|
+
getVaultHolders: (id) => request(this.base, `/fragment/vault/${id}/holders`),
|
|
227
|
+
getHoldings: (wallet) => request(this.base, `/fragment/holdings/${wallet}`),
|
|
209
228
|
buy: (token, data) => postRequest(this.base, '/fragment/buy/prepare', data, token),
|
|
210
229
|
fragmentize: (token, data) => postRequest(this.base, '/fragment/fragmentize/prepare', data, token),
|
|
211
230
|
redeem: (token, data) => postRequest(this.base, '/fragment/redeem/prepare', data, token),
|
|
@@ -217,15 +236,53 @@ class MicrocosmAPI {
|
|
|
217
236
|
this.lending = {
|
|
218
237
|
getPool: () => request(this.base, '/lending/pool'),
|
|
219
238
|
getStats: () => request(this.base, '/lending/stats'),
|
|
239
|
+
getOracle: () => request(this.base, '/lending/oracle'),
|
|
220
240
|
getPosition: (wallet) => request(this.base, `/lending/position/${wallet}`),
|
|
241
|
+
getLoans: (wallet) => request(this.base, `/lending/loans/${wallet}`),
|
|
242
|
+
getLoan: (wallet, loanId) => request(this.base, `/lending/loan/${wallet}/${loanId}`),
|
|
243
|
+
getLpBalance: (wallet) => request(this.base, `/lending/lp-balance/${wallet}`),
|
|
244
|
+
calculateInterest: (data) => postRequest(this.base, '/lending/calculate-interest', data),
|
|
245
|
+
estimateBorrowCost: (data) => postRequest(this.base, '/lending/estimate-borrow-cost', data),
|
|
221
246
|
deposit: (token, data) => postRequest(this.base, '/lending/deposit/prepare', data, token),
|
|
222
247
|
withdraw: (token, data) => postRequest(this.base, '/lending/withdraw/prepare', data, token),
|
|
223
248
|
borrow: (token, data) => postRequest(this.base, '/lending/borrow/prepare', data, token),
|
|
224
249
|
repay: (token, data) => postRequest(this.base, '/lending/repay/prepare', data, token),
|
|
250
|
+
extend: (token, data) => postRequest(this.base, '/lending/extend/prepare', data, token),
|
|
225
251
|
liquidate: (token, data) => postRequest(this.base, '/lending/liquidate/prepare', data, token),
|
|
226
252
|
};
|
|
227
253
|
this.organizations = {
|
|
228
254
|
getList: (token) => request(this.base, '/organizations', token),
|
|
255
|
+
getTree: (token) => request(this.base, '/organizations/tree', token),
|
|
256
|
+
getSummary: (token) => request(this.base, '/organizations/summary', token),
|
|
257
|
+
getDetail: (token, id) => request(this.base, `/organizations/${id}`, token),
|
|
258
|
+
getMembers: (token, id, params) => {
|
|
259
|
+
const p = params || {};
|
|
260
|
+
return request(this.base, `/organizations/${id}/members?page=${p.page || 1}&page_size=${p.page_size || 20}`, token);
|
|
261
|
+
},
|
|
262
|
+
getStats: (id) => request(this.base, `/organizations/${id}/stats`),
|
|
263
|
+
};
|
|
264
|
+
this.notifications = {
|
|
265
|
+
list: (token, params) => {
|
|
266
|
+
const p = params || {};
|
|
267
|
+
let qs = `?page=${p.page || 1}&page_size=${p.page_size || 20}`;
|
|
268
|
+
if (p.unread_only)
|
|
269
|
+
qs += '&unread_only=true';
|
|
270
|
+
return request(this.base, `/notifications${qs}`, token);
|
|
271
|
+
},
|
|
272
|
+
getUnreadCount: (token) => request(this.base, '/notifications/unread-count', token),
|
|
273
|
+
markRead: (token, ids) => postRequest(this.base, '/notifications/read', ids ? { notification_ids: ids } : {}, token),
|
|
274
|
+
markSingleRead: (token, id) => postRequest(this.base, `/notifications/${id}/read`, {}, token),
|
|
275
|
+
};
|
|
276
|
+
this.projects = {
|
|
277
|
+
apply: (token, data) => postRequest(this.base.replace('/v1', ''), '/api/open/projects/apply', data, token),
|
|
278
|
+
getMyApplications: (token) => request(this.base.replace('/v1', ''), '/api/open/projects/applications/mine', token),
|
|
279
|
+
};
|
|
280
|
+
this.nft = {
|
|
281
|
+
getCollectionMetadata: () => request(this.base, '/nft/metadata/collection.json'),
|
|
282
|
+
getTerritoryMetadata: (territoryId) => request(this.base, `/nft/metadata/${territoryId}.json`),
|
|
283
|
+
getCollectionImage: () => `${this.base}/nft/image/collection`,
|
|
284
|
+
getDefaultImage: (typeName) => `${this.base}/nft/image/default/${typeName}`,
|
|
285
|
+
getTerritoryImage: (territoryId) => `${this.base}/nft/image/${territoryId}`,
|
|
229
286
|
};
|
|
230
287
|
this.base = (config?.baseUrl || DEFAULT_BASE).replace(/\/$/, '');
|
|
231
288
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -97,8 +97,6 @@ export interface MCCPrice {
|
|
|
97
97
|
market_cap?: number | null;
|
|
98
98
|
source: string;
|
|
99
99
|
updated_at: string;
|
|
100
|
-
buyback_price?: number;
|
|
101
|
-
premium_rate?: number;
|
|
102
100
|
}
|
|
103
101
|
export interface Wallet {
|
|
104
102
|
wallet_address: string;
|
|
@@ -138,27 +136,6 @@ export interface MiningDistribution {
|
|
|
138
136
|
tx_signature?: string;
|
|
139
137
|
created_at: string;
|
|
140
138
|
}
|
|
141
|
-
export interface BuybackQuote {
|
|
142
|
-
mcc_amount: number;
|
|
143
|
-
market_price: number;
|
|
144
|
-
buyback_price: number;
|
|
145
|
-
usdc_amount: number;
|
|
146
|
-
premium_amount: number;
|
|
147
|
-
fee?: number;
|
|
148
|
-
fee_rate?: number;
|
|
149
|
-
slippage?: number;
|
|
150
|
-
net_amount?: number;
|
|
151
|
-
vault_type?: string;
|
|
152
|
-
pool_remaining?: number;
|
|
153
|
-
}
|
|
154
|
-
export interface BuybackRecord {
|
|
155
|
-
mcc_amount: number;
|
|
156
|
-
usdc_amount: number;
|
|
157
|
-
stablecoin: string;
|
|
158
|
-
tx_signature?: string;
|
|
159
|
-
buyback_price?: number;
|
|
160
|
-
created_at: string;
|
|
161
|
-
}
|
|
162
139
|
export interface Territory {
|
|
163
140
|
unit_id: string;
|
|
164
141
|
unit_name: string;
|
|
@@ -283,23 +260,6 @@ export interface MiningConfig {
|
|
|
283
260
|
min_amount: number;
|
|
284
261
|
max_amount: number;
|
|
285
262
|
}
|
|
286
|
-
export interface BuybackRecordInput {
|
|
287
|
-
tx_signature: string;
|
|
288
|
-
wallet_address: string;
|
|
289
|
-
mcc_amount: number;
|
|
290
|
-
usdc_amount: number;
|
|
291
|
-
stablecoin?: string;
|
|
292
|
-
}
|
|
293
|
-
export interface ReincarnationConfig {
|
|
294
|
-
program_id: string;
|
|
295
|
-
pool_address: string;
|
|
296
|
-
mcc_vault: string;
|
|
297
|
-
usdc_vault: string;
|
|
298
|
-
usdt_vault: string;
|
|
299
|
-
min_buyback: number;
|
|
300
|
-
max_buyback: number;
|
|
301
|
-
premium_rate: number;
|
|
302
|
-
}
|
|
303
263
|
export interface MCCHistoryRecord {
|
|
304
264
|
mcc_amount: number;
|
|
305
265
|
stablecoin_amount: number;
|
|
@@ -309,13 +269,6 @@ export interface MCCHistoryRecord {
|
|
|
309
269
|
wallet_address?: string;
|
|
310
270
|
created_at: string;
|
|
311
271
|
}
|
|
312
|
-
export interface CycleHistory {
|
|
313
|
-
cycle_id: number;
|
|
314
|
-
executed_at: string;
|
|
315
|
-
mcc_returned: number;
|
|
316
|
-
mcd_returned: number;
|
|
317
|
-
status: string;
|
|
318
|
-
}
|
|
319
272
|
export interface AuctionHistory {
|
|
320
273
|
auction_id: number;
|
|
321
274
|
unit_name: string;
|
|
@@ -569,15 +522,21 @@ export interface LendingWithdrawInput {
|
|
|
569
522
|
export interface LendingBorrowInput {
|
|
570
523
|
wallet: string;
|
|
571
524
|
amount: number;
|
|
572
|
-
|
|
525
|
+
nft_mint: string;
|
|
526
|
+
duration_type: number;
|
|
573
527
|
}
|
|
574
528
|
export interface LendingRepayInput {
|
|
575
529
|
wallet: string;
|
|
576
|
-
|
|
530
|
+
nft_mint: string;
|
|
577
531
|
amount: number;
|
|
578
532
|
}
|
|
533
|
+
export interface LendingExtendInput {
|
|
534
|
+
wallet: string;
|
|
535
|
+
nft_mint: string;
|
|
536
|
+
new_duration_type: number;
|
|
537
|
+
}
|
|
579
538
|
export interface LendingLiquidateInput {
|
|
580
539
|
liquidator_wallet: string;
|
|
581
540
|
borrower_wallet: string;
|
|
582
|
-
|
|
541
|
+
nft_mint: string;
|
|
583
542
|
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@microcosmmoney/auth-core",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Microcosm OAuth 2.0 authentication core library",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@microcosmmoney/auth-core",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "Microcosm OAuth 2.0 authentication core library",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.9.3"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/MicrocosmMoney/Microcosm"
|
|
21
|
+
}
|
|
22
|
+
}
|