@b3dotfun/sdk 0.1.2 → 0.1.5
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.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +66 -15
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +185 -50
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/cjs/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/cjs/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/cjs/anyspend/react/components/types/classes.js +6 -0
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +119 -15
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.js +46 -0
- package/dist/cjs/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +12 -2
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +17 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +19 -152
- package/dist/cjs/global-account/react/components/index.d.ts +0 -1
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +2 -4
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +14 -31
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +8 -19
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +68 -17
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +189 -54
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/esm/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/esm/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/esm/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/esm/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/esm/anyspend/react/components/types/classes.js +5 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +119 -16
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.js +43 -0
- package/dist/esm/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/esm/anyspend/utils/format.js +12 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +16 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -153
- package/dist/esm/global-account/react/components/index.d.ts +0 -1
- package/dist/esm/global-account/react/components/index.js +0 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/esm/global-account/react/hooks/useAuth.js +14 -31
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +8 -19
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/types/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/types/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/types/global-account/react/components/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +8 -19
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +164 -36
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +11 -6
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +278 -69
- package/src/anyspend/react/components/AnySpendDeposit.tsx +176 -52
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/anyspend/react/components/QRDeposit.tsx +91 -35
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +31 -19
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +14 -4
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +43 -23
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +53 -32
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +26 -13
- package/src/anyspend/react/components/common/OrderDetails.tsx +20 -9
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +12 -7
- package/src/anyspend/react/components/common/OrderHistory.tsx +2 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +4 -1
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +118 -40
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +28 -14
- package/src/anyspend/react/components/common/RecipientSelection.tsx +20 -5
- package/src/anyspend/react/components/common/TabSection.tsx +21 -12
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +12 -4
- package/src/anyspend/react/components/common/WarningText.tsx +10 -10
- package/src/anyspend/react/components/index.ts +16 -0
- package/src/anyspend/react/components/types/classes.ts +476 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +141 -17
- package/src/anyspend/react/hooks/useDirectTransfer.ts +67 -0
- package/src/anyspend/react/hooks/useRecipientAddressState.ts +1 -1
- package/src/anyspend/utils/format.ts +13 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -5
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -4
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +1 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -11
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +0 -6
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +33 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +27 -184
- package/src/global-account/react/components/index.ts +0 -3
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +14 -31
- package/src/global-account/react/hooks/useTWAuth.tsx +3 -5
- package/src/global-account/react/stores/useModalStore.ts +7 -20
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +0 -86
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +0 -142
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +0 -83
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +0 -136
- package/dist/types/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/types/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/src/global-account/react/components/TurnkeyAuthModal.tsx +0 -243
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +0 -171
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SingleUserSearchSelector = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.
|
|
7
|
-
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter =
|
|
8
|
-
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast =
|
|
6
|
+
exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SingleUserSearchSelector = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.RelayKitProviderWrapper = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
7
|
+
exports.toast = exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = void 0;
|
|
8
|
+
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = void 0;
|
|
9
9
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
10
10
|
// Core Components
|
|
11
11
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
@@ -40,9 +40,6 @@ Object.defineProperty(exports, "LoginStepContainer", { enumerable: true, get: fu
|
|
|
40
40
|
var signInUtils_1 = require("./SignInWithB3/utils/signInUtils");
|
|
41
41
|
Object.defineProperty(exports, "getConnectOptionsFromStrategy", { enumerable: true, get: function () { return signInUtils_1.getConnectOptionsFromStrategy; } });
|
|
42
42
|
Object.defineProperty(exports, "isWalletType", { enumerable: true, get: function () { return signInUtils_1.isWalletType; } });
|
|
43
|
-
// Turnkey Components
|
|
44
|
-
var TurnkeyAuthModal_1 = require("./TurnkeyAuthModal");
|
|
45
|
-
Object.defineProperty(exports, "TurnkeyAuthModal", { enumerable: true, get: function () { return TurnkeyAuthModal_1.TurnkeyAuthModal; } });
|
|
46
43
|
// ManageAccount Components
|
|
47
44
|
var ManageAccount_1 = require("./ManageAccount/ManageAccount");
|
|
48
45
|
Object.defineProperty(exports, "ManageAccount", { enumerable: true, get: function () { return ManageAccount_1.ManageAccount; } });
|
|
@@ -41,7 +41,6 @@ export { useTokenFromUrl } from "./useTokenFromUrl";
|
|
|
41
41
|
export { useTokenPrice } from "./useTokenPrice";
|
|
42
42
|
export { useTokenPriceWithFallback } from "./useTokenPriceWithFallback";
|
|
43
43
|
export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
44
|
-
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
45
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
46
45
|
export { useURLParams } from "./useURLParams";
|
|
47
46
|
export { useUser } from "./useUser";
|
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.useUser =
|
|
17
|
+
exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimCollectibles = exports.useSimTokenBalance = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAuth = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = exports.createWagmiConfig = void 0;
|
|
18
|
+
exports.useUser = void 0;
|
|
19
19
|
var createWagmiConfig_1 = require("../utils/createWagmiConfig");
|
|
20
20
|
Object.defineProperty(exports, "createWagmiConfig", { enumerable: true, get: function () { return createWagmiConfig_1.createWagmiConfig; } });
|
|
21
21
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
@@ -107,8 +107,6 @@ var useTokenPriceWithFallback_1 = require("./useTokenPriceWithFallback");
|
|
|
107
107
|
Object.defineProperty(exports, "useTokenPriceWithFallback", { enumerable: true, get: function () { return useTokenPriceWithFallback_1.useTokenPriceWithFallback; } });
|
|
108
108
|
var useTokensFromAddress_1 = require("./useTokensFromAddress");
|
|
109
109
|
Object.defineProperty(exports, "useTokensFromAddress", { enumerable: true, get: function () { return useTokensFromAddress_1.useTokensFromAddress; } });
|
|
110
|
-
var useTurnkeyAuth_1 = require("./useTurnkeyAuth");
|
|
111
|
-
Object.defineProperty(exports, "useTurnkeyAuth", { enumerable: true, get: function () { return useTurnkeyAuth_1.useTurnkeyAuth; } });
|
|
112
110
|
var useUnifiedChainSwitchAndExecute_1 = require("./useUnifiedChainSwitchAndExecute");
|
|
113
111
|
Object.defineProperty(exports, "useUnifiedChainSwitchAndExecute", { enumerable: true, get: function () { return useUnifiedChainSwitchAndExecute_1.useUnifiedChainSwitchAndExecute; } });
|
|
114
112
|
var useURLParams_1 = require("./useURLParams");
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Wallet } from "thirdweb/wallets";
|
|
2
2
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
3
3
|
/**
|
|
4
|
-
* Unified authentication hook
|
|
5
|
-
* This replaces the previous Thirdweb-based authentication
|
|
4
|
+
* Unified authentication hook for B3
|
|
6
5
|
*
|
|
7
6
|
* This hook provides 1:1 feature parity with useAuthentication.ts
|
|
8
7
|
*/
|
|
9
8
|
export declare function useAuth(): {
|
|
10
|
-
authenticate: (
|
|
9
|
+
authenticate: (accessToken: string, partnerId: string, strategy?: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
11
10
|
reAuthenticate: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
12
11
|
logout: (callback?: () => void) => Promise<void>;
|
|
13
12
|
isAuthenticated: boolean;
|
|
@@ -22,8 +22,7 @@ const useSearchParamsSSR_1 = require("./useSearchParamsSSR");
|
|
|
22
22
|
const useUserQuery_1 = require("./useUserQuery");
|
|
23
23
|
const debug = (0, debug_1.debugB3React)("useAuth");
|
|
24
24
|
/**
|
|
25
|
-
* Unified authentication hook
|
|
26
|
-
* This replaces the previous Thirdweb-based authentication
|
|
25
|
+
* Unified authentication hook for B3
|
|
27
26
|
*
|
|
28
27
|
* This hook provides 1:1 feature parity with useAuthentication.ts
|
|
29
28
|
*/
|
|
@@ -134,12 +133,8 @@ function useAuth() {
|
|
|
134
133
|
syncWagmi();
|
|
135
134
|
}, [wallets, syncWagmi]);
|
|
136
135
|
/**
|
|
137
|
-
* Authenticate user
|
|
138
|
-
*
|
|
139
|
-
* Wallets are still used for signing transactions, but authentication is done via Turnkey email OTP.
|
|
140
|
-
*
|
|
141
|
-
* For backward compatibility, this function still accepts a wallet parameter,
|
|
142
|
-
* but it's not used for authentication anymore.
|
|
136
|
+
* Authenticate user
|
|
137
|
+
* Attempts to re-authenticate using existing session
|
|
143
138
|
*/
|
|
144
139
|
const authenticateUser = (0, react_2.useCallback)(async () => {
|
|
145
140
|
setHasStartedConnecting(true);
|
|
@@ -156,33 +151,31 @@ function useAuth() {
|
|
|
156
151
|
return userAuth;
|
|
157
152
|
}
|
|
158
153
|
catch (error) {
|
|
159
|
-
// If re-authentication fails, user needs to authenticate
|
|
160
|
-
|
|
161
|
-
debug("Re-authentication failed. User needs to authenticate via Turnkey.", error);
|
|
154
|
+
// If re-authentication fails, user needs to authenticate
|
|
155
|
+
debug("Re-authentication failed. User needs to authenticate.", error);
|
|
162
156
|
setIsAuthenticated(false);
|
|
163
157
|
setIsAuthenticating(false);
|
|
164
|
-
throw new Error("Authentication required. Please authenticate
|
|
158
|
+
throw new Error("Authentication required. Please authenticate.");
|
|
165
159
|
}
|
|
166
160
|
}, [reAuthenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
|
|
167
161
|
/**
|
|
168
|
-
* Authenticate with
|
|
169
|
-
* This is the primary authentication method, replacing Thirdweb wallet-based auth
|
|
162
|
+
* Authenticate with B3
|
|
170
163
|
*
|
|
171
164
|
* This function:
|
|
172
165
|
* 1. Authenticates with FeathersJS (persists session via cookies)
|
|
173
166
|
* 2. Sets user state in the user store (persists to localStorage)
|
|
174
167
|
* 3. Authenticates with BSMNT for basement integration
|
|
175
168
|
*/
|
|
176
|
-
const authenticate = (0, react_2.useCallback)(async (
|
|
177
|
-
if (!
|
|
178
|
-
throw new Error("
|
|
169
|
+
const authenticate = (0, react_2.useCallback)(async (accessToken, partnerId, strategy = "thirdweb-jwt") => {
|
|
170
|
+
if (!accessToken) {
|
|
171
|
+
throw new Error("Access token is required");
|
|
179
172
|
}
|
|
180
|
-
debug("Authenticating with
|
|
173
|
+
debug("Authenticating with B3", { referralCode, partnerId, strategy });
|
|
181
174
|
try {
|
|
182
175
|
// Step 1: Authenticate with FeathersJS (session persisted via cookies)
|
|
183
176
|
const response = await app_1.default.authenticate({
|
|
184
|
-
strategy
|
|
185
|
-
accessToken
|
|
177
|
+
strategy,
|
|
178
|
+
accessToken,
|
|
186
179
|
referralCode,
|
|
187
180
|
partnerId: partnerId,
|
|
188
181
|
});
|
|
@@ -210,13 +203,6 @@ function useAuth() {
|
|
|
210
203
|
}, [referralCode, setUser]);
|
|
211
204
|
/**
|
|
212
205
|
* Handle wallet connection
|
|
213
|
-
* Note: With Turnkey migration, wallet connection is primarily for signing transactions,
|
|
214
|
-
* not for authentication. Authentication should be done separately via Turnkey email OTP.
|
|
215
|
-
*/
|
|
216
|
-
/**
|
|
217
|
-
* Handle wallet connection
|
|
218
|
-
* Note: With Turnkey migration, wallet connection is primarily for signing transactions,
|
|
219
|
-
* not for authentication. Authentication should be done separately via Turnkey email OTP.
|
|
220
206
|
*/
|
|
221
207
|
const onConnect = (0, react_2.useCallback)(async (_walleAutoConnectedWith, allConnectedWallets) => {
|
|
222
208
|
debug("@@useAuth:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
@@ -231,7 +217,6 @@ function useAuth() {
|
|
|
231
217
|
setIsAuthenticating(true);
|
|
232
218
|
await setActiveWallet(wallet);
|
|
233
219
|
// Try to authenticate user (will use re-authenticate if session exists)
|
|
234
|
-
// If no session exists, authentication will need to happen via Turnkey flow
|
|
235
220
|
try {
|
|
236
221
|
const userAuth = await authenticateUser();
|
|
237
222
|
if (userAuth && onConnectCallback) {
|
|
@@ -239,10 +224,8 @@ function useAuth() {
|
|
|
239
224
|
}
|
|
240
225
|
}
|
|
241
226
|
catch (authError) {
|
|
242
|
-
// Authentication failed -
|
|
243
|
-
// The Turnkey auth modal should handle this
|
|
227
|
+
// Authentication failed - user needs to authenticate
|
|
244
228
|
debug("@@useAuth:onConnect:authFailed", { authError });
|
|
245
|
-
// Don't set isAuthenticated to false here - let the Turnkey flow handle it
|
|
246
229
|
}
|
|
247
230
|
}
|
|
248
231
|
catch (error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Wallet } from "thirdweb/wallets";
|
|
2
2
|
/**
|
|
3
|
-
* @deprecated Use useAuth()
|
|
3
|
+
* @deprecated Use useAuth() instead
|
|
4
4
|
*/
|
|
5
5
|
export declare function useTWAuth(): {
|
|
6
6
|
authenticate: (wallet: Wallet, partnerId: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useTWAuth = useTWAuth;
|
|
7
7
|
/**
|
|
8
|
-
* @deprecated This hook is deprecated. Use useAuth()
|
|
8
|
+
* @deprecated This hook is deprecated. Use useAuth() instead.
|
|
9
9
|
* This file is kept for backward compatibility but should not be used in new code.
|
|
10
10
|
*/
|
|
11
11
|
const app_1 = __importDefault(require("../../../global-account/app"));
|
|
@@ -13,10 +13,10 @@ const debug_1 = __importDefault(require("../../../shared/utils/debug"));
|
|
|
13
13
|
const react_1 = require("react");
|
|
14
14
|
const useSearchParamsSSR_1 = require("./useSearchParamsSSR");
|
|
15
15
|
/**
|
|
16
|
-
* @deprecated Use useAuth()
|
|
16
|
+
* @deprecated Use useAuth() instead
|
|
17
17
|
*/
|
|
18
18
|
function useTWAuth() {
|
|
19
|
-
console.warn("useTWAuth is deprecated. Please migrate to useAuth()
|
|
19
|
+
console.warn("useTWAuth is deprecated. Please migrate to useAuth() for authentication.");
|
|
20
20
|
const referralCode = (0, useSearchParamsSSR_1.useSearchParam)("referralCode");
|
|
21
21
|
const authenticate = (0, react_1.useCallback)(async (wallet, partnerId) => {
|
|
22
22
|
if (!wallet || !wallet?.getAuthToken?.())
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnySpendAllClasses } from "../../../anyspend/react";
|
|
1
2
|
import { components } from "../../../anyspend/types/api";
|
|
2
3
|
import { GenerateSigMintResponse } from "../../../anyspend/types/signatureMint";
|
|
3
4
|
import { AllowedStrategy } from "../../../global-account/react";
|
|
@@ -41,24 +42,6 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
41
42
|
/** Whether to show the signers enabled modal */
|
|
42
43
|
signersEnabled?: boolean;
|
|
43
44
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Props for the Turnkey Authentication modal
|
|
46
|
-
* Handles Turnkey email/OTP authentication flow
|
|
47
|
-
*/
|
|
48
|
-
export interface TurnkeyAuthModalProps extends BaseModalProps {
|
|
49
|
-
/** Modal type identifier */
|
|
50
|
-
type: "turnkeyAuth";
|
|
51
|
-
/** Callback function called when authentication is successful */
|
|
52
|
-
onSuccess: (_user: any) => void;
|
|
53
|
-
/** Callback function called when modal is closed */
|
|
54
|
-
onClose: () => void;
|
|
55
|
-
/** Initial email to pre-fill */
|
|
56
|
-
initialEmail?: string;
|
|
57
|
-
/** Whether to skip directly to OTP step */
|
|
58
|
-
skipToOtp?: boolean;
|
|
59
|
-
/** Whether the modal can be closed - defaults to false for Turnkey */
|
|
60
|
-
closable?: boolean;
|
|
61
|
-
}
|
|
62
45
|
/**
|
|
63
46
|
* Props for the Request Permissions modal
|
|
64
47
|
* Used to request permission for session keys to interact with contracts
|
|
@@ -305,6 +288,8 @@ export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
|
305
288
|
depositContractAddress: string;
|
|
306
289
|
/** Token to deposit */
|
|
307
290
|
token: components["schemas"]["Token"];
|
|
291
|
+
/** The exact amount of destination tokens to receive, in wei. This will pre-fill the output amount and switch to an exact output swap. */
|
|
292
|
+
destinationTokenAmount?: string;
|
|
308
293
|
/** Callback function called when the deposit is successful */
|
|
309
294
|
onSuccess?: () => void;
|
|
310
295
|
}
|
|
@@ -541,11 +526,15 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
541
526
|
returnHomeLabel?: string;
|
|
542
527
|
/** Whether the deposit requires a custom function (uses AnySpendCustomExactIn). Defaults to false. */
|
|
543
528
|
isCustomDeposit?: boolean;
|
|
529
|
+
/** Custom class names for styling specific elements */
|
|
530
|
+
classes?: AnySpendAllClasses;
|
|
531
|
+
/** Whether to allow direct transfer without swap */
|
|
532
|
+
allowDirectTransfer?: boolean;
|
|
544
533
|
}
|
|
545
534
|
/**
|
|
546
535
|
* Union type of all possible modal content types
|
|
547
536
|
*/
|
|
548
|
-
export type ModalContentType = SignInWithB3ModalProps |
|
|
537
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | LinkNewAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | DepositModalProps | SendModalProps | NotificationsModalProps | AnySpendCollectorClubPurchaseProps | AnySpendDepositModalProps;
|
|
549
538
|
/**
|
|
550
539
|
* State interface for the modal store
|
|
551
540
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { components } from "../../types/api";
|
|
2
|
+
import type { AnySpendClasses } from "./types/classes";
|
|
2
3
|
export interface RecipientOption {
|
|
3
4
|
address: string;
|
|
4
5
|
icon?: string;
|
|
@@ -15,7 +16,8 @@ export declare enum PanelView {
|
|
|
15
16
|
CRYPTO_PAYMENT_METHOD = 6,
|
|
16
17
|
FIAT_PAYMENT_METHOD = 7,
|
|
17
18
|
POINTS_DETAIL = 8,
|
|
18
|
-
FEE_DETAIL = 9
|
|
19
|
+
FEE_DETAIL = 9,
|
|
20
|
+
DIRECT_TRANSFER_SUCCESS = 10
|
|
19
21
|
}
|
|
20
22
|
export declare function AnySpend(props: {
|
|
21
23
|
mode?: "page" | "modal";
|
|
@@ -45,4 +47,8 @@ export declare function AnySpend(props: {
|
|
|
45
47
|
customRecipientLabel?: string;
|
|
46
48
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
47
49
|
returnHomeLabel?: string;
|
|
50
|
+
/** Custom class names for styling specific elements */
|
|
51
|
+
classes?: AnySpendClasses;
|
|
52
|
+
/** When true, allows direct transfer without swap if source and destination token/chain are the same */
|
|
53
|
+
allowDirectTransfer?: boolean;
|
|
48
54
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { eqci, getDefaultToken, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, HYPERLIQUID_USDC_ADDRESS, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
|
|
3
|
+
import { eqci, getChainName, getDefaultToken, getExplorerTxUrl, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, HYPERLIQUID_USDC_ADDRESS, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGasPrice, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
5
|
import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet, useB3Config, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
6
|
import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
|
|
@@ -9,7 +9,7 @@ import { getThirdwebChain } from "../../../shared/constants/chains/supported.js"
|
|
|
9
9
|
import { cn } from "../../../shared/utils/cn.js";
|
|
10
10
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
11
11
|
import invariant from "invariant";
|
|
12
|
-
import { ArrowDown, HistoryIcon, Loader2 } from "lucide-react";
|
|
12
|
+
import { ArrowDown, CheckCircle, HistoryIcon, Loader2 } from "lucide-react";
|
|
13
13
|
import { motion } from "motion/react";
|
|
14
14
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
15
15
|
import { parseUnits } from "viem";
|
|
@@ -17,6 +17,7 @@ import { base, mainnet } from "viem/chains";
|
|
|
17
17
|
import { useAutoSelectCryptoPaymentMethod } from "../hooks/useAutoSelectCryptoPaymentMethod.js";
|
|
18
18
|
import { useConnectedWalletDisplay } from "../hooks/useConnectedWalletDisplay.js";
|
|
19
19
|
import { useCryptoPaymentMethodState } from "../hooks/useCryptoPaymentMethodState.js";
|
|
20
|
+
import { useDirectTransfer } from "../hooks/useDirectTransfer.js";
|
|
20
21
|
import { useRecipientAddressState } from "../hooks/useRecipientAddressState.js";
|
|
21
22
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
|
|
22
23
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
|
|
@@ -45,17 +46,20 @@ export var PanelView;
|
|
|
45
46
|
PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 7] = "FIAT_PAYMENT_METHOD";
|
|
46
47
|
PanelView[PanelView["POINTS_DETAIL"] = 8] = "POINTS_DETAIL";
|
|
47
48
|
PanelView[PanelView["FEE_DETAIL"] = 9] = "FEE_DETAIL";
|
|
49
|
+
PanelView[PanelView["DIRECT_TRANSFER_SUCCESS"] = 10] = "DIRECT_TRANSFER_SUCCESS";
|
|
48
50
|
})(PanelView || (PanelView = {}));
|
|
49
51
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
50
52
|
export function AnySpend(props) {
|
|
51
53
|
const fingerprintConfig = getFingerprintConfig();
|
|
54
|
+
console.log("[mitch] AnySpend rendered with fingerprintConfig:", props, fingerprintConfig);
|
|
52
55
|
return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
|
|
53
56
|
}
|
|
54
|
-
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }) {
|
|
57
|
+
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, }) {
|
|
55
58
|
const searchParams = useSearchParamsSSR();
|
|
56
59
|
const router = useRouter();
|
|
57
60
|
const { partnerId } = useB3Config();
|
|
58
61
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
62
|
+
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
59
63
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
60
64
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
61
65
|
// Add refs to track URL state
|
|
@@ -69,6 +73,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
69
73
|
const previousPanel = useRef(PanelView.MAIN);
|
|
70
74
|
const [activeTab, setActiveTab] = useState(defaultActiveTab);
|
|
71
75
|
const [orderId, setOrderId] = useState(loadOrder);
|
|
76
|
+
const [directTransferTxHash, setDirectTransferTxHash] = useState();
|
|
72
77
|
const { orderAndTransactions: oat, getOrderAndTransactionsError } = useAnyspendOrderAndTransactions(orderId);
|
|
73
78
|
!!getOrderAndTransactionsError && console.log("getOrderAndTransactionsError", getOrderAndTransactionsError);
|
|
74
79
|
const [activePanel, setActivePanel] = useState(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
|
|
@@ -327,6 +332,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
327
332
|
// [selectedDstChainId, newRecipientAddress, resolvedAddress]
|
|
328
333
|
// );
|
|
329
334
|
const { address: globalAddress, wallet: globalWallet, connectedEOAWallet } = useAccountWallet();
|
|
335
|
+
const { executeDirectTransfer, isTransferring: isSwitchingOrExecuting } = useDirectTransfer();
|
|
330
336
|
const globalWalletImage = useAccountWalletImage();
|
|
331
337
|
// Get wallet address based on selected payment method
|
|
332
338
|
const { walletAddress } = useConnectedWalletDisplay(effectiveCryptoPaymentMethod);
|
|
@@ -526,19 +532,26 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
526
532
|
selectedSrcChainId === selectedDstChainId &&
|
|
527
533
|
selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase());
|
|
528
534
|
}, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
|
|
535
|
+
// Check if this is a direct transfer (same chain/token with allowDirectTransfer enabled)
|
|
536
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
529
537
|
// Determine button state and text
|
|
530
538
|
const btnInfo = useMemo(() => {
|
|
531
539
|
// For fiat tab, check srcAmountOnRamp; for crypto tab, check activeInputAmountInWei
|
|
532
540
|
const hasAmount = activeTab === "fiat" ? srcAmountOnRamp && parseFloat(srcAmountOnRamp) > 0 : activeInputAmountInWei !== "0";
|
|
533
541
|
if (!hasAmount)
|
|
534
542
|
return { text: "Enter an amount", disable: true, error: false, loading: false };
|
|
535
|
-
if (isSameChainSameToken)
|
|
543
|
+
if (isSameChainSameToken && !allowDirectTransfer)
|
|
536
544
|
return { text: "Select a different token or chain", disable: true, error: false, loading: false };
|
|
537
|
-
if (isLoadingAnyspendQuote)
|
|
545
|
+
if (isLoadingAnyspendQuote && !isSameChainSameToken)
|
|
538
546
|
return { text: "Loading quote...", disable: true, error: false, loading: true };
|
|
539
|
-
if (isCreatingOrder || isCreatingOnrampOrder)
|
|
540
|
-
return {
|
|
541
|
-
|
|
547
|
+
if (isCreatingOrder || isCreatingOnrampOrder || isSwitchingOrExecuting)
|
|
548
|
+
return {
|
|
549
|
+
text: isSwitchingOrExecuting ? "Transferring..." : "Creating order...",
|
|
550
|
+
disable: true,
|
|
551
|
+
error: false,
|
|
552
|
+
loading: true,
|
|
553
|
+
};
|
|
554
|
+
if ((!anyspendQuote || !anyspendQuote.success) && !(isSameChainSameToken && allowDirectTransfer))
|
|
542
555
|
return { text: "No quote found", disable: true, error: false, loading: false };
|
|
543
556
|
if (activeTab === "fiat") {
|
|
544
557
|
// For fiat: check recipient first, then payment method
|
|
@@ -563,7 +576,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
563
576
|
// If payment method selected, show appropriate action
|
|
564
577
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
565
578
|
effectiveCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
566
|
-
|
|
579
|
+
const buttonText = isSameChainSameToken && allowDirectTransfer ? "Transfer" : "Swap";
|
|
580
|
+
return { text: buttonText, disable: false, error: false, loading: false };
|
|
567
581
|
}
|
|
568
582
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
569
583
|
return { text: "Continue to payment", disable: false, error: false, loading: false };
|
|
@@ -577,18 +591,24 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
577
591
|
effectiveRecipientAddress,
|
|
578
592
|
isCreatingOrder,
|
|
579
593
|
isCreatingOnrampOrder,
|
|
594
|
+
isSwitchingOrExecuting,
|
|
580
595
|
anyspendQuote,
|
|
581
596
|
activeTab,
|
|
582
597
|
effectiveCryptoPaymentMethod,
|
|
583
598
|
selectedFiatPaymentMethod,
|
|
584
599
|
srcAmountOnRamp,
|
|
600
|
+
allowDirectTransfer,
|
|
585
601
|
]);
|
|
586
602
|
// Handle main button click
|
|
587
603
|
const onMainButtonClick = async () => {
|
|
588
604
|
if (btnInfo.disable)
|
|
589
605
|
return;
|
|
606
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
590
607
|
try {
|
|
591
|
-
|
|
608
|
+
// Only require quote for non-direct transfers
|
|
609
|
+
if (!isDirectTransfer) {
|
|
610
|
+
invariant(anyspendQuote, "Relay price is not found");
|
|
611
|
+
}
|
|
592
612
|
if (activeTab === "fiat") {
|
|
593
613
|
// For fiat: check recipient first
|
|
594
614
|
if (!effectiveRecipientAddress) {
|
|
@@ -652,12 +672,29 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
652
672
|
// Handle crypto swap creation
|
|
653
673
|
const handleCryptoSwap = async (method) => {
|
|
654
674
|
try {
|
|
655
|
-
|
|
675
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
656
676
|
invariant(effectiveRecipientAddress, "Recipient address is not found");
|
|
677
|
+
const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
678
|
+
// Handle direct transfer (same chain/token) - bypass backend, transfer directly
|
|
679
|
+
if (isDirectTransfer) {
|
|
680
|
+
const txHash = await executeDirectTransfer({
|
|
681
|
+
chainId: selectedSrcChainId,
|
|
682
|
+
tokenAddress: selectedSrcToken.address,
|
|
683
|
+
recipientAddress: effectiveRecipientAddress,
|
|
684
|
+
amount: srcAmountBigInt,
|
|
685
|
+
method,
|
|
686
|
+
});
|
|
687
|
+
if (txHash) {
|
|
688
|
+
setDirectTransferTxHash(txHash);
|
|
689
|
+
navigateToPanel(PanelView.DIRECT_TRANSFER_SUCCESS, "forward");
|
|
690
|
+
}
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
// Regular swap flow - use backend
|
|
694
|
+
invariant(anyspendQuote, "Relay price is not found");
|
|
657
695
|
// Debug: Check payment method values
|
|
658
696
|
console.log("handleCryptoSwap - method parameter:", method);
|
|
659
697
|
console.log("handleCryptoSwap - selectedCryptoPaymentMethod state:", selectedCryptoPaymentMethod);
|
|
660
|
-
const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
661
698
|
createOrder({
|
|
662
699
|
recipientAddress: effectiveRecipientAddress,
|
|
663
700
|
orderType: "swap",
|
|
@@ -825,7 +862,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
825
862
|
// Reset payment methods when going back
|
|
826
863
|
resetPaymentMethods();
|
|
827
864
|
}, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel, disableUrlParamManagement: disableUrlParamManagement })) }) }));
|
|
828
|
-
const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
865
|
+
const mainView = (_jsxs("div", { className: classes?.mainContent || "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [_jsxs("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && (_jsxs("div", { className: classes?.header || "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
829
866
|
setActiveTab(tab);
|
|
830
867
|
// Reset payment methods when switching tabs
|
|
831
868
|
resetPaymentMethods();
|
|
@@ -839,7 +876,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
839
876
|
else {
|
|
840
877
|
setActivePanel(panelIndex);
|
|
841
878
|
}
|
|
842
|
-
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues, customRecipientLabel: customRecipientLabel }) })), activeTab === "crypto" && (_jsx("div", { className: "z-10 -my-6 flex justify-center", children: _jsx(Button, { variant: "ghost", className:
|
|
879
|
+
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues, customRecipientLabel: customRecipientLabel }) })), activeTab === "crypto" && (_jsx("div", { className: "z-10 -my-6 flex justify-center", children: _jsx(Button, { variant: "ghost", className: classes?.swapDirectionButton ||
|
|
880
|
+
cn("border-as-stroke bg-as-surface-primary h-10 w-10 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "cursor-default", selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50"), onClick: () => {
|
|
843
881
|
if (isBuyMode) {
|
|
844
882
|
return;
|
|
845
883
|
}
|
|
@@ -859,7 +897,11 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
859
897
|
}, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) })), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, effectiveRecipientAddress: effectiveRecipientAddress, recipientName: recipientName || undefined, customRecipientLabel: customRecipientLabel, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
860
898
|
setIsSrcInputDirty(false);
|
|
861
899
|
setDstAmount(value);
|
|
862
|
-
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), gasPriceData && !isLoadingGas && activeTab === "crypto" && (_jsx(GasIndicator, { gasPrice: gasPriceData, className: "mt-2 w-full" })), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className:
|
|
900
|
+
}, anyspendQuote: isDirectTransfer ? undefined : anyspendQuote, onShowPointsDetail: isDirectTransfer ? undefined : () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: isDirectTransfer ? undefined : () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), gasPriceData && !isLoadingGas && activeTab === "crypto" && !isDirectTransfer && (_jsx(GasIndicator, { gasPrice: gasPriceData, className: classes?.gasIndicator || "mt-2 w-full" })), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (btnInfo.error && classes?.mainButtonError) ||
|
|
901
|
+
(btnInfo.disable && classes?.mainButtonDisabled) ||
|
|
902
|
+
classes?.mainButton ||
|
|
903
|
+
cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || effectiveRecipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: classes?.historyButton ||
|
|
904
|
+
"text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }), _jsx("div", { className: "w-full", children: _jsx(TabsPrimitive, { defaultValue: "swap", onValueChange: value => {
|
|
863
905
|
if (value === "settings" || value === "home") {
|
|
864
906
|
setB3ModalContentType({
|
|
865
907
|
type: "manageAccount",
|
|
@@ -911,9 +953,17 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
911
953
|
}, srcAmountOnRamp: srcAmountOnRamp }));
|
|
912
954
|
const pointsDetailView = (_jsx(PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: navigateBack }));
|
|
913
955
|
const feeDetailView = anyspendQuote?.data?.fee ? (_jsx(FeeDetailPanel, { fee: anyspendQuote.data.fee, transactionAmountUsd: activeTab === "crypto" ? Number(anyspendQuote.data.currencyIn?.amountUsd) : parseFloat(srcAmountOnRamp), onBack: navigateBack })) : null;
|
|
956
|
+
const directTransferSuccessView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-6 p-5", children: [_jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsx("div", { className: "bg-as-brand/10 flex h-16 w-16 items-center justify-center rounded-full", children: _jsx(CheckCircle, { className: "text-as-brand h-8 w-8" }) }), _jsxs("div", { className: "text-center", children: [_jsx("h2", { className: "text-as-primary text-xl font-bold", children: "Transfer Complete" }), _jsxs("p", { className: "text-as-secondary mt-1 text-sm", children: ["Your ", selectedSrcToken.symbol, " has been sent to ", effectiveRecipientAddress?.slice(0, 6), "...", effectiveRecipientAddress?.slice(-4), " on ", getChainName(selectedSrcChainId)] })] })] }), directTransferTxHash && (_jsx("a", { href: getExplorerTxUrl(selectedSrcChainId, directTransferTxHash), target: "_blank", rel: "noopener noreferrer", className: "text-as-brand hover:text-as-brand/80 text-sm underline", children: "View transaction" })), _jsx("div", { className: "flex w-full flex-col gap-2", children: returnToHomeUrl ? (_jsx(Button, { onClick: () => {
|
|
957
|
+
window.location.href = returnToHomeUrl;
|
|
958
|
+
}, className: "bg-as-brand hover:bg-as-brand/90 w-full text-white", children: returnHomeLabel || "Return to Home" })) : (_jsx(Button, { onClick: () => {
|
|
959
|
+
onSuccess?.(directTransferTxHash);
|
|
960
|
+
setDirectTransferTxHash(undefined);
|
|
961
|
+
setB3ModalOpen(false);
|
|
962
|
+
}, className: "bg-as-brand hover:bg-as-brand/90 w-full text-white", children: returnHomeLabel || "Done" })) })] }));
|
|
914
963
|
// Add tabs to the main component when no order is loaded
|
|
915
|
-
return (_jsx(StyleRoot, { children: _jsx("div", { className:
|
|
916
|
-
"
|
|
964
|
+
return (_jsx(StyleRoot, { children: _jsx("div", { className: classes?.container ||
|
|
965
|
+
cn("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
|
|
966
|
+
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
|
|
917
967
|
? oat
|
|
918
968
|
? PanelView.ORDER_DETAILS
|
|
919
969
|
: PanelView.LOADING
|
|
@@ -942,5 +992,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
942
992
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: fiatPaymentMethodView }, "fiat-payment-method-view"),
|
|
943
993
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
|
|
944
994
|
_jsx("div", { className: cn(mode === "page" && "p-6"), children: feeDetailView }, "fee-detail-view"),
|
|
995
|
+
_jsx("div", { className: cn(mode === "page" && "p-6"), children: directTransferSuccessView }, "direct-transfer-success-view"),
|
|
945
996
|
] }) }) }));
|
|
946
997
|
}
|
|
@@ -35,9 +35,13 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
35
35
|
*/
|
|
36
36
|
recipientAddress: string;
|
|
37
37
|
/**
|
|
38
|
-
* Optional spender address (defaults to
|
|
38
|
+
* Optional spender address (defaults to shop address)
|
|
39
39
|
*/
|
|
40
40
|
spenderAddress?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Collector Club Shop contract address (defaults to Base mainnet shop)
|
|
43
|
+
*/
|
|
44
|
+
ccShopAddress?: string;
|
|
41
45
|
/**
|
|
42
46
|
* Success callback
|
|
43
47
|
*/
|
|
@@ -66,4 +70,4 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
66
70
|
*/
|
|
67
71
|
forceFiatPayment?: boolean;
|
|
68
72
|
}
|
|
69
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, ccShopAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -30,8 +30,8 @@ import { formatUnits } from "../../../shared/utils/number.js";
|
|
|
30
30
|
import { useMemo } from "react";
|
|
31
31
|
import { encodeFunctionData } from "viem";
|
|
32
32
|
import { AnySpendCustom } from "./AnySpendCustom.js";
|
|
33
|
-
// Collector Club Shop contract on Base
|
|
34
|
-
const
|
|
33
|
+
// Default Collector Club Shop contract on Base
|
|
34
|
+
const DEFAULT_CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
|
|
35
35
|
const BASE_CHAIN_ID = 8453;
|
|
36
36
|
// ABI for buyPacksFor function only
|
|
37
37
|
const BUY_PACKS_FOR_ABI = {
|
|
@@ -45,7 +45,7 @@ const BUY_PACKS_FOR_ABI = {
|
|
|
45
45
|
stateMutability: "nonpayable",
|
|
46
46
|
type: "function",
|
|
47
47
|
};
|
|
48
|
-
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress,
|
|
48
|
+
export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = USDC_BASE, recipientAddress, ccShopAddress = DEFAULT_CC_SHOP_ADDRESS, spenderAddress, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
|
|
49
49
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
50
50
|
const totalAmount = useMemo(() => {
|
|
51
51
|
try {
|
|
@@ -78,7 +78,7 @@ export function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activ
|
|
|
78
78
|
}, [recipientAddress, packId, packAmount]);
|
|
79
79
|
// Default header if not provided
|
|
80
80
|
const defaultHeader = () => (_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsxs("div", { children: [_jsx("h1", { className: "text-as-primary text-xl font-bold", children: "Buy Collector Club Packs" }), _jsxs("p", { className: "text-as-secondary text-sm", children: ["Purchase ", packAmount, " pack", packAmount !== 1 ? "s" : "", " using any token"] })] }) }));
|
|
81
|
-
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: activeTab, recipientAddress: recipientAddress, spenderAddress: spenderAddress, orderType: "custom", dstChainId: BASE_CHAIN_ID, dstToken: paymentToken, dstAmount: totalAmount, contractAddress:
|
|
81
|
+
return (_jsx(AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: activeTab, recipientAddress: recipientAddress, spenderAddress: spenderAddress ?? ccShopAddress, orderType: "custom", dstChainId: BASE_CHAIN_ID, dstToken: paymentToken, dstAmount: totalAmount, contractAddress: ccShopAddress, encodedData: encodedData, metadata: {
|
|
82
82
|
packId,
|
|
83
83
|
packAmount,
|
|
84
84
|
pricePerPack,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import { GetQuoteResponse } from "../../../anyspend/types/api_req_res";
|
|
3
|
+
import type { AnySpendCustomExactInClasses } from "./types/classes";
|
|
3
4
|
type CustomExactInConfig = {
|
|
4
5
|
functionAbi: string;
|
|
5
6
|
functionName: string;
|
|
@@ -17,6 +18,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
17
18
|
sourceTokenChainId?: number;
|
|
18
19
|
destinationToken: components["schemas"]["Token"];
|
|
19
20
|
destinationChainId: number;
|
|
21
|
+
destinationTokenAmount?: string;
|
|
20
22
|
onSuccess?: (amount: string) => void;
|
|
21
23
|
onOpenCustomModal?: () => void;
|
|
22
24
|
mainFooter?: React.ReactNode;
|
|
@@ -38,6 +40,10 @@ export interface AnySpendCustomExactInProps {
|
|
|
38
40
|
customRecipientLabel?: string;
|
|
39
41
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
40
42
|
returnHomeLabel?: string;
|
|
43
|
+
/** Custom class names for styling specific elements */
|
|
44
|
+
classes?: AnySpendCustomExactInClasses;
|
|
45
|
+
/** When true, allows direct transfer without swap if source and destination token/chain are the same */
|
|
46
|
+
allowDirectTransfer?: boolean;
|
|
41
47
|
}
|
|
42
48
|
export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
|
|
43
49
|
export {};
|