@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
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useAuthentication, useAuthStore, useB3Config, useHandleConnectWithPrivy, } from "../../../../global-account/react/index.js";
|
|
3
|
-
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
const debug = debugB3React("SignInWithB3Privy");
|
|
6
|
-
export function SignInWithB3Privy({ onSuccess, onError, chain }) {
|
|
7
|
-
const { partnerId } = useB3Config();
|
|
8
|
-
const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
|
|
9
|
-
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
10
|
-
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
11
|
-
const { logout } = useAuthentication(partnerId, { skipAutoConnect: true });
|
|
12
|
-
debug("@@SignInWithB3Privy", {
|
|
13
|
-
isLoading,
|
|
14
|
-
fullToken,
|
|
15
|
-
});
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
async function autoConnect() {
|
|
18
|
-
try {
|
|
19
|
-
const connectResult = await connectTw();
|
|
20
|
-
const account = connectResult?.getAccount();
|
|
21
|
-
if (!account) {
|
|
22
|
-
setIsAuthenticated(false);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
await onSuccess(account);
|
|
26
|
-
setIsAuthenticated(true);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.error("Failed to connect:", error);
|
|
30
|
-
await onError?.(error);
|
|
31
|
-
await logout();
|
|
32
|
-
setIsAuthenticated(false);
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
debug("setIsAuthenticating:false:7");
|
|
36
|
-
setIsAuthenticating(false);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
autoConnect();
|
|
40
|
-
}, [connectTw, onSuccess, onError, setIsAuthenticated, logout, setIsAuthenticating]);
|
|
41
|
-
// Currently we auto login, so we can show loading immediately and the onSuccess will proceed to the next modal
|
|
42
|
-
return (_jsx("div", { className: "flex aspect-square items-center justify-center p-6", children: _jsx(Loading, { variant: "white", size: "lg" }) }));
|
|
43
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Chain } from "thirdweb";
|
|
2
|
-
import { Account } from "thirdweb/wallets";
|
|
3
|
-
/**
|
|
4
|
-
* This essentially wraps our useConnect hook to handle the Privy auth flow.
|
|
5
|
-
* Currently, this is for the basement-privy strategy
|
|
6
|
-
*/
|
|
7
|
-
export declare function useHandleConnectWithPrivy(chain?: Chain, onSuccess?: (account: Account) => void): {
|
|
8
|
-
connectTw: () => Promise<import("thirdweb/wallets").Wallet | null | undefined>;
|
|
9
|
-
isLoading: boolean;
|
|
10
|
-
fullToken: string | null;
|
|
11
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { useB3Config, useConnect } from "../../../global-account/react/index.js";
|
|
2
|
-
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
3
|
-
import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
|
|
4
|
-
import { useCallback, useRef, useState } from "react";
|
|
5
|
-
const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
|
|
6
|
-
/**
|
|
7
|
-
* This essentially wraps our useConnect hook to handle the Privy auth flow.
|
|
8
|
-
* Currently, this is for the basement-privy strategy
|
|
9
|
-
*/
|
|
10
|
-
export function useHandleConnectWithPrivy(chain, onSuccess) {
|
|
11
|
-
const { partnerId } = useB3Config();
|
|
12
|
-
if (!chain) {
|
|
13
|
-
throw new Error("Chain is required");
|
|
14
|
-
}
|
|
15
|
-
const { connect } = useConnect(partnerId, chain);
|
|
16
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
17
|
-
const isConnecting = useRef(false);
|
|
18
|
-
const { identityToken } = useIdentityToken();
|
|
19
|
-
const { getAccessToken } = usePrivy();
|
|
20
|
-
const [fullToken, setFullToken] = useState(null);
|
|
21
|
-
const connectTw = useCallback(async () => {
|
|
22
|
-
if (isConnecting.current) {
|
|
23
|
-
debug("@@connectTw:skipping:isConnecting", isConnecting.current);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
setIsLoading(true);
|
|
27
|
-
isConnecting.current = true;
|
|
28
|
-
// Form token
|
|
29
|
-
const accessToken = await getAccessToken();
|
|
30
|
-
const fullToken = `${accessToken}+${identityToken}`;
|
|
31
|
-
setFullToken(fullToken);
|
|
32
|
-
debug("@@connectTw:fullToken", fullToken);
|
|
33
|
-
if (!fullToken)
|
|
34
|
-
throw new Error("Token is not set");
|
|
35
|
-
// Connect to TW via privy
|
|
36
|
-
const wallet = await connect({
|
|
37
|
-
strategy: "auth_endpoint",
|
|
38
|
-
payload: JSON.stringify({
|
|
39
|
-
strategy: "basement",
|
|
40
|
-
accessToken: fullToken,
|
|
41
|
-
}),
|
|
42
|
-
});
|
|
43
|
-
debug("@@useHandleConnectWithPrivy:connect:return", wallet);
|
|
44
|
-
setIsLoading(false);
|
|
45
|
-
// Handle onsuccess & more
|
|
46
|
-
try {
|
|
47
|
-
debug("@@autoLogin:starting", fullToken);
|
|
48
|
-
const account = wallet?.getAccount();
|
|
49
|
-
if (!account) {
|
|
50
|
-
throw new Error("Failed to connect");
|
|
51
|
-
}
|
|
52
|
-
onSuccess?.(account);
|
|
53
|
-
if (!account) {
|
|
54
|
-
throw new Error("Failed to connect");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.error("@@Error signing in with Privy", error);
|
|
59
|
-
}
|
|
60
|
-
finally {
|
|
61
|
-
isConnecting.current = false;
|
|
62
|
-
setIsLoading(false);
|
|
63
|
-
}
|
|
64
|
-
return wallet;
|
|
65
|
-
}, [connect, getAccessToken, identityToken, onSuccess]);
|
|
66
|
-
return { connectTw, isLoading, fullToken };
|
|
67
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export interface SimTokenMetadata {
|
|
2
|
-
logo?: string;
|
|
3
|
-
}
|
|
4
|
-
export interface SimBalanceItem {
|
|
5
|
-
chain: string;
|
|
6
|
-
chain_id: number;
|
|
7
|
-
address: string;
|
|
8
|
-
amount: string;
|
|
9
|
-
symbol: string;
|
|
10
|
-
decimals: number;
|
|
11
|
-
price_usd?: number;
|
|
12
|
-
value_usd?: number;
|
|
13
|
-
name?: string;
|
|
14
|
-
token_metadata?: SimTokenMetadata;
|
|
15
|
-
pool_size?: number;
|
|
16
|
-
low_liquidity?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface SimBalanceResponse {
|
|
19
|
-
request_time: string;
|
|
20
|
-
response_time: string;
|
|
21
|
-
wallet_address: string;
|
|
22
|
-
balances: SimBalanceItem[];
|
|
23
|
-
}
|
|
24
|
-
export interface SvmBalanceItem {
|
|
25
|
-
chain: string;
|
|
26
|
-
address: string;
|
|
27
|
-
amount: string;
|
|
28
|
-
balance: string;
|
|
29
|
-
raw_balance: string;
|
|
30
|
-
value_usd?: number;
|
|
31
|
-
program_id: string | null;
|
|
32
|
-
decimals: number;
|
|
33
|
-
total_supply: string;
|
|
34
|
-
metadata_address?: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
symbol: string;
|
|
37
|
-
uri?: string | null;
|
|
38
|
-
price_usd?: number;
|
|
39
|
-
liquidity_usd?: number;
|
|
40
|
-
pool_type?: string | null;
|
|
41
|
-
pool_address?: string | null;
|
|
42
|
-
mint_authority?: string | null;
|
|
43
|
-
}
|
|
44
|
-
export interface SvmBalanceResponse {
|
|
45
|
-
processing_time_ms?: number;
|
|
46
|
-
wallet_address: string;
|
|
47
|
-
next_offset?: string;
|
|
48
|
-
balances_count?: number;
|
|
49
|
-
balances: SvmBalanceItem[];
|
|
50
|
-
}
|
|
51
|
-
export declare function useSimBalance(address?: string, chainIdsParam?: number[]): import("@tanstack/react-query").UseQueryResult<SimBalanceResponse, Error>;
|
|
52
|
-
export declare function useSimSvmBalance(address?: string, chains?: ("solana" | "eclipse")[], limit?: number): import("@tanstack/react-query").UseQueryResult<SvmBalanceResponse, Error>;
|
|
53
|
-
/**
|
|
54
|
-
* Hook to fetch a single token balance for a wallet.
|
|
55
|
-
* @param walletAddress - The wallet address to fetch balance for
|
|
56
|
-
* @param tokenAddress - The token contract address, or "native" for native token (ETH, etc.)
|
|
57
|
-
* @param chainId - Chain ID to query (defaults to 1 for Ethereum mainnet)
|
|
58
|
-
*/
|
|
59
|
-
export declare function useSimTokenBalance(walletAddress?: string, tokenAddress?: string, chainId?: number): import("@tanstack/react-query").UseQueryResult<SimBalanceResponse, Error>;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import { buildSimduneUrl } from "../utils/simdune.js";
|
|
3
|
-
async function fetchSimBalance(address, chainIdsParam) {
|
|
4
|
-
if (!address)
|
|
5
|
-
throw new Error("Address is required");
|
|
6
|
-
const chainIds = chainIdsParam.length === 0 ? "mainnet" : chainIdsParam.join(",");
|
|
7
|
-
const queryParams = new URLSearchParams();
|
|
8
|
-
queryParams.append("metadata", "logo");
|
|
9
|
-
queryParams.append("chain_ids", chainIds);
|
|
10
|
-
queryParams.append("exclude_spam_tokens", "true");
|
|
11
|
-
const url = buildSimduneUrl(`/v1/evm/balances/${address}`, queryParams);
|
|
12
|
-
const response = await fetch(url);
|
|
13
|
-
if (!response.ok) {
|
|
14
|
-
throw new Error(`Failed to fetch balance: ${response.statusText}`);
|
|
15
|
-
}
|
|
16
|
-
const balanceData = await response.json();
|
|
17
|
-
return balanceData;
|
|
18
|
-
}
|
|
19
|
-
async function fetchSimTokenBalance(walletAddress, tokenAddress, chainId) {
|
|
20
|
-
if (!walletAddress)
|
|
21
|
-
throw new Error("Wallet address is required");
|
|
22
|
-
if (!tokenAddress)
|
|
23
|
-
throw new Error("Token address is required");
|
|
24
|
-
if (!chainId)
|
|
25
|
-
throw new Error("Chain ID is required");
|
|
26
|
-
const queryParams = new URLSearchParams();
|
|
27
|
-
queryParams.append("chain_ids", chainId.toString());
|
|
28
|
-
const url = buildSimduneUrl(`/v1/evm/balances/${walletAddress}/token/${tokenAddress}`, queryParams);
|
|
29
|
-
const response = await fetch(url);
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
throw new Error(`Failed to fetch token balance: ${response.statusText}`);
|
|
32
|
-
}
|
|
33
|
-
const balanceData = await response.json();
|
|
34
|
-
return balanceData;
|
|
35
|
-
}
|
|
36
|
-
async function fetchSimSvmBalance(address, chains, limit) {
|
|
37
|
-
if (!address)
|
|
38
|
-
throw new Error("Address is required");
|
|
39
|
-
const queryParams = new URLSearchParams();
|
|
40
|
-
if (chains && chains.length > 0) {
|
|
41
|
-
queryParams.append("chains", chains.join(","));
|
|
42
|
-
}
|
|
43
|
-
if (limit) {
|
|
44
|
-
queryParams.append("limit", limit.toString());
|
|
45
|
-
}
|
|
46
|
-
const url = buildSimduneUrl(`/beta/svm/balances/${address}`, queryParams.toString() ? queryParams : undefined);
|
|
47
|
-
const response = await fetch(url);
|
|
48
|
-
if (!response.ok) {
|
|
49
|
-
throw new Error(`Failed to fetch SVM balance: ${response.statusText}`);
|
|
50
|
-
}
|
|
51
|
-
const balanceData = await response.json();
|
|
52
|
-
return balanceData;
|
|
53
|
-
}
|
|
54
|
-
export function useSimBalance(address, chainIdsParam) {
|
|
55
|
-
return useQuery({
|
|
56
|
-
queryKey: ["simBalance", address, chainIdsParam],
|
|
57
|
-
queryFn: () => {
|
|
58
|
-
if (!address)
|
|
59
|
-
throw new Error("Address is required");
|
|
60
|
-
return fetchSimBalance(address, chainIdsParam || []);
|
|
61
|
-
},
|
|
62
|
-
enabled: Boolean(address),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
export function useSimSvmBalance(address, chains, limit) {
|
|
66
|
-
return useQuery({
|
|
67
|
-
queryKey: ["svmBalance", address, chains, limit],
|
|
68
|
-
queryFn: () => {
|
|
69
|
-
if (!address)
|
|
70
|
-
throw new Error("Address is required");
|
|
71
|
-
return fetchSimSvmBalance(address, chains, limit);
|
|
72
|
-
},
|
|
73
|
-
enabled: Boolean(address),
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Hook to fetch a single token balance for a wallet.
|
|
78
|
-
* @param walletAddress - The wallet address to fetch balance for
|
|
79
|
-
* @param tokenAddress - The token contract address, or "native" for native token (ETH, etc.)
|
|
80
|
-
* @param chainId - Chain ID to query (defaults to 1 for Ethereum mainnet)
|
|
81
|
-
*/
|
|
82
|
-
export function useSimTokenBalance(walletAddress, tokenAddress, chainId) {
|
|
83
|
-
return useQuery({
|
|
84
|
-
queryKey: ["simTokenBalance", walletAddress, tokenAddress, chainId],
|
|
85
|
-
queryFn: () => {
|
|
86
|
-
if (!walletAddress || !tokenAddress || !chainId) {
|
|
87
|
-
throw new Error("Missing required parameters");
|
|
88
|
-
}
|
|
89
|
-
return fetchSimTokenBalance(walletAddress, tokenAddress, chainId);
|
|
90
|
-
},
|
|
91
|
-
enabled: Boolean(walletAddress) && Boolean(tokenAddress),
|
|
92
|
-
});
|
|
93
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { SimpleHashNFTResponse } from "../../../global-account/types/simplehash.types";
|
|
2
|
-
export interface SimCollectibleMetadata {
|
|
3
|
-
uri: string;
|
|
4
|
-
attributes?: Array<{
|
|
5
|
-
trait_type: string;
|
|
6
|
-
value: string;
|
|
7
|
-
display_type?: string | null;
|
|
8
|
-
}>;
|
|
9
|
-
}
|
|
10
|
-
export interface SimCollectibleEntry {
|
|
11
|
-
contract_address: string;
|
|
12
|
-
token_standard: "ERC721" | "ERC1155";
|
|
13
|
-
token_id: string;
|
|
14
|
-
chain: string;
|
|
15
|
-
chain_id: number;
|
|
16
|
-
name?: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
symbol?: string;
|
|
19
|
-
image_url?: string;
|
|
20
|
-
last_sale_price?: string;
|
|
21
|
-
metadata?: SimCollectibleMetadata;
|
|
22
|
-
is_spam?: boolean;
|
|
23
|
-
spam_score?: number;
|
|
24
|
-
explanations?: string[];
|
|
25
|
-
balance?: string;
|
|
26
|
-
last_acquired?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface SimCollectiblesResponse {
|
|
29
|
-
address: string;
|
|
30
|
-
entries: SimCollectibleEntry[];
|
|
31
|
-
next_offset?: string;
|
|
32
|
-
request_time: string;
|
|
33
|
-
response_time: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Hook to fetch NFT collectibles from Simdune API.
|
|
37
|
-
* Returns data in SimpleHash format for compatibility with AccountAssets component.
|
|
38
|
-
* @param address - Wallet address to fetch collectibles for
|
|
39
|
-
* @param chainIdsParam - Optional array of chain IDs to filter by
|
|
40
|
-
* @param options - Optional parameters (limit, filterSpam)
|
|
41
|
-
*/
|
|
42
|
-
export declare function useSimCollectibles(address?: string, chainIdsParam?: number[], options?: {
|
|
43
|
-
limit?: number;
|
|
44
|
-
filterSpam?: boolean;
|
|
45
|
-
}): import("@tanstack/react-query").UseQueryResult<SimpleHashNFTResponse, Error>;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import { buildSimduneUrl } from "../utils/simdune.js";
|
|
3
|
-
/**
|
|
4
|
-
* Safely parse a balance string to a number, capping at MAX_SAFE_INTEGER
|
|
5
|
-
* to prevent overflow issues with large ERC1155 balances.
|
|
6
|
-
*/
|
|
7
|
-
function safeParseBalance(balance) {
|
|
8
|
-
if (!balance)
|
|
9
|
-
return 1;
|
|
10
|
-
const parsed = parseInt(balance, 10);
|
|
11
|
-
if (Number.isNaN(parsed))
|
|
12
|
-
return 1;
|
|
13
|
-
return Math.min(parsed, Number.MAX_SAFE_INTEGER);
|
|
14
|
-
}
|
|
15
|
-
async function fetchSimCollectibles(address, chainIdsParam, options) {
|
|
16
|
-
if (!address)
|
|
17
|
-
throw new Error("Address is required");
|
|
18
|
-
const queryParams = new URLSearchParams();
|
|
19
|
-
if (chainIdsParam && chainIdsParam.length > 0) {
|
|
20
|
-
queryParams.append("chain_ids", chainIdsParam.join(","));
|
|
21
|
-
}
|
|
22
|
-
if (options?.limit) {
|
|
23
|
-
queryParams.append("limit", options.limit.toString());
|
|
24
|
-
}
|
|
25
|
-
if (options?.filterSpam !== undefined) {
|
|
26
|
-
queryParams.append("filter_spam", options.filterSpam.toString());
|
|
27
|
-
}
|
|
28
|
-
const url = buildSimduneUrl(`/v1/evm/collectibles/${address}`, queryParams);
|
|
29
|
-
const response = await fetch(url);
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
throw new Error(`Failed to fetch collectibles: ${response.statusText}`);
|
|
32
|
-
}
|
|
33
|
-
const data = await response.json();
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Transforms Simdune collectibles response to SimpleHash NFT format
|
|
38
|
-
* for compatibility with existing AccountAssets component
|
|
39
|
-
*/
|
|
40
|
-
function transformToSimpleHashFormat(data) {
|
|
41
|
-
const nfts = data.entries.map(entry => ({
|
|
42
|
-
nft_id: `${entry.chain}.${entry.contract_address}.${entry.token_id}`,
|
|
43
|
-
chain: entry.chain,
|
|
44
|
-
contract_address: entry.contract_address,
|
|
45
|
-
token_id: entry.token_id,
|
|
46
|
-
name: entry.name || "",
|
|
47
|
-
description: entry.description || "",
|
|
48
|
-
previews: {
|
|
49
|
-
image_small_url: entry.image_url || "",
|
|
50
|
-
image_medium_url: entry.image_url || "",
|
|
51
|
-
image_large_url: entry.image_url || "",
|
|
52
|
-
image_opengraph_url: entry.image_url || "",
|
|
53
|
-
blurhash: "",
|
|
54
|
-
predominant_color: "",
|
|
55
|
-
},
|
|
56
|
-
image_url: entry.image_url || "",
|
|
57
|
-
image_properties: {
|
|
58
|
-
width: 0,
|
|
59
|
-
height: 0,
|
|
60
|
-
size: 0,
|
|
61
|
-
mime_type: "",
|
|
62
|
-
exif_orientation: null,
|
|
63
|
-
},
|
|
64
|
-
video_url: null,
|
|
65
|
-
video_properties: null,
|
|
66
|
-
audio_url: null,
|
|
67
|
-
audio_properties: null,
|
|
68
|
-
model_url: null,
|
|
69
|
-
model_properties: null,
|
|
70
|
-
other_url: null,
|
|
71
|
-
other_properties: null,
|
|
72
|
-
background_color: null,
|
|
73
|
-
external_url: null,
|
|
74
|
-
created_date: "",
|
|
75
|
-
status: "minted",
|
|
76
|
-
token_count: 1,
|
|
77
|
-
owner_count: 1,
|
|
78
|
-
owners: [
|
|
79
|
-
{
|
|
80
|
-
owner_address: data.address,
|
|
81
|
-
quantity: safeParseBalance(entry.balance),
|
|
82
|
-
quantity_string: entry.balance || "1",
|
|
83
|
-
first_acquired_date: entry.last_acquired || "",
|
|
84
|
-
last_acquired_date: entry.last_acquired || "",
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
contract: {
|
|
88
|
-
type: entry.token_standard,
|
|
89
|
-
name: entry.name || "",
|
|
90
|
-
symbol: entry.symbol || null,
|
|
91
|
-
deployed_by: "",
|
|
92
|
-
deployed_via_contract: "",
|
|
93
|
-
owned_by: "",
|
|
94
|
-
has_multiple_collections: false,
|
|
95
|
-
},
|
|
96
|
-
collection: {
|
|
97
|
-
collection_id: entry.contract_address,
|
|
98
|
-
name: entry.symbol || "Unknown Collection",
|
|
99
|
-
description: null,
|
|
100
|
-
image_url: entry.image_url || "",
|
|
101
|
-
image_properties: {
|
|
102
|
-
width: 0,
|
|
103
|
-
height: 0,
|
|
104
|
-
mime_type: "",
|
|
105
|
-
},
|
|
106
|
-
banner_image_url: null,
|
|
107
|
-
category: null,
|
|
108
|
-
is_nsfw: null,
|
|
109
|
-
external_url: null,
|
|
110
|
-
twitter_username: null,
|
|
111
|
-
discord_url: null,
|
|
112
|
-
instagram_username: null,
|
|
113
|
-
medium_username: null,
|
|
114
|
-
telegram_url: null,
|
|
115
|
-
marketplace_pages: [],
|
|
116
|
-
metaplex_mint: null,
|
|
117
|
-
metaplex_candy_machine: null,
|
|
118
|
-
metaplex_first_verified_creator: null,
|
|
119
|
-
floor_prices: [],
|
|
120
|
-
top_bids: [],
|
|
121
|
-
distinct_owner_count: 0,
|
|
122
|
-
distinct_nft_count: 0,
|
|
123
|
-
total_quantity: 0,
|
|
124
|
-
chains: [entry.chain],
|
|
125
|
-
top_contracts: [entry.contract_address],
|
|
126
|
-
collection_royalties: [],
|
|
127
|
-
},
|
|
128
|
-
last_sale: entry.last_sale_price
|
|
129
|
-
? {
|
|
130
|
-
price: entry.last_sale_price,
|
|
131
|
-
}
|
|
132
|
-
: null,
|
|
133
|
-
primary_sale: null,
|
|
134
|
-
first_created: {
|
|
135
|
-
minted_to: data.address,
|
|
136
|
-
quantity: 1,
|
|
137
|
-
quantity_string: "1",
|
|
138
|
-
timestamp: "",
|
|
139
|
-
block_number: 0,
|
|
140
|
-
transaction: "",
|
|
141
|
-
transaction_initiator: "",
|
|
142
|
-
},
|
|
143
|
-
rarity: {
|
|
144
|
-
rank: null,
|
|
145
|
-
score: null,
|
|
146
|
-
unique_attributes: null,
|
|
147
|
-
},
|
|
148
|
-
royalty: [],
|
|
149
|
-
extra_metadata: {
|
|
150
|
-
attributes: (entry.metadata?.attributes || []).map(attr => ({
|
|
151
|
-
trait_type: attr.trait_type,
|
|
152
|
-
value: attr.value,
|
|
153
|
-
display_type: attr.display_type ?? null,
|
|
154
|
-
})),
|
|
155
|
-
image_original_url: entry.image_url || "",
|
|
156
|
-
animation_original_url: null,
|
|
157
|
-
metadata_original_url: entry.metadata?.uri || "",
|
|
158
|
-
},
|
|
159
|
-
}));
|
|
160
|
-
return {
|
|
161
|
-
next_cursor: data.next_offset || null,
|
|
162
|
-
next: null,
|
|
163
|
-
previous: null,
|
|
164
|
-
nfts,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Hook to fetch NFT collectibles from Simdune API.
|
|
169
|
-
* Returns data in SimpleHash format for compatibility with AccountAssets component.
|
|
170
|
-
* @param address - Wallet address to fetch collectibles for
|
|
171
|
-
* @param chainIdsParam - Optional array of chain IDs to filter by
|
|
172
|
-
* @param options - Optional parameters (limit, filterSpam)
|
|
173
|
-
*/
|
|
174
|
-
export function useSimCollectibles(address, chainIdsParam, options) {
|
|
175
|
-
return useQuery({
|
|
176
|
-
queryKey: ["simCollectibles", address, chainIdsParam, options],
|
|
177
|
-
queryFn: async () => {
|
|
178
|
-
if (!address)
|
|
179
|
-
throw new Error("Address is required");
|
|
180
|
-
const data = await fetchSimCollectibles(address, chainIdsParam, options);
|
|
181
|
-
return transformToSimpleHashFormat(data);
|
|
182
|
-
},
|
|
183
|
-
enabled: Boolean(address),
|
|
184
|
-
staleTime: 30 * 1000,
|
|
185
|
-
gcTime: 5 * 60 * 1000,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const SIMDUNE_API_HOST = "https://simdune-api.sean-430.workers.dev";
|
|
2
|
-
/**
|
|
3
|
-
* Builds a Simdune API URL with the proxy wrapper and optional dev mode key.
|
|
4
|
-
* @param endpoint - The Simdune API endpoint (e.g., "/v1/evm/balances/0x...")
|
|
5
|
-
* @param queryParams - Optional URLSearchParams to append
|
|
6
|
-
*/
|
|
7
|
-
export declare function buildSimduneUrl(endpoint: string, queryParams?: URLSearchParams): string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const SIMDUNE_API_HOST = "https://simdune-api.sean-430.workers.dev";
|
|
2
|
-
/**
|
|
3
|
-
* Builds a Simdune API URL with the proxy wrapper and optional dev mode key.
|
|
4
|
-
* @param endpoint - The Simdune API endpoint (e.g., "/v1/evm/balances/0x...")
|
|
5
|
-
* @param queryParams - Optional URLSearchParams to append
|
|
6
|
-
*/
|
|
7
|
-
export function buildSimduneUrl(endpoint, queryParams) {
|
|
8
|
-
const baseUrl = `${SIMDUNE_API_HOST}/?url=https://api.sim.dune.com${endpoint}`;
|
|
9
|
-
let url = baseUrl;
|
|
10
|
-
if (queryParams && queryParams.toString()) {
|
|
11
|
-
url += `?${queryParams.toString()}`;
|
|
12
|
-
}
|
|
13
|
-
if (process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET) {
|
|
14
|
-
url += `${queryParams?.toString() ? "&" : "?"}localkey=${process.env.NEXT_PUBLIC_DEVMODE_SHARED_SECRET}`;
|
|
15
|
-
}
|
|
16
|
-
return url;
|
|
17
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Static } from "@feathersjs/typebox";
|
|
2
|
-
export declare const chainNetworksSchema: import("@feathersjs/typebox").TObject<{
|
|
3
|
-
_id: import("@feathersjs/typebox").TUnion<[import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TObject<{}>]>;
|
|
4
|
-
id: import("@feathersjs/typebox").TInteger;
|
|
5
|
-
name: import("@feathersjs/typebox").TString<string>;
|
|
6
|
-
rpcUrls: import("@feathersjs/typebox").TObject<{
|
|
7
|
-
default: import("@feathersjs/typebox").TObject<{
|
|
8
|
-
http: import("@feathersjs/typebox").TString<"uri">;
|
|
9
|
-
ws: import("@feathersjs/typebox").TString<"uri">;
|
|
10
|
-
}>;
|
|
11
|
-
backups: import("@feathersjs/typebox").TArray<import("@feathersjs/typebox").TObject<{
|
|
12
|
-
type: import("@feathersjs/typebox").TUnion<[import("@feathersjs/typebox").TLiteral<"http">, import("@feathersjs/typebox").TLiteral<"ws">]>;
|
|
13
|
-
uri: import("@feathersjs/typebox").TString<string>;
|
|
14
|
-
}>>;
|
|
15
|
-
}>;
|
|
16
|
-
icon: import("@feathersjs/typebox").TObject<{
|
|
17
|
-
url: import("@feathersjs/typebox").TString<"uri">;
|
|
18
|
-
width: import("@feathersjs/typebox").TInteger;
|
|
19
|
-
height: import("@feathersjs/typebox").TInteger;
|
|
20
|
-
format: import("@feathersjs/typebox").TString<string>;
|
|
21
|
-
}>;
|
|
22
|
-
blockExplorers: import("@feathersjs/typebox").TObject<{
|
|
23
|
-
explorerTitle: import("@feathersjs/typebox").TString<string>;
|
|
24
|
-
default: import("@feathersjs/typebox").TString<"uri">;
|
|
25
|
-
}>;
|
|
26
|
-
nativeCurrency: import("@feathersjs/typebox").TObject<{
|
|
27
|
-
name: import("@feathersjs/typebox").TString<string>;
|
|
28
|
-
symbol: import("@feathersjs/typebox").TString<string>;
|
|
29
|
-
decimals: import("@feathersjs/typebox").TInteger;
|
|
30
|
-
}>;
|
|
31
|
-
testnet: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TBoolean>;
|
|
32
|
-
testnetConfigID: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TInteger>;
|
|
33
|
-
sourceId: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TInteger>;
|
|
34
|
-
contracts: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TRecord<import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TObject<{
|
|
35
|
-
address: import("@feathersjs/typebox").TString<string>;
|
|
36
|
-
blockCreated: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TInteger>;
|
|
37
|
-
}>>>;
|
|
38
|
-
formatters: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TRecord<import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TAny>>;
|
|
39
|
-
fees: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TRecord<import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TAny>>;
|
|
40
|
-
badge: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TString<"uri">>;
|
|
41
|
-
color: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TString<string>>;
|
|
42
|
-
enabledFeatures: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TArray<import("@feathersjs/typebox").TString<string>>>;
|
|
43
|
-
}>;
|
|
44
|
-
export type ChainNetworks = Static<typeof chainNetworksSchema>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ObjectIdSchema, Type } from "@feathersjs/typebox";
|
|
2
|
-
const ChainContractSchema = Type.Object({
|
|
3
|
-
address: Type.String(),
|
|
4
|
-
blockCreated: Type.Optional(Type.Integer()),
|
|
5
|
-
});
|
|
6
|
-
export const chainNetworksSchema = Type.Object({
|
|
7
|
-
_id: ObjectIdSchema(),
|
|
8
|
-
id: Type.Integer(),
|
|
9
|
-
name: Type.String(),
|
|
10
|
-
rpcUrls: Type.Object({
|
|
11
|
-
default: Type.Object({
|
|
12
|
-
http: Type.String({ format: "uri" }),
|
|
13
|
-
ws: Type.String({ format: "uri" }),
|
|
14
|
-
}),
|
|
15
|
-
backups: Type.Array(Type.Object({
|
|
16
|
-
type: Type.Union([Type.Literal("http"), Type.Literal("ws")]),
|
|
17
|
-
uri: Type.String(),
|
|
18
|
-
})),
|
|
19
|
-
}),
|
|
20
|
-
icon: Type.Object({
|
|
21
|
-
url: Type.String({ format: "uri" }),
|
|
22
|
-
width: Type.Integer(),
|
|
23
|
-
height: Type.Integer(),
|
|
24
|
-
format: Type.String(),
|
|
25
|
-
}),
|
|
26
|
-
blockExplorers: Type.Object({
|
|
27
|
-
explorerTitle: Type.String(),
|
|
28
|
-
default: Type.String({ format: "uri" }),
|
|
29
|
-
}),
|
|
30
|
-
nativeCurrency: Type.Object({
|
|
31
|
-
name: Type.String(),
|
|
32
|
-
symbol: Type.String(),
|
|
33
|
-
decimals: Type.Integer(),
|
|
34
|
-
}),
|
|
35
|
-
testnet: Type.Optional(Type.Boolean()),
|
|
36
|
-
testnetConfigID: Type.Optional(Type.Integer()),
|
|
37
|
-
// Additional required Viem fields that can't be derived
|
|
38
|
-
sourceId: Type.Optional(Type.Integer()),
|
|
39
|
-
contracts: Type.Optional(Type.Record(Type.String(), ChainContractSchema)),
|
|
40
|
-
formatters: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
|
41
|
-
fees: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
|
42
|
-
badge: Type.Optional(Type.String({ format: "uri" })),
|
|
43
|
-
color: Type.Optional(Type.String()),
|
|
44
|
-
enabledFeatures: Type.Optional(Type.Array(Type.String())),
|
|
45
|
-
}, { $id: "ChainNetworks", additionalProperties: false });
|