@b3dotfun/sdk 0.1.1-test.0 → 0.1.2-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +22 -14
- package/dist/cjs/anyspend/react/components/QRDeposit.js +31 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
- package/dist/cjs/anyspend/react/components/common/TransferResultScreen.js +25 -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/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
- package/dist/cjs/anyspend/react/hooks/useWatchTransfer.js +75 -0
- package/dist/cjs/anyspend/utils/address.d.ts +5 -0
- package/dist/cjs/anyspend/utils/address.js +8 -0
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -1
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +37 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +7 -57
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +11 -35
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +3 -3
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -10
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +2 -20
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +1 -1
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +4 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +163 -0
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.js +5 -0
- package/dist/cjs/global-account/react/components/StyleRoot.js +2 -2
- package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
- package/dist/cjs/global-account/react/components/index.d.ts +3 -2
- package/dist/cjs/global-account/react/components/index.js +6 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuth.js +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +6 -3
- package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
- package/dist/cjs/global-account/react/hooks/useNotifications.js +1 -1
- package/dist/cjs/global-account/react/hooks/useProfile.js +4 -23
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +1 -1
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +6 -7
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +64 -39
- package/dist/cjs/global-account/react/index.native.d.ts +0 -2
- package/dist/cjs/global-account/react/index.native.js +1 -5
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +66 -1
- package/dist/cjs/global-account/react/stores/useModalStore.js +3 -0
- package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/cjs/global-account/react/stores/userStore.js +30 -0
- package/dist/cjs/global-account/react/utils/profileApi.d.ts +13 -0
- package/dist/cjs/global-account/react/utils/profileApi.js +29 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +23 -15
- package/dist/esm/anyspend/react/components/QRDeposit.js +32 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +10 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
- package/dist/esm/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
- package/dist/esm/anyspend/react/components/common/TransferResultScreen.js +22 -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/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
- package/dist/esm/anyspend/react/hooks/useWatchTransfer.js +72 -0
- package/dist/esm/anyspend/utils/address.d.ts +5 -0
- package/dist/esm/anyspend/utils/address.js +7 -0
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +6 -2
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +33 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +6 -58
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +10 -37
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +3 -3
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -10
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +1 -19
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +5 -3
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +160 -0
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.js +1 -0
- package/dist/esm/global-account/react/components/StyleRoot.js +2 -2
- package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
- package/dist/esm/global-account/react/components/index.d.ts +3 -2
- package/dist/esm/global-account/react/components/index.js +3 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuth.js +3 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +6 -3
- package/dist/esm/global-account/react/hooks/useClient.js +2 -2
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
- package/dist/esm/global-account/react/hooks/useProfile.js +1 -20
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +2 -2
- package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/esm/global-account/react/hooks/useUser.js +17 -0
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +6 -7
- package/dist/esm/global-account/react/hooks/useUserQuery.js +63 -37
- package/dist/esm/global-account/react/index.native.d.ts +0 -2
- package/dist/esm/global-account/react/index.native.js +0 -2
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +66 -1
- package/dist/esm/global-account/react/stores/useModalStore.js +3 -0
- package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/esm/global-account/react/stores/userStore.js +27 -0
- package/dist/esm/global-account/react/utils/profileApi.d.ts +13 -0
- package/dist/esm/global-account/react/utils/profileApi.js +25 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
- package/dist/types/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
- package/dist/types/anyspend/utils/address.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +3 -3
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
- package/dist/types/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
- package/dist/types/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
- package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +3 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +6 -7
- package/dist/types/global-account/react/index.native.d.ts +0 -2
- package/dist/types/global-account/react/stores/useModalStore.d.ts +66 -1
- package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/types/global-account/react/utils/profileApi.d.ts +13 -0
- package/package.json +6 -1
- package/src/anyspend/react/components/AnySpend.tsx +3 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +60 -42
- package/src/anyspend/react/components/QRDeposit.tsx +57 -5
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +13 -3
- package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +2 -2
- package/src/anyspend/react/components/common/TransferResultScreen.tsx +107 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/anyspend/react/hooks/useWatchTransfer.ts +114 -0
- package/src/anyspend/utils/address.ts +13 -0
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +6 -2
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +84 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +26 -45
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -103
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +4 -12
- package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
- package/src/global-account/react/components/B3Provider/useB3Config.ts +1 -34
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +7 -3
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/SingleUserSearchSelector/README.md +266 -0
- package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +330 -0
- package/src/global-account/react/components/SingleUserSearchSelector/index.ts +2 -0
- package/src/global-account/react/components/StyleRoot.tsx +2 -2
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
- package/src/global-account/react/components/index.ts +8 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +3 -3
- package/src/global-account/react/hooks/useAuthentication.ts +7 -3
- package/src/global-account/react/hooks/useClient.ts +2 -2
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
- package/src/global-account/react/hooks/useNotifications.ts +2 -2
- package/src/global-account/react/hooks/useProfile.ts +1 -32
- package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +2 -2
- package/src/global-account/react/hooks/useUser.ts +20 -0
- package/src/global-account/react/hooks/useUserQuery.ts +64 -51
- package/src/global-account/react/index.native.ts +0 -2
- package/src/global-account/react/stores/useModalStore.ts +70 -1
- package/src/global-account/react/stores/userStore.ts +41 -0
- package/src/global-account/react/utils/profileApi.ts +38 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/src/global-account/react/components/B3Provider/types.ts +0 -50
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { HYPERLIQUID_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
|
|
2
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
2
|
import { GetQuoteResponse } from "@b3dotfun/sdk/anyspend/types/api_req_res";
|
|
4
|
-
import { Skeleton, useAccountWallet, useSimBalance } from "@b3dotfun/sdk/global-account/react";
|
|
3
|
+
import { Skeleton, useAccountWallet, useSimBalance, useTokenData } from "@b3dotfun/sdk/global-account/react";
|
|
5
4
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
6
5
|
import {
|
|
7
6
|
NetworkArbitrumOne,
|
|
@@ -57,10 +56,10 @@ export interface AnySpendDepositProps {
|
|
|
57
56
|
sourceTokenAddress?: string;
|
|
58
57
|
/** Source chain ID to pre-select. If not provided, shows chain selection */
|
|
59
58
|
sourceTokenChainId?: number;
|
|
60
|
-
/** The destination token
|
|
61
|
-
|
|
59
|
+
/** The destination token address */
|
|
60
|
+
destinationTokenAddress: string;
|
|
62
61
|
/** The destination chain ID */
|
|
63
|
-
|
|
62
|
+
destinationTokenChainId: number;
|
|
64
63
|
/** Callback when deposit succeeds */
|
|
65
64
|
onSuccess?: (amount: string) => void;
|
|
66
65
|
/** Callback for opening a custom modal (e.g., for special token handling) */
|
|
@@ -112,6 +111,11 @@ export interface AnySpendDepositProps {
|
|
|
112
111
|
customRecipientLabel?: string;
|
|
113
112
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
114
113
|
returnHomeLabel?: string;
|
|
114
|
+
/** Whether the deposit requires a custom function (uses AnySpendCustomExactIn).
|
|
115
|
+
* When false, uses simple swap flow (AnySpend).
|
|
116
|
+
* Defaults to false.
|
|
117
|
+
*/
|
|
118
|
+
isCustomDeposit?: boolean;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
// Default supported chains
|
|
@@ -178,8 +182,8 @@ function ChainIcon({ chainId, className }: { chainId: number; className?: string
|
|
|
178
182
|
* // Simple deposit with chain selection
|
|
179
183
|
* <AnySpendDeposit
|
|
180
184
|
* recipientAddress={userAddress}
|
|
181
|
-
*
|
|
182
|
-
*
|
|
185
|
+
* destinationTokenAddress="0x..."
|
|
186
|
+
* destinationTokenChainId={base.id}
|
|
183
187
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
184
188
|
* />
|
|
185
189
|
*
|
|
@@ -187,8 +191,8 @@ function ChainIcon({ chainId, className }: { chainId: number; className?: string
|
|
|
187
191
|
* // Skip chain selection by providing sourceTokenChainId
|
|
188
192
|
* <AnySpendDeposit
|
|
189
193
|
* recipientAddress={userAddress}
|
|
190
|
-
*
|
|
191
|
-
*
|
|
194
|
+
* destinationTokenAddress="0x..."
|
|
195
|
+
* destinationTokenChainId={base.id}
|
|
192
196
|
* sourceTokenChainId={base.id}
|
|
193
197
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
194
198
|
* />
|
|
@@ -197,8 +201,8 @@ function ChainIcon({ chainId, className }: { chainId: number; className?: string
|
|
|
197
201
|
* // Deposit with custom contract
|
|
198
202
|
* <AnySpendDeposit
|
|
199
203
|
* recipientAddress={userAddress}
|
|
200
|
-
*
|
|
201
|
-
*
|
|
204
|
+
* destinationTokenAddress="0x..."
|
|
205
|
+
* destinationTokenChainId={base.id}
|
|
202
206
|
* depositContractConfig={{
|
|
203
207
|
* contractAddress: "0x...",
|
|
204
208
|
* functionName: "depositFor",
|
|
@@ -213,8 +217,8 @@ export function AnySpendDeposit({
|
|
|
213
217
|
paymentType: initialPaymentType,
|
|
214
218
|
sourceTokenAddress,
|
|
215
219
|
sourceTokenChainId: initialSourceChainId,
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
destinationTokenAddress,
|
|
221
|
+
destinationTokenChainId,
|
|
218
222
|
onSuccess,
|
|
219
223
|
onOpenCustomModal,
|
|
220
224
|
mainFooter,
|
|
@@ -233,6 +237,7 @@ export function AnySpendDeposit({
|
|
|
233
237
|
returnToHomeUrl,
|
|
234
238
|
customRecipientLabel,
|
|
235
239
|
returnHomeLabel,
|
|
240
|
+
isCustomDeposit = false,
|
|
236
241
|
}: AnySpendDepositProps) {
|
|
237
242
|
const { connectedEOAWallet } = useAccountWallet();
|
|
238
243
|
const eoaAddress = connectedEOAWallet?.getAccount()?.address;
|
|
@@ -244,6 +249,22 @@ export function AnySpendDeposit({
|
|
|
244
249
|
const [selectedChainId, setSelectedChainId] = useState<number | undefined>(initialSourceChainId);
|
|
245
250
|
const [paymentType, setPaymentType] = useState<"crypto" | "fiat">(initialPaymentType ?? "crypto");
|
|
246
251
|
|
|
252
|
+
// Fetch destination token data
|
|
253
|
+
const { data: destinationTokenData } = useTokenData(destinationTokenChainId, destinationTokenAddress);
|
|
254
|
+
|
|
255
|
+
// Construct full destination token object
|
|
256
|
+
const destinationToken: components["schemas"]["Token"] = useMemo(
|
|
257
|
+
() => ({
|
|
258
|
+
address: destinationTokenAddress,
|
|
259
|
+
chainId: destinationTokenChainId,
|
|
260
|
+
symbol: destinationTokenData?.symbol ?? "",
|
|
261
|
+
name: destinationTokenData?.name ?? "",
|
|
262
|
+
decimals: destinationTokenData?.decimals ?? 18,
|
|
263
|
+
metadata: { logoURI: destinationTokenData?.logoURI },
|
|
264
|
+
}),
|
|
265
|
+
[destinationTokenAddress, destinationTokenChainId, destinationTokenData],
|
|
266
|
+
);
|
|
267
|
+
|
|
247
268
|
// Fetch balances for EOA wallet
|
|
248
269
|
const { data: balanceData, isLoading: isBalanceLoading } = useSimBalance(
|
|
249
270
|
shouldShowChainSelection ? eoaAddress : undefined,
|
|
@@ -300,7 +321,7 @@ export function AnySpendDeposit({
|
|
|
300
321
|
|
|
301
322
|
if (!recipientAddress) return null;
|
|
302
323
|
|
|
303
|
-
const tokenSymbol = destinationToken.symbol
|
|
324
|
+
const tokenSymbol = destinationToken.symbol || "TOKEN";
|
|
304
325
|
|
|
305
326
|
// Determine order type based on config
|
|
306
327
|
const effectiveOrderType = orderType ?? (depositContractConfig ? "custom_exact_in" : "swap");
|
|
@@ -479,7 +500,7 @@ export function AnySpendDeposit({
|
|
|
479
500
|
</div>
|
|
480
501
|
|
|
481
502
|
{/* Chain-specific warning */}
|
|
482
|
-
<ChainWarningText chainId={
|
|
503
|
+
<ChainWarningText chainId={destinationTokenChainId} className="mt-2" />
|
|
483
504
|
</div>
|
|
484
505
|
</div>
|
|
485
506
|
);
|
|
@@ -492,7 +513,7 @@ export function AnySpendDeposit({
|
|
|
492
513
|
mode={mode}
|
|
493
514
|
recipientAddress={recipientAddress}
|
|
494
515
|
destinationToken={destinationToken}
|
|
495
|
-
destinationChainId={
|
|
516
|
+
destinationChainId={destinationTokenChainId}
|
|
496
517
|
depositContractConfig={depositContractConfig}
|
|
497
518
|
onBack={handleBack}
|
|
498
519
|
onClose={onClose ?? handleBack}
|
|
@@ -500,9 +521,6 @@ export function AnySpendDeposit({
|
|
|
500
521
|
);
|
|
501
522
|
}
|
|
502
523
|
|
|
503
|
-
// Check if destination is Hyperliquid
|
|
504
|
-
const isHyperliquidDeposit = destinationChainId === HYPERLIQUID_CHAIN_ID;
|
|
505
|
-
|
|
506
524
|
// Deposit view
|
|
507
525
|
return (
|
|
508
526
|
<div className="anyspend-deposit anyspend-deposit-form relative">
|
|
@@ -532,27 +550,7 @@ export function AnySpendDeposit({
|
|
|
532
550
|
)}
|
|
533
551
|
|
|
534
552
|
<div className={cn("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8")}>
|
|
535
|
-
{
|
|
536
|
-
<AnySpend
|
|
537
|
-
key={selectedChainId}
|
|
538
|
-
loadOrder={loadOrder}
|
|
539
|
-
mode={mode}
|
|
540
|
-
defaultActiveTab={paymentType}
|
|
541
|
-
recipientAddress={recipientAddress}
|
|
542
|
-
sourceChainId={selectedChainId}
|
|
543
|
-
destinationTokenAddress={destinationToken.address}
|
|
544
|
-
destinationTokenChainId={destinationChainId}
|
|
545
|
-
onSuccess={txHash => onSuccess?.(txHash ?? "")}
|
|
546
|
-
onTokenSelect={onTokenSelect}
|
|
547
|
-
customUsdInputValues={customUsdInputValues}
|
|
548
|
-
hideHeader
|
|
549
|
-
hideBottomNavigation
|
|
550
|
-
disableUrlParamManagement
|
|
551
|
-
returnToHomeUrl={returnToHomeUrl}
|
|
552
|
-
customRecipientLabel={customRecipientLabel}
|
|
553
|
-
returnHomeLabel={returnHomeLabel}
|
|
554
|
-
/>
|
|
555
|
-
) : (
|
|
553
|
+
{isCustomDeposit ? (
|
|
556
554
|
<AnySpendCustomExactIn
|
|
557
555
|
key={selectedChainId}
|
|
558
556
|
loadOrder={loadOrder}
|
|
@@ -562,7 +560,7 @@ export function AnySpendDeposit({
|
|
|
562
560
|
sourceTokenAddress={sourceTokenAddress}
|
|
563
561
|
sourceTokenChainId={selectedChainId}
|
|
564
562
|
destinationToken={destinationToken}
|
|
565
|
-
destinationChainId={
|
|
563
|
+
destinationChainId={destinationTokenChainId}
|
|
566
564
|
orderType={effectiveOrderType}
|
|
567
565
|
minDestinationAmount={minDestinationAmount}
|
|
568
566
|
header={header ?? defaultHeader}
|
|
@@ -577,11 +575,31 @@ export function AnySpendDeposit({
|
|
|
577
575
|
customRecipientLabel={customRecipientLabel}
|
|
578
576
|
returnHomeLabel={returnHomeLabel}
|
|
579
577
|
/>
|
|
578
|
+
) : (
|
|
579
|
+
<AnySpend
|
|
580
|
+
key={selectedChainId}
|
|
581
|
+
loadOrder={loadOrder}
|
|
582
|
+
mode={mode}
|
|
583
|
+
defaultActiveTab={paymentType}
|
|
584
|
+
recipientAddress={recipientAddress}
|
|
585
|
+
sourceChainId={selectedChainId}
|
|
586
|
+
destinationTokenAddress={destinationTokenAddress}
|
|
587
|
+
destinationTokenChainId={destinationTokenChainId}
|
|
588
|
+
onSuccess={txHash => onSuccess?.(txHash ?? "")}
|
|
589
|
+
onTokenSelect={onTokenSelect}
|
|
590
|
+
customUsdInputValues={customUsdInputValues}
|
|
591
|
+
hideHeader
|
|
592
|
+
hideBottomNavigation
|
|
593
|
+
disableUrlParamManagement
|
|
594
|
+
returnToHomeUrl={returnToHomeUrl}
|
|
595
|
+
customRecipientLabel={customRecipientLabel}
|
|
596
|
+
returnHomeLabel={returnHomeLabel}
|
|
597
|
+
/>
|
|
580
598
|
)}
|
|
581
599
|
</div>
|
|
582
600
|
|
|
583
601
|
{/* Chain-specific warning */}
|
|
584
|
-
<ChainWarningText chainId={
|
|
602
|
+
<ChainWarningText chainId={destinationTokenChainId} className="px-4 pb-4" />
|
|
585
603
|
</div>
|
|
586
604
|
);
|
|
587
605
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ALL_CHAINS, getAvailableChainIds } from "@b3dotfun/sdk/anyspend";
|
|
1
|
+
import { ALL_CHAINS, getAvailableChainIds, isSameChainAndToken } from "@b3dotfun/sdk/anyspend";
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { Button, toast } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
@@ -8,9 +8,11 @@ import { QRCodeSVG } from "qrcode.react";
|
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
9
9
|
import { useAnyspendOrderAndTransactions } from "../hooks/useAnyspendOrderAndTransactions";
|
|
10
10
|
import { useCreateDepositFirstOrder } from "../hooks/useCreateDepositFirstOrder";
|
|
11
|
+
import { TransferResult, useWatchTransfer } from "../hooks/useWatchTransfer";
|
|
11
12
|
import { DepositContractConfig } from "./AnySpendDeposit";
|
|
12
13
|
import { ChainTokenIcon } from "./common/ChainTokenIcon";
|
|
13
14
|
import { OrderDetails } from "./common/OrderDetails";
|
|
15
|
+
import { TransferResultScreen } from "./common/TransferResultScreen";
|
|
14
16
|
import { ChainWarningText, WarningText } from "./common/WarningText";
|
|
15
17
|
|
|
16
18
|
export interface QRDepositProps {
|
|
@@ -85,6 +87,7 @@ export function QRDeposit({
|
|
|
85
87
|
const [globalAddress, setGlobalAddress] = useState<string | undefined>();
|
|
86
88
|
const orderCreatedRef = useRef(false);
|
|
87
89
|
const onSuccessCalled = useRef(false);
|
|
90
|
+
const [transferResult, setTransferResult] = useState<TransferResult | null>(null);
|
|
88
91
|
|
|
89
92
|
// Source token/chain as state (can be changed by user)
|
|
90
93
|
const [sourceChainId, setSourceChainId] = useState(sourceChainIdProp ?? 8453);
|
|
@@ -92,6 +95,27 @@ export function QRDeposit({
|
|
|
92
95
|
sourceTokenProp ?? DEFAULT_ETH_ON_BASE,
|
|
93
96
|
);
|
|
94
97
|
|
|
98
|
+
// Check if this is a pure transfer (same chain and token)
|
|
99
|
+
const isPureTransfer = isSameChainAndToken(
|
|
100
|
+
sourceChainId,
|
|
101
|
+
sourceToken.address,
|
|
102
|
+
destinationChainId,
|
|
103
|
+
destinationToken.address,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
// Watch for pure transfers (same chain and token)
|
|
107
|
+
const { isWatching: isWatchingTransfer } = useWatchTransfer({
|
|
108
|
+
address: recipientAddress,
|
|
109
|
+
chainId: sourceChainId,
|
|
110
|
+
tokenAddress: sourceToken.address,
|
|
111
|
+
tokenDecimals: sourceToken.decimals,
|
|
112
|
+
enabled: isPureTransfer && !transferResult,
|
|
113
|
+
onTransferDetected: result => {
|
|
114
|
+
setTransferResult(result);
|
|
115
|
+
onSuccess?.();
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
95
119
|
// Handle token selection from TokenSelector
|
|
96
120
|
const handleTokenSelect = (newToken: any) => {
|
|
97
121
|
const token: components["schemas"]["Token"] = {
|
|
@@ -107,6 +131,7 @@ export function QRDeposit({
|
|
|
107
131
|
setOrderId(undefined);
|
|
108
132
|
setGlobalAddress(undefined);
|
|
109
133
|
orderCreatedRef.current = false;
|
|
134
|
+
setTransferResult(null);
|
|
110
135
|
|
|
111
136
|
// Update token and chain
|
|
112
137
|
setSourceChainId(newToken.chainId);
|
|
@@ -131,9 +156,11 @@ export function QRDeposit({
|
|
|
131
156
|
// Fetch order status
|
|
132
157
|
const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
|
|
133
158
|
|
|
134
|
-
// Create order on mount
|
|
159
|
+
// Create order on mount (skip for pure transfers)
|
|
135
160
|
useEffect(() => {
|
|
136
161
|
if (orderCreatedRef.current) return;
|
|
162
|
+
if (isPureTransfer) return; // Skip order creation for pure transfers
|
|
163
|
+
|
|
137
164
|
orderCreatedRef.current = true;
|
|
138
165
|
|
|
139
166
|
createOrder({
|
|
@@ -154,6 +181,7 @@ export function QRDeposit({
|
|
|
154
181
|
creatorAddress,
|
|
155
182
|
depositContractConfig,
|
|
156
183
|
createOrder,
|
|
184
|
+
isPureTransfer,
|
|
157
185
|
]);
|
|
158
186
|
|
|
159
187
|
// Call onSuccess when order is executed
|
|
@@ -170,7 +198,8 @@ export function QRDeposit({
|
|
|
170
198
|
onSuccessCalled.current = false;
|
|
171
199
|
}, [orderId]);
|
|
172
200
|
|
|
173
|
-
|
|
201
|
+
// For pure transfers, always use recipient address; for orders, use global address
|
|
202
|
+
const displayAddress = isPureTransfer ? recipientAddress : globalAddress || recipientAddress;
|
|
174
203
|
|
|
175
204
|
const handleCopyAddress = async () => {
|
|
176
205
|
if (displayAddress) {
|
|
@@ -190,6 +219,21 @@ export function QRDeposit({
|
|
|
190
219
|
onClose?.();
|
|
191
220
|
};
|
|
192
221
|
|
|
222
|
+
// Show transfer result screen for completed pure transfers
|
|
223
|
+
if (isPureTransfer && transferResult) {
|
|
224
|
+
return (
|
|
225
|
+
<TransferResultScreen
|
|
226
|
+
mode={mode}
|
|
227
|
+
transferResult={transferResult}
|
|
228
|
+
token={sourceToken}
|
|
229
|
+
chainId={sourceChainId}
|
|
230
|
+
recipientAddress={recipientAddress}
|
|
231
|
+
onBack={onBack}
|
|
232
|
+
onClose={onClose}
|
|
233
|
+
/>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
193
237
|
// Show order details if order has deposits or is being processed
|
|
194
238
|
if (oat?.data && oat.data.depositTxs && oat.data.depositTxs.length > 0) {
|
|
195
239
|
return (
|
|
@@ -214,8 +258,8 @@ export function QRDeposit({
|
|
|
214
258
|
);
|
|
215
259
|
}
|
|
216
260
|
|
|
217
|
-
// Show loading state while creating order (but not if we already have an orderId)
|
|
218
|
-
if (isCreatingOrder && !orderId) {
|
|
261
|
+
// Show loading state while creating order (but not if we already have an orderId or for pure transfers)
|
|
262
|
+
if (isCreatingOrder && !orderId && !isPureTransfer) {
|
|
219
263
|
return (
|
|
220
264
|
<div
|
|
221
265
|
className={cn(
|
|
@@ -335,6 +379,14 @@ export function QRDeposit({
|
|
|
335
379
|
will not be converted.
|
|
336
380
|
</WarningText>
|
|
337
381
|
|
|
382
|
+
{/* Watching indicator for pure transfers */}
|
|
383
|
+
{isPureTransfer && isWatchingTransfer && (
|
|
384
|
+
<div className="anyspend-qr-watching flex items-center justify-center gap-2 rounded-lg bg-blue-500/10 p-3">
|
|
385
|
+
<Loader2 className="h-4 w-4 animate-spin text-blue-500" />
|
|
386
|
+
<span className="text-sm text-blue-500">Watching for incoming transfer...</span>
|
|
387
|
+
</div>
|
|
388
|
+
)}
|
|
389
|
+
|
|
338
390
|
{/* Copy button */}
|
|
339
391
|
<button
|
|
340
392
|
onClick={handleCopyAddress}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { toast, useAccountWallet, WalletImage } from "@b3dotfun/sdk/global-account/react";
|
|
3
|
+
import { toast, useAccountWallet, useModalStore, WalletImage } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
5
5
|
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
6
6
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
@@ -48,13 +48,20 @@ export function CryptoPaymentMethod({
|
|
|
48
48
|
// Use custom hook to determine wallet display logic
|
|
49
49
|
const { shouldShowConnectedEOA } = useConnectedWalletDisplay(selectedPaymentMethod);
|
|
50
50
|
|
|
51
|
+
// Get modal store to block parent modal closing while connect modal is open
|
|
52
|
+
const setClosable = useModalStore(state => state.setClosable);
|
|
53
|
+
|
|
51
54
|
// Handle wallet connection using thirdweb modal
|
|
52
55
|
const handleConnectWallet = async () => {
|
|
56
|
+
// Block parent B3 modal from closing while thirdweb connect modal is open
|
|
57
|
+
setClosable(false);
|
|
58
|
+
|
|
53
59
|
try {
|
|
54
60
|
// Disconnect current wallet before connecting a new one
|
|
55
61
|
if (connectedEOAWallet) {
|
|
56
|
-
|
|
62
|
+
disconnect(connectedEOAWallet);
|
|
57
63
|
}
|
|
64
|
+
|
|
58
65
|
const wallet = await openConnectModal({
|
|
59
66
|
client,
|
|
60
67
|
setActive: false,
|
|
@@ -62,8 +69,8 @@ export function CryptoPaymentMethod({
|
|
|
62
69
|
showThirdwebBranding: false,
|
|
63
70
|
wallets: recommendWallets,
|
|
64
71
|
});
|
|
72
|
+
|
|
65
73
|
if (wallet) {
|
|
66
|
-
// setActiveWallet(wallet);
|
|
67
74
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
68
75
|
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
69
76
|
toast.success("Wallet connected");
|
|
@@ -82,6 +89,9 @@ export function CryptoPaymentMethod({
|
|
|
82
89
|
toast.error("Failed to connect wallet");
|
|
83
90
|
}
|
|
84
91
|
}
|
|
92
|
+
} finally {
|
|
93
|
+
// Always re-enable parent modal closing when connect modal closes
|
|
94
|
+
setClosable(true);
|
|
85
95
|
}
|
|
86
96
|
};
|
|
87
97
|
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
TextLoop,
|
|
22
22
|
TextShimmer,
|
|
23
23
|
useAccountWallet,
|
|
24
|
-
|
|
24
|
+
useB3Config,
|
|
25
25
|
useModalStore,
|
|
26
26
|
useProfile,
|
|
27
27
|
useUnifiedChainSwitchAndExecute,
|
|
@@ -228,7 +228,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
228
228
|
const searchParams = useSearchParams();
|
|
229
229
|
|
|
230
230
|
// Get theme from B3Provider context
|
|
231
|
-
const { theme } =
|
|
231
|
+
const { theme } = useB3Config();
|
|
232
232
|
const colorMode = theme || "light";
|
|
233
233
|
|
|
234
234
|
// Read crypto payment method from URL parameters
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OrderDetailsCollapsible, useStripeClientSecret } from "@b3dotfun/sdk/anyspend/react";
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
|
-
import { ShinyButton,
|
|
3
|
+
import { ShinyButton, useB3Config, useModalStore, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
5
|
import { formatStripeAmount, getStripePromise } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
6
6
|
import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
|
|
@@ -18,7 +18,7 @@ interface PaymentStripeWeb2Props {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }: PaymentStripeWeb2Props) {
|
|
21
|
-
const { theme, stripePublishableKey } =
|
|
21
|
+
const { theme, stripePublishableKey } = useB3Config();
|
|
22
22
|
const fingerprintConfig = getFingerprintConfig();
|
|
23
23
|
|
|
24
24
|
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } =
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ALL_CHAINS } from "@b3dotfun/sdk/anyspend";
|
|
4
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
5
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
6
|
+
import { CheckCircle2, Home } from "lucide-react";
|
|
7
|
+
import { TransferResult } from "../../hooks/useWatchTransfer";
|
|
8
|
+
import { ChainTokenIcon } from "./ChainTokenIcon";
|
|
9
|
+
|
|
10
|
+
export interface TransferResultScreenProps {
|
|
11
|
+
mode?: "modal" | "page";
|
|
12
|
+
/** The transfer result containing amount info */
|
|
13
|
+
transferResult: TransferResult;
|
|
14
|
+
/** The token that was transferred */
|
|
15
|
+
token: components["schemas"]["Token"];
|
|
16
|
+
/** The chain ID where the transfer happened */
|
|
17
|
+
chainId: number;
|
|
18
|
+
/** The recipient address */
|
|
19
|
+
recipientAddress: string;
|
|
20
|
+
/** Callback when back/close button is clicked */
|
|
21
|
+
onBack?: () => void;
|
|
22
|
+
/** Callback when close button is clicked */
|
|
23
|
+
onClose?: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A component for displaying the result of a pure transfer (same chain, same token).
|
|
28
|
+
* Shows the transferred amount with success styling.
|
|
29
|
+
*/
|
|
30
|
+
export function TransferResultScreen({
|
|
31
|
+
mode = "modal",
|
|
32
|
+
transferResult,
|
|
33
|
+
token,
|
|
34
|
+
chainId,
|
|
35
|
+
recipientAddress,
|
|
36
|
+
onBack,
|
|
37
|
+
onClose,
|
|
38
|
+
}: TransferResultScreenProps) {
|
|
39
|
+
const chain = ALL_CHAINS[chainId];
|
|
40
|
+
|
|
41
|
+
const handleClose = () => {
|
|
42
|
+
if (onClose) {
|
|
43
|
+
onClose();
|
|
44
|
+
} else if (onBack) {
|
|
45
|
+
onBack();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
className={cn(
|
|
52
|
+
"anyspend-container anyspend-transfer-result font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6",
|
|
53
|
+
mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
54
|
+
)}
|
|
55
|
+
>
|
|
56
|
+
<div className="anyspend-transfer-result-content flex flex-col items-center gap-6">
|
|
57
|
+
{/* Success icon */}
|
|
58
|
+
<div className="anyspend-transfer-success-icon bg-as-success-secondary flex h-16 w-16 items-center justify-center rounded-full">
|
|
59
|
+
<CheckCircle2 className="text-as-content-icon-success h-10 w-10" />
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{/* Success message */}
|
|
63
|
+
<div className="anyspend-transfer-success-message flex flex-col items-center gap-2">
|
|
64
|
+
<h2 className="text-as-primary text-xl font-semibold">Transfer Received!</h2>
|
|
65
|
+
<p className="text-as-secondary text-center text-sm">Your transfer has been successfully received.</p>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{/* Amount display */}
|
|
69
|
+
<div className="anyspend-transfer-amount border-as-border-secondary bg-as-surface-secondary flex w-full flex-col items-center gap-3 rounded-xl border p-4">
|
|
70
|
+
<div className="flex items-center gap-3">
|
|
71
|
+
<ChainTokenIcon
|
|
72
|
+
chainUrl={chain?.logoUrl}
|
|
73
|
+
tokenUrl={token.metadata?.logoURI}
|
|
74
|
+
className="h-10 min-h-10 w-10 min-w-10"
|
|
75
|
+
/>
|
|
76
|
+
<div className="flex flex-col">
|
|
77
|
+
<span className="text-as-primary text-2xl font-bold">
|
|
78
|
+
{transferResult.formattedAmount} {token.symbol}
|
|
79
|
+
</span>
|
|
80
|
+
<span className="text-as-secondary text-sm">on {chain?.name ?? "Unknown Chain"}</span>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
{/* Recipient info */}
|
|
86
|
+
<div className="anyspend-transfer-recipient flex w-full flex-col gap-1">
|
|
87
|
+
<span className="text-as-secondary text-xs">Received at</span>
|
|
88
|
+
<span className="text-as-primary break-all font-mono text-sm">{recipientAddress}</span>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
{/* Close button */}
|
|
92
|
+
<button
|
|
93
|
+
onClick={handleClose}
|
|
94
|
+
className="anyspend-transfer-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-xl py-3.5 font-medium text-white transition-all hover:opacity-90"
|
|
95
|
+
>
|
|
96
|
+
{mode === "page" ? (
|
|
97
|
+
<>
|
|
98
|
+
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
99
|
+
</>
|
|
100
|
+
) : (
|
|
101
|
+
"Close"
|
|
102
|
+
)}
|
|
103
|
+
</button>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -3,7 +3,7 @@ import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
|
3
3
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
4
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
5
5
|
import { buildMetadata, buildPayload, normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
7
7
|
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
8
8
|
import { useMutation } from "@tanstack/react-query";
|
|
9
9
|
import { useMemo } from "react";
|
|
@@ -36,7 +36,7 @@ export type UseAnyspendCreateOnrampOrderProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspendCreateOnrampOrderProps = {}) {
|
|
38
38
|
// Get B3 context values
|
|
39
|
-
const { partnerId } =
|
|
39
|
+
const { partnerId } = useB3Config();
|
|
40
40
|
|
|
41
41
|
// Get validated client reference ID from B3 context
|
|
42
42
|
const createValidatedClientReferenceId = useValidatedClientReferenceId();
|
|
@@ -2,7 +2,7 @@ import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
4
4
|
import { buildMetadata, buildPayload, normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
5
|
-
import {
|
|
5
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
6
6
|
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
7
7
|
import { useMutation } from "@tanstack/react-query";
|
|
8
8
|
import { useMemo } from "react";
|
|
@@ -36,7 +36,7 @@ export type UseAnyspendCreateOrderProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
export function useAnyspendCreateOrder({ onSuccess, onError }: UseAnyspendCreateOrderProps = {}) {
|
|
38
38
|
// Get B3 context values
|
|
39
|
-
const { partnerId } =
|
|
39
|
+
const { partnerId } = useB3Config();
|
|
40
40
|
|
|
41
41
|
// Get validated client reference ID from B3 context
|
|
42
42
|
const createValidatedClientReferenceId = useValidatedClientReferenceId();
|
|
@@ -2,7 +2,7 @@ import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
|
2
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
3
|
import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
|
|
4
4
|
import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
5
|
-
import {
|
|
5
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
6
6
|
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
7
7
|
import { useMutation } from "@tanstack/react-query";
|
|
8
8
|
import { useMemo } from "react";
|
|
@@ -29,7 +29,7 @@ export type UseCreateDepositFirstOrderProps = {
|
|
|
29
29
|
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
30
30
|
*/
|
|
31
31
|
export function useCreateDepositFirstOrder({ onSuccess, onError }: UseCreateDepositFirstOrderProps = {}) {
|
|
32
|
-
const { partnerId } =
|
|
32
|
+
const { partnerId } = useB3Config();
|
|
33
33
|
|
|
34
34
|
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
35
35
|
const visitorData: VisitorData | undefined = fpData && {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Validators } from "@b3dotfun/sdk/anyspend/utils/validation";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { CreateOnrampOrderParams } from "./useAnyspendCreateOnrampOrder";
|
|
5
5
|
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
@@ -9,7 +9,7 @@ import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
|
9
9
|
* Gets the createClientReferenceId function from B3 context and validates the result
|
|
10
10
|
*/
|
|
11
11
|
export function useValidatedClientReferenceId() {
|
|
12
|
-
const { createClientReferenceId } =
|
|
12
|
+
const { createClientReferenceId } = useB3Config();
|
|
13
13
|
|
|
14
14
|
const createValidatedClientReferenceId = useCallback(
|
|
15
15
|
async (params: CreateOrderParams | CreateOnrampOrderParams) => {
|