@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
|
@@ -54,9 +54,8 @@ function CryptoPayPanel({ recipientAddress, destinationTokenAddress, destination
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}, [selectedSrcToken, dstTokenData, destinationTokenAddress, destinationTokenChainId]);
|
|
57
|
-
const isSameToken = selectedSrcToken &&
|
|
58
|
-
selectedSrcToken.address
|
|
59
|
-
selectedSrcToken.chainId === destinationTokenChainId;
|
|
57
|
+
const isSameToken = selectedSrcToken !== null &&
|
|
58
|
+
(0, anyspend_1.isSameChainAndToken)(selectedSrcToken.chainId, selectedSrcToken.address, destinationTokenChainId, destinationTokenAddress);
|
|
60
59
|
const { anyspendQuote, isLoadingAnyspendQuote } = (0, useAnyspendQuote_1.useAnyspendQuote)({
|
|
61
60
|
type: "swap",
|
|
62
61
|
srcChain: selectedSrcChainId,
|
|
@@ -71,13 +70,17 @@ function CryptoPayPanel({ recipientAddress, destinationTokenAddress, destination
|
|
|
71
70
|
? "native"
|
|
72
71
|
: selectedSrcToken.address
|
|
73
72
|
: undefined;
|
|
74
|
-
|
|
73
|
+
// `selectedSrcChainId` is Relay-numbered; balance rows are keyed by the chain registry's id.
|
|
74
|
+
const { data: balanceRow, isError: isBalanceError } = (0, react_1.usePortfolioTokenBalance)(effectiveAddress, tokenAddress, (0, chain_1.toRegistryChainId)(selectedSrcChainId));
|
|
75
75
|
const balance = (0, react_4.useMemo)(() => {
|
|
76
|
-
|
|
77
|
-
if (!b?.amount)
|
|
76
|
+
if (!balanceRow?.amount)
|
|
78
77
|
return { raw: BigInt(0), formatted: "0", decimals: 18 };
|
|
79
|
-
return {
|
|
80
|
-
|
|
78
|
+
return {
|
|
79
|
+
raw: BigInt(balanceRow.amount),
|
|
80
|
+
formatted: (0, number_1.formatTokenAmount)(BigInt(balanceRow.amount), balanceRow.decimals),
|
|
81
|
+
decimals: balanceRow.decimals,
|
|
82
|
+
};
|
|
83
|
+
}, [balanceRow]);
|
|
81
84
|
const srcAmount = (0, react_4.useMemo)(() => {
|
|
82
85
|
if (isSameToken)
|
|
83
86
|
return totalAmount;
|
|
@@ -88,7 +91,9 @@ function CryptoPayPanel({ recipientAddress, destinationTokenAddress, destination
|
|
|
88
91
|
return "0";
|
|
89
92
|
return (0, number_1.formatTokenAmount)(BigInt(srcAmount || "0"), selectedSrcToken.decimals || 18);
|
|
90
93
|
}, [srcAmount, selectedSrcToken]);
|
|
91
|
-
|
|
94
|
+
// A failed balance read must not masquerade as a shortfall: it would disable Pay and tell a
|
|
95
|
+
// funded user they are short. Unknown blocks auto-pay but leaves the manual path open.
|
|
96
|
+
const hasEnoughBalance = !isBalanceError && balance.raw >= BigInt(srcAmount || "0");
|
|
92
97
|
/* ------------------------------------------------------------------ */
|
|
93
98
|
/* Destination token object (shared by both flows) */
|
|
94
99
|
/* ------------------------------------------------------------------ */
|
|
@@ -317,7 +322,7 @@ function CryptoPayPanel({ recipientAddress, destinationTokenAddress, destination
|
|
|
317
322
|
}, [shouldAutoPay, connectedAddress, selectedSrcToken, hasEnoughBalance, isLoadingAnyspendQuote, handleWalletPay]);
|
|
318
323
|
const isLoading = isLoadingAnyspendQuote;
|
|
319
324
|
const isPending = isCreatingSwapOrder || isSendingDeposit || isWaitingForExecution;
|
|
320
|
-
const canPay = connectedAddress && selectedSrcToken && hasEnoughBalance && !isLoading && !isPending;
|
|
325
|
+
const canPay = connectedAddress && selectedSrcToken && (hasEnoughBalance || isBalanceError) && !isLoading && !isPending;
|
|
321
326
|
const chainName = anyspend_1.ALL_CHAINS[selectedSrcChainId]?.name || "the specified chain";
|
|
322
327
|
const chainLogoUrl = anyspend_1.ALL_CHAINS[selectedSrcChainId]?.logoUrl;
|
|
323
328
|
// Collapse QR on mobile when a wallet connector is available
|
|
@@ -336,7 +341,9 @@ function CryptoPayPanel({ recipientAddress, destinationTokenAddress, destination
|
|
|
336
341
|
name: token.name,
|
|
337
342
|
symbol: token.symbol,
|
|
338
343
|
});
|
|
339
|
-
}, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)("button", { className: (0, cn_1.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 ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[selectedSrcToken.chainId]?.logoUrl || "", tokenUrl: selectedSrcToken.metadata?.logoURI, className: "h-8 w-8" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-left", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: selectedSrcToken.symbol }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: ["Balance: ", balance.formatted] })] })] })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-400", children: "Select token" })), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 text-gray-400" })] }) })] }), (0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: (0, cn_1.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: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "You pay" }), (0, jsx_runtime_1.jsx)(react_3.AnimatePresence, { mode: "wait", children: isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, children: (0, jsx_runtime_1.jsx)(react_2.TextShimmer, { duration: 1, className: "text-sm", children: "Fetching quote..." }) }, "quote-loading")) : ((0, jsx_runtime_1.jsxs)(react_3.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")) })] }) }), (0, jsx_runtime_1.jsx)(react_3.AnimatePresence, { children: connectedAddress && selectedSrcToken && !hasEnoughBalance && !isLoading && ((0, jsx_runtime_1.
|
|
344
|
+
}, supportedWalletVMs: ["evm", "svm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)("button", { className: (0, cn_1.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 ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[selectedSrcToken.chainId]?.logoUrl || "", tokenUrl: selectedSrcToken.metadata?.logoURI, className: "h-8 w-8" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-left", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: selectedSrcToken.symbol }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: ["Balance: ", balance.formatted] })] })] })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-400", children: "Select token" })), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 text-gray-400" })] }) })] }), (0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.25, ease: "easeOut" }, className: (0, cn_1.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: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "You pay" }), (0, jsx_runtime_1.jsx)(react_3.AnimatePresence, { mode: "wait", children: isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, children: (0, jsx_runtime_1.jsx)(react_2.TextShimmer, { duration: 1, className: "text-sm", children: "Fetching quote..." }) }, "quote-loading")) : ((0, jsx_runtime_1.jsxs)(react_3.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")) })] }) }), (0, jsx_runtime_1.jsx)(react_3.AnimatePresence, { children: connectedAddress && selectedSrcToken && !hasEnoughBalance && !isLoading && ((0, jsx_runtime_1.jsx)(react_3.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
|
|
345
|
+
? `Couldn't check your ${selectedSrcToken.symbol} balance`
|
|
346
|
+
: `Insufficient ${selectedSrcToken.symbol} balance` }, "balance-warning")) }), !connectedAddress ? ((0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: themeColor || "hsl(var(--as-brand))", onClick: handleConnectWallet, className: (0, cn_1.cn)("w-full", classes?.payButton), textClassName: "text-white", children: "Connect Wallet to Pay" })) : ((0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: themeColor || "hsl(var(--as-brand))", onClick: handleWalletPay, disabled: !canPay, className: (0, cn_1.cn)("w-full", classes?.payButton), textClassName: (0, cn_1.cn)(!canPay ? "text-as-secondary" : "text-white"), children: isPending ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), isCreatingSwapOrder
|
|
340
347
|
? "Creating order..."
|
|
341
348
|
: isSendingDeposit
|
|
342
349
|
? "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,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PureTransferView = PureTransferView;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const anyspend_1 = require("../../../../anyspend");
|
|
7
|
+
const react_1 = require("../../../../global-account/react");
|
|
8
|
+
const cn_1 = require("../../../../shared/utils/cn");
|
|
9
|
+
const lucide_react_1 = require("lucide-react");
|
|
10
|
+
const qrcode_react_1 = require("qrcode.react");
|
|
11
|
+
const react_2 = require("react");
|
|
12
|
+
const useWatchTransfer_1 = require("../../hooks/useWatchTransfer");
|
|
13
|
+
const WarningText_1 = require("./WarningText");
|
|
14
|
+
const TransferResultScreen_1 = require("./TransferResultScreen");
|
|
15
|
+
/**
|
|
16
|
+
* A self-contained view that shows the recipient address as a QR code + copy button and
|
|
17
|
+
* watches for an incoming same-chain/same-token transfer via `useWatchTransfer`. When a
|
|
18
|
+
* transfer is detected it renders `TransferResultScreen`.
|
|
19
|
+
*
|
|
20
|
+
* This is the "TRANSFER_CRYPTO" path for same-token AnySpend deposits — no relayer order,
|
|
21
|
+
* no fee; the user simply sends the token directly to their own address.
|
|
22
|
+
*/
|
|
23
|
+
function PureTransferView({ mode = "modal", recipientAddress, chainId, token, displayAmount, isActive, onBack, onClose, onTransferDetected, }) {
|
|
24
|
+
const [transferResult, setTransferResult] = (0, react_2.useState)(null);
|
|
25
|
+
// Fix 4: reset transferResult when the panel becomes active again
|
|
26
|
+
(0, react_2.useEffect)(() => {
|
|
27
|
+
if (isActive)
|
|
28
|
+
setTransferResult(null);
|
|
29
|
+
}, [isActive]);
|
|
30
|
+
// Fix 3: stabilize the callback so it doesn't re-run the watcher effect every render
|
|
31
|
+
const handleTransferDetected = (0, react_2.useCallback)((result) => {
|
|
32
|
+
setTransferResult(result);
|
|
33
|
+
onTransferDetected?.(result);
|
|
34
|
+
}, [onTransferDetected]);
|
|
35
|
+
const { isWatching } = (0, useWatchTransfer_1.useWatchTransfer)({
|
|
36
|
+
address: recipientAddress,
|
|
37
|
+
chainId,
|
|
38
|
+
tokenAddress: token.address,
|
|
39
|
+
tokenDecimals: token.decimals,
|
|
40
|
+
// Fix 1: also require a non-empty recipient before enabling the watcher
|
|
41
|
+
enabled: !!recipientAddress && !transferResult && isActive,
|
|
42
|
+
onTransferDetected: handleTransferDetected,
|
|
43
|
+
});
|
|
44
|
+
// Fix 2: guard qrValue when recipientAddress is empty
|
|
45
|
+
const qrValue = (0, react_2.useMemo)(() => recipientAddress
|
|
46
|
+
? (0, anyspend_1.getPaymentUrl)(recipientAddress, undefined, token.address === anyspend_1.ZERO_ADDRESS ? "ETH" : token.address, chainId, token.decimals)
|
|
47
|
+
: "", [recipientAddress, token.address, token.decimals, chainId]);
|
|
48
|
+
const chainName = (0, react_2.useMemo)(() => {
|
|
49
|
+
try {
|
|
50
|
+
return (0, anyspend_1.getChainName)(chainId);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return "the specified chain";
|
|
54
|
+
}
|
|
55
|
+
}, [chainId]);
|
|
56
|
+
// Guard: if no address yet, render nothing
|
|
57
|
+
if (!recipientAddress)
|
|
58
|
+
return null;
|
|
59
|
+
// Once a transfer is detected, hand off to the shared success screen
|
|
60
|
+
if (transferResult) {
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(TransferResultScreen_1.TransferResultScreen, { mode: mode, transferResult: transferResult, token: token, chainId: chainId, recipientAddress: recipientAddress, onBack: onBack, onClose: onClose }));
|
|
62
|
+
}
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-pure-transfer font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6"), children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-pure-transfer-content flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-pure-transfer-header flex items-center justify-between", children: [onBack ? ((0, jsx_runtime_1.jsx)("button", { onClick: onBack, className: "anyspend-pure-transfer-back text-as-secondary hover:text-as-primary", "aria-label": "Go back", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-5 w-5" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "w-5" })), (0, jsx_runtime_1.jsxs)("h2", { className: "anyspend-pure-transfer-title text-as-primary text-base font-semibold", children: ["Send ", token.symbol] }), onClose ? ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-pure-transfer-close text-as-secondary hover:text-as-primary", "aria-label": "Close", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-5 w-5" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "w-5" }))] }), displayAmount && ((0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-medium", children: displayAmount }) })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-pure-transfer-qr-content border-as-stroke flex items-start gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-pure-transfer-qr-code-container flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-pure-transfer-qr-code rounded-lg bg-white p-2", children: (0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: qrValue, size: 120, level: "M", marginSize: 0 }) }), (0, jsx_runtime_1.jsxs)("span", { className: "anyspend-pure-transfer-qr-scan-hint text-as-secondary text-xs", children: ["SCAN WITH ", (0, jsx_runtime_1.jsx)("span", { className: "inline-block", children: "\uD83E\uDD8A" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-pure-transfer-address-container flex flex-1 flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-pure-transfer-address-label text-as-secondary text-sm", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-pure-transfer-address-row flex items-start gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-pure-transfer-address text-as-primary break-all font-mono text-sm leading-relaxed", children: recipientAddress }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: recipientAddress, className: "anyspend-pure-transfer-copy-icon text-as-secondary hover:text-as-primary mt-0.5 shrink-0" })] })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: chainId }), (0, jsx_runtime_1.jsxs)(WarningText_1.WarningText, { children: ["Only send ", token.symbol, " on ", chainName, ". Other tokens will not be converted."] }), isWatching && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-pure-transfer-watching bg-as-brand/10 flex items-center justify-center gap-2 rounded-lg p-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-brand h-4 w-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-brand text-sm", children: "Watching for incoming transfer..." })] })), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: recipientAddress, children: (0, jsx_runtime_1.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" }) })] }) }));
|
|
64
|
+
}
|
|
@@ -9,10 +9,9 @@ const number_1 = require("../../../../shared/utils/number");
|
|
|
9
9
|
const react_2 = require("react");
|
|
10
10
|
const viem_1 = require("viem");
|
|
11
11
|
function TokenBalance({ token, walletAddress, onChangeInput, }) {
|
|
12
|
-
|
|
13
|
-
const { data, isLoading } = (0, react_1.
|
|
12
|
+
// `token.chainId` is Relay-numbered; balance rows are keyed by the chain registry's id.
|
|
13
|
+
const { data: balance, isLoading, isError, } = (0, react_1.usePortfolioTokenBalance)(walletAddress, token.address, (0, chain_1.toRegistryChainId)(token.chainId));
|
|
14
14
|
const { rawBalance, formattedBalance } = (0, react_2.useMemo)(() => {
|
|
15
|
-
const balance = data?.balances?.[0];
|
|
16
15
|
if (!balance?.amount) {
|
|
17
16
|
return { rawBalance: null, formattedBalance: "0" };
|
|
18
17
|
}
|
|
@@ -21,7 +20,7 @@ function TokenBalance({ token, walletAddress, onChangeInput, }) {
|
|
|
21
20
|
rawBalance: raw,
|
|
22
21
|
formattedBalance: (0, number_1.formatTokenAmount)(raw, balance.decimals),
|
|
23
22
|
};
|
|
24
|
-
}, [
|
|
23
|
+
}, [balance]);
|
|
25
24
|
const handlePercentageClick = (percentage) => {
|
|
26
25
|
if (!rawBalance)
|
|
27
26
|
return;
|
|
@@ -45,5 +44,5 @@ function TokenBalance({ token, walletAddress, onChangeInput, }) {
|
|
|
45
44
|
}
|
|
46
45
|
onChangeInput((0, viem_1.formatUnits)(amount, token.decimals));
|
|
47
46
|
};
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "flex h-7 items-center justify-end gap-1", children: !isLoading && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 inline-flex rounded-lg text-sm", children: rawBalance ? `Balance: ${formattedBalance}` : `Balance: 0` }), !!rawBalance && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.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}`));
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex h-7 items-center justify-end gap-1", children: !isLoading && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 inline-flex rounded-lg text-sm", children: isError ? "Balance: —" : rawBalance ? `Balance: ${formattedBalance}` : `Balance: 0` }), !!rawBalance && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.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}`));
|
|
49
48
|
}
|
|
@@ -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,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSolanaAddress =
|
|
3
|
+
exports.isSolanaAddress = void 0;
|
|
4
4
|
exports.isEvmOrSolanaAddress = isEvmOrSolanaAddress;
|
|
5
5
|
exports.isHyperliquidUSDC = isHyperliquidUSDC;
|
|
6
6
|
exports.normalizeAddress = normalizeAddress;
|
|
7
7
|
exports.eqci = eqci;
|
|
8
8
|
exports.isSameChainAndToken = isSameChainAndToken;
|
|
9
|
+
const runtime_1 = require("@b3/chain-registry/runtime");
|
|
10
|
+
Object.defineProperty(exports, "isSolanaAddress", { enumerable: true, get: function () { return runtime_1.isSolanaAddress; } });
|
|
9
11
|
const viem_1 = require("viem");
|
|
12
|
+
const constants_1 = require("../constants");
|
|
10
13
|
const token_1 = require("./token");
|
|
11
|
-
function isSolanaAddress(address) {
|
|
12
|
-
// Solana addresses are 32-byte base58 strings (usually 32-44 characters)
|
|
13
|
-
const solanaAddressRegex = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
14
|
-
return solanaAddressRegex.test(address);
|
|
15
|
-
}
|
|
16
14
|
function isEvmOrSolanaAddress(address) {
|
|
17
|
-
return (0, viem_1.isAddress)(address) || isSolanaAddress(address);
|
|
15
|
+
return (0, viem_1.isAddress)(address) || (0, runtime_1.isSolanaAddress)(address);
|
|
18
16
|
}
|
|
19
17
|
/**
|
|
20
18
|
* Check if an address is Hyperliquid's special USDC address.
|
|
@@ -30,7 +28,7 @@ function isHyperliquidUSDC(chainId, address) {
|
|
|
30
28
|
return chainId === token_1.HYPERLIQUID_CHAIN_ID && address.toLowerCase() === "0x00000000000000000000000000000000";
|
|
31
29
|
}
|
|
32
30
|
function normalizeAddress(address) {
|
|
33
|
-
if (isSolanaAddress(address)) {
|
|
31
|
+
if ((0, runtime_1.isSolanaAddress)(address)) {
|
|
34
32
|
return address;
|
|
35
33
|
}
|
|
36
34
|
return address.toLowerCase(); // EVM address will normalize to lower case
|
|
@@ -48,5 +46,10 @@ function eqci(a, b) {
|
|
|
48
46
|
* When true, this is a pure transfer (no swap/bridge needed).
|
|
49
47
|
*/
|
|
50
48
|
function isSameChainAndToken(sourceChainId, sourceTokenAddress, destinationChainId, destinationTokenAddress) {
|
|
51
|
-
|
|
49
|
+
if (sourceChainId !== destinationChainId)
|
|
50
|
+
return false;
|
|
51
|
+
if ((0, runtime_1.chainTypeForIdentifier)(String(sourceChainId)) === "solana" || sourceChainId === constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID) {
|
|
52
|
+
return sourceTokenAddress === destinationTokenAddress;
|
|
53
|
+
}
|
|
54
|
+
return sourceTokenAddress.toLowerCase() === destinationTokenAddress.toLowerCase();
|
|
52
55
|
}
|
|
@@ -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.
|
|
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ALL_CHAINS = exports.HYPERLIQUID_CHAINS = exports.SOLANA_CHAINS = exports.EVM_CHAINS = exports.HYPERLIQUID_MAINNET = exports.SOLANA_MAINNET = exports.EVM_TESTNET = exports.EVM_MAINNET = exports.hyperEVM = void 0;
|
|
6
|
+
exports.DEPRECATED_CHAIN_IDS = exports.ALL_CHAINS = exports.HYPERLIQUID_CHAINS = exports.SOLANA_CHAINS = exports.EVM_CHAINS = exports.HYPERLIQUID_MAINNET = exports.SOLANA_MAINNET = exports.EVM_TESTNET = exports.EVM_MAINNET = exports.plume = exports.hyperEVM = void 0;
|
|
7
7
|
exports.setChainRpcOverrides = setChainRpcOverrides;
|
|
8
8
|
exports.getChainRpcOverrides = getChainRpcOverrides;
|
|
9
9
|
exports.clearChainRpcOverrides = clearChainRpcOverrides;
|
|
10
|
+
exports.toRegistryChainId = toRegistryChainId;
|
|
10
11
|
exports.getSolanaChains = getSolanaChains;
|
|
11
12
|
exports.getAllEvmChains = getAllEvmChains;
|
|
12
13
|
exports.getChainType = getChainType;
|
|
@@ -27,8 +28,10 @@ exports.getNativeToken = getNativeToken;
|
|
|
27
28
|
exports.isEvmChain = isEvmChain;
|
|
28
29
|
exports.isHyperliquidChain = isHyperliquidChain;
|
|
29
30
|
exports.getHyperliquidChain = getHyperliquidChain;
|
|
31
|
+
exports.isDeprecatedChain = isDeprecatedChain;
|
|
30
32
|
exports.getAvailableChainIds = getAvailableChainIds;
|
|
31
33
|
const constants_1 = require("../../anyspend/constants");
|
|
34
|
+
const zerionPositions_1 = require("../../shared/utils/zerionPositions");
|
|
32
35
|
const rpc_1 = require("../../anyspend/constants/rpc");
|
|
33
36
|
const b3Viem_1 = require("../../shared/constants/chains/b3Viem");
|
|
34
37
|
const invariant_1 = __importDefault(require("invariant"));
|
|
@@ -76,10 +79,17 @@ function clearChainRpcOverrides() {
|
|
|
76
79
|
exports.hyperEVM = (0, viem_1.defineChain)({
|
|
77
80
|
id: token_1.HYPEREVM_CHAIN_ID,
|
|
78
81
|
name: "HyperEVM",
|
|
79
|
-
nativeCurrency: { name: "
|
|
82
|
+
nativeCurrency: { name: "Hyperliquid", symbol: "HYPE", decimals: 18 },
|
|
80
83
|
rpcUrls: { default: { http: [rpc_1.HYPEREVM_PUBLIC_RPC] } },
|
|
81
84
|
blockExplorers: { default: { name: "HyperEVM Explorer", url: "https://hyperevmscan.io/" } },
|
|
82
85
|
});
|
|
86
|
+
exports.plume = (0, viem_1.defineChain)({
|
|
87
|
+
id: token_1.PLUME_CHAIN_ID,
|
|
88
|
+
name: "Plume",
|
|
89
|
+
nativeCurrency: { name: "Plume", symbol: "PLUME", decimals: 18 },
|
|
90
|
+
rpcUrls: { default: { http: [rpc_1.PLUME_PUBLIC_RPC] } },
|
|
91
|
+
blockExplorers: { default: { name: "Plume Explorer", url: "https://explorer.plume.org" } },
|
|
92
|
+
});
|
|
83
93
|
// export const b4testnet = defineChain({
|
|
84
94
|
// id: 19934,
|
|
85
95
|
// name: "B4 Testnet",
|
|
@@ -237,6 +247,34 @@ exports.EVM_MAINNET = {
|
|
|
237
247
|
coingeckoName: "hyperevm",
|
|
238
248
|
wethAddress: "0x5555555555555555555555555555555555555555",
|
|
239
249
|
},
|
|
250
|
+
[exports.plume.id]: {
|
|
251
|
+
id: exports.plume.id,
|
|
252
|
+
name: exports.plume.name,
|
|
253
|
+
logoUrl: "https://cdn.b3.fun/b3os-icons/plume.svg",
|
|
254
|
+
type: chain_1.ChainType.EVM,
|
|
255
|
+
nativeRequired: (0, viem_1.parseEther)("5"), // 5 PLUME ≈ $0.06 — gas reserve; Plume gasPrice ~1000 gwei × 2.2M gas (approve+deposit) needs ~2.2 PLUME, +headroom for spikes
|
|
256
|
+
canDepositNative: true,
|
|
257
|
+
defaultToken: (0, token_1.getPlumeNativeToken)(),
|
|
258
|
+
nativeToken: (0, token_1.getPlumeNativeToken)(),
|
|
259
|
+
viem: exports.plume,
|
|
260
|
+
pollingInterval: 1000, // 1 second for Plume (L2 fast blocks)
|
|
261
|
+
coingeckoName: "plume-network",
|
|
262
|
+
wethAddress: "0xea237441c92cae6fc17caaf9a7acb3f953be4bd1", // WPLUME (wrapped native)
|
|
263
|
+
},
|
|
264
|
+
[chains_1.robinhood.id]: {
|
|
265
|
+
id: chains_1.robinhood.id,
|
|
266
|
+
name: chains_1.robinhood.name,
|
|
267
|
+
logoUrl: "https://assets.relay.link/icons/square/4663/light.png",
|
|
268
|
+
type: chain_1.ChainType.EVM,
|
|
269
|
+
nativeRequired: (0, viem_1.parseEther)("0.0001"),
|
|
270
|
+
canDepositNative: true,
|
|
271
|
+
defaultToken: (0, token_1.getEthToken)(chains_1.robinhood.id),
|
|
272
|
+
nativeToken: (0, token_1.getEthToken)(chains_1.robinhood.id),
|
|
273
|
+
viem: getCustomEvmChain(chains_1.robinhood, rpc_1.ROBINHOOD_PUBLIC_RPC),
|
|
274
|
+
pollingInterval: 1000, // 1 second for Robinhood Chain (Arbitrum Orbit fast blocks)
|
|
275
|
+
coingeckoName: "robinhood",
|
|
276
|
+
wethAddress: "0x0bd7d308f8e1639fab988df18a8011f41eacad73", // wrapped native ETH (registry wrappedNative)
|
|
277
|
+
},
|
|
240
278
|
};
|
|
241
279
|
exports.EVM_TESTNET = {
|
|
242
280
|
// [sepolia.id]: {
|
|
@@ -315,6 +353,16 @@ exports.HYPERLIQUID_MAINNET = {
|
|
|
315
353
|
};
|
|
316
354
|
exports.EVM_CHAINS = { ...exports.EVM_MAINNET, ...exports.EVM_TESTNET };
|
|
317
355
|
exports.SOLANA_CHAINS = { [constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID]: exports.SOLANA_MAINNET };
|
|
356
|
+
/**
|
|
357
|
+
* Translate a Relay-numbered chain id into the id the chain registry uses.
|
|
358
|
+
*
|
|
359
|
+
* Relay numbers Solana 792703809; every other chain shares the universal EVM id. Balance rows are
|
|
360
|
+
* keyed by the registry's id, so handing Relay's number to a balance lookup matches nothing at all
|
|
361
|
+
* — and a funded Solana wallet then reads as empty rather than as unreadable.
|
|
362
|
+
*/
|
|
363
|
+
function toRegistryChainId(chainId) {
|
|
364
|
+
return chainId === constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID ? zerionPositions_1.SOLANA_CHAIN_ID : chainId;
|
|
365
|
+
}
|
|
318
366
|
exports.HYPERLIQUID_CHAINS = {
|
|
319
367
|
[token_1.HYPERLIQUID_CHAIN_ID]: exports.HYPERLIQUID_MAINNET,
|
|
320
368
|
};
|
|
@@ -591,6 +639,24 @@ function getHyperliquidChain(chainId) {
|
|
|
591
639
|
(0, invariant_1.default)(exports.HYPERLIQUID_CHAINS[chainId], `Chain ${chainId} is not a Hyperliquid chain`);
|
|
592
640
|
return exports.HYPERLIQUID_CHAINS[chainId];
|
|
593
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* Chains AnySpend no longer accepts orders on, as either source or destination.
|
|
644
|
+
*
|
|
645
|
+
* They stay in ALL_CHAINS on purpose. That map answers "what is this chain" — name, logo, token,
|
|
646
|
+
* decimals — which every order that ever existed still needs in order to render; removing an entry
|
|
647
|
+
* would make getChainName and friends throw on historical rows. Whether new orders are accepted is
|
|
648
|
+
* this separate question.
|
|
649
|
+
*
|
|
650
|
+
* anyspend-service imports this list rather than keeping its own, so the API and the chain picker
|
|
651
|
+
* can never disagree about what is on offer.
|
|
652
|
+
*/
|
|
653
|
+
exports.DEPRECATED_CHAIN_IDS = [
|
|
654
|
+
8333, // B3
|
|
655
|
+
98866, // Plume
|
|
656
|
+
];
|
|
657
|
+
function isDeprecatedChain(chainId) {
|
|
658
|
+
return chainId !== undefined && exports.DEPRECATED_CHAIN_IDS.includes(chainId);
|
|
659
|
+
}
|
|
594
660
|
/**
|
|
595
661
|
* Get available chain IDs for AnySpend based on context (source or destination).
|
|
596
662
|
* Filters out chains that shouldn't be available for the given context.
|
|
@@ -606,7 +672,11 @@ function getHyperliquidChain(chainId) {
|
|
|
606
672
|
* const destChains = getAvailableChainIds("to") // [1, 8453, 137, ..., 1337]
|
|
607
673
|
*/
|
|
608
674
|
function getAvailableChainIds(context) {
|
|
609
|
-
|
|
675
|
+
// Deprecated chains are excluded from both directions: the API rejects them, so offering them in
|
|
676
|
+
// a picker would let a user select something that then fails at order creation.
|
|
677
|
+
const allChainIds = Object.values(exports.ALL_CHAINS)
|
|
678
|
+
.map(chain => chain.id)
|
|
679
|
+
.filter(chainId => !isDeprecatedChain(chainId));
|
|
610
680
|
if (context === "from") {
|
|
611
681
|
// Hyperliquid is only supported as destination chain, not source chain
|
|
612
682
|
return allChainIds.filter(chainId => chainId !== token_1.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"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HYPERLIQUID_USDC_ADDRESS = exports.HYPEREVM_CHAIN_ID = exports.HYPERLIQUID_CHAIN_ID = void 0;
|
|
3
|
+
exports.HYPERLIQUID_USDC_ADDRESS = exports.PLUME_CHAIN_ID = exports.HYPEREVM_CHAIN_ID = exports.HYPERLIQUID_CHAIN_ID = void 0;
|
|
4
4
|
exports.isNativeToken = isNativeToken;
|
|
5
5
|
exports.getSolanaToken = getSolanaToken;
|
|
6
6
|
exports.getEthToken = getEthToken;
|
|
@@ -9,10 +9,12 @@ exports.getBnbToken = getBnbToken;
|
|
|
9
9
|
exports.getAvaxToken = getAvaxToken;
|
|
10
10
|
exports.getHyperEVMNativeToken = getHyperEVMNativeToken;
|
|
11
11
|
exports.getHyperliquidUSDCToken = getHyperliquidUSDCToken;
|
|
12
|
+
exports.getPlumeNativeToken = getPlumeNativeToken;
|
|
12
13
|
const constants_1 = require("../../anyspend/constants");
|
|
13
14
|
const chains_1 = require("viem/chains");
|
|
14
15
|
exports.HYPERLIQUID_CHAIN_ID = 1337;
|
|
15
16
|
exports.HYPEREVM_CHAIN_ID = 999;
|
|
17
|
+
exports.PLUME_CHAIN_ID = 98866;
|
|
16
18
|
/**
|
|
17
19
|
* Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
|
|
18
20
|
* instead of the standard 42-character EVM address format.
|
|
@@ -106,3 +108,15 @@ function getHyperliquidUSDCToken() {
|
|
|
106
108
|
},
|
|
107
109
|
};
|
|
108
110
|
}
|
|
111
|
+
function getPlumeNativeToken() {
|
|
112
|
+
return {
|
|
113
|
+
chainId: exports.PLUME_CHAIN_ID,
|
|
114
|
+
address: constants_1.ZERO_ADDRESS,
|
|
115
|
+
symbol: "PLUME",
|
|
116
|
+
name: "Plume",
|
|
117
|
+
decimals: 18,
|
|
118
|
+
metadata: {
|
|
119
|
+
logoURI: "https://cdn.b3.fun/b3os-icons/plume.svg",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
package/dist/cjs/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
|
}
|