@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
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ import { AnySpendNFTButton } from "@b3dotfun/sdk/anyspend/react";
|
|
|
69
69
|
function NFTMinting() {
|
|
70
70
|
const nftContract = {
|
|
71
71
|
address: "0x9c275ff1634519E9B5449ec79cd939B5F900564d",
|
|
72
|
-
chainId:
|
|
72
|
+
chainId: 8453,
|
|
73
73
|
name: "Example NFT Collection",
|
|
74
74
|
imageUrl: "https://example.com/nft-image.jpg",
|
|
75
75
|
description: "A beautiful NFT from our collection",
|
|
@@ -127,7 +127,7 @@ import type { GetQuoteRequest } from "@b3dotfun/sdk/anyspend/types";
|
|
|
127
127
|
// Get quote for cross-chain swap
|
|
128
128
|
const quoteRequest: GetQuoteRequest = {
|
|
129
129
|
srcChain: 1,
|
|
130
|
-
dstChain:
|
|
130
|
+
dstChain: 8453,
|
|
131
131
|
srcTokenAddress: "0xA0b86a33E6c51c7C36c654d6C9e7b8F5d4a8b5c5",
|
|
132
132
|
dstTokenAddress: "0x...",
|
|
133
133
|
srcAmount: "1000000", // 1 USDC
|
|
@@ -142,7 +142,7 @@ const order = await anyspendService.createOrder({
|
|
|
142
142
|
recipientAddress: "0x...",
|
|
143
143
|
type: "swap",
|
|
144
144
|
srcChain: 1,
|
|
145
|
-
dstChain:
|
|
145
|
+
dstChain: 8453,
|
|
146
146
|
srcTokenAddress: "0x...",
|
|
147
147
|
dstTokenAddress: "0x...",
|
|
148
148
|
srcAmount: "1000000",
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// React Native / Metro requires CJS-compatible re-exports from a fixed path.
|
|
2
|
+
// This shim resolves `@b3dotfun/sdk/constants/chains/b3Chain` for bundlers
|
|
3
|
+
// that don't honour the package's `exports` map.
|
|
2
4
|
export * from "../../dist/esm/constants/chains/b3Chain";
|
|
@@ -13,9 +13,11 @@ export declare const OPTIMISM_PUBLIC_RPC = "https://optimism-rpc.publicnode.com"
|
|
|
13
13
|
export declare const POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
|
|
14
14
|
export declare const AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
|
|
15
15
|
export declare const BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
|
|
16
|
-
export declare const B3_PUBLIC_RPC = "https://
|
|
16
|
+
export declare const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun";
|
|
17
17
|
export declare const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
18
18
|
export declare const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
19
|
+
export declare const PLUME_PUBLIC_RPC = "https://rpc.plume.org";
|
|
20
|
+
export declare const ROBINHOOD_PUBLIC_RPC = "https://rpc.mainnet.chain.robinhood.com";
|
|
19
21
|
/**
|
|
20
22
|
* Map of chain IDs to their default public RPC URLs.
|
|
21
23
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - https://chainlist.org
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.PUBLIC_RPC_URLS = exports.HYPEREVM_PUBLIC_RPC = exports.ABSTRACT_PUBLIC_RPC = exports.B3_PUBLIC_RPC = exports.BSC_PUBLIC_RPC = exports.AVALANCHE_PUBLIC_RPC = exports.POLYGON_PUBLIC_RPC = exports.OPTIMISM_PUBLIC_RPC = exports.BASE_PUBLIC_RPC = exports.ARBITRUM_PUBLIC_RPC = exports.ETHEREUM_PUBLIC_RPC = void 0;
|
|
11
|
+
exports.PUBLIC_RPC_URLS = exports.ROBINHOOD_PUBLIC_RPC = exports.PLUME_PUBLIC_RPC = exports.HYPEREVM_PUBLIC_RPC = exports.ABSTRACT_PUBLIC_RPC = exports.B3_PUBLIC_RPC = exports.BSC_PUBLIC_RPC = exports.AVALANCHE_PUBLIC_RPC = exports.POLYGON_PUBLIC_RPC = exports.OPTIMISM_PUBLIC_RPC = exports.BASE_PUBLIC_RPC = exports.ARBITRUM_PUBLIC_RPC = exports.ETHEREUM_PUBLIC_RPC = void 0;
|
|
12
12
|
// PublicNode endpoints
|
|
13
13
|
exports.ETHEREUM_PUBLIC_RPC = "https://ethereum-rpc.publicnode.com";
|
|
14
14
|
exports.ARBITRUM_PUBLIC_RPC = "https://arbitrum-one-rpc.publicnode.com";
|
|
@@ -18,9 +18,11 @@ exports.POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
|
|
|
18
18
|
exports.AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
|
|
19
19
|
exports.BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
|
|
20
20
|
// Chain-specific public endpoints
|
|
21
|
-
exports.B3_PUBLIC_RPC = "https://
|
|
21
|
+
exports.B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun";
|
|
22
22
|
exports.ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
23
23
|
exports.HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
24
|
+
exports.PLUME_PUBLIC_RPC = "https://rpc.plume.org";
|
|
25
|
+
exports.ROBINHOOD_PUBLIC_RPC = "https://rpc.mainnet.chain.robinhood.com";
|
|
24
26
|
/**
|
|
25
27
|
* Map of chain IDs to their default public RPC URLs.
|
|
26
28
|
*/
|
|
@@ -35,4 +37,6 @@ exports.PUBLIC_RPC_URLS = {
|
|
|
35
37
|
8333: exports.B3_PUBLIC_RPC, // B3
|
|
36
38
|
2741: exports.ABSTRACT_PUBLIC_RPC, // Abstract
|
|
37
39
|
999: exports.HYPEREVM_PUBLIC_RPC, // HyperEVM
|
|
40
|
+
98866: exports.PLUME_PUBLIC_RPC, // Plume Network
|
|
41
|
+
4663: exports.ROBINHOOD_PUBLIC_RPC, // Robinhood Chain
|
|
38
42
|
};
|
|
@@ -20,7 +20,8 @@ export declare enum PanelView {
|
|
|
20
20
|
FEE_DETAIL = 9,
|
|
21
21
|
DIRECT_TRANSFER_SUCCESS = 10,
|
|
22
22
|
FIAT_KYC = 11,
|
|
23
|
-
FIAT_AUTH = 12
|
|
23
|
+
FIAT_AUTH = 12,
|
|
24
|
+
PURE_TRANSFER_ADDRESS = 13
|
|
24
25
|
}
|
|
25
26
|
export declare function AnySpend(props: {
|
|
26
27
|
mode?: "page" | "modal";
|
|
@@ -28,6 +29,13 @@ export declare function AnySpend(props: {
|
|
|
28
29
|
sourceChainId?: number;
|
|
29
30
|
destinationTokenAddress?: string;
|
|
30
31
|
destinationTokenChainId?: number;
|
|
32
|
+
/**
|
|
33
|
+
* When false, the destination token is user-selectable even if a default destination token is
|
|
34
|
+
* provided (the provided destination is used only as the initial/default value). Used by the
|
|
35
|
+
* wallet-funding deposit flow so the user can change the receive token away from the default
|
|
36
|
+
* (Base USDC). Defaults to true (locked buy-mode display, current behavior).
|
|
37
|
+
*/
|
|
38
|
+
lockDestinationToken?: boolean;
|
|
31
39
|
recipientAddress?: string;
|
|
32
40
|
loadOrder?: string;
|
|
33
41
|
hideTransactionHistoryButton?: boolean;
|
|
@@ -42,6 +42,7 @@ const LoginStep_1 = require("../../../global-account/react/components/SignInWith
|
|
|
42
42
|
const PanelOnramp_1 = require("./common/PanelOnramp");
|
|
43
43
|
const PanelOnrampPayment_1 = require("./common/PanelOnrampPayment");
|
|
44
44
|
const PointsDetailPanel_1 = require("./common/PointsDetailPanel");
|
|
45
|
+
const PureTransferView_1 = require("./common/PureTransferView");
|
|
45
46
|
const RecipientSelection_1 = require("./common/RecipientSelection");
|
|
46
47
|
const TabSection_1 = require("./common/TabSection");
|
|
47
48
|
const AnySpendCustomizationContext_1 = require("./context/AnySpendCustomizationContext");
|
|
@@ -61,13 +62,14 @@ var PanelView;
|
|
|
61
62
|
PanelView[PanelView["DIRECT_TRANSFER_SUCCESS"] = 10] = "DIRECT_TRANSFER_SUCCESS";
|
|
62
63
|
PanelView[PanelView["FIAT_KYC"] = 11] = "FIAT_KYC";
|
|
63
64
|
PanelView[PanelView["FIAT_AUTH"] = 12] = "FIAT_AUTH";
|
|
65
|
+
PanelView[PanelView["PURE_TRANSFER_ADDRESS"] = 13] = "PURE_TRANSFER_ADDRESS";
|
|
64
66
|
})(PanelView || (exports.PanelView = PanelView = {}));
|
|
65
67
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
66
68
|
function AnySpend(props) {
|
|
67
69
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
68
70
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomizationContext_1.AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }) }));
|
|
69
71
|
}
|
|
70
|
-
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, showFiatOption = true, }) {
|
|
72
|
+
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, lockDestinationToken = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, showFiatOption = true, }) {
|
|
71
73
|
const { slots, content } = (0, AnySpendCustomizationContext_1.useAnySpendCustomization)();
|
|
72
74
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
73
75
|
const router = (0, react_2.useRouter)();
|
|
@@ -81,8 +83,10 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
81
83
|
// in the same frame that onStatusResolved sets it (setState is async).
|
|
82
84
|
// When kycEnabled is false (default), pre-approve so the KYC gate is skipped.
|
|
83
85
|
const kycApprovedRef = (0, react_4.useRef)(!kycEnabled);
|
|
84
|
-
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
85
|
-
|
|
86
|
+
// Determine if we're in "buy mode" based on whether destination token props are provided.
|
|
87
|
+
// When lockDestinationToken is false, the provided destination is only a default and the user
|
|
88
|
+
// can change the receive token, so we stay out of buy mode (selectable swap mode).
|
|
89
|
+
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId) && lockDestinationToken;
|
|
86
90
|
// Add refs to track URL state
|
|
87
91
|
const initialUrlProcessed = (0, react_4.useRef)(false);
|
|
88
92
|
const lastUrlUpdate = (0, react_4.useRef)(null);
|
|
@@ -142,9 +146,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
142
146
|
(0, react_4.useEffect)(() => {
|
|
143
147
|
sessionStorage.setItem("anyspend_fiat_method", selectedFiatPaymentMethod);
|
|
144
148
|
}, [selectedFiatPaymentMethod]);
|
|
149
|
+
// Whether a default destination token was provided. When lockDestinationToken is false this is
|
|
150
|
+
// used only as the INITIAL/default value (the user can still change the receive token), so the
|
|
151
|
+
// wallet-funding deposit flow defaults to Base USDC but stays selectable.
|
|
152
|
+
const hasProvidedDestination = !!(destinationTokenAddress && destinationTokenChainId);
|
|
145
153
|
// Get initial chain IDs from URL or defaults
|
|
146
154
|
const initialSrcChainId = sourceChainId || parseInt(searchParams.get("fromChainId") || "0") || chains_1.mainnet.id;
|
|
147
|
-
const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") ||
|
|
155
|
+
const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") ||
|
|
156
|
+
(isBuyMode ? destinationTokenChainId : hasProvidedDestination ? destinationTokenChainId : chains_1.base.id);
|
|
148
157
|
// State for source chain/token selection
|
|
149
158
|
const [selectedSrcChainId, setSelectedSrcChainId] = (0, react_4.useState)(initialSrcChainId);
|
|
150
159
|
const defaultSrcToken = (0, anyspend_1.getDefaultToken)(selectedSrcChainId);
|
|
@@ -181,19 +190,25 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
181
190
|
});
|
|
182
191
|
// Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
|
|
183
192
|
const isHyperliquidUSDCAddress = (address) => (0, anyspend_1.eqci)(address, anyspend_1.HYPERLIQUID_USDC_ADDRESS) || (0, anyspend_1.eqci)(address, anyspend_1.ZERO_ADDRESS);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
// Build a token object from the provided destination props (handles the Hyperliquid USDC special case).
|
|
194
|
+
// The inline truthiness check lets TypeScript narrow both props to non-null, so it is `undefined`
|
|
195
|
+
// unless both props are provided — i.e. only meaningful when hasProvidedDestination/isBuyMode is true.
|
|
196
|
+
const providedDstToken = destinationTokenChainId && destinationTokenAddress
|
|
197
|
+
? destinationTokenChainId === anyspend_1.HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
|
|
198
|
+
? (0, anyspend_1.getHyperliquidUSDCToken)()
|
|
199
|
+
: {
|
|
200
|
+
symbol: "",
|
|
201
|
+
chainId: destinationTokenChainId,
|
|
202
|
+
address: destinationTokenAddress,
|
|
203
|
+
name: "",
|
|
204
|
+
decimals: 18,
|
|
205
|
+
metadata: {},
|
|
206
|
+
}
|
|
207
|
+
: undefined;
|
|
208
|
+
// In buy mode the provided destination is locked. Otherwise, if a default destination was provided
|
|
209
|
+
// (selectable deposit flow) seed it as the default; falling back to the chain's default token only
|
|
210
|
+
// when no destination prop is given (standard swap mode).
|
|
211
|
+
const defaultDstToken = (isBuyMode || hasProvidedDestination) && providedDstToken ? providedDstToken : (0, anyspend_1.getDefaultToken)(selectedDstChainId);
|
|
197
212
|
const dstTokenFromUrl = (0, react_2.useTokenFromUrl)({
|
|
198
213
|
defaultToken: defaultDstToken,
|
|
199
214
|
prefix: "to",
|
|
@@ -440,7 +455,10 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
440
455
|
walletAddress,
|
|
441
456
|
globalAddress,
|
|
442
457
|
});
|
|
443
|
-
const recipientProfile = (0, react_2.useProfile)({
|
|
458
|
+
const recipientProfile = (0, react_2.useProfile)({
|
|
459
|
+
address: effectiveRecipientAddress,
|
|
460
|
+
fresh: true,
|
|
461
|
+
});
|
|
444
462
|
const recipientName = recipientProfile.data?.name;
|
|
445
463
|
// Check token balance for crypto payments
|
|
446
464
|
const effectiveBalanceAddress = senderAddress || connectedEOAWallet?.getAccount()?.address;
|
|
@@ -546,12 +564,15 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
546
564
|
anyspendQuote.data.currencyOut?.amount &&
|
|
547
565
|
anyspendQuote.data.currencyOut?.currency?.decimals) {
|
|
548
566
|
if (isSrcInputDirty) {
|
|
549
|
-
//
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
567
|
+
// The user is driving the SOURCE (exact-in): reflect the quote's OUTPUT even
|
|
568
|
+
// when a fixed destinationTokenAmount pre-filled the receive. That lock only
|
|
569
|
+
// governs the INITIAL exact-out state (untouched source → compute the pay for
|
|
570
|
+
// the fixed receive). Once the user edits the pay, keeping the receive pinned
|
|
571
|
+
// shows a value that doesn't match the quote — the URL amount "overrides" the
|
|
572
|
+
// real output, an invalid mismatched swap.
|
|
573
|
+
const amount = anyspendQuote.data.currencyOut.amount;
|
|
574
|
+
const decimals = anyspendQuote.data.currencyOut.currency.decimals;
|
|
575
|
+
setDstAmount((0, number_1.formatTokenAmount)(BigInt(amount), decimals, 6, false));
|
|
555
576
|
}
|
|
556
577
|
else {
|
|
557
578
|
const amount = anyspendQuote.data.currencyIn.amount;
|
|
@@ -561,16 +582,13 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
561
582
|
}
|
|
562
583
|
else {
|
|
563
584
|
if (isSrcInputDirty) {
|
|
564
|
-
|
|
565
|
-
if (!destinationTokenAmount) {
|
|
566
|
-
setDstAmount("");
|
|
567
|
-
}
|
|
585
|
+
setDstAmount("");
|
|
568
586
|
}
|
|
569
587
|
else {
|
|
570
588
|
setSrcAmount("");
|
|
571
589
|
}
|
|
572
590
|
}
|
|
573
|
-
}, [anyspendQuote, isSrcInputDirty
|
|
591
|
+
}, [anyspendQuote, isSrcInputDirty]);
|
|
574
592
|
// Call onSuccess when order is executed
|
|
575
593
|
(0, useOnOrderSuccess_1.useOnOrderSuccess)({ orderData: oat, orderId, onSuccess });
|
|
576
594
|
// Clear all persisted selection state once an order is submitted — next open starts fresh
|
|
@@ -631,8 +649,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
631
649
|
// Check if it's a same-chain same-token swap
|
|
632
650
|
const isSameChainSameToken = (0, react_4.useMemo)(() => {
|
|
633
651
|
return (activeTab === "crypto" &&
|
|
634
|
-
selectedSrcChainId
|
|
635
|
-
selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase());
|
|
652
|
+
(0, anyspend_1.isSameChainAndToken)(selectedSrcChainId, selectedSrcToken.address, selectedDstChainId, selectedDstToken.address));
|
|
636
653
|
}, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
|
|
637
654
|
// Check if this is a direct transfer (same chain/token with allowDirectTransfer enabled)
|
|
638
655
|
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
@@ -641,11 +658,26 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
641
658
|
// For fiat tab, check srcAmountOnRamp; for crypto tab, check activeInputAmountInWei
|
|
642
659
|
const hasAmount = activeTab === "fiat" ? srcAmountOnRamp && parseFloat(srcAmountOnRamp) > 0 : activeInputAmountInWei !== "0";
|
|
643
660
|
if (!hasAmount)
|
|
644
|
-
return {
|
|
661
|
+
return {
|
|
662
|
+
text: "Enter an amount",
|
|
663
|
+
disable: true,
|
|
664
|
+
error: false,
|
|
665
|
+
loading: false,
|
|
666
|
+
};
|
|
645
667
|
if (isSameChainSameToken && !allowDirectTransfer)
|
|
646
|
-
return {
|
|
668
|
+
return {
|
|
669
|
+
text: "Select a different token or chain",
|
|
670
|
+
disable: true,
|
|
671
|
+
error: false,
|
|
672
|
+
loading: false,
|
|
673
|
+
};
|
|
647
674
|
if (isLoadingAnyspendQuote && !isSameChainSameToken)
|
|
648
|
-
return {
|
|
675
|
+
return {
|
|
676
|
+
text: "Loading quote...",
|
|
677
|
+
disable: true,
|
|
678
|
+
error: false,
|
|
679
|
+
loading: true,
|
|
680
|
+
};
|
|
649
681
|
if (isCreatingOrder || isCreatingOnrampOrder || isSwitchingOrExecuting)
|
|
650
682
|
return {
|
|
651
683
|
text: isSwitchingOrExecuting ? "Transferring..." : "Creating order...",
|
|
@@ -654,14 +686,29 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
654
686
|
loading: true,
|
|
655
687
|
};
|
|
656
688
|
if ((!anyspendQuote || !anyspendQuote.success) && !(isSameChainSameToken && allowDirectTransfer))
|
|
657
|
-
return {
|
|
689
|
+
return {
|
|
690
|
+
text: "No quote found",
|
|
691
|
+
disable: true,
|
|
692
|
+
error: false,
|
|
693
|
+
loading: false,
|
|
694
|
+
};
|
|
658
695
|
if (activeTab === "fiat") {
|
|
659
696
|
// For fiat: check recipient first, then payment method
|
|
660
697
|
if (!effectiveRecipientAddress)
|
|
661
|
-
return {
|
|
698
|
+
return {
|
|
699
|
+
text: "Select recipient",
|
|
700
|
+
disable: false,
|
|
701
|
+
error: false,
|
|
702
|
+
loading: false,
|
|
703
|
+
};
|
|
662
704
|
// If no fiat payment method selected, show "Select payment method"
|
|
663
705
|
if (selectedFiatPaymentMethod === FiatPaymentMethod_1.FiatPaymentMethod.NONE) {
|
|
664
|
-
return {
|
|
706
|
+
return {
|
|
707
|
+
text: "Select payment method",
|
|
708
|
+
disable: false,
|
|
709
|
+
error: false,
|
|
710
|
+
loading: false,
|
|
711
|
+
};
|
|
665
712
|
}
|
|
666
713
|
// If payment method is selected, show "Continue"
|
|
667
714
|
return { text: "Continue", disable: false, error: false, loading: false };
|
|
@@ -670,19 +717,40 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
670
717
|
// For crypto: check payment method first, then recipient
|
|
671
718
|
// If no payment method selected, show "Choose payment method"
|
|
672
719
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE) {
|
|
673
|
-
return {
|
|
720
|
+
return {
|
|
721
|
+
text: "Choose payment method",
|
|
722
|
+
disable: false,
|
|
723
|
+
error: false,
|
|
724
|
+
loading: false,
|
|
725
|
+
};
|
|
674
726
|
}
|
|
675
727
|
// Check recipient after payment method
|
|
676
728
|
if (!effectiveRecipientAddress)
|
|
677
|
-
return {
|
|
729
|
+
return {
|
|
730
|
+
text: "Select recipient",
|
|
731
|
+
disable: false,
|
|
732
|
+
error: false,
|
|
733
|
+
loading: false,
|
|
734
|
+
};
|
|
678
735
|
// If payment method selected, show appropriate action
|
|
679
736
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
680
737
|
effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
681
738
|
const buttonText = isSameChainSameToken && allowDirectTransfer ? "Transfer" : "Swap";
|
|
682
|
-
return {
|
|
739
|
+
return {
|
|
740
|
+
text: buttonText,
|
|
741
|
+
disable: false,
|
|
742
|
+
error: false,
|
|
743
|
+
loading: false,
|
|
744
|
+
};
|
|
683
745
|
}
|
|
684
746
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
685
|
-
|
|
747
|
+
const transferText = isSameChainSameToken && allowDirectTransfer ? "Show deposit address" : "Continue to payment";
|
|
748
|
+
return {
|
|
749
|
+
text: transferText,
|
|
750
|
+
disable: false,
|
|
751
|
+
error: false,
|
|
752
|
+
loading: false,
|
|
753
|
+
};
|
|
686
754
|
}
|
|
687
755
|
}
|
|
688
756
|
return { text: "Continue", disable: false, error: false, loading: false };
|
|
@@ -774,8 +842,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
774
842
|
// Handle crypto swap creation
|
|
775
843
|
const handleCryptoSwap = async (method) => {
|
|
776
844
|
try {
|
|
777
|
-
|
|
845
|
+
// TRANSFER_CRYPTO is the manual deposit-address flow — no connected wallet to send from.
|
|
846
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer && method !== CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO;
|
|
778
847
|
(0, invariant_1.default)(effectiveRecipientAddress, "Recipient address is not found");
|
|
848
|
+
// Same-token manual deposit → show recipient address + watch, no relayer order, no fee
|
|
849
|
+
if (isSameChainSameToken && allowDirectTransfer && method === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
850
|
+
navigateToPanel(PanelView.PURE_TRANSFER_ADDRESS, "forward");
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
779
853
|
const srcAmountBigInt = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
780
854
|
// Handle direct transfer (same chain/token) - bypass backend, transfer directly
|
|
781
855
|
if (isDirectTransfer) {
|
|
@@ -794,9 +868,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
794
868
|
}
|
|
795
869
|
// Regular swap flow - use backend
|
|
796
870
|
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
797
|
-
// Debug: Check payment method values
|
|
798
|
-
console.log("handleCryptoSwap - method parameter:", method);
|
|
799
|
-
console.log("handleCryptoSwap - selectedCryptoPaymentMethod state:", selectedCryptoPaymentMethod);
|
|
800
871
|
createOrder({
|
|
801
872
|
recipientAddress: effectiveRecipientAddress,
|
|
802
873
|
orderType: "swap",
|
|
@@ -804,7 +875,11 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
804
875
|
dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
|
|
805
876
|
srcToken: selectedSrcToken,
|
|
806
877
|
dstToken: isBuyMode
|
|
807
|
-
? {
|
|
878
|
+
? {
|
|
879
|
+
...selectedDstToken,
|
|
880
|
+
chainId: destinationTokenChainId,
|
|
881
|
+
address: destinationTokenAddress,
|
|
882
|
+
}
|
|
808
883
|
: selectedDstToken,
|
|
809
884
|
srcAmount: srcAmountBigInt.toString(),
|
|
810
885
|
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount || "0",
|
|
@@ -1121,6 +1196,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
1121
1196
|
const authView = ((0, jsx_runtime_1.jsx)("div", { className: "mx-auto w-full max-w-[460px]", children: (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: baseChain, onSuccess: async () => {
|
|
1122
1197
|
// isAuthenticated will be true at this point — the useEffect below handles navigation
|
|
1123
1198
|
} }) }));
|
|
1199
|
+
const pureTransferAddressView = ((0, jsx_runtime_1.jsx)(PureTransferView_1.PureTransferView, { mode: mode, recipientAddress: effectiveRecipientAddress ?? "", chainId: selectedSrcChainId, token: selectedSrcToken, displayAmount: srcAmount && srcAmount !== "0" ? `${srcAmount} ${selectedSrcToken.symbol}` : undefined, isActive: activePanel === PanelView.PURE_TRANSFER_ADDRESS, onBack: navigateBack, onClose: () => setB3ModalOpen(false), onTransferDetected: () => onSuccess?.() }));
|
|
1124
1200
|
// Add tabs to the main component when no order is loaded
|
|
1125
1201
|
return ((0, jsx_runtime_1.jsx)(react_2.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: classes?.container ||
|
|
1126
1202
|
(0, cn_1.cn)("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
|
|
@@ -1156,5 +1232,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
1156
1232
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: directTransferSuccessView }, "direct-transfer-success-view"),
|
|
1157
1233
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: kycView }, "fiat-kyc-view"),
|
|
1158
1234
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: authView }, "fiat-auth-view"),
|
|
1235
|
+
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: pureTransferAddressView }, "pure-transfer-address-view"),
|
|
1159
1236
|
] }) }) }));
|
|
1160
1237
|
}
|
|
@@ -67,15 +67,10 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
67
67
|
// Check if source and destination are the same token on the same chain
|
|
68
68
|
const isSameChainSameToken = (0, react_4.useMemo)(() => {
|
|
69
69
|
return (effectivePaymentType === "crypto" &&
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
selectedSrcChainId,
|
|
75
|
-
selectedDstChainId,
|
|
76
|
-
selectedSrcToken?.address,
|
|
77
|
-
selectedDstToken?.address,
|
|
78
|
-
]);
|
|
70
|
+
selectedSrcToken != null &&
|
|
71
|
+
selectedDstToken != null &&
|
|
72
|
+
(0, utils_1.isSameChainAndToken)(selectedSrcChainId, selectedSrcToken.address, selectedDstChainId, selectedDstToken.address));
|
|
73
|
+
}, [effectivePaymentType, selectedSrcChainId, selectedDstChainId, selectedSrcToken, selectedDstToken]);
|
|
79
74
|
// Check if this is a direct transfer
|
|
80
75
|
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
81
76
|
// State for direct transfer success
|
|
@@ -254,7 +249,10 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
254
249
|
(0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) })) }), gasPriceData && !isLoadingGas && effectivePaymentType === "crypto" && !isDirectTransfer && ((0, jsx_runtime_1.jsx)(GasIndicator_1.GasIndicator, { gasPrice: gasPriceData, className: classes?.gasIndicator || "mt-2 w-full" })), mainFooter ? mainFooter : null] }));
|
|
255
250
|
const handleCryptoOrder = async () => {
|
|
256
251
|
try {
|
|
257
|
-
|
|
252
|
+
// TRANSFER_CRYPTO is the manual deposit-address flow — no connected wallet to send from.
|
|
253
|
+
const isDirectTransfer = isSameChainSameToken &&
|
|
254
|
+
allowDirectTransfer &&
|
|
255
|
+
effectiveCryptoPaymentMethod !== CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO;
|
|
258
256
|
if (!isDirectTransfer) {
|
|
259
257
|
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
260
258
|
}
|
|
@@ -41,6 +41,13 @@ export interface AnySpendDepositProps {
|
|
|
41
41
|
destinationTokenAddress: string;
|
|
42
42
|
/** The destination chain ID */
|
|
43
43
|
destinationTokenChainId: number;
|
|
44
|
+
/**
|
|
45
|
+
* When false, the destination token is user-selectable even though a default destination token is
|
|
46
|
+
* provided (the provided destination is used only as the initial/default value). Used by the
|
|
47
|
+
* wallet-funding deposit flow so the user can change the receive token away from the default
|
|
48
|
+
* (Base USDC). Defaults to true (locked destination, current behavior). Does not affect the
|
|
49
|
+
* QR/pure-transfer path. */
|
|
50
|
+
lockDestinationToken?: boolean;
|
|
44
51
|
/** Callback when deposit succeeds */
|
|
45
52
|
onSuccess?: (amount: string) => void;
|
|
46
53
|
/** Callback for opening a custom modal (e.g., for special token handling) */
|
|
@@ -77,8 +84,6 @@ export interface AnySpendDepositProps {
|
|
|
77
84
|
showFiatOption?: boolean;
|
|
78
85
|
/** Custom list of supported chains. If not provided, uses default chains */
|
|
79
86
|
supportedChains?: ChainConfig[];
|
|
80
|
-
/** Minimum pool size for filtering tokens (default: 1,000,000) */
|
|
81
|
-
minPoolSize?: number;
|
|
82
87
|
/** Custom title for chain selection step */
|
|
83
88
|
chainSelectionTitle?: string;
|
|
84
89
|
/** Custom description for chain selection step */
|
|
@@ -102,6 +107,13 @@ export interface AnySpendDepositProps {
|
|
|
102
107
|
classes?: AnySpendAllClasses;
|
|
103
108
|
/** When true, allows direct transfer without swap if source and destination token/chain are the same */
|
|
104
109
|
allowDirectTransfer?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* When true, the QR-deposit path is a PURE TRANSFER: the destination token/chain
|
|
112
|
+
* mirror whatever source token the user selects, so the exact token they send lands
|
|
113
|
+
* in their wallet on the same chain (no swap/bridge). Forwarded to QRDeposit.
|
|
114
|
+
* Defaults to false.
|
|
115
|
+
*/
|
|
116
|
+
pureTransferOnly?: boolean;
|
|
105
117
|
/** Fixed destination token amount (in wei/smallest unit). When provided, user cannot change the amount. */
|
|
106
118
|
destinationTokenAmount?: string;
|
|
107
119
|
/** Opaque metadata passed to the order for callbacks (e.g., workflow form data) */
|
|
@@ -150,4 +162,4 @@ export interface AnySpendDepositProps {
|
|
|
150
162
|
* onSuccess={(amount) => console.log(`Deposited ${amount}`)}
|
|
151
163
|
* />
|
|
152
164
|
*/
|
|
153
|
-
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains,
|
|
165
|
+
export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, lockDestinationToken, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, showFiatOption, supportedChains, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, pureTransferOnly, destinationTokenAmount, callbackMetadata, senderAddress, slots, content, theme, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
|