@b3dotfun/sdk 0.1.0-alpha.0 → 0.1.0-alpha.2

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.
Files changed (41) hide show
  1. package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +1 -1
  2. package/dist/cjs/anyspend/react/components/common/GasIndicator.js +6 -16
  3. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  4. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +37 -0
  5. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -30
  6. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +4 -31
  7. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +1 -12
  8. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
  9. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +2 -21
  10. package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
  11. package/dist/cjs/global-account/react/stores/index.js +1 -3
  12. package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +1 -1
  13. package/dist/esm/anyspend/react/components/common/GasIndicator.js +7 -17
  14. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  15. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +33 -0
  16. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -30
  17. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +3 -30
  18. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +1 -12
  19. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
  20. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +1 -20
  21. package/dist/esm/global-account/react/stores/index.d.ts +0 -1
  22. package/dist/esm/global-account/react/stores/index.js +0 -1
  23. package/dist/styles/index.css +1 -1
  24. package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +1 -1
  25. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  26. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +1 -12
  27. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
  28. package/dist/types/global-account/react/stores/index.d.ts +0 -1
  29. package/package.json +1 -1
  30. package/src/anyspend/react/components/common/GasIndicator.tsx +11 -30
  31. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +84 -0
  32. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +28 -36
  33. package/src/global-account/react/components/B3Provider/B3Provider.tsx +21 -38
  34. package/src/global-account/react/components/B3Provider/useB3Config.ts +1 -21
  35. package/src/global-account/react/stores/index.ts +0 -1
  36. package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
  37. package/dist/cjs/global-account/react/stores/configStore.js +0 -30
  38. package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
  39. package/dist/esm/global-account/react/stores/configStore.js +0 -27
  40. package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
  41. package/src/global-account/react/stores/configStore.ts +0 -51
@@ -9,23 +9,7 @@ export interface GasIndicatorProps {
9
9
  className?: string;
10
10
  }
11
11
 
12
- const LEVEL_LABELS: Record<GasPriceData["level"], string> = {
13
- low: "Low",
14
- normal: "Normal",
15
- elevated: "Elevated",
16
- high: "High",
17
- spike: "Spike",
18
- };
19
-
20
- const LEVEL_STYLES: Record<GasPriceData["level"], string> = {
21
- low: "bg-green-500/20 text-green-500",
22
- normal: "bg-as-surface-tertiary text-as-secondary",
23
- elevated: "bg-yellow-500/20 text-yellow-600",
24
- high: "bg-orange-500/20 text-orange-500",
25
- spike: "bg-red-500/20 text-red-500",
26
- };
27
-
28
- function formatGasPrice(gweiString: string): string {
12
+ function formatGwei(gweiString: string): string {
29
13
  const gwei = parseFloat(gweiString);
30
14
  if (gwei < 0.001) return "<0.001";
31
15
  if (gwei < 1) return gwei.toFixed(3);
@@ -34,26 +18,23 @@ function formatGasPrice(gweiString: string): string {
34
18
  }
35
19
 
36
20
  export function GasIndicator({ gasPrice, className }: GasIndicatorProps) {
21
+ // Only show when gas is high or spike
22
+ if (!["high", "spike"].includes(gasPrice.level)) {
23
+ return null;
24
+ }
25
+
37
26
  return (
38
27
  <motion.div
39
28
  initial={{ opacity: 0, y: 10 }}
40
29
  animate={{ opacity: 1, y: 0 }}
41
30
  transition={{ duration: 0.2 }}
42
- className={cn(
43
- "flex items-center justify-between rounded-lg px-3 py-2",
44
- gasPrice.isSpike ? "bg-yellow-500/10" : "bg-as-surface-secondary",
45
- className,
46
- )}
31
+ className={cn("flex flex-col gap-1 rounded-lg bg-orange-500/10 px-3 py-2", className)}
47
32
  >
48
- <div className="flex items-center gap-2">
49
- <span className="text-as-secondary text-xs">Gas on {gasPrice.chainName}</span>
50
- </div>
51
- <div className="flex items-center gap-2">
52
- <span className={cn("rounded px-1.5 py-0.5 text-xs font-medium", LEVEL_STYLES[gasPrice.level])}>
53
- {LEVEL_LABELS[gasPrice.level]}
54
- </span>
55
- <span className="text-as-primary text-xs font-medium">{formatGasPrice(gasPrice.gasPriceGwei)} Gwei</span>
33
+ <div className="flex items-center justify-between">
34
+ <span className="text-xs font-medium text-orange-500">Gas is high - transaction may fail or cost more</span>
35
+ <span className="text-xs font-medium text-orange-500">{formatGwei(gasPrice.gasPriceGwei)} Gwei</span>
56
36
  </div>
37
+ <span className="text-as-secondary text-xs">Consider swapping later for better rates</span>
57
38
  </motion.div>
58
39
  );
59
40
  }
@@ -0,0 +1,84 @@
1
+ import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
+ import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
3
+ import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
4
+ import { createContext, useContext } from "react";
5
+ import { Account } from "thirdweb/wallets";
6
+ import { ClientType } from "../../../client-manager";
7
+
8
+ /**
9
+ * Default permissions configuration for B3 provider
10
+ */
11
+ const DEFAULT_PERMISSIONS: PermissionsConfig = {
12
+ approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
13
+ nativeTokenLimitPerTransaction: 0.1,
14
+ startDate: new Date(),
15
+ endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
16
+ };
17
+
18
+ export interface B3ConfigContextType {
19
+ accountOverride?: Account;
20
+ automaticallySetFirstEoa: boolean;
21
+ environment: "development" | "production";
22
+ defaultPermissions: PermissionsConfig;
23
+ theme: "light" | "dark";
24
+ clientType: ClientType;
25
+ partnerId: string;
26
+ stripePublishableKey?: string;
27
+ createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
28
+ enableTurnkey: boolean;
29
+ }
30
+
31
+ const B3ConfigContext = createContext<B3ConfigContextType | null>(null);
32
+
33
+ export function B3ConfigProvider({
34
+ children,
35
+ accountOverride,
36
+ environment = "development",
37
+ defaultPermissions = DEFAULT_PERMISSIONS,
38
+ automaticallySetFirstEoa = false,
39
+ theme = "light",
40
+ clientType = "rest",
41
+ partnerId,
42
+ stripePublishableKey,
43
+ createClientReferenceId,
44
+ enableTurnkey = false,
45
+ }: {
46
+ children: React.ReactNode;
47
+ accountOverride?: Account;
48
+ environment?: "development" | "production";
49
+ defaultPermissions?: PermissionsConfig;
50
+ automaticallySetFirstEoa?: boolean;
51
+ theme?: "light" | "dark";
52
+ clientType?: ClientType;
53
+ partnerId: string;
54
+ stripePublishableKey?: string;
55
+ createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
56
+ enableTurnkey?: boolean;
57
+ }) {
58
+ return (
59
+ <B3ConfigContext.Provider
60
+ value={{
61
+ accountOverride,
62
+ environment,
63
+ defaultPermissions,
64
+ automaticallySetFirstEoa,
65
+ theme,
66
+ clientType,
67
+ partnerId,
68
+ stripePublishableKey,
69
+ createClientReferenceId,
70
+ enableTurnkey,
71
+ }}
72
+ >
73
+ {children}
74
+ </B3ConfigContext.Provider>
75
+ );
76
+ }
77
+
78
+ export function useB3Config(): B3ConfigContextType {
79
+ const context = useContext(B3ConfigContext);
80
+ if (!context) {
81
+ throw new Error("useB3Config must be used within a B3ConfigProvider");
82
+ }
83
+ return context;
84
+ }
@@ -1,15 +1,14 @@
1
1
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
2
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
- import { useEffect } from "react";
4
3
  import { ThirdwebProvider } from "thirdweb/react";
5
4
  import { Account, Wallet } from "thirdweb/wallets";
6
5
 
7
6
  import { ClientType } from "../../../client-manager";
8
7
 
9
8
  import { WagmiProvider } from "wagmi";
10
- import { useB3ConfigStore } from "../../stores/configStore";
11
9
  import { createWagmiConfig } from "../../utils/createWagmiConfig";
12
10
  import AuthenticationProvider from "./AuthenticationProvider";
11
+ import { B3ConfigProvider } from "./B3ConfigProvider";
13
12
  import { LocalSDKProvider } from "./LocalSDKProvider";
14
13
 
15
14
  // Create queryClient instance
@@ -39,28 +38,23 @@ export function B3Provider({
39
38
  onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
40
39
  defaultPermissions?: PermissionsConfig;
41
40
  }) {
42
- const setConfig = useB3ConfigStore(state => state.setConfig);
43
-
44
- // Initialize config store on mount - props are static and never change
45
- useEffect(() => {
46
- setConfig({
47
- accountOverride,
48
- environment: environment ?? "development",
49
- automaticallySetFirstEoa: false,
50
- theme,
51
- clientType,
52
- partnerId,
53
- defaultPermissions,
54
- });
55
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
56
-
57
41
  return (
58
42
  <ThirdwebProvider>
59
43
  <LocalSDKProvider onConnectCallback={onConnect}>
60
- {/* <RelayKitProviderWrapper> */}
61
- {children}
62
- <AuthenticationProvider partnerId={partnerId} automaticallySetFirstEoa={false} />
63
- {/* </RelayKitProviderWrapper> */}
44
+ <B3ConfigProvider
45
+ accountOverride={accountOverride}
46
+ environment={environment}
47
+ automaticallySetFirstEoa={false}
48
+ theme={theme}
49
+ clientType={clientType}
50
+ partnerId={partnerId}
51
+ defaultPermissions={defaultPermissions}
52
+ >
53
+ {/* <RelayKitProviderWrapper> */}
54
+ {children}
55
+ <AuthenticationProvider partnerId={partnerId} automaticallySetFirstEoa={false} />
56
+ {/* </RelayKitProviderWrapper> */}
57
+ </B3ConfigProvider>
64
58
  </LocalSDKProvider>
65
59
  </ThirdwebProvider>
66
60
  );
@@ -88,25 +82,23 @@ export function InnerProvider({
88
82
  partnerId: string;
89
83
  rpcUrls?: Record<number, string>;
90
84
  }) {
91
- const setConfig = useB3ConfigStore(state => state.setConfig);
92
85
  const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
93
86
 
94
- // Initialize config store on mount - props are static and never change
95
- useEffect(() => {
96
- setConfig({
97
- accountOverride,
98
- environment: environment ?? "development",
99
- automaticallySetFirstEoa: false,
100
- theme,
101
- clientType,
102
- partnerId,
103
- defaultPermissions,
104
- });
105
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
106
-
107
87
  return (
108
88
  <WagmiProvider config={wagmiConfig}>
109
- <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
89
+ <QueryClientProvider client={queryClient}>
90
+ <B3ConfigProvider
91
+ accountOverride={accountOverride}
92
+ environment={environment}
93
+ automaticallySetFirstEoa={false}
94
+ theme={theme}
95
+ clientType={clientType}
96
+ partnerId={partnerId}
97
+ defaultPermissions={defaultPermissions}
98
+ >
99
+ {children}
100
+ </B3ConfigProvider>
101
+ </QueryClientProvider>
110
102
  </WagmiProvider>
111
103
  );
112
104
  }
@@ -11,10 +11,10 @@ import { ThirdwebProvider } from "thirdweb/react";
11
11
  import { Account, Wallet } from "thirdweb/wallets";
12
12
  import { CreateConnectorFn, WagmiProvider } from "wagmi";
13
13
  import { ClientType, setClientType } from "../../../client-manager";
14
- import { useB3ConfigStore } from "../../stores/configStore";
15
14
  import { StyleRoot } from "../StyleRoot";
16
15
  import { setToastContext, ToastProvider, useToastContext } from "../Toast/index";
17
16
  import AuthenticationProvider from "./AuthenticationProvider";
17
+ import { B3ConfigProvider } from "./B3ConfigProvider";
18
18
  import { LocalSDKProvider } from "./LocalSDKProvider";
19
19
 
20
20
  // Create queryClient instance
@@ -65,36 +65,6 @@ export function B3Provider({
65
65
  enableTurnkey?: boolean;
66
66
  defaultPermissions?: PermissionsConfig;
67
67
  }) {
68
- const setConfig = useB3ConfigStore(state => state.setConfig);
69
-
70
- // Initialize config store on mount
71
- useEffect(() => {
72
- setConfig({
73
- accountOverride,
74
- environment: environment ?? "development",
75
- automaticallySetFirstEoa: !!automaticallySetFirstEoa,
76
- theme,
77
- clientType,
78
- partnerId,
79
- stripePublishableKey,
80
- createClientReferenceId,
81
- enableTurnkey,
82
- defaultPermissions,
83
- });
84
- }, [
85
- accountOverride,
86
- environment,
87
- automaticallySetFirstEoa,
88
- theme,
89
- clientType,
90
- partnerId,
91
- stripePublishableKey,
92
- createClientReferenceId,
93
- enableTurnkey,
94
- defaultPermissions,
95
- setConfig,
96
- ]); // eslint-disable-line react-hooks/exhaustive-deps
97
-
98
68
  // Initialize Google Analytics on mount
99
69
  useEffect(() => {
100
70
  loadGA4Script();
@@ -117,13 +87,26 @@ export function B3Provider({
117
87
  <TooltipProvider>
118
88
  <ToastProvider>
119
89
  <LocalSDKProvider onConnectCallback={onConnect}>
120
- <ToastContextConnector />
121
- <RelayKitProviderWrapper simDuneApiKey={simDuneApiKey}>
122
- {children}
123
- {/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
124
- <StyleRoot id="b3-root" />
125
- </RelayKitProviderWrapper>
126
- <AuthenticationProvider partnerId={partnerId} automaticallySetFirstEoa={!!automaticallySetFirstEoa} />
90
+ <B3ConfigProvider
91
+ accountOverride={accountOverride}
92
+ environment={environment}
93
+ automaticallySetFirstEoa={!!automaticallySetFirstEoa}
94
+ theme={theme}
95
+ clientType={clientType}
96
+ partnerId={partnerId}
97
+ stripePublishableKey={stripePublishableKey}
98
+ createClientReferenceId={createClientReferenceId}
99
+ enableTurnkey={enableTurnkey}
100
+ defaultPermissions={defaultPermissions}
101
+ >
102
+ <ToastContextConnector />
103
+ <RelayKitProviderWrapper simDuneApiKey={simDuneApiKey}>
104
+ {children}
105
+ {/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
106
+ <StyleRoot id="b3-root" />
107
+ </RelayKitProviderWrapper>
108
+ <AuthenticationProvider partnerId={partnerId} automaticallySetFirstEoa={!!automaticallySetFirstEoa} />
109
+ </B3ConfigProvider>
127
110
  </LocalSDKProvider>
128
111
  </ToastProvider>
129
112
  </TooltipProvider>
@@ -1,21 +1 @@
1
- import { useB3ConfigStore } from "../../stores/configStore";
2
-
3
- /**
4
- * Hook to access B3 configuration
5
- * Returns all config values from the Zustand store
6
- * Since config is static (set once at initialization), destructuring is fine here
7
- */
8
- export const useB3Config = () => {
9
- return useB3ConfigStore(state => ({
10
- automaticallySetFirstEoa: state.automaticallySetFirstEoa,
11
- environment: state.environment,
12
- theme: state.theme,
13
- clientType: state.clientType,
14
- partnerId: state.partnerId,
15
- createClientReferenceId: state.createClientReferenceId,
16
- enableTurnkey: state.enableTurnkey,
17
- stripePublishableKey: state.stripePublishableKey,
18
- defaultPermissions: state.defaultPermissions,
19
- accountOverride: state.accountOverride,
20
- }));
21
- };
1
+ export { useB3Config } from "./B3ConfigProvider";
@@ -1,5 +1,4 @@
1
1
  export { useAuthStore } from "./useAuthStore";
2
- export { useB3ConfigStore } from "./configStore";
3
2
  export { useModalStore } from "./useModalStore";
4
3
  export { useRecentAddressesStore } from "./useRecentAddressesStore";
5
4
 
@@ -1,24 +0,0 @@
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 {};
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useB3ConfigStore = void 0;
4
- const zustand_1 = require("zustand");
5
- /**
6
- * Default permissions configuration for B3 provider
7
- */
8
- const DEFAULT_PERMISSIONS = {
9
- approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
10
- nativeTokenLimitPerTransaction: 0.1,
11
- startDate: new Date(),
12
- endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
13
- };
14
- /**
15
- * Zustand store for B3 configuration
16
- * NOT persisted - these are developer-set configuration values
17
- */
18
- exports.useB3ConfigStore = (0, zustand_1.create)(set => ({
19
- accountOverride: undefined,
20
- automaticallySetFirstEoa: false,
21
- environment: "development",
22
- defaultPermissions: DEFAULT_PERMISSIONS,
23
- theme: "light",
24
- clientType: "rest",
25
- partnerId: "",
26
- stripePublishableKey: undefined,
27
- createClientReferenceId: undefined,
28
- enableTurnkey: false,
29
- setConfig: config => set(state => ({ ...state, ...config })),
30
- }));
@@ -1,24 +0,0 @@
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 {};
@@ -1,27 +0,0 @@
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,24 +0,0 @@
1
- import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "@b3dotfun/sdk/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 {};
@@ -1,51 +0,0 @@
1
- import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
4
- import { Account } from "thirdweb/wallets";
5
- import { create } from "zustand";
6
- import { ClientType } from "../../client-manager";
7
-
8
- /**
9
- * Default permissions configuration for B3 provider
10
- */
11
- const DEFAULT_PERMISSIONS: PermissionsConfig = {
12
- approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
13
- nativeTokenLimitPerTransaction: 0.1,
14
- startDate: new Date(),
15
- endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
16
- };
17
-
18
- interface ConfigStore {
19
- accountOverride?: Account;
20
- automaticallySetFirstEoa: boolean;
21
- environment: "development" | "production";
22
- defaultPermissions: PermissionsConfig;
23
- theme: "light" | "dark";
24
- clientType: ClientType;
25
- partnerId: string;
26
- stripePublishableKey?: string;
27
- createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
28
- enableTurnkey: boolean;
29
-
30
- // Actions
31
- setConfig: (config: Partial<Omit<ConfigStore, "setConfig">>) => void;
32
- }
33
-
34
- /**
35
- * Zustand store for B3 configuration
36
- * NOT persisted - these are developer-set configuration values
37
- */
38
- export const useB3ConfigStore = create<ConfigStore>(set => ({
39
- accountOverride: undefined,
40
- automaticallySetFirstEoa: false,
41
- environment: "development",
42
- defaultPermissions: DEFAULT_PERMISSIONS,
43
- theme: "light",
44
- clientType: "rest",
45
- partnerId: "",
46
- stripePublishableKey: undefined,
47
- createClientReferenceId: undefined,
48
- enableTurnkey: false,
49
-
50
- setConfig: config => set(state => ({ ...state, ...config })),
51
- }));