@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
|
@@ -8,6 +8,7 @@ const react_2 = require("react");
|
|
|
8
8
|
const viem_1 = require("thirdweb/adapters/viem");
|
|
9
9
|
const react_3 = require("thirdweb/react");
|
|
10
10
|
const debug = (0, debug_1.debugB3React)("useFirstEOA");
|
|
11
|
+
// Explicit return annotation keeps the hook's declaration portable (TS2742).
|
|
11
12
|
function useFirstEOA(chain) {
|
|
12
13
|
const wallets = (0, react_3.useConnectedWallets)();
|
|
13
14
|
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
@@ -4,7 +4,7 @@ exports.useNativeBalance = useNativeBalance;
|
|
|
4
4
|
exports.useNativeBalanceFromRPC = useNativeBalanceFromRPC;
|
|
5
5
|
const react_1 = require("../../../global-account/react");
|
|
6
6
|
const constants_1 = require("../../../shared/constants");
|
|
7
|
-
const
|
|
7
|
+
const b3Chain_1 = require("../../../shared/constants/chains/b3Chain");
|
|
8
8
|
const formatNumber_1 = require("../../../shared/utils/formatNumber");
|
|
9
9
|
const react_query_1 = require("@tanstack/react-query");
|
|
10
10
|
const viem_1 = require("viem");
|
|
@@ -90,7 +90,7 @@ function useNativeBalanceFromRPC(address, chainId) {
|
|
|
90
90
|
return 0;
|
|
91
91
|
try {
|
|
92
92
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
93
|
-
chain: chainId === 8333 ?
|
|
93
|
+
chain: chainId === 8333 ? b3Chain_1.b3Mainnet : b3Chain_1.b3Testnet,
|
|
94
94
|
transport: (0, viem_1.http)(chainId === 8333 ? constants_1.PUBLIC_BASE_RPC_URL : undefined),
|
|
95
95
|
});
|
|
96
96
|
const balance = await publicClient.getBalance({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type B3TokenBalance } from "../../../shared/utils/zerionPositions";
|
|
2
|
+
/**
|
|
3
|
+
* Holdings for a wallet, optionally narrowed to specific chains.
|
|
4
|
+
*
|
|
5
|
+
* Read `isError` before reading `data`: a failed read and an empty wallet are different facts, and
|
|
6
|
+
* rendering the first as the second tells the user they hold nothing when nobody knows.
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePortfolioBalance(address?: string, chainIds?: number[]): import("@tanstack/react-query").UseQueryResult<B3TokenBalance[], Error>;
|
|
9
|
+
/**
|
|
10
|
+
* One token's balance for a wallet, served from the same per-wallet fetch as {@link usePortfolioBalance}.
|
|
11
|
+
*
|
|
12
|
+
* `tokenAddress` may be a contract address or the chain's native sentinel; matching is
|
|
13
|
+
* case-insensitive because callers pass addresses in whatever casing their source used.
|
|
14
|
+
*/
|
|
15
|
+
export declare function usePortfolioTokenBalance(walletAddress?: string, tokenAddress?: string, chainId?: number): import("@tanstack/react-query").UseQueryResult<B3TokenBalance | undefined, Error>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePortfolioBalance = usePortfolioBalance;
|
|
4
|
+
exports.usePortfolioTokenBalance = usePortfolioTokenBalance;
|
|
5
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
6
|
+
const zerionPositions_1 = require("../../../shared/utils/zerionPositions");
|
|
7
|
+
/**
|
|
8
|
+
* Wallet holdings, read through the b3 portfolio proxy.
|
|
9
|
+
*
|
|
10
|
+
* The proxy holds the upstream API key server-side and authorizes browsers by Origin allowlist, so
|
|
11
|
+
* nothing secret ships to the client and no key is accepted from it. A consumer served from an
|
|
12
|
+
* origin the proxy does not know will be refused — adding an origin is a proxy config change, not
|
|
13
|
+
* an SDK change.
|
|
14
|
+
*/
|
|
15
|
+
const PORTFOLIO_API_BASE_URL = "https://portfolio-api.b3.fun";
|
|
16
|
+
/**
|
|
17
|
+
* Fetch every spendable holding for a wallet in one request.
|
|
18
|
+
*
|
|
19
|
+
* Deliberately unpaginated and unfiltered by chain. The positions endpoint returns a wallet's full
|
|
20
|
+
* simple-position list in a single response, and passing a chain filter is actively harmful: the
|
|
21
|
+
* upstream rejects a handful of otherwise-valid chain slugs and fails the WHOLE request when one
|
|
22
|
+
* appears, so a caller asking for five chains can lose all five. Callers narrow the result instead.
|
|
23
|
+
*/
|
|
24
|
+
async function fetchWalletPositions(address) {
|
|
25
|
+
const url = `${PORTFOLIO_API_BASE_URL}/v1/wallets/${encodeURIComponent(address)}/positions/?filter[positions]=only_simple`;
|
|
26
|
+
const response = await fetch(url, { headers: { Accept: "application/json" } });
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
throw new Error(`Failed to fetch wallet balances: ${response.status} ${response.statusText}`);
|
|
29
|
+
}
|
|
30
|
+
const body = (await response.json());
|
|
31
|
+
return (0, zerionPositions_1.adaptZerionPositions)(body.data ?? []);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Keyed by wallet alone so every consumer of the same wallet shares one fetch and one cache entry.
|
|
35
|
+
* Keying by the requested chain subset instead would refetch per caller and share nothing.
|
|
36
|
+
*/
|
|
37
|
+
function walletPositionsQueryKey(address) {
|
|
38
|
+
return ["walletPositions", address];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Holdings for a wallet, optionally narrowed to specific chains.
|
|
42
|
+
*
|
|
43
|
+
* Read `isError` before reading `data`: a failed read and an empty wallet are different facts, and
|
|
44
|
+
* rendering the first as the second tells the user they hold nothing when nobody knows.
|
|
45
|
+
*/
|
|
46
|
+
function usePortfolioBalance(address, chainIds) {
|
|
47
|
+
const wantedChainIds = chainIds && chainIds.length > 0 ? chainIds : undefined;
|
|
48
|
+
return (0, react_query_1.useQuery)({
|
|
49
|
+
queryKey: walletPositionsQueryKey(address),
|
|
50
|
+
queryFn: () => {
|
|
51
|
+
if (!address)
|
|
52
|
+
throw new Error("Address is required");
|
|
53
|
+
return fetchWalletPositions(address);
|
|
54
|
+
},
|
|
55
|
+
enabled: Boolean(address),
|
|
56
|
+
select: (balances) => wantedChainIds ? balances.filter(balance => wantedChainIds.includes(balance.chain_id)) : balances,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One token's balance for a wallet, served from the same per-wallet fetch as {@link usePortfolioBalance}.
|
|
61
|
+
*
|
|
62
|
+
* `tokenAddress` may be a contract address or the chain's native sentinel; matching is
|
|
63
|
+
* case-insensitive because callers pass addresses in whatever casing their source used.
|
|
64
|
+
*/
|
|
65
|
+
function usePortfolioTokenBalance(walletAddress, tokenAddress, chainId) {
|
|
66
|
+
return (0, react_query_1.useQuery)({
|
|
67
|
+
queryKey: walletPositionsQueryKey(walletAddress),
|
|
68
|
+
queryFn: () => {
|
|
69
|
+
if (!walletAddress)
|
|
70
|
+
throw new Error("Address is required");
|
|
71
|
+
return fetchWalletPositions(walletAddress);
|
|
72
|
+
},
|
|
73
|
+
enabled: Boolean(walletAddress) && Boolean(tokenAddress) && Boolean(chainId),
|
|
74
|
+
select: (balances) => balances.find(balance => balance.chain_id === chainId && (0, zerionPositions_1.balanceMatchesToken)(balance, tokenAddress ?? "")),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SimpleHashNFTResponse } from "../../../global-account/types/simplehash.types";
|
|
2
|
+
/**
|
|
3
|
+
* NFTs held by a wallet, in the SimpleHash shape `AccountAssets` already renders.
|
|
4
|
+
*
|
|
5
|
+
* Chain narrowing happens here rather than in the request: the upstream rejects some valid chain
|
|
6
|
+
* slugs outright and fails the whole request when one is present, so asking for a subset can cost
|
|
7
|
+
* you the whole answer.
|
|
8
|
+
*/
|
|
9
|
+
export declare function usePortfolioCollectibles(address?: string, chainIds?: number[], options?: {
|
|
10
|
+
limit?: number;
|
|
11
|
+
filterSpam?: boolean;
|
|
12
|
+
}): import("@tanstack/react-query").UseQueryResult<SimpleHashNFTResponse, Error>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePortfolioCollectibles = usePortfolioCollectibles;
|
|
4
|
+
const zerionPositions_1 = require("../../../shared/utils/zerionPositions");
|
|
5
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
6
|
+
const PORTFOLIO_API_BASE_URL = "https://portfolio-api.b3.fun";
|
|
7
|
+
/** Caps an ERC-1155 balance string at MAX_SAFE_INTEGER so a huge supply cannot overflow. */
|
|
8
|
+
function safeParseBalance(balance) {
|
|
9
|
+
if (!balance)
|
|
10
|
+
return 1;
|
|
11
|
+
const parsed = parseInt(balance, 10);
|
|
12
|
+
if (Number.isNaN(parsed))
|
|
13
|
+
return 1;
|
|
14
|
+
return Math.min(parsed, Number.MAX_SAFE_INTEGER);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reshape one Zerion NFT position into the SimpleHash record `AccountAssets` renders.
|
|
18
|
+
*
|
|
19
|
+
* Fields Zerion does not carry — traits, rarity, royalties, sale history — stay empty rather than
|
|
20
|
+
* being synthesised from something adjacent. In particular the position's `price` is a current
|
|
21
|
+
* estimate, not a sale, so it must not be written into `last_sale`.
|
|
22
|
+
*/
|
|
23
|
+
function toSimpleHashNft(position, ownerAddress) {
|
|
24
|
+
const attributes = position.attributes ?? {};
|
|
25
|
+
const nftInfo = attributes.nft_info;
|
|
26
|
+
const slug = position.relationships?.chain?.data?.id;
|
|
27
|
+
if (!nftInfo?.contract_address || !nftInfo.token_id || !slug)
|
|
28
|
+
return null;
|
|
29
|
+
const imageUrl = nftInfo.content?.detail?.url ?? nftInfo.content?.preview?.url ?? "";
|
|
30
|
+
const collectionInfo = attributes.collection_info ?? {};
|
|
31
|
+
const acquiredAt = attributes.changed_at ?? "";
|
|
32
|
+
return {
|
|
33
|
+
nft_id: `${slug}.${nftInfo.contract_address}.${nftInfo.token_id}`,
|
|
34
|
+
chain: slug,
|
|
35
|
+
contract_address: nftInfo.contract_address,
|
|
36
|
+
token_id: nftInfo.token_id,
|
|
37
|
+
name: nftInfo.name || "",
|
|
38
|
+
description: collectionInfo.description || "",
|
|
39
|
+
previews: {
|
|
40
|
+
image_small_url: nftInfo.content?.preview?.url ?? imageUrl,
|
|
41
|
+
image_medium_url: imageUrl,
|
|
42
|
+
image_large_url: imageUrl,
|
|
43
|
+
image_opengraph_url: imageUrl,
|
|
44
|
+
blurhash: "",
|
|
45
|
+
predominant_color: "",
|
|
46
|
+
},
|
|
47
|
+
image_url: imageUrl,
|
|
48
|
+
image_properties: { width: 0, height: 0, size: 0, mime_type: "", exif_orientation: null },
|
|
49
|
+
video_url: null,
|
|
50
|
+
video_properties: null,
|
|
51
|
+
audio_url: null,
|
|
52
|
+
audio_properties: null,
|
|
53
|
+
model_url: null,
|
|
54
|
+
model_properties: null,
|
|
55
|
+
other_url: null,
|
|
56
|
+
other_properties: null,
|
|
57
|
+
background_color: null,
|
|
58
|
+
external_url: null,
|
|
59
|
+
created_date: "",
|
|
60
|
+
status: "minted",
|
|
61
|
+
token_count: 1,
|
|
62
|
+
owner_count: 1,
|
|
63
|
+
owners: [
|
|
64
|
+
{
|
|
65
|
+
owner_address: ownerAddress,
|
|
66
|
+
quantity: safeParseBalance(attributes.amount),
|
|
67
|
+
quantity_string: attributes.amount || "1",
|
|
68
|
+
first_acquired_date: acquiredAt,
|
|
69
|
+
last_acquired_date: acquiredAt,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
contract: {
|
|
73
|
+
type: nftInfo.interface === "ERC1155" ? "ERC1155" : "ERC721",
|
|
74
|
+
name: collectionInfo.name || "",
|
|
75
|
+
symbol: null,
|
|
76
|
+
deployed_by: "",
|
|
77
|
+
deployed_via_contract: "",
|
|
78
|
+
owned_by: "",
|
|
79
|
+
has_multiple_collections: false,
|
|
80
|
+
},
|
|
81
|
+
collection: {
|
|
82
|
+
collection_id: nftInfo.contract_address,
|
|
83
|
+
name: collectionInfo.name || "Unknown Collection",
|
|
84
|
+
description: collectionInfo.description ?? null,
|
|
85
|
+
image_url: collectionInfo.content?.icon?.url ?? "",
|
|
86
|
+
image_properties: { width: 0, height: 0, mime_type: "" },
|
|
87
|
+
banner_image_url: null,
|
|
88
|
+
category: null,
|
|
89
|
+
is_nsfw: null,
|
|
90
|
+
external_url: null,
|
|
91
|
+
twitter_username: null,
|
|
92
|
+
discord_url: null,
|
|
93
|
+
instagram_username: null,
|
|
94
|
+
medium_username: null,
|
|
95
|
+
telegram_url: null,
|
|
96
|
+
marketplace_pages: [],
|
|
97
|
+
metaplex_mint: null,
|
|
98
|
+
metaplex_candy_machine: null,
|
|
99
|
+
metaplex_first_verified_creator: null,
|
|
100
|
+
floor_prices: [],
|
|
101
|
+
top_bids: [],
|
|
102
|
+
distinct_owner_count: 0,
|
|
103
|
+
distinct_nft_count: 0,
|
|
104
|
+
total_quantity: 0,
|
|
105
|
+
chains: [slug],
|
|
106
|
+
top_contracts: [nftInfo.contract_address],
|
|
107
|
+
collection_royalties: [],
|
|
108
|
+
},
|
|
109
|
+
last_sale: null,
|
|
110
|
+
primary_sale: null,
|
|
111
|
+
first_created: {
|
|
112
|
+
minted_to: ownerAddress,
|
|
113
|
+
quantity: 1,
|
|
114
|
+
quantity_string: "1",
|
|
115
|
+
timestamp: "",
|
|
116
|
+
block_number: 0,
|
|
117
|
+
transaction: "",
|
|
118
|
+
transaction_initiator: "",
|
|
119
|
+
},
|
|
120
|
+
rarity: { rank: null, score: null, unique_attributes: null },
|
|
121
|
+
royalty: [],
|
|
122
|
+
extra_metadata: {
|
|
123
|
+
attributes: [],
|
|
124
|
+
image_original_url: imageUrl,
|
|
125
|
+
animation_original_url: null,
|
|
126
|
+
metadata_original_url: "",
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* NFTs held by a wallet, in the SimpleHash shape `AccountAssets` already renders.
|
|
132
|
+
*
|
|
133
|
+
* Chain narrowing happens here rather than in the request: the upstream rejects some valid chain
|
|
134
|
+
* slugs outright and fails the whole request when one is present, so asking for a subset can cost
|
|
135
|
+
* you the whole answer.
|
|
136
|
+
*/
|
|
137
|
+
function usePortfolioCollectibles(address, chainIds, options) {
|
|
138
|
+
const limit = options?.limit;
|
|
139
|
+
const filterSpam = options?.filterSpam;
|
|
140
|
+
const wantedChainIds = chainIds && chainIds.length > 0 ? chainIds : undefined;
|
|
141
|
+
return (0, react_query_1.useQuery)({
|
|
142
|
+
queryKey: ["walletCollectibles", address, limit, filterSpam],
|
|
143
|
+
queryFn: async () => {
|
|
144
|
+
if (!address)
|
|
145
|
+
throw new Error("Address is required");
|
|
146
|
+
const params = new URLSearchParams();
|
|
147
|
+
if (limit)
|
|
148
|
+
params.set("page[size]", String(limit));
|
|
149
|
+
const query = params.toString();
|
|
150
|
+
const url = `${PORTFOLIO_API_BASE_URL}/v1/wallets/${encodeURIComponent(address)}/nft-positions/${query ? `?${query}` : ""}`;
|
|
151
|
+
const response = await fetch(url, { headers: { Accept: "application/json" } });
|
|
152
|
+
if (!response.ok) {
|
|
153
|
+
throw new Error(`Failed to fetch collectibles: ${response.status} ${response.statusText}`);
|
|
154
|
+
}
|
|
155
|
+
const body = (await response.json());
|
|
156
|
+
// Spam is dropped here, not in `select`: the flag lives on the raw position and the
|
|
157
|
+
// SimpleHash shape has nowhere to carry it downstream.
|
|
158
|
+
const nfts = (body.data ?? [])
|
|
159
|
+
.filter(position => !(filterSpam && position.attributes?.nft_info?.flags?.is_spam === true))
|
|
160
|
+
.map(position => toSimpleHashNft(position, address))
|
|
161
|
+
.filter((nft) => nft !== null);
|
|
162
|
+
return { next_cursor: null, next: null, previous: null, nfts };
|
|
163
|
+
},
|
|
164
|
+
enabled: Boolean(address),
|
|
165
|
+
staleTime: 30 * 1000,
|
|
166
|
+
gcTime: 5 * 60 * 1000,
|
|
167
|
+
select: (data) => {
|
|
168
|
+
if (!wantedChainIds)
|
|
169
|
+
return data;
|
|
170
|
+
const all = data.nfts ?? [];
|
|
171
|
+
const nfts = all.filter(nft => {
|
|
172
|
+
const chainId = (0, zerionPositions_1.zerionSlugToChainId)(nft.chain);
|
|
173
|
+
return chainId !== undefined && wantedChainIds.includes(chainId);
|
|
174
|
+
});
|
|
175
|
+
return nfts.length === all.length ? data : { ...data, nfts };
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Account } from "thirdweb/wallets";
|
|
2
2
|
export declare function useSiwe(): {
|
|
3
|
-
authenticate: (account: Account, partnerId: string) => Promise<
|
|
3
|
+
authenticate: (account: Account, partnerId: string) => Promise<Record<string, any>>;
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Account } from "thirdweb/wallets";
|
|
2
2
|
export declare function useSiwe(): {
|
|
3
|
-
authenticate: (account: Account, partnerId: string) => Promise<
|
|
3
|
+
authenticate: (account: Account, partnerId: string) => Promise<Record<string, any>>;
|
|
4
4
|
};
|
|
@@ -3,5 +3,5 @@ import { Wallet } from "thirdweb/wallets";
|
|
|
3
3
|
* @deprecated Use useAuth() instead
|
|
4
4
|
*/
|
|
5
5
|
export declare function useTWAuth(): {
|
|
6
|
-
authenticate: (wallet: Wallet, partnerId: string) => Promise<
|
|
6
|
+
authenticate: (wallet: Wallet, partnerId: string) => Promise<Record<string, any>>;
|
|
7
7
|
};
|
|
@@ -5,6 +5,7 @@ export interface UnifiedTransactionParams {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function useUnifiedChainSwitchAndExecute(): {
|
|
7
7
|
switchChainAndExecute: (targetChainId: number, params: UnifiedTransactionParams) => Promise<string | undefined>;
|
|
8
|
+
switchChainAndExecuteWithGlobalAccount: (targetChainId: number, params: UnifiedTransactionParams, expectedGlobalAccountAddress?: string) => Promise<string | undefined>;
|
|
8
9
|
switchChainAndExecuteWithEOA: (targetChainId: number, params: UnifiedTransactionParams) => Promise<string | undefined>;
|
|
9
10
|
isSwitchingOrExecuting: boolean;
|
|
10
11
|
isActiveSmartWallet: boolean | undefined;
|
|
@@ -14,18 +14,14 @@ const react_2 = require("react");
|
|
|
14
14
|
const thirdweb_2 = require("thirdweb");
|
|
15
15
|
const viem_1 = require("viem");
|
|
16
16
|
const wagmi_1 = require("wagmi");
|
|
17
|
-
const
|
|
17
|
+
const B3ConfigProvider_1 = require("../components/B3Provider/B3ConfigProvider");
|
|
18
18
|
const useAccountWallet_1 = require("./useAccountWallet");
|
|
19
|
-
const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
20
|
-
process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
21
|
-
process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID ||
|
|
22
|
-
process.env.NEXT_PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID);
|
|
23
|
-
(0, invariant_1.default)(partnerId, "Partner ID is required");
|
|
24
19
|
function useUnifiedChainSwitchAndExecute() {
|
|
25
20
|
const { switchChainAsync } = (0, wagmi_1.useSwitchChain)();
|
|
26
21
|
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0, react_2.useState)(false);
|
|
27
|
-
const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
|
|
28
|
-
|
|
22
|
+
const { isActiveSmartWallet, isActiveEOAWallet, connectedSmartWallet, connectedEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
|
|
23
|
+
// From context, not process.env: partnerId is hashed into the server intent key and must match the ecosystem wallet.
|
|
24
|
+
const { partnerId } = (0, B3ConfigProvider_1.useB3Config)();
|
|
29
25
|
// Handle EOA wallet chain switch and execute transaction
|
|
30
26
|
const handleEOASwitchChainAndSendTransaction = (0, react_2.useCallback)(async (targetChainId, params) => {
|
|
31
27
|
if (!connectedEOAWallet) {
|
|
@@ -102,10 +98,18 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
102
98
|
setIsSwitchingOrExecuting(false);
|
|
103
99
|
}
|
|
104
100
|
}, [connectedEOAWallet, switchChainAsync]);
|
|
105
|
-
// Handle
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
// Handle Global Account transaction (no chain switch needed for AA).
|
|
102
|
+
// Resolve the signer from the connected ecosystem wallet rather than the active
|
|
103
|
+
// wallet so callers can explicitly require the Global Account.
|
|
104
|
+
const handleGlobalAccountSendTransaction = (0, react_2.useCallback)(async (targetChainId, params, expectedGlobalAccountAddress) => {
|
|
105
|
+
const globalAccount = connectedSmartWallet?.getAccount();
|
|
106
|
+
if (!globalAccount) {
|
|
107
|
+
react_1.toast.error("Global Account not connected");
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (expectedGlobalAccountAddress &&
|
|
111
|
+
globalAccount.address.toLowerCase() !== expectedGlobalAccountAddress.toLowerCase()) {
|
|
112
|
+
react_1.toast.error("Connected Global Account does not match the authenticated account");
|
|
109
113
|
return;
|
|
110
114
|
}
|
|
111
115
|
try {
|
|
@@ -118,23 +122,28 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
118
122
|
data: params.data,
|
|
119
123
|
value: params.value,
|
|
120
124
|
});
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
// Pre-register an intent to authorize the signature server-side; skip if partnerId is missing.
|
|
126
|
+
if (partnerId) {
|
|
127
|
+
try {
|
|
128
|
+
await app_1.default.service("global-accounts-intents").create({
|
|
129
|
+
partnerId,
|
|
130
|
+
chainId: targetChainId,
|
|
131
|
+
to: params.to,
|
|
132
|
+
data: params.data || "0x",
|
|
133
|
+
value: params.value.toString(),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.error("Create global-accounts-intents error", err);
|
|
138
|
+
}
|
|
130
139
|
}
|
|
131
|
-
|
|
132
|
-
console.
|
|
140
|
+
else if (process.env.NODE_ENV !== "production") {
|
|
141
|
+
console.warn("useUnifiedChainSwitchAndExecute: missing partnerId from B3Config — skipping intent pre-authorization");
|
|
133
142
|
}
|
|
134
143
|
react_1.toast.info("Sending transaction…");
|
|
135
144
|
const start = performance.now();
|
|
136
145
|
const sendTxResponse = await (0, thirdweb_2.sendTransaction)({
|
|
137
|
-
account:
|
|
146
|
+
account: globalAccount,
|
|
138
147
|
transaction,
|
|
139
148
|
});
|
|
140
149
|
const end = performance.now();
|
|
@@ -150,17 +159,18 @@ function useUnifiedChainSwitchAndExecute() {
|
|
|
150
159
|
finally {
|
|
151
160
|
setIsSwitchingOrExecuting(false);
|
|
152
161
|
}
|
|
153
|
-
}, [
|
|
162
|
+
}, [connectedSmartWallet, partnerId]);
|
|
154
163
|
// Unified switch chain and execute function
|
|
155
164
|
const switchChainAndExecute = (0, react_2.useCallback)(async (targetChainId, params) => {
|
|
156
165
|
// Check which wallet type is active
|
|
157
166
|
if (isActiveSmartWallet) {
|
|
158
|
-
return
|
|
167
|
+
return handleGlobalAccountSendTransaction(targetChainId, params);
|
|
159
168
|
}
|
|
160
169
|
return handleEOASwitchChainAndSendTransaction(targetChainId, params);
|
|
161
|
-
}, [isActiveSmartWallet,
|
|
170
|
+
}, [isActiveSmartWallet, handleGlobalAccountSendTransaction, handleEOASwitchChainAndSendTransaction]);
|
|
162
171
|
return {
|
|
163
172
|
switchChainAndExecute,
|
|
173
|
+
switchChainAndExecuteWithGlobalAccount: handleGlobalAccountSendTransaction,
|
|
164
174
|
switchChainAndExecuteWithEOA: handleEOASwitchChainAndSendTransaction,
|
|
165
175
|
isSwitchingOrExecuting,
|
|
166
176
|
isActiveSmartWallet,
|
|
@@ -617,8 +617,16 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
617
617
|
destinationTokenAddress: string;
|
|
618
618
|
/** The destination chain ID */
|
|
619
619
|
destinationTokenChainId: number;
|
|
620
|
+
/**
|
|
621
|
+
* When false, the destination token is user-selectable even though a default destination token is
|
|
622
|
+
* provided (the provided destination is used only as the initial/default value). Used by the
|
|
623
|
+
* wallet-funding deposit flow so the user can change the receive token away from the default
|
|
624
|
+
* (Base USDC). Defaults to true (locked destination). Does not affect the QR/pure-transfer path. */
|
|
625
|
+
lockDestinationToken?: boolean;
|
|
620
626
|
/** Callback when deposit succeeds */
|
|
621
627
|
onSuccess?: (amount: string) => void;
|
|
628
|
+
/** Callback when the modal's close control is pressed. */
|
|
629
|
+
onClose?: () => void;
|
|
622
630
|
/** Callback for opening a custom modal (e.g., for special token handling) */
|
|
623
631
|
onOpenCustomModal?: () => void;
|
|
624
632
|
/** Custom footer content */
|
|
@@ -641,8 +649,6 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
641
649
|
showChainSelection?: boolean;
|
|
642
650
|
/** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
|
|
643
651
|
showFiatOption?: boolean;
|
|
644
|
-
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
645
|
-
minPoolSize?: number;
|
|
646
652
|
/** Custom title for chain selection step */
|
|
647
653
|
chainSelectionTitle?: string;
|
|
648
654
|
/** Custom description for chain selection step */
|
|
@@ -661,6 +667,12 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
661
667
|
classes?: AnySpendAllClasses;
|
|
662
668
|
/** Whether to allow direct transfer without swap */
|
|
663
669
|
allowDirectTransfer?: boolean;
|
|
670
|
+
/**
|
|
671
|
+
* When true, the QR-deposit path is a PURE TRANSFER: the destination token/chain
|
|
672
|
+
* mirror the user's selected source token, so the exact token they send lands in
|
|
673
|
+
* their wallet on the same chain (no swap/bridge).
|
|
674
|
+
*/
|
|
675
|
+
pureTransferOnly?: boolean;
|
|
664
676
|
/** Opaque metadata passed to the order for callbacks (e.g., workflow form data) */
|
|
665
677
|
callbackMetadata?: Record<string, unknown>;
|
|
666
678
|
}
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
type ObjectId = string;
|
|
5
5
|
interface PartnerIds {
|
|
6
|
+
/** @deprecated Privy is no longer used for authentication. This field exists for legacy data compatibility only. */
|
|
6
7
|
privyId?: string;
|
|
7
8
|
thirdwebId?: string;
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Privy is no longer used for authentication. This type exists for legacy data compatibility only.
|
|
12
|
+
*/
|
|
9
13
|
interface PrivyLinkedAccount {
|
|
10
14
|
type: string;
|
|
11
15
|
address?: string;
|
|
@@ -45,6 +49,7 @@ interface User {
|
|
|
45
49
|
createdAt: number;
|
|
46
50
|
updatedAt: number;
|
|
47
51
|
partnerIds: PartnerIds;
|
|
52
|
+
/** @deprecated Privy is no longer used for authentication. This field exists for legacy data compatibility only. */
|
|
48
53
|
privyLinkedAccounts?: PrivyLinkedAccount[];
|
|
49
54
|
twProfiles?: TWProfile[];
|
|
50
55
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Static } from "@feathersjs/typebox";
|
|
2
|
-
export declare const featureFlagsSchema: import("@
|
|
3
|
-
_id: import("@
|
|
4
|
-
id: import("@
|
|
5
|
-
enabled: import("@
|
|
6
|
-
description: import("@
|
|
2
|
+
export declare const featureFlagsSchema: import("@sinclair/typebox").TObject<{
|
|
3
|
+
_id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TObject<{}>]>;
|
|
4
|
+
id: import("@sinclair/typebox").TString<string>;
|
|
5
|
+
enabled: import("@sinclair/typebox").TBoolean;
|
|
6
|
+
description: import("@sinclair/typebox").TString<string>;
|
|
7
7
|
}>;
|
|
8
8
|
export type FeatureFlags = Static<typeof featureFlagsSchema>;
|
|
@@ -4,6 +4,7 @@ exports.notificationsAPI = void 0;
|
|
|
4
4
|
exports.setApiUrl = setApiUrl;
|
|
5
5
|
exports.getApiUrl = getApiUrl;
|
|
6
6
|
const auth_token_1 = require("../../shared/utils/auth-token");
|
|
7
|
+
// Hardcoded default; consumers override via `B3Provider.notificationsApiUrl`.
|
|
7
8
|
const DEFAULT_API_URL = "https://notifications.b3.fun";
|
|
8
9
|
let apiUrl = DEFAULT_API_URL;
|
|
9
10
|
function setApiUrl(url) {
|