@microcosmmoney/auth-core 1.3.0 → 1.5.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 CHANGED
@@ -4,4 +4,5 @@ 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, 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, Notification, OrganizationSummary, TerritoryDetailedStats, ManagerIncomeRecord, TeamCustodySummary, } from './types';
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, 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, Notification, OrganizationSummary, TerritoryDetailedStats, ManagerIncomeRecord, TeamCustodySummary, FragmentBuyInput, FragmentizeInput, FragmentRedeemInput, FragmentBuyoutInitiateInput, FragmentBuyoutAcceptInput, FragmentBuyoutCompleteInput, FragmentBuyoutCancelInput, LendingDepositInput, LendingWithdrawInput, LendingBorrowInput, LendingRepayInput, LendingLiquidateInput, } from './types';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MicrocosmAPI = exports.ApiClient = exports.STORAGE_KEYS = exports.Storage = exports.TokenManager = exports.MicrocosmAuthClient = void 0;
3
+ exports.UserRank = exports.MicrocosmAPI = exports.ApiClient = exports.STORAGE_KEYS = exports.Storage = exports.TokenManager = exports.MicrocosmAuthClient = void 0;
4
4
  // AI-generated · AI-managed · AI-maintained
5
5
  var client_1 = require("./client");
6
6
  Object.defineProperty(exports, "MicrocosmAuthClient", { enumerable: true, get: function () { return client_1.MicrocosmAuthClient; } });
@@ -13,3 +13,5 @@ var api_client_1 = require("./api-client");
13
13
  Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return api_client_1.ApiClient; } });
14
14
  var open_api_1 = require("./open-api");
15
15
  Object.defineProperty(exports, "MicrocosmAPI", { enumerable: true, get: function () { return open_api_1.MicrocosmAPI; } });
16
+ var types_1 = require("./types");
17
+ Object.defineProperty(exports, "UserRank", { enumerable: true, get: function () { return types_1.UserRank; } });
@@ -196,11 +196,61 @@ export declare class MicrocosmAPI {
196
196
  getConfig: () => Promise<ApiRes<any>>;
197
197
  getVaults: () => Promise<ApiRes<any>>;
198
198
  getVault: (id: number) => Promise<ApiRes<any>>;
199
+ buy: (token: string, data: {
200
+ nft_mint: string;
201
+ amount: number;
202
+ max_price_per_fragment_usdc?: number;
203
+ }) => Promise<ApiRes<any>>;
204
+ fragmentize: (token: string, data: {
205
+ nft_mint: string;
206
+ fragment_count: number;
207
+ }) => Promise<ApiRes<any>>;
208
+ redeem: (token: string, data: {
209
+ nft_mint: string;
210
+ }) => Promise<ApiRes<any>>;
211
+ initiateBuyout: (token: string, data: {
212
+ nft_mint: string;
213
+ price_per_fragment_usdc: number;
214
+ }) => Promise<ApiRes<any>>;
215
+ acceptBuyout: (token: string, data: {
216
+ nft_mint: string;
217
+ initiator: string;
218
+ fragment_amount: number;
219
+ }) => Promise<ApiRes<any>>;
220
+ completeBuyout: (token: string, data: {
221
+ nft_mint: string;
222
+ }) => Promise<ApiRes<any>>;
223
+ cancelBuyout: (token: string, data: {
224
+ nft_mint: string;
225
+ }) => Promise<ApiRes<any>>;
199
226
  };
200
227
  readonly lending: {
201
228
  getPool: () => Promise<ApiRes<any>>;
202
229
  getStats: () => Promise<ApiRes<any>>;
203
230
  getPosition: (wallet: string) => Promise<ApiRes<any>>;
231
+ deposit: (token: string, data: {
232
+ wallet: string;
233
+ amount: number;
234
+ }) => Promise<ApiRes<any>>;
235
+ withdraw: (token: string, data: {
236
+ wallet: string;
237
+ lp_amount: number;
238
+ }) => Promise<ApiRes<any>>;
239
+ borrow: (token: string, data: {
240
+ wallet: string;
241
+ amount: number;
242
+ collateral_nft_mint: string;
243
+ }) => Promise<ApiRes<any>>;
244
+ repay: (token: string, data: {
245
+ wallet: string;
246
+ loan_id: number;
247
+ amount: number;
248
+ }) => Promise<ApiRes<any>>;
249
+ liquidate: (token: string, data: {
250
+ liquidator_wallet: string;
251
+ borrower_wallet: string;
252
+ loan_id: number;
253
+ }) => Promise<ApiRes<any>>;
204
254
  };
205
255
  readonly organizations: {
206
256
  getList: (token: string) => Promise<ApiRes<any>>;
package/dist/open-api.js CHANGED
@@ -206,11 +206,23 @@ class MicrocosmAPI {
206
206
  getConfig: () => request(this.base, '/fragment/config'),
207
207
  getVaults: () => request(this.base, '/fragment/vaults'),
208
208
  getVault: (id) => request(this.base, `/fragment/vault/${id}`),
209
+ buy: (token, data) => postRequest(this.base, '/fragment/buy/prepare', data, token),
210
+ fragmentize: (token, data) => postRequest(this.base, '/fragment/fragmentize/prepare', data, token),
211
+ redeem: (token, data) => postRequest(this.base, '/fragment/redeem/prepare', data, token),
212
+ initiateBuyout: (token, data) => postRequest(this.base, '/fragment/buyout/initiate/prepare', data, token),
213
+ acceptBuyout: (token, data) => postRequest(this.base, '/fragment/buyout/accept/prepare', data, token),
214
+ completeBuyout: (token, data) => postRequest(this.base, '/fragment/buyout/complete/prepare', data, token),
215
+ cancelBuyout: (token, data) => postRequest(this.base, '/fragment/buyout/cancel/prepare', data, token),
209
216
  };
210
217
  this.lending = {
211
218
  getPool: () => request(this.base, '/lending/pool'),
212
219
  getStats: () => request(this.base, '/lending/stats'),
213
220
  getPosition: (wallet) => request(this.base, `/lending/position/${wallet}`),
221
+ deposit: (token, data) => postRequest(this.base, '/lending/deposit/prepare', data, token),
222
+ withdraw: (token, data) => postRequest(this.base, '/lending/withdraw/prepare', data, token),
223
+ borrow: (token, data) => postRequest(this.base, '/lending/borrow/prepare', data, token),
224
+ repay: (token, data) => postRequest(this.base, '/lending/repay/prepare', data, token),
225
+ liquidate: (token, data) => postRequest(this.base, '/lending/liquidate/prepare', data, token),
214
226
  };
215
227
  this.organizations = {
216
228
  getList: (token) => request(this.base, '/organizations', token),
package/dist/types.d.ts CHANGED
@@ -1,4 +1,13 @@
1
1
  export type UnitType = 'station' | 'matrix' | 'sector' | 'system';
2
+ export declare enum UserRank {
3
+ RECRUIT = "Recruit",
4
+ PROSPECT = "Prospect",
5
+ MINER = "Miner",
6
+ COMMANDER = "Commander",
7
+ PIONEER = "Pioneer",
8
+ WARDEN = "Warden",
9
+ ADMIRAL = "Admiral"
10
+ }
2
11
  export interface MicrocosmAuthConfig {
3
12
  clientId: string;
4
13
  redirectUri: string;
@@ -522,3 +531,53 @@ export interface TeamCustodySummary {
522
531
  address: string;
523
532
  }[];
524
533
  }
534
+ export interface FragmentBuyInput {
535
+ nft_mint: string;
536
+ amount: number;
537
+ max_price_per_fragment_usdc?: number;
538
+ }
539
+ export interface FragmentizeInput {
540
+ nft_mint: string;
541
+ fragment_count: number;
542
+ }
543
+ export interface FragmentRedeemInput {
544
+ nft_mint: string;
545
+ }
546
+ export interface FragmentBuyoutInitiateInput {
547
+ nft_mint: string;
548
+ price_per_fragment_usdc: number;
549
+ }
550
+ export interface FragmentBuyoutAcceptInput {
551
+ nft_mint: string;
552
+ initiator: string;
553
+ fragment_amount: number;
554
+ }
555
+ export interface FragmentBuyoutCompleteInput {
556
+ nft_mint: string;
557
+ }
558
+ export interface FragmentBuyoutCancelInput {
559
+ nft_mint: string;
560
+ }
561
+ export interface LendingDepositInput {
562
+ wallet: string;
563
+ amount: number;
564
+ }
565
+ export interface LendingWithdrawInput {
566
+ wallet: string;
567
+ lp_amount: number;
568
+ }
569
+ export interface LendingBorrowInput {
570
+ wallet: string;
571
+ amount: number;
572
+ collateral_nft_mint: string;
573
+ }
574
+ export interface LendingRepayInput {
575
+ wallet: string;
576
+ loan_id: number;
577
+ amount: number;
578
+ }
579
+ export interface LendingLiquidateInput {
580
+ liquidator_wallet: string;
581
+ borrower_wallet: string;
582
+ loan_id: number;
583
+ }
package/dist/types.js CHANGED
@@ -1,2 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserRank = void 0;
4
+ var UserRank;
5
+ (function (UserRank) {
6
+ UserRank["RECRUIT"] = "Recruit";
7
+ UserRank["PROSPECT"] = "Prospect";
8
+ UserRank["MINER"] = "Miner";
9
+ UserRank["COMMANDER"] = "Commander";
10
+ UserRank["PIONEER"] = "Pioneer";
11
+ UserRank["WARDEN"] = "Warden";
12
+ UserRank["ADMIRAL"] = "Admiral";
13
+ })(UserRank || (exports.UserRank = UserRank = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microcosmmoney/auth-core",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Microcosm OAuth 2.0 authentication core library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",