@b3dotfun/sdk 0.1.70-alpha.1 → 0.1.70-alpha.11
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/constants/chains/b3Chain.js +3 -1
- package/dist/cjs/anyspend/constants/rpc.d.ts +2 -1
- package/dist/cjs/anyspend/constants/rpc.js +4 -2
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +9 -3
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +13 -3
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
- package/dist/cjs/anyspend/utils/chain.d.ts +39 -1
- package/dist/cjs/anyspend/utils/chain.js +23 -2
- package/dist/cjs/anyspend/utils/token.d.ts +2 -0
- package/dist/cjs/anyspend/utils/token.js +15 -1
- package/dist/cjs/app.shared.d.ts +9 -1
- package/dist/cjs/app.shared.js +19 -0
- package/dist/cjs/global-account/app.native.d.ts +1 -1
- package/dist/cjs/global-account/better-auth-client.d.ts +3314 -36
- package/dist/cjs/global-account/better-auth-client.js +28 -3
- package/dist/cjs/global-account/bsmnt.d.ts +2 -2
- package/dist/cjs/global-account/bsmnt.native.d.ts +1 -1
- package/dist/cjs/global-account/client-manager.d.ts +7 -5
- package/dist/cjs/global-account/client-manager.js +19 -4
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +6 -11
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +8 -13
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +24 -3
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +48 -8
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -5
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +3 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +1 -3
- package/dist/cjs/global-account/react/components/index.d.ts +0 -2
- package/dist/cjs/global-account/react/components/index.js +3 -7
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +2 -4
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +3 -3
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -1
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +1656 -21
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +13 -14
- package/dist/cjs/global-account/react/hooks/useClient.d.ts +3 -3
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useSiwe.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useSiwe.native.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +20 -17
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +28 -0
- package/dist/cjs/global-account/types/b3-api.types.d.ts +5 -0
- package/dist/cjs/global-account/types/feature-flags.d.ts +5 -5
- package/dist/cjs/notifications/services/api.js +1 -0
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +6 -54
- package/dist/cjs/shared/constants/chains/b3Chain.js +5 -41
- package/dist/cjs/shared/constants/chains/supported.d.ts +1 -49
- package/dist/cjs/shared/constants/chains/supported.js +8 -36
- package/dist/cjs/shared/utils/chain-transformers.d.ts +4 -4
- package/dist/cjs/shared/utils/chain-transformers.js +38 -37
- package/dist/cjs/shared/utils/thirdweb-insights.js +2 -2
- package/dist/cjs/shared/utils/upload.d.ts +9 -0
- package/dist/cjs/shared/utils/upload.js +34 -0
- package/dist/esm/anyspend/constants/rpc.d.ts +2 -1
- package/dist/esm/anyspend/constants/rpc.js +3 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +21 -14
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +10 -4
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/esm/anyspend/react/components/AnySpendWorkflowTrigger.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +14 -4
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
- package/dist/esm/anyspend/utils/chain.d.ts +39 -1
- package/dist/esm/anyspend/utils/chain.js +24 -3
- package/dist/esm/anyspend/utils/token.d.ts +2 -0
- package/dist/esm/anyspend/utils/token.js +13 -0
- package/dist/esm/app.shared.d.ts +9 -1
- package/dist/esm/app.shared.js +17 -0
- package/dist/esm/global-account/app.native.d.ts +1 -1
- package/dist/esm/global-account/better-auth-client.d.ts +3314 -36
- package/dist/esm/global-account/better-auth-client.js +27 -4
- package/dist/esm/global-account/bsmnt.d.ts +2 -2
- package/dist/esm/global-account/bsmnt.native.d.ts +1 -1
- package/dist/esm/global-account/client-manager.d.ts +7 -5
- package/dist/esm/global-account/client-manager.js +19 -5
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +6 -11
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +8 -13
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +25 -4
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +48 -8
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -5
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +1 -3
- package/dist/esm/global-account/react/components/index.d.ts +0 -2
- package/dist/esm/global-account/react/components/index.js +0 -2
- 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.d.ts +3 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -1
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +1656 -21
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +13 -14
- package/dist/esm/global-account/react/hooks/useClient.d.ts +3 -3
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +1 -1
- package/dist/esm/global-account/react/hooks/useSiwe.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useSiwe.native.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +20 -17
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +28 -0
- package/dist/esm/global-account/types/b3-api.types.d.ts +5 -0
- package/dist/esm/global-account/types/feature-flags.d.ts +5 -5
- package/dist/esm/notifications/services/api.js +1 -0
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +6 -54
- package/dist/esm/shared/constants/chains/b3Chain.js +4 -38
- package/dist/esm/shared/constants/chains/supported.d.ts +1 -49
- package/dist/esm/shared/constants/chains/supported.js +7 -35
- package/dist/esm/shared/utils/chain-transformers.d.ts +4 -4
- package/dist/esm/shared/utils/chain-transformers.js +38 -37
- package/dist/esm/shared/utils/thirdweb-insights.js +2 -2
- package/dist/esm/shared/utils/upload.d.ts +9 -0
- package/dist/esm/shared/utils/upload.js +31 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/rpc.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendWorkflowTrigger.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +2 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +3 -1
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
- package/dist/types/anyspend/utils/chain.d.ts +39 -1
- package/dist/types/anyspend/utils/token.d.ts +2 -0
- package/dist/types/app.shared.d.ts +9 -1
- package/dist/types/global-account/app.native.d.ts +1 -1
- package/dist/types/global-account/better-auth-client.d.ts +3314 -36
- package/dist/types/global-account/bsmnt.d.ts +2 -2
- package/dist/types/global-account/bsmnt.native.d.ts +1 -1
- package/dist/types/global-account/client-manager.d.ts +7 -5
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -5
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +8 -13
- package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +3 -2
- package/dist/types/global-account/react/components/index.d.ts +0 -2
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +3 -3
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +1656 -21
- package/dist/types/global-account/react/hooks/useClient.d.ts +3 -3
- package/dist/types/global-account/react/hooks/useSiwe.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useSiwe.native.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +28 -0
- package/dist/types/global-account/types/b3-api.types.d.ts +5 -0
- package/dist/types/global-account/types/feature-flags.d.ts +5 -5
- package/dist/types/shared/constants/chains/b3Chain.d.ts +6 -54
- package/dist/types/shared/constants/chains/supported.d.ts +1 -49
- package/dist/types/shared/utils/chain-transformers.d.ts +4 -4
- package/dist/types/shared/utils/upload.d.ts +9 -0
- package/node_modules/@b3/chain-registry/chains.json +1160 -0
- package/node_modules/@b3/chain-registry/package.json +14 -0
- package/node_modules/@b3/chain-registry/src/index.ts +169 -0
- package/node_modules/@b3/chain-registry/tsconfig.json +16 -0
- package/package.json +76 -28
- package/src/anyspend/constants/rpc.ts +3 -2
- package/src/anyspend/react/components/AnySpendBondKit.tsx +2 -0
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +3 -0
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +29 -14
- package/src/anyspend/react/components/AnySpendDeposit.tsx +13 -3
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/anyspend/react/components/AnySpendWorkflowTrigger.tsx +4 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +3 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +3 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +4 -0
- package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +4 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +97 -79
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +13 -13
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +4 -4
- package/src/anyspend/types/api_req_res.ts +10 -5
- package/src/anyspend/utils/chain.ts +26 -1
- package/src/anyspend/utils/token.ts +14 -0
- package/src/app.shared.ts +21 -1
- package/src/global-account/app.native.ts +5 -1
- package/src/global-account/better-auth-client.ts +30 -4
- package/src/global-account/bsmnt.native.ts +5 -1
- package/src/global-account/bsmnt.ts +9 -2
- package/src/global-account/client-manager.ts +41 -9
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +6 -11
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -6
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +49 -32
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +53 -8
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +1 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +1 -4
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +2 -4
- package/src/global-account/react/components/index.ts +0 -2
- package/src/global-account/react/components/ui/button.tsx +1 -2
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +2 -2
- package/src/global-account/react/hooks/useAuthentication.ts +2 -2
- package/src/global-account/react/hooks/useBetterAuth.ts +14 -15
- package/src/global-account/react/hooks/useClient.ts +11 -2
- package/src/global-account/react/hooks/useNativeBalance.tsx +1 -1
- package/src/global-account/react/hooks/useSiwe.native.tsx +1 -1
- package/src/global-account/react/hooks/useSiwe.tsx +1 -1
- package/src/global-account/react/hooks/useTWAuth.tsx +1 -1
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +22 -20
- package/src/global-account/react/stores/useModalStore.ts +28 -0
- package/src/global-account/types/b3-api.types.ts +5 -1
- package/src/notifications/services/api.ts +1 -0
- package/src/shared/constants/chains/b3Chain.ts +4 -43
- package/src/shared/constants/chains/supported.ts +9 -48
- package/src/shared/utils/chain-transformers.ts +41 -39
- package/src/shared/utils/thirdweb-insights.ts +2 -2
- package/src/shared/utils/upload.ts +48 -0
- package/src/styles/index.css +27 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthClientProvider.js +0 -31
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +0 -10
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +0 -46
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +0 -11
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +0 -70
- package/dist/cjs/global-account/types/chain-networks.d.ts +0 -44
- package/dist/cjs/global-account/types/chain-networks.js +0 -48
- package/dist/cjs/shared/generated/chain-networks.json +0 -684
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthClientProvider.js +0 -27
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +0 -10
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +0 -43
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +0 -11
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +0 -67
- package/dist/esm/global-account/types/chain-networks.d.ts +0 -44
- package/dist/esm/global-account/types/chain-networks.js +0 -45
- package/dist/esm/shared/generated/chain-networks.json +0 -684
- package/dist/types/global-account/react/components/B3Provider/BetterAuthClientProvider.d.ts +0 -17
- package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +0 -10
- package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +0 -11
- package/dist/types/global-account/types/chain-networks.d.ts +0 -44
- package/src/global-account/react/components/B3Provider/BetterAuthClientProvider.tsx +0 -40
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +0 -63
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +0 -79
- package/src/global-account/types/chain-networks.ts +0 -54
- package/src/shared/generated/chain-networks.json +0 -684
|
@@ -2,7 +2,7 @@ import app from "@b3dotfun/sdk/global-account/app";
|
|
|
2
2
|
import { useAuthStore, useB3Config } from "@b3dotfun/sdk/global-account/react";
|
|
3
3
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { getBetterAuthClient } from "../../better-auth-client";
|
|
6
6
|
import { useUserQuery } from "./useUserQuery";
|
|
7
7
|
|
|
8
8
|
const debug = debugB3React("useBetterAuth");
|
|
@@ -27,7 +27,6 @@ export class EmailVerificationRequiredError extends Error {
|
|
|
27
27
|
*/
|
|
28
28
|
export function useBetterAuth() {
|
|
29
29
|
const { partnerId } = useB3Config();
|
|
30
|
-
const betterAuthClient = useBetterAuthClient();
|
|
31
30
|
const { setUser } = useUserQuery();
|
|
32
31
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
33
32
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
@@ -35,7 +34,7 @@ export function useBetterAuth() {
|
|
|
35
34
|
const setHasStartedConnecting = useAuthStore(state => state.setHasStartedConnecting);
|
|
36
35
|
|
|
37
36
|
const exchangeForFeathersJWT = useCallback(
|
|
38
|
-
async (sessionToken: string) => {
|
|
37
|
+
async (sessionToken: string): Promise<Record<string, any>> => {
|
|
39
38
|
debug("Exchanging Better Auth token for Feathers JWT");
|
|
40
39
|
|
|
41
40
|
const response = await app.authenticate({
|
|
@@ -66,7 +65,7 @@ export function useBetterAuth() {
|
|
|
66
65
|
setIsAuthenticating(true);
|
|
67
66
|
|
|
68
67
|
try {
|
|
69
|
-
const result = await
|
|
68
|
+
const result = await getBetterAuthClient().signIn.email({ email, password });
|
|
70
69
|
|
|
71
70
|
if (result.error) {
|
|
72
71
|
throw new Error(result.error.message || "Sign in failed");
|
|
@@ -84,7 +83,7 @@ export function useBetterAuth() {
|
|
|
84
83
|
throw error;
|
|
85
84
|
}
|
|
86
85
|
},
|
|
87
|
-
[exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting
|
|
86
|
+
[exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting],
|
|
88
87
|
);
|
|
89
88
|
|
|
90
89
|
const signUpWithEmail = useCallback(
|
|
@@ -94,7 +93,7 @@ export function useBetterAuth() {
|
|
|
94
93
|
setIsAuthenticating(true);
|
|
95
94
|
|
|
96
95
|
try {
|
|
97
|
-
const result = await
|
|
96
|
+
const result = await getBetterAuthClient().signUp.email({ email, password, name });
|
|
98
97
|
|
|
99
98
|
if (result.error) {
|
|
100
99
|
throw new Error(result.error.message || "Sign up failed");
|
|
@@ -105,7 +104,7 @@ export function useBetterAuth() {
|
|
|
105
104
|
// requireEmailVerification is enabled — send verification email with
|
|
106
105
|
// a callbackURL Better Auth redirects to after server-side verify.
|
|
107
106
|
// Pass verifyCallbackURL to land on a dedicated confirmation page.
|
|
108
|
-
await
|
|
107
|
+
await getBetterAuthClient().sendVerificationEmail({
|
|
109
108
|
email,
|
|
110
109
|
callbackURL: verifyCallbackURL || `${window.location.origin}?authStrategy=better-auth`,
|
|
111
110
|
});
|
|
@@ -119,7 +118,7 @@ export function useBetterAuth() {
|
|
|
119
118
|
throw error;
|
|
120
119
|
}
|
|
121
120
|
},
|
|
122
|
-
[exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting
|
|
121
|
+
[exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting],
|
|
123
122
|
);
|
|
124
123
|
|
|
125
124
|
const signInWithSocial = useCallback(
|
|
@@ -129,7 +128,7 @@ export function useBetterAuth() {
|
|
|
129
128
|
setIsAuthenticating(true);
|
|
130
129
|
|
|
131
130
|
try {
|
|
132
|
-
const result = await
|
|
131
|
+
const result = await getBetterAuthClient().signIn.social({
|
|
133
132
|
provider,
|
|
134
133
|
callbackURL: window.location.href,
|
|
135
134
|
});
|
|
@@ -146,13 +145,13 @@ export function useBetterAuth() {
|
|
|
146
145
|
throw error;
|
|
147
146
|
}
|
|
148
147
|
},
|
|
149
|
-
[setIsAuthenticating, setHasStartedConnecting
|
|
148
|
+
[setIsAuthenticating, setHasStartedConnecting],
|
|
150
149
|
);
|
|
151
150
|
|
|
152
151
|
const requestPasswordReset = useCallback(async (email: string, redirectTo?: string) => {
|
|
153
152
|
debug("Requesting password reset", { email });
|
|
154
153
|
|
|
155
|
-
const result = await
|
|
154
|
+
const result = await getBetterAuthClient().requestPasswordReset({
|
|
156
155
|
email,
|
|
157
156
|
redirectTo,
|
|
158
157
|
});
|
|
@@ -163,12 +162,12 @@ export function useBetterAuth() {
|
|
|
163
162
|
|
|
164
163
|
debug("Password reset email sent");
|
|
165
164
|
return result;
|
|
166
|
-
}, [
|
|
165
|
+
}, []);
|
|
167
166
|
|
|
168
167
|
const resetPassword = useCallback(async (newPassword: string, token: string) => {
|
|
169
168
|
debug("Resetting password");
|
|
170
169
|
|
|
171
|
-
const result = await
|
|
170
|
+
const result = await getBetterAuthClient().resetPassword({
|
|
172
171
|
newPassword,
|
|
173
172
|
token,
|
|
174
173
|
});
|
|
@@ -179,7 +178,7 @@ export function useBetterAuth() {
|
|
|
179
178
|
|
|
180
179
|
debug("Password reset successful");
|
|
181
180
|
return result;
|
|
182
|
-
}, [
|
|
181
|
+
}, []);
|
|
183
182
|
|
|
184
183
|
return {
|
|
185
184
|
signInWithEmail,
|
|
@@ -188,6 +187,6 @@ export function useBetterAuth() {
|
|
|
188
187
|
requestPasswordReset,
|
|
189
188
|
resetPassword,
|
|
190
189
|
exchangeForFeathersJWT,
|
|
191
|
-
betterAuthClient,
|
|
190
|
+
betterAuthClient: getBetterAuthClient(),
|
|
192
191
|
};
|
|
193
192
|
}
|
|
@@ -28,14 +28,23 @@ export function useClient() {
|
|
|
28
28
|
}, []);
|
|
29
29
|
|
|
30
30
|
const authenticateWithType = useCallback(
|
|
31
|
-
async (
|
|
31
|
+
async (
|
|
32
|
+
type: ClientType,
|
|
33
|
+
accessToken: string,
|
|
34
|
+
identityToken: string,
|
|
35
|
+
params?: Record<string, any>,
|
|
36
|
+
): Promise<Record<string, any> | null> => {
|
|
32
37
|
return authenticateWithClient(type, accessToken, identityToken, params);
|
|
33
38
|
},
|
|
34
39
|
[],
|
|
35
40
|
);
|
|
36
41
|
|
|
37
42
|
const authenticateWithBoth = useCallback(
|
|
38
|
-
async (
|
|
43
|
+
async (
|
|
44
|
+
accessToken: string,
|
|
45
|
+
identityToken: string,
|
|
46
|
+
params?: Record<string, any>,
|
|
47
|
+
): Promise<{ socket: Record<string, any> | null; rest: Record<string, any> | null; success: boolean }> => {
|
|
39
48
|
return authenticateBoth(accessToken, identityToken, params);
|
|
40
49
|
},
|
|
41
50
|
[],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toast } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
|
|
3
|
-
import { b3Mainnet, b3Testnet } from "@b3dotfun/sdk/shared/constants/chains/
|
|
3
|
+
import { b3Mainnet, b3Testnet } from "@b3dotfun/sdk/shared/constants/chains/b3Chain";
|
|
4
4
|
import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
|
|
5
5
|
import { useQuery } from "@tanstack/react-query";
|
|
6
6
|
|
|
@@ -4,7 +4,7 @@ import { useCallback } from "react";
|
|
|
4
4
|
import { Account } from "thirdweb/wallets";
|
|
5
5
|
|
|
6
6
|
export function useSiwe() {
|
|
7
|
-
const authenticate = useCallback(async (account: Account, partnerId: string) => {
|
|
7
|
+
const authenticate = useCallback(async (account: Account, partnerId: string): Promise<Record<string, any>> => {
|
|
8
8
|
if (!account || !account.signMessage) throw new Error("Account not found");
|
|
9
9
|
// generate challenge
|
|
10
10
|
const challenge = await app.service("global-accounts-challenge").create({
|
|
@@ -8,7 +8,7 @@ export function useSiwe() {
|
|
|
8
8
|
const referralCode = useSearchParam("referralCode");
|
|
9
9
|
|
|
10
10
|
const authenticate = useCallback(
|
|
11
|
-
async (account: Account, partnerId: string) => {
|
|
11
|
+
async (account: Account, partnerId: string): Promise<Record<string, any>> => {
|
|
12
12
|
console.warn("@@useSiwe is deprecated, use useTWAuth instead");
|
|
13
13
|
if (!account || !account.signMessage) throw new Error("Account not found");
|
|
14
14
|
|
|
@@ -15,7 +15,7 @@ export function useTWAuth() {
|
|
|
15
15
|
const referralCode = useSearchParam("referralCode");
|
|
16
16
|
|
|
17
17
|
const authenticate = useCallback(
|
|
18
|
-
async (wallet: Wallet, partnerId: string) => {
|
|
18
|
+
async (wallet: Wallet, partnerId: string): Promise<Record<string, any>> => {
|
|
19
19
|
if (!wallet || !wallet?.getAuthToken?.()) throw new Error("Wallet not found");
|
|
20
20
|
|
|
21
21
|
const authToken = wallet.getAuthToken();
|
|
@@ -9,6 +9,7 @@ import { useCallback, useState } from "react";
|
|
|
9
9
|
import { prepareTransaction, sendTransaction as twSendTransaction } from "thirdweb";
|
|
10
10
|
import { isAddress } from "viem";
|
|
11
11
|
import { useSwitchChain } from "wagmi";
|
|
12
|
+
import { useB3Config } from "../components/B3Provider/B3ConfigProvider";
|
|
12
13
|
import { useB3Account } from "../components/B3Provider/useB3Account";
|
|
13
14
|
import { useAccountWallet } from "./useAccountWallet";
|
|
14
15
|
|
|
@@ -18,14 +19,6 @@ export interface UnifiedTransactionParams {
|
|
|
18
19
|
value: bigint;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
const partnerId = String(
|
|
22
|
-
process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
23
|
-
process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
24
|
-
process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID ||
|
|
25
|
-
process.env.NEXT_PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID,
|
|
26
|
-
);
|
|
27
|
-
invariant(partnerId, "Partner ID is required");
|
|
28
|
-
|
|
29
22
|
export function useUnifiedChainSwitchAndExecute() {
|
|
30
23
|
const { switchChainAsync } = useSwitchChain();
|
|
31
24
|
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = useState(false);
|
|
@@ -33,6 +26,9 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
33
26
|
const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = useAccountWallet();
|
|
34
27
|
const aaAccount = useB3Account();
|
|
35
28
|
|
|
29
|
+
// From context, not process.env: partnerId is hashed into the server intent key and must match the ecosystem wallet.
|
|
30
|
+
const { partnerId } = useB3Config();
|
|
31
|
+
|
|
36
32
|
// Handle EOA wallet chain switch and execute transaction
|
|
37
33
|
const handleEOASwitchChainAndSendTransaction = useCallback(
|
|
38
34
|
async (targetChainId: number, params: UnifiedTransactionParams): Promise<string | undefined> => {
|
|
@@ -144,17 +140,23 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
144
140
|
value: params.value,
|
|
145
141
|
});
|
|
146
142
|
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
143
|
+
// Pre-register an intent to authorize the signature server-side; skip if partnerId is missing.
|
|
144
|
+
if (partnerId) {
|
|
145
|
+
try {
|
|
146
|
+
await app.service("global-accounts-intents").create({
|
|
147
|
+
partnerId,
|
|
148
|
+
chainId: targetChainId,
|
|
149
|
+
to: params.to,
|
|
150
|
+
data: params.data || "0x",
|
|
151
|
+
value: params.value.toString(),
|
|
152
|
+
});
|
|
153
|
+
} catch (err: any) {
|
|
154
|
+
console.error("Create global-accounts-intents error", err);
|
|
155
|
+
}
|
|
156
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
157
|
+
console.warn(
|
|
158
|
+
"useUnifiedChainSwitchAndExecute: missing partnerId from B3Config — skipping intent pre-authorization",
|
|
159
|
+
);
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
toast.info("Sending transaction…");
|
|
@@ -176,7 +178,7 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
176
178
|
setIsSwitchingOrExecuting(false);
|
|
177
179
|
}
|
|
178
180
|
},
|
|
179
|
-
[aaAccount],
|
|
181
|
+
[aaAccount, partnerId],
|
|
180
182
|
);
|
|
181
183
|
|
|
182
184
|
// Unified switch chain and execute function
|
|
@@ -141,6 +141,8 @@ export interface AnySpendModalProps extends BaseModalProps {
|
|
|
141
141
|
disableUrlParamManagement?: boolean;
|
|
142
142
|
/** Staging environment support */
|
|
143
143
|
isStaging?: boolean;
|
|
144
|
+
/** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
|
|
145
|
+
showFiatOption?: boolean;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
/**
|
|
@@ -158,6 +160,8 @@ export interface AnySpendNftProps extends BaseModalProps {
|
|
|
158
160
|
onSuccess?: (txHash?: string) => void;
|
|
159
161
|
/** Client-provided reference ID for tracking orders */
|
|
160
162
|
clientReferenceId?: string;
|
|
163
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
164
|
+
showFiatOption?: boolean;
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
/**
|
|
@@ -236,6 +240,8 @@ export interface AnySpendStakeB3Props extends BaseModalProps {
|
|
|
236
240
|
stakeAmount?: string;
|
|
237
241
|
/** Callback function called when the stake is successful */
|
|
238
242
|
onSuccess?: () => void;
|
|
243
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
244
|
+
showFiatOption?: boolean;
|
|
239
245
|
}
|
|
240
246
|
|
|
241
247
|
/**
|
|
@@ -251,6 +257,8 @@ export interface AnySpendStakeB3ExactInProps extends BaseModalProps {
|
|
|
251
257
|
stakeAmount?: string;
|
|
252
258
|
/** Callback function called when the stake is successful */
|
|
253
259
|
onSuccess?: () => void;
|
|
260
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
261
|
+
showFiatOption?: boolean;
|
|
254
262
|
}
|
|
255
263
|
|
|
256
264
|
/**
|
|
@@ -272,6 +280,8 @@ export interface AnySpendStakeUpsideProps extends BaseModalProps {
|
|
|
272
280
|
activeTab?: "crypto" | "fiat";
|
|
273
281
|
/** Callback function called when the stake is successful */
|
|
274
282
|
onSuccess?: () => void;
|
|
283
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
284
|
+
showFiatOption?: boolean;
|
|
275
285
|
}
|
|
276
286
|
|
|
277
287
|
/**
|
|
@@ -289,6 +299,8 @@ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
|
|
|
289
299
|
token: components["schemas"]["Token"];
|
|
290
300
|
/** Callback function called when the stake is successful */
|
|
291
301
|
onSuccess?: () => void;
|
|
302
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
303
|
+
showFiatOption?: boolean;
|
|
292
304
|
}
|
|
293
305
|
|
|
294
306
|
/**
|
|
@@ -312,6 +324,8 @@ export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
|
312
324
|
destinationTokenAmount?: string;
|
|
313
325
|
/** Callback function called when the deposit is successful */
|
|
314
326
|
onSuccess?: () => void;
|
|
327
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
328
|
+
showFiatOption?: boolean;
|
|
315
329
|
}
|
|
316
330
|
|
|
317
331
|
/**
|
|
@@ -331,6 +345,8 @@ export interface AnySpendBuySpinProps extends BaseModalProps {
|
|
|
331
345
|
onSuccess?: (txHash?: string) => void;
|
|
332
346
|
/** Prefill quantity of spins to purchase */
|
|
333
347
|
prefillQuantity?: string;
|
|
348
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
349
|
+
showFiatOption?: boolean;
|
|
334
350
|
}
|
|
335
351
|
|
|
336
352
|
/**
|
|
@@ -346,6 +362,8 @@ export interface AnySpendSignatureMintProps extends BaseModalProps {
|
|
|
346
362
|
imageUrl?: string;
|
|
347
363
|
/** Callback function called when minting is successful */
|
|
348
364
|
onSuccess?: (txHash?: string) => void;
|
|
365
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
366
|
+
showFiatOption?: boolean;
|
|
349
367
|
}
|
|
350
368
|
|
|
351
369
|
/**
|
|
@@ -371,6 +389,8 @@ export interface AnySpendBondKitProps extends BaseModalProps {
|
|
|
371
389
|
b3Amount?: string;
|
|
372
390
|
/** Callback function called when purchase is successful */
|
|
373
391
|
onSuccess?: (txHash?: string) => void;
|
|
392
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
393
|
+
showFiatOption?: boolean;
|
|
374
394
|
}
|
|
375
395
|
|
|
376
396
|
export interface LinkAccountModalProps extends BaseModalProps {
|
|
@@ -420,6 +440,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
420
440
|
customRecipientLabel?: string;
|
|
421
441
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
422
442
|
returnHomeLabel?: string;
|
|
443
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
444
|
+
showFiatOption?: boolean;
|
|
423
445
|
}
|
|
424
446
|
|
|
425
447
|
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
@@ -511,6 +533,8 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
|
511
533
|
isStaging?: boolean;
|
|
512
534
|
/** Optional discount code to apply to the purchase */
|
|
513
535
|
discountCode?: string;
|
|
536
|
+
/** Whether to show the "Pay with fiat" tab. Defaults to true. */
|
|
537
|
+
showFiatOption?: boolean;
|
|
514
538
|
}
|
|
515
539
|
|
|
516
540
|
/**
|
|
@@ -569,6 +593,8 @@ export interface AnySpendCheckoutTriggerModalProps extends BaseModalProps {
|
|
|
569
593
|
returnUrl?: string;
|
|
570
594
|
/** Label for the return button */
|
|
571
595
|
returnLabel?: string;
|
|
596
|
+
/** Whether to show fiat payment options (card + coinbase). Defaults to true. */
|
|
597
|
+
showFiatOption?: boolean;
|
|
572
598
|
}
|
|
573
599
|
|
|
574
600
|
export interface AnySpendWorkflowTriggerModalProps extends BaseModalProps {
|
|
@@ -598,6 +624,8 @@ export interface AnySpendWorkflowTriggerModalProps extends BaseModalProps {
|
|
|
598
624
|
actionLabel?: string;
|
|
599
625
|
/** Custom class names */
|
|
600
626
|
classes?: AnySpendAllClasses;
|
|
627
|
+
/** Whether to show fiat payment option. Defaults to true. */
|
|
628
|
+
showFiatOption?: boolean;
|
|
601
629
|
}
|
|
602
630
|
|
|
603
631
|
export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
@@ -10,11 +10,14 @@ type ObjectId = string;
|
|
|
10
10
|
|
|
11
11
|
// Partner IDs interface
|
|
12
12
|
interface PartnerIds {
|
|
13
|
+
/** @deprecated Privy is no longer used for authentication. This field exists for legacy data compatibility only. */
|
|
13
14
|
privyId?: string;
|
|
14
15
|
thirdwebId?: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Privy is no longer used for authentication. This type exists for legacy data compatibility only.
|
|
20
|
+
*/
|
|
18
21
|
interface PrivyLinkedAccount {
|
|
19
22
|
type: string; // "wallet" | "smart_wallet" | "google_oauth"
|
|
20
23
|
address?: string;
|
|
@@ -76,6 +79,7 @@ interface User {
|
|
|
76
79
|
|
|
77
80
|
// Partner integrations
|
|
78
81
|
partnerIds: PartnerIds;
|
|
82
|
+
/** @deprecated Privy is no longer used for authentication. This field exists for legacy data compatibility only. */
|
|
79
83
|
privyLinkedAccounts?: PrivyLinkedAccount[];
|
|
80
84
|
twProfiles?: TWProfile[];
|
|
81
85
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChainNetworks } from "@b3dotfun/sdk/global-account/types/chain-networks";
|
|
2
1
|
import { defineChain as defineThirdwebChain, Chain as ThirdwebChain } from "thirdweb";
|
|
3
2
|
import { Chain, defineChain } from "viem";
|
|
4
3
|
|
|
@@ -58,11 +57,11 @@ export const b3Testnet: Chain = defineChain({
|
|
|
58
57
|
export const b3Mainnet = defineChain({
|
|
59
58
|
id: 8333,
|
|
60
59
|
name: "B3",
|
|
61
|
-
rpc: "https://
|
|
60
|
+
rpc: "https://mainnet-rpc.b3.fun",
|
|
62
61
|
rpcUrls: {
|
|
63
62
|
default: {
|
|
64
|
-
http: ["https://
|
|
65
|
-
ws: ["wss://
|
|
63
|
+
http: ["https://mainnet-rpc.b3.fun"],
|
|
64
|
+
ws: ["wss://mainnet-rpc.b3.fun/ws"],
|
|
66
65
|
},
|
|
67
66
|
},
|
|
68
67
|
icon: {
|
|
@@ -84,28 +83,6 @@ export const b3Mainnet = defineChain({
|
|
|
84
83
|
},
|
|
85
84
|
});
|
|
86
85
|
|
|
87
|
-
export const getViemChainConfig = (config: ChainNetworks) =>
|
|
88
|
-
defineChain({
|
|
89
|
-
id: config.id,
|
|
90
|
-
name: config.name,
|
|
91
|
-
rpc: config.rpcUrls.default.http,
|
|
92
|
-
rpcUrls: {
|
|
93
|
-
default: {
|
|
94
|
-
http: [config.rpcUrls.default.http],
|
|
95
|
-
ws: [config.rpcUrls.default.ws],
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
icon: config.icon,
|
|
99
|
-
blockExplorers: {
|
|
100
|
-
default: {
|
|
101
|
-
name: config.blockExplorers.explorerTitle,
|
|
102
|
-
url: config.blockExplorers.default,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
nativeCurrency: config.nativeCurrency,
|
|
106
|
-
testnet: config.testnet ? true : undefined,
|
|
107
|
-
});
|
|
108
|
-
|
|
109
86
|
export const thirdwebB3Testnet: ThirdwebChain = defineThirdwebChain({
|
|
110
87
|
id: 1993,
|
|
111
88
|
name: "B3 Sepolia",
|
|
@@ -133,7 +110,7 @@ export const thirdwebB3Testnet: ThirdwebChain = defineThirdwebChain({
|
|
|
133
110
|
export const thirdwebB3Mainnet: ThirdwebChain = defineThirdwebChain({
|
|
134
111
|
id: 8333,
|
|
135
112
|
name: "B3",
|
|
136
|
-
rpc: "https://
|
|
113
|
+
rpc: "https://mainnet-rpc.b3.fun",
|
|
137
114
|
icon: {
|
|
138
115
|
url: "https://cdn.b3.fun/b3_logo.svg",
|
|
139
116
|
width: 32,
|
|
@@ -153,22 +130,6 @@ export const thirdwebB3Mainnet: ThirdwebChain = defineThirdwebChain({
|
|
|
153
130
|
},
|
|
154
131
|
});
|
|
155
132
|
|
|
156
|
-
export const getThirdwebChainConfig = (config: ChainNetworks): ThirdwebChain =>
|
|
157
|
-
defineThirdwebChain({
|
|
158
|
-
id: config.id,
|
|
159
|
-
name: config.name,
|
|
160
|
-
rpc: config.rpcUrls.default.http,
|
|
161
|
-
icon: config.icon,
|
|
162
|
-
blockExplorers: [
|
|
163
|
-
{
|
|
164
|
-
name: config.blockExplorers.explorerTitle,
|
|
165
|
-
url: config.blockExplorers.default,
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
nativeCurrency: config.nativeCurrency,
|
|
169
|
-
testnet: config.testnet ? true : undefined,
|
|
170
|
-
});
|
|
171
|
-
|
|
172
133
|
export const b3Chain = process.env.NEXT_PUBLIC_B3_CHAINID === "8333" ? b3Mainnet : b3Testnet;
|
|
173
134
|
export const thirdwebB3Chain: ThirdwebChain =
|
|
174
135
|
process.env.NEXT_PUBLIC_B3_CHAINID === "8333" ? thirdwebB3Mainnet : thirdwebB3Testnet;
|
|
@@ -1,75 +1,36 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ANYSPEND_EVM_CHAINS } from "@b3/chain-registry";
|
|
2
2
|
import { toThirdwebChain, toViemChain } from "@b3dotfun/sdk/shared/utils/chain-transformers";
|
|
3
3
|
import invariant from "invariant";
|
|
4
|
-
|
|
5
4
|
import type { Chain as ThirdwebChain } from "thirdweb";
|
|
6
|
-
// Import the JSON directly
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
import chainNetworksJSON from "../../generated/chain-networks.json" with { type: "json" };
|
|
10
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
11
6
|
// @ts-ignore
|
|
12
7
|
import coingeckoChainsJSON from "../../generated/coingecko-chains.json" with { type: "json" };
|
|
13
8
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const viemChains = chainNetworks.map(toViemChain);
|
|
18
|
-
|
|
19
|
-
// TODO: link to doc explaining why we don't support all chains and how to add more
|
|
20
|
-
// These are the chains that are supported for things such as bridging and fetching balances
|
|
21
|
-
export const supportedChains = [...viemChains];
|
|
22
|
-
|
|
23
|
-
// ThirdWeb format chains
|
|
24
|
-
export const supportedChainsTW: ThirdwebChain[] = [
|
|
25
|
-
...chainNetworks
|
|
26
|
-
.map(chain => {
|
|
27
|
-
const networkData = chainNetworks.find(n => n.id === chain.id);
|
|
28
|
-
return networkData ? toThirdwebChain(networkData) : undefined;
|
|
29
|
-
})
|
|
30
|
-
.filter((chain): chain is NonNullable<typeof chain> => chain !== undefined),
|
|
31
|
-
];
|
|
9
|
+
export const supportedChains = ANYSPEND_EVM_CHAINS.map(toViemChain);
|
|
10
|
+
export const supportedChainsTW: ThirdwebChain[] = ANYSPEND_EVM_CHAINS.map(toThirdwebChain);
|
|
11
|
+
export const supportedChainNetworks = ANYSPEND_EVM_CHAINS;
|
|
32
12
|
|
|
33
|
-
// Original format from chain-networks.json
|
|
34
|
-
export const supportedChainNetworks = chainNetworks;
|
|
35
|
-
|
|
36
|
-
// CoinGecko chain mapping
|
|
37
13
|
export const coingeckoChains = coingeckoChainsJSON as Record<
|
|
38
14
|
number,
|
|
39
|
-
{
|
|
40
|
-
coingecko_id: string;
|
|
41
|
-
name: string;
|
|
42
|
-
native_coin_id: string;
|
|
43
|
-
}
|
|
15
|
+
{ coingecko_id: string; name: string; native_coin_id: string }
|
|
44
16
|
>;
|
|
45
|
-
|
|
17
|
+
|
|
46
18
|
export function getCoingeckoChainInfo(chainId: number) {
|
|
47
19
|
return coingeckoChains[chainId];
|
|
48
20
|
}
|
|
49
21
|
|
|
50
|
-
const _b3MainnetThirdWeb
|
|
22
|
+
const _b3MainnetThirdWeb = supportedChainsTW.find(c => c.id === 8333);
|
|
51
23
|
invariant(_b3MainnetThirdWeb, "B3 mainnet chain not found in supported chains TW");
|
|
52
24
|
export const b3MainnetThirdWeb = _b3MainnetThirdWeb;
|
|
53
25
|
|
|
54
|
-
const
|
|
55
|
-
invariant(_b3TestnetThirdWeb, "B3 testnet chain not found in supported chains TW");
|
|
56
|
-
export const b3TestnetThirdWeb = _b3TestnetThirdWeb;
|
|
57
|
-
|
|
58
|
-
const _b3Mainnet = supportedChains.find(chain => chain.id === 8333);
|
|
26
|
+
const _b3Mainnet = supportedChains.find(c => c.id === 8333);
|
|
59
27
|
invariant(_b3Mainnet, "B3 mainnet chain not found in supported chains");
|
|
60
28
|
export const b3Mainnet = _b3Mainnet;
|
|
61
29
|
|
|
62
|
-
const
|
|
63
|
-
invariant(_b3Testnet, "B3 testnet chain not found in supported chains");
|
|
64
|
-
export const b3Testnet = _b3Testnet;
|
|
65
|
-
|
|
66
|
-
const _baseMainnet = supportedChains.find(chain => chain.id === 8453);
|
|
30
|
+
const _baseMainnet = supportedChains.find(c => c.id === 8453);
|
|
67
31
|
invariant(_baseMainnet, "Base mainnet chain not found in supported chains");
|
|
68
32
|
export const baseMainnet = _baseMainnet;
|
|
69
33
|
|
|
70
|
-
/**
|
|
71
|
-
* Get a Thirdweb chain by chain ID from supportedChainsTW
|
|
72
|
-
*/
|
|
73
34
|
export function getThirdwebChain(chainId: number): ThirdwebChain {
|
|
74
35
|
const chain = supportedChainsTW.find(c => c.id === chainId);
|
|
75
36
|
if (!chain) {
|