@b3dotfun/sdk 0.1.70-alpha.2 → 0.1.70-alpha.21
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/README.md +3 -3
- package/constants/chains/b3Chain.js +3 -1
- package/dist/cjs/anyspend/constants/rpc.d.ts +3 -1
- package/dist/cjs/anyspend/constants/rpc.js +6 -2
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +9 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +123 -46
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +8 -10
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +15 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +78 -25
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +32 -13
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +32 -10
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +22 -3
- package/dist/cjs/anyspend/react/components/QRDeposit.js +25 -16
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +18 -11
- package/dist/cjs/anyspend/react/components/common/PureTransferView.d.ts +30 -0
- package/dist/cjs/anyspend/react/components/common/PureTransferView.js +64 -0
- package/dist/cjs/anyspend/react/components/common/TokenBalance.js +4 -5
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/utils/address.d.ts +2 -1
- package/dist/cjs/anyspend/utils/address.js +12 -9
- package/dist/cjs/anyspend/utils/chain.d.ts +84 -1
- package/dist/cjs/anyspend/utils/chain.js +73 -3
- 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 +51 -4
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +6 -11
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +11 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +12 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +12 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +25 -3
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +45 -4
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +11 -5
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +23 -15
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +8 -6
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +17 -8
- package/dist/cjs/global-account/react/components/Send/Send.js +15 -11
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +3 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -5
- package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +1 -0
- 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 +3 -3
- package/dist/cjs/global-account/react/components/index.d.ts +1 -1
- package/dist/cjs/global-account/react/components/index.js +3 -3
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -3
- package/dist/cjs/global-account/react/hooks/index.js +7 -10
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +5 -4
- package/dist/cjs/global-account/react/hooks/useAuth.js +1 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +3 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +2 -1
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +1657 -22
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +7 -7
- package/dist/cjs/global-account/react/hooks/useClient.d.ts +3 -3
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/cjs/global-account/react/hooks/useFirstEOA.js +1 -0
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioBalance.js +76 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.js +178 -0
- 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.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +37 -27
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +14 -2
- 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 +30 -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/constants/index.d.ts +4 -0
- 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/cjs/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/cjs/shared/utils/zerionPositions.js +188 -0
- package/dist/esm/anyspend/constants/rpc.d.ts +3 -1
- package/dist/esm/anyspend/constants/rpc.js +5 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +9 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +124 -47
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +9 -11
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +15 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +80 -27
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +33 -14
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +33 -11
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +22 -3
- package/dist/esm/anyspend/react/components/QRDeposit.js +27 -18
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +21 -14
- package/dist/esm/anyspend/react/components/common/PureTransferView.d.ts +30 -0
- package/dist/esm/anyspend/react/components/common/PureTransferView.js +61 -0
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +6 -7
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/utils/address.d.ts +2 -1
- package/dist/esm/anyspend/utils/address.js +9 -6
- package/dist/esm/anyspend/utils/chain.d.ts +84 -1
- package/dist/esm/anyspend/utils/chain.js +73 -5
- 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 +51 -5
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +6 -11
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +11 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +11 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +12 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +26 -4
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +46 -5
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +11 -5
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +24 -16
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +9 -7
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +18 -9
- package/dist/esm/global-account/react/components/Send/Send.js +16 -12
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +3 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -5
- package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +2 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +1 -0
- 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 +3 -3
- package/dist/esm/global-account/react/components/index.d.ts +1 -1
- package/dist/esm/global-account/react/components/index.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -3
- package/dist/esm/global-account/react/hooks/index.js +2 -3
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +5 -4
- package/dist/esm/global-account/react/hooks/useAuth.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +3 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +2 -1
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +1657 -22
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +8 -8
- package/dist/esm/global-account/react/hooks/useClient.d.ts +3 -3
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/esm/global-account/react/hooks/useFirstEOA.js +1 -0
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +1 -1
- package/dist/esm/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/esm/global-account/react/hooks/usePortfolioBalance.js +72 -0
- package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.js +175 -0
- 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.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +37 -27
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +14 -2
- 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 +30 -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/constants/index.d.ts +4 -0
- 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/esm/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/esm/shared/utils/zerionPositions.js +180 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/rpc.d.ts +3 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +9 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +15 -3
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +22 -3
- package/dist/types/anyspend/react/components/common/PureTransferView.d.ts +30 -0
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/anyspend/utils/address.d.ts +2 -1
- package/dist/types/anyspend/utils/chain.d.ts +84 -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 +11 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +12 -2
- package/dist/types/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +3 -2
- package/dist/types/global-account/react/components/index.d.ts +1 -1
- package/dist/types/global-account/react/hooks/index.d.ts +2 -3
- package/dist/types/global-account/react/hooks/useAuth.d.ts +5 -4
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +3 -2
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +1657 -22
- package/dist/types/global-account/react/hooks/useClient.d.ts +3 -3
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/types/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/types/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- 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/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +14 -2
- 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 +30 -54
- package/dist/types/shared/constants/chains/supported.d.ts +1 -49
- package/dist/types/shared/constants/index.d.ts +4 -0
- package/dist/types/shared/utils/chain-transformers.d.ts +4 -4
- package/dist/types/shared/utils/upload.d.ts +9 -0
- package/dist/types/shared/utils/zerionPositions.d.ts +96 -0
- package/node_modules/@b3/chain-registry/chains.json +1225 -0
- package/node_modules/@b3/chain-registry/dist/chains.json +1225 -0
- package/node_modules/@b3/chain-registry/dist/index.cjs +1676 -0
- package/node_modules/@b3/chain-registry/dist/index.d.cts +195 -0
- package/node_modules/@b3/chain-registry/dist/index.d.ts +195 -0
- package/node_modules/@b3/chain-registry/dist/index.mjs +1604 -0
- package/node_modules/@b3/chain-registry/dist/src/index.d.ts +193 -0
- package/node_modules/@b3/chain-registry/dist/src/index.js +408 -0
- package/node_modules/@b3/chain-registry/package.json +66 -0
- package/node_modules/@b3/chain-registry/src/index.test.ts +432 -0
- package/node_modules/@b3/chain-registry/src/index.ts +672 -0
- package/package.json +81 -30
- package/src/anyspend/README.md +2 -2
- package/src/anyspend/constants/rpc.ts +5 -2
- package/src/anyspend/docs/components.md +6 -6
- package/src/anyspend/docs/contributing.md +1 -1
- package/src/anyspend/docs/hooks.md +3 -3
- package/src/anyspend/docs/installation.md +2 -2
- package/src/anyspend/react/components/AnySpend.tsx +163 -47
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +10 -11
- package/src/anyspend/react/components/AnySpendDeposit.tsx +130 -31
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +55 -14
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +55 -11
- package/src/anyspend/react/components/QRDeposit.tsx +101 -22
- package/src/anyspend/react/components/__tests__/QRDeposit.test.tsx +331 -0
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +38 -16
- package/src/anyspend/react/components/common/PureTransferView.tsx +212 -0
- package/src/anyspend/react/components/common/TokenBalance.tsx +10 -7
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +13 -13
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +4 -4
- package/src/anyspend/services/gas.test.ts +95 -18
- package/src/anyspend/types/api_req_res.ts +10 -5
- package/src/anyspend/utils/__tests__/address.test.ts +39 -0
- package/src/anyspend/utils/__tests__/deprecatedChains.test.ts +44 -0
- package/src/anyspend/utils/__tests__/toRegistryChainId.test.ts +17 -0
- package/src/anyspend/utils/address.ts +8 -6
- package/src/anyspend/utils/chain.ts +79 -3
- 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 +74 -9
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +6 -11
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +12 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +40 -4
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +51 -5
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +11 -11
- package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +50 -21
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +5 -3
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -6
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +1 -1
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +22 -9
- package/src/global-account/react/components/Send/Send.tsx +39 -15
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +12 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +1 -4
- package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +9 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +1 -0
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +4 -4
- package/src/global-account/react/components/index.ts +1 -1
- package/src/global-account/react/components/ui/button.tsx +1 -2
- package/src/global-account/react/hooks/__tests__/useUnifiedChainSwitchAndExecute.test.tsx +156 -0
- package/src/global-account/react/hooks/index.ts +2 -3
- package/src/global-account/react/hooks/useAuth.ts +5 -4
- package/src/global-account/react/hooks/useAuthentication.ts +5 -4
- package/src/global-account/react/hooks/useBetterAuth.ts +10 -10
- package/src/global-account/react/hooks/useClient.ts +11 -2
- package/src/global-account/react/hooks/useFirstEOA.tsx +9 -2
- package/src/global-account/react/hooks/useNativeBalance.tsx +1 -1
- package/src/global-account/react/hooks/usePortfolioBalance.ts +89 -0
- package/src/global-account/react/hooks/usePortfolioCollectibles.ts +212 -0
- 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 +47 -31
- package/src/global-account/react/stores/useModalStore.ts +14 -2
- 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/constants/index.ts +8 -0
- package/src/shared/react/hooks/__tests__/useCurrencyConversion.test.ts +54 -43
- package/src/shared/utils/__tests__/zerionPositions.test.ts +248 -0
- 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/shared/utils/zerionPositions.ts +247 -0
- package/src/styles/index.css +27 -0
- 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/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +0 -98
- package/dist/cjs/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/cjs/global-account/react/hooks/useSimCollectibles.js +0 -190
- package/dist/cjs/global-account/react/utils/simdune.d.ts +0 -7
- package/dist/cjs/global-account/react/utils/simdune.js +0 -21
- 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/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/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/esm/global-account/react/hooks/useSimBalance.js +0 -93
- package/dist/esm/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/esm/global-account/react/hooks/useSimCollectibles.js +0 -187
- package/dist/esm/global-account/react/utils/simdune.d.ts +0 -7
- package/dist/esm/global-account/react/utils/simdune.js +0 -17
- 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/SignInWithB3/SignInWithB3Privy.d.ts +0 -10
- package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +0 -11
- package/dist/types/global-account/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/types/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/types/global-account/react/utils/simdune.d.ts +0 -7
- package/dist/types/global-account/types/chain-networks.d.ts +0 -44
- 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/react/hooks/useSimBalance.ts +0 -164
- package/src/global-account/react/hooks/useSimCollectibles.ts +0 -238
- package/src/global-account/react/utils/simdune.ts +0 -20
- package/src/global-account/types/chain-networks.ts +0 -54
- package/src/shared/generated/chain-networks.json +0 -684
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
import { createAuthClient } from "better-auth/client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { twoFactorClient } from "better-auth/client/plugins";
|
|
3
|
+
import { getB3ApiUrl } from "../app.shared.js";
|
|
4
|
+
export function createB3BetterAuthClient(baseURL) {
|
|
4
5
|
return createAuthClient({
|
|
5
|
-
baseURL,
|
|
6
|
+
baseURL: baseURL ?? getB3ApiUrl(),
|
|
6
7
|
basePath: "/auth",
|
|
7
8
|
fetchOptions: {
|
|
8
9
|
credentials: "include",
|
|
9
10
|
},
|
|
11
|
+
plugins: [twoFactorClient()],
|
|
10
12
|
});
|
|
11
13
|
}
|
|
12
|
-
//
|
|
14
|
+
// Lazily-initialized singleton. Recreated when the API URL changes via
|
|
15
|
+
// `resetBetterAuthClient()` (called by B3Provider when `apiUrl` changes).
|
|
16
|
+
let _client = null;
|
|
17
|
+
let _clientUrl = null;
|
|
18
|
+
/** Get the shared BetterAuth client, creating it if needed. */
|
|
19
|
+
export function getBetterAuthClient() {
|
|
20
|
+
const url = getB3ApiUrl();
|
|
21
|
+
if (!_client || _clientUrl !== url) {
|
|
22
|
+
_client = createB3BetterAuthClient(url);
|
|
23
|
+
_clientUrl = url;
|
|
24
|
+
}
|
|
25
|
+
return _client;
|
|
26
|
+
}
|
|
27
|
+
/** Force-recreate the client on next access (e.g. after API URL change). */
|
|
28
|
+
export function resetBetterAuthClient() {
|
|
29
|
+
_client = null;
|
|
30
|
+
_clientUrl = null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `getBetterAuthClient()` instead. This static singleton
|
|
34
|
+
* does not reflect runtime API URL changes via `B3Provider apiUrl` prop.
|
|
35
|
+
*/
|
|
13
36
|
export const betterAuthClient = createB3BetterAuthClient();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const app: import("@b3dotfun/basement-api").ClientApplication;
|
|
2
|
-
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<
|
|
2
|
+
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
3
3
|
export declare const resetSocket: () => void;
|
|
4
|
-
export declare const authenticateWithB3JWT: (fullToken: string, params?: Record<string, any>) => Promise<
|
|
4
|
+
export declare const authenticateWithB3JWT: (fullToken: string, params?: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
5
5
|
export default app;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MMKV } from "react-native-mmkv";
|
|
2
2
|
export declare const localStoreInstance: MMKV;
|
|
3
3
|
declare const app: import("@b3dotfun/basement-api").ClientApplication;
|
|
4
|
-
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<
|
|
4
|
+
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
5
5
|
export default app;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ClientApplication } from "@b3dotfun/b3-api";
|
|
2
2
|
export type ClientType = "socket" | "rest";
|
|
3
|
+
/** Reset all cached clients (called when API URL changes). */
|
|
4
|
+
export declare function resetClients(): void;
|
|
3
5
|
/**
|
|
4
6
|
* Sets the active client type and creates the appropriate client
|
|
5
7
|
*
|
|
@@ -25,20 +27,20 @@ export declare function resetSocket(): void;
|
|
|
25
27
|
/**
|
|
26
28
|
* Authenticates with the current active client
|
|
27
29
|
*/
|
|
28
|
-
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<
|
|
30
|
+
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
29
31
|
/**
|
|
30
32
|
* Authenticates with a specific client type
|
|
31
33
|
*/
|
|
32
|
-
export declare const authenticateWithClient: (clientType: ClientType, accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<
|
|
34
|
+
export declare const authenticateWithClient: (clientType: ClientType, accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
33
35
|
/**
|
|
34
36
|
* Authenticates with both clients in parallel (useful for migration scenarios)
|
|
35
37
|
*/
|
|
36
38
|
export declare const authenticateBoth: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<{
|
|
37
|
-
socket:
|
|
38
|
-
rest:
|
|
39
|
+
socket: Record<string, any> | null;
|
|
40
|
+
rest: Record<string, any> | null;
|
|
39
41
|
success: boolean;
|
|
40
42
|
}>;
|
|
41
43
|
/**
|
|
42
44
|
* Switches the client type and authenticates
|
|
43
45
|
*/
|
|
44
|
-
export declare function switchClientAndAuth(type: ClientType, access: string, id: string, params?: any): Promise<
|
|
46
|
+
export declare function switchClientAndAuth(type: ClientType, access: string, id: string, params?: any): Promise<Record<string, any> | null>;
|
|
@@ -2,22 +2,57 @@ import { createClient } from "@b3dotfun/b3-api";
|
|
|
2
2
|
import rest from "@feathersjs/rest-client";
|
|
3
3
|
import socketio from "@feathersjs/socketio-client";
|
|
4
4
|
import io from "socket.io-client";
|
|
5
|
-
import { authenticate as authenticateB3,
|
|
5
|
+
import { authenticate as authenticateB3, getB3ApiUrl, clientOptions } from "../app.shared.js";
|
|
6
6
|
// Global state to track which client type is active
|
|
7
7
|
let currentClientType = "rest";
|
|
8
8
|
let currentClient = null;
|
|
9
9
|
// Socket client instance
|
|
10
10
|
let socketClient = null;
|
|
11
11
|
let socketInstance = null;
|
|
12
|
+
let socketClientUrl = null;
|
|
12
13
|
// REST client instance
|
|
13
14
|
let restClient = null;
|
|
15
|
+
let restClientUrl = null;
|
|
16
|
+
// The pinned @b3dotfun/b3-api client's generated usersMethods predates `setBio`,
|
|
17
|
+
// so `users.setBio(...)` throws "setBio is not a function". Re-register the users
|
|
18
|
+
// service with the full list (mirrors users.shared.ts). Remove once the
|
|
19
|
+
// @b3dotfun/b3-api pin includes setBio.
|
|
20
|
+
const USERS_METHODS = [
|
|
21
|
+
"find",
|
|
22
|
+
"get",
|
|
23
|
+
"create",
|
|
24
|
+
"patch",
|
|
25
|
+
"remove",
|
|
26
|
+
"setReferralCode",
|
|
27
|
+
"syncTwProfiles",
|
|
28
|
+
"setAvatar",
|
|
29
|
+
"setBio",
|
|
30
|
+
"registerUsername",
|
|
31
|
+
"getMe",
|
|
32
|
+
];
|
|
33
|
+
// Re-register on every client the manager builds — the active transport
|
|
34
|
+
// (REST/socket) switches at runtime.
|
|
35
|
+
function ensureUsersCustomMethods(client) {
|
|
36
|
+
try {
|
|
37
|
+
const connection = client.get("connection");
|
|
38
|
+
if (connection?.service) {
|
|
39
|
+
client.use("users", connection.service("users"), { methods: USERS_METHODS });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Non-fatal: keep whatever methods the generated client already exposes.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
14
46
|
/**
|
|
15
47
|
* Creates a socket client
|
|
16
48
|
*/
|
|
17
49
|
function createSocketClient() {
|
|
18
|
-
|
|
19
|
-
|
|
50
|
+
const url = getB3ApiUrl();
|
|
51
|
+
if (!socketClient || socketClientUrl !== url) {
|
|
52
|
+
socketInstance = io(url, { transports: ["websocket"] });
|
|
20
53
|
socketClient = createClient(socketio(socketInstance), clientOptions);
|
|
54
|
+
ensureUsersCustomMethods(socketClient);
|
|
55
|
+
socketClientUrl = url;
|
|
21
56
|
}
|
|
22
57
|
return socketClient;
|
|
23
58
|
}
|
|
@@ -33,12 +68,23 @@ function resolveFetch() {
|
|
|
33
68
|
return require("cross-fetch").fetch;
|
|
34
69
|
}
|
|
35
70
|
function createRestClient() {
|
|
36
|
-
|
|
37
|
-
|
|
71
|
+
const url = getB3ApiUrl();
|
|
72
|
+
if (!restClient || restClientUrl !== url) {
|
|
73
|
+
const connection = rest(url).fetch(resolveFetch());
|
|
38
74
|
restClient = createClient(connection, clientOptions);
|
|
75
|
+
ensureUsersCustomMethods(restClient);
|
|
76
|
+
restClientUrl = url;
|
|
39
77
|
}
|
|
40
78
|
return restClient;
|
|
41
79
|
}
|
|
80
|
+
/** Reset all cached clients (called when API URL changes). */
|
|
81
|
+
export function resetClients() {
|
|
82
|
+
socketClient = null;
|
|
83
|
+
socketClientUrl = null;
|
|
84
|
+
restClient = null;
|
|
85
|
+
restClientUrl = null;
|
|
86
|
+
currentClient = null;
|
|
87
|
+
}
|
|
42
88
|
/**
|
|
43
89
|
* Sets the active client type and creates the appropriate client
|
|
44
90
|
*
|
|
@@ -6,13 +6,12 @@ import { validateImageUrl } from "../../../../global-account/react/utils/profile
|
|
|
6
6
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
7
7
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
8
8
|
import { getIpfsUrl } from "../../../../shared/utils/ipfs.js";
|
|
9
|
-
import {
|
|
9
|
+
import { uploadFile as uploadToB3 } from "../../../../shared/utils/upload.js";
|
|
10
10
|
import { Loader2, Upload, X } from "lucide-react";
|
|
11
11
|
import { useCallback, useRef, useState } from "react";
|
|
12
12
|
import Cropper from "react-easy-crop";
|
|
13
13
|
import "react-easy-crop/react-easy-crop.css";
|
|
14
14
|
import { useActiveAccount } from "thirdweb/react";
|
|
15
|
-
import { upload } from "thirdweb/storage";
|
|
16
15
|
import { useModalStore } from "../../stores/index.js";
|
|
17
16
|
import ModalHeader from "../ModalHeader/ModalHeader.js";
|
|
18
17
|
const debug = debugB3React("AvatarEditor");
|
|
@@ -195,18 +194,14 @@ export function AvatarEditor({ onSetAvatar, className }) {
|
|
|
195
194
|
return;
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
|
-
// Upload
|
|
197
|
+
// Upload file if we have one
|
|
199
198
|
if (fileToUpload) {
|
|
200
|
-
debug("Starting upload
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
client,
|
|
204
|
-
files: [fileToUpload],
|
|
205
|
-
});
|
|
206
|
-
debug("Upload successful", ipfsUrl);
|
|
199
|
+
debug("Starting upload", fileToUpload);
|
|
200
|
+
const avatarUrl = await uploadToB3(fileToUpload);
|
|
201
|
+
debug("Upload successful", avatarUrl);
|
|
207
202
|
// Save avatar URL using profiles service
|
|
208
203
|
const user = await app.service("users").setAvatar({
|
|
209
|
-
avatar:
|
|
204
|
+
avatar: avatarUrl,
|
|
210
205
|
},
|
|
211
206
|
// @ts-expect-error - our typed client is expecting context even though it's set elsewhere
|
|
212
207
|
{});
|
|
@@ -30,3 +30,14 @@ export declare function B3ConfigProvider({ children, accountOverride, environmen
|
|
|
30
30
|
authStrategy?: AuthStrategy;
|
|
31
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export declare function useB3Config(): B3ConfigContextType;
|
|
33
|
+
/**
|
|
34
|
+
* Overrides ONLY `partnerId` for a subtree, inheriting every other config value from the parent
|
|
35
|
+
* B3ConfigProvider. Lets a single route attribute its AnySpend orders/quotes to a different partner
|
|
36
|
+
* (e.g. `/b3os-deposit` → the b3os partner) without standing up a second B3Provider — the config
|
|
37
|
+
* context is separate from the wallet/modal machinery, so nothing re-initializes. Must be rendered
|
|
38
|
+
* inside an existing B3ConfigProvider.
|
|
39
|
+
*/
|
|
40
|
+
export declare function B3ConfigPartnerOverride({ partnerId, children }: {
|
|
41
|
+
partnerId: string;
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -31,3 +31,14 @@ export function useB3Config() {
|
|
|
31
31
|
}
|
|
32
32
|
return context;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Overrides ONLY `partnerId` for a subtree, inheriting every other config value from the parent
|
|
36
|
+
* B3ConfigProvider. Lets a single route attribute its AnySpend orders/quotes to a different partner
|
|
37
|
+
* (e.g. `/b3os-deposit` → the b3os partner) without standing up a second B3Provider — the config
|
|
38
|
+
* context is separate from the wallet/modal machinery, so nothing re-initializes. Must be rendered
|
|
39
|
+
* inside an existing B3ConfigProvider.
|
|
40
|
+
*/
|
|
41
|
+
export function B3ConfigPartnerOverride({ partnerId, children }) {
|
|
42
|
+
const parent = useB3Config();
|
|
43
|
+
return _jsx(B3ConfigContext.Provider, { value: { ...parent, partnerId }, children: children });
|
|
44
|
+
}
|
|
@@ -10,7 +10,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
10
10
|
/**
|
|
11
11
|
* Main B3Provider component
|
|
12
12
|
*/
|
|
13
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider,
|
|
13
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication, queryClient, authStrategy, apiUrl, notificationsApiUrl, }: {
|
|
14
14
|
theme: "light" | "dark";
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
accountOverride?: Account;
|
|
@@ -18,7 +18,6 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
18
18
|
automaticallySetFirstEoa?: boolean;
|
|
19
19
|
/** EIP-1193 provider to auto-connect as the default EOA wallet (e.g., Farcaster frame wallet) */
|
|
20
20
|
defaultEoaProvider?: EIP1193.EIP1193Provider;
|
|
21
|
-
simDuneApiKey?: string;
|
|
22
21
|
toaster?: {
|
|
23
22
|
position?: "top-center" | "top-right" | "bottom-center" | "bottom-right";
|
|
24
23
|
style?: React.CSSProperties;
|
|
@@ -39,4 +38,15 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
39
38
|
queryClient?: QueryClient;
|
|
40
39
|
/** Auth strategy: "thirdweb" (default, ecosystem wallet) or "better-auth" (email/password via Better Auth) */
|
|
41
40
|
authStrategy?: AuthStrategy;
|
|
41
|
+
/**
|
|
42
|
+
* Override the B3 API URL. When provided, all SDK requests (auth, Feathers,
|
|
43
|
+
* BetterAuth) will use this URL instead of the `NEXT_PUBLIC_B3_API` env var.
|
|
44
|
+
*
|
|
45
|
+
* Useful for local development: pass `http://localhost:3031` to route
|
|
46
|
+
* OAuth callbacks and session checks through your local B3 API.
|
|
47
|
+
* If omitted, defaults to `NEXT_PUBLIC_B3_API` or `https://api.b3.fun`.
|
|
48
|
+
*/
|
|
49
|
+
apiUrl?: string;
|
|
50
|
+
/** Override the notifications worker URL. Defaults to `https://notifications.b3.fun`. */
|
|
51
|
+
notificationsApiUrl?: string;
|
|
42
52
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,19 +5,41 @@ import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
|
5
5
|
import { WalletProvider } from "../../../../wallet/react/index.js";
|
|
6
6
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
7
7
|
import { useEffect, useMemo } from "react";
|
|
8
|
-
import { setClientType } from "../../../client-manager.js";
|
|
8
|
+
import { resetClients, setClientType } from "../../../client-manager.js";
|
|
9
|
+
import { setB3ApiUrl } from "../../../../app.shared.js";
|
|
10
|
+
import { setApiUrl as setNotificationsApiUrl } from "../../../../notifications/services/api.js";
|
|
11
|
+
import { resetBetterAuthClient } from "../../../better-auth-client.js";
|
|
9
12
|
import { StyleRoot } from "../StyleRoot.js";
|
|
10
13
|
import { setToastContext, ToastProvider, useToastContext } from "../Toast/index.js";
|
|
11
14
|
import AuthenticationProvider from "./AuthenticationProvider.js";
|
|
12
15
|
import { B3ConfigProvider } from "./B3ConfigProvider.js";
|
|
13
16
|
import BetterAuthProvider from "./BetterAuthProvider.js";
|
|
14
17
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
18
|
+
const NOTIFICATIONS_URL_BY_ENV = {
|
|
19
|
+
development: "https://dev-notifications.b3.fun",
|
|
20
|
+
production: "https://notifications.b3.fun",
|
|
21
|
+
};
|
|
15
22
|
/**
|
|
16
23
|
* Main B3Provider component
|
|
17
24
|
*/
|
|
18
|
-
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider,
|
|
25
|
+
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, defaultEoaProvider,
|
|
19
26
|
// deprecated since v0.0.87
|
|
20
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication = false, queryClient, authStrategy = "thirdweb", }) {
|
|
27
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, disableBSMNTAuthentication = false, queryClient, authStrategy = "thirdweb", apiUrl, notificationsApiUrl, }) {
|
|
28
|
+
// Override the B3 API URL when the `apiUrl` prop is provided.
|
|
29
|
+
// Must run before client initialization and auth providers mount.
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setB3ApiUrl(apiUrl ?? null);
|
|
32
|
+
if (apiUrl) {
|
|
33
|
+
resetBetterAuthClient();
|
|
34
|
+
resetClients();
|
|
35
|
+
}
|
|
36
|
+
return () => {
|
|
37
|
+
setB3ApiUrl(null);
|
|
38
|
+
};
|
|
39
|
+
}, [apiUrl]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
setNotificationsApiUrl(notificationsApiUrl ?? NOTIFICATIONS_URL_BY_ENV[environment ?? "production"]);
|
|
42
|
+
}, [notificationsApiUrl, environment]);
|
|
21
43
|
// Initialize Google Analytics on mount
|
|
22
44
|
useEffect(() => {
|
|
23
45
|
loadGA4Script();
|
|
@@ -27,7 +49,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
27
49
|
setClientType(clientType);
|
|
28
50
|
}, [clientType]);
|
|
29
51
|
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
30
|
-
return (_jsx(WalletProvider, { wagmiConfig: wagmiConfig, queryClient: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, disableBSMNTAuthentication: disableBSMNTAuthentication, children: _jsxs(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, authStrategy: authStrategy, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, {
|
|
52
|
+
return (_jsx(WalletProvider, { wagmiConfig: wagmiConfig, queryClient: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, disableBSMNTAuthentication: disableBSMNTAuthentication, children: _jsxs(B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, authStrategy: authStrategy, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { children: [children, _jsx(StyleRoot, { id: "b3-root" })] }), authStrategy === "better-auth" ? (_jsx(BetterAuthProvider, { partnerId: partnerId })) : (_jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa, defaultEoaProvider: defaultEoaProvider }))] }) }) }) }) }));
|
|
31
53
|
}
|
|
32
54
|
/**
|
|
33
55
|
* Component to connect the toast context to the global toast API
|
|
@@ -4,7 +4,7 @@ import { B3_AUTH_COOKIE_NAME } from "../../../../shared/constants/index.js";
|
|
|
4
4
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
5
5
|
import Cookies from "js-cookie";
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { getBetterAuthClient } from "../../../better-auth-client.js";
|
|
8
8
|
import { useUserQuery } from "../../hooks/useUserQuery.js";
|
|
9
9
|
const debug = debugB3React("BetterAuthProvider");
|
|
10
10
|
/**
|
|
@@ -40,7 +40,7 @@ const BetterAuthProvider = ({ partnerId }) => {
|
|
|
40
40
|
app.logout = async () => {
|
|
41
41
|
debug("Patched logout: clearing Better Auth session");
|
|
42
42
|
try {
|
|
43
|
-
await
|
|
43
|
+
await getBetterAuthClient().signOut();
|
|
44
44
|
}
|
|
45
45
|
catch {
|
|
46
46
|
debug("Better Auth signOut failed (non-critical)");
|
|
@@ -74,9 +74,50 @@ const BetterAuthProvider = ({ partnerId }) => {
|
|
|
74
74
|
catch {
|
|
75
75
|
debug("No existing Feathers JWT");
|
|
76
76
|
}
|
|
77
|
-
// 2. Check for
|
|
77
|
+
// 2. Check for _ba_token in URL (OAuth callback with third-party cookie bypass).
|
|
78
|
+
// When the API and frontend are on different domains, browsers with third-party
|
|
79
|
+
// cookie blocking (Firefox TCP, Safari ITP, Chrome Privacy Sandbox) prevent the
|
|
80
|
+
// better-auth.session_token cookie from being sent on cross-origin requests.
|
|
81
|
+
// The B3 API injects the session token into the redirect URL as _ba_token,
|
|
82
|
+
// allowing direct exchange without relying on cookies.
|
|
83
|
+
const params = new URLSearchParams(window.location.search);
|
|
84
|
+
const baToken = params.get("_ba_token");
|
|
85
|
+
if (baToken) {
|
|
86
|
+
debug("Found _ba_token in URL, exchanging for Feathers JWT");
|
|
87
|
+
// Clean the token from the URL immediately (security)
|
|
88
|
+
params.delete("_ba_token");
|
|
89
|
+
const cleanSearch = params.toString();
|
|
90
|
+
const cleanUrl = window.location.pathname + (cleanSearch ? `?${cleanSearch}` : "") + window.location.hash;
|
|
91
|
+
window.history.replaceState({}, "", cleanUrl);
|
|
92
|
+
try {
|
|
93
|
+
const response = await app.authenticate({
|
|
94
|
+
strategy: "better-auth",
|
|
95
|
+
accessToken: baToken,
|
|
96
|
+
partnerId,
|
|
97
|
+
});
|
|
98
|
+
if (response.accessToken) {
|
|
99
|
+
Cookies.set(B3_AUTH_COOKIE_NAME, response.accessToken, {
|
|
100
|
+
secure: true,
|
|
101
|
+
sameSite: "Lax",
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (response.user) {
|
|
105
|
+
setUser(response.user);
|
|
106
|
+
setIsAuthenticated(true);
|
|
107
|
+
setIsConnected(true);
|
|
108
|
+
}
|
|
109
|
+
debug("_ba_token exchanged for Feathers JWT", { userId: response.user?.userId });
|
|
110
|
+
setIsAuthenticating(false);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
debug("_ba_token exchange failed", err);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// 3. Check for a Better Auth session via cookie (works when API and frontend
|
|
118
|
+
// share a domain or when cookies aren't partitioned)
|
|
78
119
|
try {
|
|
79
|
-
const session = await
|
|
120
|
+
const session = await getBetterAuthClient().getSession();
|
|
80
121
|
if (session.data?.session?.token) {
|
|
81
122
|
debug("Better Auth session found, exchanging for Feathers JWT", {
|
|
82
123
|
betterAuthUserId: session.data.user?.id,
|
|
@@ -105,7 +146,7 @@ const BetterAuthProvider = ({ partnerId }) => {
|
|
|
105
146
|
catch {
|
|
106
147
|
debug("No Better Auth session to restore");
|
|
107
148
|
}
|
|
108
|
-
//
|
|
149
|
+
// 4. Nothing found — show login UI
|
|
109
150
|
setIsAuthenticating(false);
|
|
110
151
|
};
|
|
111
152
|
restoreSession();
|
|
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { RelayKitProvider } from "@relayprotocol/relay-kit-ui";
|
|
3
3
|
import { fetchChainConfigs, MAINNET_RELAY_API } from "@relayprotocol/relay-sdk";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
|
-
export function RelayKitProviderWrapper({ children
|
|
5
|
+
export function RelayKitProviderWrapper({ children }) {
|
|
6
6
|
const [relayChains, setRelayChains] = useState([]);
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
const fetchChains = async () => {
|
|
@@ -11,16 +11,22 @@ export function RelayKitProviderWrapper({ children, simDuneApiKey, }) {
|
|
|
11
11
|
};
|
|
12
12
|
fetchChains();
|
|
13
13
|
}, []);
|
|
14
|
+
// Balances for Relay's token selector come from the b3-zerion-api Zerion proxy, not Relay's own Dune
|
|
15
|
+
// integration. Relay only fires the balance query when duneConfig.apiKey is set, so apiBaseUrl points
|
|
16
|
+
// it at our proxy; the proxy ignores the client-sent key and holds the real Zerion credential itself.
|
|
14
17
|
return (_jsx(RelayKitProvider, { options: {
|
|
15
18
|
baseApiUrl: MAINNET_RELAY_API,
|
|
16
19
|
source: "anyspend",
|
|
17
|
-
duneConfig: {
|
|
18
|
-
apiKey: simDuneApiKey,
|
|
19
|
-
apiBaseUrl: "https://api.sim.dune.com",
|
|
20
|
-
},
|
|
21
20
|
chains: relayChains,
|
|
22
21
|
privateChainIds: undefined,
|
|
23
22
|
appName: "AnySpend",
|
|
24
23
|
useGasFeeEstimations: true,
|
|
24
|
+
duneConfig: {
|
|
25
|
+
// Non-secret placeholder. Relay only fires its balance query when apiKey is defined; the value is sent
|
|
26
|
+
// as X-Sim-Api-Key to our proxy, which ignores it. The real Zerion key stays server-side in b3-zerion-api.
|
|
27
|
+
apiKey: "proxied-via-portfolio-api",
|
|
28
|
+
// Relay appends /v1/evm/balances/{address}. Our b3-zerion-api worker serves that route, backed by Zerion.
|
|
29
|
+
apiBaseUrl: "https://portfolio-api.b3.fun",
|
|
30
|
+
},
|
|
25
31
|
}, children: _jsx(_Fragment, { children: children }) }));
|
|
26
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ALL_CHAINS, getExplorerTxUrl } from "../../../../anyspend/index.js";
|
|
3
3
|
import { ChainTokenIcon } from "../../../../anyspend/react/components/common/ChainTokenIcon.js";
|
|
4
|
-
import { Button, toast, TransitionPanel, useAnalytics,
|
|
4
|
+
import { Button, toast, TransitionPanel, useAnalytics, usePortfolioBalance, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { formatDisplayNumber, formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
6
6
|
import invariant from "invariant";
|
|
7
7
|
import { ArrowLeft, CircleHelp, Copy, Loader2, Send } from "lucide-react";
|
|
@@ -41,7 +41,7 @@ export function ContentTokens({ activeTab }) {
|
|
|
41
41
|
const animationDirection = useRef(null);
|
|
42
42
|
// === DATA FETCHING ===
|
|
43
43
|
const account = useActiveAccount();
|
|
44
|
-
const { data:
|
|
44
|
+
const { data: balances, refetch: refetchBalances, isLoading: isLoadingBalance, isError: isBalanceError, } = usePortfolioBalance(account?.address);
|
|
45
45
|
// === BLOCKCHAIN INTERACTION ===
|
|
46
46
|
const { switchChainAndExecute } = useUnifiedChainSwitchAndExecute();
|
|
47
47
|
// === ANALYTICS ===
|
|
@@ -75,13 +75,13 @@ export function ContentTokens({ activeTab }) {
|
|
|
75
75
|
// === HELPER FUNCTION ===
|
|
76
76
|
// Get current version of selected token from fresh balance data
|
|
77
77
|
// 🔧 FIX: Prevents auto-navigation back to token list when balance refreshes
|
|
78
|
-
// The
|
|
78
|
+
// The balance hook refreshes data, creating new token object references
|
|
79
79
|
// This helper ensures we always get the fresh token data instead of stale references
|
|
80
80
|
const getCurrentSelectedToken = () => {
|
|
81
|
-
if (!selectedToken || !
|
|
81
|
+
if (!selectedToken || !balances) {
|
|
82
82
|
return null;
|
|
83
83
|
}
|
|
84
|
-
const found =
|
|
84
|
+
const found = balances.find(token => token.chain_id === selectedToken.chain_id && token.address === selectedToken.address);
|
|
85
85
|
return found || null;
|
|
86
86
|
};
|
|
87
87
|
// ==================================================================================
|
|
@@ -147,11 +147,13 @@ export function ContentTokens({ activeTab }) {
|
|
|
147
147
|
functionName: "transfer",
|
|
148
148
|
args: [recipientAddress, amountInWei],
|
|
149
149
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
// A native send carries value and no calldata; an ERC-20 send carries calldata and no
|
|
151
|
+
// value. Branch on the explicit flag, never on the address: the native sentinel is a
|
|
152
|
+
// display detail, and taking the ERC-20 path for a native coin spends gas without moving
|
|
153
|
+
// anything.
|
|
154
|
+
const tx = await switchChainAndExecute(displayToken.chain_id, displayToken.is_native
|
|
155
|
+
? { to: recipientAddress, value: amountInWei }
|
|
156
|
+
: { to: displayToken.address, data: sendTokenData, value: BigInt(0) });
|
|
155
157
|
if (tx) {
|
|
156
158
|
// Track successful send
|
|
157
159
|
sendAnalyticsEvent("send_token_button_click", {
|
|
@@ -177,7 +179,7 @@ export function ContentTokens({ activeTab }) {
|
|
|
177
179
|
// Wait 1 second to make sure the tx is indexed on sim api.
|
|
178
180
|
setTimeout(async () => {
|
|
179
181
|
// Force refetch to bypass cache and get fresh balance data
|
|
180
|
-
await
|
|
182
|
+
await refetchBalances();
|
|
181
183
|
}, 1000);
|
|
182
184
|
setIsSending(false);
|
|
183
185
|
}
|
|
@@ -211,21 +213,27 @@ export function ContentTokens({ activeTab }) {
|
|
|
211
213
|
if (isLoadingBalance) {
|
|
212
214
|
return _jsx(LoadingIndicator, {});
|
|
213
215
|
}
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
+
// A wallet IS connected here — only the read failed. Prompting the user to connect would send
|
|
217
|
+
// them to fix something that is not broken.
|
|
218
|
+
// `isBalanceError` as well as the absent list: after a first success a later refetch failure
|
|
219
|
+
// keeps `data` populated, so `!balances` alone would show stale numbers as if they were fresh.
|
|
220
|
+
if (account?.address && (isBalanceError || !balances)) {
|
|
221
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [_jsx("div", { className: "bg-b3-line/50 mb-4 rounded-full p-4", children: _jsx(Loader2, { className: "text-b3-foreground-muted h-8 w-8" }) }), _jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold mb-2", children: "Couldn't load your tokens" }), _jsx("button", { onClick: () => refetchBalances(), className: "text-b3-foreground-muted font-neue-montreal-medium text-sm underline", children: "Try again" })] }));
|
|
222
|
+
}
|
|
223
|
+
if (!account?.address) {
|
|
216
224
|
return (_jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [_jsx("div", { className: "bg-b3-line/50 mb-4 rounded-full p-4", children: _jsx(Loader2, { className: "text-b3-foreground-muted h-8 w-8" }) }), _jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold mb-2", children: "No wallet connected" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Connect your wallet to view token balances" })] }));
|
|
217
225
|
}
|
|
218
226
|
// === SMART FILTERING LOGIC ===
|
|
219
227
|
// Filter tokens with value >= $1 to reduce noise from dust tokens
|
|
220
|
-
const filteredTokens =
|
|
228
|
+
const filteredTokens = balances?.filter(token => token.value_usd !== undefined && token.value_usd >= 1) || [];
|
|
221
229
|
// 🧠 INTELLIGENT DISPLAY LOGIC:
|
|
222
230
|
// Show all tokens automatically when filtering would be unhelpful:
|
|
223
231
|
// 1. User explicitly requested to show all, OR
|
|
224
232
|
// 2. No tokens with value >= $1 (user has only dust), OR
|
|
225
233
|
// 3. 5 or fewer tokens with value >= $1 (not enough to warrant filtering)
|
|
226
234
|
const shouldShowAllTokens = showAllTokens || filteredTokens.length === 0 || filteredTokens.length <= 5;
|
|
227
|
-
const tokensToShow = shouldShowAllTokens ?
|
|
228
|
-
const hasHiddenTokens = !shouldShowAllTokens && (
|
|
235
|
+
const tokensToShow = shouldShowAllTokens ? balances || [] : filteredTokens;
|
|
236
|
+
const hasHiddenTokens = !shouldShowAllTokens && (balances?.length || 0) > filteredTokens.length;
|
|
229
237
|
// Handle token selection and navigate to send form
|
|
230
238
|
const handleTokenClick = (token) => {
|
|
231
239
|
setSelectedToken(token);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useActiveWallet } from "thirdweb/react";
|
|
3
3
|
import { AccountAssets } from "..";
|
|
4
|
-
import {
|
|
4
|
+
import { usePortfolioCollectibles } from "../../hooks/index.js";
|
|
5
5
|
const NFTContent = () => {
|
|
6
6
|
// Get active wallet state
|
|
7
7
|
const activeWallet = useActiveWallet();
|
|
8
8
|
const activeAccount = activeWallet?.getAccount();
|
|
9
9
|
const activeAddress = activeAccount?.address;
|
|
10
|
-
const { data: nfts, isLoading } =
|
|
11
|
-
return (_jsx("div", { style: { minHeight: "100px" }, children: nfts ? (_jsx(AccountAssets, { nfts: nfts, isLoading: isLoading })) : (_jsx("div", { className: "py-12 text-center text-gray-500", children: "No NFTs found" })) }));
|
|
10
|
+
const { data: nfts, isLoading, isError } = usePortfolioCollectibles(activeAddress, [1, 8453], { filterSpam: true });
|
|
11
|
+
return (_jsx("div", { style: { minHeight: "100px" }, children: isError ? (_jsx("div", { className: "py-12 text-center text-gray-500", children: "Couldn't load your NFTs" })) : nfts ? (_jsx(AccountAssets, { nfts: nfts, isLoading: isLoading })) : (_jsx("div", { className: "py-12 text-center text-gray-500", children: "No NFTs found" })) }));
|
|
12
12
|
};
|
|
13
13
|
export default NFTContent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAccountWallet, useB3Config, useModalStore, useProfile,
|
|
2
|
+
import { useAccountWallet, useB3Config, useModalStore, useProfile, usePortfolioBalance, useUser, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
4
4
|
import { AVATAR_COLORS } from "../../../../shared/constants/index.js";
|
|
5
5
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
@@ -24,14 +24,16 @@ const ProfileSection = () => {
|
|
|
24
24
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
25
25
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
26
26
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
27
|
-
const { data:
|
|
27
|
+
const { data: balances, isError: isBalanceError } = usePortfolioBalance(smartWalletAddress);
|
|
28
28
|
const [imgError, setImgError] = useState(false);
|
|
29
29
|
const handleImgError = useCallback(() => setImgError(true), []);
|
|
30
|
+
// Null while the holdings are unknown. Summing an absent list to $0.00 would report an empty
|
|
31
|
+
// portfolio to someone whose balances merely failed to load.
|
|
30
32
|
const totalBalanceUsd = useMemo(() => {
|
|
31
|
-
if (!
|
|
32
|
-
return
|
|
33
|
-
return
|
|
34
|
-
}, [
|
|
33
|
+
if (isBalanceError || !balances)
|
|
34
|
+
return null;
|
|
35
|
+
return balances.reduce((sum, token) => sum + (token.value_usd || 0), 0);
|
|
36
|
+
}, [balances, isBalanceError]);
|
|
35
37
|
const handleEditAvatar = () => {
|
|
36
38
|
setB3ModalOpen(true);
|
|
37
39
|
setB3ModalContentType({
|
|
@@ -48,6 +50,6 @@ const ProfileSection = () => {
|
|
|
48
50
|
}, [avatarSrc]);
|
|
49
51
|
const currentUsername = user?.username || profile?.displayName || formatUsername(profile?.name || "");
|
|
50
52
|
const avatarSeed = eoaAddress || account?.address || smartWalletAddress || currentUsername || user?.email || "user";
|
|
51
|
-
return (_jsx("div", { className: "flex items-center justify-between px-5 py-6", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [_jsx("div", { className: "border-b3-line border-1 bg-b3-primary-wash size-14 overflow-hidden rounded-full border", children: avatarSrc && !imgError ? (_jsx(IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "h-full w-full object-cover", onError: handleImgError })) : (_jsx(Avatar, { name: avatarSeed, variant: "beam", size: 56, colors: AVATAR_COLORS })) }), _jsx("button", { onClick: handleEditAvatar, className: "border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-6 items-center justify-center rounded-full border-4 bg-[#a0a0ab] transition-colors", children: _jsx(Pencil, { size: 10, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info flex flex-col gap-1", children: [!isBetterAuth && (_jsxs("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [_jsx("div", { className: "text-b3-foreground-muted", children: " $" }), _jsx("div", { className: "text-[30px]", children: formatDisplayNumber(totalBalanceUsd, { fractionDigits: 2 }) })] })), _jsx("div", { className: "b3-modal-username font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername }), isBetterAuth && user?.email && (_jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: user.email }))] })] }) }));
|
|
53
|
+
return (_jsx("div", { className: "flex items-center justify-between px-5 py-6", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [_jsx("div", { className: "border-b3-line border-1 bg-b3-primary-wash size-14 overflow-hidden rounded-full border", children: avatarSrc && !imgError ? (_jsx(IPFSMediaRenderer, { src: avatarSrc, alt: "Profile Avatar", className: "h-full w-full object-cover", onError: handleImgError })) : (_jsx(Avatar, { name: avatarSeed, variant: "beam", size: 56, colors: AVATAR_COLORS })) }), _jsx("button", { onClick: handleEditAvatar, className: "border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-6 items-center justify-center rounded-full border-4 bg-[#a0a0ab] transition-colors", children: _jsx(Pencil, { size: 10, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info flex flex-col gap-1", children: [!isBetterAuth && (_jsxs("h2", { className: "text-b3-grey font-neue-montreal-semibold flex h-[38px] items-center gap-1 text-xl", children: [_jsx("div", { className: "text-b3-foreground-muted", children: " $" }), _jsx("div", { className: "text-[30px]", children: totalBalanceUsd === null ? "—" : formatDisplayNumber(totalBalanceUsd, { fractionDigits: 2 }) })] })), _jsx("div", { className: "b3-modal-username font-neue-montreal-semibold text-base leading-none text-[#0B57C2]", children: currentUsername }), isBetterAuth && user?.email && (_jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: user.email }))] })] }) }));
|
|
52
54
|
};
|
|
53
55
|
export default ProfileSection;
|