@b3dotfun/sdk 0.0.73 → 0.0.74-alpha.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/cjs/anyspend/react/components/AnySpend.js +75 -50
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +9 -10
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +41 -41
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +17 -9
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +7 -8
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +7 -8
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +18 -14
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +6 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +35 -35
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +1 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +7 -3
- package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +8 -9
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -3
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +1 -2
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +12 -12
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -5
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +3 -2
- package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.js +17 -17
- package/dist/cjs/anyspend/react/utils/toast.d.ts +6 -0
- package/dist/cjs/anyspend/react/utils/toast.js +9 -0
- package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +2 -3
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +275 -39
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +40 -13
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +19 -3
- package/dist/cjs/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/cjs/global-account/react/components/Deposit/Deposit.js +61 -0
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
- package/dist/cjs/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +34 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +104 -283
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +320 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkedAccountItem.js +44 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +23 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +120 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +43 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +16 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +16 -194
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +15 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationChannel.js +13 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
- package/dist/cjs/global-account/react/components/ManageAccount/NotificationsContent.js +152 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +47 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +60 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.js +8 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +116 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +44 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +48 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +68 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +79 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +79 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
- package/dist/cjs/global-account/react/components/ManageAccount/channels/index.js +11 -0
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +12 -0
- package/dist/cjs/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/cjs/global-account/react/components/Send/Send.js +195 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +5 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -1
- package/dist/cjs/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
- package/dist/cjs/global-account/react/components/Toast/ToastComponents.js +54 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.d.ts +19 -0
- package/dist/cjs/global-account/react/components/Toast/ToastContext.js +59 -0
- package/dist/cjs/global-account/react/components/Toast/index.d.ts +4 -0
- package/dist/cjs/global-account/react/components/Toast/index.js +12 -0
- package/dist/cjs/global-account/react/components/Toast/toastApi.d.ts +21 -0
- package/dist/cjs/global-account/react/components/Toast/toastApi.js +93 -0
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.js +13 -0
- package/dist/cjs/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/BellIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.js +7 -0
- package/dist/cjs/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/CopyIcon.js +7 -0
- package/dist/cjs/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/LinkIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/cjs/global-account/react/components/icons/LockIcon.js +5 -0
- package/dist/cjs/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/cjs/global-account/react/components/icons/WalletIcon.js +7 -0
- package/dist/cjs/global-account/react/components/index.d.ts +10 -4
- package/dist/cjs/global-account/react/components/index.js +29 -9
- package/dist/cjs/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
- package/dist/cjs/global-account/react/components/ui/drawer.js +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +3 -2
- package/dist/cjs/global-account/react/hooks/index.js +7 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +18 -0
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
- package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.js +11 -11
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useNotifications.d.ts +48 -0
- package/dist/cjs/global-account/react/hooks/useNotifications.js +189 -0
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +3 -3
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.js +1 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +17 -17
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +47 -6
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.js +36 -0
- package/dist/cjs/global-account/react/utils/index.d.ts +4 -0
- package/dist/cjs/global-account/react/utils/index.js +20 -0
- package/dist/cjs/global-account/react/utils/notificationsAPI.d.ts +80 -0
- package/dist/cjs/global-account/react/utils/notificationsAPI.js +257 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +3 -0
- package/dist/cjs/global-account/react/utils/profileDisplay.js +8 -4
- package/dist/cjs/global-account/react/utils/toast.d.ts +6 -0
- package/dist/cjs/global-account/react/utils/toast.js +9 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +3 -2
- package/dist/cjs/shared/constants/chains/supported.js +4 -0
- package/dist/cjs/shared/utils/ipfs.js +10 -3
- package/dist/esm/anyspend/react/components/AnySpend.js +67 -42
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +10 -10
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +12 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -5
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +1 -2
- package/dist/esm/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +6 -5
- package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +2 -3
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +1 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +1 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -2
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +3 -2
- package/dist/esm/anyspend/react/hooks/usePhantomTransfer.js +1 -1
- package/dist/esm/anyspend/react/utils/toast.d.ts +6 -0
- package/dist/esm/anyspend/react/utils/toast.js +5 -0
- package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +38 -2
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +1 -2
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +276 -40
- package/dist/esm/global-account/react/components/B3DynamicModal.js +37 -13
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -3
- package/dist/esm/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/esm/global-account/react/components/Deposit/Deposit.js +55 -0
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
- package/dist/esm/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.js +31 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +103 -283
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +314 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkedAccountItem.js +42 -0
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +21 -0
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +1 -2
- package/dist/esm/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +81 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +41 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +10 -0
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +18 -196
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +13 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationChannel.js +9 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
- package/dist/esm/global-account/react/components/ManageAccount/NotificationsContent.js +147 -0
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +45 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +55 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.js +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +111 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.js +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +42 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +44 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +64 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +75 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +75 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
- package/dist/esm/global-account/react/components/ManageAccount/channels/index.js +4 -0
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +10 -0
- package/dist/esm/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/esm/global-account/react/components/Send/Send.js +189 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +7 -6
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -1
- package/dist/esm/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
- package/dist/esm/global-account/react/components/Toast/ToastComponents.js +50 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.d.ts +19 -0
- package/dist/esm/global-account/react/components/Toast/ToastContext.js +55 -0
- package/dist/esm/global-account/react/components/Toast/index.d.ts +4 -0
- package/dist/esm/global-account/react/components/Toast/index.js +3 -0
- package/dist/esm/global-account/react/components/Toast/toastApi.d.ts +21 -0
- package/dist/esm/global-account/react/components/Toast/toastApi.js +89 -0
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.js +11 -0
- package/dist/esm/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/BellIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.js +4 -0
- package/dist/esm/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/CopyIcon.js +4 -0
- package/dist/esm/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/LinkIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/esm/global-account/react/components/icons/LockIcon.js +3 -0
- package/dist/esm/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/esm/global-account/react/components/icons/WalletIcon.js +4 -0
- package/dist/esm/global-account/react/components/index.d.ts +10 -4
- package/dist/esm/global-account/react/components/index.js +14 -5
- package/dist/esm/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
- package/dist/esm/global-account/react/components/ui/drawer.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +3 -2
- package/dist/esm/global-account/react/hooks/index.js +3 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +17 -0
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +1 -0
- package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +1 -1
- package/dist/esm/global-account/react/hooks/useNotifications.d.ts +48 -0
- package/dist/esm/global-account/react/hooks/useNotifications.js +186 -0
- package/dist/esm/global-account/react/hooks/useSimBalance.js +3 -3
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.js +1 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +47 -6
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.js +33 -0
- package/dist/esm/global-account/react/utils/index.d.ts +4 -0
- package/dist/esm/global-account/react/utils/index.js +4 -0
- package/dist/esm/global-account/react/utils/notificationsAPI.d.ts +80 -0
- package/dist/esm/global-account/react/utils/notificationsAPI.js +254 -0
- package/dist/esm/global-account/react/utils/profileDisplay.d.ts +3 -0
- package/dist/esm/global-account/react/utils/profileDisplay.js +8 -4
- package/dist/esm/global-account/react/utils/toast.d.ts +6 -0
- package/dist/esm/global-account/react/utils/toast.js +5 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +3 -2
- package/dist/esm/shared/constants/chains/supported.js +3 -0
- package/dist/esm/shared/utils/ipfs.js +10 -3
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +0 -6
- package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/types/anyspend/react/utils/toast.d.ts +6 -0
- package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/types/global-account/react/components/Deposit/Deposit.d.ts +1 -0
- package/dist/types/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.d.ts +39 -0
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +6 -4
- package/dist/types/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +4 -0
- package/dist/types/global-account/react/components/LinkAccount/LinkedAccountItem.d.ts +16 -0
- package/dist/types/global-account/react/components/ManageAccount/BottomNavigation.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/Header.d.ts +3 -0
- package/dist/types/global-account/react/components/ManageAccount/HomeActions.d.ts +5 -0
- package/dist/types/global-account/react/components/ManageAccount/HomeContent.d.ts +6 -0
- package/dist/types/global-account/react/components/ManageAccount/NFTContent.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/NotificationChannel.d.ts +16 -0
- package/dist/types/global-account/react/components/ManageAccount/NotificationsContent.d.ts +8 -0
- package/dist/types/global-account/react/components/ManageAccount/ProfileSection.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsContent.d.ts +7 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +9 -0
- package/dist/types/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +3 -3
- package/dist/types/global-account/react/components/ManageAccount/TokenContent.d.ts +2 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/DiscordChannel.d.ts +11 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/EmailChannel.d.ts +11 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/PhoneChannel.d.ts +14 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/TelegramChannel.d.ts +11 -0
- package/dist/types/global-account/react/components/ManageAccount/channels/index.d.ts +4 -0
- package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +11 -0
- package/dist/types/global-account/react/components/Send/Send.d.ts +5 -0
- package/dist/types/global-account/react/components/Toast/ToastComponents.d.ts +15 -0
- package/dist/types/global-account/react/components/Toast/ToastContext.d.ts +19 -0
- package/dist/types/global-account/react/components/Toast/index.d.ts +4 -0
- package/dist/types/global-account/react/components/Toast/toastApi.d.ts +21 -0
- package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +4 -0
- package/dist/types/global-account/react/components/icons/BellIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/icons/CopyIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/icons/LinkIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/LockIcon.d.ts +3 -0
- package/dist/types/global-account/react/components/icons/WalletIcon.d.ts +2 -0
- package/dist/types/global-account/react/components/index.d.ts +10 -4
- package/dist/types/global-account/react/hooks/index.d.ts +3 -2
- package/dist/types/global-account/react/hooks/useAccountWallet.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useNotifications.d.ts +48 -0
- package/dist/types/global-account/react/hooks/useTokenBalanceDirect.d.ts +1 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +47 -6
- package/dist/types/global-account/react/stores/useRecentAddressesStore.d.ts +25 -0
- package/dist/types/global-account/react/utils/index.d.ts +4 -0
- package/dist/types/global-account/react/utils/notificationsAPI.d.ts +80 -0
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +3 -0
- package/dist/types/global-account/react/utils/toast.d.ts +6 -0
- package/dist/types/shared/constants/chains/supported.d.ts +3 -2
- package/package.json +2 -1
- package/src/anyspend/react/components/AnySpend.tsx +213 -173
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +80 -77
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +20 -4
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -1
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +2 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +56 -22
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +1 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +6 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -2
- package/src/anyspend/react/components/common/OrderHistory.tsx +8 -13
- package/src/anyspend/react/components/common/OrderHistoryItem.tsx +69 -25
- package/src/anyspend/react/components/common/PanelOnramp.tsx +6 -4
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +3 -3
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +3 -3
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +2 -1
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +2 -1
- package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +3 -2
- package/src/anyspend/react/hooks/usePhantomTransfer.ts +1 -1
- package/src/anyspend/react/utils/toast.ts +6 -0
- package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +115 -25
- package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +2 -2
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +491 -130
- package/src/global-account/react/components/B3DynamicModal.tsx +76 -17
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +40 -20
- package/src/global-account/react/components/Deposit/Deposit.tsx +208 -0
- package/src/global-account/react/components/IPFSMediaRenderer/IPFSMediaRenderer.tsx +84 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +269 -434
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +480 -0
- package/src/global-account/react/components/LinkAccount/LinkedAccountItem.tsx +135 -0
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +83 -0
- package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +2 -1
- package/src/global-account/react/components/ManageAccount/Header.tsx +230 -0
- package/src/global-account/react/components/ManageAccount/HomeActions.tsx +118 -0
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +42 -0
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +74 -597
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +24 -0
- package/src/global-account/react/components/ManageAccount/NotificationChannel.tsx +94 -0
- package/src/global-account/react/components/ManageAccount/NotificationsContent.tsx +268 -0
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +79 -0
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +106 -0
- package/src/global-account/react/components/ManageAccount/SettingsMenuItem.tsx +31 -0
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +197 -0
- package/src/global-account/react/components/ManageAccount/TokenBalanceRow.tsx +20 -5
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +66 -0
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +119 -0
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +168 -0
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +227 -0
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +150 -0
- package/src/global-account/react/components/ManageAccount/channels/index.ts +4 -0
- package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +61 -0
- package/src/global-account/react/components/Send/Send.tsx +621 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +13 -12
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +1 -1
- package/src/global-account/react/components/Toast/README.md +350 -0
- package/src/global-account/react/components/Toast/ToastComponents.tsx +159 -0
- package/src/global-account/react/components/Toast/ToastContext.tsx +86 -0
- package/src/global-account/react/components/Toast/index.ts +4 -0
- package/src/global-account/react/components/Toast/toastApi.ts +98 -0
- package/src/global-account/react/components/WalletImage/WalletImage.tsx +12 -0
- package/src/global-account/react/components/icons/BellIcon.tsx +15 -0
- package/src/global-account/react/components/icons/ChevronDownIcon.tsx +17 -0
- package/src/global-account/react/components/icons/CopyIcon.tsx +22 -0
- package/src/global-account/react/components/icons/LinkIcon.tsx +15 -0
- package/src/global-account/react/components/icons/LockIcon.tsx +15 -0
- package/src/global-account/react/components/icons/WalletIcon.tsx +21 -0
- package/src/global-account/react/components/index.ts +19 -5
- package/src/global-account/react/components/ui/Tabs.tsx +5 -13
- package/src/global-account/react/components/ui/dialog.tsx +23 -14
- package/src/global-account/react/components/ui/drawer.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +5 -1
- package/src/global-account/react/hooks/useAccountWallet.tsx +26 -0
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +1 -0
- package/src/global-account/react/hooks/useChainSwitchWithAction.ts +3 -2
- package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
- package/src/global-account/react/hooks/useNotifications.ts +229 -0
- package/src/global-account/react/hooks/useSimBalance.ts +3 -3
- package/src/global-account/react/hooks/useTokenBalanceDirect.tsx +2 -0
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +3 -2
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +53 -6
- package/src/global-account/react/stores/useRecentAddressesStore.ts +54 -0
- package/src/global-account/react/utils/index.ts +4 -0
- package/src/global-account/react/utils/notificationsAPI.ts +305 -0
- package/src/global-account/react/utils/profileDisplay.ts +12 -4
- package/src/global-account/react/utils/toast.ts +6 -0
- package/src/shared/constants/chains/supported.ts +4 -0
- package/src/shared/utils/ipfs.ts +10 -3
- package/src/styles/index.css +12 -1
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +0 -107
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
- package/dist/cjs/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -151
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +0 -104
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
- package/dist/esm/global-account/react/components/ProfileEditor/ProfileEditor.js +0 -145
- package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +0 -7
- package/dist/types/global-account/react/components/ProfileEditor/ProfileEditor.d.ts +0 -6
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +0 -258
- package/src/global-account/react/components/ProfileEditor/ProfileEditor.tsx +0 -279
|
@@ -43,14 +43,14 @@ const constants_1 = require("../../../anyspend/constants");
|
|
|
43
43
|
const react_1 = require("../../../anyspend/react");
|
|
44
44
|
const react_2 = require("../../../global-account/react");
|
|
45
45
|
const utils_1 = require("../../../shared/utils");
|
|
46
|
+
const react_3 = require("../../../global-account/react");
|
|
46
47
|
const formatAddress_1 = require("../../../shared/utils/formatAddress");
|
|
47
48
|
const number_1 = require("../../../shared/utils/number");
|
|
48
49
|
const simplehash_1 = require("../../../shared/utils/simplehash");
|
|
49
50
|
const invariant_1 = __importDefault(require("invariant"));
|
|
50
51
|
const lucide_react_1 = require("lucide-react");
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const sonner_1 = require("sonner");
|
|
52
|
+
const react_4 = require("motion/react");
|
|
53
|
+
const react_5 = __importStar(require("react"));
|
|
54
54
|
const chains_1 = require("viem/chains");
|
|
55
55
|
const FeatureFlagsContext_1 = require("../contexts/FeatureFlagsContext");
|
|
56
56
|
const useAutoSetActiveWalletFromWagmi_1 = require("../hooks/useAutoSetActiveWalletFromWagmi");
|
|
@@ -154,12 +154,12 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
154
154
|
const router = (0, react_2.useRouter)();
|
|
155
155
|
// Auto-set active wallet from wagmi
|
|
156
156
|
(0, useAutoSetActiveWalletFromWagmi_1.useAutoSetActiveWalletFromWagmi)();
|
|
157
|
-
const [activePanel, setActivePanel] = (0,
|
|
158
|
-
const [activeTab, setActiveTab] = (0,
|
|
157
|
+
const [activePanel, setActivePanel] = (0, react_5.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER);
|
|
158
|
+
const [activeTab, setActiveTab] = (0, react_5.useState)(activeTabProps);
|
|
159
159
|
// Payment method state with dual-state system (auto + explicit user selection)
|
|
160
160
|
// Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
|
|
161
161
|
const { setSelectedCryptoPaymentMethod, effectiveCryptoPaymentMethod, resetPaymentMethods } = (0, useCryptoPaymentMethodState_1.useCryptoPaymentMethodState)();
|
|
162
|
-
const [selectedFiatPaymentMethod, setSelectedFiatPaymentMethod] = (0,
|
|
162
|
+
const [selectedFiatPaymentMethod, setSelectedFiatPaymentMethod] = (0, react_5.useState)(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
|
|
163
163
|
// Get current user's wallet
|
|
164
164
|
const currentWallet = (0, react_2.useAccountWallet)();
|
|
165
165
|
// Recipient address state with dual-state system (auto + explicit user selection)
|
|
@@ -168,12 +168,12 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
168
168
|
recipientAddressFromProps: recipientAddressProps,
|
|
169
169
|
globalAddress: currentWallet.address,
|
|
170
170
|
});
|
|
171
|
-
const [orderId, setOrderId] = (0,
|
|
171
|
+
const [orderId, setOrderId] = (0, react_5.useState)(loadOrder);
|
|
172
172
|
// Track if onSuccess has been called for the current order
|
|
173
|
-
const onSuccessCalled =
|
|
174
|
-
const [srcChainId, setSrcChainId] = (0,
|
|
173
|
+
const onSuccessCalled = react_5.default.useRef(false);
|
|
174
|
+
const [srcChainId, setSrcChainId] = (0, react_5.useState)(chains_1.base.id);
|
|
175
175
|
// Get token list for token balance check
|
|
176
|
-
const chainName = (0,
|
|
176
|
+
const chainName = (0, react_5.useMemo)(() => (0, simplehash_1.simpleHashChainToChainName)(srcChainId), [srcChainId]);
|
|
177
177
|
const { data: tokenList } = (0, react_1.useAnyspendTokenList)(srcChainId, "");
|
|
178
178
|
// Get token balances for the selected chain
|
|
179
179
|
const { nativeTokens, fungibleTokens } = (0, react_2.useTokenBalancesByChain)({
|
|
@@ -182,7 +182,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
182
182
|
enabled: !!currentWallet?.wallet?.address && !!chainName,
|
|
183
183
|
});
|
|
184
184
|
// Find a token with a balance, prioritizing tokens the user already owns
|
|
185
|
-
const getTokenWithBalance = (0,
|
|
185
|
+
const getTokenWithBalance = (0, react_5.useCallback)(() => {
|
|
186
186
|
if (!currentWallet?.wallet?.address || (!nativeTokens && !fungibleTokens) || !tokenList) {
|
|
187
187
|
return (0, anyspend_1.getDefaultToken)(srcChainId);
|
|
188
188
|
}
|
|
@@ -212,10 +212,10 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
212
212
|
return (0, anyspend_1.getDefaultToken)(srcChainId);
|
|
213
213
|
}, [currentWallet?.wallet?.address, nativeTokens, fungibleTokens, tokenList, srcChainId]);
|
|
214
214
|
// Set the selected token with preference for tokens user owns
|
|
215
|
-
const [srcToken, setSrcToken] = (0,
|
|
216
|
-
const [dirtySelectSrcToken, setDirtySelectSrcToken] = (0,
|
|
215
|
+
const [srcToken, setSrcToken] = (0, react_5.useState)((0, anyspend_1.getDefaultToken)(srcChainId));
|
|
216
|
+
const [dirtySelectSrcToken, setDirtySelectSrcToken] = (0, react_5.useState)(false);
|
|
217
217
|
// Update token when chain changes or token balances are loaded
|
|
218
|
-
(0,
|
|
218
|
+
(0, react_5.useEffect)(() => {
|
|
219
219
|
if (tokenList?.length && !dirtySelectSrcToken) {
|
|
220
220
|
const tokenWithBalance = getTokenWithBalance();
|
|
221
221
|
if ((0, anyspend_1.eqci)(tokenWithBalance.address, dstToken.address) === false) {
|
|
@@ -224,7 +224,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
224
224
|
}
|
|
225
225
|
}, [srcChainId, tokenList, getTokenWithBalance, nativeTokens, fungibleTokens, dirtySelectSrcToken, dstToken.address]);
|
|
226
226
|
// const { account: isAuthenticated } = useB3();
|
|
227
|
-
const getRelayQuoteRequest = (0,
|
|
227
|
+
const getRelayQuoteRequest = (0, react_5.useMemo)(() => {
|
|
228
228
|
return generateGetRelayQuoteRequest({
|
|
229
229
|
orderType: orderType,
|
|
230
230
|
srcChainId: activeTab === "fiat" ? chains_1.base.id : srcChainId,
|
|
@@ -267,7 +267,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
267
267
|
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
268
268
|
};
|
|
269
269
|
// Update dependent amount when relay price changes
|
|
270
|
-
const srcAmount = (0,
|
|
270
|
+
const srcAmount = (0, react_5.useMemo)(() => {
|
|
271
271
|
if (!anyspendQuote?.data ||
|
|
272
272
|
!anyspendQuote?.data?.currencyIn?.amount ||
|
|
273
273
|
!anyspendQuote?.data?.currencyIn?.currency?.decimals)
|
|
@@ -282,10 +282,10 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
282
282
|
}
|
|
283
283
|
}, [activeTab, anyspendQuote?.data]);
|
|
284
284
|
const formattedSrcAmount = srcAmount ? (0, number_1.formatTokenAmount)(srcAmount, srcToken.decimals, 6, false) : null;
|
|
285
|
-
const srcFiatAmount = (0,
|
|
285
|
+
const srcFiatAmount = (0, react_5.useMemo)(() => (activeTab === "fiat" && srcAmount ? (0, number_1.formatUnits)(srcAmount.toString(), constants_1.USDC_BASE.decimals) : "0"), [activeTab, srcAmount]);
|
|
286
286
|
// Get geo data and onramp options (after quote is available)
|
|
287
287
|
const { geoData, isOnrampSupported, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(srcFiatAmount);
|
|
288
|
-
(0,
|
|
288
|
+
(0, react_5.useEffect)(() => {
|
|
289
289
|
if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
|
|
290
290
|
console.log("Calling onSuccess");
|
|
291
291
|
const relayTxs = oat?.data?.relayTxs;
|
|
@@ -296,7 +296,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
296
296
|
}
|
|
297
297
|
}, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, oat?.data?.relayTxs, onSuccess]);
|
|
298
298
|
// Reset flag when orderId changes
|
|
299
|
-
(0,
|
|
299
|
+
(0, react_5.useEffect)(() => {
|
|
300
300
|
onSuccessCalled.current = false;
|
|
301
301
|
}, [orderId]);
|
|
302
302
|
const { createOrder: createRegularOrder, isCreatingOrder: isCreatingRegularOrder } = (0, react_1.useAnyspendCreateOrder)({
|
|
@@ -305,7 +305,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
305
305
|
},
|
|
306
306
|
onError: error => {
|
|
307
307
|
console.error(error);
|
|
308
|
-
|
|
308
|
+
react_3.toast.error("Failed to create order: " + error.message);
|
|
309
309
|
},
|
|
310
310
|
});
|
|
311
311
|
const { createOrder: createOnrampOrder, isCreatingOrder: isCreatingOnrampOrder } = (0, react_1.useAnyspendCreateOnrampOrder)({
|
|
@@ -314,7 +314,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
314
314
|
},
|
|
315
315
|
onError: error => {
|
|
316
316
|
console.error(error);
|
|
317
|
-
|
|
317
|
+
react_3.toast.error("Failed to create order: " + error.message);
|
|
318
318
|
},
|
|
319
319
|
});
|
|
320
320
|
const isCreatingOrder = isCreatingRegularOrder || isCreatingOnrampOrder;
|
|
@@ -401,7 +401,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
401
401
|
}
|
|
402
402
|
catch (err) {
|
|
403
403
|
console.error(err);
|
|
404
|
-
|
|
404
|
+
react_3.toast.error(err.message);
|
|
405
405
|
throw err;
|
|
406
406
|
}
|
|
407
407
|
};
|
|
@@ -427,7 +427,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
427
427
|
}
|
|
428
428
|
catch (err) {
|
|
429
429
|
console.error("Error creating order:", err);
|
|
430
|
-
|
|
430
|
+
react_3.toast.error(`Error creating order: ${err instanceof Error ? err.message : err}`);
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
};
|
|
@@ -437,7 +437,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
437
437
|
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
438
438
|
(0, invariant_1.default)(recipientAddress, "Recipient address is not found");
|
|
439
439
|
if (!srcFiatAmount || parseFloat(srcFiatAmount) <= 0) {
|
|
440
|
-
|
|
440
|
+
react_3.toast.error("Please enter a valid amount");
|
|
441
441
|
return;
|
|
442
442
|
}
|
|
443
443
|
// Determine vendor and payment method string based on selected payment method
|
|
@@ -445,7 +445,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
445
445
|
let paymentMethodString = "";
|
|
446
446
|
if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY) {
|
|
447
447
|
if (coinbaseAvailablePaymentMethods.length === 0) {
|
|
448
|
-
|
|
448
|
+
react_3.toast.error("Coinbase Pay not available");
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
451
|
vendor = "coinbase";
|
|
@@ -453,14 +453,14 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
453
453
|
}
|
|
454
454
|
else if (paymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
|
|
455
455
|
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
456
|
-
|
|
456
|
+
react_3.toast.error("Stripe not available");
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
459
|
vendor = stripeWeb2Support && stripeWeb2Support.isSupport ? "stripe-web2" : "stripe";
|
|
460
460
|
paymentMethodString = "";
|
|
461
461
|
}
|
|
462
462
|
else {
|
|
463
|
-
|
|
463
|
+
react_3.toast.error("Please select a payment method");
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
466
|
await handleCreateOrder(recipientAddress, {
|
|
@@ -470,10 +470,10 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
470
470
|
}
|
|
471
471
|
catch (err) {
|
|
472
472
|
console.error(err);
|
|
473
|
-
|
|
473
|
+
react_3.toast.error("Failed to create order: " + err.message);
|
|
474
474
|
}
|
|
475
475
|
};
|
|
476
|
-
const recipientSection = showRecipient ? ((0, jsx_runtime_1.jsxs)(
|
|
476
|
+
const recipientSection = showRecipient ? ((0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
477
477
|
opacity: hasMounted ? 1 : 0,
|
|
478
478
|
y: hasMounted ? 0 : 20,
|
|
479
479
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -483,8 +483,8 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
483
483
|
? "Receive NFT at"
|
|
484
484
|
: orderType === "join_tournament"
|
|
485
485
|
? "Join for"
|
|
486
|
-
: "Recipient" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientAddress ? ((0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)("text-as-tertiarry flex
|
|
487
|
-
const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center
|
|
486
|
+
: "Recipient" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [recipientAddress ? ((0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)("text-as-tertiarry flex items-center gap-2 rounded-lg"), onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: (0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: (0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.shortenAddress)(recipientAddress) }) }) })) : ((0, jsx_runtime_1.jsx)("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: () => setActivePanel(PanelView.RECIPIENT_SELECTION), children: (0, jsx_runtime_1.jsx)("div", { className: "whitespace-nowrap text-sm font-medium", children: "Select recipient" }) })), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })] }, recipientAddress)) : null;
|
|
487
|
+
const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center", mode === "modal" && "bg-b3-react-background"), children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => {
|
|
488
488
|
setActivePanel(PanelView.HISTORY);
|
|
489
489
|
}, onSelectOrder: onSelectOrder }) }));
|
|
490
490
|
const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : effectiveCryptoPaymentMethod, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: method => {
|
|
@@ -522,36 +522,36 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
522
522
|
// Reset payment methods when switching tabs
|
|
523
523
|
resetPaymentMethods();
|
|
524
524
|
setSelectedFiatPaymentMethod(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
|
|
525
|
-
}, children: "Pay with fiat" })) : ((0, jsx_runtime_1.jsxs)(react_2.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_2.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "crypto", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)(
|
|
525
|
+
}, children: "Pay with fiat" })) : ((0, jsx_runtime_1.jsxs)(react_2.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_2.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)("button", { className: (0, utils_1.cn)("relative z-10 h-full w-full rounded-xl px-3 text-sm font-medium transition-colors duration-100", "text-as-primary/50 cursor-not-allowed bg-transparent"), disabled: true, children: "Pay with fiat" }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary w-[140px]", children: "Fiat payments are not supported for this amount" }) })] }))] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "crypto", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
526
526
|
opacity: hasMounted ? 1 : 0,
|
|
527
527
|
y: hasMounted ? 0 : 20,
|
|
528
528
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
529
|
-
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex
|
|
529
|
+
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), children: effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [connectedAddress ? ((0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry whitespace-nowrap", children: connectedName ? (0, utils_1.formatUsername)(connectedName) : (0, formatAddress_1.shortenAddress)(connectedAddress || "") })) : ((0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap", children: "Connect wallet" })), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap", children: "Transfer crypto" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap", children: "Select payment method" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), recipientSection, (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
530
530
|
opacity: hasMounted ? 1 : 0,
|
|
531
531
|
y: hasMounted ? 0 : 20,
|
|
532
532
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
533
533
|
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry text-sm", children: "Pay with" }), (0, jsx_runtime_1.jsx)(OrderToken_1.OrderToken, { address: currentWallet?.wallet?.address, context: "from", chainId: srcChainId, setChainId: setSrcChainId, token: srcToken, setToken: token => {
|
|
534
534
|
setDirtySelectSrcToken(true);
|
|
535
535
|
setSrcToken(token);
|
|
536
|
-
}, requiredAmount: srcAmount || undefined })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(
|
|
536
|
+
}, requiredAmount: srcAmount || undefined })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
537
537
|
opacity: hasMounted ? 1 : 0,
|
|
538
538
|
y: hasMounted ? 0 : 20,
|
|
539
539
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
540
|
-
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("
|
|
541
|
-
10000).toFixed(2), " ", "fee"] }))] })] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex w-full flex-col items-center justify-between gap-2"), children: (0, jsx_runtime_1.jsx)(
|
|
540
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry flex flex-wrap items-center gap-1.5 text-sm", children: [(0, jsx_runtime_1.jsxs)("span", { className: "whitespace-nowrap", children: ["Total ", (0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry", children: "(with fee)" })] }), anyspendQuote?.data?.fee && ((0, jsx_runtime_1.jsx)(react_2.TooltipProvider, { children: (0, jsx_runtime_1.jsxs)(react_2.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_2.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { side: "top", children: (0, jsx_runtime_1.jsx)(FeeBreakDown_1.FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-0.5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [renderPointsBadge(), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary whitespace-nowrap font-semibold", children: [formattedSrcAmount || "--", " ", srcToken.symbol] })] }), anyspendQuote?.data?.fee?.type === "standard_fee" && anyspendQuote.data.currencyIn?.amountUsd && ((0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary text-xs", children: ["incl. $", ((Number(anyspendQuote.data.currencyIn.amountUsd) * anyspendQuote.data.fee.finalFeeBps) /
|
|
541
|
+
10000).toFixed(2), " ", "fee"] }))] })] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex w-full flex-col items-center justify-between gap-2"), children: (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: false, animate: {
|
|
542
542
|
opacity: hasMounted ? 1 : 0,
|
|
543
543
|
y: hasMounted ? 0 : 20,
|
|
544
544
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
545
|
-
}, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Loading quote..." })] })) : !recipientAddress ? ("Select recipient") : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE ? ("Choose payment method") : anyspendQuote ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Checkout" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "fiat", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)(
|
|
545
|
+
}, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Loading quote..." })] })) : !recipientAddress ? ("Select recipient") : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE ? ("Choose payment method") : anyspendQuote ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Checkout" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "fiat", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex flex-col gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "border-as-border-secondary bg-as-surface-secondary flex w-full flex-col gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
546
546
|
opacity: hasMounted ? 1 : 0,
|
|
547
547
|
y: hasMounted ? 0 : 20,
|
|
548
548
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
549
|
-
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay with" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex
|
|
549
|
+
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay with" }), (0, jsx_runtime_1.jsx)("button", { className: "text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(PanelView.FIAT_PAYMENT_METHOD), children: selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 whitespace-nowrap", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: "C" }) }), "Coinbase Pay"] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) : selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 whitespace-nowrap", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-blue-600", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-bold text-white", children: "S" }) }), "Credit/Debit Card"] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "whitespace-nowrap", children: "Select payment method" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4 shrink-0" })] })) })] }), (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), recipientSection, (0, jsx_runtime_1.jsx)("div", { className: "divider w-full" }), (0, jsx_runtime_1.jsxs)(react_4.motion.div, { initial: false, animate: {
|
|
550
550
|
opacity: hasMounted ? 1 : 0,
|
|
551
551
|
y: hasMounted ? 0 : 20,
|
|
552
552
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
553
|
-
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("
|
|
554
|
-
1e6).toFixed(2), " ", "fee"] }))] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex w-full flex-col items-center justify-between gap-2"), children: (0, jsx_runtime_1.jsx)(
|
|
553
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-tertiarry flex flex-wrap items-center gap-1.5 text-sm", children: [(0, jsx_runtime_1.jsxs)("span", { className: "whitespace-nowrap", children: ["Total ", (0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry", children: "(USD)" })] }), anyspendQuote?.data?.fee && ((0, jsx_runtime_1.jsx)(react_2.TooltipProvider, { children: (0, jsx_runtime_1.jsxs)(react_2.Tooltip, { children: [(0, jsx_runtime_1.jsx)(react_2.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)("button", { className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }) }), (0, jsx_runtime_1.jsx)(react_2.TooltipContent, { side: "top", children: (0, jsx_runtime_1.jsx)(FeeBreakDown_1.FeeBreakDown, { fee: anyspendQuote.data.fee }) })] }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-0.5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [renderPointsBadge(), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary whitespace-nowrap text-xl font-semibold", children: ["$", srcFiatAmount || "0.00"] })] }), anyspendQuote?.data?.fee?.type === "stripeweb2_fee" && anyspendQuote.data.fee.originalAmount && ((0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary text-xs", children: ["incl. $", ((Number(anyspendQuote.data.fee.originalAmount) - Number(anyspendQuote.data.fee.finalAmount)) /
|
|
554
|
+
1e6).toFixed(2), " ", "fee"] }))] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex w-full flex-col items-center justify-between gap-2"), children: (0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: false, animate: {
|
|
555
555
|
opacity: hasMounted ? 1 : 0,
|
|
556
556
|
y: hasMounted ? 0 : 20,
|
|
557
557
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -570,7 +570,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
570
570
|
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
571
571
|
} }) }));
|
|
572
572
|
// Crypto payment method view
|
|
573
|
-
const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: (0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, {
|
|
573
|
+
const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4"), children: (0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { selectedPaymentMethod: effectiveCryptoPaymentMethod, setSelectedPaymentMethod: method => {
|
|
574
574
|
// When user explicitly selects a payment method, save it
|
|
575
575
|
setSelectedCryptoPaymentMethod(method);
|
|
576
576
|
}, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(PanelView.CONFIRM_ORDER), onSelectPaymentMethod: (method) => {
|
|
@@ -18,6 +18,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
18
18
|
destinationToken: components["schemas"]["Token"];
|
|
19
19
|
destinationChainId: number;
|
|
20
20
|
onSuccess?: (amount: string) => void;
|
|
21
|
+
onOpenCustomModal?: () => void;
|
|
21
22
|
mainFooter?: React.ReactNode;
|
|
22
23
|
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
23
24
|
preventDefault: () => void;
|
|
@@ -13,8 +13,8 @@ const invariant_1 = __importDefault(require("invariant"));
|
|
|
13
13
|
const lucide_react_1 = require("lucide-react");
|
|
14
14
|
const react_2 = require("motion/react");
|
|
15
15
|
const react_3 = require("react");
|
|
16
|
-
const sonner_1 = require("sonner");
|
|
17
16
|
const react_4 = require("thirdweb/react");
|
|
17
|
+
const constants_1 = require("../../constants");
|
|
18
18
|
const useAnyspendFlow_1 = require("../hooks/useAnyspendFlow");
|
|
19
19
|
const AnySpendFingerprintWrapper_1 = require("./AnySpendFingerprintWrapper");
|
|
20
20
|
const CryptoPaySection_1 = require("./common/CryptoPaySection");
|
|
@@ -31,7 +31,7 @@ function AnySpendCustomExactIn(props) {
|
|
|
31
31
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
32
32
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomExactInInner, { ...props }) }));
|
|
33
33
|
}
|
|
34
|
-
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, }) {
|
|
34
|
+
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, }) {
|
|
35
35
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
36
36
|
const DESTINATION_TOKEN_DETAILS = {
|
|
37
37
|
SYMBOL: destinationToken.symbol ?? "TOKEN",
|
|
@@ -88,6 +88,9 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
88
88
|
const btnInfo = (0, react_3.useMemo)(() => {
|
|
89
89
|
if (activeInputAmountInWei === "0")
|
|
90
90
|
return { text: "Enter an amount", disable: true, error: false, loading: false };
|
|
91
|
+
if (orderType === "hype_duel" && selectedSrcToken?.address?.toLowerCase() === constants_1.B3_TOKEN.address.toLowerCase()) {
|
|
92
|
+
return { text: "Convert to HYPE using B3", disable: false, error: false, loading: false };
|
|
93
|
+
}
|
|
91
94
|
if (isLoadingAnyspendQuote)
|
|
92
95
|
return { text: "Loading quote...", disable: true, error: false, loading: true };
|
|
93
96
|
if (isCreatingOrder || isCreatingOnrampOrder)
|
|
@@ -150,8 +153,13 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
150
153
|
minDestinationAmount,
|
|
151
154
|
DESTINATION_TOKEN_DETAILS.SYMBOL,
|
|
152
155
|
orderType,
|
|
156
|
+
selectedSrcToken,
|
|
153
157
|
]);
|
|
154
158
|
const onMainButtonClick = async () => {
|
|
159
|
+
if (orderType === "hype_duel" && selectedSrcToken?.address?.toLowerCase() === constants_1.B3_TOKEN.address.toLowerCase()) {
|
|
160
|
+
onOpenCustomModal?.();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
155
163
|
if (btnInfo.disable)
|
|
156
164
|
return;
|
|
157
165
|
if (!selectedRecipientOrDefault) {
|
|
@@ -199,7 +207,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
199
207
|
}
|
|
200
208
|
catch (err) {
|
|
201
209
|
console.error(err);
|
|
202
|
-
|
|
210
|
+
react_1.toast.error("Failed to create order: " + err.message);
|
|
203
211
|
}
|
|
204
212
|
};
|
|
205
213
|
const handleFiatOrder = async () => {
|
|
@@ -207,14 +215,14 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
207
215
|
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
208
216
|
(0, invariant_1.default)(selectedRecipientOrDefault, "Recipient address is not found");
|
|
209
217
|
if (!srcAmount || parseFloat(srcAmount) <= 0) {
|
|
210
|
-
|
|
218
|
+
react_1.toast.error("Please enter a valid amount");
|
|
211
219
|
return;
|
|
212
220
|
}
|
|
213
221
|
let vendor;
|
|
214
222
|
let paymentMethodString = "";
|
|
215
223
|
if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY) {
|
|
216
224
|
if (coinbaseAvailablePaymentMethods.length === 0) {
|
|
217
|
-
|
|
225
|
+
react_1.toast.error("Coinbase Pay not available");
|
|
218
226
|
return;
|
|
219
227
|
}
|
|
220
228
|
vendor = "coinbase";
|
|
@@ -222,13 +230,13 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
222
230
|
}
|
|
223
231
|
else if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.STRIPE) {
|
|
224
232
|
if (!stripeWeb2Support || !stripeWeb2Support.isSupport) {
|
|
225
|
-
|
|
233
|
+
react_1.toast.error("Stripe not available");
|
|
226
234
|
return;
|
|
227
235
|
}
|
|
228
236
|
vendor = "stripe-web2";
|
|
229
237
|
}
|
|
230
238
|
else {
|
|
231
|
-
|
|
239
|
+
react_1.toast.error("Please select a payment method");
|
|
232
240
|
return;
|
|
233
241
|
}
|
|
234
242
|
const payload = buildCustomPayload(selectedRecipientOrDefault);
|
|
@@ -251,7 +259,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
251
259
|
}
|
|
252
260
|
catch (err) {
|
|
253
261
|
console.error(err);
|
|
254
|
-
|
|
262
|
+
react_1.toast.error("Failed to create order: " + err.message);
|
|
255
263
|
}
|
|
256
264
|
};
|
|
257
265
|
const orderDetailsView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-[460px] max-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-col gap-4", children: oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: paymentType === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : effectiveCryptoPaymentMethod, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
|
|
@@ -263,7 +271,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
263
271
|
setSelectedRecipientAddress(address);
|
|
264
272
|
setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
|
|
265
273
|
} }));
|
|
266
|
-
const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, {
|
|
274
|
+
const cryptoPaymentMethodView = ((0, jsx_runtime_1.jsx)(CryptoPaymentMethod_1.CryptoPaymentMethod, { selectedPaymentMethod: selectedCryptoPaymentMethod, setSelectedPaymentMethod: setSelectedCryptoPaymentMethod, isCreatingOrder: isCreatingOrder, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN), onSelectPaymentMethod: (method) => {
|
|
267
275
|
setSelectedCryptoPaymentMethod(method);
|
|
268
276
|
setActivePanel(useAnyspendFlow_1.PanelView.MAIN);
|
|
269
277
|
} }));
|
|
@@ -13,7 +13,6 @@ const invariant_1 = __importDefault(require("invariant"));
|
|
|
13
13
|
const lucide_react_1 = require("lucide-react");
|
|
14
14
|
const react_2 = require("motion/react");
|
|
15
15
|
const react_3 = require("react");
|
|
16
|
-
const sonner_1 = require("sonner");
|
|
17
16
|
const viem_1 = require("viem");
|
|
18
17
|
const chains_1 = require("viem/chains");
|
|
19
18
|
const wagmi_1 = require("wagmi");
|
|
@@ -158,7 +157,7 @@ function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmo
|
|
|
158
157
|
});
|
|
159
158
|
// If allowance is insufficient, request approval first
|
|
160
159
|
if (allowance < BigInt(userStakeAmount)) {
|
|
161
|
-
|
|
160
|
+
react_1.toast.info("Approving B3 spending...");
|
|
162
161
|
const approvalData = (0, viem_1.encodeFunctionData)({
|
|
163
162
|
abi: viem_1.erc20Abi,
|
|
164
163
|
functionName: "approve",
|
|
@@ -170,7 +169,7 @@ function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmo
|
|
|
170
169
|
value: BigInt(0),
|
|
171
170
|
});
|
|
172
171
|
if (!approvalHash) {
|
|
173
|
-
|
|
172
|
+
react_1.toast.error("Approval failed. Please try again.");
|
|
174
173
|
return;
|
|
175
174
|
}
|
|
176
175
|
const approvalReceipt = await basePublicClient.waitForTransactionReceipt({
|
|
@@ -178,12 +177,12 @@ function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmo
|
|
|
178
177
|
confirmations: 1,
|
|
179
178
|
});
|
|
180
179
|
if (approvalReceipt?.status !== "success") {
|
|
181
|
-
|
|
180
|
+
react_1.toast.error("Approval failed. Please try again.");
|
|
182
181
|
return;
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
184
|
// Execute the stake
|
|
186
|
-
|
|
185
|
+
react_1.toast.info("Staking B3...");
|
|
187
186
|
const stakeData = (0, viem_1.encodeFunctionData)({
|
|
188
187
|
abi: anyspend_1.ABI_ERC20_STAKING,
|
|
189
188
|
functionName: "stake",
|
|
@@ -196,12 +195,12 @@ function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmo
|
|
|
196
195
|
});
|
|
197
196
|
if (stakeHash) {
|
|
198
197
|
setStakingTxHash(stakeHash);
|
|
199
|
-
|
|
198
|
+
react_1.toast.success("Staking transaction submitted!");
|
|
200
199
|
}
|
|
201
200
|
}
|
|
202
201
|
catch (error) {
|
|
203
202
|
console.error("@@b3-stake:error:", error);
|
|
204
|
-
|
|
203
|
+
react_1.toast.error("Staking failed. Please try again.");
|
|
205
204
|
setShowSuccessModal(false); // Ensure modal doesn't show on error
|
|
206
205
|
}
|
|
207
206
|
finally {
|
|
@@ -210,7 +209,7 @@ function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmo
|
|
|
210
209
|
};
|
|
211
210
|
const confirmAmount = () => {
|
|
212
211
|
if (!isAmountValid) {
|
|
213
|
-
|
|
212
|
+
react_1.toast.error("Please enter a valid amount to stake");
|
|
214
213
|
return;
|
|
215
214
|
}
|
|
216
215
|
// Check if user has sufficient B3 balance for direct staking
|
|
@@ -10,7 +10,6 @@ const number_1 = require("../../../shared/utils/number");
|
|
|
10
10
|
const lucide_react_1 = require("lucide-react");
|
|
11
11
|
const react_2 = require("motion/react");
|
|
12
12
|
const react_3 = require("react");
|
|
13
|
-
const sonner_1 = require("sonner");
|
|
14
13
|
const viem_1 = require("viem");
|
|
15
14
|
const chains_1 = require("viem/chains");
|
|
16
15
|
const wagmi_1 = require("wagmi");
|
|
@@ -160,7 +159,7 @@ function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress,
|
|
|
160
159
|
});
|
|
161
160
|
// If allowance is insufficient, request approval first
|
|
162
161
|
if (allowance < BigInt(userStakeAmount)) {
|
|
163
|
-
|
|
162
|
+
react_1.toast.info("Approving B3 spending...");
|
|
164
163
|
const approvalData = (0, viem_1.encodeFunctionData)({
|
|
165
164
|
abi: viem_1.erc20Abi,
|
|
166
165
|
functionName: "approve",
|
|
@@ -172,7 +171,7 @@ function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress,
|
|
|
172
171
|
value: BigInt(0),
|
|
173
172
|
});
|
|
174
173
|
if (!approvalHash) {
|
|
175
|
-
|
|
174
|
+
react_1.toast.error("Approval failed. Please try again.");
|
|
176
175
|
return;
|
|
177
176
|
}
|
|
178
177
|
const approvalReceipt = await basePublicClient.waitForTransactionReceipt({
|
|
@@ -180,12 +179,12 @@ function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress,
|
|
|
180
179
|
confirmations: 1,
|
|
181
180
|
});
|
|
182
181
|
if (approvalReceipt?.status !== "success") {
|
|
183
|
-
|
|
182
|
+
react_1.toast.error("Approval failed. Please try again.");
|
|
184
183
|
return;
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
// Execute the stake
|
|
188
|
-
|
|
187
|
+
react_1.toast.info("Staking B3...");
|
|
189
188
|
const stakeData = (0, viem_1.encodeFunctionData)({
|
|
190
189
|
abi: anyspend_1.ABI_ERC20_STAKING,
|
|
191
190
|
functionName: "stake",
|
|
@@ -198,12 +197,12 @@ function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress,
|
|
|
198
197
|
});
|
|
199
198
|
if (stakeHash) {
|
|
200
199
|
setStakingTxHash(stakeHash);
|
|
201
|
-
|
|
200
|
+
react_1.toast.success("Staking transaction submitted!");
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
catch (error) {
|
|
205
204
|
console.error("@@b3-stake-custom-exact-in:error:", error);
|
|
206
|
-
|
|
205
|
+
react_1.toast.error("Staking failed. Please try again.");
|
|
207
206
|
setShowSuccessModal(false); // Ensure modal doesn't show on error
|
|
208
207
|
}
|
|
209
208
|
finally {
|
|
@@ -212,7 +211,7 @@ function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress,
|
|
|
212
211
|
};
|
|
213
212
|
const confirmAmount = () => {
|
|
214
213
|
if (!isAmountValid) {
|
|
215
|
-
|
|
214
|
+
react_1.toast.error("Please enter a valid amount to stake");
|
|
216
215
|
return;
|
|
217
216
|
}
|
|
218
217
|
// Check if user has sufficient B3 balance for direct staking
|
|
@@ -11,6 +11,7 @@ export interface AnySpendDepositHypeProps {
|
|
|
11
11
|
sourceTokenAddress?: string;
|
|
12
12
|
sourceTokenChainId?: number;
|
|
13
13
|
onSuccess?: () => void;
|
|
14
|
+
onOpenCustomModal?: () => void;
|
|
14
15
|
mainFooter?: React.ReactNode;
|
|
15
16
|
/**
|
|
16
17
|
* Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
|
|
@@ -22,4 +23,4 @@ export interface AnySpendDepositHypeProps {
|
|
|
22
23
|
customUsdInputValues?: string[];
|
|
23
24
|
preferEoa?: boolean;
|
|
24
25
|
}
|
|
25
|
-
export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
+
export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -10,7 +10,7 @@ exports.HYPE_TOKEN_DETAILS = {
|
|
|
10
10
|
SYMBOL: "HYPE",
|
|
11
11
|
LOGO_URI: "https://cdn.hypeduel.com/hypes-coin.svg",
|
|
12
12
|
};
|
|
13
|
-
function AnySpendDepositHype({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }) {
|
|
13
|
+
function AnySpendDepositHype({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }) {
|
|
14
14
|
if (!recipientAddress)
|
|
15
15
|
return null;
|
|
16
16
|
const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }));
|
|
@@ -23,5 +23,5 @@ function AnySpendDepositHype({ loadOrder, mode = "modal", recipientAddress, paym
|
|
|
23
23
|
logoURI: exports.HYPE_TOKEN_DETAILS.LOGO_URI,
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: hypeToken, destinationChainId: chains_1.base.id, orderType: "hype_duel", minDestinationAmount: 10, header: header, onSuccess: onSuccess, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa }));
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: hypeToken, destinationChainId: chains_1.base.id, orderType: "hype_duel", minDestinationAmount: 10, header: header, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa }));
|
|
27
27
|
}
|
|
@@ -5,12 +5,6 @@ export declare enum CryptoPaymentMethodType {
|
|
|
5
5
|
TRANSFER_CRYPTO = "transfer_crypto"
|
|
6
6
|
}
|
|
7
7
|
interface CryptoPaymentMethodProps {
|
|
8
|
-
globalAddress?: string;
|
|
9
|
-
globalWallet?: {
|
|
10
|
-
meta?: {
|
|
11
|
-
icon?: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
8
|
selectedPaymentMethod: CryptoPaymentMethodType;
|
|
15
9
|
setSelectedPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
16
10
|
isCreatingOrder: boolean;
|