@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
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { NFT, SimpleHashNFTResponse } from "@b3dotfun/sdk/global-account/types/simplehash.types";
|
|
2
|
+
import { zerionSlugToChainId } from "@b3dotfun/sdk/shared/utils/zerionPositions";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
|
|
5
|
+
const PORTFOLIO_API_BASE_URL = "https://portfolio-api.b3.fun";
|
|
6
|
+
|
|
7
|
+
interface ZerionNftPosition {
|
|
8
|
+
id?: string;
|
|
9
|
+
attributes?: {
|
|
10
|
+
amount?: string;
|
|
11
|
+
changed_at?: string;
|
|
12
|
+
nft_info?: {
|
|
13
|
+
contract_address?: string;
|
|
14
|
+
token_id?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
interface?: string;
|
|
17
|
+
content?: { preview?: { url?: string }; detail?: { url?: string } };
|
|
18
|
+
flags?: { is_spam?: boolean };
|
|
19
|
+
};
|
|
20
|
+
collection_info?: {
|
|
21
|
+
name?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
content?: { icon?: { url?: string } };
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
relationships?: { chain?: { data?: { id?: string } } };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ZerionNftPositionsResponse {
|
|
30
|
+
data?: ZerionNftPosition[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Caps an ERC-1155 balance string at MAX_SAFE_INTEGER so a huge supply cannot overflow. */
|
|
34
|
+
function safeParseBalance(balance: string | undefined): number {
|
|
35
|
+
if (!balance) return 1;
|
|
36
|
+
const parsed = parseInt(balance, 10);
|
|
37
|
+
if (Number.isNaN(parsed)) return 1;
|
|
38
|
+
return Math.min(parsed, Number.MAX_SAFE_INTEGER);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Reshape one Zerion NFT position into the SimpleHash record `AccountAssets` renders.
|
|
43
|
+
*
|
|
44
|
+
* Fields Zerion does not carry — traits, rarity, royalties, sale history — stay empty rather than
|
|
45
|
+
* being synthesised from something adjacent. In particular the position's `price` is a current
|
|
46
|
+
* estimate, not a sale, so it must not be written into `last_sale`.
|
|
47
|
+
*/
|
|
48
|
+
function toSimpleHashNft(position: ZerionNftPosition, ownerAddress: string): NFT | null {
|
|
49
|
+
const attributes = position.attributes ?? {};
|
|
50
|
+
const nftInfo = attributes.nft_info;
|
|
51
|
+
const slug = position.relationships?.chain?.data?.id;
|
|
52
|
+
if (!nftInfo?.contract_address || !nftInfo.token_id || !slug) return null;
|
|
53
|
+
|
|
54
|
+
const imageUrl = nftInfo.content?.detail?.url ?? nftInfo.content?.preview?.url ?? "";
|
|
55
|
+
const collectionInfo = attributes.collection_info ?? {};
|
|
56
|
+
const acquiredAt = attributes.changed_at ?? "";
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
nft_id: `${slug}.${nftInfo.contract_address}.${nftInfo.token_id}`,
|
|
60
|
+
chain: slug,
|
|
61
|
+
contract_address: nftInfo.contract_address,
|
|
62
|
+
token_id: nftInfo.token_id,
|
|
63
|
+
name: nftInfo.name || "",
|
|
64
|
+
description: collectionInfo.description || "",
|
|
65
|
+
previews: {
|
|
66
|
+
image_small_url: nftInfo.content?.preview?.url ?? imageUrl,
|
|
67
|
+
image_medium_url: imageUrl,
|
|
68
|
+
image_large_url: imageUrl,
|
|
69
|
+
image_opengraph_url: imageUrl,
|
|
70
|
+
blurhash: "",
|
|
71
|
+
predominant_color: "",
|
|
72
|
+
},
|
|
73
|
+
image_url: imageUrl,
|
|
74
|
+
image_properties: { width: 0, height: 0, size: 0, mime_type: "", exif_orientation: null },
|
|
75
|
+
video_url: null,
|
|
76
|
+
video_properties: null,
|
|
77
|
+
audio_url: null,
|
|
78
|
+
audio_properties: null,
|
|
79
|
+
model_url: null,
|
|
80
|
+
model_properties: null,
|
|
81
|
+
other_url: null,
|
|
82
|
+
other_properties: null,
|
|
83
|
+
background_color: null,
|
|
84
|
+
external_url: null,
|
|
85
|
+
created_date: "",
|
|
86
|
+
status: "minted",
|
|
87
|
+
token_count: 1,
|
|
88
|
+
owner_count: 1,
|
|
89
|
+
owners: [
|
|
90
|
+
{
|
|
91
|
+
owner_address: ownerAddress,
|
|
92
|
+
quantity: safeParseBalance(attributes.amount),
|
|
93
|
+
quantity_string: attributes.amount || "1",
|
|
94
|
+
first_acquired_date: acquiredAt,
|
|
95
|
+
last_acquired_date: acquiredAt,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
contract: {
|
|
99
|
+
type: nftInfo.interface === "ERC1155" ? "ERC1155" : "ERC721",
|
|
100
|
+
name: collectionInfo.name || "",
|
|
101
|
+
symbol: null,
|
|
102
|
+
deployed_by: "",
|
|
103
|
+
deployed_via_contract: "",
|
|
104
|
+
owned_by: "",
|
|
105
|
+
has_multiple_collections: false,
|
|
106
|
+
},
|
|
107
|
+
collection: {
|
|
108
|
+
collection_id: nftInfo.contract_address,
|
|
109
|
+
name: collectionInfo.name || "Unknown Collection",
|
|
110
|
+
description: collectionInfo.description ?? null,
|
|
111
|
+
image_url: collectionInfo.content?.icon?.url ?? "",
|
|
112
|
+
image_properties: { width: 0, height: 0, mime_type: "" },
|
|
113
|
+
banner_image_url: null,
|
|
114
|
+
category: null,
|
|
115
|
+
is_nsfw: null,
|
|
116
|
+
external_url: null,
|
|
117
|
+
twitter_username: null,
|
|
118
|
+
discord_url: null,
|
|
119
|
+
instagram_username: null,
|
|
120
|
+
medium_username: null,
|
|
121
|
+
telegram_url: null,
|
|
122
|
+
marketplace_pages: [],
|
|
123
|
+
metaplex_mint: null,
|
|
124
|
+
metaplex_candy_machine: null,
|
|
125
|
+
metaplex_first_verified_creator: null,
|
|
126
|
+
floor_prices: [],
|
|
127
|
+
top_bids: [],
|
|
128
|
+
distinct_owner_count: 0,
|
|
129
|
+
distinct_nft_count: 0,
|
|
130
|
+
total_quantity: 0,
|
|
131
|
+
chains: [slug],
|
|
132
|
+
top_contracts: [nftInfo.contract_address],
|
|
133
|
+
collection_royalties: [],
|
|
134
|
+
},
|
|
135
|
+
last_sale: null,
|
|
136
|
+
primary_sale: null,
|
|
137
|
+
first_created: {
|
|
138
|
+
minted_to: ownerAddress,
|
|
139
|
+
quantity: 1,
|
|
140
|
+
quantity_string: "1",
|
|
141
|
+
timestamp: "",
|
|
142
|
+
block_number: 0,
|
|
143
|
+
transaction: "",
|
|
144
|
+
transaction_initiator: "",
|
|
145
|
+
},
|
|
146
|
+
rarity: { rank: null, score: null, unique_attributes: null },
|
|
147
|
+
royalty: [],
|
|
148
|
+
extra_metadata: {
|
|
149
|
+
attributes: [],
|
|
150
|
+
image_original_url: imageUrl,
|
|
151
|
+
animation_original_url: null,
|
|
152
|
+
metadata_original_url: "",
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* NFTs held by a wallet, in the SimpleHash shape `AccountAssets` already renders.
|
|
159
|
+
*
|
|
160
|
+
* Chain narrowing happens here rather than in the request: the upstream rejects some valid chain
|
|
161
|
+
* slugs outright and fails the whole request when one is present, so asking for a subset can cost
|
|
162
|
+
* you the whole answer.
|
|
163
|
+
*/
|
|
164
|
+
export function usePortfolioCollectibles(
|
|
165
|
+
address?: string,
|
|
166
|
+
chainIds?: number[],
|
|
167
|
+
options?: { limit?: number; filterSpam?: boolean },
|
|
168
|
+
) {
|
|
169
|
+
const limit = options?.limit;
|
|
170
|
+
const filterSpam = options?.filterSpam;
|
|
171
|
+
const wantedChainIds = chainIds && chainIds.length > 0 ? chainIds : undefined;
|
|
172
|
+
|
|
173
|
+
return useQuery({
|
|
174
|
+
queryKey: ["walletCollectibles", address, limit, filterSpam],
|
|
175
|
+
queryFn: async (): Promise<SimpleHashNFTResponse> => {
|
|
176
|
+
if (!address) throw new Error("Address is required");
|
|
177
|
+
|
|
178
|
+
const params = new URLSearchParams();
|
|
179
|
+
if (limit) params.set("page[size]", String(limit));
|
|
180
|
+
const query = params.toString();
|
|
181
|
+
const url = `${PORTFOLIO_API_BASE_URL}/v1/wallets/${encodeURIComponent(address)}/nft-positions/${query ? `?${query}` : ""}`;
|
|
182
|
+
|
|
183
|
+
const response = await fetch(url, { headers: { Accept: "application/json" } });
|
|
184
|
+
if (!response.ok) {
|
|
185
|
+
throw new Error(`Failed to fetch collectibles: ${response.status} ${response.statusText}`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const body = (await response.json()) as ZerionNftPositionsResponse;
|
|
189
|
+
// Spam is dropped here, not in `select`: the flag lives on the raw position and the
|
|
190
|
+
// SimpleHash shape has nowhere to carry it downstream.
|
|
191
|
+
const nfts = (body.data ?? [])
|
|
192
|
+
.filter(position => !(filterSpam && position.attributes?.nft_info?.flags?.is_spam === true))
|
|
193
|
+
.map(position => toSimpleHashNft(position, address))
|
|
194
|
+
.filter((nft): nft is NFT => nft !== null);
|
|
195
|
+
|
|
196
|
+
return { next_cursor: null, next: null, previous: null, nfts };
|
|
197
|
+
},
|
|
198
|
+
enabled: Boolean(address),
|
|
199
|
+
staleTime: 30 * 1000,
|
|
200
|
+
gcTime: 5 * 60 * 1000,
|
|
201
|
+
select: (data: SimpleHashNFTResponse) => {
|
|
202
|
+
if (!wantedChainIds) return data;
|
|
203
|
+
|
|
204
|
+
const all = data.nfts ?? [];
|
|
205
|
+
const nfts = all.filter(nft => {
|
|
206
|
+
const chainId = zerionSlugToChainId(nft.chain);
|
|
207
|
+
return chainId !== undefined && wantedChainIds.includes(chainId);
|
|
208
|
+
});
|
|
209
|
+
return nfts.length === all.length ? data : { ...data, nfts };
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
}
|
|
@@ -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,7 +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 {
|
|
12
|
+
import { useB3Config } from "../components/B3Provider/B3ConfigProvider";
|
|
13
13
|
import { useAccountWallet } from "./useAccountWallet";
|
|
14
14
|
|
|
15
15
|
export interface UnifiedTransactionParams {
|
|
@@ -18,20 +18,14 @@ export interface UnifiedTransactionParams {
|
|
|
18
18
|
value: bigint;
|
|
19
19
|
}
|
|
20
20
|
|
|
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
21
|
export function useUnifiedChainSwitchAndExecute() {
|
|
30
22
|
const { switchChainAsync } = useSwitchChain();
|
|
31
23
|
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = useState(false);
|
|
32
24
|
|
|
33
|
-
const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = useAccountWallet();
|
|
34
|
-
|
|
25
|
+
const { isActiveSmartWallet, isActiveEOAWallet, connectedSmartWallet, connectedEOAWallet } = useAccountWallet();
|
|
26
|
+
|
|
27
|
+
// From context, not process.env: partnerId is hashed into the server intent key and must match the ecosystem wallet.
|
|
28
|
+
const { partnerId } = useB3Config();
|
|
35
29
|
|
|
36
30
|
// Handle EOA wallet chain switch and execute transaction
|
|
37
31
|
const handleEOASwitchChainAndSendTransaction = useCallback(
|
|
@@ -123,11 +117,26 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
123
117
|
[connectedEOAWallet, switchChainAsync],
|
|
124
118
|
);
|
|
125
119
|
|
|
126
|
-
// Handle
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
// Handle Global Account transaction (no chain switch needed for AA).
|
|
121
|
+
// Resolve the signer from the connected ecosystem wallet rather than the active
|
|
122
|
+
// wallet so callers can explicitly require the Global Account.
|
|
123
|
+
const handleGlobalAccountSendTransaction = useCallback(
|
|
124
|
+
async (
|
|
125
|
+
targetChainId: number,
|
|
126
|
+
params: UnifiedTransactionParams,
|
|
127
|
+
expectedGlobalAccountAddress?: string,
|
|
128
|
+
): Promise<string | undefined> => {
|
|
129
|
+
const globalAccount = connectedSmartWallet?.getAccount();
|
|
130
|
+
if (!globalAccount) {
|
|
131
|
+
toast.error("Global Account not connected");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (
|
|
136
|
+
expectedGlobalAccountAddress &&
|
|
137
|
+
globalAccount.address.toLowerCase() !== expectedGlobalAccountAddress.toLowerCase()
|
|
138
|
+
) {
|
|
139
|
+
toast.error("Connected Global Account does not match the authenticated account");
|
|
131
140
|
return;
|
|
132
141
|
}
|
|
133
142
|
|
|
@@ -144,23 +153,29 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
144
153
|
value: params.value,
|
|
145
154
|
});
|
|
146
155
|
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
// Pre-register an intent to authorize the signature server-side; skip if partnerId is missing.
|
|
157
|
+
if (partnerId) {
|
|
158
|
+
try {
|
|
159
|
+
await app.service("global-accounts-intents").create({
|
|
160
|
+
partnerId,
|
|
161
|
+
chainId: targetChainId,
|
|
162
|
+
to: params.to,
|
|
163
|
+
data: params.data || "0x",
|
|
164
|
+
value: params.value.toString(),
|
|
165
|
+
});
|
|
166
|
+
} catch (err: any) {
|
|
167
|
+
console.error("Create global-accounts-intents error", err);
|
|
168
|
+
}
|
|
169
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
170
|
+
console.warn(
|
|
171
|
+
"useUnifiedChainSwitchAndExecute: missing partnerId from B3Config — skipping intent pre-authorization",
|
|
172
|
+
);
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
toast.info("Sending transaction…");
|
|
161
176
|
const start = performance.now();
|
|
162
177
|
const sendTxResponse = await twSendTransaction({
|
|
163
|
-
account:
|
|
178
|
+
account: globalAccount,
|
|
164
179
|
transaction,
|
|
165
180
|
});
|
|
166
181
|
const end = performance.now();
|
|
@@ -176,7 +191,7 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
176
191
|
setIsSwitchingOrExecuting(false);
|
|
177
192
|
}
|
|
178
193
|
},
|
|
179
|
-
[
|
|
194
|
+
[connectedSmartWallet, partnerId],
|
|
180
195
|
);
|
|
181
196
|
|
|
182
197
|
// Unified switch chain and execute function
|
|
@@ -184,15 +199,16 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
184
199
|
async (targetChainId: number, params: UnifiedTransactionParams): Promise<string | undefined> => {
|
|
185
200
|
// Check which wallet type is active
|
|
186
201
|
if (isActiveSmartWallet) {
|
|
187
|
-
return
|
|
202
|
+
return handleGlobalAccountSendTransaction(targetChainId, params);
|
|
188
203
|
}
|
|
189
204
|
return handleEOASwitchChainAndSendTransaction(targetChainId, params);
|
|
190
205
|
},
|
|
191
|
-
[isActiveSmartWallet,
|
|
206
|
+
[isActiveSmartWallet, handleGlobalAccountSendTransaction, handleEOASwitchChainAndSendTransaction],
|
|
192
207
|
);
|
|
193
208
|
|
|
194
209
|
return {
|
|
195
210
|
switchChainAndExecute,
|
|
211
|
+
switchChainAndExecuteWithGlobalAccount: handleGlobalAccountSendTransaction,
|
|
196
212
|
switchChainAndExecuteWithEOA: handleEOASwitchChainAndSendTransaction,
|
|
197
213
|
isSwitchingOrExecuting,
|
|
198
214
|
isActiveSmartWallet,
|
|
@@ -645,8 +645,16 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
645
645
|
destinationTokenAddress: string;
|
|
646
646
|
/** The destination chain ID */
|
|
647
647
|
destinationTokenChainId: number;
|
|
648
|
+
/**
|
|
649
|
+
* When false, the destination token is user-selectable even though a default destination token is
|
|
650
|
+
* provided (the provided destination is used only as the initial/default value). Used by the
|
|
651
|
+
* wallet-funding deposit flow so the user can change the receive token away from the default
|
|
652
|
+
* (Base USDC). Defaults to true (locked destination). Does not affect the QR/pure-transfer path. */
|
|
653
|
+
lockDestinationToken?: boolean;
|
|
648
654
|
/** Callback when deposit succeeds */
|
|
649
655
|
onSuccess?: (amount: string) => void;
|
|
656
|
+
/** Callback when the modal's close control is pressed. */
|
|
657
|
+
onClose?: () => void;
|
|
650
658
|
/** Callback for opening a custom modal (e.g., for special token handling) */
|
|
651
659
|
onOpenCustomModal?: () => void;
|
|
652
660
|
/** Custom footer content */
|
|
@@ -667,8 +675,6 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
667
675
|
showChainSelection?: boolean;
|
|
668
676
|
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
669
677
|
showFiatOption?: boolean;
|
|
670
|
-
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
671
|
-
minPoolSize?: number;
|
|
672
678
|
/** Custom title for chain selection step */
|
|
673
679
|
chainSelectionTitle?: string;
|
|
674
680
|
/** Custom description for chain selection step */
|
|
@@ -687,6 +693,12 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
687
693
|
classes?: AnySpendAllClasses;
|
|
688
694
|
/** Whether to allow direct transfer without swap */
|
|
689
695
|
allowDirectTransfer?: boolean;
|
|
696
|
+
/**
|
|
697
|
+
* When true, the QR-deposit path is a PURE TRANSFER: the destination token/chain
|
|
698
|
+
* mirror the user's selected source token, so the exact token they send lands in
|
|
699
|
+
* their wallet on the same chain (no swap/bridge).
|
|
700
|
+
*/
|
|
701
|
+
pureTransferOnly?: boolean;
|
|
690
702
|
/** Opaque metadata passed to the order for callbacks (e.g., workflow form data) */
|
|
691
703
|
callbackMetadata?: Record<string, unknown>;
|
|
692
704
|
}
|
|
@@ -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/runtime";
|
|
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) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Wallet } from "thirdweb/wallets";
|
|
2
|
+
|
|
1
3
|
export * from "./currency";
|
|
2
4
|
|
|
3
5
|
export const siteURL = "https://basement.fun";
|
|
@@ -8,6 +10,12 @@ export const ecosystemWalletId = (process.env.NEXT_PUBLIC_THIRDWEB_ECOSYSTEM_ID
|
|
|
8
10
|
process.env.EXPO_PUBLIC_THIRDWEB_ECOSYSTEM_ID ||
|
|
9
11
|
"ecosystem.b3-open-gaming") as `ecosystem.${string}`; // Fallback to prod key lookup
|
|
10
12
|
|
|
13
|
+
// Portable equivalent of thirdweb's `EcosystemWallet`, which thirdweb does not export
|
|
14
|
+
// from any public entry point — declaration emit cannot name the internal type (TS2742).
|
|
15
|
+
export type EcosystemWallet = Wallet<`ecosystem.${string}`> & {
|
|
16
|
+
getAuthToken: () => string | null;
|
|
17
|
+
};
|
|
18
|
+
|
|
11
19
|
export const tokenIcons = {
|
|
12
20
|
ETH: "https://cdn.b3.fun/ethereum.svg",
|
|
13
21
|
WETH: "https://cdn.b3.fun/wrapped-ethereum.svg",
|