@b3dotfun/sdk 0.0.88-alpha.10 → 0.0.88-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +0 -2
- package/dist/cjs/anyspend/constants/index.js +1 -3
- package/dist/cjs/anyspend/index.d.ts +0 -2
- package/dist/cjs/anyspend/index.js +0 -3
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpend.js +6 -9
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +20 -24
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -34
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/index.js +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +57 -35
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +35 -38
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +15 -11
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -1
- package/dist/cjs/global-account/react/components/index.js +6 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +2 -1
- package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
- package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
- package/dist/cjs/global-account/react/index.native.d.ts +2 -0
- package/dist/cjs/global-account/react/index.native.js +5 -1
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/esm/anyspend/constants/index.d.ts +0 -2
- package/dist/esm/anyspend/constants/index.js +0 -2
- package/dist/esm/anyspend/index.d.ts +0 -2
- package/dist/esm/anyspend/index.js +0 -3
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
- package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/index.js +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +16 -12
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -1
- package/dist/esm/global-account/react/components/index.js +2 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAuth.js +3 -2
- package/dist/esm/global-account/react/hooks/useClient.js +2 -2
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
- package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
- package/dist/esm/global-account/react/index.native.d.ts +2 -0
- package/dist/esm/global-account/react/index.native.js +2 -0
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -2
- package/dist/types/anyspend/index.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
- package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
- package/dist/types/global-account/react/components/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/index.native.d.ts +2 -0
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +0 -3
- package/src/anyspend/index.ts +0 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -28
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
- package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
- package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
- package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
- package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
- package/src/anyspend/react/hooks/index.ts +0 -1
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +4 -3
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
- package/src/global-account/react/components/B3Provider/types.ts +50 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
- package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
- package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -2
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +14 -11
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/StyleRoot.tsx +3 -3
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
- package/src/global-account/react/components/index.ts +2 -1
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +3 -2
- package/src/global-account/react/hooks/useClient.ts +2 -2
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
- package/src/global-account/react/hooks/useNotifications.ts +2 -2
- package/src/global-account/react/hooks/useTokenBalance.tsx +7 -8
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
- package/src/global-account/react/hooks/useUserQuery.ts +40 -1
- package/src/global-account/react/index.native.ts +2 -0
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +0 -10
- package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
- package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
- package/dist/cjs/anyspend/services/gas.d.ts +0 -21
- package/dist/cjs/anyspend/services/gas.js +0 -65
- package/dist/cjs/anyspend/types/gas.d.ts +0 -61
- package/dist/cjs/anyspend/types/gas.js +0 -2
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
- package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/cjs/global-account/react/stores/configStore.js +0 -30
- package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/cjs/global-account/react/stores/userStore.js +0 -30
- package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
- package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
- package/dist/esm/anyspend/services/gas.d.ts +0 -21
- package/dist/esm/anyspend/services/gas.js +0 -59
- package/dist/esm/anyspend/types/gas.d.ts +0 -61
- package/dist/esm/anyspend/types/gas.js +0 -1
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
- package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/esm/global-account/react/hooks/useUser.js +0 -17
- package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/esm/global-account/react/stores/configStore.js +0 -27
- package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
- package/dist/esm/global-account/react/stores/userStore.js +0 -27
- package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
- package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
- package/dist/types/anyspend/services/gas.d.ts +0 -21
- package/dist/types/anyspend/types/gas.d.ts +0 -61
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
- package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
- package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
- package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
- package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
- package/src/anyspend/services/gas.test.ts +0 -31
- package/src/anyspend/services/gas.ts +0 -73
- package/src/anyspend/types/gas.ts +0 -66
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
- package/src/global-account/react/hooks/useUser.ts +0 -20
- package/src/global-account/react/stores/configStore.ts +0 -51
- package/src/global-account/react/stores/userStore.ts +0 -41
|
@@ -1,8 +1,9 @@
|
|
|
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";
|
|
4
|
-
export { B3Provider } from "./B3Provider/B3Provider";
|
|
4
|
+
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
5
5
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
6
|
+
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
6
7
|
export { useB3 } from "./B3Provider/useB3";
|
|
7
8
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
8
9
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
@@ -52,4 +52,3 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
|
52
52
|
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
53
53
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
54
54
|
export { useURLParams } from "./useURLParams";
|
|
55
|
-
export { useUser } from "./useUser";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import app from "@b3dotfun/sdk/global-account/app";
|
|
2
2
|
import { authenticateWithB3JWT } from "@b3dotfun/sdk/global-account/bsmnt";
|
|
3
|
-
import { useAuthStore
|
|
3
|
+
import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
|
|
5
5
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
6
6
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
@@ -18,6 +18,7 @@ import { Wallet, ecosystemWallet } from "thirdweb/wallets";
|
|
|
18
18
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
19
19
|
import { useAccount, useConnect, useSwitchAccount } from "wagmi";
|
|
20
20
|
import { LocalSDKContext } from "../components/B3Provider/LocalSDKProvider";
|
|
21
|
+
import { useB3 } from "../components/B3Provider/useB3";
|
|
21
22
|
import { createWagmiConfig } from "../utils/createWagmiConfig";
|
|
22
23
|
import { useSearchParam } from "./useSearchParamsSSR";
|
|
23
24
|
import { useUserQuery } from "./useUserQuery";
|
|
@@ -47,7 +48,7 @@ export function useAuth() {
|
|
|
47
48
|
const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
|
|
48
49
|
const useAutoConnectLoadingPrevious = useRef(false);
|
|
49
50
|
const referralCode = useSearchParam("referralCode");
|
|
50
|
-
const { partnerId } =
|
|
51
|
+
const { partnerId } = useB3();
|
|
51
52
|
const wagmiConfig = createWagmiConfig({ partnerId });
|
|
52
53
|
const { connect } = useConnect();
|
|
53
54
|
const activeWagmiAccount = useAccount();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3 } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import {
|
|
4
4
|
ClientType,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* Hook to access the current FeathersJS client and client management utilities
|
|
14
14
|
*/
|
|
15
15
|
export function useClient() {
|
|
16
|
-
const { clientType } =
|
|
16
|
+
const { clientType } = useB3();
|
|
17
17
|
|
|
18
18
|
const getCurrentClient = useCallback(() => {
|
|
19
19
|
return getClient();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useB3, useConnect } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
3
|
import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
@@ -11,7 +11,7 @@ const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
|
|
|
11
11
|
* Currently, this is for the basement-privy strategy
|
|
12
12
|
*/
|
|
13
13
|
export function useHandleConnectWithPrivy(chain?: Chain, onSuccess?: (account: Account) => void) {
|
|
14
|
-
const { partnerId } =
|
|
14
|
+
const { partnerId } = useB3();
|
|
15
15
|
if (!chain) {
|
|
16
16
|
throw new Error("Chain is required");
|
|
17
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
2
1
|
import { getAuthToken } from "@b3dotfun/sdk/shared/utils/auth-token";
|
|
3
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
4
3
|
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { useB3 } from "../components";
|
|
5
5
|
import { notificationsAPI, UserData } from "../utils/notificationsAPI";
|
|
6
6
|
import { useUserQuery } from "./useUserQuery";
|
|
7
7
|
|
|
@@ -56,7 +56,7 @@ export interface UseNotificationsReturn {
|
|
|
56
56
|
*/
|
|
57
57
|
export function useNotifications(): UseNotificationsReturn {
|
|
58
58
|
const { user } = useUserQuery();
|
|
59
|
-
const { partnerId } =
|
|
59
|
+
const { partnerId } = useB3();
|
|
60
60
|
const [userData, setUserData] = useState<UserData | null>(null);
|
|
61
61
|
const [loading, setLoading] = useState(true);
|
|
62
62
|
const [error, setError] = useState<string | null>(null);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { isNativeToken } from "@b3dotfun/sdk/anyspend";
|
|
4
|
-
import {
|
|
5
|
-
import { useAccountWallet, useAuthStore } from "@b3dotfun/sdk/global-account/react";
|
|
4
|
+
import { useB3, useAccountWallet } from "@b3dotfun/sdk/global-account/react";
|
|
6
5
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
7
6
|
import { getERC20Balances, getNativeTokenBalance } from "@b3dotfun/sdk/shared/utils/thirdweb-insights";
|
|
8
7
|
import { useQuery } from "@tanstack/react-query";
|
|
9
8
|
import { useEffect } from "react";
|
|
9
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
10
10
|
|
|
11
11
|
interface UseTokenBalanceProps {
|
|
12
12
|
token: components["schemas"]["Token"];
|
|
@@ -20,8 +20,7 @@ export interface TokenBalanceResult {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function useTokenBalance({ token, address }: UseTokenBalanceProps): TokenBalanceResult {
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const { ready } = useB3();
|
|
25
24
|
const account = useAccountWallet();
|
|
26
25
|
|
|
27
26
|
const effectiveAddress = address || account?.address;
|
|
@@ -61,7 +60,7 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
|
|
|
61
60
|
}
|
|
62
61
|
return { formatted: "0", raw: null };
|
|
63
62
|
},
|
|
64
|
-
enabled:
|
|
63
|
+
enabled: ready && !!effectiveAddress,
|
|
65
64
|
staleTime: 30000,
|
|
66
65
|
gcTime: 5 * 60 * 1000,
|
|
67
66
|
retry: 2,
|
|
@@ -70,13 +69,13 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
|
|
|
70
69
|
|
|
71
70
|
// Force a refetch when the wallet or token changes
|
|
72
71
|
useEffect(() => {
|
|
73
|
-
if (
|
|
72
|
+
if (ready && effectiveAddress) {
|
|
74
73
|
refetch();
|
|
75
74
|
}
|
|
76
|
-
}, [
|
|
75
|
+
}, [ready, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
|
|
77
76
|
|
|
78
77
|
// Determine if we're actually loading
|
|
79
|
-
const isActuallyLoading = !
|
|
78
|
+
const isActuallyLoading = !ready || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
|
|
80
79
|
|
|
81
80
|
return {
|
|
82
81
|
rawBalance: tokenBalance?.raw || BigInt(0),
|
|
@@ -6,8 +6,8 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
6
6
|
import { viemToThirdwebChain } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
7
7
|
import { getChainById } from "@b3dotfun/sdk/shared/utils/chains";
|
|
8
8
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
9
|
-
import invariant from "invariant";
|
|
10
9
|
import { getWalletBalance } from "thirdweb/wallets";
|
|
10
|
+
import invariant from "invariant";
|
|
11
11
|
|
|
12
12
|
type GetWalletBalanceResult = {
|
|
13
13
|
value: bigint;
|
|
@@ -83,9 +83,7 @@ export function useTokenBalancesByChain({
|
|
|
83
83
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
84
84
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
85
85
|
retry: 2, // Limit retries on failure
|
|
86
|
-
|
|
87
|
-
// This ensures we only get new references when data actually changes
|
|
88
|
-
structuralSharing: true,
|
|
86
|
+
structuralSharing: false,
|
|
89
87
|
});
|
|
90
88
|
|
|
91
89
|
return {
|
|
@@ -1,9 +1,48 @@
|
|
|
1
1
|
import { Users } from "@b3dotfun/b3-api";
|
|
2
|
+
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
2
3
|
import { useEffect } from "react";
|
|
3
|
-
import {
|
|
4
|
+
import { create } from "zustand";
|
|
5
|
+
import { persist } from "zustand/middleware";
|
|
6
|
+
|
|
7
|
+
const debug = debugB3React("useUserQuery");
|
|
4
8
|
|
|
5
9
|
const USER_QUERY_KEY = ["b3-user"];
|
|
6
10
|
|
|
11
|
+
interface UserStore {
|
|
12
|
+
user: Users | null;
|
|
13
|
+
setUser: (user: Users | undefined) => void;
|
|
14
|
+
clearUser: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Zustand store for managing user state
|
|
19
|
+
* Persists user data to localStorage
|
|
20
|
+
*/
|
|
21
|
+
const useUserStore = create<UserStore>()(
|
|
22
|
+
persist(
|
|
23
|
+
set => ({
|
|
24
|
+
user: null,
|
|
25
|
+
setUser: (newUser: Users | undefined) => {
|
|
26
|
+
const userToSave = newUser ?? null;
|
|
27
|
+
set({ user: userToSave });
|
|
28
|
+
debug("User updated", userToSave);
|
|
29
|
+
},
|
|
30
|
+
clearUser: () => {
|
|
31
|
+
set({ user: null });
|
|
32
|
+
debug("User cleared");
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
{
|
|
36
|
+
name: "b3-user",
|
|
37
|
+
onRehydrateStorage: () => (_, error) => {
|
|
38
|
+
if (error) {
|
|
39
|
+
console.warn("Failed to rehydrate user store:", error);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
|
|
7
46
|
/**
|
|
8
47
|
* NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
|
|
9
48
|
*
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
8
8
|
|
|
9
|
+
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
10
|
+
export { useB3 } from "./components/B3Provider/useB3";
|
|
9
11
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
10
12
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
11
13
|
export { useProfile } from "./hooks/useProfile";
|
|
@@ -426,12 +426,6 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
426
426
|
customUsdInputValues?: string[];
|
|
427
427
|
/** prefer eoa wallet */
|
|
428
428
|
preferEoa?: boolean;
|
|
429
|
-
/** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
|
|
430
|
-
returnToHomeUrl?: string;
|
|
431
|
-
/** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
|
|
432
|
-
customRecipientLabel?: string;
|
|
433
|
-
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
434
|
-
returnHomeLabel?: string;
|
|
435
429
|
}
|
|
436
430
|
|
|
437
431
|
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
@@ -505,10 +499,6 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
505
499
|
vendingMachineId: string;
|
|
506
500
|
/** The pack type */
|
|
507
501
|
packType: string;
|
|
508
|
-
/** Active tab */
|
|
509
|
-
activeTab?: "crypto" | "fiat";
|
|
510
|
-
/** Force fiat payment */
|
|
511
|
-
forceFiatPayment?: boolean;
|
|
512
502
|
}
|
|
513
503
|
|
|
514
504
|
/**
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { GasPriceData } from "../../../types/gas";
|
|
2
|
-
export interface GasIndicatorProps {
|
|
3
|
-
gasPrice: GasPriceData;
|
|
4
|
-
className?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function GasIndicator({ gasPrice, className }: GasIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.GasIndicator = GasIndicator;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const cn_1 = require("../../../../shared/utils/cn");
|
|
7
|
-
const react_1 = require("motion/react");
|
|
8
|
-
const LEVEL_LABELS = {
|
|
9
|
-
low: "Low",
|
|
10
|
-
normal: "Normal",
|
|
11
|
-
elevated: "Elevated",
|
|
12
|
-
high: "High",
|
|
13
|
-
spike: "Spike",
|
|
14
|
-
};
|
|
15
|
-
const LEVEL_STYLES = {
|
|
16
|
-
low: "bg-green-500/20 text-green-500",
|
|
17
|
-
normal: "bg-as-surface-tertiary text-as-secondary",
|
|
18
|
-
elevated: "bg-yellow-500/20 text-yellow-600",
|
|
19
|
-
high: "bg-orange-500/20 text-orange-500",
|
|
20
|
-
spike: "bg-red-500/20 text-red-500",
|
|
21
|
-
};
|
|
22
|
-
function formatGasPrice(gweiString) {
|
|
23
|
-
const gwei = parseFloat(gweiString);
|
|
24
|
-
if (gwei < 0.001)
|
|
25
|
-
return "<0.001";
|
|
26
|
-
if (gwei < 1)
|
|
27
|
-
return gwei.toFixed(3);
|
|
28
|
-
if (gwei < 10)
|
|
29
|
-
return gwei.toFixed(2);
|
|
30
|
-
return gwei.toFixed(1);
|
|
31
|
-
}
|
|
32
|
-
function GasIndicator({ gasPrice, className }) {
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.motion.div, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.2 }, className: (0, cn_1.cn)("flex items-center justify-between rounded-lg px-3 py-2", gasPrice.isSpike ? "bg-yellow-500/10" : "bg-as-surface-secondary", className), children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary text-xs", children: ["Gas on ", gasPrice.chainName] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: (0, cn_1.cn)("rounded px-1.5 py-0.5 text-xs font-medium", LEVEL_STYLES[gasPrice.level]), children: LEVEL_LABELS[gasPrice.level] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-xs font-medium", children: [formatGasPrice(gasPrice.gasPriceGwei), " Gwei"] })] })] }));
|
|
34
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { GasPriceData } from "../../types/gas";
|
|
2
|
-
export interface UseGasPriceOptions {
|
|
3
|
-
/** Refetch interval in ms (default: 10000 = 10s) */
|
|
4
|
-
refetchInterval?: number;
|
|
5
|
-
/** Whether to enable the query (default: true if chainId is supported) */
|
|
6
|
-
enabled?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface UseGasPriceResult {
|
|
9
|
-
/** Gas price data */
|
|
10
|
-
gasPrice: GasPriceData | undefined;
|
|
11
|
-
/** Whether the query is loading */
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
/** Whether there's an error */
|
|
14
|
-
isError: boolean;
|
|
15
|
-
/** Error object if any */
|
|
16
|
-
error: Error | null;
|
|
17
|
-
/** Whether gas is currently spiking */
|
|
18
|
-
isSpike: boolean;
|
|
19
|
-
/** Refetch function */
|
|
20
|
-
refetch: () => void;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* React hook to fetch current gas price for a chain.
|
|
24
|
-
*
|
|
25
|
-
* @param chainId - The chain ID to fetch gas price for
|
|
26
|
-
* @param options - Optional configuration
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```tsx
|
|
30
|
-
* const { gasPrice, isSpike, isLoading } = useGasPrice(8453); // Base
|
|
31
|
-
*
|
|
32
|
-
* if (isSpike) {
|
|
33
|
-
* return <Warning>Gas prices are high: {gasPrice?.recommendation}</Warning>;
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function useGasPrice(chainId: number | undefined, options?: UseGasPriceOptions): UseGasPriceResult;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGasPrice = useGasPrice;
|
|
4
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const gas_1 = require("../../services/gas");
|
|
7
|
-
/**
|
|
8
|
-
* React hook to fetch current gas price for a chain.
|
|
9
|
-
*
|
|
10
|
-
* @param chainId - The chain ID to fetch gas price for
|
|
11
|
-
* @param options - Optional configuration
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* const { gasPrice, isSpike, isLoading } = useGasPrice(8453); // Base
|
|
16
|
-
*
|
|
17
|
-
* if (isSpike) {
|
|
18
|
-
* return <Warning>Gas prices are high: {gasPrice?.recommendation}</Warning>;
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
function useGasPrice(chainId, options = {}) {
|
|
23
|
-
const { refetchInterval = 10000, enabled } = options;
|
|
24
|
-
const isSupported = chainId !== undefined && (0, gas_1.isGasOracleSupported)(chainId);
|
|
25
|
-
const queryEnabled = enabled ?? isSupported;
|
|
26
|
-
const { data, isLoading, isError, error, refetch } = (0, react_query_1.useQuery)({
|
|
27
|
-
queryKey: ["gasPrice", chainId],
|
|
28
|
-
queryFn: () => gas_1.gasService.fetch(chainId),
|
|
29
|
-
enabled: queryEnabled && chainId !== undefined,
|
|
30
|
-
refetchInterval,
|
|
31
|
-
staleTime: 5000, // Consider data fresh for 5s
|
|
32
|
-
retry: 2,
|
|
33
|
-
refetchOnWindowFocus: true,
|
|
34
|
-
});
|
|
35
|
-
return (0, react_1.useMemo)(() => ({
|
|
36
|
-
gasPrice: data,
|
|
37
|
-
isLoading,
|
|
38
|
-
isError,
|
|
39
|
-
error: error,
|
|
40
|
-
isSpike: data?.isSpike ?? false,
|
|
41
|
-
refetch,
|
|
42
|
-
}), [data, isLoading, isError, error, refetch]);
|
|
43
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { GasOracleResponse, GasPriceData } from "../types/gas";
|
|
2
|
-
/** Supported chain IDs for gas oracle */
|
|
3
|
-
export declare const GAS_ORACLE_SUPPORTED_CHAINS: readonly [1, 137, 42161, 8453, 56, 10, 43114, 8333, 2741, 4689, 3338, 1329];
|
|
4
|
-
export type GasOracleSupportedChainId = (typeof GAS_ORACLE_SUPPORTED_CHAINS)[number];
|
|
5
|
-
/** Check if a chain is supported by the gas oracle */
|
|
6
|
-
export declare function isGasOracleSupported(chainId: number): chainId is GasOracleSupportedChainId;
|
|
7
|
-
/** Fetch gas price data from the gas oracle */
|
|
8
|
-
export declare function fetchGasPrice(chainId: number): Promise<GasOracleResponse>;
|
|
9
|
-
/** Transform raw oracle response to simplified UI data */
|
|
10
|
-
export declare function toGasPriceData(response: GasOracleResponse): GasPriceData;
|
|
11
|
-
/** Gas service for fetching and transforming gas data */
|
|
12
|
-
export declare const gasService: {
|
|
13
|
-
/** Fetch raw gas oracle response */
|
|
14
|
-
fetchRaw: typeof fetchGasPrice;
|
|
15
|
-
/** Fetch and transform to UI-friendly format */
|
|
16
|
-
fetch: (chainId: number) => Promise<GasPriceData>;
|
|
17
|
-
/** Check if chain is supported */
|
|
18
|
-
isSupported: typeof isGasOracleSupported;
|
|
19
|
-
/** List of supported chain IDs */
|
|
20
|
-
supportedChains: readonly [1, 137, 42161, 8453, 56, 10, 43114, 8333, 2741, 4689, 3338, 1329];
|
|
21
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gasService = exports.GAS_ORACLE_SUPPORTED_CHAINS = void 0;
|
|
4
|
-
exports.isGasOracleSupported = isGasOracleSupported;
|
|
5
|
-
exports.fetchGasPrice = fetchGasPrice;
|
|
6
|
-
exports.toGasPriceData = toGasPriceData;
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
/** Supported chain IDs for gas oracle */
|
|
9
|
-
exports.GAS_ORACLE_SUPPORTED_CHAINS = [
|
|
10
|
-
1, // Ethereum
|
|
11
|
-
137, // Polygon
|
|
12
|
-
42161, // Arbitrum
|
|
13
|
-
8453, // Base
|
|
14
|
-
56, // BSC
|
|
15
|
-
10, // Optimism
|
|
16
|
-
43114, // Avalanche
|
|
17
|
-
8333, // B3
|
|
18
|
-
2741, // Abstract
|
|
19
|
-
4689, // IoTeX
|
|
20
|
-
3338, // Peaq
|
|
21
|
-
1329, // Sei
|
|
22
|
-
];
|
|
23
|
-
/** Check if a chain is supported by the gas oracle */
|
|
24
|
-
function isGasOracleSupported(chainId) {
|
|
25
|
-
return exports.GAS_ORACLE_SUPPORTED_CHAINS.includes(chainId);
|
|
26
|
-
}
|
|
27
|
-
/** Fetch gas price data from the gas oracle */
|
|
28
|
-
async function fetchGasPrice(chainId) {
|
|
29
|
-
const response = await fetch(`${constants_1.GAS_ORACLE_BASE_URL}/gas/${chainId}`);
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
throw new Error(`Failed to fetch gas price for chain ${chainId}: ${response.status}`);
|
|
32
|
-
}
|
|
33
|
-
return response.json();
|
|
34
|
-
}
|
|
35
|
-
/** Transform raw oracle response to simplified UI data */
|
|
36
|
-
function toGasPriceData(response) {
|
|
37
|
-
const { analysis } = response;
|
|
38
|
-
const isSpike = analysis.level === "elevated" || analysis.level === "high" || analysis.level === "spike";
|
|
39
|
-
return {
|
|
40
|
-
chainId: response.chainId,
|
|
41
|
-
chainName: response.chainName,
|
|
42
|
-
gasPriceGwei: response.gasPrice.standard,
|
|
43
|
-
baseFeeGwei: response.eip1559?.baseFee,
|
|
44
|
-
level: analysis.level,
|
|
45
|
-
isSpike,
|
|
46
|
-
recommendation: analysis.recommendation,
|
|
47
|
-
vsMedian: analysis.vs1h, // Use 1h as primary comparison
|
|
48
|
-
source: response.source,
|
|
49
|
-
timestamp: response.timestamp,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/** Gas service for fetching and transforming gas data */
|
|
53
|
-
exports.gasService = {
|
|
54
|
-
/** Fetch raw gas oracle response */
|
|
55
|
-
fetchRaw: fetchGasPrice,
|
|
56
|
-
/** Fetch and transform to UI-friendly format */
|
|
57
|
-
fetch: async (chainId) => {
|
|
58
|
-
const response = await fetchGasPrice(chainId);
|
|
59
|
-
return toGasPriceData(response);
|
|
60
|
-
},
|
|
61
|
-
/** Check if chain is supported */
|
|
62
|
-
isSupported: isGasOracleSupported,
|
|
63
|
-
/** List of supported chain IDs */
|
|
64
|
-
supportedChains: exports.GAS_ORACLE_SUPPORTED_CHAINS,
|
|
65
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/** Gas level classification based on historical percentiles */
|
|
2
|
-
export type GasLevel = "low" | "normal" | "elevated" | "high" | "spike";
|
|
3
|
-
/** Gas prices in Gwei for different speed tiers */
|
|
4
|
-
export interface GasPrices {
|
|
5
|
-
low: string;
|
|
6
|
-
standard: string;
|
|
7
|
-
fast: string;
|
|
8
|
-
instant?: string;
|
|
9
|
-
}
|
|
10
|
-
/** EIP-1559 specific gas data */
|
|
11
|
-
export interface Eip1559Data {
|
|
12
|
-
baseFee: string;
|
|
13
|
-
maxPriorityFee: GasPrices;
|
|
14
|
-
maxFee: GasPrices;
|
|
15
|
-
}
|
|
16
|
-
/** Spike analysis comparing current gas to historical data */
|
|
17
|
-
export interface GasSpikeAnalysis {
|
|
18
|
-
level: GasLevel;
|
|
19
|
-
percentile: number;
|
|
20
|
-
/** Ratio to 1h median (primary spike detection) */
|
|
21
|
-
vs1h: number;
|
|
22
|
-
/** Ratio to 4h median (short-term context) */
|
|
23
|
-
vs4h: number;
|
|
24
|
-
/** Ratio to 24h median (daily context) */
|
|
25
|
-
vs24h: number;
|
|
26
|
-
recommendation: string;
|
|
27
|
-
}
|
|
28
|
-
/** Full gas response from the gas oracle */
|
|
29
|
-
export interface GasOracleResponse {
|
|
30
|
-
chainId: number;
|
|
31
|
-
chainName: string;
|
|
32
|
-
timestamp: string;
|
|
33
|
-
blockNumber?: number;
|
|
34
|
-
source: "blocknative" | "rpc";
|
|
35
|
-
gasPrice: GasPrices;
|
|
36
|
-
eip1559?: Eip1559Data;
|
|
37
|
-
analysis: GasSpikeAnalysis;
|
|
38
|
-
cached: boolean;
|
|
39
|
-
cacheAge?: number;
|
|
40
|
-
}
|
|
41
|
-
/** Simplified gas data for UI display */
|
|
42
|
-
export interface GasPriceData {
|
|
43
|
-
chainId: number;
|
|
44
|
-
chainName: string;
|
|
45
|
-
/** Standard gas price in Gwei */
|
|
46
|
-
gasPriceGwei: string;
|
|
47
|
-
/** Base fee in Gwei (EIP-1559 chains) */
|
|
48
|
-
baseFeeGwei?: string;
|
|
49
|
-
/** Gas level classification */
|
|
50
|
-
level: GasLevel;
|
|
51
|
-
/** Whether gas is currently spiking (elevated, high, or spike) */
|
|
52
|
-
isSpike: boolean;
|
|
53
|
-
/** Human-readable recommendation */
|
|
54
|
-
recommendation: string;
|
|
55
|
-
/** Ratio to recent median (1 = normal, >1.5 = elevated) */
|
|
56
|
-
vsMedian: number;
|
|
57
|
-
/** Data source */
|
|
58
|
-
source: "blocknative" | "rpc";
|
|
59
|
-
/** Timestamp of the data */
|
|
60
|
-
timestamp: string;
|
|
61
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const hooks_1 = require("../../hooks");
|
|
4
|
-
const useAutoSelectWallet_1 = require("../../hooks/useAutoSelectWallet");
|
|
5
|
-
const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, }) => {
|
|
6
|
-
(0, hooks_1.useAuthentication)(partnerId);
|
|
7
|
-
(0, useAutoSelectWallet_1.useAutoSelectWallet)({
|
|
8
|
-
enabled: automaticallySetFirstEoa,
|
|
9
|
-
});
|
|
10
|
-
return null;
|
|
11
|
-
};
|
|
12
|
-
exports.default = AuthenticationProvider;
|
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useUser = useUser;
|
|
4
|
-
const react_1 = require("../../../global-account/react");
|
|
5
|
-
const userStore_1 = require("../stores/userStore");
|
|
6
|
-
/**
|
|
7
|
-
* Preferred Hook to get the user data
|
|
8
|
-
*/
|
|
9
|
-
function useUser() {
|
|
10
|
-
const user = (0, userStore_1.useUserStore)(state => state.user);
|
|
11
|
-
const isConnecting = (0, react_1.useAuthStore)(state => state.isConnecting);
|
|
12
|
-
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
13
|
-
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
14
|
-
return {
|
|
15
|
-
user,
|
|
16
|
-
isConnecting,
|
|
17
|
-
isConnected,
|
|
18
|
-
isAuthenticating,
|
|
19
|
-
};
|
|
20
|
-
}
|