@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
|
@@ -5,10 +5,10 @@ import { useAnyspendCreateOrder } from "../../../../anyspend/react/hooks/useAnys
|
|
|
5
5
|
import { useAnyspendOrderAndTransactions } from "../../../../anyspend/react/hooks/useAnyspendOrderAndTransactions.js";
|
|
6
6
|
import { useCreateDepositFirstOrder } from "../../../../anyspend/react/hooks/useCreateDepositFirstOrder.js";
|
|
7
7
|
import { useOnOrderSuccess } from "../../../../anyspend/react/hooks/useOnOrderSuccess.js";
|
|
8
|
-
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds } from "../../../../anyspend/index.js";
|
|
9
|
-
import { getPaymentUrl } from "../../../../anyspend/utils/chain.js";
|
|
8
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, getAvailableChainIds, isSameChainAndToken, } from "../../../../anyspend/index.js";
|
|
9
|
+
import { getPaymentUrl, toRegistryChainId } from "../../../../anyspend/utils/chain.js";
|
|
10
10
|
import { isNativeToken } from "../../../../anyspend/utils/token.js";
|
|
11
|
-
import { useAccountWallet, useIsMobile,
|
|
11
|
+
import { useAccountWallet, useIsMobile, usePortfolioTokenBalance, useTokenData, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
12
12
|
import { ShinyButton, TextShimmer } from "../../../../global-account/react/index.js";
|
|
13
13
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
14
14
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
@@ -51,9 +51,8 @@ export function CryptoPayPanel({ recipientAddress, destinationTokenAddress, dest
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}, [selectedSrcToken, dstTokenData, destinationTokenAddress, destinationTokenChainId]);
|
|
54
|
-
const isSameToken = selectedSrcToken &&
|
|
55
|
-
selectedSrcToken.address
|
|
56
|
-
selectedSrcToken.chainId === destinationTokenChainId;
|
|
54
|
+
const isSameToken = selectedSrcToken !== null &&
|
|
55
|
+
isSameChainAndToken(selectedSrcToken.chainId, selectedSrcToken.address, destinationTokenChainId, destinationTokenAddress);
|
|
57
56
|
const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote({
|
|
58
57
|
type: "swap",
|
|
59
58
|
srcChain: selectedSrcChainId,
|
|
@@ -68,13 +67,17 @@ export function CryptoPayPanel({ recipientAddress, destinationTokenAddress, dest
|
|
|
68
67
|
? "native"
|
|
69
68
|
: selectedSrcToken.address
|
|
70
69
|
: undefined;
|
|
71
|
-
|
|
70
|
+
// `selectedSrcChainId` is Relay-numbered; balance rows are keyed by the chain registry's id.
|
|
71
|
+
const { data: balanceRow, isError: isBalanceError } = usePortfolioTokenBalance(effectiveAddress, tokenAddress, toRegistryChainId(selectedSrcChainId));
|
|
72
72
|
const balance = useMemo(() => {
|
|
73
|
-
|
|
74
|
-
if (!b?.amount)
|
|
73
|
+
if (!balanceRow?.amount)
|
|
75
74
|
return { raw: BigInt(0), formatted: "0", decimals: 18 };
|
|
76
|
-
return {
|
|
77
|
-
|
|
75
|
+
return {
|
|
76
|
+
raw: BigInt(balanceRow.amount),
|
|
77
|
+
formatted: formatTokenAmount(BigInt(balanceRow.amount), balanceRow.decimals),
|
|
78
|
+
decimals: balanceRow.decimals,
|
|
79
|
+
};
|
|
80
|
+
}, [balanceRow]);
|
|
78
81
|
const srcAmount = useMemo(() => {
|
|
79
82
|
if (isSameToken)
|
|
80
83
|
return totalAmount;
|
|
@@ -85,7 +88,9 @@ export function CryptoPayPanel({ recipientAddress, destinationTokenAddress, dest
|
|
|
85
88
|
return "0";
|
|
86
89
|
return formatTokenAmount(BigInt(srcAmount || "0"), selectedSrcToken.decimals || 18);
|
|
87
90
|
}, [srcAmount, selectedSrcToken]);
|
|
88
|
-
|
|
91
|
+
// A failed balance read must not masquerade as a shortfall: it would disable Pay and tell a
|
|
92
|
+
// funded user they are short. Unknown blocks auto-pay but leaves the manual path open.
|
|
93
|
+
const hasEnoughBalance = !isBalanceError && balance.raw >= BigInt(srcAmount || "0");
|
|
89
94
|
/* ------------------------------------------------------------------ */
|
|
90
95
|
/* Destination token object (shared by both flows) */
|
|
91
96
|
/* ------------------------------------------------------------------ */
|
|
@@ -314,7 +319,7 @@ export function CryptoPayPanel({ recipientAddress, destinationTokenAddress, dest
|
|
|
314
319
|
}, [shouldAutoPay, connectedAddress, selectedSrcToken, hasEnoughBalance, isLoadingAnyspendQuote, handleWalletPay]);
|
|
315
320
|
const isLoading = isLoadingAnyspendQuote;
|
|
316
321
|
const isPending = isCreatingSwapOrder || isSendingDeposit || isWaitingForExecution;
|
|
317
|
-
const canPay = connectedAddress && selectedSrcToken && hasEnoughBalance && !isLoading && !isPending;
|
|
322
|
+
const canPay = connectedAddress && selectedSrcToken && (hasEnoughBalance || isBalanceError) && !isLoading && !isPending;
|
|
318
323
|
const chainName = ALL_CHAINS[selectedSrcChainId]?.name || "the specified chain";
|
|
319
324
|
const chainLogoUrl = ALL_CHAINS[selectedSrcChainId]?.logoUrl;
|
|
320
325
|
// Collapse QR on mobile when a wallet connector is available
|
|
@@ -333,7 +338,9 @@ export function CryptoPayPanel({ recipientAddress, destinationTokenAddress, dest
|
|
|
333
338
|
name: token.name,
|
|
334
339
|
symbol: token.symbol,
|
|
335
340
|
});
|
|
336
|
-
}, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: _jsxs("button", { className: cn("flex w-full items-center justify-between rounded-xl border border-gray-200 bg-white px-4 py-3 transition-colors hover:border-gray-300 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:border-neutral-600", classes?.tokenSelector), children: [selectedSrcToken ? (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[selectedSrcToken.chainId]?.logoUrl || "", tokenUrl: selectedSrcToken.metadata?.logoURI, className: "h-8 w-8" }), _jsxs("div", { className: "text-left", children: [_jsx("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: selectedSrcToken.symbol }), _jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: ["Balance: ", balance.formatted] })] })] })) : (_jsx("span", { className: "text-sm text-gray-400", children: "Select token" })), _jsx(ChevronsUpDown, { className: "h-4 w-4 text-gray-400" })] }) })] }), _jsx(motion.div, { initial: { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: cn("rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800/50", classes?.quoteDisplay), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "You pay" }), _jsx(AnimatePresence, { mode: "wait", children: isLoadingAnyspendQuote ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, children: _jsx(TextShimmer, { duration: 1, className: "text-sm", children: "Fetching quote..." }) }, "quote-loading")) : (_jsxs(motion.span, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: [srcAmountFormatted, " ", selectedSrcToken?.symbol || ""] }, "quote-amount")) })] }) }), _jsx(AnimatePresence, { children: connectedAddress && selectedSrcToken && !hasEnoughBalance && !isLoading && (
|
|
341
|
+
}, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: _jsxs("button", { className: cn("flex w-full items-center justify-between rounded-xl border border-gray-200 bg-white px-4 py-3 transition-colors hover:border-gray-300 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:border-neutral-600", classes?.tokenSelector), children: [selectedSrcToken ? (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[selectedSrcToken.chainId]?.logoUrl || "", tokenUrl: selectedSrcToken.metadata?.logoURI, className: "h-8 w-8" }), _jsxs("div", { className: "text-left", children: [_jsx("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: selectedSrcToken.symbol }), _jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: ["Balance: ", balance.formatted] })] })] })) : (_jsx("span", { className: "text-sm text-gray-400", children: "Select token" })), _jsx(ChevronsUpDown, { className: "h-4 w-4 text-gray-400" })] }) })] }), _jsx(motion.div, { initial: { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: cn("rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800/50", classes?.quoteDisplay), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "You pay" }), _jsx(AnimatePresence, { mode: "wait", children: isLoadingAnyspendQuote ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, children: _jsx(TextShimmer, { duration: 1, className: "text-sm", children: "Fetching quote..." }) }, "quote-loading")) : (_jsxs(motion.span, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: [srcAmountFormatted, " ", selectedSrcToken?.symbol || ""] }, "quote-amount")) })] }) }), _jsx(AnimatePresence, { children: connectedAddress && selectedSrcToken && !hasEnoughBalance && !isLoading && (_jsx(motion.p, { initial: { opacity: 0, height: 0 }, animate: { opacity: 1, height: "auto" }, exit: { opacity: 0, height: 0 }, transition: { duration: 0.2, ease: "easeOut" }, className: `text-center text-sm ${isBalanceError ? "text-as-primary/50" : "text-red-500"}`, children: isBalanceError
|
|
342
|
+
? `Couldn't check your ${selectedSrcToken.symbol} balance`
|
|
343
|
+
: `Insufficient ${selectedSrcToken.symbol} balance` }, "balance-warning")) }), !connectedAddress ? (_jsx(ShinyButton, { accentColor: themeColor || "hsl(var(--as-brand))", onClick: handleConnectWallet, className: cn("w-full", classes?.payButton), textClassName: "text-white", children: "Connect Wallet to Pay" })) : (_jsx(ShinyButton, { accentColor: themeColor || "hsl(var(--as-brand))", onClick: handleWalletPay, disabled: !canPay, className: cn("w-full", classes?.payButton), textClassName: cn(!canPay ? "text-as-secondary" : "text-white"), children: isPending ? (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), isCreatingSwapOrder
|
|
337
344
|
? "Creating order..."
|
|
338
345
|
: isSendingDeposit
|
|
339
346
|
? "Confirm in wallet..."
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { components } from "../../../../anyspend/types/api";
|
|
2
|
+
import type { TransferResult } from "../../hooks/useWatchTransfer";
|
|
3
|
+
export interface PureTransferViewProps {
|
|
4
|
+
mode?: "modal" | "page";
|
|
5
|
+
/** The recipient address where funds will land (the user's own wallet) */
|
|
6
|
+
recipientAddress: string;
|
|
7
|
+
/** Chain ID to watch on */
|
|
8
|
+
chainId: number;
|
|
9
|
+
/** Token the user sends — drives the QR code and balance watcher */
|
|
10
|
+
token: components["schemas"]["Token"];
|
|
11
|
+
/** Human-readable amount to display (display-only; skip row if empty or "0") */
|
|
12
|
+
displayAmount?: string;
|
|
13
|
+
/** Whether this panel is the currently active panel; gates the balance watcher */
|
|
14
|
+
isActive?: boolean;
|
|
15
|
+
/** Callback when back chevron is clicked */
|
|
16
|
+
onBack?: () => void;
|
|
17
|
+
/** Callback when X close button is clicked */
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
/** Callback when an incoming transfer is detected */
|
|
20
|
+
onTransferDetected?: (result: TransferResult) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A self-contained view that shows the recipient address as a QR code + copy button and
|
|
24
|
+
* watches for an incoming same-chain/same-token transfer via `useWatchTransfer`. When a
|
|
25
|
+
* transfer is detected it renders `TransferResultScreen`.
|
|
26
|
+
*
|
|
27
|
+
* This is the "TRANSFER_CRYPTO" path for same-token AnySpend deposits — no relayer order,
|
|
28
|
+
* no fee; the user simply sends the token directly to their own address.
|
|
29
|
+
*/
|
|
30
|
+
export declare function PureTransferView({ mode, recipientAddress, chainId, token, displayAmount, isActive, onBack, onClose, onTransferDetected, }: PureTransferViewProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { getChainName, getPaymentUrl, ZERO_ADDRESS } from "../../../../anyspend/index.js";
|
|
4
|
+
import { CopyToClipboard } from "../../../../global-account/react/index.js";
|
|
5
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
6
|
+
import { ChevronLeft, Loader2, X } from "lucide-react";
|
|
7
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
8
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
9
|
+
import { useWatchTransfer } from "../../hooks/useWatchTransfer.js";
|
|
10
|
+
import { ChainWarningText, WarningText } from "./WarningText.js";
|
|
11
|
+
import { TransferResultScreen } from "./TransferResultScreen.js";
|
|
12
|
+
/**
|
|
13
|
+
* A self-contained view that shows the recipient address as a QR code + copy button and
|
|
14
|
+
* watches for an incoming same-chain/same-token transfer via `useWatchTransfer`. When a
|
|
15
|
+
* transfer is detected it renders `TransferResultScreen`.
|
|
16
|
+
*
|
|
17
|
+
* This is the "TRANSFER_CRYPTO" path for same-token AnySpend deposits — no relayer order,
|
|
18
|
+
* no fee; the user simply sends the token directly to their own address.
|
|
19
|
+
*/
|
|
20
|
+
export function PureTransferView({ mode = "modal", recipientAddress, chainId, token, displayAmount, isActive, onBack, onClose, onTransferDetected, }) {
|
|
21
|
+
const [transferResult, setTransferResult] = useState(null);
|
|
22
|
+
// Fix 4: reset transferResult when the panel becomes active again
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (isActive)
|
|
25
|
+
setTransferResult(null);
|
|
26
|
+
}, [isActive]);
|
|
27
|
+
// Fix 3: stabilize the callback so it doesn't re-run the watcher effect every render
|
|
28
|
+
const handleTransferDetected = useCallback((result) => {
|
|
29
|
+
setTransferResult(result);
|
|
30
|
+
onTransferDetected?.(result);
|
|
31
|
+
}, [onTransferDetected]);
|
|
32
|
+
const { isWatching } = useWatchTransfer({
|
|
33
|
+
address: recipientAddress,
|
|
34
|
+
chainId,
|
|
35
|
+
tokenAddress: token.address,
|
|
36
|
+
tokenDecimals: token.decimals,
|
|
37
|
+
// Fix 1: also require a non-empty recipient before enabling the watcher
|
|
38
|
+
enabled: !!recipientAddress && !transferResult && isActive,
|
|
39
|
+
onTransferDetected: handleTransferDetected,
|
|
40
|
+
});
|
|
41
|
+
// Fix 2: guard qrValue when recipientAddress is empty
|
|
42
|
+
const qrValue = useMemo(() => recipientAddress
|
|
43
|
+
? getPaymentUrl(recipientAddress, undefined, token.address === ZERO_ADDRESS ? "ETH" : token.address, chainId, token.decimals)
|
|
44
|
+
: "", [recipientAddress, token.address, token.decimals, chainId]);
|
|
45
|
+
const chainName = useMemo(() => {
|
|
46
|
+
try {
|
|
47
|
+
return getChainName(chainId);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return "the specified chain";
|
|
51
|
+
}
|
|
52
|
+
}, [chainId]);
|
|
53
|
+
// Guard: if no address yet, render nothing
|
|
54
|
+
if (!recipientAddress)
|
|
55
|
+
return null;
|
|
56
|
+
// Once a transfer is detected, hand off to the shared success screen
|
|
57
|
+
if (transferResult) {
|
|
58
|
+
return (_jsx(TransferResultScreen, { mode: mode, transferResult: transferResult, token: token, chainId: chainId, recipientAddress: recipientAddress, onBack: onBack, onClose: onClose }));
|
|
59
|
+
}
|
|
60
|
+
return (_jsx("div", { className: cn("anyspend-container anyspend-pure-transfer font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6"), children: _jsxs("div", { className: "anyspend-pure-transfer-content flex flex-col gap-4", children: [_jsxs("div", { className: "anyspend-pure-transfer-header flex items-center justify-between", children: [onBack ? (_jsx("button", { onClick: onBack, className: "anyspend-pure-transfer-back text-as-secondary hover:text-as-primary", "aria-label": "Go back", children: _jsx(ChevronLeft, { className: "h-5 w-5" }) })) : (_jsx("div", { className: "w-5" })), _jsxs("h2", { className: "anyspend-pure-transfer-title text-as-primary text-base font-semibold", children: ["Send ", token.symbol] }), onClose ? (_jsx("button", { onClick: onClose, className: "anyspend-pure-transfer-close text-as-secondary hover:text-as-primary", "aria-label": "Close", children: _jsx(X, { className: "h-5 w-5" }) })) : (_jsx("div", { className: "w-5" }))] }), displayAmount && (_jsx("div", { className: "anyspend-pure-transfer-amount-badge border-as-border-secondary bg-as-surface-secondary flex items-center justify-center rounded-xl border px-4 py-2", children: _jsx("span", { className: "text-as-primary text-sm font-medium", children: displayAmount }) })), _jsxs("div", { className: "anyspend-pure-transfer-qr-content border-as-stroke flex items-start gap-4 rounded-xl border p-4", children: [_jsxs("div", { className: "anyspend-pure-transfer-qr-code-container flex flex-col items-center gap-2", children: [_jsx("div", { className: "anyspend-pure-transfer-qr-code rounded-lg bg-white p-2", children: _jsx(QRCodeSVG, { value: qrValue, size: 120, level: "M", marginSize: 0 }) }), _jsxs("span", { className: "anyspend-pure-transfer-qr-scan-hint text-as-secondary text-xs", children: ["SCAN WITH ", _jsx("span", { className: "inline-block", children: "\uD83E\uDD8A" })] })] }), _jsxs("div", { className: "anyspend-pure-transfer-address-container flex flex-1 flex-col gap-1", children: [_jsx("span", { className: "anyspend-pure-transfer-address-label text-as-secondary text-sm", children: "Deposit address:" }), _jsxs("div", { className: "anyspend-pure-transfer-address-row flex items-start gap-1", children: [_jsx("span", { className: "anyspend-pure-transfer-address text-as-primary break-all font-mono text-sm leading-relaxed", children: recipientAddress }), _jsx(CopyToClipboard, { text: recipientAddress, className: "anyspend-pure-transfer-copy-icon text-as-secondary hover:text-as-primary mt-0.5 shrink-0" })] })] })] }), _jsx(ChainWarningText, { chainId: chainId }), _jsxs(WarningText, { children: ["Only send ", token.symbol, " on ", chainName, ". Other tokens will not be converted."] }), isWatching && (_jsxs("div", { className: "anyspend-pure-transfer-watching bg-as-brand/10 flex items-center justify-center gap-2 rounded-lg p-3", children: [_jsx(Loader2, { className: "text-as-brand h-4 w-4 animate-spin" }), _jsx("span", { className: "text-as-brand text-sm", children: "Watching for incoming transfer..." })] })), _jsx(CopyToClipboard, { text: recipientAddress, children: _jsx("button", { className: "anyspend-pure-transfer-copy-button bg-as-brand hover:bg-as-brand/90 flex w-full items-center justify-center gap-2 rounded-xl py-3.5 font-medium text-white transition-all", children: "Copy deposit address" }) })] }) }));
|
|
61
|
+
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getNativeRequired } from "../../../../anyspend/utils/chain.js";
|
|
2
|
+
import { getNativeRequired, toRegistryChainId } from "../../../../anyspend/utils/chain.js";
|
|
3
3
|
import { isNativeToken } from "../../../../anyspend/utils/token.js";
|
|
4
|
-
import {
|
|
4
|
+
import { usePortfolioTokenBalance } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
6
6
|
import { useMemo } from "react";
|
|
7
7
|
import { formatUnits } from "viem";
|
|
8
8
|
export function TokenBalance({ token, walletAddress, onChangeInput, }) {
|
|
9
|
-
|
|
10
|
-
const { data, isLoading } =
|
|
9
|
+
// `token.chainId` is Relay-numbered; balance rows are keyed by the chain registry's id.
|
|
10
|
+
const { data: balance, isLoading, isError, } = usePortfolioTokenBalance(walletAddress, token.address, toRegistryChainId(token.chainId));
|
|
11
11
|
const { rawBalance, formattedBalance } = useMemo(() => {
|
|
12
|
-
const balance = data?.balances?.[0];
|
|
13
12
|
if (!balance?.amount) {
|
|
14
13
|
return { rawBalance: null, formattedBalance: "0" };
|
|
15
14
|
}
|
|
@@ -18,7 +17,7 @@ export function TokenBalance({ token, walletAddress, onChangeInput, }) {
|
|
|
18
17
|
rawBalance: raw,
|
|
19
18
|
formattedBalance: formatTokenAmount(raw, balance.decimals),
|
|
20
19
|
};
|
|
21
|
-
}, [
|
|
20
|
+
}, [balance]);
|
|
22
21
|
const handlePercentageClick = (percentage) => {
|
|
23
22
|
if (!rawBalance)
|
|
24
23
|
return;
|
|
@@ -42,5 +41,5 @@ export function TokenBalance({ token, walletAddress, onChangeInput, }) {
|
|
|
42
41
|
}
|
|
43
42
|
onChangeInput(formatUnits(amount, token.decimals));
|
|
44
43
|
};
|
|
45
|
-
return (_jsx("div", { className: "flex h-7 items-center justify-end gap-1", children: !isLoading && (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-as-primary/50 inline-flex rounded-lg text-sm", children: rawBalance ? `Balance: ${formattedBalance}` : `Balance: 0` }), !!rawBalance && (_jsx(_Fragment, { children: _jsx("button", { onClick: () => handlePercentageClick(100), className: "text-as-primary/50 bg-as-on-surface-2 hover:bg-as-on-surface-3 inline-flex cursor-pointer rounded-lg px-2 py-1 text-xs transition-colors", children: "MAX" }) }))] })) }, `balance-${token.address}-${token.chainId}`));
|
|
44
|
+
return (_jsx("div", { className: "flex h-7 items-center justify-end gap-1", children: !isLoading && (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-as-primary/50 inline-flex rounded-lg text-sm", children: isError ? "Balance: —" : rawBalance ? `Balance: ${formattedBalance}` : `Balance: 0` }), !!rawBalance && (_jsx(_Fragment, { children: _jsx("button", { onClick: () => handlePercentageClick(100), className: "text-as-primary/50 bg-as-on-surface-2 hover:bg-as-on-surface-3 inline-flex cursor-pointer rounded-lg px-2 py-1 text-xs transition-colors", children: "MAX" }) }))] })) }, `balance-${token.address}-${token.chainId}`));
|
|
46
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
import { CreateOrderResponse } from "../../../anyspend/types/api_req_res";
|
|
3
|
-
import { DepositContractConfig } from "../components/AnySpendDeposit";
|
|
1
|
+
import type { components } from "../../../anyspend/types/api";
|
|
2
|
+
import type { CreateOrderResponse } from "../../../anyspend/types/api_req_res";
|
|
3
|
+
import type { DepositContractConfig } from "../components/AnySpendDeposit";
|
|
4
4
|
export type CreateDepositFirstOrderParams = {
|
|
5
5
|
recipientAddress: string;
|
|
6
6
|
srcChain: number;
|
|
@@ -10,9 +10,9 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
|
|
|
10
10
|
description?: string | undefined;
|
|
11
11
|
status?: "ACTIVE" | "INACTIVE" | "DRAFT" | undefined;
|
|
12
12
|
metadata?: {} | undefined;
|
|
13
|
+
logoURI?: string | undefined;
|
|
13
14
|
createdAt?: string | undefined;
|
|
14
15
|
updatedAt?: string | undefined;
|
|
15
|
-
logoURI?: string | undefined;
|
|
16
16
|
creator?: string | undefined;
|
|
17
17
|
signatureRequestBody?: {
|
|
18
18
|
currency?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { isSolanaAddress } from "@b3/chain-registry/runtime";
|
|
2
|
+
export { isSolanaAddress };
|
|
2
3
|
export declare function isEvmOrSolanaAddress(address: string): boolean;
|
|
3
4
|
/**
|
|
4
5
|
* Check if an address is Hyperliquid's special USDC address.
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
import { chainTypeForIdentifier, isSolanaAddress } from "@b3/chain-registry/runtime";
|
|
1
2
|
import { isAddress } from "viem";
|
|
3
|
+
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "../constants/index.js";
|
|
2
4
|
import { HYPERLIQUID_CHAIN_ID } from "./token.js";
|
|
3
|
-
export
|
|
4
|
-
// Solana addresses are 32-byte base58 strings (usually 32-44 characters)
|
|
5
|
-
const solanaAddressRegex = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
6
|
-
return solanaAddressRegex.test(address);
|
|
7
|
-
}
|
|
5
|
+
export { isSolanaAddress };
|
|
8
6
|
export function isEvmOrSolanaAddress(address) {
|
|
9
7
|
return isAddress(address) || isSolanaAddress(address);
|
|
10
8
|
}
|
|
@@ -40,5 +38,10 @@ export function eqci(a, b) {
|
|
|
40
38
|
* When true, this is a pure transfer (no swap/bridge needed).
|
|
41
39
|
*/
|
|
42
40
|
export function isSameChainAndToken(sourceChainId, sourceTokenAddress, destinationChainId, destinationTokenAddress) {
|
|
43
|
-
|
|
41
|
+
if (sourceChainId !== destinationChainId)
|
|
42
|
+
return false;
|
|
43
|
+
if (chainTypeForIdentifier(String(sourceChainId)) === "solana" || sourceChainId === RELAY_SOLANA_MAINNET_CHAIN_ID) {
|
|
44
|
+
return sourceTokenAddress === destinationTokenAddress;
|
|
45
|
+
}
|
|
46
|
+
return sourceTokenAddress.toLowerCase() === destinationTokenAddress.toLowerCase();
|
|
44
47
|
}
|
|
@@ -45,7 +45,7 @@ export declare const hyperEVM: {
|
|
|
45
45
|
id: 999;
|
|
46
46
|
name: "HyperEVM";
|
|
47
47
|
nativeCurrency: {
|
|
48
|
-
readonly name: "
|
|
48
|
+
readonly name: "Hyperliquid";
|
|
49
49
|
readonly symbol: "HYPE";
|
|
50
50
|
readonly decimals: 18;
|
|
51
51
|
};
|
|
@@ -56,11 +56,73 @@ export declare const hyperEVM: {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
sourceId?: number | undefined | undefined;
|
|
59
|
+
supportsTransactionReplacementDetection?: boolean | undefined | undefined;
|
|
59
60
|
testnet?: boolean | undefined | undefined;
|
|
60
61
|
custom?: Record<string, unknown> | undefined;
|
|
62
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
61
63
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
62
64
|
formatters?: undefined;
|
|
65
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
66
|
+
client: import("viem").Client;
|
|
67
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
68
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
69
|
+
client: import("viem").Client;
|
|
70
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
71
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
72
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
73
|
+
}] | undefined;
|
|
63
74
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
75
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
76
|
+
};
|
|
77
|
+
export declare const plume: {
|
|
78
|
+
blockExplorers: {
|
|
79
|
+
readonly default: {
|
|
80
|
+
readonly name: "Plume Explorer";
|
|
81
|
+
readonly url: "https://explorer.plume.org";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
blockTime?: number | undefined | undefined;
|
|
85
|
+
contracts?: {
|
|
86
|
+
[x: string]: import("viem").ChainContract | {
|
|
87
|
+
[sourceId: number]: import("viem").ChainContract | undefined;
|
|
88
|
+
} | undefined;
|
|
89
|
+
ensRegistry?: import("viem").ChainContract | undefined;
|
|
90
|
+
ensUniversalResolver?: import("viem").ChainContract | undefined;
|
|
91
|
+
multicall3?: import("viem").ChainContract | undefined;
|
|
92
|
+
erc6492Verifier?: import("viem").ChainContract | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
ensTlds?: readonly string[] | undefined;
|
|
95
|
+
id: 98866;
|
|
96
|
+
name: "Plume";
|
|
97
|
+
nativeCurrency: {
|
|
98
|
+
readonly name: "Plume";
|
|
99
|
+
readonly symbol: "PLUME";
|
|
100
|
+
readonly decimals: 18;
|
|
101
|
+
};
|
|
102
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
103
|
+
rpcUrls: {
|
|
104
|
+
readonly default: {
|
|
105
|
+
readonly http: readonly ["https://rpc.plume.org"];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
sourceId?: number | undefined | undefined;
|
|
109
|
+
supportsTransactionReplacementDetection?: boolean | undefined | undefined;
|
|
110
|
+
testnet?: boolean | undefined | undefined;
|
|
111
|
+
custom?: Record<string, unknown> | undefined;
|
|
112
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
113
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
114
|
+
formatters?: undefined;
|
|
115
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
116
|
+
client: import("viem").Client;
|
|
117
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
118
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
119
|
+
client: import("viem").Client;
|
|
120
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
121
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
122
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
123
|
+
}] | undefined;
|
|
124
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
125
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
64
126
|
};
|
|
65
127
|
export declare const EVM_MAINNET: Record<number, IEVMChain>;
|
|
66
128
|
export declare const EVM_TESTNET: Record<number, IEVMChain>;
|
|
@@ -68,6 +130,14 @@ export declare const SOLANA_MAINNET: ISolanaChain;
|
|
|
68
130
|
export declare const HYPERLIQUID_MAINNET: IHyperliquidChain;
|
|
69
131
|
export declare const EVM_CHAINS: Record<number, IEVMChain>;
|
|
70
132
|
export declare const SOLANA_CHAINS: Record<number, ISolanaChain>;
|
|
133
|
+
/**
|
|
134
|
+
* Translate a Relay-numbered chain id into the id the chain registry uses.
|
|
135
|
+
*
|
|
136
|
+
* Relay numbers Solana 792703809; every other chain shares the universal EVM id. Balance rows are
|
|
137
|
+
* keyed by the registry's id, so handing Relay's number to a balance lookup matches nothing at all
|
|
138
|
+
* — and a funded Solana wallet then reads as empty rather than as unreadable.
|
|
139
|
+
*/
|
|
140
|
+
export declare function toRegistryChainId(chainId: number): number;
|
|
71
141
|
export declare const HYPERLIQUID_CHAINS: Record<number, IHyperliquidChain>;
|
|
72
142
|
export declare const ALL_CHAINS: Record<number, IBaseChain>;
|
|
73
143
|
export declare function getSolanaChains(network: "mainnet" | "testnet"): ISolanaChain;
|
|
@@ -90,6 +160,19 @@ export declare function getNativeToken(chainId: number): components["schemas"]["
|
|
|
90
160
|
export declare function isEvmChain(chainId: number): boolean;
|
|
91
161
|
export declare function isHyperliquidChain(chainId: number): boolean;
|
|
92
162
|
export declare function getHyperliquidChain(chainId: number): IHyperliquidChain;
|
|
163
|
+
/**
|
|
164
|
+
* Chains AnySpend no longer accepts orders on, as either source or destination.
|
|
165
|
+
*
|
|
166
|
+
* They stay in ALL_CHAINS on purpose. That map answers "what is this chain" — name, logo, token,
|
|
167
|
+
* decimals — which every order that ever existed still needs in order to render; removing an entry
|
|
168
|
+
* would make getChainName and friends throw on historical rows. Whether new orders are accepted is
|
|
169
|
+
* this separate question.
|
|
170
|
+
*
|
|
171
|
+
* anyspend-service imports this list rather than keeping its own, so the API and the chain picker
|
|
172
|
+
* can never disagree about what is on offer.
|
|
173
|
+
*/
|
|
174
|
+
export declare const DEPRECATED_CHAIN_IDS: readonly number[];
|
|
175
|
+
export declare function isDeprecatedChain(chainId?: number): boolean;
|
|
93
176
|
/**
|
|
94
177
|
* Get available chain IDs for AnySpend based on context (source or destination).
|
|
95
178
|
* Filters out chains that shouldn't be available for the given context.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "../../anyspend/constants/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { SOLANA_CHAIN_ID } from "../../shared/utils/zerionPositions.js";
|
|
3
|
+
import { ABSTRACT_PUBLIC_RPC, ARBITRUM_PUBLIC_RPC, AVALANCHE_PUBLIC_RPC, BASE_PUBLIC_RPC, BSC_PUBLIC_RPC, ETHEREUM_PUBLIC_RPC, HYPEREVM_PUBLIC_RPC, OPTIMISM_PUBLIC_RPC, PLUME_PUBLIC_RPC, POLYGON_PUBLIC_RPC, ROBINHOOD_PUBLIC_RPC, } from "../../anyspend/constants/rpc.js";
|
|
3
4
|
import { b3Viem } from "../../shared/constants/chains/b3Viem.js";
|
|
4
5
|
import invariant from "invariant";
|
|
5
6
|
import { createPublicClient, createWalletClient, defineChain, http, parseEther, } from "viem";
|
|
6
|
-
import { abstract, arbitrum, avalanche, base, bsc, mainnet, optimism, polygon } from "viem/chains";
|
|
7
|
+
import { abstract, arbitrum, avalanche, base, bsc, mainnet, optimism, polygon, robinhood } from "viem/chains";
|
|
7
8
|
import { ChainType } from "../types/chain.js";
|
|
8
|
-
import { getAvaxToken, getBnbToken, getEthToken, getHyperEVMNativeToken, getHyperliquidUSDCToken, getPolToken, getSolanaToken, HYPEREVM_CHAIN_ID, HYPERLIQUID_CHAIN_ID, } from "./token.js";
|
|
9
|
+
import { getAvaxToken, getBnbToken, getEthToken, getHyperEVMNativeToken, getHyperliquidUSDCToken, getPlumeNativeToken, getPolToken, getSolanaToken, HYPEREVM_CHAIN_ID, HYPERLIQUID_CHAIN_ID, PLUME_CHAIN_ID, } from "./token.js";
|
|
9
10
|
function getCustomEvmChain(chain, rpcUrl) {
|
|
10
11
|
return defineChain({ ...chain, rpcUrls: { default: { http: [rpcUrl] } } });
|
|
11
12
|
}
|
|
@@ -46,10 +47,17 @@ export function clearChainRpcOverrides() {
|
|
|
46
47
|
export const hyperEVM = defineChain({
|
|
47
48
|
id: HYPEREVM_CHAIN_ID,
|
|
48
49
|
name: "HyperEVM",
|
|
49
|
-
nativeCurrency: { name: "
|
|
50
|
+
nativeCurrency: { name: "Hyperliquid", symbol: "HYPE", decimals: 18 },
|
|
50
51
|
rpcUrls: { default: { http: [HYPEREVM_PUBLIC_RPC] } },
|
|
51
52
|
blockExplorers: { default: { name: "HyperEVM Explorer", url: "https://hyperevmscan.io/" } },
|
|
52
53
|
});
|
|
54
|
+
export const plume = defineChain({
|
|
55
|
+
id: PLUME_CHAIN_ID,
|
|
56
|
+
name: "Plume",
|
|
57
|
+
nativeCurrency: { name: "Plume", symbol: "PLUME", decimals: 18 },
|
|
58
|
+
rpcUrls: { default: { http: [PLUME_PUBLIC_RPC] } },
|
|
59
|
+
blockExplorers: { default: { name: "Plume Explorer", url: "https://explorer.plume.org" } },
|
|
60
|
+
});
|
|
53
61
|
// export const b4testnet = defineChain({
|
|
54
62
|
// id: 19934,
|
|
55
63
|
// name: "B4 Testnet",
|
|
@@ -207,6 +215,34 @@ export const EVM_MAINNET = {
|
|
|
207
215
|
coingeckoName: "hyperevm",
|
|
208
216
|
wethAddress: "0x5555555555555555555555555555555555555555",
|
|
209
217
|
},
|
|
218
|
+
[plume.id]: {
|
|
219
|
+
id: plume.id,
|
|
220
|
+
name: plume.name,
|
|
221
|
+
logoUrl: "https://cdn.b3.fun/b3os-icons/plume.svg",
|
|
222
|
+
type: ChainType.EVM,
|
|
223
|
+
nativeRequired: parseEther("5"), // 5 PLUME ≈ $0.06 — gas reserve; Plume gasPrice ~1000 gwei × 2.2M gas (approve+deposit) needs ~2.2 PLUME, +headroom for spikes
|
|
224
|
+
canDepositNative: true,
|
|
225
|
+
defaultToken: getPlumeNativeToken(),
|
|
226
|
+
nativeToken: getPlumeNativeToken(),
|
|
227
|
+
viem: plume,
|
|
228
|
+
pollingInterval: 1000, // 1 second for Plume (L2 fast blocks)
|
|
229
|
+
coingeckoName: "plume-network",
|
|
230
|
+
wethAddress: "0xea237441c92cae6fc17caaf9a7acb3f953be4bd1", // WPLUME (wrapped native)
|
|
231
|
+
},
|
|
232
|
+
[robinhood.id]: {
|
|
233
|
+
id: robinhood.id,
|
|
234
|
+
name: robinhood.name,
|
|
235
|
+
logoUrl: "https://assets.relay.link/icons/square/4663/light.png",
|
|
236
|
+
type: ChainType.EVM,
|
|
237
|
+
nativeRequired: parseEther("0.0001"),
|
|
238
|
+
canDepositNative: true,
|
|
239
|
+
defaultToken: getEthToken(robinhood.id),
|
|
240
|
+
nativeToken: getEthToken(robinhood.id),
|
|
241
|
+
viem: getCustomEvmChain(robinhood, ROBINHOOD_PUBLIC_RPC),
|
|
242
|
+
pollingInterval: 1000, // 1 second for Robinhood Chain (Arbitrum Orbit fast blocks)
|
|
243
|
+
coingeckoName: "robinhood",
|
|
244
|
+
wethAddress: "0x0bd7d308f8e1639fab988df18a8011f41eacad73", // wrapped native ETH (registry wrappedNative)
|
|
245
|
+
},
|
|
210
246
|
};
|
|
211
247
|
export const EVM_TESTNET = {
|
|
212
248
|
// [sepolia.id]: {
|
|
@@ -285,6 +321,16 @@ export const HYPERLIQUID_MAINNET = {
|
|
|
285
321
|
};
|
|
286
322
|
export const EVM_CHAINS = { ...EVM_MAINNET, ...EVM_TESTNET };
|
|
287
323
|
export const SOLANA_CHAINS = { [RELAY_SOLANA_MAINNET_CHAIN_ID]: SOLANA_MAINNET };
|
|
324
|
+
/**
|
|
325
|
+
* Translate a Relay-numbered chain id into the id the chain registry uses.
|
|
326
|
+
*
|
|
327
|
+
* Relay numbers Solana 792703809; every other chain shares the universal EVM id. Balance rows are
|
|
328
|
+
* keyed by the registry's id, so handing Relay's number to a balance lookup matches nothing at all
|
|
329
|
+
* — and a funded Solana wallet then reads as empty rather than as unreadable.
|
|
330
|
+
*/
|
|
331
|
+
export function toRegistryChainId(chainId) {
|
|
332
|
+
return chainId === RELAY_SOLANA_MAINNET_CHAIN_ID ? SOLANA_CHAIN_ID : chainId;
|
|
333
|
+
}
|
|
288
334
|
export const HYPERLIQUID_CHAINS = {
|
|
289
335
|
[HYPERLIQUID_CHAIN_ID]: HYPERLIQUID_MAINNET,
|
|
290
336
|
};
|
|
@@ -561,6 +607,24 @@ export function getHyperliquidChain(chainId) {
|
|
|
561
607
|
invariant(HYPERLIQUID_CHAINS[chainId], `Chain ${chainId} is not a Hyperliquid chain`);
|
|
562
608
|
return HYPERLIQUID_CHAINS[chainId];
|
|
563
609
|
}
|
|
610
|
+
/**
|
|
611
|
+
* Chains AnySpend no longer accepts orders on, as either source or destination.
|
|
612
|
+
*
|
|
613
|
+
* They stay in ALL_CHAINS on purpose. That map answers "what is this chain" — name, logo, token,
|
|
614
|
+
* decimals — which every order that ever existed still needs in order to render; removing an entry
|
|
615
|
+
* would make getChainName and friends throw on historical rows. Whether new orders are accepted is
|
|
616
|
+
* this separate question.
|
|
617
|
+
*
|
|
618
|
+
* anyspend-service imports this list rather than keeping its own, so the API and the chain picker
|
|
619
|
+
* can never disagree about what is on offer.
|
|
620
|
+
*/
|
|
621
|
+
export const DEPRECATED_CHAIN_IDS = [
|
|
622
|
+
8333, // B3
|
|
623
|
+
98866, // Plume
|
|
624
|
+
];
|
|
625
|
+
export function isDeprecatedChain(chainId) {
|
|
626
|
+
return chainId !== undefined && DEPRECATED_CHAIN_IDS.includes(chainId);
|
|
627
|
+
}
|
|
564
628
|
/**
|
|
565
629
|
* Get available chain IDs for AnySpend based on context (source or destination).
|
|
566
630
|
* Filters out chains that shouldn't be available for the given context.
|
|
@@ -576,7 +640,11 @@ export function getHyperliquidChain(chainId) {
|
|
|
576
640
|
* const destChains = getAvailableChainIds("to") // [1, 8453, 137, ..., 1337]
|
|
577
641
|
*/
|
|
578
642
|
export function getAvailableChainIds(context) {
|
|
579
|
-
|
|
643
|
+
// Deprecated chains are excluded from both directions: the API rejects them, so offering them in
|
|
644
|
+
// a picker would let a user select something that then fails at order creation.
|
|
645
|
+
const allChainIds = Object.values(ALL_CHAINS)
|
|
646
|
+
.map(chain => chain.id)
|
|
647
|
+
.filter(chainId => !isDeprecatedChain(chainId));
|
|
580
648
|
if (context === "from") {
|
|
581
649
|
// Hyperliquid is only supported as destination chain, not source chain
|
|
582
650
|
return allChainIds.filter(chainId => chainId !== HYPERLIQUID_CHAIN_ID);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { components } from "../../anyspend/types/api";
|
|
2
2
|
export declare const HYPERLIQUID_CHAIN_ID = 1337;
|
|
3
3
|
export declare const HYPEREVM_CHAIN_ID = 999;
|
|
4
|
+
export declare const PLUME_CHAIN_ID = 98866;
|
|
4
5
|
/**
|
|
5
6
|
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
6
7
|
* instead of the standard 42-character EVM address format.
|
|
@@ -15,3 +16,4 @@ export declare function getBnbToken(): components["schemas"]["Token"];
|
|
|
15
16
|
export declare function getAvaxToken(): components["schemas"]["Token"];
|
|
16
17
|
export declare function getHyperEVMNativeToken(): components["schemas"]["Token"];
|
|
17
18
|
export declare function getHyperliquidUSDCToken(): components["schemas"]["Token"];
|
|
19
|
+
export declare function getPlumeNativeToken(): components["schemas"]["Token"];
|
|
@@ -2,6 +2,7 @@ import { RELAY_SOL_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS } from "
|
|
|
2
2
|
import { avalanche, bsc, polygon } from "viem/chains";
|
|
3
3
|
export const HYPERLIQUID_CHAIN_ID = 1337;
|
|
4
4
|
export const HYPEREVM_CHAIN_ID = 999;
|
|
5
|
+
export const PLUME_CHAIN_ID = 98866;
|
|
5
6
|
/**
|
|
6
7
|
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
7
8
|
* instead of the standard 42-character EVM address format.
|
|
@@ -95,3 +96,15 @@ export function getHyperliquidUSDCToken() {
|
|
|
95
96
|
},
|
|
96
97
|
};
|
|
97
98
|
}
|
|
99
|
+
export function getPlumeNativeToken() {
|
|
100
|
+
return {
|
|
101
|
+
chainId: PLUME_CHAIN_ID,
|
|
102
|
+
address: ZERO_ADDRESS,
|
|
103
|
+
symbol: "PLUME",
|
|
104
|
+
name: "Plume",
|
|
105
|
+
decimals: 18,
|
|
106
|
+
metadata: {
|
|
107
|
+
logoURI: "https://cdn.b3.fun/b3os-icons/plume.svg",
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
package/dist/esm/app.shared.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { ClientApplication } from "@b3dotfun/b3-api";
|
|
2
2
|
import { AuthenticationClient } from "@feathersjs/authentication-client";
|
|
3
|
+
/** Default API URL derived from environment variables. */
|
|
3
4
|
export declare const B3_API_URL: string;
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Override the B3 API URL at runtime. Called by `B3Provider` when an
|
|
7
|
+
* `apiUrl` prop is provided. Pass `null` to revert to the default.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setB3ApiUrl(url: string | null): void;
|
|
10
|
+
/** Get the current B3 API URL (prefers runtime override, then env var). */
|
|
11
|
+
export declare function getB3ApiUrl(): string;
|
|
12
|
+
export declare const authenticate: (app: ClientApplication, accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
5
13
|
export declare class MyAuthenticationClient extends AuthenticationClient {
|
|
6
14
|
getFromLocation(location: any): Promise<any>;
|
|
7
15
|
}
|
package/dist/esm/app.shared.js
CHANGED
|
@@ -2,7 +2,24 @@ import { AuthenticationClient } from "@feathersjs/authentication-client";
|
|
|
2
2
|
import Cookies from "js-cookie";
|
|
3
3
|
import { B3_AUTH_COOKIE_NAME } from "./shared/constants/index.js";
|
|
4
4
|
import { getSessionDurationDays } from "./shared/utils/session-duration.js";
|
|
5
|
+
/** Default API URL derived from environment variables. */
|
|
5
6
|
export const B3_API_URL = process.env.EXPO_PUBLIC_B3_API || process.env.NEXT_PUBLIC_B3_API || process.env.PUBLIC_B3_API || "https://api.b3.fun";
|
|
7
|
+
/**
|
|
8
|
+
* Runtime-overridable API URL. Set by `B3Provider` when an `apiUrl` prop
|
|
9
|
+
* is provided. Falls back to the env-var-derived `B3_API_URL`.
|
|
10
|
+
*/
|
|
11
|
+
let _apiUrlOverride = null;
|
|
12
|
+
/**
|
|
13
|
+
* Override the B3 API URL at runtime. Called by `B3Provider` when an
|
|
14
|
+
* `apiUrl` prop is provided. Pass `null` to revert to the default.
|
|
15
|
+
*/
|
|
16
|
+
export function setB3ApiUrl(url) {
|
|
17
|
+
_apiUrlOverride = url;
|
|
18
|
+
}
|
|
19
|
+
/** Get the current B3 API URL (prefers runtime override, then env var). */
|
|
20
|
+
export function getB3ApiUrl() {
|
|
21
|
+
return _apiUrlOverride || B3_API_URL;
|
|
22
|
+
}
|
|
6
23
|
export const authenticate = async (app, accessToken, identityToken, params) => {
|
|
7
24
|
const fullToken = `${accessToken}+${identityToken}`;
|
|
8
25
|
// Do not authenticate if there is no token
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MMKV } from "react-native-mmkv";
|
|
2
2
|
export declare const localStoreInstance: MMKV;
|
|
3
3
|
declare const app: import("@b3dotfun/b3-api").ClientApplication;
|
|
4
|
-
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<
|
|
4
|
+
export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
5
5
|
export default app;
|