@microcosmmoney/portal-react 3.12.8 → 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/index.d.ts +22 -0
- package/dist/index.js +48 -1
- package/dist/main-portal/components/auctions/AuctionsPage.d.ts +1 -0
- package/dist/main-portal/components/auctions/AuctionsPage.js +218 -0
- package/dist/main-portal/components/data/asset-stats.d.ts +1 -0
- package/dist/main-portal/components/data/asset-stats.js +33 -0
- package/dist/main-portal/components/data/charts/MCCSupplyChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/MCCSupplyChart.js +27 -0
- package/dist/main-portal/components/data/charts/MiningTrendChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/MiningTrendChart.js +39 -0
- package/dist/main-portal/components/data/charts/PriceChart.d.ts +5 -0
- package/dist/main-portal/components/data/charts/PriceChart.js +99 -0
- package/dist/main-portal/components/data/charts/TeamWalletChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/TeamWalletChart.js +33 -0
- package/dist/main-portal/components/data/charts/TerritoryProgressChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/TerritoryProgressChart.js +35 -0
- package/dist/main-portal/components/data/charts/UserLevelPieChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/UserLevelPieChart.js +34 -0
- package/dist/main-portal/components/data/charts/index.d.ts +5 -0
- package/dist/main-portal/components/data/charts/index.js +14 -0
- package/dist/main-portal/components/data/data-hero.d.ts +1 -0
- package/dist/main-portal/components/data/data-hero.js +81 -0
- package/dist/main-portal/components/data/mining-history-stats.d.ts +1 -0
- package/dist/main-portal/components/data/mining-history-stats.js +44 -0
- package/dist/main-portal/components/data/team-wallet-stats.d.ts +1 -0
- package/dist/main-portal/components/data/team-wallet-stats.js +34 -0
- package/dist/main-portal/components/data/territory-stats.d.ts +1 -0
- package/dist/main-portal/components/data/territory-stats.js +48 -0
- package/dist/main-portal/components/data/user-level-stats.d.ts +1 -0
- package/dist/main-portal/components/data/user-level-stats.js +36 -0
- package/dist/main-portal/components/fragment/FragmentPage.d.ts +1 -0
- package/dist/main-portal/components/fragment/FragmentPage.js +13 -0
- package/dist/main-portal/components/income/ManagerIncomePage.d.ts +1 -0
- package/dist/main-portal/components/income/ManagerIncomePage.js +147 -0
- package/dist/main-portal/components/layout/AppSidebar.d.ts +3 -0
- package/dist/main-portal/components/layout/AppSidebar.js +88 -0
- package/dist/main-portal/components/layout/DashboardHeader.d.ts +1 -0
- package/dist/main-portal/components/layout/DashboardHeader.js +121 -0
- package/dist/main-portal/components/layout/LocaleSwitcher.d.ts +1 -0
- package/dist/main-portal/components/layout/LocaleSwitcher.js +30 -0
- package/dist/main-portal/components/layout/MainFooter.d.ts +2 -0
- package/dist/main-portal/components/layout/MainFooter.js +50 -0
- package/dist/main-portal/components/layout/ShadcnNavbar.d.ts +1 -0
- package/dist/main-portal/components/layout/ShadcnNavbar.js +155 -0
- package/dist/main-portal/components/layout/TerminalSidebar.d.ts +1 -0
- package/dist/main-portal/components/layout/TerminalSidebar.js +110 -0
- package/dist/main-portal/components/lending/LendingPage.d.ts +1 -0
- package/dist/main-portal/components/lending/LendingPage.js +20 -0
- package/dist/main-portal/components/mcd/MCDPage.d.ts +1 -0
- package/dist/main-portal/components/mcd/MCDPage.js +125 -0
- package/dist/main-portal/components/messages/MessagesPage.d.ts +1 -0
- package/dist/main-portal/components/messages/MessagesPage.js +13 -0
- package/dist/main-portal/components/mining/MiningDistributionHistory.d.ts +11 -0
- package/dist/main-portal/components/mining/MiningDistributionHistory.js +84 -0
- package/dist/main-portal/components/mining/MiningModal.d.ts +12 -0
- package/dist/main-portal/components/mining/MiningModal.js +302 -0
- package/dist/main-portal/components/mining/MiningPage.d.ts +1 -0
- package/dist/main-portal/components/mining/MiningPage.js +237 -0
- package/dist/main-portal/components/mining/index.d.ts +1 -0
- package/dist/main-portal/components/mining/index.js +6 -0
- package/dist/main-portal/components/notifications/NotificationsPage.d.ts +1 -0
- package/dist/main-portal/components/notifications/NotificationsPage.js +13 -0
- package/dist/main-portal/components/organization/OrganizationPage.d.ts +1 -0
- package/dist/main-portal/components/organization/OrganizationPage.js +235 -0
- package/dist/main-portal/components/organization/connection-line.d.ts +12 -0
- package/dist/main-portal/components/organization/connection-line.js +38 -0
- package/dist/main-portal/components/organization/diagram-node.d.ts +17 -0
- package/dist/main-portal/components/organization/diagram-node.js +105 -0
- package/dist/main-portal/components/organization/system-panel.d.ts +11 -0
- package/dist/main-portal/components/organization/system-panel.js +72 -0
- package/dist/main-portal/components/profile/EmailChangeCard.d.ts +1 -0
- package/dist/main-portal/components/profile/EmailChangeCard.js +58 -0
- package/dist/main-portal/components/profile/ProfilePage.d.ts +1 -0
- package/dist/main-portal/components/profile/ProfilePage.js +263 -0
- package/dist/main-portal/components/profile/TwoFactorSettings.d.ts +1 -0
- package/dist/main-portal/components/profile/TwoFactorSettings.js +99 -0
- package/dist/main-portal/components/providers/ClientProviders.d.ts +6 -0
- package/dist/main-portal/components/providers/ClientProviders.js +17 -0
- package/dist/main-portal/components/providers/SolanaWalletProvider.d.ts +7 -0
- package/dist/main-portal/components/providers/SolanaWalletProvider.js +17 -0
- package/dist/main-portal/components/providers/theme-provider.d.ts +5 -0
- package/dist/main-portal/components/providers/theme-provider.js +10 -0
- package/dist/main-portal/components/queue/QueueStatusPage.d.ts +1 -0
- package/dist/main-portal/components/queue/QueueStatusPage.js +245 -0
- package/dist/main-portal/components/reincarnation/ReincarnationPage.d.ts +1 -0
- package/dist/main-portal/components/reincarnation/ReincarnationPage.js +87 -0
- package/dist/main-portal/components/resources/mcc-stats-section.d.ts +1 -0
- package/dist/main-portal/components/resources/mcc-stats-section.js +199 -0
- package/dist/main-portal/components/resources/mcd-stats-section.d.ts +1 -0
- package/dist/main-portal/components/resources/mcd-stats-section.js +76 -0
- package/dist/main-portal/components/resources/minting-entry-section.d.ts +1 -0
- package/dist/main-portal/components/resources/minting-entry-section.js +70 -0
- package/dist/main-portal/components/resources/public-mining-modal.d.ts +7 -0
- package/dist/main-portal/components/resources/public-mining-modal.js +239 -0
- package/dist/main-portal/components/resources/recycle-pool-section.d.ts +1 -0
- package/dist/main-portal/components/resources/recycle-pool-section.js +82 -0
- package/dist/main-portal/components/resources/registration-prompt.d.ts +8 -0
- package/dist/main-portal/components/resources/registration-prompt.js +13 -0
- package/dist/main-portal/components/rewards/RewardsPage.d.ts +1 -0
- package/dist/main-portal/components/rewards/RewardsPage.js +149 -0
- package/dist/main-portal/components/security/domain-verification-bar.d.ts +1 -0
- package/dist/main-portal/components/security/domain-verification-bar.js +32 -0
- package/dist/main-portal/components/stations/StationDetailPage.d.ts +5 -0
- package/dist/main-portal/components/stations/StationDetailPage.js +232 -0
- package/dist/main-portal/components/stations/StationIncomeChart.d.ts +11 -0
- package/dist/main-portal/components/stations/StationIncomeChart.js +57 -0
- package/dist/main-portal/components/stations/StationKPIHistory.d.ts +1 -0
- package/dist/main-portal/components/stations/StationKPIHistory.js +7 -0
- package/dist/main-portal/components/stations/StationListPage.d.ts +1 -0
- package/dist/main-portal/components/stations/StationListPage.js +341 -0
- package/dist/main-portal/components/stations/StationMemberRanking.d.ts +13 -0
- package/dist/main-portal/components/stations/StationMemberRanking.js +64 -0
- package/dist/main-portal/components/stations/StationSummaryCards.d.ts +13 -0
- package/dist/main-portal/components/stations/StationSummaryCards.js +30 -0
- package/dist/main-portal/components/stations/StationsPage.d.ts +1 -0
- package/dist/main-portal/components/stations/StationsPage.js +239 -0
- package/dist/main-portal/components/territory/TerritoryNFTBrowser.d.ts +1 -0
- package/dist/main-portal/components/territory/TerritoryNFTBrowser.js +147 -0
- package/dist/main-portal/components/ui/accordion.d.ts +7 -0
- package/dist/main-portal/components/ui/accordion.js +57 -0
- package/dist/main-portal/components/ui/alert-dialog.d.ts +14 -0
- package/dist/main-portal/components/ui/alert-dialog.js +85 -0
- package/dist/main-portal/components/ui/alert.d.ts +9 -0
- package/dist/main-portal/components/ui/alert.js +28 -0
- package/dist/main-portal/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/main-portal/components/ui/aspect-ratio.js +43 -0
- package/dist/main-portal/components/ui/avatar.d.ts +6 -0
- package/dist/main-portal/components/ui/avatar.js +52 -0
- package/dist/main-portal/components/ui/badge.d.ts +9 -0
- package/dist/main-portal/components/ui/badge.js +26 -0
- package/dist/main-portal/components/ui/breadcrumb.d.ts +11 -0
- package/dist/main-portal/components/ui/breadcrumb.js +35 -0
- package/dist/main-portal/components/ui/button-group.d.ts +11 -0
- package/dist/main-portal/components/ui/button-group.js +34 -0
- package/dist/main-portal/components/ui/button.d.ts +10 -0
- package/dist/main-portal/components/ui/button.js +35 -0
- package/dist/main-portal/components/ui/calendar.d.ts +8 -0
- package/dist/main-portal/components/ui/calendar.js +111 -0
- package/dist/main-portal/components/ui/card.d.ts +17 -0
- package/dist/main-portal/components/ui/card.js +41 -0
- package/dist/main-portal/components/ui/carousel.d.ts +19 -0
- package/dist/main-portal/components/ui/carousel.js +134 -0
- package/dist/main-portal/components/ui/chart.d.ts +40 -0
- package/dist/main-portal/components/ui/chart.js +168 -0
- package/dist/main-portal/components/ui/checkbox.d.ts +4 -0
- package/dist/main-portal/components/ui/checkbox.js +45 -0
- package/dist/main-portal/components/ui/collapsible.d.ts +5 -0
- package/dist/main-portal/components/ui/collapsible.js +51 -0
- package/dist/main-portal/components/ui/command.d.ts +18 -0
- package/dist/main-portal/components/ui/command.js +45 -0
- package/dist/main-portal/components/ui/context-menu.d.ts +25 -0
- package/dist/main-portal/components/ui/context-menu.js +101 -0
- package/dist/main-portal/components/ui/dialog.d.ts +15 -0
- package/dist/main-portal/components/ui/dialog.js +81 -0
- package/dist/main-portal/components/ui/drawer.d.ts +13 -0
- package/dist/main-portal/components/ui/drawer.js +47 -0
- package/dist/main-portal/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/main-portal/components/ui/dropdown-menu.js +101 -0
- package/dist/main-portal/components/ui/empty.d.ts +11 -0
- package/dist/main-portal/components/ui/empty.js +41 -0
- package/dist/main-portal/components/ui/field.d.ts +24 -0
- package/dist/main-portal/components/ui/field.js +85 -0
- package/dist/main-portal/components/ui/form.d.ts +24 -0
- package/dist/main-portal/components/ui/form.js +103 -0
- package/dist/main-portal/components/ui/hover-avatar.d.ts +10 -0
- package/dist/main-portal/components/ui/hover-avatar.js +70 -0
- package/dist/main-portal/components/ui/hover-card.d.ts +6 -0
- package/dist/main-portal/components/ui/hover-card.js +52 -0
- package/dist/main-portal/components/ui/input-group.d.ts +15 -0
- package/dist/main-portal/components/ui/input-group.js +65 -0
- package/dist/main-portal/components/ui/input-otp.d.ts +11 -0
- package/dist/main-portal/components/ui/input-otp.js +60 -0
- package/dist/main-portal/components/ui/input.d.ts +3 -0
- package/dist/main-portal/components/ui/input.js +8 -0
- package/dist/main-portal/components/ui/item.d.ts +23 -0
- package/dist/main-portal/components/ui/item.js +77 -0
- package/dist/main-portal/components/ui/kbd.d.ts +3 -0
- package/dist/main-portal/components/ui/kbd.js +13 -0
- package/dist/main-portal/components/ui/label.d.ts +4 -0
- package/dist/main-portal/components/ui/label.js +44 -0
- package/dist/main-portal/components/ui/menubar.d.ts +26 -0
- package/dist/main-portal/components/ui/menubar.js +105 -0
- package/dist/main-portal/components/ui/navigation-menu.d.ts +14 -0
- package/dist/main-portal/components/ui/navigation-menu.js +75 -0
- package/dist/main-portal/components/ui/pagination.d.ts +13 -0
- package/dist/main-portal/components/ui/pagination.js +37 -0
- package/dist/main-portal/components/ui/popover.d.ts +7 -0
- package/dist/main-portal/components/ui/popover.js +56 -0
- package/dist/main-portal/components/ui/progress.d.ts +4 -0
- package/dist/main-portal/components/ui/progress.js +44 -0
- package/dist/main-portal/components/ui/radio-group.d.ts +5 -0
- package/dist/main-portal/components/ui/radio-group.js +49 -0
- package/dist/main-portal/components/ui/resizable.d.ts +8 -0
- package/dist/main-portal/components/ui/resizable.js +53 -0
- package/dist/main-portal/components/ui/scroll-area.d.ts +5 -0
- package/dist/main-portal/components/ui/scroll-area.js +50 -0
- package/dist/main-portal/components/ui/select.d.ts +15 -0
- package/dist/main-portal/components/ui/select.js +83 -0
- package/dist/main-portal/components/ui/separator.d.ts +4 -0
- package/dist/main-portal/components/ui/separator.js +44 -0
- package/dist/main-portal/components/ui/sheet.d.ts +13 -0
- package/dist/main-portal/components/ui/sheet.js +83 -0
- package/dist/main-portal/components/ui/sidebar.d.ts +69 -0
- package/dist/main-portal/components/ui/sidebar.js +258 -0
- package/dist/main-portal/components/ui/skeleton.d.ts +2 -0
- package/dist/main-portal/components/ui/skeleton.js +9 -0
- package/dist/main-portal/components/ui/slider.d.ts +4 -0
- package/dist/main-portal/components/ui/slider.js +50 -0
- package/dist/main-portal/components/ui/sonner.d.ts +3 -0
- package/dist/main-portal/components/ui/sonner.js +17 -0
- package/dist/main-portal/components/ui/spinner.d.ts +2 -0
- package/dist/main-portal/components/ui/spinner.js +10 -0
- package/dist/main-portal/components/ui/switch.d.ts +4 -0
- package/dist/main-portal/components/ui/switch.js +44 -0
- package/dist/main-portal/components/ui/table.d.ts +10 -0
- package/dist/main-portal/components/ui/table.js +38 -0
- package/dist/main-portal/components/ui/tabs.d.ts +7 -0
- package/dist/main-portal/components/ui/tabs.js +53 -0
- package/dist/main-portal/components/ui/terminal.d.ts +49 -0
- package/dist/main-portal/components/ui/terminal.js +56 -0
- package/dist/main-portal/components/ui/textarea.d.ts +3 -0
- package/dist/main-portal/components/ui/textarea.js +8 -0
- package/dist/main-portal/components/ui/time-remaining.d.ts +54 -0
- package/dist/main-portal/components/ui/time-remaining.js +223 -0
- package/dist/main-portal/components/ui/toast.d.ts +15 -0
- package/dist/main-portal/components/ui/toast.js +77 -0
- package/dist/main-portal/components/ui/toaster.d.ts +1 -0
- package/dist/main-portal/components/ui/toaster.js +14 -0
- package/dist/main-portal/components/ui/toggle-group.d.ts +7 -0
- package/dist/main-portal/components/ui/toggle-group.js +58 -0
- package/dist/main-portal/components/ui/toggle.d.ts +9 -0
- package/dist/main-portal/components/ui/toggle.js +64 -0
- package/dist/main-portal/components/ui/tooltip.d.ts +7 -0
- package/dist/main-portal/components/ui/tooltip.js +56 -0
- package/dist/main-portal/components/ui/use-mobile.d.ts +1 -0
- package/dist/main-portal/components/ui/use-mobile.js +53 -0
- package/dist/main-portal/components/voting/VotingPage.d.ts +1 -0
- package/dist/main-portal/components/voting/VotingPage.js +14 -0
- package/dist/main-portal/components/wallet/MCCHistory.d.ts +9 -0
- package/dist/main-portal/components/wallet/MCCHistory.js +100 -0
- package/dist/main-portal/components/wallet/WalletManagement.d.ts +5 -0
- package/dist/main-portal/components/wallet/WalletManagement.js +144 -0
- package/dist/main-portal/components/wallet/WalletPage.d.ts +1 -0
- package/dist/main-portal/components/wallet/WalletPage.js +130 -0
- package/dist/main-portal/config/menu-config.d.ts +22 -0
- package/dist/main-portal/config/menu-config.js +167 -0
- package/dist/main-portal/contexts/MCCPriceContext.d.ts +38 -0
- package/dist/main-portal/contexts/MCCPriceContext.js +70 -0
- package/dist/main-portal/contexts/WalletContext.d.ts +48 -0
- package/dist/main-portal/contexts/WalletContext.js +94 -0
- package/dist/main-portal/hooks/index.d.ts +4 -0
- package/dist/main-portal/hooks/index.js +11 -0
- package/dist/main-portal/hooks/use-breakpoint.d.ts +45 -0
- package/dist/main-portal/hooks/use-breakpoint.js +91 -0
- package/dist/main-portal/hooks/use-mobile.d.ts +1 -0
- package/dist/main-portal/hooks/use-mobile.js +55 -0
- package/dist/main-portal/hooks/use-toast.d.ts +44 -0
- package/dist/main-portal/hooks/use-toast.js +164 -0
- package/dist/main-portal/hooks/useAuth.d.ts +30 -0
- package/dist/main-portal/hooks/useAuth.js +136 -0
- package/dist/main-portal/hooks/useMCC.d.ts +26 -0
- package/dist/main-portal/hooks/useMCC.js +148 -0
- package/dist/main-portal/hooks/useMCD.d.ts +17 -0
- package/dist/main-portal/hooks/useMCD.js +114 -0
- package/dist/main-portal/hooks/useMultiWalletBalance.d.ts +31 -0
- package/dist/main-portal/hooks/useMultiWalletBalance.js +65 -0
- package/dist/main-portal/hooks/useSolanaBalance.d.ts +21 -0
- package/dist/main-portal/hooks/useSolanaBalance.js +58 -0
- package/dist/main-portal/hooks/useSpeechRecognition.d.ts +6 -0
- package/dist/main-portal/hooks/useSpeechRecognition.js +82 -0
- package/dist/main-portal/hooks/useStats.d.ts +131 -0
- package/dist/main-portal/hooks/useStats.js +161 -0
- package/dist/main-portal/hooks/useStrategies.d.ts +134 -0
- package/dist/main-portal/hooks/useStrategies.js +28 -0
- package/dist/main-portal/hooks/useUserRank.d.ts +16 -0
- package/dist/main-portal/hooks/useUserRank.js +61 -0
- package/dist/main-portal/hooks/useWalletTokenBalances.d.ts +29 -0
- package/dist/main-portal/hooks/useWalletTokenBalances.js +106 -0
- package/dist/main-portal/i18n/navigation.d.ts +341 -0
- package/dist/main-portal/i18n/navigation.js +7 -0
- package/dist/main-portal/i18n/request.d.ts +2 -0
- package/dist/main-portal/i18n/request.js +47 -0
- package/dist/main-portal/i18n/routing.d.ts +18 -0
- package/dist/main-portal/i18n/routing.js +10 -0
- package/dist/main-portal/lib/ai-chat-config.d.ts +8 -0
- package/dist/main-portal/lib/ai-chat-config.js +144 -0
- package/dist/main-portal/lib/api/blockchain.d.ts +178 -0
- package/dist/main-portal/lib/api/blockchain.js +302 -0
- package/dist/main-portal/lib/api/core.d.ts +3 -0
- package/dist/main-portal/lib/api/core.js +47 -0
- package/dist/main-portal/lib/api/index.d.ts +9 -0
- package/dist/main-portal/lib/api/index.js +37 -0
- package/dist/main-portal/lib/api/services/ai.d.ts +139 -0
- package/dist/main-portal/lib/api/services/ai.js +214 -0
- package/dist/main-portal/lib/api/services/finance.d.ts +37 -0
- package/dist/main-portal/lib/api/services/finance.js +144 -0
- package/dist/main-portal/lib/api/services/index.d.ts +5 -0
- package/dist/main-portal/lib/api/services/index.js +21 -0
- package/dist/main-portal/lib/api/services/mining.d.ts +68 -0
- package/dist/main-portal/lib/api/services/mining.js +76 -0
- package/dist/main-portal/lib/api/services/organization.d.ts +161 -0
- package/dist/main-portal/lib/api/services/organization.js +139 -0
- package/dist/main-portal/lib/api/services/user.d.ts +90 -0
- package/dist/main-portal/lib/api/services/user.js +78 -0
- package/dist/main-portal/lib/api/services.d.ts +1 -0
- package/dist/main-portal/lib/api/services.js +17 -0
- package/dist/main-portal/lib/api-service.d.ts +1 -0
- package/dist/main-portal/lib/api-service.js +18 -0
- package/dist/main-portal/lib/auth-service.d.ts +65 -0
- package/dist/main-portal/lib/auth-service.js +382 -0
- package/dist/main-portal/lib/config/mainstream-tokens.d.ts +13 -0
- package/dist/main-portal/lib/config/mainstream-tokens.js +88 -0
- package/dist/main-portal/lib/docs-data.d.ts +36 -0
- package/dist/main-portal/lib/docs-data.js +108 -0
- package/dist/main-portal/lib/oauth-config.d.ts +12 -0
- package/dist/main-portal/lib/oauth-config.js +48 -0
- package/dist/main-portal/lib/order-id-generator.d.ts +19 -0
- package/dist/main-portal/lib/order-id-generator.js +97 -0
- package/dist/main-portal/lib/solana/reincarnation-client.d.ts +28 -0
- package/dist/main-portal/lib/solana/reincarnation-client.js +39 -0
- package/dist/main-portal/lib/solana/solana-pay.d.ts +31 -0
- package/dist/main-portal/lib/solana/solana-pay.js +85 -0
- package/dist/main-portal/lib/strategy/defaults.d.ts +2 -0
- package/dist/main-portal/lib/strategy/defaults.js +58 -0
- package/dist/main-portal/lib/strategy/index.d.ts +3 -0
- package/dist/main-portal/lib/strategy/index.js +20 -0
- package/dist/main-portal/lib/strategy/tooltips.d.ts +1 -0
- package/dist/main-portal/lib/strategy/tooltips.js +50 -0
- package/dist/main-portal/lib/strategy/types.d.ts +74 -0
- package/dist/main-portal/lib/strategy/types.js +2 -0
- package/dist/main-portal/lib/types/ai.types.d.ts +111 -0
- package/dist/main-portal/lib/types/ai.types.js +2 -0
- package/dist/main-portal/lib/types/api.d.ts +5 -0
- package/dist/main-portal/lib/types/api.js +21 -0
- package/dist/main-portal/lib/types/common.types.d.ts +168 -0
- package/dist/main-portal/lib/types/common.types.js +24 -0
- package/dist/main-portal/lib/types/finance.types.d.ts +267 -0
- package/dist/main-portal/lib/types/finance.types.js +2 -0
- package/dist/main-portal/lib/types/protocol.types.d.ts +216 -0
- package/dist/main-portal/lib/types/protocol.types.js +2 -0
- package/dist/main-portal/lib/types/user.types.d.ts +243 -0
- package/dist/main-portal/lib/types/user.types.js +12 -0
- package/dist/main-portal/lib/utils/territoryId.d.ts +75 -0
- package/dist/main-portal/lib/utils/territoryId.js +241 -0
- package/dist/main-portal/lib/utils.d.ts +4 -0
- package/dist/main-portal/lib/utils.js +24 -0
- package/dist/main-portal/lib/wallet-auth/api.d.ts +13 -0
- package/dist/main-portal/lib/wallet-auth/api.js +132 -0
- package/dist/main-portal/lib/wallet-auth/types.d.ts +87 -0
- package/dist/main-portal/lib/wallet-auth/types.js +58 -0
- package/package.json +55 -5
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAiChatContext = getAiChatContext;
|
|
4
|
+
const ROUTE_RULES = [
|
|
5
|
+
{
|
|
6
|
+
prefix: '/developers/assistant',
|
|
7
|
+
ctx: {
|
|
8
|
+
roleKey: 'apex_advisor',
|
|
9
|
+
accentColor: '#22c55e',
|
|
10
|
+
questions: ['APEX 评审如何运作?', '项目评分标准是什么?', 'Forge 工程团如何构建?'],
|
|
11
|
+
placeholder: '描述你的项目想法,APEX 评审院帮你完善方案...',
|
|
12
|
+
label: 'APEX 顾问',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
prefix: '/developers',
|
|
17
|
+
ctx: {
|
|
18
|
+
roleKey: 'dev_assistant',
|
|
19
|
+
accentColor: '#22c55e',
|
|
20
|
+
questions: ['如何接入 Open API?', 'OAuth 2.0 认证流程?', 'SDK 怎么安装?'],
|
|
21
|
+
placeholder: '询问开发相关问题...',
|
|
22
|
+
label: 'APEX 顾问',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
prefix: '/docs',
|
|
27
|
+
ctx: {
|
|
28
|
+
roleKey: 'docs_helper',
|
|
29
|
+
accentColor: '#e2e8f0',
|
|
30
|
+
questions: ['技术文档入口?', 'API 参考在哪?', '快速上手指南?'],
|
|
31
|
+
placeholder: '询问文档相关问题...',
|
|
32
|
+
label: '文档助手',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
prefix: '/blockchain',
|
|
37
|
+
ctx: {
|
|
38
|
+
roleKey: 'blockchain_expert',
|
|
39
|
+
accentColor: '#5EEAD4',
|
|
40
|
+
questions: ['链上数据如何查询?', '合约状态如何查看?', 'MCC 合约地址是什么?'],
|
|
41
|
+
placeholder: '询问区块链相关问题...',
|
|
42
|
+
label: '链上专家',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
prefix: '/data',
|
|
47
|
+
ctx: {
|
|
48
|
+
roleKey: 'data_analyst',
|
|
49
|
+
accentColor: '#5EEAD4',
|
|
50
|
+
questions: ['持币人分布?', '挖矿趋势如何?', '流动性深度?'],
|
|
51
|
+
placeholder: '询问数据分析相关问题...',
|
|
52
|
+
label: '数据分析',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
prefix: '/resources/mining',
|
|
57
|
+
ctx: {
|
|
58
|
+
roleKey: 'mining_advisor',
|
|
59
|
+
accentColor: '#f59e0b',
|
|
60
|
+
questions: ['挖矿价格如何计算?', '伴生矿是什么?', '减半机制是什么?'],
|
|
61
|
+
placeholder: '询问挖矿相关问题...',
|
|
62
|
+
label: '挖矿顾问',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
prefix: '/mine',
|
|
67
|
+
ctx: {
|
|
68
|
+
roleKey: 'mining_advisor',
|
|
69
|
+
accentColor: '#f59e0b',
|
|
70
|
+
questions: ['如何开始挖矿?', '支持哪些钱包?', '挖矿收益如何计算?'],
|
|
71
|
+
placeholder: '询问挖矿相关问题...',
|
|
72
|
+
label: '挖矿顾问',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
prefix: '/resources',
|
|
77
|
+
ctx: {
|
|
78
|
+
roleKey: 'resource_guide',
|
|
79
|
+
accentColor: '#f59e0b',
|
|
80
|
+
questions: ['MCC 代币总量是多少?', '领地系统怎么运作?', '如何参与拍卖?'],
|
|
81
|
+
placeholder: '询问资源相关问题...',
|
|
82
|
+
label: '资源向导',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
prefix: '/market',
|
|
87
|
+
ctx: {
|
|
88
|
+
roleKey: 'market_guide',
|
|
89
|
+
accentColor: '#FF6B00',
|
|
90
|
+
questions: ['MCC 当前价格?', '如何购买 MCC?', '流动性池状态?'],
|
|
91
|
+
placeholder: '询问市场相关问题...',
|
|
92
|
+
label: '市场向导',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
prefix: '/community',
|
|
97
|
+
ctx: {
|
|
98
|
+
roleKey: 'community_guide',
|
|
99
|
+
accentColor: '#5EEAD4',
|
|
100
|
+
questions: ['如何加入社区?', '治理机制是什么?', '如何参与生态?'],
|
|
101
|
+
placeholder: '询问社区相关问题...',
|
|
102
|
+
label: '社区向导',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
prefix: '/mainnet',
|
|
107
|
+
ctx: {
|
|
108
|
+
roleKey: 'mainnet_guide',
|
|
109
|
+
accentColor: '#22D3EE',
|
|
110
|
+
questions: ['合约部署状态?', '如何验证交易?', '主网地址在哪?'],
|
|
111
|
+
placeholder: '询问主网相关问题...',
|
|
112
|
+
label: '主网向导',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
prefix: '/game',
|
|
117
|
+
ctx: {
|
|
118
|
+
roleKey: 'game_guide',
|
|
119
|
+
accentColor: '#a855f7',
|
|
120
|
+
questions: ['Crash 玩法规则?', 'HODL 对赌怎么玩?', '退场罚没如何分配?'],
|
|
121
|
+
placeholder: '询问游戏相关问题...',
|
|
122
|
+
label: '游戏向导',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
const DEFAULT_CONTEXT = {
|
|
127
|
+
roleKey: 'home_guide',
|
|
128
|
+
accentColor: '#22c55e',
|
|
129
|
+
questions: ['Microcosm 是什么?', 'MCC 代币介绍', '如何加入生态?'],
|
|
130
|
+
placeholder: '有什么想了解的?',
|
|
131
|
+
label: 'AI 助手',
|
|
132
|
+
};
|
|
133
|
+
function stripLocalePrefix(pathname) {
|
|
134
|
+
return pathname.replace(/^\/[a-z]{2}(?:\/|$)/, '/') || '/';
|
|
135
|
+
}
|
|
136
|
+
function getAiChatContext(pathname) {
|
|
137
|
+
const cleanPath = stripLocalePrefix(pathname);
|
|
138
|
+
for (const rule of ROUTE_RULES) {
|
|
139
|
+
if (cleanPath.startsWith(rule.prefix)) {
|
|
140
|
+
return rule.ctx;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return DEFAULT_CONTEXT;
|
|
144
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export interface TokenBalance {
|
|
2
|
+
symbol: string;
|
|
3
|
+
mint: string;
|
|
4
|
+
balance: number;
|
|
5
|
+
raw_balance: number;
|
|
6
|
+
decimals: number;
|
|
7
|
+
usd_value: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WalletBalance {
|
|
10
|
+
wallet: string;
|
|
11
|
+
sol: TokenBalance;
|
|
12
|
+
tokens: TokenBalance[];
|
|
13
|
+
total_usd_value: number;
|
|
14
|
+
cached_at: string;
|
|
15
|
+
from_cache: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface PoolStatus {
|
|
18
|
+
pool_address: string;
|
|
19
|
+
usdc_vault: string;
|
|
20
|
+
usdc_balance: number;
|
|
21
|
+
usdt_vault: string;
|
|
22
|
+
usdt_balance: number;
|
|
23
|
+
total_mcc_bought: number;
|
|
24
|
+
total_market_made: number;
|
|
25
|
+
status: 'active' | 'empty' | 'paused';
|
|
26
|
+
updated_at: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function getMccPrice(): Promise<number | null>;
|
|
29
|
+
export declare function getWalletBalance(walletAddress: string, forceRefresh?: boolean): Promise<WalletBalance | null>;
|
|
30
|
+
export declare function getMCCBalance(walletAddress: string, forceRefresh?: boolean): Promise<TokenBalance | null>;
|
|
31
|
+
export declare function refreshWalletBalance(walletAddress: string): Promise<WalletBalance | null>;
|
|
32
|
+
export declare function invalidateWalletCache(walletAddress: string, txType?: string): Promise<boolean>;
|
|
33
|
+
export declare function getPoolStatus(forceRefresh?: boolean): Promise<PoolStatus | null>;
|
|
34
|
+
export declare function getTokenFromBalance(balance: WalletBalance | null, symbol: string): TokenBalance | null;
|
|
35
|
+
export declare function formatTokenBalance(balance: number, decimals?: number): string;
|
|
36
|
+
export interface McdAccountStatus {
|
|
37
|
+
uid: string;
|
|
38
|
+
has_account: boolean;
|
|
39
|
+
is_miner: boolean;
|
|
40
|
+
territory_id: string | null;
|
|
41
|
+
can_receive_mcd: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface McdAccountResult {
|
|
44
|
+
uid: string;
|
|
45
|
+
territory_id: string;
|
|
46
|
+
status: 'created' | 'exists';
|
|
47
|
+
tx_signature?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function getMcdAccountStatus(uid: string): Promise<McdAccountStatus | null>;
|
|
50
|
+
export declare function ensureUserMcdAccount(uid: string): Promise<McdAccountResult>;
|
|
51
|
+
export declare function batchGetMcdAccountStatus(uids: string[]): Promise<Record<string, McdAccountStatus>>;
|
|
52
|
+
export interface ZombieAccount {
|
|
53
|
+
uid: string;
|
|
54
|
+
email: string;
|
|
55
|
+
display_name: string | null;
|
|
56
|
+
wallet_address: string | null;
|
|
57
|
+
mcd_balance: number;
|
|
58
|
+
inactive_days: number;
|
|
59
|
+
last_login_at: string | null;
|
|
60
|
+
account_created_at: string | null;
|
|
61
|
+
}
|
|
62
|
+
export interface ZombieAccountsResult {
|
|
63
|
+
accounts: ZombieAccount[];
|
|
64
|
+
total: number;
|
|
65
|
+
summary: {
|
|
66
|
+
total_zombie_accounts: number;
|
|
67
|
+
estimated_rent_recovery: number;
|
|
68
|
+
min_inactive_days: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface ClosureResult {
|
|
72
|
+
uid: string;
|
|
73
|
+
rent_recovered: number;
|
|
74
|
+
tx_signature: string | null;
|
|
75
|
+
closure_id: number;
|
|
76
|
+
}
|
|
77
|
+
export interface BatchClosureResult {
|
|
78
|
+
closed_count: number;
|
|
79
|
+
failed_count: number;
|
|
80
|
+
total_rent_recovered: number;
|
|
81
|
+
results: Array<{
|
|
82
|
+
uid: string;
|
|
83
|
+
success: boolean;
|
|
84
|
+
error?: string;
|
|
85
|
+
rent_recovered: number;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
export interface RentStatistics {
|
|
89
|
+
summary: {
|
|
90
|
+
total_accounts: number;
|
|
91
|
+
zombie_accounts: number;
|
|
92
|
+
cumulative_closures: number;
|
|
93
|
+
cumulative_rent_recovered: number;
|
|
94
|
+
};
|
|
95
|
+
daily_stats: Array<{
|
|
96
|
+
date: string;
|
|
97
|
+
closed_count: number;
|
|
98
|
+
rent_recovered: number;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
export interface ClosureHistory {
|
|
102
|
+
closures: Array<{
|
|
103
|
+
id: number;
|
|
104
|
+
uid: string;
|
|
105
|
+
user_mcd_pda: string;
|
|
106
|
+
rent_recovered: number;
|
|
107
|
+
tx_signature: string | null;
|
|
108
|
+
closed_by: string;
|
|
109
|
+
reason: string;
|
|
110
|
+
user_email: string | null;
|
|
111
|
+
last_active_at: string | null;
|
|
112
|
+
closed_at: string;
|
|
113
|
+
}>;
|
|
114
|
+
total: number;
|
|
115
|
+
}
|
|
116
|
+
export declare function getZombieAccounts(options?: {
|
|
117
|
+
limit?: number;
|
|
118
|
+
offset?: number;
|
|
119
|
+
min_inactive_days?: number;
|
|
120
|
+
}): Promise<ZombieAccountsResult>;
|
|
121
|
+
export declare function closeMcdAccount(uid: string, reason?: 'zombie' | 'user_request' | 'admin'): Promise<ClosureResult>;
|
|
122
|
+
export declare function batchCloseMcdAccounts(uids: string[], reason?: 'zombie' | 'admin'): Promise<BatchClosureResult>;
|
|
123
|
+
export declare function getRentStatistics(startDate?: string, endDate?: string): Promise<RentStatistics>;
|
|
124
|
+
export declare function getClosureHistory(options?: {
|
|
125
|
+
limit?: number;
|
|
126
|
+
offset?: number;
|
|
127
|
+
reason?: string;
|
|
128
|
+
}): Promise<ClosureHistory>;
|
|
129
|
+
export interface SystemAddress {
|
|
130
|
+
id: number;
|
|
131
|
+
category: string;
|
|
132
|
+
subcategory?: string;
|
|
133
|
+
name: string;
|
|
134
|
+
address: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
status: string;
|
|
137
|
+
address_type?: string;
|
|
138
|
+
parent_address?: string;
|
|
139
|
+
metadata?: Record<string, unknown>;
|
|
140
|
+
created_at: string;
|
|
141
|
+
updated_at: string;
|
|
142
|
+
archived_at?: string;
|
|
143
|
+
archived_reason?: string;
|
|
144
|
+
}
|
|
145
|
+
export interface SystemAddressStats {
|
|
146
|
+
total: number;
|
|
147
|
+
categories: number;
|
|
148
|
+
by_category: Record<string, number>;
|
|
149
|
+
by_status: Record<string, number>;
|
|
150
|
+
}
|
|
151
|
+
export declare function getSystemAddresses(options?: {
|
|
152
|
+
category?: string;
|
|
153
|
+
status?: string;
|
|
154
|
+
search?: string;
|
|
155
|
+
limit?: number;
|
|
156
|
+
offset?: number;
|
|
157
|
+
}): Promise<{
|
|
158
|
+
addresses: SystemAddress[];
|
|
159
|
+
total: number;
|
|
160
|
+
}>;
|
|
161
|
+
export declare function getSystemAddressStats(): Promise<SystemAddressStats>;
|
|
162
|
+
export declare function updateSystemAddress(id: number, data: {
|
|
163
|
+
description?: string;
|
|
164
|
+
status?: string;
|
|
165
|
+
archived_reason?: string;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
success: boolean;
|
|
168
|
+
id?: number;
|
|
169
|
+
name?: string;
|
|
170
|
+
status?: string;
|
|
171
|
+
error?: string;
|
|
172
|
+
}>;
|
|
173
|
+
export declare function seedSystemAddresses(): Promise<{
|
|
174
|
+
success: boolean;
|
|
175
|
+
inserted: number;
|
|
176
|
+
updated: number;
|
|
177
|
+
total: number;
|
|
178
|
+
}>;
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMccPrice = getMccPrice;
|
|
4
|
+
exports.getWalletBalance = getWalletBalance;
|
|
5
|
+
exports.getMCCBalance = getMCCBalance;
|
|
6
|
+
exports.refreshWalletBalance = refreshWalletBalance;
|
|
7
|
+
exports.invalidateWalletCache = invalidateWalletCache;
|
|
8
|
+
exports.getPoolStatus = getPoolStatus;
|
|
9
|
+
exports.getTokenFromBalance = getTokenFromBalance;
|
|
10
|
+
exports.formatTokenBalance = formatTokenBalance;
|
|
11
|
+
exports.getMcdAccountStatus = getMcdAccountStatus;
|
|
12
|
+
exports.ensureUserMcdAccount = ensureUserMcdAccount;
|
|
13
|
+
exports.batchGetMcdAccountStatus = batchGetMcdAccountStatus;
|
|
14
|
+
exports.getZombieAccounts = getZombieAccounts;
|
|
15
|
+
exports.closeMcdAccount = closeMcdAccount;
|
|
16
|
+
exports.batchCloseMcdAccounts = batchCloseMcdAccounts;
|
|
17
|
+
exports.getRentStatistics = getRentStatistics;
|
|
18
|
+
exports.getClosureHistory = getClosureHistory;
|
|
19
|
+
exports.getSystemAddresses = getSystemAddresses;
|
|
20
|
+
exports.getSystemAddressStats = getSystemAddressStats;
|
|
21
|
+
exports.updateSystemAddress = updateSystemAddress;
|
|
22
|
+
exports.seedSystemAddresses = seedSystemAddresses;
|
|
23
|
+
// AI-generated · AI-managed · AI-maintained
|
|
24
|
+
const core_1 = require("./core");
|
|
25
|
+
async function getMccPrice() {
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetch('/api/blockchain-service/mining/ratio');
|
|
28
|
+
const data = await response.json();
|
|
29
|
+
if (data.success && data.data?.usdc_per_mcc) {
|
|
30
|
+
return data.data.usdc_per_mcc;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function getWalletBalance(walletAddress, forceRefresh = false) {
|
|
39
|
+
try {
|
|
40
|
+
const queryParams = forceRefresh ? '?force=true' : '';
|
|
41
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/balance/wallet/${walletAddress}${queryParams}`, { method: 'GET' }, true);
|
|
42
|
+
if (response.success && response.data) {
|
|
43
|
+
return response.data;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error('[Blockchain API] 获取钱包余额失败:', error);
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function getMCCBalance(walletAddress, forceRefresh = false) {
|
|
53
|
+
try {
|
|
54
|
+
const queryParams = forceRefresh ? '?force=true' : '';
|
|
55
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/balance/wallet/${walletAddress}/mcc${queryParams}`, { method: 'GET' }, true);
|
|
56
|
+
if (response.success && response.data) {
|
|
57
|
+
return response.data;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error('[Blockchain API] 获取 MCC 余额失败:', error);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function refreshWalletBalance(walletAddress) {
|
|
67
|
+
try {
|
|
68
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/balance/wallet/${walletAddress}/refresh`, { method: 'POST' });
|
|
69
|
+
if (response.success && response.data) {
|
|
70
|
+
return response.data;
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('[Blockchain API] 刷新钱包余额失败:', error);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function invalidateWalletCache(walletAddress, txType) {
|
|
80
|
+
try {
|
|
81
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/balance/invalidate/${walletAddress}`, {
|
|
82
|
+
method: 'POST',
|
|
83
|
+
body: JSON.stringify({ tx_type: txType })
|
|
84
|
+
});
|
|
85
|
+
return response.success === true;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error('[Blockchain API] 失效缓存失败:', error);
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function getPoolStatus(forceRefresh = false) {
|
|
93
|
+
try {
|
|
94
|
+
const queryParams = forceRefresh ? '?force=true' : '';
|
|
95
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/balance/pool/reincarnation${queryParams}`, { method: 'GET' }, true);
|
|
96
|
+
if (response.success && response.data) {
|
|
97
|
+
return response.data;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error('[Blockchain API] 获取轮回池状态失败:', error);
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function getTokenFromBalance(balance, symbol) {
|
|
107
|
+
if (!balance)
|
|
108
|
+
return null;
|
|
109
|
+
if (symbol.toUpperCase() === 'SOL') {
|
|
110
|
+
return balance.sol;
|
|
111
|
+
}
|
|
112
|
+
return balance.tokens.find(t => t.symbol.toUpperCase() === symbol.toUpperCase()) || null;
|
|
113
|
+
}
|
|
114
|
+
function formatTokenBalance(balance, decimals = 2) {
|
|
115
|
+
return balance.toLocaleString('en-US', {
|
|
116
|
+
minimumFractionDigits: decimals,
|
|
117
|
+
maximumFractionDigits: decimals
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async function getMcdAccountStatus(uid) {
|
|
121
|
+
try {
|
|
122
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/account-status/${uid}`, { method: 'GET' });
|
|
123
|
+
if (response.success && response.data) {
|
|
124
|
+
return response.data;
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
console.error('[Blockchain API] 获取 MCD 账户状态失败:', error);
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function ensureUserMcdAccount(uid) {
|
|
134
|
+
try {
|
|
135
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/account/ensure/${uid}`, { method: 'POST' });
|
|
136
|
+
if (response.success && response.data) {
|
|
137
|
+
return response.data;
|
|
138
|
+
}
|
|
139
|
+
throw new Error(response.error || '创建 MCD 账户失败');
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error('[Blockchain API] 创建 MCD 账户失败:', error);
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function batchGetMcdAccountStatus(uids) {
|
|
147
|
+
try {
|
|
148
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/batch-status`, {
|
|
149
|
+
method: 'POST',
|
|
150
|
+
body: JSON.stringify({ uids })
|
|
151
|
+
});
|
|
152
|
+
if (response.success && response.data) {
|
|
153
|
+
return response.data;
|
|
154
|
+
}
|
|
155
|
+
return {};
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
console.error('[Blockchain API] 批量获取 MCD 账户状态失败:', error);
|
|
159
|
+
return {};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function getZombieAccounts(options = {}) {
|
|
163
|
+
const { limit = 50, offset = 0, min_inactive_days = 180 } = options;
|
|
164
|
+
try {
|
|
165
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/zombie-accounts?limit=${limit}&offset=${offset}&inactive_days=${min_inactive_days}`, { method: 'GET' });
|
|
166
|
+
if (response.success && response.data) {
|
|
167
|
+
return response.data;
|
|
168
|
+
}
|
|
169
|
+
throw new Error(response.error || '获取僵尸账户失败');
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error('[Blockchain API] 获取僵尸账户失败:', error);
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async function closeMcdAccount(uid, reason = 'zombie') {
|
|
177
|
+
try {
|
|
178
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/close-account/${uid}`, {
|
|
179
|
+
method: 'POST',
|
|
180
|
+
body: JSON.stringify({ reason })
|
|
181
|
+
});
|
|
182
|
+
if (response.success && response.data) {
|
|
183
|
+
return response.data;
|
|
184
|
+
}
|
|
185
|
+
throw new Error(response.error || '关闭账户失败');
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
console.error('[Blockchain API] 关闭 MCD 账户失败:', error);
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async function batchCloseMcdAccounts(uids, reason = 'zombie') {
|
|
193
|
+
try {
|
|
194
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/batch-close-accounts`, {
|
|
195
|
+
method: 'POST',
|
|
196
|
+
body: JSON.stringify({ uids, reason })
|
|
197
|
+
});
|
|
198
|
+
if (response.success && response.data) {
|
|
199
|
+
return response.data;
|
|
200
|
+
}
|
|
201
|
+
throw new Error(response.error || '批量关闭账户失败');
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error('[Blockchain API] 批量关闭 MCD 账户失败:', error);
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async function getRentStatistics(startDate, endDate) {
|
|
209
|
+
try {
|
|
210
|
+
const params = new URLSearchParams();
|
|
211
|
+
if (startDate)
|
|
212
|
+
params.append('start_date', startDate);
|
|
213
|
+
if (endDate)
|
|
214
|
+
params.append('end_date', endDate);
|
|
215
|
+
const url = `/blockchain/mcd/admin/rent-statistics${params.toString() ? `?${params.toString()}` : ''}`;
|
|
216
|
+
const response = await (0, core_1.fetchApi)(url, { method: 'GET' });
|
|
217
|
+
if (response.success && response.data) {
|
|
218
|
+
return response.data;
|
|
219
|
+
}
|
|
220
|
+
throw new Error(response.error || '获取租金统计失败');
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
console.error('[Blockchain API] 获取租金统计失败:', error);
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async function getClosureHistory(options = {}) {
|
|
228
|
+
const { limit = 50, offset = 0, reason } = options;
|
|
229
|
+
try {
|
|
230
|
+
let url = `/blockchain/mcd/admin/closure-history?limit=${limit}&offset=${offset}`;
|
|
231
|
+
if (reason)
|
|
232
|
+
url += `&reason=${reason}`;
|
|
233
|
+
const response = await (0, core_1.fetchApi)(url, { method: 'GET' });
|
|
234
|
+
if (response.success && response.data) {
|
|
235
|
+
return response.data;
|
|
236
|
+
}
|
|
237
|
+
throw new Error(response.error || '获取关闭历史失败');
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error('[Blockchain API] 获取关闭历史失败:', error);
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async function getSystemAddresses(options = {}) {
|
|
245
|
+
const { category, status, search, limit = 200, offset = 0 } = options;
|
|
246
|
+
try {
|
|
247
|
+
const params = new URLSearchParams();
|
|
248
|
+
params.set('limit', String(limit));
|
|
249
|
+
params.set('offset', String(offset));
|
|
250
|
+
if (category)
|
|
251
|
+
params.set('category', category);
|
|
252
|
+
if (status)
|
|
253
|
+
params.set('status', status);
|
|
254
|
+
if (search)
|
|
255
|
+
params.set('search', search);
|
|
256
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/system-addresses/admin/list?${params.toString()}`, { method: 'GET' });
|
|
257
|
+
if (response.success && response.data) {
|
|
258
|
+
return response.data;
|
|
259
|
+
}
|
|
260
|
+
throw new Error(response.error || 'Failed to load system addresses');
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
console.error('[Blockchain API] getSystemAddresses failed:', error);
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
async function getSystemAddressStats() {
|
|
268
|
+
try {
|
|
269
|
+
const response = await (0, core_1.fetchApi)('/blockchain/system-addresses/admin/stats', { method: 'GET' });
|
|
270
|
+
if (response.success && response.data) {
|
|
271
|
+
return response.data;
|
|
272
|
+
}
|
|
273
|
+
throw new Error(response.error || 'Failed to load stats');
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
console.error('[Blockchain API] getSystemAddressStats failed:', error);
|
|
277
|
+
throw error;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async function updateSystemAddress(id, data) {
|
|
281
|
+
try {
|
|
282
|
+
const response = await (0, core_1.fetchApi)(`/blockchain/system-addresses/admin/${id}`, {
|
|
283
|
+
method: 'PUT',
|
|
284
|
+
body: JSON.stringify(data)
|
|
285
|
+
});
|
|
286
|
+
return response;
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
console.error('[Blockchain API] updateSystemAddress failed:', error);
|
|
290
|
+
throw error;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
async function seedSystemAddresses() {
|
|
294
|
+
try {
|
|
295
|
+
const response = await (0, core_1.fetchApi)('/blockchain/system-addresses/admin/seed', { method: 'POST' });
|
|
296
|
+
return response;
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
console.error('[Blockchain API] seedSystemAddresses failed:', error);
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentUserToken = exports.fetchApi = void 0;
|
|
4
|
+
// AI-generated · AI-managed · AI-maintained
|
|
5
|
+
const auth_service_1 = require("../auth-service");
|
|
6
|
+
Object.defineProperty(exports, "getCurrentUserToken", { enumerable: true, get: function () { return auth_service_1.getCurrentUserToken; } });
|
|
7
|
+
const BASE_URL = '/api';
|
|
8
|
+
const fetchApi = async (endpoint, options = {}, isPublic = false) => {
|
|
9
|
+
const headers = {
|
|
10
|
+
'Content-Type': 'application/json',
|
|
11
|
+
};
|
|
12
|
+
if (options.headers) {
|
|
13
|
+
const originalHeaders = options.headers;
|
|
14
|
+
Object.assign(headers, originalHeaders);
|
|
15
|
+
}
|
|
16
|
+
if (!isPublic) {
|
|
17
|
+
const authToken = await (0, auth_service_1.getCurrentUserToken)();
|
|
18
|
+
if (!authToken) {
|
|
19
|
+
throw new Error('用户未登录,无法发起请求。');
|
|
20
|
+
}
|
|
21
|
+
headers['Authorization'] = `Bearer ${authToken}`;
|
|
22
|
+
}
|
|
23
|
+
const config = {
|
|
24
|
+
...options,
|
|
25
|
+
headers
|
|
26
|
+
};
|
|
27
|
+
const response = await fetch(`${BASE_URL}${endpoint}`, config);
|
|
28
|
+
const safeJson = async (res) => {
|
|
29
|
+
const contentType = res.headers.get('content-type');
|
|
30
|
+
if (contentType && contentType.includes('application/json')) {
|
|
31
|
+
return res.json();
|
|
32
|
+
}
|
|
33
|
+
const text = await res.text();
|
|
34
|
+
return { error: text || `服务器返回了非 JSON 错误 (状态: ${res.status})` };
|
|
35
|
+
};
|
|
36
|
+
if (!response.ok) {
|
|
37
|
+
// 401/403: 认证失效,强制登出(不再继续处理业务错误)
|
|
38
|
+
if (response.status === 401 || response.status === 403) {
|
|
39
|
+
(0, auth_service_1.handleAuthFailure)(response.status);
|
|
40
|
+
throw new Error('认证已失效,正在跳转登录页...');
|
|
41
|
+
}
|
|
42
|
+
const errorData = await safeJson(response);
|
|
43
|
+
throw new Error(errorData.error || `服务器返回了一个错误 (状态: ${response.status})`);
|
|
44
|
+
}
|
|
45
|
+
return safeJson(response);
|
|
46
|
+
};
|
|
47
|
+
exports.fetchApi = fetchApi;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { fetchApi, getCurrentUserToken } from './core';
|
|
2
|
+
export declare const apiService: {
|
|
3
|
+
get: (endpoint: string) => Promise<any>;
|
|
4
|
+
post: (endpoint: string, data?: unknown) => Promise<any>;
|
|
5
|
+
put: (endpoint: string, data?: unknown) => Promise<any>;
|
|
6
|
+
delete: (endpoint: string) => Promise<any>;
|
|
7
|
+
};
|
|
8
|
+
export * from './services';
|
|
9
|
+
export { getMCCBalance as getOnchainMCCBalance, getPoolStatus, type PoolStatus, } from './blockchain';
|