@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,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import app from "../../../../global-account/app.js";
|
|
4
|
-
import { Button, IPFSMediaRenderer, toast, useAuthentication,
|
|
4
|
+
import { Button, IPFSMediaRenderer, toast, useAuthentication, useB3Config, useProfile, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
6
6
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
7
7
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
@@ -37,7 +37,7 @@ export function AvatarEditor({ onSetAvatar, className }) {
|
|
|
37
37
|
const [zoom, setZoom] = useState(1);
|
|
38
38
|
const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
|
|
39
39
|
const fileInputRef = useRef(null);
|
|
40
|
-
const { partnerId } =
|
|
40
|
+
const { partnerId } = useB3Config();
|
|
41
41
|
const { user, setUser } = useAuthentication(partnerId);
|
|
42
42
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
43
43
|
const contentType = useModalStore(state => state.contentType);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AnySpend, AnySpendBondKit, AnySpendBuySpin, AnySpendCollectorClubPurchase, AnySpendNFT, AnyspendSignatureMint, AnySpendStakeB3, AnySpendStakeB3ExactIn, AnySpendTournament, OrderHistory, } from "../../../anyspend/react/index.js";
|
|
3
|
+
import { AnySpendDeposit } from "../../../anyspend/react/components/AnySpendDeposit.js";
|
|
3
4
|
import { AnySpendDepositHype } from "../../../anyspend/react/components/AnyspendDepositHype.js";
|
|
4
5
|
import { AnySpendDepositUpside } from "../../../anyspend/react/components/AnySpendDepositUpside.js";
|
|
5
6
|
import { AnySpendStakeUpside } from "../../../anyspend/react/components/AnySpendStakeUpside.js";
|
|
6
7
|
import { AnySpendStakeUpsideExactIn } from "../../../anyspend/react/components/AnySpendStakeUpsideExactIn.js";
|
|
7
|
-
import {
|
|
8
|
+
import { useB3Config, useIsMobile, useModalStore } from "../../../global-account/react/index.js";
|
|
8
9
|
import { cn } from "../../../shared/utils/cn.js";
|
|
9
10
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
10
11
|
import { AnimatePresence, motion } from "framer-motion";
|
|
@@ -27,7 +28,7 @@ export function B3DynamicModal() {
|
|
|
27
28
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
28
29
|
const contentType = useModalStore(state => state.contentType);
|
|
29
30
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
30
|
-
const { theme } =
|
|
31
|
+
const { theme } = useB3Config();
|
|
31
32
|
const isMobile = useIsMobile();
|
|
32
33
|
const { toasts, removeToast } = useToastContext();
|
|
33
34
|
// Define arrays for different modal type groups
|
|
@@ -52,6 +53,7 @@ export function B3DynamicModal() {
|
|
|
52
53
|
"deposit",
|
|
53
54
|
"send",
|
|
54
55
|
"notifications",
|
|
56
|
+
"anySpendDeposit",
|
|
55
57
|
];
|
|
56
58
|
const freestyleTypes = [
|
|
57
59
|
"anySpendNft",
|
|
@@ -122,6 +124,8 @@ export function B3DynamicModal() {
|
|
|
122
124
|
return _jsx(AnySpendDepositHype, { ...contentType, mode: "modal" });
|
|
123
125
|
case "anySpendCollectorClubPurchase":
|
|
124
126
|
return _jsx(AnySpendCollectorClubPurchase, { ...contentType, mode: "modal" });
|
|
127
|
+
case "anySpendDeposit":
|
|
128
|
+
return _jsx(AnySpendDeposit, { ...contentType, mode: "modal" });
|
|
125
129
|
case "avatarEditor":
|
|
126
130
|
return _jsx(AvatarEditor, { onSetAvatar: contentType.onSuccess });
|
|
127
131
|
case "deposit":
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAuthentication } from "../../hooks/index.js";
|
|
2
|
+
import { useAutoSelectWallet } from "../../hooks/useAutoSelectWallet.js";
|
|
3
|
+
const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, }) => {
|
|
4
|
+
useAuthentication(partnerId);
|
|
5
|
+
useAutoSelectWallet({
|
|
6
|
+
enabled: automaticallySetFirstEoa,
|
|
7
|
+
});
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
export default AuthenticationProvider;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
2
|
+
import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
|
|
3
|
+
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
4
|
+
import { Account } from "thirdweb/wallets";
|
|
5
|
+
import { ClientType } from "../../../client-manager";
|
|
6
|
+
export interface B3ConfigContextType {
|
|
7
|
+
accountOverride?: Account;
|
|
8
|
+
automaticallySetFirstEoa: boolean;
|
|
9
|
+
environment: "development" | "production";
|
|
10
|
+
defaultPermissions: PermissionsConfig;
|
|
11
|
+
theme: "light" | "dark";
|
|
12
|
+
clientType: ClientType;
|
|
13
|
+
partnerId: string;
|
|
14
|
+
stripePublishableKey?: string;
|
|
15
|
+
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
16
|
+
enableTurnkey: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
accountOverride?: Account;
|
|
21
|
+
environment?: "development" | "production";
|
|
22
|
+
defaultPermissions?: PermissionsConfig;
|
|
23
|
+
automaticallySetFirstEoa?: boolean;
|
|
24
|
+
theme?: "light" | "dark";
|
|
25
|
+
clientType?: ClientType;
|
|
26
|
+
partnerId: string;
|
|
27
|
+
stripePublishableKey?: string;
|
|
28
|
+
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
29
|
+
enableTurnkey?: boolean;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function useB3Config(): B3ConfigContextType;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Default permissions configuration for B3 provider
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_PERMISSIONS = {
|
|
7
|
+
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
|
|
8
|
+
nativeTokenLimitPerTransaction: 0.1,
|
|
9
|
+
startDate: new Date(),
|
|
10
|
+
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
11
|
+
};
|
|
12
|
+
const B3ConfigContext = createContext(null);
|
|
13
|
+
export function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey = false, }) {
|
|
14
|
+
return (_jsx(B3ConfigContext.Provider, { value: {
|
|
15
|
+
accountOverride,
|
|
16
|
+
environment,
|
|
17
|
+
defaultPermissions,
|
|
18
|
+
automaticallySetFirstEoa,
|
|
19
|
+
theme,
|
|
20
|
+
clientType,
|
|
21
|
+
partnerId,
|
|
22
|
+
stripePublishableKey,
|
|
23
|
+
createClientReferenceId,
|
|
24
|
+
enableTurnkey,
|
|
25
|
+
}, children: children }));
|
|
26
|
+
}
|
|
27
|
+
export function useB3Config() {
|
|
28
|
+
const context = useContext(B3ConfigContext);
|
|
29
|
+
if (!context) {
|
|
30
|
+
throw new Error("useB3Config must be used within a B3ConfigProvider");
|
|
31
|
+
}
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
@@ -5,15 +5,14 @@ import "@relayprotocol/relay-kit-ui/styles.css";
|
|
|
5
5
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
6
6
|
import { CreateConnectorFn } from "wagmi";
|
|
7
7
|
import { ClientType } from "../../../client-manager";
|
|
8
|
-
import { B3ContextType } from "./types";
|
|
9
8
|
/**
|
|
10
9
|
* Main B3Provider component
|
|
11
10
|
*/
|
|
12
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
|
|
11
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, defaultPermissions, }: {
|
|
13
12
|
theme: "light" | "dark";
|
|
14
13
|
children: React.ReactNode;
|
|
15
14
|
accountOverride?: Account;
|
|
16
|
-
environment
|
|
15
|
+
environment?: "development" | "production";
|
|
17
16
|
automaticallySetFirstEoa?: boolean;
|
|
18
17
|
simDuneApiKey?: string;
|
|
19
18
|
toaster?: {
|
|
@@ -26,24 +25,10 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
26
25
|
/** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
|
|
27
26
|
stripePublishableKey?: string;
|
|
28
27
|
onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
28
|
+
onLogout?: () => void | Promise<void>;
|
|
29
29
|
connectors?: CreateConnectorFn[];
|
|
30
30
|
overrideDefaultConnectors?: boolean;
|
|
31
31
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
32
32
|
enableTurnkey?: boolean;
|
|
33
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
/**
|
|
35
|
-
* Inner provider component that provides the actual B3Context
|
|
36
|
-
*/
|
|
37
|
-
export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
|
|
38
|
-
children: React.ReactNode;
|
|
39
|
-
accountOverride?: Account;
|
|
40
|
-
environment: B3ContextType["environment"];
|
|
41
33
|
defaultPermissions?: PermissionsConfig;
|
|
42
|
-
automaticallySetFirstEoa: boolean;
|
|
43
|
-
theme: "light" | "dark";
|
|
44
|
-
clientType?: ClientType;
|
|
45
|
-
partnerId: string;
|
|
46
|
-
stripePublishableKey?: string;
|
|
47
|
-
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
48
|
-
enableTurnkey?: boolean;
|
|
49
34
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { RelayKitProviderWrapper, TooltipProvider
|
|
3
|
-
import { useAutoSelectWallet } from "../../../../global-account/react/hooks/useAutoSelectWallet.js";
|
|
2
|
+
import { RelayKitProviderWrapper, TooltipProvider } from "../../../../global-account/react/index.js";
|
|
4
3
|
import { createWagmiConfig } from "../../../../global-account/react/utils/createWagmiConfig.js";
|
|
5
4
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
6
5
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
7
6
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
8
7
|
import { useEffect, useMemo } from "react";
|
|
9
|
-
import { ThirdwebProvider
|
|
8
|
+
import { ThirdwebProvider } from "thirdweb/react";
|
|
10
9
|
import { WagmiProvider } from "wagmi";
|
|
11
10
|
import { setClientType } from "../../../client-manager.js";
|
|
12
11
|
import { StyleRoot } from "../StyleRoot.js";
|
|
13
12
|
import { setToastContext, ToastProvider, useToastContext } from "../Toast/index.js";
|
|
13
|
+
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
14
|
+
import { B3ConfigProvider } from "./B3ConfigProvider.js";
|
|
14
15
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
15
|
-
import { B3Context } from "./types.js";
|
|
16
|
-
/**
|
|
17
|
-
* Default permissions configuration for B3 provider
|
|
18
|
-
*/
|
|
19
|
-
const DEFAULT_PERMISSIONS = {
|
|
20
|
-
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
21
|
-
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
22
|
-
startDate: new Date(),
|
|
23
|
-
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
24
|
-
};
|
|
25
16
|
// Create queryClient instance
|
|
26
17
|
const queryClient = new QueryClient();
|
|
27
18
|
/**
|
|
@@ -29,7 +20,7 @@ const queryClient = new QueryClient();
|
|
|
29
20
|
*/
|
|
30
21
|
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
|
|
31
22
|
// deprecated since v0.0.87
|
|
32
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
|
|
23
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
33
24
|
// Initialize Google Analytics on mount
|
|
34
25
|
useEffect(() => {
|
|
35
26
|
loadGA4Script();
|
|
@@ -39,50 +30,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
39
30
|
setClientType(clientType);
|
|
40
31
|
}, [clientType]);
|
|
41
32
|
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
42
|
-
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsxs(
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Inner provider component that provides the actual B3Context
|
|
46
|
-
*/
|
|
47
|
-
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
|
|
48
|
-
const activeAccount = useActiveAccount();
|
|
49
|
-
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
50
|
-
//const isConnected = useAuthStore(state => state.isConnected);
|
|
51
|
-
//const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
52
|
-
// Note: This fixes a bug where useAuthentication is no longer rendered on every page, as of this PR https://github.com/b3-fun/b3/pull/385/files#diff-3ef996931b8fc8e49021ba1b42ddaa97535214681610dc5fdacf63542e261af7
|
|
53
|
-
// The above PR removes useAuthentication from the overall B3Provider. useAuthentication should be everywhere the provider is, since it sets the overall auth state
|
|
54
|
-
// By just calling it manually, we fix that issue
|
|
55
|
-
// As a follow up, we should fix the SDK directly
|
|
56
|
-
useAuthentication(partnerId);
|
|
57
|
-
// Use given accountOverride or activeAccount from thirdweb
|
|
58
|
-
// WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
|
|
59
|
-
// skip isAuthenticated check ?
|
|
60
|
-
const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
61
|
-
// Wrapper to set active wallet via thirdweb
|
|
62
|
-
// Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
|
|
63
|
-
// Auto-select first EOA wallet when enabled
|
|
64
|
-
useAutoSelectWallet({
|
|
65
|
-
enabled: automaticallySetFirstEoa,
|
|
66
|
-
});
|
|
67
|
-
return (_jsx(B3Context.Provider, { value: {
|
|
68
|
-
account: effectiveAccount,
|
|
69
|
-
// setWallet,
|
|
70
|
-
//wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
|
|
71
|
-
//user,
|
|
72
|
-
//setUser,
|
|
73
|
-
//refetchUser,
|
|
74
|
-
initialized: true,
|
|
75
|
-
ready: !!effectiveAccount,
|
|
76
|
-
automaticallySetFirstEoa,
|
|
77
|
-
environment,
|
|
78
|
-
defaultPermissions,
|
|
79
|
-
theme,
|
|
80
|
-
clientType,
|
|
81
|
-
partnerId: partnerId,
|
|
82
|
-
stripePublishableKey,
|
|
83
|
-
createClientReferenceId,
|
|
84
|
-
enableTurnkey,
|
|
85
|
-
}, children: children }));
|
|
33
|
+
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, children: _jsxs(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, defaultPermissions: defaultPermissions, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] }), _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }) }));
|
|
86
34
|
}
|
|
87
35
|
/**
|
|
88
36
|
* Component to connect the toast context to the global toast API
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
2
2
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
3
3
|
import { ClientType } from "../../../client-manager";
|
|
4
|
-
import { B3ContextType } from "./types";
|
|
5
4
|
/**
|
|
6
|
-
* Main B3Provider component
|
|
5
|
+
* Main B3Provider component
|
|
7
6
|
*/
|
|
8
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, }: {
|
|
7
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, defaultPermissions, }: {
|
|
9
8
|
theme: "light" | "dark";
|
|
10
9
|
children: React.ReactNode;
|
|
11
10
|
accountOverride?: Account;
|
|
12
|
-
environment
|
|
11
|
+
environment?: "development" | "production";
|
|
13
12
|
clientType?: ClientType;
|
|
14
13
|
partnerId: string;
|
|
15
14
|
rpcUrls?: Record<number, string>;
|
|
16
15
|
onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
16
|
+
defaultPermissions?: PermissionsConfig;
|
|
17
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
/**
|
|
19
|
-
* Inner provider component
|
|
19
|
+
* Inner provider component for native
|
|
20
20
|
*/
|
|
21
21
|
export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
accountOverride?: Account;
|
|
24
|
-
environment
|
|
24
|
+
environment?: "development" | "production";
|
|
25
25
|
defaultPermissions?: PermissionsConfig;
|
|
26
26
|
theme: "light" | "dark";
|
|
27
27
|
clientType?: ClientType;
|
|
@@ -1,50 +1,23 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
-
import { ThirdwebProvider
|
|
3
|
+
import { ThirdwebProvider } from "thirdweb/react";
|
|
4
4
|
import { WagmiProvider } from "wagmi";
|
|
5
5
|
import { createWagmiConfig } from "../../utils/createWagmiConfig.js";
|
|
6
|
+
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
7
|
+
import { B3ConfigProvider } from "./B3ConfigProvider.js";
|
|
6
8
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
7
|
-
import { B3Context } from "./types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Default permissions configuration for B3 provider
|
|
10
|
-
*/
|
|
11
|
-
const DEFAULT_PERMISSIONS = {
|
|
12
|
-
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
13
|
-
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
14
|
-
startDate: new Date(),
|
|
15
|
-
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
16
|
-
};
|
|
17
9
|
// Create queryClient instance
|
|
18
10
|
const queryClient = new QueryClient();
|
|
19
11
|
/**
|
|
20
|
-
* Main B3Provider component
|
|
12
|
+
* Main B3Provider component
|
|
21
13
|
*/
|
|
22
|
-
export function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, }) {
|
|
23
|
-
return (_jsx(ThirdwebProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children:
|
|
14
|
+
export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, defaultPermissions, }) {
|
|
15
|
+
return (_jsx(ThirdwebProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsxs(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: [children, _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }) }));
|
|
24
16
|
}
|
|
25
17
|
/**
|
|
26
|
-
* Inner provider component
|
|
18
|
+
* Inner provider component for native
|
|
27
19
|
*/
|
|
28
|
-
export function InnerProvider({ children, accountOverride, environment, defaultPermissions
|
|
29
|
-
const activeAccount = useActiveAccount();
|
|
30
|
-
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
20
|
+
export function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
31
21
|
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
|
|
32
|
-
|
|
33
|
-
const effectiveAccount = accountOverride || activeAccount;
|
|
34
|
-
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(B3Context.Provider, { value: {
|
|
35
|
-
//account: effectiveAccount,
|
|
36
|
-
automaticallySetFirstEoa: false,
|
|
37
|
-
//setWallet: () => {},
|
|
38
|
-
wallet: undefined,
|
|
39
|
-
//user,
|
|
40
|
-
//setUser,
|
|
41
|
-
initialized: true,
|
|
42
|
-
ready: !!effectiveAccount,
|
|
43
|
-
environment,
|
|
44
|
-
defaultPermissions,
|
|
45
|
-
theme,
|
|
46
|
-
clientType,
|
|
47
|
-
partnerId,
|
|
48
|
-
//refetchUser,
|
|
49
|
-
}, children: children }) }) }));
|
|
22
|
+
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: children }) }) }));
|
|
50
23
|
}
|
|
@@ -5,12 +5,14 @@ import { Wallet } from "thirdweb/wallets";
|
|
|
5
5
|
*/
|
|
6
6
|
export interface LocalSDKContextType {
|
|
7
7
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
8
|
+
onLogoutCallback?: () => void | Promise<void>;
|
|
8
9
|
}
|
|
9
10
|
export declare const LocalSDKContext: import("react").Context<LocalSDKContextType>;
|
|
10
11
|
/**
|
|
11
12
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
12
13
|
*/
|
|
13
|
-
export declare function LocalSDKProvider({ children, onConnectCallback, }: {
|
|
14
|
+
export declare function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }: {
|
|
14
15
|
children: React.ReactNode;
|
|
15
16
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
17
|
+
onLogoutCallback?: () => void | Promise<void>;
|
|
16
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,12 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext } from "react";
|
|
3
3
|
export const LocalSDKContext = createContext({
|
|
4
4
|
onConnectCallback: undefined,
|
|
5
|
+
onLogoutCallback: undefined,
|
|
5
6
|
});
|
|
6
7
|
/**
|
|
7
8
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
8
9
|
*/
|
|
9
|
-
export function LocalSDKProvider({ children, onConnectCallback, }) {
|
|
10
|
+
export function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }) {
|
|
10
11
|
return (_jsx(LocalSDKContext.Provider, { value: {
|
|
11
12
|
onConnectCallback,
|
|
13
|
+
onLogoutCallback,
|
|
12
14
|
}, children: children }));
|
|
13
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to access the B3
|
|
3
|
-
* @
|
|
2
|
+
* Hook to access the B3 configuration
|
|
3
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
4
4
|
*/
|
|
5
|
-
export declare function useB3(): import("./
|
|
5
|
+
export declare function useB3(): import("./B3ConfigProvider").B3ConfigContextType;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B3Context } from "./types.js";
|
|
1
|
+
import { useB3Config } from "./useB3Config.js";
|
|
3
2
|
/**
|
|
4
|
-
* Hook to access the B3
|
|
5
|
-
* @
|
|
3
|
+
* Hook to access the B3 configuration
|
|
4
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
6
5
|
*/
|
|
7
6
|
export function useB3() {
|
|
8
|
-
|
|
9
|
-
if (!context.initialized) {
|
|
10
|
-
throw new Error("useB3 must be used within a B3Provider");
|
|
11
|
-
}
|
|
12
|
-
// Return a stable reference
|
|
13
|
-
return useMemo(() => context, [context]);
|
|
7
|
+
return useB3Config();
|
|
14
8
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useActiveAccount } from "thirdweb/react";
|
|
2
|
+
import { useAuthStore } from "../../stores/useAuthStore.js";
|
|
2
3
|
// Wrapper around useActiveAccount
|
|
3
4
|
export const useB3Account = () => {
|
|
4
|
-
const
|
|
5
|
-
|
|
5
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
6
|
+
const activeAccount = useActiveAccount();
|
|
7
|
+
const effectiveAccount = isAuthenticated ? activeAccount : undefined;
|
|
8
|
+
return effectiveAccount;
|
|
6
9
|
};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
automaticallySetFirstEoa: boolean;
|
|
3
|
-
environment: "development" | "production" | undefined;
|
|
4
|
-
theme: "light" | "dark";
|
|
5
|
-
clientType: import("../../../client-manager").ClientType;
|
|
6
|
-
partnerId: string;
|
|
7
|
-
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
8
|
-
enableTurnkey: boolean | undefined;
|
|
9
|
-
};
|
|
1
|
+
export { useB3Config } from "./B3ConfigProvider";
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { B3Context } from "./types.js";
|
|
3
|
-
export const useB3Config = () => {
|
|
4
|
-
const context = useContext(B3Context);
|
|
5
|
-
if (!context) {
|
|
6
|
-
throw new Error("useB3 must be used within a B3Provider");
|
|
7
|
-
}
|
|
8
|
-
const { automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, } = context;
|
|
9
|
-
// Return a stable reference
|
|
10
|
-
return useMemo(() => ({
|
|
11
|
-
automaticallySetFirstEoa,
|
|
12
|
-
environment,
|
|
13
|
-
theme,
|
|
14
|
-
clientType,
|
|
15
|
-
partnerId,
|
|
16
|
-
createClientReferenceId,
|
|
17
|
-
enableTurnkey,
|
|
18
|
-
}), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
|
|
19
|
-
};
|
|
1
|
+
export { useB3Config } from "./B3ConfigProvider.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAccountWallet,
|
|
2
|
+
import { useAccountWallet, useModalStore, useProfile, useSimBalance, useUser, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
4
4
|
import { formatDisplayNumber } from "../../../../shared/utils/number.js";
|
|
5
5
|
import { Pencil } from "lucide-react";
|
|
@@ -15,8 +15,7 @@ const ProfileSection = () => {
|
|
|
15
15
|
address: eoaAddress || account?.address,
|
|
16
16
|
fresh: true,
|
|
17
17
|
});
|
|
18
|
-
const {
|
|
19
|
-
const { user } = useAuthentication(partnerId);
|
|
18
|
+
const { user } = useUser();
|
|
20
19
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
21
20
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
22
21
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ens_normalize } from "@adraffy/ens-normalize";
|
|
3
3
|
import app from "../../../../global-account/app.js";
|
|
4
|
-
import { toast, useAuthentication,
|
|
4
|
+
import { toast, useAuthentication, useB3Config, useModalStore, useProfile } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { Check, Loader2, Pencil, X } from "lucide-react";
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -15,7 +15,7 @@ const SettingsProfileCard = () => {
|
|
|
15
15
|
address: eoaAddress || account?.address,
|
|
16
16
|
fresh: true,
|
|
17
17
|
});
|
|
18
|
-
const { partnerId } =
|
|
18
|
+
const { partnerId } = useB3Config();
|
|
19
19
|
const { user, setUser } = useAuthentication(partnerId);
|
|
20
20
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
21
21
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
@@ -7,7 +7,7 @@ import { toast } from "../../Toast/toastApi.js";
|
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("DiscordChannel");
|
|
9
9
|
export const DiscordChannel = ({ userId, jwtToken, discordChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3Config();
|
|
11
11
|
const [discordId, setDiscordId] = useState("");
|
|
12
12
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
13
13
|
const [showInput, setShowInput] = useState(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
@@ -11,7 +11,7 @@ const validateEmail = (email) => {
|
|
|
11
11
|
return emailRegex.test(email);
|
|
12
12
|
};
|
|
13
13
|
export const EmailChannel = ({ userId, jwtToken, emailChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
14
|
-
const { partnerId } =
|
|
14
|
+
const { partnerId } = useB3Config();
|
|
15
15
|
const [email, setEmail] = useState("");
|
|
16
16
|
const [emailError, setEmailError] = useState(null);
|
|
17
17
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
@@ -7,7 +7,7 @@ import { toast } from "../../Toast/toastApi.js";
|
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("PhoneChannel");
|
|
9
9
|
export const PhoneChannel = ({ userId, jwtToken, smsChannel, whatsappChannel, isSMSConnected, isWhatsAppConnected, isOptimisticallySMSConnected, isOptimisticallyWhatsAppConnected, onConnectionChange, onToggle, }) => {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3Config();
|
|
11
11
|
const [phoneNumber, setPhoneNumber] = useState("");
|
|
12
12
|
const [isConnectingSMS, setIsConnectingSMS] = useState(false);
|
|
13
13
|
const [isConnectingWhatsApp, setIsConnectingWhatsApp] = useState(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
@@ -7,7 +7,7 @@ import { toast } from "../../Toast/toastApi.js";
|
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("TelegramChannel");
|
|
9
9
|
export const TelegramChannel = ({ userId, jwtToken, telegramChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3Config();
|
|
11
11
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
12
12
|
const [status, setStatus] = useState("idle");
|
|
13
13
|
// Detect if we're disconnecting
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, PermissionItem, useAddTWSessionKey,
|
|
2
|
+
import { Button, PermissionItem, useAddTWSessionKey, useB3Config, useGetAllTWSigners, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
4
|
import { formatAddress } from "../../../../shared/utils/formatAddress.js";
|
|
5
5
|
import { CreditCard, Eye } from "lucide-react";
|
|
@@ -14,7 +14,7 @@ const debug = debugB3React("RequestPermissions");
|
|
|
14
14
|
export function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
|
|
15
15
|
const [isApproving, setIsApproving] = useState(false);
|
|
16
16
|
const account = useActiveAccount();
|
|
17
|
-
const { defaultPermissions } =
|
|
17
|
+
const { defaultPermissions } = useB3Config();
|
|
18
18
|
const DEFAULT_PERMISSIONS = useMemo(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
|
|
19
19
|
const { refetch: refetchSigners } = useGetAllTWSigners({
|
|
20
20
|
chain,
|