@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,17 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B3Context } from "./types";
|
|
1
|
+
import { useB3Config } from "./useB3Config";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
* Hook to access the B3
|
|
6
|
-
* @
|
|
4
|
+
* Hook to access the B3 configuration
|
|
5
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
7
6
|
*/
|
|
8
7
|
export function useB3() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (!context.initialized) {
|
|
12
|
-
throw new Error("useB3 must be used within a B3Provider");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Return a stable reference
|
|
16
|
-
return useMemo(() => context, [context]);
|
|
8
|
+
return useB3Config();
|
|
17
9
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { useActiveAccount } from "thirdweb/react";
|
|
2
|
+
import { useAuthStore } from "../../stores/useAuthStore";
|
|
2
3
|
|
|
3
4
|
// Wrapper around useActiveAccount
|
|
4
5
|
export const useB3Account = () => {
|
|
5
|
-
const
|
|
6
|
-
|
|
6
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
7
|
+
const activeAccount = useActiveAccount();
|
|
8
|
+
const effectiveAccount = isAuthenticated ? activeAccount : undefined;
|
|
9
|
+
|
|
10
|
+
return effectiveAccount;
|
|
7
11
|
};
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { B3Context } from "./types";
|
|
3
|
-
|
|
4
|
-
export const useB3Config = () => {
|
|
5
|
-
const context = useContext(B3Context);
|
|
6
|
-
|
|
7
|
-
if (!context) {
|
|
8
|
-
throw new Error("useB3 must be used within a B3Provider");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
automaticallySetFirstEoa,
|
|
13
|
-
environment,
|
|
14
|
-
theme,
|
|
15
|
-
clientType,
|
|
16
|
-
partnerId,
|
|
17
|
-
createClientReferenceId,
|
|
18
|
-
enableTurnkey,
|
|
19
|
-
} = context;
|
|
20
|
-
|
|
21
|
-
// Return a stable reference
|
|
22
|
-
return useMemo(
|
|
23
|
-
() => ({
|
|
24
|
-
automaticallySetFirstEoa,
|
|
25
|
-
environment,
|
|
26
|
-
theme,
|
|
27
|
-
clientType,
|
|
28
|
-
partnerId,
|
|
29
|
-
createClientReferenceId,
|
|
30
|
-
enableTurnkey,
|
|
31
|
-
}),
|
|
32
|
-
[automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey],
|
|
33
|
-
);
|
|
34
|
-
};
|
|
1
|
+
export { useB3Config } from "./B3ConfigProvider";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAccountWallet,
|
|
3
|
-
useAuthentication,
|
|
4
|
-
useB3,
|
|
5
3
|
useModalStore,
|
|
6
4
|
useProfile,
|
|
7
5
|
useSimBalance,
|
|
6
|
+
useUser,
|
|
8
7
|
} from "@b3dotfun/sdk/global-account/react";
|
|
9
8
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
10
9
|
import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
@@ -22,8 +21,7 @@ const ProfileSection = () => {
|
|
|
22
21
|
address: eoaAddress || account?.address,
|
|
23
22
|
fresh: true,
|
|
24
23
|
});
|
|
25
|
-
const {
|
|
26
|
-
const { user } = useAuthentication(partnerId);
|
|
24
|
+
const { user } = useUser();
|
|
27
25
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
28
26
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
29
27
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ens_normalize } from "@adraffy/ens-normalize";
|
|
2
2
|
import app from "@b3dotfun/sdk/global-account/app";
|
|
3
|
-
import { toast, useAuthentication,
|
|
3
|
+
import { toast, useAuthentication, useB3Config, useModalStore, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
5
5
|
import { Check, Loader2, Pencil, X } from "lucide-react";
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -17,7 +17,7 @@ const SettingsProfileCard = () => {
|
|
|
17
17
|
address: eoaAddress || account?.address,
|
|
18
18
|
fresh: true,
|
|
19
19
|
});
|
|
20
|
-
const { partnerId } =
|
|
20
|
+
const { partnerId } = useB3Config();
|
|
21
21
|
const { user, setUser } = useAuthentication(partnerId);
|
|
22
22
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
23
23
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI";
|
|
@@ -26,7 +26,7 @@ export const DiscordChannel = ({
|
|
|
26
26
|
onConnectionChange,
|
|
27
27
|
onToggle,
|
|
28
28
|
}: DiscordChannelProps) => {
|
|
29
|
-
const { partnerId } =
|
|
29
|
+
const { partnerId } = useB3Config();
|
|
30
30
|
|
|
31
31
|
const [discordId, setDiscordId] = useState("");
|
|
32
32
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI";
|
|
@@ -31,7 +31,7 @@ export const EmailChannel = ({
|
|
|
31
31
|
onConnectionChange,
|
|
32
32
|
onToggle,
|
|
33
33
|
}: EmailChannelProps) => {
|
|
34
|
-
const { partnerId } =
|
|
34
|
+
const { partnerId } = useB3Config();
|
|
35
35
|
|
|
36
36
|
const [email, setEmail] = useState("");
|
|
37
37
|
const [emailError, setEmailError] = useState<string | null>(null);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI";
|
|
@@ -32,7 +32,7 @@ export const PhoneChannel = ({
|
|
|
32
32
|
onConnectionChange,
|
|
33
33
|
onToggle,
|
|
34
34
|
}: PhoneChannelProps) => {
|
|
35
|
-
const { partnerId } =
|
|
35
|
+
const { partnerId } = useB3Config();
|
|
36
36
|
|
|
37
37
|
const [phoneNumber, setPhoneNumber] = useState("");
|
|
38
38
|
const [isConnectingSMS, setIsConnectingSMS] = useState(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { notificationsAPI } from "../../../utils/notificationsAPI";
|
|
@@ -26,7 +26,7 @@ export const TelegramChannel = ({
|
|
|
26
26
|
onConnectionChange,
|
|
27
27
|
onToggle,
|
|
28
28
|
}: TelegramChannelProps) => {
|
|
29
|
-
const { partnerId } =
|
|
29
|
+
const { partnerId } = useB3Config();
|
|
30
30
|
|
|
31
31
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
32
32
|
const [status, setStatus] = useState<"idle" | "pending" | "connected">("idle");
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
PermissionItem,
|
|
4
4
|
RequestPermissionsModalProps,
|
|
5
5
|
useAddTWSessionKey,
|
|
6
|
-
|
|
6
|
+
useB3Config,
|
|
7
7
|
useGetAllTWSigners,
|
|
8
8
|
} from "@b3dotfun/sdk/global-account/react";
|
|
9
9
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
@@ -30,7 +30,7 @@ export function RequestPermissions({
|
|
|
30
30
|
}: RequestPermissionsModalProps) {
|
|
31
31
|
const [isApproving, setIsApproving] = useState(false);
|
|
32
32
|
const account = useActiveAccount();
|
|
33
|
-
const { defaultPermissions } =
|
|
33
|
+
const { defaultPermissions } = useB3Config();
|
|
34
34
|
const DEFAULT_PERMISSIONS = useMemo(
|
|
35
35
|
() => permissions ?? (defaultPermissions as PermissionsConfig),
|
|
36
36
|
[defaultPermissions, permissions],
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
StyleRoot,
|
|
6
6
|
useAccountWallet,
|
|
7
7
|
useAuthentication,
|
|
8
|
-
|
|
8
|
+
useB3Config,
|
|
9
9
|
useIsMobile,
|
|
10
10
|
} from "@b3dotfun/sdk/global-account/react";
|
|
11
11
|
import Icon from "@b3dotfun/sdk/global-account/react/components/custom/Icon";
|
|
@@ -30,7 +30,7 @@ type SignInWithB3Props = Omit<SignInWithB3ModalProps, "type" | "showBackButton">
|
|
|
30
30
|
|
|
31
31
|
export function SignIn(props: SignInWithB3Props) {
|
|
32
32
|
const { className } = props;
|
|
33
|
-
const { automaticallySetFirstEoa, partnerId } =
|
|
33
|
+
const { automaticallySetFirstEoa, partnerId } = useB3Config();
|
|
34
34
|
const {
|
|
35
35
|
address: globalAddress,
|
|
36
36
|
ensName,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { Users } from "@b3dotfun/b3-api";
|
|
1
2
|
import {
|
|
2
3
|
Loading,
|
|
3
4
|
SignInWithB3ModalProps,
|
|
4
5
|
useAuthentication,
|
|
5
6
|
useAuthStore,
|
|
6
|
-
|
|
7
|
+
useB3Config,
|
|
7
8
|
useGetAllTWSigners,
|
|
8
9
|
useModalStore,
|
|
9
10
|
} from "@b3dotfun/sdk/global-account/react";
|
|
@@ -34,8 +35,9 @@ export function SignInWithB3Flow({
|
|
|
34
35
|
closeAfterLogin = false,
|
|
35
36
|
source = "signInWithB3Button",
|
|
36
37
|
signersEnabled = false,
|
|
38
|
+
onTurnkeyConnect,
|
|
37
39
|
}: SignInWithB3ModalProps) {
|
|
38
|
-
const { automaticallySetFirstEoa, enableTurnkey } =
|
|
40
|
+
const { automaticallySetFirstEoa, enableTurnkey } = useB3Config();
|
|
39
41
|
const { user, refetchUser, logout } = useAuthentication(partnerId);
|
|
40
42
|
|
|
41
43
|
// FIXME Logout before login to ensure a clean state
|
|
@@ -395,7 +397,7 @@ export function SignInWithB3Flow({
|
|
|
395
397
|
content = (
|
|
396
398
|
<LoginStepContainer partnerId={partnerId}>
|
|
397
399
|
<TurnkeyAuthModal
|
|
398
|
-
onSuccess={async (authenticatedUser:
|
|
400
|
+
onSuccess={async (authenticatedUser: Users) => {
|
|
399
401
|
debug("Turnkey authentication successful in primary flow", { authenticatedUser });
|
|
400
402
|
setTurnkeyAuthCompleted(true);
|
|
401
403
|
// After Turnkey auth, refetch user to get the full user object
|
|
@@ -408,6 +410,8 @@ export function SignInWithB3Flow({
|
|
|
408
410
|
setJustCompletedLogin(true);
|
|
409
411
|
// Call the login success callback
|
|
410
412
|
onLoginSuccess?.({} as Account);
|
|
413
|
+
// Call the onTurnkeyConnect callback
|
|
414
|
+
onTurnkeyConnect?.(authenticatedUser);
|
|
411
415
|
}}
|
|
412
416
|
onClose={() => {
|
|
413
417
|
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Loading,
|
|
3
3
|
useAuthentication,
|
|
4
4
|
useAuthStore,
|
|
5
|
-
|
|
5
|
+
useB3Config,
|
|
6
6
|
useHandleConnectWithPrivy,
|
|
7
7
|
} from "@b3dotfun/sdk/global-account/react";
|
|
8
8
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
@@ -19,7 +19,7 @@ interface SignInWithB3PrivyProps {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function SignInWithB3Privy({ onSuccess, onError, chain }: SignInWithB3PrivyProps) {
|
|
22
|
-
const { partnerId } =
|
|
22
|
+
const { partnerId } = useB3Config();
|
|
23
23
|
const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
|
|
24
24
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
25
25
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useAuthentication,
|
|
1
|
+
import { useAuthentication, useB3Config, useQueryB3 } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
|
|
3
3
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
4
4
|
import { Chain } from "thirdweb";
|
|
@@ -50,7 +50,7 @@ export function LoginStepContainer({ children, partnerId }: LoginStepContainerPr
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function LoginStep({ onSuccess, chain }: LoginStepProps) {
|
|
53
|
-
const { partnerId, theme } =
|
|
53
|
+
const { partnerId, theme } = useB3Config();
|
|
54
54
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
55
55
|
partnerId: partnerId,
|
|
56
56
|
});
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
LoginStepContainer,
|
|
8
8
|
useAuthentication,
|
|
9
9
|
useAuthStore,
|
|
10
|
-
|
|
10
|
+
useB3Config,
|
|
11
11
|
useConnect,
|
|
12
12
|
WalletRow,
|
|
13
13
|
} from "@b3dotfun/sdk/global-account/react";
|
|
@@ -37,7 +37,7 @@ export function LoginStepCustom({
|
|
|
37
37
|
maxInitialWallets = 2,
|
|
38
38
|
automaticallySetFirstEoa,
|
|
39
39
|
}: LoginStepCustomProps) {
|
|
40
|
-
const { partnerId } =
|
|
40
|
+
const { partnerId } = useB3Config();
|
|
41
41
|
const [isLoading, setIsLoading] = useState(false);
|
|
42
42
|
const [showAllWallets, setShowAllWallets] = useState(false);
|
|
43
43
|
const { connect } = useConnect(partnerId, chain);
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# SingleUserSearchSelector Component
|
|
2
|
+
|
|
3
|
+
A specialized React component for searching and selecting a single user profile. This component is designed specifically for single-user selection scenarios, not for multi-user or general profile browsing.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔍 Search by address or name
|
|
8
|
+
- 🎯 Filter results by profile type (b3-ens, thirdweb-\*, ens-data, global-account)
|
|
9
|
+
- 📋 Shows a single result in a dropdown
|
|
10
|
+
- ⚡ Debounced search (500ms)
|
|
11
|
+
- 🎨 Styled consistently with B3 design system
|
|
12
|
+
- ♿ Accessible with proper keyboard navigation
|
|
13
|
+
- 📱 Responsive design
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic Example
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { SingleUserSearchSelector } from "@b3dotfun/sdk/global-account/react";
|
|
21
|
+
|
|
22
|
+
function MyComponent() {
|
|
23
|
+
return (
|
|
24
|
+
<SingleUserSearchSelector
|
|
25
|
+
onSelectUser={profile => {
|
|
26
|
+
console.log("Selected user:", profile);
|
|
27
|
+
// Handle user selection
|
|
28
|
+
}}
|
|
29
|
+
placeholder="Search by address or name..."
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### With Profile Type Filter
|
|
36
|
+
|
|
37
|
+
Filter results to only show specific profile types:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<SingleUserSearchSelector
|
|
41
|
+
onSelectUser={profile => {
|
|
42
|
+
console.log("Selected user:", profile);
|
|
43
|
+
}}
|
|
44
|
+
profileTypeFilter={["b3-ens", "global-account"]}
|
|
45
|
+
placeholder="Search B3 users..."
|
|
46
|
+
/>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Available Profile Types
|
|
50
|
+
|
|
51
|
+
- `b3-ens` - B3 ENS profiles
|
|
52
|
+
- `thirdweb-${string}` - Thirdweb profiles (e.g., thirdweb-email, thirdweb-wallet)
|
|
53
|
+
- `ens-data` - ENS data profiles
|
|
54
|
+
- `global-account` - Global account profiles
|
|
55
|
+
|
|
56
|
+
### Custom Styling
|
|
57
|
+
|
|
58
|
+
You can apply custom styles using the `className` prop or target specific elements using CSS class names:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<SingleUserSearchSelector
|
|
62
|
+
onSelectUser={profile => {
|
|
63
|
+
console.log("Selected user:", profile);
|
|
64
|
+
}}
|
|
65
|
+
className="mx-auto max-w-md"
|
|
66
|
+
placeholder="Find a user..."
|
|
67
|
+
showClearButton={true}
|
|
68
|
+
minSearchLength={3}
|
|
69
|
+
/>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### CSS Class Names for Custom Styling
|
|
73
|
+
|
|
74
|
+
The component includes semantic class names for easy customization:
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
/* Main container */
|
|
78
|
+
.single-user-search-selector {
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Input wrapper */
|
|
82
|
+
.single-user-search-input-wrapper {
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Search icon */
|
|
86
|
+
.single-user-search-icon {
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Input field */
|
|
90
|
+
.single-user-search-input {
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Clear button */
|
|
94
|
+
.single-user-search-clear-button {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Loading state */
|
|
98
|
+
.single-user-search-loading {
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Error state */
|
|
102
|
+
.single-user-search-error {
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Dropdown container */
|
|
106
|
+
.single-user-search-dropdown {
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Result button */
|
|
110
|
+
.single-user-search-result-button {
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Avatar container */
|
|
114
|
+
.single-user-search-result-avatar {
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Profile info container */
|
|
118
|
+
.single-user-search-result-info {
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Display name */
|
|
122
|
+
.single-user-search-result-name {
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Address */
|
|
126
|
+
.single-user-search-result-address {
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Bio */
|
|
130
|
+
.single-user-search-result-bio {
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Badges container */
|
|
134
|
+
.single-user-search-result-badges {
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Individual badge */
|
|
138
|
+
.single-user-search-result-badge {
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Example customization:
|
|
143
|
+
|
|
144
|
+
```css
|
|
145
|
+
/* Custom styling example */
|
|
146
|
+
.single-user-search-input {
|
|
147
|
+
border-radius: 12px;
|
|
148
|
+
font-size: 16px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.single-user-search-dropdown {
|
|
152
|
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.single-user-search-result-name {
|
|
156
|
+
color: #0c68e9;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Props
|
|
161
|
+
|
|
162
|
+
| Prop | Type | Default | Description |
|
|
163
|
+
| ------------------- | ------------------------------------ | ------------------------------------- | ----------------------------------------------------------------------------- |
|
|
164
|
+
| `onSelectUser` | `(profile: CombinedProfile) => void` | **Required** | Callback function when a user is selected. Returns the complete profile data. |
|
|
165
|
+
| `profileTypeFilter` | `ProfileTypeFilter[]` | `undefined` | Optional filter to only show profiles with specific types. |
|
|
166
|
+
| `placeholder` | `string` | `"Search by address, name, or ID..."` | Custom placeholder text for the search input. |
|
|
167
|
+
| `className` | `string` | `undefined` | Custom class name for the container. |
|
|
168
|
+
| `showClearButton` | `boolean` | `true` | Show clear button when there's input. |
|
|
169
|
+
| `minSearchLength` | `number` | `3` | Minimum characters before triggering search. |
|
|
170
|
+
|
|
171
|
+
## Profile Data Structure
|
|
172
|
+
|
|
173
|
+
The `onSelectUser` callback receives a `CombinedProfile` object:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
interface CombinedProfile {
|
|
177
|
+
name: string | null;
|
|
178
|
+
address: string | null;
|
|
179
|
+
avatar: string | undefined;
|
|
180
|
+
bio: string | null;
|
|
181
|
+
displayName: string | null;
|
|
182
|
+
profiles: Profile[];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface Profile {
|
|
186
|
+
type: string;
|
|
187
|
+
address?: string;
|
|
188
|
+
name?: string;
|
|
189
|
+
avatar?: string | null;
|
|
190
|
+
bio?: string | null;
|
|
191
|
+
displayName?: string | null;
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Examples
|
|
196
|
+
|
|
197
|
+
### In a Modal
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import { SingleUserSearchSelector } from "@b3dotfun/sdk/global-account/react";
|
|
201
|
+
import { Dialog } from "@radix-ui/react-dialog";
|
|
202
|
+
|
|
203
|
+
function UserSearchModal({ isOpen, onClose }) {
|
|
204
|
+
return (
|
|
205
|
+
<Dialog open={isOpen} onOpenChange={onClose}>
|
|
206
|
+
<DialogContent>
|
|
207
|
+
<h2>Find User</h2>
|
|
208
|
+
<SingleUserSearchSelector
|
|
209
|
+
onSelectUser={profile => {
|
|
210
|
+
console.log("Selected:", profile);
|
|
211
|
+
onClose();
|
|
212
|
+
}}
|
|
213
|
+
profileTypeFilter={["b3-ens", "global-account"]}
|
|
214
|
+
/>
|
|
215
|
+
</DialogContent>
|
|
216
|
+
</Dialog>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### With State Management
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
import { SingleUserSearchSelector } from "@b3dotfun/sdk/global-account/react";
|
|
225
|
+
import type { CombinedProfile } from "@b3dotfun/sdk/global-account/react";
|
|
226
|
+
import { useState } from "react";
|
|
227
|
+
|
|
228
|
+
function UserSelector() {
|
|
229
|
+
const [selectedUser, setSelectedUser] = useState<CombinedProfile | null>(null);
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<div>
|
|
233
|
+
<SingleUserSearchSelector onSelectUser={setSelectedUser} profileTypeFilter={["b3-ens"]} />
|
|
234
|
+
|
|
235
|
+
{selectedUser && (
|
|
236
|
+
<div className="mt-4">
|
|
237
|
+
<h3>Selected User</h3>
|
|
238
|
+
<p>Name: {selectedUser.displayName || selectedUser.name}</p>
|
|
239
|
+
<p>Address: {selectedUser.address}</p>
|
|
240
|
+
</div>
|
|
241
|
+
)}
|
|
242
|
+
</div>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Notes
|
|
248
|
+
|
|
249
|
+
- The component uses the B3 Profiles API (`https://profiles.b3.fun`)
|
|
250
|
+
- Search is debounced by 500ms to avoid excessive API calls
|
|
251
|
+
- Only one result is shown at a time (by design for single-user selection)
|
|
252
|
+
- The dropdown closes automatically when a user is selected
|
|
253
|
+
- Click outside the dropdown to close it
|
|
254
|
+
- The component handles loading and error states automatically
|
|
255
|
+
|
|
256
|
+
## Exporting
|
|
257
|
+
|
|
258
|
+
The component is exported from the SDK package:
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
// From main export
|
|
262
|
+
import { SingleUserSearchSelector } from "@b3dotfun/sdk/global-account/react";
|
|
263
|
+
|
|
264
|
+
// From specific path
|
|
265
|
+
import { SingleUserSearchSelector } from "@b3dotfun/sdk/global-account/react/components/SingleUserSearchSelector";
|
|
266
|
+
```
|