@microcosmmoney/portal-react 3.12.7 → 3.13.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/components/mcd/mcd-page.js +3 -5
- package/dist/components/wallet/wallet-page.js +1 -1
- 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 +135 -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/useMarketData.d.ts +9 -0
- package/dist/main-portal/hooks/useMarketData.js +32 -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/usePriceHistory.d.ts +9 -0
- package/dist/main-portal/hooks/usePriceHistory.js +36 -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/analytics/hooks.d.ts +139 -0
- package/dist/main-portal/lib/analytics/hooks.js +277 -0
- package/dist/main-portal/lib/analytics/index.d.ts +2 -0
- package/dist/main-portal/lib/analytics/index.js +19 -0
- package/dist/main-portal/lib/analytics/types.d.ts +611 -0
- package/dist/main-portal/lib/analytics/types.js +2 -0
- package/dist/main-portal/lib/api/account.d.ts +39 -0
- package/dist/main-portal/lib/api/account.js +86 -0
- package/dist/main-portal/lib/api/admin.d.ts +78 -0
- package/dist/main-portal/lib/api/admin.js +195 -0
- package/dist/main-portal/lib/api/analytics.d.ts +217 -0
- package/dist/main-portal/lib/api/analytics.js +55 -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/dexscreener.d.ts +126 -0
- package/dist/main-portal/lib/api/dexscreener.js +139 -0
- package/dist/main-portal/lib/api/geckoterminal.d.ts +10 -0
- package/dist/main-portal/lib/api/geckoterminal.js +43 -0
- package/dist/main-portal/lib/api/index.d.ts +16 -0
- package/dist/main-portal/lib/api/index.js +230 -0
- package/dist/main-portal/lib/api/mcc-holders.d.ts +130 -0
- package/dist/main-portal/lib/api/mcc-holders.js +47 -0
- package/dist/main-portal/lib/api/org-service-proxy.d.ts +7 -0
- package/dist/main-portal/lib/api/org-service-proxy.js +55 -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/strategies.d.ts +101 -0
- package/dist/main-portal/lib/api/strategies.js +87 -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/exchanges/config.d.ts +34 -0
- package/dist/main-portal/lib/exchanges/config.js +185 -0
- package/dist/main-portal/lib/exchanges/hooks/index.d.ts +5 -0
- package/dist/main-portal/lib/exchanges/hooks/index.js +10 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceData.d.ts +15 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceData.js +216 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceDialogs.d.ts +32 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceDialogs.js +395 -0
- package/dist/main-portal/lib/exchanges/hooks/useUserExchanges.d.ts +15 -0
- package/dist/main-portal/lib/exchanges/hooks/useUserExchanges.js +51 -0
- package/dist/main-portal/lib/exchanges/index.d.ts +4 -0
- package/dist/main-portal/lib/exchanges/index.js +21 -0
- package/dist/main-portal/lib/exchanges/types.d.ts +102 -0
- package/dist/main-portal/lib/exchanges/types.js +2 -0
- package/dist/main-portal/lib/exchanges/utils.d.ts +1 -0
- package/dist/main-portal/lib/exchanges/utils.js +10 -0
- package/dist/main-portal/lib/gcp-secrets.d.ts +7 -0
- package/dist/main-portal/lib/gcp-secrets.js +45 -0
- package/dist/main-portal/lib/mockWallet.d.ts +130 -0
- package/dist/main-portal/lib/mockWallet.js +284 -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,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.useUserExchanges = useUserExchanges;
|
|
9
|
+
const swr_1 = __importDefault(require("swr"));
|
|
10
|
+
const core_1 = require("../../api/core");
|
|
11
|
+
function transformResponse(response) {
|
|
12
|
+
if (!response.success || !response.data?.exchanges) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
const boundExchanges = [];
|
|
16
|
+
for (const [exchangeId, exchangeData] of Object.entries(response.data.exchanges)) {
|
|
17
|
+
const hasActiveAccount = Object.values(exchangeData.accounts || {}).some(account => account.status === 'active');
|
|
18
|
+
if (hasActiveAccount) {
|
|
19
|
+
boundExchanges.push(exchangeId.toLowerCase());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return boundExchanges;
|
|
23
|
+
}
|
|
24
|
+
function useUserExchanges() {
|
|
25
|
+
const { data, error, isLoading, mutate } = (0, swr_1.default)('/account/exchanges', async (url) => {
|
|
26
|
+
const response = await (0, core_1.fetchApi)(url);
|
|
27
|
+
return transformResponse(response);
|
|
28
|
+
}, {
|
|
29
|
+
revalidateOnFocus: false,
|
|
30
|
+
revalidateOnReconnect: false,
|
|
31
|
+
dedupingInterval: 60000,
|
|
32
|
+
});
|
|
33
|
+
const isExchangeBound = (exchangeId) => {
|
|
34
|
+
if (!data)
|
|
35
|
+
return false;
|
|
36
|
+
return data.includes(exchangeId.toLowerCase());
|
|
37
|
+
};
|
|
38
|
+
const isSelectedExchangeAvailable = (selectedExchange) => {
|
|
39
|
+
if (selectedExchange === 'all')
|
|
40
|
+
return true;
|
|
41
|
+
return isExchangeBound(selectedExchange);
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
boundExchanges: data || [],
|
|
45
|
+
isExchangeBound,
|
|
46
|
+
isSelectedExchangeAvailable,
|
|
47
|
+
isLoading,
|
|
48
|
+
error,
|
|
49
|
+
refresh: mutate,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// AI-generated · AI-managed · AI-maintained
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./config"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
__exportStar(require("./hooks"), exports);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export interface AccountBalance {
|
|
2
|
+
asset: string;
|
|
3
|
+
balance: number;
|
|
4
|
+
availableBalance: number;
|
|
5
|
+
unrealizedProfit: number;
|
|
6
|
+
}
|
|
7
|
+
export interface Position {
|
|
8
|
+
symbol: string;
|
|
9
|
+
side: "LONG" | "SHORT";
|
|
10
|
+
amount: number;
|
|
11
|
+
entryPrice: number;
|
|
12
|
+
markPrice: number;
|
|
13
|
+
liquidationPrice: number;
|
|
14
|
+
unrealizedProfit: number;
|
|
15
|
+
leverage: number;
|
|
16
|
+
}
|
|
17
|
+
export interface OpenOrder {
|
|
18
|
+
orderId: string;
|
|
19
|
+
symbol: string;
|
|
20
|
+
side: string;
|
|
21
|
+
type: string;
|
|
22
|
+
price: number;
|
|
23
|
+
quantity: number;
|
|
24
|
+
filled: number;
|
|
25
|
+
status: string;
|
|
26
|
+
time: string;
|
|
27
|
+
clientOrderId?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface Trade {
|
|
30
|
+
id: string;
|
|
31
|
+
orderId: string;
|
|
32
|
+
symbol: string;
|
|
33
|
+
side: string;
|
|
34
|
+
price: number;
|
|
35
|
+
quantity: number;
|
|
36
|
+
realizedPnl: number;
|
|
37
|
+
commission: number;
|
|
38
|
+
time: number;
|
|
39
|
+
isMaker: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface GroupedPosition {
|
|
42
|
+
symbol: string;
|
|
43
|
+
longPosition?: Position;
|
|
44
|
+
shortPosition?: Position;
|
|
45
|
+
totalUnrealizedProfit: number;
|
|
46
|
+
orders: OpenOrder[];
|
|
47
|
+
}
|
|
48
|
+
export interface GroupedOrders {
|
|
49
|
+
symbol: string;
|
|
50
|
+
orders: OpenOrder[];
|
|
51
|
+
totalQuantity: number;
|
|
52
|
+
}
|
|
53
|
+
export interface GroupedTrades {
|
|
54
|
+
symbol: string;
|
|
55
|
+
trades: Trade[];
|
|
56
|
+
totalRealizedPnl: number;
|
|
57
|
+
totalVolume: number;
|
|
58
|
+
}
|
|
59
|
+
export interface CleanupProgress {
|
|
60
|
+
status: string;
|
|
61
|
+
phase: string;
|
|
62
|
+
total_operations: number;
|
|
63
|
+
completed_operations: number;
|
|
64
|
+
current_operation: string;
|
|
65
|
+
result?: {
|
|
66
|
+
LONG?: {
|
|
67
|
+
tp_merged: number;
|
|
68
|
+
open_deleted: number;
|
|
69
|
+
};
|
|
70
|
+
SHORT?: {
|
|
71
|
+
tp_merged: number;
|
|
72
|
+
open_deleted: number;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
error?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface CleanupPreview {
|
|
78
|
+
LONG?: {
|
|
79
|
+
tp_orders?: {
|
|
80
|
+
before: number;
|
|
81
|
+
after: number;
|
|
82
|
+
merge_count: number;
|
|
83
|
+
};
|
|
84
|
+
open_orders?: {
|
|
85
|
+
before: number;
|
|
86
|
+
after: number;
|
|
87
|
+
delete_count: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
SHORT?: {
|
|
91
|
+
tp_orders?: {
|
|
92
|
+
before: number;
|
|
93
|
+
after: number;
|
|
94
|
+
merge_count: number;
|
|
95
|
+
};
|
|
96
|
+
open_orders?: {
|
|
97
|
+
before: number;
|
|
98
|
+
after: number;
|
|
99
|
+
delete_count: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatNumber(value: number, decimals?: number): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatNumber = formatNumber;
|
|
4
|
+
// AI-generated · AI-managed · AI-maintained
|
|
5
|
+
function formatNumber(value, decimals = 2) {
|
|
6
|
+
return value.toLocaleString('en-US', {
|
|
7
|
+
minimumFractionDigits: decimals,
|
|
8
|
+
maximumFractionDigits: decimals
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read secrets from GCP Secret Manager via REST API (Workload Identity).
|
|
3
|
+
* Zero external dependencies — uses native fetch + GKE metadata API.
|
|
4
|
+
* Falls back to process.env for local development.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSecret(secretId: string, envFallback?: string): Promise<string>;
|
|
7
|
+
export declare function getGeminiApiKey(): Promise<string>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Read secrets from GCP Secret Manager via REST API (Workload Identity).
|
|
4
|
+
* Zero external dependencies — uses native fetch + GKE metadata API.
|
|
5
|
+
* Falls back to process.env for local development.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getSecret = getSecret;
|
|
9
|
+
exports.getGeminiApiKey = getGeminiApiKey;
|
|
10
|
+
const GCP_PROJECT = process.env.GCP_PROJECT_ID || 'double-helix-9f030';
|
|
11
|
+
const cache = {};
|
|
12
|
+
async function getSecret(secretId, envFallback) {
|
|
13
|
+
if (cache[secretId])
|
|
14
|
+
return cache[secretId];
|
|
15
|
+
try {
|
|
16
|
+
// Get access token from GKE metadata server (Workload Identity)
|
|
17
|
+
const tokenRes = await fetch('http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token', { headers: { 'Metadata-Flavor': 'Google' } });
|
|
18
|
+
if (!tokenRes.ok)
|
|
19
|
+
throw new Error(`Metadata token: ${tokenRes.status}`);
|
|
20
|
+
const { access_token } = await tokenRes.json();
|
|
21
|
+
// Fetch secret from Secret Manager REST API
|
|
22
|
+
const secretRes = await fetch(`https://secretmanager.googleapis.com/v1/projects/${GCP_PROJECT}/secrets/${secretId}/versions/latest:access`, { headers: { Authorization: `Bearer ${access_token}` } });
|
|
23
|
+
if (!secretRes.ok)
|
|
24
|
+
throw new Error(`Secret Manager: ${secretRes.status}`);
|
|
25
|
+
const data = await secretRes.json();
|
|
26
|
+
const value = Buffer.from(data.payload.data, 'base64').toString('utf-8').trim();
|
|
27
|
+
cache[secretId] = value;
|
|
28
|
+
console.log(`[gcp-secrets] Loaded '${secretId}' from Secret Manager`);
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
console.warn(`[gcp-secrets] Fallback to env for '${secretId}':`, e instanceof Error ? e.message : e);
|
|
33
|
+
}
|
|
34
|
+
const value = envFallback ?? '';
|
|
35
|
+
cache[secretId] = value;
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
/** Pre-cached Gemini API key. Call initSecrets() at startup or use getGeminiApiKey(). */
|
|
39
|
+
let _geminiKey = null;
|
|
40
|
+
async function getGeminiApiKey() {
|
|
41
|
+
if (_geminiKey !== null)
|
|
42
|
+
return _geminiKey;
|
|
43
|
+
_geminiKey = await getSecret('gemini-api-key', process.env.GEMINI_API_KEY || '');
|
|
44
|
+
return _geminiKey;
|
|
45
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
interface Transaction {
|
|
2
|
+
type: string;
|
|
3
|
+
amount: number;
|
|
4
|
+
txHash: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
balanceBefore?: number;
|
|
7
|
+
balanceAfter?: number;
|
|
8
|
+
to?: string;
|
|
9
|
+
from?: string;
|
|
10
|
+
}
|
|
11
|
+
interface TransferResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
txHash: string;
|
|
14
|
+
amount: number;
|
|
15
|
+
to?: string;
|
|
16
|
+
from?: string;
|
|
17
|
+
balanceBefore: number;
|
|
18
|
+
balanceAfter: number;
|
|
19
|
+
transaction: Transaction;
|
|
20
|
+
}
|
|
21
|
+
interface DepositResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
txHash: string;
|
|
24
|
+
amount: number;
|
|
25
|
+
balanceBefore: number;
|
|
26
|
+
balanceAfter: number;
|
|
27
|
+
transaction: Transaction;
|
|
28
|
+
}
|
|
29
|
+
interface WalletInfo {
|
|
30
|
+
userId: string;
|
|
31
|
+
balance: number;
|
|
32
|
+
transactionCount: number;
|
|
33
|
+
lastTransaction: Transaction | null;
|
|
34
|
+
isMock: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface WalletExport {
|
|
37
|
+
userId: string;
|
|
38
|
+
balance: number;
|
|
39
|
+
transactions: Transaction[];
|
|
40
|
+
exportTime: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function generateMockTxHash(): string;
|
|
43
|
+
export declare class PersistentMockWallet {
|
|
44
|
+
private userId;
|
|
45
|
+
private defaultBalance;
|
|
46
|
+
private storageKey;
|
|
47
|
+
private transactionsKey;
|
|
48
|
+
private balance;
|
|
49
|
+
private transactions;
|
|
50
|
+
constructor(userId: string, defaultBalance?: number);
|
|
51
|
+
private loadBalance;
|
|
52
|
+
private saveBalance;
|
|
53
|
+
private loadTransactions;
|
|
54
|
+
private saveTransactions;
|
|
55
|
+
private addTransaction;
|
|
56
|
+
getBalance(): number;
|
|
57
|
+
deposit(amount: number): DepositResult;
|
|
58
|
+
transfer(amount: number, to?: string): TransferResult;
|
|
59
|
+
refund(amount: number, from?: string): TransferResult;
|
|
60
|
+
reset(amount?: number): {
|
|
61
|
+
success: boolean;
|
|
62
|
+
newBalance: number;
|
|
63
|
+
};
|
|
64
|
+
clear(): void;
|
|
65
|
+
getTransactions(limit?: number): Transaction[];
|
|
66
|
+
getInfo(): WalletInfo;
|
|
67
|
+
hasEnough(amount: number): boolean;
|
|
68
|
+
export(): WalletExport;
|
|
69
|
+
import(data: WalletExport): void;
|
|
70
|
+
}
|
|
71
|
+
export declare class MemoryMockWallet {
|
|
72
|
+
private balance;
|
|
73
|
+
private transactions;
|
|
74
|
+
constructor(initialBalance?: number);
|
|
75
|
+
getBalance(): number;
|
|
76
|
+
deposit(amount: number): {
|
|
77
|
+
newBalance: number;
|
|
78
|
+
type: string;
|
|
79
|
+
amount: number;
|
|
80
|
+
txHash: string;
|
|
81
|
+
timestamp: string;
|
|
82
|
+
balanceBefore?: number;
|
|
83
|
+
balanceAfter?: number;
|
|
84
|
+
to?: string;
|
|
85
|
+
from?: string;
|
|
86
|
+
success: boolean;
|
|
87
|
+
};
|
|
88
|
+
transfer(amount: number, to?: string): {
|
|
89
|
+
newBalance: number;
|
|
90
|
+
type: string;
|
|
91
|
+
amount: number;
|
|
92
|
+
txHash: string;
|
|
93
|
+
timestamp: string;
|
|
94
|
+
balanceBefore?: number;
|
|
95
|
+
balanceAfter?: number;
|
|
96
|
+
to?: string;
|
|
97
|
+
from?: string;
|
|
98
|
+
success: boolean;
|
|
99
|
+
};
|
|
100
|
+
refund(amount: number, from?: string): {
|
|
101
|
+
newBalance: number;
|
|
102
|
+
type: string;
|
|
103
|
+
amount: number;
|
|
104
|
+
txHash: string;
|
|
105
|
+
timestamp: string;
|
|
106
|
+
balanceBefore?: number;
|
|
107
|
+
balanceAfter?: number;
|
|
108
|
+
to?: string;
|
|
109
|
+
from?: string;
|
|
110
|
+
success: boolean;
|
|
111
|
+
};
|
|
112
|
+
getTransactions(limit?: number): Transaction[];
|
|
113
|
+
hasEnough(amount: number): boolean;
|
|
114
|
+
}
|
|
115
|
+
export declare function createTestAccounts(): {
|
|
116
|
+
admin: PersistentMockWallet;
|
|
117
|
+
rich: PersistentMockWallet;
|
|
118
|
+
normal1: PersistentMockWallet;
|
|
119
|
+
normal2: PersistentMockWallet;
|
|
120
|
+
poor: PersistentMockWallet;
|
|
121
|
+
};
|
|
122
|
+
export declare function formatMCC(amount: number): string;
|
|
123
|
+
declare const _default: {
|
|
124
|
+
PersistentMockWallet: typeof PersistentMockWallet;
|
|
125
|
+
MemoryMockWallet: typeof MemoryMockWallet;
|
|
126
|
+
generateMockTxHash: typeof generateMockTxHash;
|
|
127
|
+
createTestAccounts: typeof createTestAccounts;
|
|
128
|
+
formatMCC: typeof formatMCC;
|
|
129
|
+
};
|
|
130
|
+
export default _default;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemoryMockWallet = exports.PersistentMockWallet = void 0;
|
|
4
|
+
exports.generateMockTxHash = generateMockTxHash;
|
|
5
|
+
exports.createTestAccounts = createTestAccounts;
|
|
6
|
+
exports.formatMCC = formatMCC;
|
|
7
|
+
function generateMockTxHash() {
|
|
8
|
+
const chars = '0123456789abcdef';
|
|
9
|
+
let hash = '0x';
|
|
10
|
+
for (let i = 0; i < 64; i++) {
|
|
11
|
+
hash += chars[Math.floor(Math.random() * 16)];
|
|
12
|
+
}
|
|
13
|
+
return hash;
|
|
14
|
+
}
|
|
15
|
+
class PersistentMockWallet {
|
|
16
|
+
constructor(userId, defaultBalance = 100000) {
|
|
17
|
+
this.balance = 0;
|
|
18
|
+
this.transactions = [];
|
|
19
|
+
if (!userId) {
|
|
20
|
+
throw new Error('userId is required');
|
|
21
|
+
}
|
|
22
|
+
this.userId = userId;
|
|
23
|
+
this.defaultBalance = defaultBalance;
|
|
24
|
+
this.storageKey = `mock_wallet_${userId}`;
|
|
25
|
+
this.transactionsKey = `mock_wallet_tx_${userId}`;
|
|
26
|
+
this.loadBalance();
|
|
27
|
+
this.loadTransactions();
|
|
28
|
+
}
|
|
29
|
+
loadBalance() {
|
|
30
|
+
if (typeof window === 'undefined') {
|
|
31
|
+
this.balance = this.defaultBalance;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const saved = localStorage.getItem(this.storageKey);
|
|
35
|
+
this.balance = saved ? parseFloat(saved) : this.defaultBalance;
|
|
36
|
+
}
|
|
37
|
+
saveBalance() {
|
|
38
|
+
if (typeof window === 'undefined')
|
|
39
|
+
return;
|
|
40
|
+
localStorage.setItem(this.storageKey, this.balance.toString());
|
|
41
|
+
}
|
|
42
|
+
loadTransactions() {
|
|
43
|
+
if (typeof window === 'undefined') {
|
|
44
|
+
this.transactions = [];
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const saved = localStorage.getItem(this.transactionsKey);
|
|
48
|
+
this.transactions = saved ? JSON.parse(saved) : [];
|
|
49
|
+
}
|
|
50
|
+
saveTransactions() {
|
|
51
|
+
if (typeof window === 'undefined')
|
|
52
|
+
return;
|
|
53
|
+
localStorage.setItem(this.transactionsKey, JSON.stringify(this.transactions));
|
|
54
|
+
}
|
|
55
|
+
addTransaction(type, amount, txHash, details = {}) {
|
|
56
|
+
const transaction = {
|
|
57
|
+
type,
|
|
58
|
+
amount,
|
|
59
|
+
txHash,
|
|
60
|
+
timestamp: new Date().toISOString(),
|
|
61
|
+
balanceBefore: this.balance,
|
|
62
|
+
balanceAfter: this.balance,
|
|
63
|
+
...details
|
|
64
|
+
};
|
|
65
|
+
this.transactions.unshift(transaction);
|
|
66
|
+
if (this.transactions.length > 100) {
|
|
67
|
+
this.transactions = this.transactions.slice(0, 100);
|
|
68
|
+
}
|
|
69
|
+
this.saveTransactions();
|
|
70
|
+
return transaction;
|
|
71
|
+
}
|
|
72
|
+
getBalance() {
|
|
73
|
+
return this.balance;
|
|
74
|
+
}
|
|
75
|
+
deposit(amount) {
|
|
76
|
+
if (amount <= 0) {
|
|
77
|
+
throw new Error('充值金额必须大于0');
|
|
78
|
+
}
|
|
79
|
+
const txHash = generateMockTxHash();
|
|
80
|
+
const balanceBefore = this.balance;
|
|
81
|
+
this.balance += amount;
|
|
82
|
+
this.saveBalance();
|
|
83
|
+
const transaction = this.addTransaction('deposit', amount, txHash, {
|
|
84
|
+
balanceBefore,
|
|
85
|
+
balanceAfter: this.balance
|
|
86
|
+
});
|
|
87
|
+
console.log(`✅ 模拟充值成功: ${amount} MCC`);
|
|
88
|
+
console.log(`Transaction Hash: ${txHash}`);
|
|
89
|
+
console.log(`新余额: ${this.balance} MCC`);
|
|
90
|
+
return {
|
|
91
|
+
success: true,
|
|
92
|
+
txHash,
|
|
93
|
+
amount,
|
|
94
|
+
balanceBefore,
|
|
95
|
+
balanceAfter: this.balance,
|
|
96
|
+
transaction
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
transfer(amount, to = 'contract') {
|
|
100
|
+
if (amount <= 0) {
|
|
101
|
+
throw new Error('转账金额必须大于0');
|
|
102
|
+
}
|
|
103
|
+
if (this.balance < amount) {
|
|
104
|
+
throw new Error(`余额不足! 当前余额: ${this.balance} MCC, 需要: ${amount} MCC`);
|
|
105
|
+
}
|
|
106
|
+
const txHash = generateMockTxHash();
|
|
107
|
+
const balanceBefore = this.balance;
|
|
108
|
+
this.balance -= amount;
|
|
109
|
+
this.saveBalance();
|
|
110
|
+
const transaction = this.addTransaction('transfer', amount, txHash, {
|
|
111
|
+
balanceBefore,
|
|
112
|
+
balanceAfter: this.balance,
|
|
113
|
+
to
|
|
114
|
+
});
|
|
115
|
+
console.log(`✅ 模拟转账成功: ${amount} MCC → ${to}`);
|
|
116
|
+
console.log(`Transaction Hash: ${txHash}`);
|
|
117
|
+
console.log(`剩余余额: ${this.balance} MCC`);
|
|
118
|
+
return {
|
|
119
|
+
success: true,
|
|
120
|
+
txHash,
|
|
121
|
+
amount,
|
|
122
|
+
to,
|
|
123
|
+
balanceBefore,
|
|
124
|
+
balanceAfter: this.balance,
|
|
125
|
+
transaction
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
refund(amount, from = 'contract') {
|
|
129
|
+
if (amount <= 0) {
|
|
130
|
+
throw new Error('退款金额必须大于0');
|
|
131
|
+
}
|
|
132
|
+
const txHash = generateMockTxHash();
|
|
133
|
+
const balanceBefore = this.balance;
|
|
134
|
+
this.balance += amount;
|
|
135
|
+
this.saveBalance();
|
|
136
|
+
const transaction = this.addTransaction('refund', amount, txHash, {
|
|
137
|
+
balanceBefore,
|
|
138
|
+
balanceAfter: this.balance,
|
|
139
|
+
from
|
|
140
|
+
});
|
|
141
|
+
console.log(`✅ 模拟退款成功: ${amount} MCC ← ${from}`);
|
|
142
|
+
console.log(`Transaction Hash: ${txHash}`);
|
|
143
|
+
console.log(`新余额: ${this.balance} MCC`);
|
|
144
|
+
return {
|
|
145
|
+
success: true,
|
|
146
|
+
txHash,
|
|
147
|
+
amount,
|
|
148
|
+
from,
|
|
149
|
+
balanceBefore,
|
|
150
|
+
balanceAfter: this.balance,
|
|
151
|
+
transaction
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
reset(amount = 100000) {
|
|
155
|
+
this.balance = amount;
|
|
156
|
+
this.saveBalance();
|
|
157
|
+
console.log(`🔄 余额已重置为: ${amount} MCC`);
|
|
158
|
+
return {
|
|
159
|
+
success: true,
|
|
160
|
+
newBalance: this.balance
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
clear() {
|
|
164
|
+
if (typeof window === 'undefined')
|
|
165
|
+
return;
|
|
166
|
+
localStorage.removeItem(this.storageKey);
|
|
167
|
+
localStorage.removeItem(this.transactionsKey);
|
|
168
|
+
this.balance = this.defaultBalance;
|
|
169
|
+
this.transactions = [];
|
|
170
|
+
console.log('🗑️ 钱包数据已清除');
|
|
171
|
+
}
|
|
172
|
+
getTransactions(limit = 10) {
|
|
173
|
+
return this.transactions.slice(0, limit);
|
|
174
|
+
}
|
|
175
|
+
getInfo() {
|
|
176
|
+
return {
|
|
177
|
+
userId: this.userId,
|
|
178
|
+
balance: this.balance,
|
|
179
|
+
transactionCount: this.transactions.length,
|
|
180
|
+
lastTransaction: this.transactions[0] || null,
|
|
181
|
+
isMock: true
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
hasEnough(amount) {
|
|
185
|
+
return this.balance >= amount;
|
|
186
|
+
}
|
|
187
|
+
export() {
|
|
188
|
+
return {
|
|
189
|
+
userId: this.userId,
|
|
190
|
+
balance: this.balance,
|
|
191
|
+
transactions: this.transactions,
|
|
192
|
+
exportTime: new Date().toISOString()
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
import(data) {
|
|
196
|
+
if (data.userId !== this.userId) {
|
|
197
|
+
throw new Error('用户ID不匹配');
|
|
198
|
+
}
|
|
199
|
+
this.balance = data.balance;
|
|
200
|
+
this.transactions = data.transactions || [];
|
|
201
|
+
this.saveBalance();
|
|
202
|
+
this.saveTransactions();
|
|
203
|
+
console.log('✅ 钱包数据导入成功');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
exports.PersistentMockWallet = PersistentMockWallet;
|
|
207
|
+
class MemoryMockWallet {
|
|
208
|
+
constructor(initialBalance = 100000) {
|
|
209
|
+
this.balance = initialBalance;
|
|
210
|
+
this.transactions = [];
|
|
211
|
+
}
|
|
212
|
+
getBalance() {
|
|
213
|
+
return this.balance;
|
|
214
|
+
}
|
|
215
|
+
deposit(amount) {
|
|
216
|
+
if (amount <= 0)
|
|
217
|
+
throw new Error('充值金额必须大于0');
|
|
218
|
+
this.balance += amount;
|
|
219
|
+
const tx = {
|
|
220
|
+
type: 'deposit',
|
|
221
|
+
amount,
|
|
222
|
+
txHash: generateMockTxHash(),
|
|
223
|
+
timestamp: new Date().toISOString()
|
|
224
|
+
};
|
|
225
|
+
this.transactions.push(tx);
|
|
226
|
+
return { success: true, ...tx, newBalance: this.balance };
|
|
227
|
+
}
|
|
228
|
+
transfer(amount, to = 'contract') {
|
|
229
|
+
if (amount <= 0)
|
|
230
|
+
throw new Error('转账金额必须大于0');
|
|
231
|
+
if (this.balance < amount)
|
|
232
|
+
throw new Error('余额不足');
|
|
233
|
+
this.balance -= amount;
|
|
234
|
+
const tx = {
|
|
235
|
+
type: 'transfer',
|
|
236
|
+
amount,
|
|
237
|
+
to,
|
|
238
|
+
txHash: generateMockTxHash(),
|
|
239
|
+
timestamp: new Date().toISOString()
|
|
240
|
+
};
|
|
241
|
+
this.transactions.push(tx);
|
|
242
|
+
return { success: true, ...tx, newBalance: this.balance };
|
|
243
|
+
}
|
|
244
|
+
refund(amount, from = 'contract') {
|
|
245
|
+
if (amount <= 0)
|
|
246
|
+
throw new Error('退款金额必须大于0');
|
|
247
|
+
this.balance += amount;
|
|
248
|
+
const tx = {
|
|
249
|
+
type: 'refund',
|
|
250
|
+
amount,
|
|
251
|
+
from,
|
|
252
|
+
txHash: generateMockTxHash(),
|
|
253
|
+
timestamp: new Date().toISOString()
|
|
254
|
+
};
|
|
255
|
+
this.transactions.push(tx);
|
|
256
|
+
return { success: true, ...tx, newBalance: this.balance };
|
|
257
|
+
}
|
|
258
|
+
getTransactions(limit = 10) {
|
|
259
|
+
return this.transactions.slice(-limit).reverse();
|
|
260
|
+
}
|
|
261
|
+
hasEnough(amount) {
|
|
262
|
+
return this.balance >= amount;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.MemoryMockWallet = MemoryMockWallet;
|
|
266
|
+
function createTestAccounts() {
|
|
267
|
+
return {
|
|
268
|
+
admin: new PersistentMockWallet('admin_test_001', Infinity),
|
|
269
|
+
rich: new PersistentMockWallet('user_rich_001', 500000),
|
|
270
|
+
normal1: new PersistentMockWallet('user_normal_001', 50000),
|
|
271
|
+
normal2: new PersistentMockWallet('user_normal_002', 50000),
|
|
272
|
+
poor: new PersistentMockWallet('user_poor_001', 5000)
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function formatMCC(amount) {
|
|
276
|
+
return `${amount.toLocaleString()} MCC`;
|
|
277
|
+
}
|
|
278
|
+
exports.default = {
|
|
279
|
+
PersistentMockWallet,
|
|
280
|
+
MemoryMockWallet,
|
|
281
|
+
generateMockTxHash,
|
|
282
|
+
createTestAccounts,
|
|
283
|
+
formatMCC
|
|
284
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const OAUTH_CONFIG: {
|
|
2
|
+
authorizationEndpoint: string;
|
|
3
|
+
tokenEndpoint: string;
|
|
4
|
+
firebaseTokenEndpoint: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
redirectUri: string;
|
|
7
|
+
scopes: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function generateState(): string;
|
|
10
|
+
export declare function saveState(state: string): void;
|
|
11
|
+
export declare function verifyState(state: string): boolean;
|
|
12
|
+
export declare function buildAuthorizationUrl(): string;
|