@b3dotfun/sdk 0.0.88-alpha.5 → 0.0.88-alpha.6
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 +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -3
- 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/B3Provider.d.ts +2 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +23 -57
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +38 -35
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +8 -9
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
- package/dist/cjs/global-account/react/components/index.d.ts +1 -2
- package/dist/cjs/global-account/react/components/index.js +3 -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.js +1 -2
- package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
- package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +9 -35
- 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/configStore.d.ts +24 -0
- package/dist/cjs/global-account/react/stores/configStore.js +30 -0
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- 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/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -4
- 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/B3Provider.d.ts +2 -18
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +22 -58
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
- 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 -3
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
- package/dist/esm/global-account/react/components/index.d.ts +1 -2
- package/dist/esm/global-account/react/components/index.js +1 -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.js +2 -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/useTokenBalance.js +6 -6
- 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.js +1 -27
- 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/configStore.d.ts +24 -0
- package/dist/esm/global-account/react/stores/configStore.js +27 -0
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -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/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/types/global-account/react/components/index.d.ts +1 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/types/global-account/react/index.native.d.ts +0 -2
- package/dist/types/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -4
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +3 -4
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +43 -54
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +32 -117
- package/src/global-account/react/components/B3Provider/useB3.ts +4 -13
- package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
- package/src/global-account/react/components/B3Provider/useB3Config.ts +18 -31
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/StyleRoot.tsx +3 -3
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
- package/src/global-account/react/components/index.ts +1 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +2 -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/useTokenBalance.tsx +8 -7
- package/src/global-account/react/hooks/useUser.ts +20 -0
- package/src/global-account/react/hooks/useUserQuery.ts +1 -40
- package/src/global-account/react/index.native.ts +0 -2
- package/src/global-account/react/stores/configStore.ts +51 -0
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/userStore.ts +41 -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,9 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access B3 configuration
|
|
3
|
+
* Returns all config values from the Zustand store
|
|
4
|
+
* Since config is static (set once at initialization), destructuring is fine here
|
|
5
|
+
*/
|
|
1
6
|
export declare const useB3Config: () => {
|
|
2
7
|
automaticallySetFirstEoa: boolean;
|
|
3
|
-
environment: "development" | "production"
|
|
8
|
+
environment: "development" | "production";
|
|
4
9
|
theme: "light" | "dark";
|
|
5
10
|
clientType: import("../../../client-manager").ClientType;
|
|
6
11
|
partnerId: string;
|
|
7
12
|
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
8
|
-
enableTurnkey: boolean
|
|
13
|
+
enableTurnkey: boolean;
|
|
14
|
+
stripePublishableKey: string | undefined;
|
|
15
|
+
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
16
|
+
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
9
17
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useB3ConfigStore } from "../../stores/configStore.js";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access B3 configuration
|
|
4
|
+
* Returns all config values from the Zustand store
|
|
5
|
+
* Since config is static (set once at initialization), destructuring is fine here
|
|
6
|
+
*/
|
|
3
7
|
export const useB3Config = () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
createClientReferenceId,
|
|
17
|
-
enableTurnkey,
|
|
18
|
-
}), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
|
|
8
|
+
return useB3ConfigStore(state => ({
|
|
9
|
+
automaticallySetFirstEoa: state.automaticallySetFirstEoa,
|
|
10
|
+
environment: state.environment,
|
|
11
|
+
theme: state.theme,
|
|
12
|
+
clientType: state.clientType,
|
|
13
|
+
partnerId: state.partnerId,
|
|
14
|
+
createClientReferenceId: state.createClientReferenceId,
|
|
15
|
+
enableTurnkey: state.enableTurnkey,
|
|
16
|
+
stripePublishableKey: state.stripePublishableKey,
|
|
17
|
+
defaultPermissions: state.defaultPermissions,
|
|
18
|
+
accountOverride: state.accountOverride,
|
|
19
|
+
}));
|
|
19
20
|
};
|
|
@@ -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,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
-
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
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,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
-
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
import { toast } from "../../Toast/toastApi.js";
|
|
7
7
|
import { NotificationChannel } from "../NotificationChannel.js";
|
|
8
8
|
const debug = debugB3React("EmailChannel");
|
|
@@ -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,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
-
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
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,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useB3Config } from "../../../../../global-account/react/index.js";
|
|
2
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { notificationsAPI } from "../../../utils/notificationsAPI.js";
|
|
5
|
-
import { useB3 } from "../../B3Provider/useB3.js";
|
|
6
6
|
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,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button,
|
|
3
|
-
import { PermissionItem } from "../../../../global-account/react/index.js";
|
|
2
|
+
import { Button, PermissionItem, useAddTWSessionKey, useB3Config, useGetAllTWSigners, } from "../../../../global-account/react/index.js";
|
|
4
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
5
4
|
import { formatAddress } from "../../../../shared/utils/formatAddress.js";
|
|
6
5
|
import { CreditCard, Eye } from "lucide-react";
|
|
@@ -15,7 +14,7 @@ const debug = debugB3React("RequestPermissions");
|
|
|
15
14
|
export function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
|
|
16
15
|
const [isApproving, setIsApproving] = useState(false);
|
|
17
16
|
const account = useActiveAccount();
|
|
18
|
-
const { defaultPermissions } =
|
|
17
|
+
const { defaultPermissions } = useB3Config();
|
|
19
18
|
const DEFAULT_PERMISSIONS = useMemo(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
|
|
20
19
|
const { refetch: refetchSigners } = useGetAllTWSigners({
|
|
21
20
|
chain,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication,
|
|
2
|
+
import { IPFSMediaRenderer, SignInWithB3, StyleRoot, useAccountWallet, useAuthentication, useB3Config, useIsMobile, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import Icon from "../../../../global-account/react/components/custom/Icon.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
5
5
|
import { cn, truncateAddress } from "../../../../shared/utils/index.js";
|
|
@@ -9,7 +9,7 @@ import { useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdwe
|
|
|
9
9
|
import { ManageAccountButton } from "../custom/ManageAccountButton.js";
|
|
10
10
|
export function SignIn(props) {
|
|
11
11
|
const { className } = props;
|
|
12
|
-
const { automaticallySetFirstEoa, partnerId } =
|
|
12
|
+
const { automaticallySetFirstEoa, partnerId } = useB3Config();
|
|
13
13
|
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = useAccountWallet();
|
|
14
14
|
const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
|
|
15
15
|
const isMobile = useIsMobile();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useAuthentication, useAuthStore,
|
|
2
|
+
import { Loading, useAuthentication, useAuthStore, useB3Config, useHandleConnectWithPrivy, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
4
|
import { useEffect } from "react";
|
|
5
5
|
const debug = debugB3React("SignInWithB3Privy");
|
|
6
6
|
export function SignInWithB3Privy({ onSuccess, onError, chain }) {
|
|
7
|
-
const { partnerId } =
|
|
7
|
+
const { partnerId } = useB3Config();
|
|
8
8
|
const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
|
|
9
9
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
10
10
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAuthentication,
|
|
2
|
+
import { useAuthentication, useB3Config, useQueryB3 } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { ecosystemWalletId } from "../../../../../shared/constants/index.js";
|
|
4
4
|
import { client } from "../../../../../shared/utils/thirdweb.js";
|
|
5
5
|
import { ConnectEmbed, darkTheme, lightTheme } from "thirdweb/react";
|
|
@@ -15,7 +15,7 @@ export function LoginStepContainer({ children, partnerId }) {
|
|
|
15
15
|
return (_jsxs("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && (_jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
|
|
16
16
|
}
|
|
17
17
|
export function LoginStep({ onSuccess, chain }) {
|
|
18
|
-
const { partnerId, theme } =
|
|
18
|
+
const { partnerId, theme } = useB3Config();
|
|
19
19
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
20
20
|
partnerId: partnerId,
|
|
21
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore,
|
|
2
|
+
import { AuthButton, Button, getConnectOptionsFromStrategy, isWalletType, LoginStepContainer, useAuthentication, useAuthStore, useB3Config, useConnect, WalletRow, } from "../../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../../shared/utils/debug.js";
|
|
4
4
|
import { client } from "../../../../../shared/utils/thirdweb.js";
|
|
5
5
|
import { useState } from "react";
|
|
@@ -7,7 +7,7 @@ import { useConnect as useConnectTW } from "thirdweb/react";
|
|
|
7
7
|
import { createWallet } from "thirdweb/wallets";
|
|
8
8
|
const debug = debugB3React("LoginStepCustom");
|
|
9
9
|
export function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
|
|
10
|
-
const { partnerId } =
|
|
10
|
+
const { partnerId } = useB3Config();
|
|
11
11
|
const [isLoading, setIsLoading] = useState(false);
|
|
12
12
|
const [showAllWallets, setShowAllWallets] = useState(false);
|
|
13
13
|
const { connect } = useConnect(partnerId, chain);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useB3Config } from "./B3Provider/useB3Config.js";
|
|
3
3
|
export function StyleRoot({ children, id }) {
|
|
4
|
-
const { theme
|
|
5
|
-
return (_jsx("div", { className: "b3-root", id: id, "data-theme":
|
|
4
|
+
const { theme } = useB3Config();
|
|
5
|
+
return (_jsx("div", { className: "b3-root", id: id, "data-theme": theme, children: children }));
|
|
6
6
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, StyleRoot,
|
|
2
|
+
import { Button, StyleRoot, useModalStore, useUser } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { cn } from "../../../../shared/utils/index.js";
|
|
4
4
|
export function ManageAccountButton(props) {
|
|
5
|
-
const { partnerId } = useB3();
|
|
6
5
|
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
|
|
7
|
-
const { isConnected } =
|
|
6
|
+
const { isConnected } = useUser();
|
|
8
7
|
const handleClickManageAccount = () => {
|
|
9
8
|
setB3ModalContentType({
|
|
10
9
|
...props,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
|
-
export { B3Provider
|
|
2
|
+
export { B3Provider } from "./B3Provider/B3Provider";
|
|
3
3
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
|
-
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
4
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
5
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
7
6
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
2
2
|
// Core Components
|
|
3
3
|
export { B3DynamicModal } from "./B3DynamicModal.js";
|
|
4
|
-
export { B3Provider
|
|
4
|
+
export { B3Provider } from "./B3Provider/B3Provider.js";
|
|
5
5
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
|
|
6
|
-
export { B3Context } from "./B3Provider/types.js";
|
|
7
6
|
export { useB3 } from "./B3Provider/useB3.js";
|
|
8
7
|
export { useB3Account } from "./B3Provider/useB3Account.js";
|
|
9
8
|
export { useB3Config } from "./B3Provider/useB3Config.js";
|
|
@@ -43,3 +43,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
|
43
43
|
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
44
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
45
45
|
export { useURLParams } from "./useURLParams";
|
|
46
|
+
export { useUser } from "./useUser";
|
|
@@ -43,3 +43,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress.js";
|
|
|
43
43
|
export { useTurnkeyAuth } from "./useTurnkeyAuth.js";
|
|
44
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute.js";
|
|
45
45
|
export { useURLParams } from "./useURLParams.js";
|
|
46
|
+
export { useUser } from "./useUser.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import app from "../../../global-account/app.js";
|
|
2
2
|
import { authenticateWithB3JWT } from "../../../global-account/bsmnt.js";
|
|
3
|
-
import { useAuthStore } from "../../../global-account/react/index.js";
|
|
3
|
+
import { useAuthStore, useB3Config } from "../../../global-account/react/index.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../shared/constants/index.js";
|
|
5
5
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
6
6
|
import { client } from "../../../shared/utils/thirdweb.js";
|
|
@@ -11,7 +11,6 @@ import { ecosystemWallet } from "thirdweb/wallets";
|
|
|
11
11
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
12
12
|
import { useAccount, useConnect, useSwitchAccount } from "wagmi";
|
|
13
13
|
import { LocalSDKContext } from "../components/B3Provider/LocalSDKProvider.js";
|
|
14
|
-
import { useB3 } from "../components/B3Provider/useB3.js";
|
|
15
14
|
import { createWagmiConfig } from "../utils/createWagmiConfig.js";
|
|
16
15
|
import { useSearchParam } from "./useSearchParamsSSR.js";
|
|
17
16
|
import { useUserQuery } from "./useUserQuery.js";
|
|
@@ -39,7 +38,7 @@ export function useAuth() {
|
|
|
39
38
|
const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
|
|
40
39
|
const useAutoConnectLoadingPrevious = useRef(false);
|
|
41
40
|
const referralCode = useSearchParam("referralCode");
|
|
42
|
-
const { partnerId } =
|
|
41
|
+
const { partnerId } = useB3Config();
|
|
43
42
|
const wagmiConfig = createWagmiConfig({ partnerId });
|
|
44
43
|
const { connect } = useConnect();
|
|
45
44
|
const activeWagmiAccount = useAccount();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config } from "../../../global-account/react/index.js";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { authenticateBoth, authenticateWithClient, getClient, getClientByType, setClientType, } from "../../client-manager.js";
|
|
4
4
|
/**
|
|
5
5
|
* Hook to access the current FeathersJS client and client management utilities
|
|
6
6
|
*/
|
|
7
7
|
export function useClient() {
|
|
8
|
-
const { clientType } =
|
|
8
|
+
const { clientType } = useB3Config();
|
|
9
9
|
const getCurrentClient = useCallback(() => {
|
|
10
10
|
return getClient();
|
|
11
11
|
}, []);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3Config, useConnect } from "../../../global-account/react/index.js";
|
|
2
2
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
3
3
|
import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
@@ -8,7 +8,7 @@ const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
|
|
|
8
8
|
* Currently, this is for the basement-privy strategy
|
|
9
9
|
*/
|
|
10
10
|
export function useHandleConnectWithPrivy(chain, onSuccess) {
|
|
11
|
-
const { partnerId } =
|
|
11
|
+
const { partnerId } = useB3Config();
|
|
12
12
|
if (!chain) {
|
|
13
13
|
throw new Error("Chain is required");
|
|
14
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { useB3Config } from "../../../global-account/react/index.js";
|
|
1
2
|
import { getAuthToken } from "../../../shared/utils/auth-token.js";
|
|
2
3
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
3
4
|
import { useCallback, useEffect, useState } from "react";
|
|
4
|
-
import { useB3 } from "../components/index.js";
|
|
5
5
|
import { notificationsAPI } from "../utils/notificationsAPI.js";
|
|
6
6
|
import { useUserQuery } from "./useUserQuery.js";
|
|
7
7
|
const debug = debugB3React("useNotifications");
|
|
@@ -27,7 +27,7 @@ const debug = debugB3React("useNotifications");
|
|
|
27
27
|
*/
|
|
28
28
|
export function useNotifications() {
|
|
29
29
|
const { user } = useUserQuery();
|
|
30
|
-
const { partnerId } =
|
|
30
|
+
const { partnerId } = useB3Config();
|
|
31
31
|
const [userData, setUserData] = useState(null);
|
|
32
32
|
const [loading, setLoading] = useState(true);
|
|
33
33
|
const [error, setError] = useState(null);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isNativeToken } from "../../../anyspend/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useAccountWallet, useAuthStore } from "../../../global-account/react/index.js";
|
|
4
4
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
5
5
|
import { getERC20Balances, getNativeTokenBalance } from "../../../shared/utils/thirdweb-insights.js";
|
|
6
6
|
import { useQuery } from "@tanstack/react-query";
|
|
7
7
|
import { useEffect } from "react";
|
|
8
8
|
export function useTokenBalance({ token, address }) {
|
|
9
|
-
const
|
|
9
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
10
10
|
const account = useAccountWallet();
|
|
11
11
|
const effectiveAddress = address || account?.address;
|
|
12
12
|
const { data: tokenBalance, isLoading, isFetching, refetch, } = useQuery({
|
|
@@ -38,7 +38,7 @@ export function useTokenBalance({ token, address }) {
|
|
|
38
38
|
}
|
|
39
39
|
return { formatted: "0", raw: null };
|
|
40
40
|
},
|
|
41
|
-
enabled:
|
|
41
|
+
enabled: isAuthenticated && !!effectiveAddress,
|
|
42
42
|
staleTime: 30000,
|
|
43
43
|
gcTime: 5 * 60 * 1000,
|
|
44
44
|
retry: 2,
|
|
@@ -46,12 +46,12 @@ export function useTokenBalance({ token, address }) {
|
|
|
46
46
|
});
|
|
47
47
|
// Force a refetch when the wallet or token changes
|
|
48
48
|
useEffect(() => {
|
|
49
|
-
if (
|
|
49
|
+
if (isAuthenticated && effectiveAddress) {
|
|
50
50
|
refetch();
|
|
51
51
|
}
|
|
52
|
-
}, [
|
|
52
|
+
}, [isAuthenticated, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
|
|
53
53
|
// Determine if we're actually loading
|
|
54
|
-
const isActuallyLoading = !
|
|
54
|
+
const isActuallyLoading = !isAuthenticated || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
|
|
55
55
|
return {
|
|
56
56
|
rawBalance: tokenBalance?.raw || BigInt(0),
|
|
57
57
|
formattedBalance: tokenBalance?.formatted || "0",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preferred Hook to get the user data
|
|
3
|
+
*/
|
|
4
|
+
export declare function useUser(): {
|
|
5
|
+
user: {
|
|
6
|
+
email?: string | undefined;
|
|
7
|
+
username?: string | undefined;
|
|
8
|
+
telNumber?: string | undefined;
|
|
9
|
+
ens?: string | undefined;
|
|
10
|
+
avatar?: string | undefined;
|
|
11
|
+
preferences?: {} | undefined;
|
|
12
|
+
referredBy?: string | {} | undefined;
|
|
13
|
+
sourceApp?: string | undefined;
|
|
14
|
+
referralCode?: string | undefined;
|
|
15
|
+
userGroups?: number[] | undefined;
|
|
16
|
+
isMigratedFromBSMNT?: boolean | undefined;
|
|
17
|
+
privyLinkedAccounts?: {
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
address?: string | undefined;
|
|
20
|
+
email?: string | undefined;
|
|
21
|
+
chain_type?: string | undefined;
|
|
22
|
+
lv?: number | undefined;
|
|
23
|
+
wallet_client_type?: string | undefined;
|
|
24
|
+
smart_wallet_type?: string | undefined;
|
|
25
|
+
subject?: string | undefined;
|
|
26
|
+
type: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
twProfiles?: {
|
|
29
|
+
type: string;
|
|
30
|
+
details: {
|
|
31
|
+
id?: string | undefined;
|
|
32
|
+
name?: string | undefined;
|
|
33
|
+
address?: string | undefined;
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
username?: string | undefined;
|
|
36
|
+
phone?: string | undefined;
|
|
37
|
+
fid?: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
turnkeySubOrgs?: {
|
|
41
|
+
hasDelegatedUser?: boolean | undefined;
|
|
42
|
+
subOrgId: string;
|
|
43
|
+
accounts: Record<string, any>[];
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
_id: string | {};
|
|
46
|
+
userId: string;
|
|
47
|
+
smartAccountAddress: string;
|
|
48
|
+
createdAt: number;
|
|
49
|
+
updatedAt: number;
|
|
50
|
+
partnerIds: {
|
|
51
|
+
privyId?: string | undefined;
|
|
52
|
+
thirdwebId?: string | undefined;
|
|
53
|
+
turnkeyId?: string | undefined;
|
|
54
|
+
turnkeyOtpId?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
} | null;
|
|
57
|
+
isConnecting: boolean;
|
|
58
|
+
isConnected: boolean;
|
|
59
|
+
isAuthenticating: boolean;
|
|
60
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useAuthStore } from "../../../global-account/react/index.js";
|
|
2
|
+
import { useUserStore } from "../stores/userStore.js";
|
|
3
|
+
/**
|
|
4
|
+
* Preferred Hook to get the user data
|
|
5
|
+
*/
|
|
6
|
+
export function useUser() {
|
|
7
|
+
const user = useUserStore(state => state.user);
|
|
8
|
+
const isConnecting = useAuthStore(state => state.isConnecting);
|
|
9
|
+
const isConnected = useAuthStore(state => state.isConnected);
|
|
10
|
+
const isAuthenticating = useAuthStore(state => state.isAuthenticating);
|
|
11
|
+
return {
|
|
12
|
+
user,
|
|
13
|
+
isConnecting,
|
|
14
|
+
isConnected,
|
|
15
|
+
isAuthenticating,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
2
1
|
import { useEffect } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { persist } from "zustand/middleware";
|
|
5
|
-
const debug = debugB3React("useUserQuery");
|
|
2
|
+
import { useUserStore } from "../stores/userStore.js";
|
|
6
3
|
const USER_QUERY_KEY = ["b3-user"];
|
|
7
|
-
/**
|
|
8
|
-
* Zustand store for managing user state
|
|
9
|
-
* Persists user data to localStorage
|
|
10
|
-
*/
|
|
11
|
-
const useUserStore = create()(persist(set => ({
|
|
12
|
-
user: null,
|
|
13
|
-
setUser: (newUser) => {
|
|
14
|
-
const userToSave = newUser ?? null;
|
|
15
|
-
set({ user: userToSave });
|
|
16
|
-
debug("User updated", userToSave);
|
|
17
|
-
},
|
|
18
|
-
clearUser: () => {
|
|
19
|
-
set({ user: null });
|
|
20
|
-
debug("User cleared");
|
|
21
|
-
},
|
|
22
|
-
}), {
|
|
23
|
-
name: "b3-user",
|
|
24
|
-
onRehydrateStorage: () => (_, error) => {
|
|
25
|
-
if (error) {
|
|
26
|
-
console.warn("Failed to rehydrate user store:", error);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
}));
|
|
30
4
|
/**
|
|
31
5
|
* NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
|
|
32
6
|
*
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
2
|
-
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
3
|
-
export { useB3 } from "./components/B3Provider/useB3";
|
|
4
2
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
5
3
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
6
4
|
export { useProfile } from "./hooks/useProfile";
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
// export * from "./stores/index.js";
|
|
4
4
|
// We only export the components and hooks that are needed for the native app
|
|
5
5
|
export { B3Provider } from "./components/B3Provider/B3Provider.native.js";
|
|
6
|
-
export { B3Context } from "./components/B3Provider/types.js";
|
|
7
|
-
export { useB3 } from "./components/B3Provider/useB3.js";
|
|
8
6
|
export { useAccountWallet } from "./hooks/useAccountWallet.js";
|
|
9
7
|
export { useAuthentication } from "./hooks/useAuthentication.js";
|
|
10
8
|
export { useProfile } from "./hooks/useProfile.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
interface ConfigStore {
|
|
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
|
+
setConfig: (config: Partial<Omit<ConfigStore, "setConfig">>) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Zustand store for B3 configuration
|
|
21
|
+
* NOT persisted - these are developer-set configuration values
|
|
22
|
+
*/
|
|
23
|
+
export declare const useB3ConfigStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConfigStore>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
/**
|
|
3
|
+
* Default permissions configuration for B3 provider
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_PERMISSIONS = {
|
|
6
|
+
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
|
|
7
|
+
nativeTokenLimitPerTransaction: 0.1,
|
|
8
|
+
startDate: new Date(),
|
|
9
|
+
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Zustand store for B3 configuration
|
|
13
|
+
* NOT persisted - these are developer-set configuration values
|
|
14
|
+
*/
|
|
15
|
+
export const useB3ConfigStore = create(set => ({
|
|
16
|
+
accountOverride: undefined,
|
|
17
|
+
automaticallySetFirstEoa: false,
|
|
18
|
+
environment: "development",
|
|
19
|
+
defaultPermissions: DEFAULT_PERMISSIONS,
|
|
20
|
+
theme: "light",
|
|
21
|
+
clientType: "rest",
|
|
22
|
+
partnerId: "",
|
|
23
|
+
stripePublishableKey: undefined,
|
|
24
|
+
createClientReferenceId: undefined,
|
|
25
|
+
enableTurnkey: false,
|
|
26
|
+
setConfig: config => set(state => ({ ...state, ...config })),
|
|
27
|
+
}));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
|
+
export { useB3ConfigStore } from "./configStore";
|
|
2
3
|
export { useModalStore } from "./useModalStore";
|
|
3
4
|
export { useRecentAddressesStore } from "./useRecentAddressesStore";
|
|
4
5
|
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|