thirdweb 5.69.0 → 5.70.0-nightly-ecaa304a812188da3c81888bb52ca6064093c139-20241121000332
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/dist/cjs/client/client.js +1 -0
- package/dist/cjs/client/client.js.map +1 -1
- package/dist/cjs/exports/react.js +32 -3
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/extensions/erc721/lazyMinting/read/getBatchesToReveal.js +1 -1
- package/dist/cjs/extensions/modules/common/checkModulesCompatibility.js +5 -0
- package/dist/cjs/extensions/modules/common/checkModulesCompatibility.js.map +1 -1
- package/dist/cjs/extensions/pack/createNewPack.js +2 -1
- package/dist/cjs/extensions/pack/createNewPack.js.map +1 -1
- package/dist/cjs/extensions/prebuilts/deploy-pack.js +1 -0
- package/dist/cjs/extensions/prebuilts/deploy-pack.js.map +1 -1
- package/dist/cjs/extensions/thirdweb/write/publish.js +4 -0
- package/dist/cjs/extensions/thirdweb/write/publish.js.map +1 -1
- package/dist/cjs/react/core/hooks/others/useChainQuery.js +3 -3
- package/dist/cjs/react/core/hooks/rpc/useBlockNumber.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useCapabilities.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSendCalls.js +3 -3
- package/dist/cjs/react/core/providers/connection-manager.js +3 -0
- package/dist/cjs/react/core/providers/connection-manager.js.map +1 -1
- package/dist/cjs/react/core/utils/wallet.js +2 -1
- package/dist/cjs/react/core/utils/wallet.js.map +1 -1
- package/dist/cjs/react/core/utils/walletIcon.js +2 -0
- package/dist/cjs/react/core/utils/walletIcon.js.map +1 -1
- package/dist/cjs/react/native/hooks/wallets/useProfiles.js +1 -1
- package/dist/cjs/react/native/providers/thirdweb-provider.js +1 -0
- package/dist/cjs/react/native/providers/thirdweb-provider.js.map +1 -1
- package/dist/cjs/react/native/ui/AutoConnect/AutoConnect.js +1 -0
- package/dist/cjs/react/native/ui/AutoConnect/AutoConnect.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectModal.js +1 -0
- package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/cjs/react/native/ui/transaction/TransactionButton.js +1 -0
- package/dist/cjs/react/native/ui/transaction/TransactionButton.js.map +1 -1
- package/dist/cjs/react/web/hooks/wallets/useProfiles.js +1 -1
- package/dist/cjs/react/web/providers/thirdweb-provider.js +1 -0
- package/dist/cjs/react/web/providers/thirdweb-provider.js.map +1 -1
- package/dist/cjs/react/web/ui/AutoConnect/AutoConnect.js +1 -0
- package/dist/cjs/react/web/ui/AutoConnect/AutoConnect.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Blobbie.js +19 -4
- package/dist/cjs/react/web/ui/ConnectWallet/Blobbie.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +21 -19
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +18 -13
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +9 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +15 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/cjs/react/web/ui/PayEmbed.js +1 -0
- package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/SiteEmbed.js +3 -2
- package/dist/cjs/react/web/ui/SiteEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/SiteLink.js +2 -1
- package/dist/cjs/react/web/ui/SiteLink.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/index.js +1 -0
- package/dist/cjs/react/web/ui/TransactionButton/index.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/address.js +49 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/address.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js +144 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/balance.js +122 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/balance.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js +16 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/name.js +106 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/name.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/provider.js +43 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/provider.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/description.js +69 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/description.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/hooks.js +45 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/hooks.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/media.js +82 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/media.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/name.js +68 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/name.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js +55 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/icon.js +113 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/icon.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/name.js +137 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/name.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/provider.js +54 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/provider.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/symbol.js +134 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/symbol.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -1
- package/dist/cjs/storage/unpin.js +1 -1
- package/dist/cjs/storage/upload.js +1 -0
- package/dist/cjs/storage/upload.js.map +1 -1
- package/dist/cjs/transaction/actions/to-serializable-transaction.js +1 -1
- package/dist/cjs/transaction/actions/zksync/send-eip712-transaction.js +5 -0
- package/dist/cjs/transaction/actions/zksync/send-eip712-transaction.js.map +1 -1
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js +5 -0
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/cjs/utils/config.js +9 -0
- package/dist/cjs/utils/config.js.map +1 -1
- package/dist/cjs/utils/json.js +7 -4
- package/dist/cjs/utils/json.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/eip5792/get-calls-status.js +1 -1
- package/dist/cjs/wallets/eip5792/get-capabilities.js +1 -1
- package/dist/cjs/wallets/eip5792/send-calls.js +2 -2
- package/dist/cjs/wallets/eip5792/wait-for-bundle.js +1 -1
- package/dist/cjs/wallets/in-app/core/users/getUser.js +1 -1
- package/dist/cjs/wallets/in-app/web/ecosystem.js +7 -17
- package/dist/cjs/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/in-app.js +2 -17
- package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js +1 -0
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js +17 -16
- package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
- package/dist/cjs/wallets/smart/smart-wallet.js +1 -0
- package/dist/cjs/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/esm/client/client.js +1 -0
- package/dist/esm/client/client.js.map +1 -1
- package/dist/esm/exports/react.js +17 -1
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/extensions/erc721/lazyMinting/read/getBatchesToReveal.js +1 -1
- package/dist/esm/extensions/modules/common/checkModulesCompatibility.js +5 -0
- package/dist/esm/extensions/modules/common/checkModulesCompatibility.js.map +1 -1
- package/dist/esm/extensions/pack/createNewPack.js +2 -1
- package/dist/esm/extensions/pack/createNewPack.js.map +1 -1
- package/dist/esm/extensions/prebuilts/deploy-pack.js +1 -0
- package/dist/esm/extensions/prebuilts/deploy-pack.js.map +1 -1
- package/dist/esm/extensions/thirdweb/write/publish.js +4 -0
- package/dist/esm/extensions/thirdweb/write/publish.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js +3 -3
- package/dist/esm/react/core/hooks/rpc/useBlockNumber.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useCapabilities.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useSendCalls.js +3 -3
- package/dist/esm/react/core/providers/connection-manager.js +3 -0
- package/dist/esm/react/core/providers/connection-manager.js.map +1 -1
- package/dist/esm/react/core/utils/wallet.js +2 -1
- package/dist/esm/react/core/utils/wallet.js.map +1 -1
- package/dist/esm/react/core/utils/walletIcon.js +2 -0
- package/dist/esm/react/core/utils/walletIcon.js.map +1 -1
- package/dist/esm/react/native/hooks/wallets/useProfiles.js +1 -1
- package/dist/esm/react/native/providers/thirdweb-provider.js +1 -0
- package/dist/esm/react/native/providers/thirdweb-provider.js.map +1 -1
- package/dist/esm/react/native/ui/AutoConnect/AutoConnect.js +1 -0
- package/dist/esm/react/native/ui/AutoConnect/AutoConnect.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectModal.js +1 -0
- package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/esm/react/native/ui/transaction/TransactionButton.js +1 -0
- package/dist/esm/react/native/ui/transaction/TransactionButton.js.map +1 -1
- package/dist/esm/react/web/hooks/wallets/useProfiles.js +1 -1
- package/dist/esm/react/web/providers/thirdweb-provider.js +1 -0
- package/dist/esm/react/web/providers/thirdweb-provider.js.map +1 -1
- package/dist/esm/react/web/ui/AutoConnect/AutoConnect.js +1 -0
- package/dist/esm/react/web/ui/AutoConnect/AutoConnect.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Blobbie.js +19 -4
- package/dist/esm/react/web/ui/ConnectWallet/Blobbie.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +21 -19
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +19 -14
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +9 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +15 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/esm/react/web/ui/PayEmbed.js +1 -0
- package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/SiteEmbed.js +3 -2
- package/dist/esm/react/web/ui/SiteEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/SiteLink.js +2 -1
- package/dist/esm/react/web/ui/SiteLink.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/index.js +1 -0
- package/dist/esm/react/web/ui/TransactionButton/index.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/address.js +46 -0
- package/dist/esm/react/web/ui/prebuilt/Account/address.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Account/avatar.js +141 -0
- package/dist/esm/react/web/ui/prebuilt/Account/avatar.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Account/balance.js +119 -0
- package/dist/esm/react/web/ui/prebuilt/Account/balance.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js +13 -0
- package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Account/name.js +103 -0
- package/dist/esm/react/web/ui/prebuilt/Account/name.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Account/provider.js +39 -0
- package/dist/esm/react/web/ui/prebuilt/Account/provider.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/description.js +66 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/description.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/hooks.js +41 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/hooks.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/media.js +79 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/media.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/name.js +65 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/name.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/provider.js +50 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/provider.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Token/icon.js +110 -0
- package/dist/esm/react/web/ui/prebuilt/Token/icon.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Token/name.js +134 -0
- package/dist/esm/react/web/ui/prebuilt/Token/name.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Token/provider.js +50 -0
- package/dist/esm/react/web/ui/prebuilt/Token/provider.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/Token/symbol.js +131 -0
- package/dist/esm/react/web/ui/prebuilt/Token/symbol.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -1
- package/dist/esm/storage/unpin.js +1 -1
- package/dist/esm/storage/upload.js +1 -0
- package/dist/esm/storage/upload.js.map +1 -1
- package/dist/esm/transaction/actions/to-serializable-transaction.js +1 -1
- package/dist/esm/transaction/actions/zksync/send-eip712-transaction.js +5 -0
- package/dist/esm/transaction/actions/zksync/send-eip712-transaction.js.map +1 -1
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js +5 -0
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/esm/utils/config.js +9 -0
- package/dist/esm/utils/config.js.map +1 -1
- package/dist/esm/utils/json.js +6 -2
- package/dist/esm/utils/json.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/eip5792/get-calls-status.js +1 -1
- package/dist/esm/wallets/eip5792/get-capabilities.js +1 -1
- package/dist/esm/wallets/eip5792/send-calls.js +2 -2
- package/dist/esm/wallets/eip5792/wait-for-bundle.js +1 -1
- package/dist/esm/wallets/in-app/core/users/getUser.js +1 -1
- package/dist/esm/wallets/in-app/web/ecosystem.js +7 -17
- package/dist/esm/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/esm/wallets/in-app/web/in-app.js +2 -17
- package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/index.js +1 -0
- package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js +18 -17
- package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
- package/dist/esm/wallets/smart/smart-wallet.js +1 -0
- package/dist/esm/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/types/client/client.d.ts +1 -0
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +14 -1
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/extensions/erc721/lazyMinting/read/getBatchesToReveal.d.ts +1 -1
- package/dist/types/extensions/modules/common/checkModulesCompatibility.d.ts +5 -0
- package/dist/types/extensions/modules/common/checkModulesCompatibility.d.ts.map +1 -1
- package/dist/types/extensions/pack/createNewPack.d.ts +2 -2
- package/dist/types/extensions/pack/createNewPack.d.ts.map +1 -1
- package/dist/types/extensions/prebuilts/deploy-pack.d.ts +1 -0
- package/dist/types/extensions/prebuilts/deploy-pack.d.ts.map +1 -1
- package/dist/types/extensions/thirdweb/write/publish.d.ts +4 -0
- package/dist/types/extensions/thirdweb/write/publish.d.ts.map +1 -1
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts +3 -3
- package/dist/types/react/core/hooks/rpc/useBlockNumber.d.ts +1 -1
- package/dist/types/react/core/hooks/wallets/useCapabilities.d.ts +1 -1
- package/dist/types/react/core/hooks/wallets/useSendCalls.d.ts +3 -3
- package/dist/types/react/core/providers/connection-manager.d.ts +3 -0
- package/dist/types/react/core/providers/connection-manager.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts +2 -1
- package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
- package/dist/types/react/core/utils/walletIcon.d.ts +2 -0
- package/dist/types/react/core/utils/walletIcon.d.ts.map +1 -1
- package/dist/types/react/native/hooks/wallets/useProfiles.d.ts +1 -1
- package/dist/types/react/native/providers/thirdweb-provider.d.ts +1 -0
- package/dist/types/react/native/providers/thirdweb-provider.d.ts.map +1 -1
- package/dist/types/react/native/ui/AutoConnect/AutoConnect.d.ts +1 -0
- package/dist/types/react/native/ui/AutoConnect/AutoConnect.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts +1 -0
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/transaction/TransactionButton.d.ts +1 -0
- package/dist/types/react/native/ui/transaction/TransactionButton.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useProfiles.d.ts +1 -1
- package/dist/types/react/web/providers/thirdweb-provider.d.ts +1 -0
- package/dist/types/react/web/providers/thirdweb-provider.d.ts.map +1 -1
- package/dist/types/react/web/ui/AutoConnect/AutoConnect.d.ts +1 -0
- package/dist/types/react/web/ui/AutoConnect/AutoConnect.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Blobbie.d.ts +22 -5
- package/dist/types/react/web/ui/ConnectWallet/Blobbie.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts +2 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +2 -2
- package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/SiteEmbed.d.ts +3 -2
- package/dist/types/react/web/ui/SiteEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/SiteLink.d.ts +2 -1
- package/dist/types/react/web/ui/SiteLink.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/index.d.ts +1 -0
- package/dist/types/react/web/ui/TransactionButton/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/address.d.ts +52 -0
- package/dist/types/react/web/ui/prebuilt/Account/address.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Account/avatar.d.ts +142 -0
- package/dist/types/react/web/ui/prebuilt/Account/avatar.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Account/balance.d.ts +137 -0
- package/dist/types/react/web/ui/prebuilt/Account/balance.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Account/blobbie.d.ts +8 -0
- package/dist/types/react/web/ui/prebuilt/Account/blobbie.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Account/name.d.ts +119 -0
- package/dist/types/react/web/ui/prebuilt/Account/name.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Account/provider.d.ts +45 -0
- package/dist/types/react/web/ui/prebuilt/Account/provider.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/NFT/description.d.ts +59 -0
- package/dist/types/react/web/ui/prebuilt/NFT/description.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/NFT/hooks.d.ts +14 -0
- package/dist/types/react/web/ui/prebuilt/NFT/hooks.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/NFT/media.d.ts +75 -0
- package/dist/types/react/web/ui/prebuilt/NFT/media.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/NFT/name.d.ts +59 -0
- package/dist/types/react/web/ui/prebuilt/NFT/name.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/NFT/provider.d.ts +55 -0
- package/dist/types/react/web/ui/prebuilt/NFT/provider.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Token/icon.d.ts +95 -0
- package/dist/types/react/web/ui/prebuilt/Token/icon.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Token/name.d.ts +140 -0
- package/dist/types/react/web/ui/prebuilt/Token/name.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Token/provider.d.ts +61 -0
- package/dist/types/react/web/ui/prebuilt/Token/provider.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/Token/symbol.d.ts +137 -0
- package/dist/types/react/web/ui/prebuilt/Token/symbol.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts +1 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts +1 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts +1 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts.map +1 -1
- package/dist/types/storage/unpin.d.ts +1 -1
- package/dist/types/storage/upload.d.ts +1 -0
- package/dist/types/storage/upload.d.ts.map +1 -1
- package/dist/types/transaction/actions/to-serializable-transaction.d.ts +1 -1
- package/dist/types/transaction/actions/zksync/send-eip712-transaction.d.ts +5 -0
- package/dist/types/transaction/actions/zksync/send-eip712-transaction.d.ts.map +1 -1
- package/dist/types/utils/any-evm/zksync/isZkSyncChain.d.ts +5 -0
- package/dist/types/utils/any-evm/zksync/isZkSyncChain.d.ts.map +1 -1
- package/dist/types/utils/config.d.ts +9 -0
- package/dist/types/utils/config.d.ts.map +1 -1
- package/dist/types/utils/json.d.ts +1 -1
- package/dist/types/utils/json.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/eip5792/get-calls-status.d.ts +1 -1
- package/dist/types/wallets/eip5792/get-capabilities.d.ts +1 -1
- package/dist/types/wallets/eip5792/send-calls.d.ts +2 -2
- package/dist/types/wallets/eip5792/wait-for-bundle.d.ts +1 -1
- package/dist/types/wallets/in-app/core/users/getUser.d.ts +1 -1
- package/dist/types/wallets/in-app/web/ecosystem.d.ts +7 -17
- package/dist/types/wallets/in-app/web/ecosystem.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts +2 -17
- package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +1 -0
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/passkeys.d.ts.map +1 -1
- package/dist/types/wallets/smart/smart-wallet.d.ts +1 -0
- package/dist/types/wallets/smart/smart-wallet.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/client/client.ts +1 -0
- package/src/exports/react.ts +56 -2
- package/src/extensions/erc721/lazyMinting/read/getBatchesToReveal.ts +1 -1
- package/src/extensions/modules/common/checkModulesCompatibility.ts +5 -0
- package/src/extensions/pack/createNewPack.ts +8 -3
- package/src/extensions/prebuilts/deploy-pack.ts +1 -0
- package/src/extensions/thirdweb/write/publish.ts +4 -0
- package/src/react/core/hooks/others/useChainQuery.ts +3 -3
- package/src/react/core/hooks/rpc/useBlockNumber.ts +1 -1
- package/src/react/core/hooks/wallets/useCapabilities.ts +1 -1
- package/src/react/core/hooks/wallets/useSendCalls.ts +3 -3
- package/src/react/core/providers/connection-manager.tsx +3 -0
- package/src/react/core/utils/wallet.ts +2 -1
- package/src/react/core/utils/walletIcon.ts +2 -0
- package/src/react/native/hooks/wallets/useProfiles.ts +1 -1
- package/src/react/native/providers/thirdweb-provider.tsx +1 -0
- package/src/react/native/ui/AutoConnect/AutoConnect.tsx +1 -0
- package/src/react/native/ui/connect/ConnectModal.tsx +1 -0
- package/src/react/native/ui/transaction/TransactionButton.tsx +1 -0
- package/src/react/web/hooks/wallets/useProfiles.ts +1 -1
- package/src/react/web/providers/thirdweb-provider.tsx +1 -0
- package/src/react/web/ui/AutoConnect/AutoConnect.tsx +1 -0
- package/src/react/web/ui/ConnectWallet/Blobbie.tsx +31 -4
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +36 -32
- package/src/react/web/ui/ConnectWallet/Details.tsx +91 -58
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +1 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +23 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +43 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +2 -3
- package/src/react/web/ui/PayEmbed.tsx +2 -2
- package/src/react/web/ui/SiteEmbed.tsx +3 -2
- package/src/react/web/ui/SiteLink.tsx +2 -1
- package/src/react/web/ui/TransactionButton/index.tsx +1 -0
- package/src/react/web/ui/prebuilt/Account/address.test.tsx +28 -0
- package/src/react/web/ui/prebuilt/Account/address.tsx +64 -0
- package/src/react/web/ui/prebuilt/Account/avatar.test.tsx +48 -0
- package/src/react/web/ui/prebuilt/Account/avatar.tsx +221 -0
- package/src/react/web/ui/prebuilt/Account/balance.test.tsx +54 -0
- package/src/react/web/ui/prebuilt/Account/balance.tsx +202 -0
- package/src/react/web/ui/prebuilt/Account/blobbie.tsx +12 -0
- package/src/react/web/ui/prebuilt/Account/name.test.tsx +62 -0
- package/src/react/web/ui/prebuilt/Account/name.tsx +175 -0
- package/src/react/web/ui/prebuilt/Account/provider.test.tsx +38 -0
- package/src/react/web/ui/prebuilt/Account/provider.tsx +69 -0
- package/src/react/web/ui/prebuilt/NFT/NFT.test.tsx +17 -14
- package/src/react/web/ui/prebuilt/NFT/description.tsx +87 -0
- package/src/react/web/ui/prebuilt/NFT/hooks.tsx +53 -0
- package/src/react/web/ui/prebuilt/NFT/media.tsx +119 -0
- package/src/react/web/ui/prebuilt/NFT/name.tsx +85 -0
- package/src/react/web/ui/prebuilt/NFT/provider.tsx +75 -0
- package/src/react/web/ui/prebuilt/Token/icon.tsx +164 -0
- package/src/react/web/ui/prebuilt/Token/name.tsx +201 -0
- package/src/react/web/ui/prebuilt/Token/provider.tsx +86 -0
- package/src/react/web/ui/prebuilt/Token/symbol.tsx +201 -0
- package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.tsx +1 -0
- package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx +1 -0
- package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.tsx +1 -0
- package/src/storage/unpin.ts +1 -1
- package/src/storage/upload.ts +1 -0
- package/src/transaction/actions/to-serializable-transaction.ts +1 -1
- package/src/transaction/actions/zksync/send-eip712-transaction.ts +5 -0
- package/src/utils/any-evm/zksync/isZkSyncChain.ts +5 -0
- package/src/utils/config.ts +9 -0
- package/src/utils/json.ts +8 -2
- package/src/version.ts +1 -1
- package/src/wallets/eip5792/get-calls-status.ts +1 -1
- package/src/wallets/eip5792/get-capabilities.ts +1 -1
- package/src/wallets/eip5792/send-calls.ts +2 -2
- package/src/wallets/eip5792/wait-for-bundle.ts +1 -1
- package/src/wallets/in-app/core/users/getUser.ts +1 -1
- package/src/wallets/in-app/web/ecosystem.ts +7 -17
- package/src/wallets/in-app/web/in-app.ts +2 -17
- package/src/wallets/in-app/web/lib/auth/index.ts +1 -0
- package/src/wallets/in-app/web/lib/auth/passkeys.ts +24 -23
- package/src/wallets/smart/smart-wallet.ts +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/NFT.js +0 -217
- package/dist/cjs/react/web/ui/prebuilt/NFT/NFT.js.map +0 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/NFT.js +0 -212
- package/dist/esm/react/web/ui/prebuilt/NFT/NFT.js.map +0 -1
- package/dist/types/react/web/ui/prebuilt/NFT/NFT.d.ts +0 -76
- package/dist/types/react/web/ui/prebuilt/NFT/NFT.d.ts.map +0 -1
- package/src/extensions/prebuilts/deploy-published.test.ts +0 -132
- package/src/react/web/ui/prebuilt/NFT/NFT.tsx +0 -272
- package/src/wallets/smart/smart-wallet-integration-v07.test.ts +0 -270
- package/src/wallets/smart/smart-wallet-integration.test.ts +0 -375
@@ -0,0 +1,87 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
import type { UseQueryOptions } from "@tanstack/react-query";
|
4
|
+
import type { JSX } from "react";
|
5
|
+
import type { NFT } from "../../../../../utils/nft/parseNft.js";
|
6
|
+
import { useNftInfo } from "./hooks.js";
|
7
|
+
import { useNFTContext } from "./provider.js";
|
8
|
+
|
9
|
+
export interface NFTDescriptionProps
|
10
|
+
extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
|
11
|
+
loadingComponent?: JSX.Element;
|
12
|
+
fallbackComponent?: JSX.Element;
|
13
|
+
/**
|
14
|
+
* Optional `useQuery` params
|
15
|
+
*/
|
16
|
+
queryOptions?: Omit<UseQueryOptions<NFT>, "queryFn" | "queryKey">;
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* This component fetches and displays an NFT's description. It inherits all the attributes of a <span>
|
21
|
+
* so you can style it just like how you would style a <span> element.
|
22
|
+
* @returns A <span> element containing the description of the NFT
|
23
|
+
*
|
24
|
+
* @example
|
25
|
+
* ### Basic usage
|
26
|
+
* ```tsx
|
27
|
+
* import { NFTProvider, NFTDescription } from "thirdweb/react";
|
28
|
+
*
|
29
|
+
* <NFTProvider>
|
30
|
+
* <NFTDescription />
|
31
|
+
* </NFTProvider>
|
32
|
+
* ```
|
33
|
+
*
|
34
|
+
* ### Show a loading sign while the description is being fetched
|
35
|
+
* ```tsx
|
36
|
+
* import { NFTProvider, NFTDescription } from "thirdweb/react";
|
37
|
+
*
|
38
|
+
* <NFTProvider>
|
39
|
+
* <NFTDescription loadingComponent={<YourLoadingSign />} />
|
40
|
+
* </NFTProvider>
|
41
|
+
* ```
|
42
|
+
*
|
43
|
+
* ### Show something in case the description failed to resolve
|
44
|
+
* ```tsx
|
45
|
+
* import { NFTProvider, NFTDescription } from "thirdweb/react";
|
46
|
+
*
|
47
|
+
* <NFTProvider>
|
48
|
+
* <NFTDescription fallbackComponent={<span>Failed to load description</span>} />
|
49
|
+
* </NFTProvider>
|
50
|
+
* ```
|
51
|
+
*
|
52
|
+
* ### Custom query options for useQuery (tanstack-query)
|
53
|
+
* ```tsx
|
54
|
+
* import { NFTProvider, NFTDescription } from "thirdweb/react";
|
55
|
+
*
|
56
|
+
* <NFTProvider>
|
57
|
+
* <NFTDescription queryOptions={{ retry: 3, enabled: false, }} />
|
58
|
+
* </NFTProvider>
|
59
|
+
* ```
|
60
|
+
*
|
61
|
+
* @component
|
62
|
+
* @nft
|
63
|
+
* @beta
|
64
|
+
*/
|
65
|
+
export function NFTDescription({
|
66
|
+
loadingComponent,
|
67
|
+
fallbackComponent,
|
68
|
+
queryOptions,
|
69
|
+
...restProps
|
70
|
+
}: NFTDescriptionProps) {
|
71
|
+
const { contract, tokenId } = useNFTContext();
|
72
|
+
const nftQuery = useNftInfo({
|
73
|
+
contract,
|
74
|
+
tokenId,
|
75
|
+
queryOptions,
|
76
|
+
});
|
77
|
+
|
78
|
+
if (nftQuery.isLoading) {
|
79
|
+
return loadingComponent || null;
|
80
|
+
}
|
81
|
+
|
82
|
+
if (!nftQuery.data?.metadata?.description) {
|
83
|
+
return fallbackComponent || null;
|
84
|
+
}
|
85
|
+
|
86
|
+
return <span {...restProps}>{nftQuery.data.metadata.description}</span>;
|
87
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { type UseQueryOptions, useQuery } from "@tanstack/react-query";
|
2
|
+
import { getNFT as getNFT721 } from "../../../../../extensions/erc721/read/getNFT.js";
|
3
|
+
import { getNFT as getNFT1155 } from "../../../../../extensions/erc1155/read/getNFT.js";
|
4
|
+
import type { NFT } from "../../../../../utils/nft/parseNft.js";
|
5
|
+
import type { NFTProviderProps } from "./provider.js";
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @internal Only used for the NFT prebuilt components
|
9
|
+
*/
|
10
|
+
export function useNftInfo(
|
11
|
+
props: NFTProviderProps & {
|
12
|
+
queryOptions?: Omit<UseQueryOptions<NFT>, "queryFn" | "queryKey">;
|
13
|
+
},
|
14
|
+
) {
|
15
|
+
return useQuery({
|
16
|
+
queryKey: [
|
17
|
+
"__nft_component_internal__",
|
18
|
+
props.contract.chain.id,
|
19
|
+
props.contract.address,
|
20
|
+
props.tokenId.toString(),
|
21
|
+
],
|
22
|
+
queryFn: () =>
|
23
|
+
getNFTInfo({ contract: props.contract, tokenId: props.tokenId }),
|
24
|
+
...props.queryOptions,
|
25
|
+
});
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @internal
|
30
|
+
*/
|
31
|
+
export async function getNFTInfo(options: NFTProviderProps): Promise<NFT> {
|
32
|
+
const nft = await Promise.allSettled([
|
33
|
+
getNFT721(options),
|
34
|
+
getNFT1155(options),
|
35
|
+
]).then(([possibleNFT721, possibleNFT1155]) => {
|
36
|
+
// getNFT extension always return an NFT object
|
37
|
+
// so we need to check if the tokenURI exists
|
38
|
+
if (
|
39
|
+
possibleNFT721.status === "fulfilled" &&
|
40
|
+
possibleNFT721.value.tokenURI
|
41
|
+
) {
|
42
|
+
return possibleNFT721.value;
|
43
|
+
}
|
44
|
+
if (
|
45
|
+
possibleNFT1155.status === "fulfilled" &&
|
46
|
+
possibleNFT1155.value.tokenURI
|
47
|
+
) {
|
48
|
+
return possibleNFT1155.value;
|
49
|
+
}
|
50
|
+
throw new Error("Failed to load NFT metadata");
|
51
|
+
});
|
52
|
+
return nft;
|
53
|
+
}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import type { UseQueryOptions } from "@tanstack/react-query";
|
2
|
+
import type { JSX } from "react";
|
3
|
+
import type { NFT } from "../../../../../utils/nft/parseNft.js";
|
4
|
+
import { MediaRenderer } from "../../MediaRenderer/MediaRenderer.js";
|
5
|
+
import type { MediaRendererProps } from "../../MediaRenderer/types.js";
|
6
|
+
import { useNftInfo } from "./hooks.js";
|
7
|
+
import { useNFTContext } from "./provider.js";
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @component
|
11
|
+
* The props for the <NFTMedia /> component
|
12
|
+
* It is similar to the [`MediaRendererProps`](https://portal.thirdweb.com/references/typescript/v5/MediaRendererProps)
|
13
|
+
* (excluding `src`, `poster` and `client`) that you can
|
14
|
+
* use to style the NFTMedia
|
15
|
+
*/
|
16
|
+
export type NFTMediaProps = Omit<
|
17
|
+
MediaRendererProps,
|
18
|
+
"src" | "poster" | "client"
|
19
|
+
> & {
|
20
|
+
loadingComponent?: JSX.Element;
|
21
|
+
fallbackComponent?: JSX.Element;
|
22
|
+
/**
|
23
|
+
* Optional `useQuery` params
|
24
|
+
*/
|
25
|
+
queryOptions?: Omit<UseQueryOptions<NFT>, "queryFn" | "queryKey">;
|
26
|
+
};
|
27
|
+
|
28
|
+
/**
|
29
|
+
* This component fetches and displays an NFT's media. It uses thirdweb [`MediaRenderer`](https://portal.thirdweb.com/refernces/typescript/v5/MediaRenderer) under the hood
|
30
|
+
* so you can style it just like how you would style a MediaRenderer.
|
31
|
+
* @returns A MediaRenderer component
|
32
|
+
*
|
33
|
+
* @component
|
34
|
+
*
|
35
|
+
* @example
|
36
|
+
* ### Basic usage
|
37
|
+
* ```tsx
|
38
|
+
* import { NFTProvider, NFTMedia } from "thirdweb/react";
|
39
|
+
*
|
40
|
+
* <NFTProvider>
|
41
|
+
* <NFTMedia />
|
42
|
+
* </NFTProvider>
|
43
|
+
* ```
|
44
|
+
*
|
45
|
+
* ### Show a loading sign while the media is being fetched
|
46
|
+
* ```tsx
|
47
|
+
* import { NFTProvider, NFTMedia } from "thirdweb/react";
|
48
|
+
*
|
49
|
+
* <NFTProvider>
|
50
|
+
* <NFTMedia loadingComponent={<YourLoadingSign />} />
|
51
|
+
* </NFTProvider>
|
52
|
+
* ```
|
53
|
+
*
|
54
|
+
* ### Show something in case the media failed to resolve
|
55
|
+
* ```tsx
|
56
|
+
* import { NFTProvider, NFTMedia } from "thirdweb/react";
|
57
|
+
*
|
58
|
+
* <NFTProvider>
|
59
|
+
* <NFTMedia fallbackComponent={<span>Failed to load media</span>} />
|
60
|
+
* </NFTProvider>
|
61
|
+
* ```
|
62
|
+
*
|
63
|
+
* ### Custom query options for useQuery (tanstack-query)
|
64
|
+
* ```tsx
|
65
|
+
* import { NFTProvider, NFTMedia } from "thirdweb/react";
|
66
|
+
*
|
67
|
+
* <NFTProvider>
|
68
|
+
* <NFTMedia queryOptions={{ retry: 3, enabled: false, }} />
|
69
|
+
* </NFTProvider>
|
70
|
+
* ```
|
71
|
+
*
|
72
|
+
* ### Basic stylings
|
73
|
+
*
|
74
|
+
* You can style NFTMedia with the `style` and `className` props.
|
75
|
+
*
|
76
|
+
* ```tsx
|
77
|
+
* <NFTMedia style={{ borderRadius: "8px" }} className="mx-auto" />
|
78
|
+
* ```
|
79
|
+
* @nft
|
80
|
+
* @beta
|
81
|
+
*/
|
82
|
+
export function NFTMedia({
|
83
|
+
loadingComponent,
|
84
|
+
fallbackComponent,
|
85
|
+
queryOptions,
|
86
|
+
...mediaRendererProps
|
87
|
+
}: NFTMediaProps) {
|
88
|
+
const { contract, tokenId } = useNFTContext();
|
89
|
+
const nftQuery = useNftInfo({
|
90
|
+
contract,
|
91
|
+
tokenId,
|
92
|
+
queryOptions,
|
93
|
+
});
|
94
|
+
|
95
|
+
if (nftQuery.isLoading) {
|
96
|
+
return loadingComponent || null;
|
97
|
+
}
|
98
|
+
|
99
|
+
if (!nftQuery.data) {
|
100
|
+
return fallbackComponent || null;
|
101
|
+
}
|
102
|
+
|
103
|
+
const animation_url = nftQuery.data.metadata.animation_url;
|
104
|
+
const image =
|
105
|
+
nftQuery.data.metadata.image || nftQuery.data.metadata.image_url;
|
106
|
+
|
107
|
+
if (!animation_url && !image) {
|
108
|
+
return fallbackComponent || null;
|
109
|
+
}
|
110
|
+
|
111
|
+
return (
|
112
|
+
<MediaRenderer
|
113
|
+
client={contract.client}
|
114
|
+
src={animation_url || image}
|
115
|
+
poster={image}
|
116
|
+
{...mediaRendererProps}
|
117
|
+
/>
|
118
|
+
);
|
119
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import type { UseQueryOptions } from "@tanstack/react-query";
|
2
|
+
import type { JSX } from "react";
|
3
|
+
import type { NFT } from "../../../../../utils/nft/parseNft.js";
|
4
|
+
import { useNftInfo } from "./hooks.js";
|
5
|
+
import { useNFTContext } from "./provider.js";
|
6
|
+
|
7
|
+
export interface NFTNameProps
|
8
|
+
extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
|
9
|
+
loadingComponent?: JSX.Element;
|
10
|
+
fallbackComponent?: JSX.Element;
|
11
|
+
/**
|
12
|
+
* Optional `useQuery` params
|
13
|
+
*/
|
14
|
+
queryOptions?: Omit<UseQueryOptions<NFT>, "queryFn" | "queryKey">;
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* This component fetches and displays an NFT's name. It takes in a `className` and `style` props
|
19
|
+
* so you can style it just like how you would style a <span> element.
|
20
|
+
* @returns A <span> element containing the name of the NFT
|
21
|
+
*
|
22
|
+
* @component
|
23
|
+
* @example
|
24
|
+
* ### Basic usage
|
25
|
+
* ```tsx
|
26
|
+
* import { NFTProvider, NFTName } from "thirdweb/react";
|
27
|
+
*
|
28
|
+
* <NFTProvider>
|
29
|
+
* <NFTName />
|
30
|
+
* </NFTProvider>
|
31
|
+
* ```
|
32
|
+
*
|
33
|
+
* ### Show a loading sign while the name is being fetched
|
34
|
+
* ```tsx
|
35
|
+
* import { NFTProvider, NFTName } from "thirdweb/react";
|
36
|
+
*
|
37
|
+
* <NFTProvider>
|
38
|
+
* <NFTName loadingComponent={<YourLoadingSign />} />
|
39
|
+
* </NFTProvider>
|
40
|
+
* ```
|
41
|
+
*
|
42
|
+
* ### Show something in case the name failed to resolve
|
43
|
+
* ```tsx
|
44
|
+
* import { NFTProvider, NFTName } from "thirdweb/react";
|
45
|
+
*
|
46
|
+
* <NFTProvider>
|
47
|
+
* <NFTName fallbackComponent={<span>Failed to load name</span>} />
|
48
|
+
* </NFTProvider>
|
49
|
+
* ```
|
50
|
+
*
|
51
|
+
* ### Custom query options for useQuery (tanstack-query)
|
52
|
+
* ```tsx
|
53
|
+
* import { NFTProvider, NFTName } from "thirdweb/react";
|
54
|
+
*
|
55
|
+
* <NFTProvider>
|
56
|
+
* <NFTName queryOptions={{ retry: 3, enabled: false, }} />
|
57
|
+
* </NFTProvider>
|
58
|
+
* ```
|
59
|
+
*
|
60
|
+
* @nft
|
61
|
+
* @beta
|
62
|
+
*/
|
63
|
+
export function NFTName({
|
64
|
+
loadingComponent,
|
65
|
+
fallbackComponent,
|
66
|
+
queryOptions,
|
67
|
+
...restProps
|
68
|
+
}: NFTNameProps) {
|
69
|
+
const { contract, tokenId } = useNFTContext();
|
70
|
+
|
71
|
+
const nftQuery = useNftInfo({
|
72
|
+
contract,
|
73
|
+
tokenId,
|
74
|
+
queryOptions,
|
75
|
+
});
|
76
|
+
|
77
|
+
if (nftQuery.isLoading) {
|
78
|
+
return loadingComponent || null;
|
79
|
+
}
|
80
|
+
|
81
|
+
if (!nftQuery.data?.metadata?.name) {
|
82
|
+
return fallbackComponent || null;
|
83
|
+
}
|
84
|
+
return <span {...restProps}>{nftQuery.data.metadata.name}</span>;
|
85
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { createContext, useContext } from "react";
|
2
|
+
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Props for the <NFT> component
|
6
|
+
* @component
|
7
|
+
*/
|
8
|
+
export type NFTProviderProps = {
|
9
|
+
/**
|
10
|
+
* The NFT contract address. Accepts both ERC721 and ERC1155 contracts
|
11
|
+
*/
|
12
|
+
contract: ThirdwebContract;
|
13
|
+
/**
|
14
|
+
* The tokenId whose info you want to display
|
15
|
+
*/
|
16
|
+
tokenId: bigint;
|
17
|
+
};
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @internal
|
21
|
+
*/
|
22
|
+
export const NFTProviderContext = /* @__PURE__ */ createContext<
|
23
|
+
NFTProviderProps | undefined
|
24
|
+
>(undefined);
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @internal
|
28
|
+
*/
|
29
|
+
export function useNFTContext() {
|
30
|
+
const ctx = useContext(NFTProviderContext);
|
31
|
+
if (!ctx) {
|
32
|
+
throw new Error(
|
33
|
+
"NFTProviderContext not found. Make sure you are using NFTMedia, NFTDescription, etc. inside a <NFTProvider /> component",
|
34
|
+
);
|
35
|
+
}
|
36
|
+
return ctx;
|
37
|
+
}
|
38
|
+
|
39
|
+
/**
|
40
|
+
* A React context provider component that supplies NFT-related data to its child components.
|
41
|
+
*
|
42
|
+
* This component serves as a wrapper around the `NFTProviderContext.Provider` and passes
|
43
|
+
* the provided NFT data down to all of its child components through the context API.
|
44
|
+
*
|
45
|
+
*
|
46
|
+
* @param {React.PropsWithChildren<NFTProviderProps>} props - The props for the NFT provider
|
47
|
+
*
|
48
|
+
* @example
|
49
|
+
* ```tsx
|
50
|
+
* import { getContract } from "thirdweb";
|
51
|
+
* import { NFTProvider, NFTMedia, NFTDescription, NFTName } from "thirdweb/react";
|
52
|
+
*
|
53
|
+
* const contract = getContract({
|
54
|
+
* address: "0x...",
|
55
|
+
* chain: ethereum,
|
56
|
+
* client: yourThirdwebClient,
|
57
|
+
* });
|
58
|
+
*
|
59
|
+
* <NFTProvider contract={contract} tokenId={0n}>
|
60
|
+
* <NFTMedia />
|
61
|
+
* <NFTDescription />
|
62
|
+
* <NFTName />
|
63
|
+
* </NFTProvider>
|
64
|
+
* ```
|
65
|
+
* @component
|
66
|
+
* @nft
|
67
|
+
* @beta
|
68
|
+
*/
|
69
|
+
export function NFTProvider(props: React.PropsWithChildren<NFTProviderProps>) {
|
70
|
+
return (
|
71
|
+
<NFTProviderContext.Provider value={props}>
|
72
|
+
{props.children}
|
73
|
+
</NFTProviderContext.Provider>
|
74
|
+
);
|
75
|
+
}
|
@@ -0,0 +1,164 @@
|
|
1
|
+
import { type UseQueryOptions, useQuery } from "@tanstack/react-query";
|
2
|
+
import type { JSX } from "react";
|
3
|
+
import { getChainMetadata } from "../../../../../chains/utils.js";
|
4
|
+
import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js";
|
5
|
+
import { getContract } from "../../../../../contract/contract.js";
|
6
|
+
import { getContractMetadata } from "../../../../../extensions/common/read/getContractMetadata.js";
|
7
|
+
import { resolveScheme } from "../../../../../utils/ipfs.js";
|
8
|
+
import { useTokenContext } from "./provider.js";
|
9
|
+
|
10
|
+
export interface TokenIconProps
|
11
|
+
extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "src"> {
|
12
|
+
/**
|
13
|
+
* This prop can be a string or a (async) function that resolves to a string, representing the icon url of the token
|
14
|
+
* This is particularly useful if you already have a way to fetch the token icon.
|
15
|
+
*/
|
16
|
+
iconResolver?: string | (() => string) | (() => Promise<string>);
|
17
|
+
/**
|
18
|
+
* This component will be shown while the avatar of the icon is being fetched
|
19
|
+
* If not passed, the component will return `null`.
|
20
|
+
*
|
21
|
+
* You can pass a loading sign or spinner to this prop.
|
22
|
+
* @example
|
23
|
+
* ```tsx
|
24
|
+
* <TokenIcon loadingComponent={<Spinner />} />
|
25
|
+
* ```
|
26
|
+
*/
|
27
|
+
loadingComponent?: JSX.Element;
|
28
|
+
/**
|
29
|
+
* This component will be shown if the request for fetching the avatar is done
|
30
|
+
* but could not retreive any result.
|
31
|
+
* You can pass a dummy avatar/image to this prop.
|
32
|
+
*
|
33
|
+
* If not passed, the component will return `null`
|
34
|
+
*
|
35
|
+
* @example
|
36
|
+
* ```tsx
|
37
|
+
* <TokenIcon fallbackComponent={<DummyImage />} />
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
fallbackComponent?: JSX.Element;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Optional query options for `useQuery`
|
44
|
+
*/
|
45
|
+
queryOptions?: Omit<UseQueryOptions<string>, "queryFn" | "queryKey">;
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* This component tries to resolve the icon of a given token, then return an image.
|
50
|
+
* @returns an <img /> with the src of the token icon
|
51
|
+
*
|
52
|
+
* @example
|
53
|
+
* ### Basic usage
|
54
|
+
* ```tsx
|
55
|
+
* import { TokenProvider, TokenIcon } from "thirdweb/react";
|
56
|
+
*
|
57
|
+
* <TokenProvider address="0x-token-address" chain={chain} client={client}>
|
58
|
+
* <TokenIcon />
|
59
|
+
* </TokenProvider>
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* Result: An <img /> component with the src of the icon
|
63
|
+
* ```html
|
64
|
+
* <img src="token-icon.png" />
|
65
|
+
* ```
|
66
|
+
*
|
67
|
+
* ### Override the icon with the `iconResolver` prop
|
68
|
+
* If you already have the icon url, you can skip the network requests and pass it directly to the TokenIcon
|
69
|
+
* ```tsx
|
70
|
+
* <TokenIcon iconResolver="/usdc.png" />
|
71
|
+
* ```
|
72
|
+
*
|
73
|
+
* You can also pass in your own custom (async) function that retrieves the icon url
|
74
|
+
* ```tsx
|
75
|
+
* const getIcon = async () => {
|
76
|
+
* const icon = getIconFromCoinMarketCap(tokenAddress, etc);
|
77
|
+
* return icon;
|
78
|
+
* };
|
79
|
+
*
|
80
|
+
* <TokenIcon iconResolver={getIcon} />
|
81
|
+
* ```
|
82
|
+
*
|
83
|
+
* ### Show a loading sign while the icon is being loaded
|
84
|
+
* ```tsx
|
85
|
+
* <TokenIcon loadingComponent={<Spinner />} />
|
86
|
+
* ```
|
87
|
+
*
|
88
|
+
* ### Fallback to a dummy image if the token icon fails to resolve
|
89
|
+
* ```tsx
|
90
|
+
* <TokenIcon fallbackComponent={<img src="blank-image.png" />} />
|
91
|
+
* ```
|
92
|
+
*
|
93
|
+
* ### Usage with queryOptions
|
94
|
+
* TokenIcon uses useQuery() from tanstack query internally.
|
95
|
+
* It allows you to pass a custom queryOptions of your choice for more control of the internal fetching logic
|
96
|
+
* ```tsx
|
97
|
+
* <TokenIcon queryOptions={{ enabled: someLogic, retry: 3, }} />
|
98
|
+
* ```
|
99
|
+
*
|
100
|
+
* @component
|
101
|
+
* @token
|
102
|
+
* @beta
|
103
|
+
*/
|
104
|
+
export function TokenIcon({
|
105
|
+
iconResolver,
|
106
|
+
loadingComponent,
|
107
|
+
fallbackComponent,
|
108
|
+
queryOptions,
|
109
|
+
...restProps
|
110
|
+
}: TokenIconProps) {
|
111
|
+
const { address, client, chain } = useTokenContext();
|
112
|
+
const iconQuery = useQuery({
|
113
|
+
queryKey: ["_internal_token_icon_", chain.id, address] as const,
|
114
|
+
queryFn: async () => {
|
115
|
+
if (typeof iconResolver === "string") {
|
116
|
+
return iconResolver;
|
117
|
+
}
|
118
|
+
if (typeof iconResolver === "function") {
|
119
|
+
return iconResolver();
|
120
|
+
}
|
121
|
+
if (address.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()) {
|
122
|
+
const possibleUrl = await getChainMetadata(chain).then(
|
123
|
+
(data) => data.icon?.url,
|
124
|
+
);
|
125
|
+
if (!possibleUrl) {
|
126
|
+
throw new Error("Failed to resolve icon for native token");
|
127
|
+
}
|
128
|
+
return resolveScheme({ uri: possibleUrl, client });
|
129
|
+
}
|
130
|
+
|
131
|
+
// Try to get the icon from the contractURI
|
132
|
+
const contractMetadata = await getContractMetadata({
|
133
|
+
contract: getContract({
|
134
|
+
address,
|
135
|
+
chain,
|
136
|
+
client,
|
137
|
+
}),
|
138
|
+
});
|
139
|
+
|
140
|
+
if (
|
141
|
+
!contractMetadata.image ||
|
142
|
+
typeof contractMetadata.image !== "string"
|
143
|
+
) {
|
144
|
+
throw new Error("Failed to resolve token icon from contract metadata");
|
145
|
+
}
|
146
|
+
|
147
|
+
return resolveScheme({
|
148
|
+
uri: contractMetadata.image,
|
149
|
+
client,
|
150
|
+
});
|
151
|
+
},
|
152
|
+
...queryOptions,
|
153
|
+
});
|
154
|
+
|
155
|
+
if (iconQuery.isLoading) {
|
156
|
+
return loadingComponent || null;
|
157
|
+
}
|
158
|
+
|
159
|
+
if (!iconQuery.data) {
|
160
|
+
return fallbackComponent || null;
|
161
|
+
}
|
162
|
+
|
163
|
+
return <img src={iconQuery.data} alt={restProps.alt} />;
|
164
|
+
}
|