@b3dotfun/sdk 0.0.88-alpha.10 → 0.0.88-alpha.3
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/constants/index.d.ts +0 -2
- package/dist/cjs/anyspend/constants/index.js +1 -3
- package/dist/cjs/anyspend/index.d.ts +0 -2
- package/dist/cjs/anyspend/index.js +0 -3
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpend.js +6 -9
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +20 -24
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -34
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/index.js +0 -1
- 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/global-account/react/components/B3DynamicModal.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +57 -35
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +35 -38
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +15 -11
- 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/StyleRoot.js +3 -3
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -1
- package/dist/cjs/global-account/react/components/index.js +6 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +2 -1
- 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 +14 -14
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
- package/dist/cjs/global-account/react/index.native.d.ts +2 -0
- package/dist/cjs/global-account/react/index.native.js +5 -1
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/esm/anyspend/constants/index.d.ts +0 -2
- package/dist/esm/anyspend/constants/index.js +0 -2
- package/dist/esm/anyspend/index.d.ts +0 -2
- package/dist/esm/anyspend/index.js +0 -3
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/index.js +0 -1
- 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/global-account/react/components/B3DynamicModal.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -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 +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +16 -12
- 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/StyleRoot.js +3 -3
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -1
- package/dist/esm/global-account/react/components/index.js +2 -1
- 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.js +3 -2
- 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/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
- package/dist/esm/global-account/react/index.native.d.ts +2 -0
- package/dist/esm/global-account/react/index.native.js +2 -0
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -2
- package/dist/types/anyspend/index.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/types/global-account/react/components/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/index.native.d.ts +2 -0
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +0 -3
- package/src/anyspend/index.ts +0 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -28
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
- package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
- package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
- package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
- package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
- package/src/anyspend/react/hooks/index.ts +0 -1
- 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/global-account/react/components/B3DynamicModal.tsx +4 -3
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
- package/src/global-account/react/components/B3Provider/types.ts +50 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
- package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
- package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -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 +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +14 -11
- 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/StyleRoot.tsx +3 -3
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
- package/src/global-account/react/components/index.ts +2 -1
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +3 -2
- 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/useTokenBalance.tsx +7 -8
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
- package/src/global-account/react/hooks/useUserQuery.ts +40 -1
- package/src/global-account/react/index.native.ts +2 -0
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +0 -10
- package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
- package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
- package/dist/cjs/anyspend/services/gas.d.ts +0 -21
- package/dist/cjs/anyspend/services/gas.js +0 -65
- package/dist/cjs/anyspend/types/gas.d.ts +0 -61
- package/dist/cjs/anyspend/types/gas.js +0 -2
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
- package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/cjs/global-account/react/stores/configStore.js +0 -30
- package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/cjs/global-account/react/stores/userStore.js +0 -30
- package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
- package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
- package/dist/esm/anyspend/services/gas.d.ts +0 -21
- package/dist/esm/anyspend/services/gas.js +0 -59
- package/dist/esm/anyspend/types/gas.d.ts +0 -61
- package/dist/esm/anyspend/types/gas.js +0 -1
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
- package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/esm/global-account/react/hooks/useUser.js +0 -17
- package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/esm/global-account/react/stores/configStore.js +0 -27
- package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/esm/global-account/react/stores/userStore.js +0 -27
- package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/types/anyspend/services/gas.d.ts +0 -21
- package/dist/types/anyspend/types/gas.d.ts +0 -61
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
- package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
- package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
- package/src/anyspend/services/gas.test.ts +0 -31
- package/src/anyspend/services/gas.ts +0 -73
- package/src/anyspend/types/gas.ts +0 -66
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
- package/src/global-account/react/hooks/useUser.ts +0 -20
- package/src/global-account/react/stores/configStore.ts +0 -51
- package/src/global-account/react/stores/userStore.ts +0 -41
|
@@ -106,12 +106,6 @@ export interface AnySpendDepositProps {
|
|
|
106
106
|
topChainsCount?: number;
|
|
107
107
|
/** Callback when close button is clicked */
|
|
108
108
|
onClose?: () => void;
|
|
109
|
-
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
110
|
-
returnToHomeUrl?: string;
|
|
111
|
-
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
112
|
-
customRecipientLabel?: string;
|
|
113
|
-
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
114
|
-
returnHomeLabel?: string;
|
|
115
109
|
}
|
|
116
110
|
|
|
117
111
|
// Default supported chains
|
|
@@ -230,9 +224,6 @@ export function AnySpendDeposit({
|
|
|
230
224
|
minPoolSize = DEFAULT_MIN_POOL_SIZE,
|
|
231
225
|
topChainsCount = 3,
|
|
232
226
|
onClose,
|
|
233
|
-
returnToHomeUrl,
|
|
234
|
-
customRecipientLabel,
|
|
235
|
-
returnHomeLabel,
|
|
236
227
|
}: AnySpendDepositProps) {
|
|
237
228
|
const { connectedEOAWallet } = useAccountWallet();
|
|
238
229
|
const eoaAddress = connectedEOAWallet?.getAccount()?.address;
|
|
@@ -365,7 +356,7 @@ export function AnySpendDeposit({
|
|
|
365
356
|
)}
|
|
366
357
|
{/* Balance header */}
|
|
367
358
|
{!isBalanceLoading && totalBalance > 0 && (
|
|
368
|
-
<div className="anyspend-deposit-balance border-
|
|
359
|
+
<div className="anyspend-deposit-balance border-secondary border-b p-5">
|
|
369
360
|
<p className="anyspend-deposit-balance-label text-as-secondary text-sm">Your Balance</p>
|
|
370
361
|
<p className="anyspend-deposit-balance-value text-as-primary text-3xl font-semibold">
|
|
371
362
|
{formatDecimal(totalBalance)} <span className="text-sm">USD</span>
|
|
@@ -534,7 +525,6 @@ export function AnySpendDeposit({
|
|
|
534
525
|
<div className={cn("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8")}>
|
|
535
526
|
{isHyperliquidDeposit ? (
|
|
536
527
|
<AnySpend
|
|
537
|
-
key={selectedChainId}
|
|
538
528
|
loadOrder={loadOrder}
|
|
539
529
|
mode={mode}
|
|
540
530
|
defaultActiveTab={paymentType}
|
|
@@ -548,13 +538,9 @@ export function AnySpendDeposit({
|
|
|
548
538
|
hideHeader
|
|
549
539
|
hideBottomNavigation
|
|
550
540
|
disableUrlParamManagement
|
|
551
|
-
returnToHomeUrl={returnToHomeUrl}
|
|
552
|
-
customRecipientLabel={customRecipientLabel}
|
|
553
|
-
returnHomeLabel={returnHomeLabel}
|
|
554
541
|
/>
|
|
555
542
|
) : (
|
|
556
543
|
<AnySpendCustomExactIn
|
|
557
|
-
key={selectedChainId}
|
|
558
544
|
loadOrder={loadOrder}
|
|
559
545
|
mode={mode}
|
|
560
546
|
recipientAddress={recipientAddress}
|
|
@@ -573,9 +559,6 @@ export function AnySpendDeposit({
|
|
|
573
559
|
customUsdInputValues={customUsdInputValues}
|
|
574
560
|
preferEoa={preferEoa}
|
|
575
561
|
customExactInConfig={depositContractConfig}
|
|
576
|
-
returnToHomeUrl={returnToHomeUrl}
|
|
577
|
-
customRecipientLabel={customRecipientLabel}
|
|
578
|
-
returnHomeLabel={returnHomeLabel}
|
|
579
562
|
/>
|
|
580
563
|
)}
|
|
581
564
|
</div>
|
|
@@ -25,10 +25,6 @@ export interface AnySpendDepositHypeProps {
|
|
|
25
25
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
26
26
|
customUsdInputValues?: string[];
|
|
27
27
|
preferEoa?: boolean;
|
|
28
|
-
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
29
|
-
returnToHomeUrl?: string;
|
|
30
|
-
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
31
|
-
customRecipientLabel?: string;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
export function AnySpendDepositHype({
|
|
@@ -6,7 +6,6 @@ import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
|
6
6
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
7
7
|
import { ChevronLeft, ChevronRightCircle, Wallet, X, ZapIcon } from "lucide-react";
|
|
8
8
|
import { useConnectModal, useDisconnect, useWalletInfo } from "thirdweb/react";
|
|
9
|
-
import { createWallet } from "thirdweb/wallets";
|
|
10
9
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay";
|
|
11
10
|
|
|
12
11
|
export enum CryptoPaymentMethodType {
|
|
@@ -16,13 +15,6 @@ export enum CryptoPaymentMethodType {
|
|
|
16
15
|
TRANSFER_CRYPTO = "transfer_crypto",
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
const recommendWallets = [
|
|
20
|
-
createWallet("io.metamask"),
|
|
21
|
-
createWallet("com.coinbase.wallet"),
|
|
22
|
-
createWallet("me.rainbow"),
|
|
23
|
-
createWallet("io.rabby"),
|
|
24
|
-
];
|
|
25
|
-
|
|
26
18
|
interface CryptoPaymentMethodProps {
|
|
27
19
|
selectedPaymentMethod: CryptoPaymentMethodType;
|
|
28
20
|
setSelectedPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
@@ -55,13 +47,7 @@ export function CryptoPaymentMethod({
|
|
|
55
47
|
if (connectedEOAWallet) {
|
|
56
48
|
await disconnect(connectedEOAWallet);
|
|
57
49
|
}
|
|
58
|
-
const wallet = await openConnectModal({
|
|
59
|
-
client,
|
|
60
|
-
setActive: false,
|
|
61
|
-
size: "compact",
|
|
62
|
-
showThirdwebBranding: false,
|
|
63
|
-
wallets: recommendWallets,
|
|
64
|
-
});
|
|
50
|
+
const wallet = await openConnectModal({ client, setActive: false });
|
|
65
51
|
if (wallet) {
|
|
66
52
|
// setActiveWallet(wallet);
|
|
67
53
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
@@ -15,8 +15,6 @@ interface CryptoReceiveSectionProps {
|
|
|
15
15
|
// Recipient data
|
|
16
16
|
effectiveRecipientAddress?: string;
|
|
17
17
|
recipientName?: string;
|
|
18
|
-
/** Custom label for recipient display (overrides recipientName) */
|
|
19
|
-
customRecipientLabel?: string;
|
|
20
18
|
onSelectRecipient: () => void;
|
|
21
19
|
// Token data
|
|
22
20
|
dstAmount: string;
|
|
@@ -43,7 +41,6 @@ export function CryptoReceiveSection({
|
|
|
43
41
|
isBuyMode = false,
|
|
44
42
|
effectiveRecipientAddress,
|
|
45
43
|
recipientName,
|
|
46
|
-
customRecipientLabel,
|
|
47
44
|
onSelectRecipient,
|
|
48
45
|
dstAmount,
|
|
49
46
|
dstToken,
|
|
@@ -81,8 +78,7 @@ export function CryptoReceiveSection({
|
|
|
81
78
|
>
|
|
82
79
|
<>
|
|
83
80
|
<span className="text-as-tertiarry flex items-center gap-1 text-sm">
|
|
84
|
-
{
|
|
85
|
-
(recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || ""))}
|
|
81
|
+
{recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || "")}
|
|
86
82
|
</span>
|
|
87
83
|
<ChevronRight className="h-4 w-4" />
|
|
88
84
|
</>
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
TextLoop,
|
|
22
22
|
TextShimmer,
|
|
23
23
|
useAccountWallet,
|
|
24
|
-
|
|
24
|
+
useB3,
|
|
25
25
|
useModalStore,
|
|
26
26
|
useProfile,
|
|
27
27
|
useUnifiedChainSwitchAndExecute,
|
|
@@ -65,10 +65,6 @@ interface OrderDetailsProps {
|
|
|
65
65
|
onBack?: () => void;
|
|
66
66
|
disableUrlParamManagement?: boolean; // When true, will not modify URL parameters
|
|
67
67
|
points?: number | undefined; // Points earned from the transaction
|
|
68
|
-
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
69
|
-
returnToHomeUrl?: string;
|
|
70
|
-
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
71
|
-
returnHomeLabel?: string;
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
// Add this helper function near the top or just above the component
|
|
@@ -221,14 +217,12 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
221
217
|
onBack,
|
|
222
218
|
disableUrlParamManagement = false,
|
|
223
219
|
points,
|
|
224
|
-
returnToHomeUrl,
|
|
225
|
-
returnHomeLabel,
|
|
226
220
|
}: OrderDetailsProps) {
|
|
227
221
|
const router = useRouter();
|
|
228
222
|
const searchParams = useSearchParams();
|
|
229
223
|
|
|
230
224
|
// Get theme from B3Provider context
|
|
231
|
-
const { theme } =
|
|
225
|
+
const { theme } = useB3();
|
|
232
226
|
const colorMode = theme || "light";
|
|
233
227
|
|
|
234
228
|
// Read crypto payment method from URL parameters
|
|
@@ -383,49 +377,6 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
383
377
|
onBack?.();
|
|
384
378
|
}, [cleanupUrlParams, onBack]);
|
|
385
379
|
|
|
386
|
-
// Handle "Return to Home" click - redirects to custom URL if provided
|
|
387
|
-
const handleReturnToHome = useCallback(() => {
|
|
388
|
-
if (returnToHomeUrl) {
|
|
389
|
-
// Validate URL to prevent Open Redirect / XSS attacks
|
|
390
|
-
try {
|
|
391
|
-
const url = new URL(returnToHomeUrl, window.location.origin);
|
|
392
|
-
// Only allow http/https protocols
|
|
393
|
-
if (url.protocol === "http:" || url.protocol === "https:") {
|
|
394
|
-
window.location.href = url.href;
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
} catch {
|
|
398
|
-
// If URL parsing fails, check if it's a safe relative URL
|
|
399
|
-
if (returnToHomeUrl.startsWith("/") && !returnToHomeUrl.startsWith("//")) {
|
|
400
|
-
window.location.href = returnToHomeUrl;
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
// Fallback to handleBack if URL is not safe
|
|
405
|
-
handleBack();
|
|
406
|
-
} else {
|
|
407
|
-
handleBack();
|
|
408
|
-
}
|
|
409
|
-
}, [returnToHomeUrl, handleBack]);
|
|
410
|
-
|
|
411
|
-
// Reusable "Return to Home" / "Close" button
|
|
412
|
-
const returnHomeOrCloseButton = (
|
|
413
|
-
<button
|
|
414
|
-
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
415
|
-
onClick={returnToHomeUrl ? handleReturnToHome : mode === "page" ? handleBack : handleCloseModal}
|
|
416
|
-
>
|
|
417
|
-
{returnHomeLabel ? (
|
|
418
|
-
returnHomeLabel
|
|
419
|
-
) : mode === "page" ? (
|
|
420
|
-
<>
|
|
421
|
-
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
422
|
-
</>
|
|
423
|
-
) : (
|
|
424
|
-
"Close"
|
|
425
|
-
)}
|
|
426
|
-
</button>
|
|
427
|
-
);
|
|
428
|
-
|
|
429
380
|
useEffect(() => {
|
|
430
381
|
if (txSuccess) {
|
|
431
382
|
toast.success("Transaction successful! We are processing your order.", { duration: 10000 });
|
|
@@ -570,7 +521,18 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
570
521
|
</span>
|
|
571
522
|
</div>
|
|
572
523
|
)}
|
|
573
|
-
|
|
524
|
+
<button
|
|
525
|
+
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
526
|
+
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
527
|
+
>
|
|
528
|
+
{mode === "page" ? (
|
|
529
|
+
<>
|
|
530
|
+
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
531
|
+
</>
|
|
532
|
+
) : (
|
|
533
|
+
"Close"
|
|
534
|
+
)}
|
|
535
|
+
</button>
|
|
574
536
|
</>
|
|
575
537
|
);
|
|
576
538
|
}
|
|
@@ -687,7 +649,20 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
687
649
|
</ShinyButton>
|
|
688
650
|
)}
|
|
689
651
|
|
|
690
|
-
{order.status === "executed" &&
|
|
652
|
+
{order.status === "executed" && (
|
|
653
|
+
<button
|
|
654
|
+
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
655
|
+
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
656
|
+
>
|
|
657
|
+
{mode === "page" ? (
|
|
658
|
+
<>
|
|
659
|
+
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
660
|
+
</>
|
|
661
|
+
) : (
|
|
662
|
+
"Close"
|
|
663
|
+
)}
|
|
664
|
+
</button>
|
|
665
|
+
)}
|
|
691
666
|
</>
|
|
692
667
|
);
|
|
693
668
|
}
|
|
@@ -811,7 +786,20 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
811
786
|
</ShinyButton>
|
|
812
787
|
)}
|
|
813
788
|
|
|
814
|
-
{order.status === "executed" &&
|
|
789
|
+
{order.status === "executed" && (
|
|
790
|
+
<button
|
|
791
|
+
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
792
|
+
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
793
|
+
>
|
|
794
|
+
{mode === "page" ? (
|
|
795
|
+
<>
|
|
796
|
+
Return to Home <Home className="ml-2 h-4 w-4" />
|
|
797
|
+
</>
|
|
798
|
+
) : (
|
|
799
|
+
"Close"
|
|
800
|
+
)}
|
|
801
|
+
</button>
|
|
802
|
+
)}
|
|
815
803
|
</>
|
|
816
804
|
);
|
|
817
805
|
}
|
|
@@ -917,12 +905,6 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
917
905
|
)}
|
|
918
906
|
|
|
919
907
|
{/* <DelayedSupportMessage /> */}
|
|
920
|
-
<button
|
|
921
|
-
className="text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline"
|
|
922
|
-
onClick={handleBack}
|
|
923
|
-
>
|
|
924
|
-
<RefreshCcw className="ml-2 h-4 w-4" /> Cancel and start over
|
|
925
|
-
</button>
|
|
926
908
|
</>
|
|
927
909
|
);
|
|
928
910
|
}
|
|
@@ -33,7 +33,6 @@ export function PanelOnramp({
|
|
|
33
33
|
onShowPointsDetail,
|
|
34
34
|
onShowFeeDetail,
|
|
35
35
|
customUsdInputValues = ["5", "10", "20", "25"],
|
|
36
|
-
customRecipientLabel,
|
|
37
36
|
}: {
|
|
38
37
|
srcAmountOnRamp: string;
|
|
39
38
|
setSrcAmountOnRamp: (amount: string) => void;
|
|
@@ -53,8 +52,6 @@ export function PanelOnramp({
|
|
|
53
52
|
onShowPointsDetail?: () => void;
|
|
54
53
|
onShowFeeDetail?: () => void;
|
|
55
54
|
customUsdInputValues?: string[];
|
|
56
|
-
/** Custom label for recipient display (overrides recipientName) */
|
|
57
|
-
customRecipientLabel?: string;
|
|
58
55
|
}) {
|
|
59
56
|
// Helper function to get fees from anyspend quote
|
|
60
57
|
const getFeeFromApi = (paymentMethod: FiatPaymentMethod): number | null => {
|
|
@@ -231,8 +228,7 @@ export function PanelOnramp({
|
|
|
231
228
|
onClick={() => setActivePanel(recipientSelectionPanelIndex)} // Recipient selection panel
|
|
232
229
|
>
|
|
233
230
|
<span className="text-sm">
|
|
234
|
-
{
|
|
235
|
-
(recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress))}
|
|
231
|
+
{recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress)}
|
|
236
232
|
</span>
|
|
237
233
|
<ChevronRight size={16} />
|
|
238
234
|
</button>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { getStripePromise } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
1
2
|
import { OrderDetailsCollapsible, useStripeClientSecret } from "@b3dotfun/sdk/anyspend/react";
|
|
2
3
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
|
-
import { ShinyButton,
|
|
4
|
+
import { ShinyButton, useB3, useModalStore, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
4
5
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
|
-
import { formatStripeAmount
|
|
6
|
+
import { formatStripeAmount } from "@b3dotfun/sdk/shared/utils/payment.utils";
|
|
6
7
|
import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
|
|
7
8
|
import { PaymentIntentResult, StripePaymentElementOptions } from "@stripe/stripe-js";
|
|
8
9
|
import { X } from "lucide-react";
|
|
@@ -18,7 +19,7 @@ interface PaymentStripeWeb2Props {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }: PaymentStripeWeb2Props) {
|
|
21
|
-
const { theme, stripePublishableKey } =
|
|
22
|
+
const { theme, stripePublishableKey } = useB3();
|
|
22
23
|
const fingerprintConfig = getFingerprintConfig();
|
|
23
24
|
|
|
24
25
|
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } =
|
|
@@ -7,7 +7,6 @@ export * from "./useAnyspendQuote";
|
|
|
7
7
|
export * from "./useAnyspendTokens";
|
|
8
8
|
export * from "./useCoinbaseOnrampOptions";
|
|
9
9
|
export * from "./useConnectedUserProfile";
|
|
10
|
-
export * from "./useGasPrice";
|
|
11
10
|
export * from "./useGeoOnrampOptions";
|
|
12
11
|
export * from "./useGetGeo";
|
|
13
12
|
export * from "./useHyperliquidTransfer";
|
|
@@ -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 { useB3 } 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 } = useB3();
|
|
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 { useB3 } 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 } = useB3();
|
|
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 { useB3 } 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 } = useB3();
|
|
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 { useB3 } 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 } = useB3();
|
|
13
13
|
|
|
14
14
|
const createValidatedClientReferenceId = useCallback(
|
|
15
15
|
async (params: CreateOrderParams | CreateOnrampOrderParams) => {
|
|
@@ -14,13 +14,14 @@ import { AnySpendDepositHype } from "@b3dotfun/sdk/anyspend/react/components/Any
|
|
|
14
14
|
import { AnySpendDepositUpside } from "@b3dotfun/sdk/anyspend/react/components/AnySpendDepositUpside";
|
|
15
15
|
import { AnySpendStakeUpside } from "@b3dotfun/sdk/anyspend/react/components/AnySpendStakeUpside";
|
|
16
16
|
import { AnySpendStakeUpsideExactIn } from "@b3dotfun/sdk/anyspend/react/components/AnySpendStakeUpsideExactIn";
|
|
17
|
-
import {
|
|
17
|
+
import { useGlobalAccount, useIsMobile, useModalStore } from "@b3dotfun/sdk/global-account/react";
|
|
18
18
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
19
19
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
20
20
|
import { AnimatePresence, motion } from "framer-motion";
|
|
21
21
|
import { useEffect, useRef } from "react";
|
|
22
22
|
import { useSetActiveWallet } from "thirdweb/react";
|
|
23
23
|
import { AvatarEditor } from "./AvatarEditor/AvatarEditor";
|
|
24
|
+
import { useB3 } from "./B3Provider/useB3";
|
|
24
25
|
import { Deposit } from "./Deposit/Deposit";
|
|
25
26
|
import { LinkAccount } from "./LinkAccount/LinkAccount";
|
|
26
27
|
import { LinkNewAccount } from "./LinkAccount/LinkNewAccount";
|
|
@@ -29,8 +30,8 @@ import NotificationsContent from "./ManageAccount/NotificationsContent";
|
|
|
29
30
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
30
31
|
import { Send } from "./Send/Send";
|
|
31
32
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
32
|
-
import { ToastContainer, useToastContext } from "./Toast/index";
|
|
33
33
|
import { TurnkeyAuthModal } from "./TurnkeyAuthModal";
|
|
34
|
+
import { ToastContainer, useToastContext } from "./Toast/index";
|
|
34
35
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog";
|
|
35
36
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer";
|
|
36
37
|
|
|
@@ -41,7 +42,7 @@ export function B3DynamicModal() {
|
|
|
41
42
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
42
43
|
const contentType = useModalStore(state => state.contentType);
|
|
43
44
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
44
|
-
const { theme } =
|
|
45
|
+
const { theme } = useB3();
|
|
45
46
|
const isMobile = useIsMobile();
|
|
46
47
|
const prevIsOpenRef = useRef(isOpen);
|
|
47
48
|
const { wallet } = useGlobalAccount();
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
-
import {
|
|
4
|
-
import { ThirdwebProvider } from "thirdweb/react";
|
|
3
|
+
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
5
4
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
6
5
|
|
|
7
6
|
import { ClientType } from "../../../client-manager";
|
|
8
7
|
|
|
9
8
|
import { WagmiProvider } from "wagmi";
|
|
10
|
-
import { useB3ConfigStore } from "../../stores/configStore";
|
|
11
9
|
import { createWagmiConfig } from "../../utils/createWagmiConfig";
|
|
12
|
-
import AuthenticationProvider from "./AuthenticationProvider";
|
|
13
10
|
import { LocalSDKProvider } from "./LocalSDKProvider";
|
|
11
|
+
import { B3Context, B3ContextType } from "./types";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default permissions configuration for B3 provider
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_PERMISSIONS = {
|
|
17
|
+
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
18
|
+
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
19
|
+
startDate: new Date(),
|
|
20
|
+
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
21
|
+
};
|
|
14
22
|
|
|
15
23
|
// Create queryClient instance
|
|
16
24
|
const queryClient = new QueryClient();
|
|
@@ -27,53 +35,44 @@ export function B3Provider({
|
|
|
27
35
|
partnerId,
|
|
28
36
|
rpcUrls,
|
|
29
37
|
onConnect,
|
|
30
|
-
defaultPermissions,
|
|
31
38
|
}: {
|
|
32
39
|
theme: "light" | "dark";
|
|
33
40
|
children: React.ReactNode;
|
|
34
41
|
accountOverride?: Account;
|
|
35
|
-
environment
|
|
42
|
+
environment: B3ContextType["environment"];
|
|
36
43
|
clientType?: ClientType;
|
|
37
44
|
partnerId: string;
|
|
38
45
|
rpcUrls?: Record<number, string>;
|
|
39
46
|
onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
40
|
-
defaultPermissions?: PermissionsConfig;
|
|
41
47
|
}) {
|
|
42
|
-
const setConfig = useB3ConfigStore(state => state.setConfig);
|
|
43
|
-
|
|
44
|
-
// Initialize config store on mount - props are static and never change
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
setConfig({
|
|
47
|
-
accountOverride,
|
|
48
|
-
environment: environment ?? "development",
|
|
49
|
-
automaticallySetFirstEoa: false,
|
|
50
|
-
theme,
|
|
51
|
-
clientType,
|
|
52
|
-
partnerId,
|
|
53
|
-
defaultPermissions,
|
|
54
|
-
});
|
|
55
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
56
|
-
|
|
57
48
|
return (
|
|
58
49
|
<ThirdwebProvider>
|
|
59
50
|
<LocalSDKProvider onConnectCallback={onConnect}>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
<InnerProvider
|
|
52
|
+
accountOverride={accountOverride}
|
|
53
|
+
environment={environment}
|
|
54
|
+
theme={theme}
|
|
55
|
+
clientType={clientType}
|
|
56
|
+
partnerId={partnerId}
|
|
57
|
+
rpcUrls={rpcUrls}
|
|
58
|
+
>
|
|
59
|
+
{/* <RelayKitProviderWrapper> */}
|
|
60
|
+
{children}
|
|
61
|
+
{/* </RelayKitProviderWrapper> */}
|
|
62
|
+
</InnerProvider>
|
|
64
63
|
</LocalSDKProvider>
|
|
65
64
|
</ThirdwebProvider>
|
|
66
65
|
);
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
/**
|
|
70
|
-
* Inner provider component
|
|
69
|
+
* Inner provider component that provides the actual B3Context
|
|
71
70
|
*/
|
|
72
71
|
export function InnerProvider({
|
|
73
72
|
children,
|
|
74
73
|
accountOverride,
|
|
75
74
|
environment,
|
|
76
|
-
defaultPermissions,
|
|
75
|
+
defaultPermissions = DEFAULT_PERMISSIONS,
|
|
77
76
|
theme = "light",
|
|
78
77
|
clientType = "socket",
|
|
79
78
|
partnerId,
|
|
@@ -81,32 +80,44 @@ export function InnerProvider({
|
|
|
81
80
|
}: {
|
|
82
81
|
children: React.ReactNode;
|
|
83
82
|
accountOverride?: Account;
|
|
84
|
-
environment
|
|
83
|
+
environment: B3ContextType["environment"];
|
|
85
84
|
defaultPermissions?: PermissionsConfig;
|
|
86
85
|
theme: "light" | "dark";
|
|
87
86
|
clientType?: ClientType;
|
|
88
87
|
partnerId: string;
|
|
89
88
|
rpcUrls?: Record<number, string>;
|
|
90
89
|
}) {
|
|
91
|
-
const
|
|
90
|
+
const activeAccount = useActiveAccount();
|
|
91
|
+
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
92
92
|
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
|
|
93
93
|
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
setConfig({
|
|
97
|
-
accountOverride,
|
|
98
|
-
environment: environment ?? "development",
|
|
99
|
-
automaticallySetFirstEoa: false,
|
|
100
|
-
theme,
|
|
101
|
-
clientType,
|
|
102
|
-
partnerId,
|
|
103
|
-
defaultPermissions,
|
|
104
|
-
});
|
|
105
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
94
|
+
// Use given accountOverride or activeAccount from thirdweb
|
|
95
|
+
const effectiveAccount = accountOverride || activeAccount;
|
|
106
96
|
|
|
107
97
|
return (
|
|
108
98
|
<WagmiProvider config={wagmiConfig}>
|
|
109
|
-
<QueryClientProvider client={queryClient}>
|
|
99
|
+
<QueryClientProvider client={queryClient}>
|
|
100
|
+
<B3Context.Provider
|
|
101
|
+
value={{
|
|
102
|
+
//account: effectiveAccount,
|
|
103
|
+
automaticallySetFirstEoa: false,
|
|
104
|
+
//setWallet: () => {},
|
|
105
|
+
wallet: undefined,
|
|
106
|
+
//user,
|
|
107
|
+
//setUser,
|
|
108
|
+
initialized: true,
|
|
109
|
+
ready: !!effectiveAccount,
|
|
110
|
+
environment,
|
|
111
|
+
defaultPermissions,
|
|
112
|
+
theme,
|
|
113
|
+
clientType,
|
|
114
|
+
partnerId,
|
|
115
|
+
//refetchUser,
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{children}
|
|
119
|
+
</B3Context.Provider>
|
|
120
|
+
</QueryClientProvider>
|
|
110
121
|
</WagmiProvider>
|
|
111
122
|
);
|
|
112
123
|
}
|