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.
Files changed (453) hide show
  1. package/dist/cjs/client/client.js +1 -0
  2. package/dist/cjs/client/client.js.map +1 -1
  3. package/dist/cjs/exports/react.js +32 -3
  4. package/dist/cjs/exports/react.js.map +1 -1
  5. package/dist/cjs/extensions/erc721/lazyMinting/read/getBatchesToReveal.js +1 -1
  6. package/dist/cjs/extensions/modules/common/checkModulesCompatibility.js +5 -0
  7. package/dist/cjs/extensions/modules/common/checkModulesCompatibility.js.map +1 -1
  8. package/dist/cjs/extensions/pack/createNewPack.js +2 -1
  9. package/dist/cjs/extensions/pack/createNewPack.js.map +1 -1
  10. package/dist/cjs/extensions/prebuilts/deploy-pack.js +1 -0
  11. package/dist/cjs/extensions/prebuilts/deploy-pack.js.map +1 -1
  12. package/dist/cjs/extensions/thirdweb/write/publish.js +4 -0
  13. package/dist/cjs/extensions/thirdweb/write/publish.js.map +1 -1
  14. package/dist/cjs/react/core/hooks/others/useChainQuery.js +3 -3
  15. package/dist/cjs/react/core/hooks/rpc/useBlockNumber.js +1 -1
  16. package/dist/cjs/react/core/hooks/wallets/useCapabilities.js +1 -1
  17. package/dist/cjs/react/core/hooks/wallets/useSendCalls.js +3 -3
  18. package/dist/cjs/react/core/providers/connection-manager.js +3 -0
  19. package/dist/cjs/react/core/providers/connection-manager.js.map +1 -1
  20. package/dist/cjs/react/core/utils/wallet.js +2 -1
  21. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  22. package/dist/cjs/react/core/utils/walletIcon.js +2 -0
  23. package/dist/cjs/react/core/utils/walletIcon.js.map +1 -1
  24. package/dist/cjs/react/native/hooks/wallets/useProfiles.js +1 -1
  25. package/dist/cjs/react/native/providers/thirdweb-provider.js +1 -0
  26. package/dist/cjs/react/native/providers/thirdweb-provider.js.map +1 -1
  27. package/dist/cjs/react/native/ui/AutoConnect/AutoConnect.js +1 -0
  28. package/dist/cjs/react/native/ui/AutoConnect/AutoConnect.js.map +1 -1
  29. package/dist/cjs/react/native/ui/connect/ConnectModal.js +1 -0
  30. package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
  31. package/dist/cjs/react/native/ui/transaction/TransactionButton.js +1 -0
  32. package/dist/cjs/react/native/ui/transaction/TransactionButton.js.map +1 -1
  33. package/dist/cjs/react/web/hooks/wallets/useProfiles.js +1 -1
  34. package/dist/cjs/react/web/providers/thirdweb-provider.js +1 -0
  35. package/dist/cjs/react/web/providers/thirdweb-provider.js.map +1 -1
  36. package/dist/cjs/react/web/ui/AutoConnect/AutoConnect.js +1 -0
  37. package/dist/cjs/react/web/ui/AutoConnect/AutoConnect.js.map +1 -1
  38. package/dist/cjs/react/web/ui/ConnectWallet/Blobbie.js +19 -4
  39. package/dist/cjs/react/web/ui/ConnectWallet/Blobbie.js.map +1 -1
  40. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +21 -19
  41. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  42. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +18 -13
  43. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  44. package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +1 -0
  45. package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
  46. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +9 -0
  47. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  48. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +15 -2
  49. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
  50. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +2 -2
  51. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  52. package/dist/cjs/react/web/ui/PayEmbed.js +1 -0
  53. package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
  54. package/dist/cjs/react/web/ui/SiteEmbed.js +3 -2
  55. package/dist/cjs/react/web/ui/SiteEmbed.js.map +1 -1
  56. package/dist/cjs/react/web/ui/SiteLink.js +2 -1
  57. package/dist/cjs/react/web/ui/SiteLink.js.map +1 -1
  58. package/dist/cjs/react/web/ui/TransactionButton/index.js +1 -0
  59. package/dist/cjs/react/web/ui/TransactionButton/index.js.map +1 -1
  60. package/dist/cjs/react/web/ui/prebuilt/Account/address.js +49 -0
  61. package/dist/cjs/react/web/ui/prebuilt/Account/address.js.map +1 -0
  62. package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js +144 -0
  63. package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js.map +1 -0
  64. package/dist/cjs/react/web/ui/prebuilt/Account/balance.js +122 -0
  65. package/dist/cjs/react/web/ui/prebuilt/Account/balance.js.map +1 -0
  66. package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js +16 -0
  67. package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js.map +1 -0
  68. package/dist/cjs/react/web/ui/prebuilt/Account/name.js +106 -0
  69. package/dist/cjs/react/web/ui/prebuilt/Account/name.js.map +1 -0
  70. package/dist/cjs/react/web/ui/prebuilt/Account/provider.js +43 -0
  71. package/dist/cjs/react/web/ui/prebuilt/Account/provider.js.map +1 -0
  72. package/dist/cjs/react/web/ui/prebuilt/NFT/description.js +69 -0
  73. package/dist/cjs/react/web/ui/prebuilt/NFT/description.js.map +1 -0
  74. package/dist/cjs/react/web/ui/prebuilt/NFT/hooks.js +45 -0
  75. package/dist/cjs/react/web/ui/prebuilt/NFT/hooks.js.map +1 -0
  76. package/dist/cjs/react/web/ui/prebuilt/NFT/media.js +82 -0
  77. package/dist/cjs/react/web/ui/prebuilt/NFT/media.js.map +1 -0
  78. package/dist/cjs/react/web/ui/prebuilt/NFT/name.js +68 -0
  79. package/dist/cjs/react/web/ui/prebuilt/NFT/name.js.map +1 -0
  80. package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js +55 -0
  81. package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js.map +1 -0
  82. package/dist/cjs/react/web/ui/prebuilt/Token/icon.js +113 -0
  83. package/dist/cjs/react/web/ui/prebuilt/Token/icon.js.map +1 -0
  84. package/dist/cjs/react/web/ui/prebuilt/Token/name.js +137 -0
  85. package/dist/cjs/react/web/ui/prebuilt/Token/name.js.map +1 -0
  86. package/dist/cjs/react/web/ui/prebuilt/Token/provider.js +54 -0
  87. package/dist/cjs/react/web/ui/prebuilt/Token/provider.js.map +1 -0
  88. package/dist/cjs/react/web/ui/prebuilt/Token/symbol.js +134 -0
  89. package/dist/cjs/react/web/ui/prebuilt/Token/symbol.js.map +1 -0
  90. package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +1 -0
  91. package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -1
  92. package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +1 -0
  93. package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
  94. package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +1 -0
  95. package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -1
  96. package/dist/cjs/storage/unpin.js +1 -1
  97. package/dist/cjs/storage/upload.js +1 -0
  98. package/dist/cjs/storage/upload.js.map +1 -1
  99. package/dist/cjs/transaction/actions/to-serializable-transaction.js +1 -1
  100. package/dist/cjs/transaction/actions/zksync/send-eip712-transaction.js +5 -0
  101. package/dist/cjs/transaction/actions/zksync/send-eip712-transaction.js.map +1 -1
  102. package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js +5 -0
  103. package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
  104. package/dist/cjs/utils/config.js +9 -0
  105. package/dist/cjs/utils/config.js.map +1 -1
  106. package/dist/cjs/utils/json.js +7 -4
  107. package/dist/cjs/utils/json.js.map +1 -1
  108. package/dist/cjs/version.js +1 -1
  109. package/dist/cjs/version.js.map +1 -1
  110. package/dist/cjs/wallets/eip5792/get-calls-status.js +1 -1
  111. package/dist/cjs/wallets/eip5792/get-capabilities.js +1 -1
  112. package/dist/cjs/wallets/eip5792/send-calls.js +2 -2
  113. package/dist/cjs/wallets/eip5792/wait-for-bundle.js +1 -1
  114. package/dist/cjs/wallets/in-app/core/users/getUser.js +1 -1
  115. package/dist/cjs/wallets/in-app/web/ecosystem.js +7 -17
  116. package/dist/cjs/wallets/in-app/web/ecosystem.js.map +1 -1
  117. package/dist/cjs/wallets/in-app/web/in-app.js +2 -17
  118. package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
  119. package/dist/cjs/wallets/in-app/web/lib/auth/index.js +1 -0
  120. package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
  121. package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js +17 -16
  122. package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
  123. package/dist/cjs/wallets/smart/smart-wallet.js +1 -0
  124. package/dist/cjs/wallets/smart/smart-wallet.js.map +1 -1
  125. package/dist/esm/client/client.js +1 -0
  126. package/dist/esm/client/client.js.map +1 -1
  127. package/dist/esm/exports/react.js +17 -1
  128. package/dist/esm/exports/react.js.map +1 -1
  129. package/dist/esm/extensions/erc721/lazyMinting/read/getBatchesToReveal.js +1 -1
  130. package/dist/esm/extensions/modules/common/checkModulesCompatibility.js +5 -0
  131. package/dist/esm/extensions/modules/common/checkModulesCompatibility.js.map +1 -1
  132. package/dist/esm/extensions/pack/createNewPack.js +2 -1
  133. package/dist/esm/extensions/pack/createNewPack.js.map +1 -1
  134. package/dist/esm/extensions/prebuilts/deploy-pack.js +1 -0
  135. package/dist/esm/extensions/prebuilts/deploy-pack.js.map +1 -1
  136. package/dist/esm/extensions/thirdweb/write/publish.js +4 -0
  137. package/dist/esm/extensions/thirdweb/write/publish.js.map +1 -1
  138. package/dist/esm/react/core/hooks/others/useChainQuery.js +3 -3
  139. package/dist/esm/react/core/hooks/rpc/useBlockNumber.js +1 -1
  140. package/dist/esm/react/core/hooks/wallets/useCapabilities.js +1 -1
  141. package/dist/esm/react/core/hooks/wallets/useSendCalls.js +3 -3
  142. package/dist/esm/react/core/providers/connection-manager.js +3 -0
  143. package/dist/esm/react/core/providers/connection-manager.js.map +1 -1
  144. package/dist/esm/react/core/utils/wallet.js +2 -1
  145. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  146. package/dist/esm/react/core/utils/walletIcon.js +2 -0
  147. package/dist/esm/react/core/utils/walletIcon.js.map +1 -1
  148. package/dist/esm/react/native/hooks/wallets/useProfiles.js +1 -1
  149. package/dist/esm/react/native/providers/thirdweb-provider.js +1 -0
  150. package/dist/esm/react/native/providers/thirdweb-provider.js.map +1 -1
  151. package/dist/esm/react/native/ui/AutoConnect/AutoConnect.js +1 -0
  152. package/dist/esm/react/native/ui/AutoConnect/AutoConnect.js.map +1 -1
  153. package/dist/esm/react/native/ui/connect/ConnectModal.js +1 -0
  154. package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
  155. package/dist/esm/react/native/ui/transaction/TransactionButton.js +1 -0
  156. package/dist/esm/react/native/ui/transaction/TransactionButton.js.map +1 -1
  157. package/dist/esm/react/web/hooks/wallets/useProfiles.js +1 -1
  158. package/dist/esm/react/web/providers/thirdweb-provider.js +1 -0
  159. package/dist/esm/react/web/providers/thirdweb-provider.js.map +1 -1
  160. package/dist/esm/react/web/ui/AutoConnect/AutoConnect.js +1 -0
  161. package/dist/esm/react/web/ui/AutoConnect/AutoConnect.js.map +1 -1
  162. package/dist/esm/react/web/ui/ConnectWallet/Blobbie.js +19 -4
  163. package/dist/esm/react/web/ui/ConnectWallet/Blobbie.js.map +1 -1
  164. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +21 -19
  165. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  166. package/dist/esm/react/web/ui/ConnectWallet/Details.js +19 -14
  167. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  168. package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +1 -0
  169. package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
  170. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +9 -0
  171. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  172. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +15 -2
  173. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
  174. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +2 -2
  175. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  176. package/dist/esm/react/web/ui/PayEmbed.js +1 -0
  177. package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
  178. package/dist/esm/react/web/ui/SiteEmbed.js +3 -2
  179. package/dist/esm/react/web/ui/SiteEmbed.js.map +1 -1
  180. package/dist/esm/react/web/ui/SiteLink.js +2 -1
  181. package/dist/esm/react/web/ui/SiteLink.js.map +1 -1
  182. package/dist/esm/react/web/ui/TransactionButton/index.js +1 -0
  183. package/dist/esm/react/web/ui/TransactionButton/index.js.map +1 -1
  184. package/dist/esm/react/web/ui/prebuilt/Account/address.js +46 -0
  185. package/dist/esm/react/web/ui/prebuilt/Account/address.js.map +1 -0
  186. package/dist/esm/react/web/ui/prebuilt/Account/avatar.js +141 -0
  187. package/dist/esm/react/web/ui/prebuilt/Account/avatar.js.map +1 -0
  188. package/dist/esm/react/web/ui/prebuilt/Account/balance.js +119 -0
  189. package/dist/esm/react/web/ui/prebuilt/Account/balance.js.map +1 -0
  190. package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js +13 -0
  191. package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js.map +1 -0
  192. package/dist/esm/react/web/ui/prebuilt/Account/name.js +103 -0
  193. package/dist/esm/react/web/ui/prebuilt/Account/name.js.map +1 -0
  194. package/dist/esm/react/web/ui/prebuilt/Account/provider.js +39 -0
  195. package/dist/esm/react/web/ui/prebuilt/Account/provider.js.map +1 -0
  196. package/dist/esm/react/web/ui/prebuilt/NFT/description.js +66 -0
  197. package/dist/esm/react/web/ui/prebuilt/NFT/description.js.map +1 -0
  198. package/dist/esm/react/web/ui/prebuilt/NFT/hooks.js +41 -0
  199. package/dist/esm/react/web/ui/prebuilt/NFT/hooks.js.map +1 -0
  200. package/dist/esm/react/web/ui/prebuilt/NFT/media.js +79 -0
  201. package/dist/esm/react/web/ui/prebuilt/NFT/media.js.map +1 -0
  202. package/dist/esm/react/web/ui/prebuilt/NFT/name.js +65 -0
  203. package/dist/esm/react/web/ui/prebuilt/NFT/name.js.map +1 -0
  204. package/dist/esm/react/web/ui/prebuilt/NFT/provider.js +50 -0
  205. package/dist/esm/react/web/ui/prebuilt/NFT/provider.js.map +1 -0
  206. package/dist/esm/react/web/ui/prebuilt/Token/icon.js +110 -0
  207. package/dist/esm/react/web/ui/prebuilt/Token/icon.js.map +1 -0
  208. package/dist/esm/react/web/ui/prebuilt/Token/name.js +134 -0
  209. package/dist/esm/react/web/ui/prebuilt/Token/name.js.map +1 -0
  210. package/dist/esm/react/web/ui/prebuilt/Token/provider.js +50 -0
  211. package/dist/esm/react/web/ui/prebuilt/Token/provider.js.map +1 -0
  212. package/dist/esm/react/web/ui/prebuilt/Token/symbol.js +131 -0
  213. package/dist/esm/react/web/ui/prebuilt/Token/symbol.js.map +1 -0
  214. package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +1 -0
  215. package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -1
  216. package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +1 -0
  217. package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
  218. package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +1 -0
  219. package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -1
  220. package/dist/esm/storage/unpin.js +1 -1
  221. package/dist/esm/storage/upload.js +1 -0
  222. package/dist/esm/storage/upload.js.map +1 -1
  223. package/dist/esm/transaction/actions/to-serializable-transaction.js +1 -1
  224. package/dist/esm/transaction/actions/zksync/send-eip712-transaction.js +5 -0
  225. package/dist/esm/transaction/actions/zksync/send-eip712-transaction.js.map +1 -1
  226. package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js +5 -0
  227. package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
  228. package/dist/esm/utils/config.js +9 -0
  229. package/dist/esm/utils/config.js.map +1 -1
  230. package/dist/esm/utils/json.js +6 -2
  231. package/dist/esm/utils/json.js.map +1 -1
  232. package/dist/esm/version.js +1 -1
  233. package/dist/esm/version.js.map +1 -1
  234. package/dist/esm/wallets/eip5792/get-calls-status.js +1 -1
  235. package/dist/esm/wallets/eip5792/get-capabilities.js +1 -1
  236. package/dist/esm/wallets/eip5792/send-calls.js +2 -2
  237. package/dist/esm/wallets/eip5792/wait-for-bundle.js +1 -1
  238. package/dist/esm/wallets/in-app/core/users/getUser.js +1 -1
  239. package/dist/esm/wallets/in-app/web/ecosystem.js +7 -17
  240. package/dist/esm/wallets/in-app/web/ecosystem.js.map +1 -1
  241. package/dist/esm/wallets/in-app/web/in-app.js +2 -17
  242. package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
  243. package/dist/esm/wallets/in-app/web/lib/auth/index.js +1 -0
  244. package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
  245. package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js +18 -17
  246. package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
  247. package/dist/esm/wallets/smart/smart-wallet.js +1 -0
  248. package/dist/esm/wallets/smart/smart-wallet.js.map +1 -1
  249. package/dist/types/client/client.d.ts +1 -0
  250. package/dist/types/client/client.d.ts.map +1 -1
  251. package/dist/types/exports/react.d.ts +14 -1
  252. package/dist/types/exports/react.d.ts.map +1 -1
  253. package/dist/types/extensions/erc721/lazyMinting/read/getBatchesToReveal.d.ts +1 -1
  254. package/dist/types/extensions/modules/common/checkModulesCompatibility.d.ts +5 -0
  255. package/dist/types/extensions/modules/common/checkModulesCompatibility.d.ts.map +1 -1
  256. package/dist/types/extensions/pack/createNewPack.d.ts +2 -2
  257. package/dist/types/extensions/pack/createNewPack.d.ts.map +1 -1
  258. package/dist/types/extensions/prebuilts/deploy-pack.d.ts +1 -0
  259. package/dist/types/extensions/prebuilts/deploy-pack.d.ts.map +1 -1
  260. package/dist/types/extensions/thirdweb/write/publish.d.ts +4 -0
  261. package/dist/types/extensions/thirdweb/write/publish.d.ts.map +1 -1
  262. package/dist/types/react/core/hooks/others/useChainQuery.d.ts +3 -3
  263. package/dist/types/react/core/hooks/rpc/useBlockNumber.d.ts +1 -1
  264. package/dist/types/react/core/hooks/wallets/useCapabilities.d.ts +1 -1
  265. package/dist/types/react/core/hooks/wallets/useSendCalls.d.ts +3 -3
  266. package/dist/types/react/core/providers/connection-manager.d.ts +3 -0
  267. package/dist/types/react/core/providers/connection-manager.d.ts.map +1 -1
  268. package/dist/types/react/core/utils/wallet.d.ts +2 -1
  269. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  270. package/dist/types/react/core/utils/walletIcon.d.ts +2 -0
  271. package/dist/types/react/core/utils/walletIcon.d.ts.map +1 -1
  272. package/dist/types/react/native/hooks/wallets/useProfiles.d.ts +1 -1
  273. package/dist/types/react/native/providers/thirdweb-provider.d.ts +1 -0
  274. package/dist/types/react/native/providers/thirdweb-provider.d.ts.map +1 -1
  275. package/dist/types/react/native/ui/AutoConnect/AutoConnect.d.ts +1 -0
  276. package/dist/types/react/native/ui/AutoConnect/AutoConnect.d.ts.map +1 -1
  277. package/dist/types/react/native/ui/connect/ConnectModal.d.ts +1 -0
  278. package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
  279. package/dist/types/react/native/ui/transaction/TransactionButton.d.ts +1 -0
  280. package/dist/types/react/native/ui/transaction/TransactionButton.d.ts.map +1 -1
  281. package/dist/types/react/web/hooks/wallets/useProfiles.d.ts +1 -1
  282. package/dist/types/react/web/providers/thirdweb-provider.d.ts +1 -0
  283. package/dist/types/react/web/providers/thirdweb-provider.d.ts.map +1 -1
  284. package/dist/types/react/web/ui/AutoConnect/AutoConnect.d.ts +1 -0
  285. package/dist/types/react/web/ui/AutoConnect/AutoConnect.d.ts.map +1 -1
  286. package/dist/types/react/web/ui/ConnectWallet/Blobbie.d.ts +22 -5
  287. package/dist/types/react/web/ui/ConnectWallet/Blobbie.d.ts.map +1 -1
  288. package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts +2 -1
  289. package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
  290. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  291. package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts +1 -0
  292. package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
  293. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
  294. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +1 -1
  295. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts.map +1 -1
  296. package/dist/types/react/web/ui/PayEmbed.d.ts +2 -2
  297. package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
  298. package/dist/types/react/web/ui/SiteEmbed.d.ts +3 -2
  299. package/dist/types/react/web/ui/SiteEmbed.d.ts.map +1 -1
  300. package/dist/types/react/web/ui/SiteLink.d.ts +2 -1
  301. package/dist/types/react/web/ui/SiteLink.d.ts.map +1 -1
  302. package/dist/types/react/web/ui/TransactionButton/index.d.ts +1 -0
  303. package/dist/types/react/web/ui/TransactionButton/index.d.ts.map +1 -1
  304. package/dist/types/react/web/ui/prebuilt/Account/address.d.ts +52 -0
  305. package/dist/types/react/web/ui/prebuilt/Account/address.d.ts.map +1 -0
  306. package/dist/types/react/web/ui/prebuilt/Account/avatar.d.ts +142 -0
  307. package/dist/types/react/web/ui/prebuilt/Account/avatar.d.ts.map +1 -0
  308. package/dist/types/react/web/ui/prebuilt/Account/balance.d.ts +137 -0
  309. package/dist/types/react/web/ui/prebuilt/Account/balance.d.ts.map +1 -0
  310. package/dist/types/react/web/ui/prebuilt/Account/blobbie.d.ts +8 -0
  311. package/dist/types/react/web/ui/prebuilt/Account/blobbie.d.ts.map +1 -0
  312. package/dist/types/react/web/ui/prebuilt/Account/name.d.ts +119 -0
  313. package/dist/types/react/web/ui/prebuilt/Account/name.d.ts.map +1 -0
  314. package/dist/types/react/web/ui/prebuilt/Account/provider.d.ts +45 -0
  315. package/dist/types/react/web/ui/prebuilt/Account/provider.d.ts.map +1 -0
  316. package/dist/types/react/web/ui/prebuilt/NFT/description.d.ts +59 -0
  317. package/dist/types/react/web/ui/prebuilt/NFT/description.d.ts.map +1 -0
  318. package/dist/types/react/web/ui/prebuilt/NFT/hooks.d.ts +14 -0
  319. package/dist/types/react/web/ui/prebuilt/NFT/hooks.d.ts.map +1 -0
  320. package/dist/types/react/web/ui/prebuilt/NFT/media.d.ts +75 -0
  321. package/dist/types/react/web/ui/prebuilt/NFT/media.d.ts.map +1 -0
  322. package/dist/types/react/web/ui/prebuilt/NFT/name.d.ts +59 -0
  323. package/dist/types/react/web/ui/prebuilt/NFT/name.d.ts.map +1 -0
  324. package/dist/types/react/web/ui/prebuilt/NFT/provider.d.ts +55 -0
  325. package/dist/types/react/web/ui/prebuilt/NFT/provider.d.ts.map +1 -0
  326. package/dist/types/react/web/ui/prebuilt/Token/icon.d.ts +95 -0
  327. package/dist/types/react/web/ui/prebuilt/Token/icon.d.ts.map +1 -0
  328. package/dist/types/react/web/ui/prebuilt/Token/name.d.ts +140 -0
  329. package/dist/types/react/web/ui/prebuilt/Token/name.d.ts.map +1 -0
  330. package/dist/types/react/web/ui/prebuilt/Token/provider.d.ts +61 -0
  331. package/dist/types/react/web/ui/prebuilt/Token/provider.d.ts.map +1 -0
  332. package/dist/types/react/web/ui/prebuilt/Token/symbol.d.ts +137 -0
  333. package/dist/types/react/web/ui/prebuilt/Token/symbol.d.ts.map +1 -0
  334. package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts +1 -0
  335. package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts.map +1 -1
  336. package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts +1 -0
  337. package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts.map +1 -1
  338. package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts +1 -0
  339. package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts.map +1 -1
  340. package/dist/types/storage/unpin.d.ts +1 -1
  341. package/dist/types/storage/upload.d.ts +1 -0
  342. package/dist/types/storage/upload.d.ts.map +1 -1
  343. package/dist/types/transaction/actions/to-serializable-transaction.d.ts +1 -1
  344. package/dist/types/transaction/actions/zksync/send-eip712-transaction.d.ts +5 -0
  345. package/dist/types/transaction/actions/zksync/send-eip712-transaction.d.ts.map +1 -1
  346. package/dist/types/utils/any-evm/zksync/isZkSyncChain.d.ts +5 -0
  347. package/dist/types/utils/any-evm/zksync/isZkSyncChain.d.ts.map +1 -1
  348. package/dist/types/utils/config.d.ts +9 -0
  349. package/dist/types/utils/config.d.ts.map +1 -1
  350. package/dist/types/utils/json.d.ts +1 -1
  351. package/dist/types/utils/json.d.ts.map +1 -1
  352. package/dist/types/version.d.ts +1 -1
  353. package/dist/types/version.d.ts.map +1 -1
  354. package/dist/types/wallets/eip5792/get-calls-status.d.ts +1 -1
  355. package/dist/types/wallets/eip5792/get-capabilities.d.ts +1 -1
  356. package/dist/types/wallets/eip5792/send-calls.d.ts +2 -2
  357. package/dist/types/wallets/eip5792/wait-for-bundle.d.ts +1 -1
  358. package/dist/types/wallets/in-app/core/users/getUser.d.ts +1 -1
  359. package/dist/types/wallets/in-app/web/ecosystem.d.ts +7 -17
  360. package/dist/types/wallets/in-app/web/ecosystem.d.ts.map +1 -1
  361. package/dist/types/wallets/in-app/web/in-app.d.ts +2 -17
  362. package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
  363. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +1 -0
  364. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
  365. package/dist/types/wallets/in-app/web/lib/auth/passkeys.d.ts.map +1 -1
  366. package/dist/types/wallets/smart/smart-wallet.d.ts +1 -0
  367. package/dist/types/wallets/smart/smart-wallet.d.ts.map +1 -1
  368. package/package.json +2 -2
  369. package/src/client/client.ts +1 -0
  370. package/src/exports/react.ts +56 -2
  371. package/src/extensions/erc721/lazyMinting/read/getBatchesToReveal.ts +1 -1
  372. package/src/extensions/modules/common/checkModulesCompatibility.ts +5 -0
  373. package/src/extensions/pack/createNewPack.ts +8 -3
  374. package/src/extensions/prebuilts/deploy-pack.ts +1 -0
  375. package/src/extensions/thirdweb/write/publish.ts +4 -0
  376. package/src/react/core/hooks/others/useChainQuery.ts +3 -3
  377. package/src/react/core/hooks/rpc/useBlockNumber.ts +1 -1
  378. package/src/react/core/hooks/wallets/useCapabilities.ts +1 -1
  379. package/src/react/core/hooks/wallets/useSendCalls.ts +3 -3
  380. package/src/react/core/providers/connection-manager.tsx +3 -0
  381. package/src/react/core/utils/wallet.ts +2 -1
  382. package/src/react/core/utils/walletIcon.ts +2 -0
  383. package/src/react/native/hooks/wallets/useProfiles.ts +1 -1
  384. package/src/react/native/providers/thirdweb-provider.tsx +1 -0
  385. package/src/react/native/ui/AutoConnect/AutoConnect.tsx +1 -0
  386. package/src/react/native/ui/connect/ConnectModal.tsx +1 -0
  387. package/src/react/native/ui/transaction/TransactionButton.tsx +1 -0
  388. package/src/react/web/hooks/wallets/useProfiles.ts +1 -1
  389. package/src/react/web/providers/thirdweb-provider.tsx +1 -0
  390. package/src/react/web/ui/AutoConnect/AutoConnect.tsx +1 -0
  391. package/src/react/web/ui/ConnectWallet/Blobbie.tsx +31 -4
  392. package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +36 -32
  393. package/src/react/web/ui/ConnectWallet/Details.tsx +91 -58
  394. package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +1 -0
  395. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +23 -0
  396. package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +43 -2
  397. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +2 -3
  398. package/src/react/web/ui/PayEmbed.tsx +2 -2
  399. package/src/react/web/ui/SiteEmbed.tsx +3 -2
  400. package/src/react/web/ui/SiteLink.tsx +2 -1
  401. package/src/react/web/ui/TransactionButton/index.tsx +1 -0
  402. package/src/react/web/ui/prebuilt/Account/address.test.tsx +28 -0
  403. package/src/react/web/ui/prebuilt/Account/address.tsx +64 -0
  404. package/src/react/web/ui/prebuilt/Account/avatar.test.tsx +48 -0
  405. package/src/react/web/ui/prebuilt/Account/avatar.tsx +221 -0
  406. package/src/react/web/ui/prebuilt/Account/balance.test.tsx +54 -0
  407. package/src/react/web/ui/prebuilt/Account/balance.tsx +202 -0
  408. package/src/react/web/ui/prebuilt/Account/blobbie.tsx +12 -0
  409. package/src/react/web/ui/prebuilt/Account/name.test.tsx +62 -0
  410. package/src/react/web/ui/prebuilt/Account/name.tsx +175 -0
  411. package/src/react/web/ui/prebuilt/Account/provider.test.tsx +38 -0
  412. package/src/react/web/ui/prebuilt/Account/provider.tsx +69 -0
  413. package/src/react/web/ui/prebuilt/NFT/NFT.test.tsx +17 -14
  414. package/src/react/web/ui/prebuilt/NFT/description.tsx +87 -0
  415. package/src/react/web/ui/prebuilt/NFT/hooks.tsx +53 -0
  416. package/src/react/web/ui/prebuilt/NFT/media.tsx +119 -0
  417. package/src/react/web/ui/prebuilt/NFT/name.tsx +85 -0
  418. package/src/react/web/ui/prebuilt/NFT/provider.tsx +75 -0
  419. package/src/react/web/ui/prebuilt/Token/icon.tsx +164 -0
  420. package/src/react/web/ui/prebuilt/Token/name.tsx +201 -0
  421. package/src/react/web/ui/prebuilt/Token/provider.tsx +86 -0
  422. package/src/react/web/ui/prebuilt/Token/symbol.tsx +201 -0
  423. package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.tsx +1 -0
  424. package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx +1 -0
  425. package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.tsx +1 -0
  426. package/src/storage/unpin.ts +1 -1
  427. package/src/storage/upload.ts +1 -0
  428. package/src/transaction/actions/to-serializable-transaction.ts +1 -1
  429. package/src/transaction/actions/zksync/send-eip712-transaction.ts +5 -0
  430. package/src/utils/any-evm/zksync/isZkSyncChain.ts +5 -0
  431. package/src/utils/config.ts +9 -0
  432. package/src/utils/json.ts +8 -2
  433. package/src/version.ts +1 -1
  434. package/src/wallets/eip5792/get-calls-status.ts +1 -1
  435. package/src/wallets/eip5792/get-capabilities.ts +1 -1
  436. package/src/wallets/eip5792/send-calls.ts +2 -2
  437. package/src/wallets/eip5792/wait-for-bundle.ts +1 -1
  438. package/src/wallets/in-app/core/users/getUser.ts +1 -1
  439. package/src/wallets/in-app/web/ecosystem.ts +7 -17
  440. package/src/wallets/in-app/web/in-app.ts +2 -17
  441. package/src/wallets/in-app/web/lib/auth/index.ts +1 -0
  442. package/src/wallets/in-app/web/lib/auth/passkeys.ts +24 -23
  443. package/src/wallets/smart/smart-wallet.ts +1 -0
  444. package/dist/cjs/react/web/ui/prebuilt/NFT/NFT.js +0 -217
  445. package/dist/cjs/react/web/ui/prebuilt/NFT/NFT.js.map +0 -1
  446. package/dist/esm/react/web/ui/prebuilt/NFT/NFT.js +0 -212
  447. package/dist/esm/react/web/ui/prebuilt/NFT/NFT.js.map +0 -1
  448. package/dist/types/react/web/ui/prebuilt/NFT/NFT.d.ts +0 -76
  449. package/dist/types/react/web/ui/prebuilt/NFT/NFT.d.ts.map +0 -1
  450. package/src/extensions/prebuilts/deploy-published.test.ts +0 -132
  451. package/src/react/web/ui/prebuilt/NFT/NFT.tsx +0 -272
  452. package/src/wallets/smart/smart-wallet-integration-v07.test.ts +0 -270
  453. package/src/wallets/smart/smart-wallet-integration.test.ts +0 -375
@@ -0,0 +1,201 @@
1
+ "use client";
2
+
3
+ import { type UseQueryOptions, useQuery } from "@tanstack/react-query";
4
+ import type React from "react";
5
+ import type { JSX } from "react";
6
+ import { getChainMetadata } from "../../../../../chains/utils.js";
7
+ import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js";
8
+ import { getContract } from "../../../../../contract/contract.js";
9
+ import { getContractMetadata } from "../../../../../extensions/common/read/getContractMetadata.js";
10
+ import { name } from "../../../../../extensions/common/read/name.js";
11
+ import { useTokenContext } from "./provider.js";
12
+
13
+ /**
14
+ * Props for the TokenName component
15
+ * @component
16
+ * @token
17
+ */
18
+ export interface TokenNameProps
19
+ extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
20
+ /**
21
+ * This prop can be a string or a (async) function that resolves to a string, representing the name of the token
22
+ * This is particularly useful if you already have a way to fetch the token name.
23
+ */
24
+ nameResolver?: string | (() => string) | (() => Promise<string>);
25
+ /**
26
+ * A function to format the name's display value
27
+ * Particularly useful to avoid overflowing-UI issues
28
+ *
29
+ * ```tsx
30
+ * <TokenName formatFn={(str: string) => doSomething()} />
31
+ * ```
32
+ */
33
+ formatFn?: (str: string) => string;
34
+ /**
35
+ * This component will be shown while the name of the token is being fetched
36
+ * If not passed, the component will return `null`.
37
+ *
38
+ * You can/should pass a loading sign or spinner to this prop.
39
+ * @example
40
+ * ```tsx
41
+ * <TokenName loadingComponent={<Spinner />} />
42
+ * ```
43
+ */
44
+ loadingComponent?: JSX.Element;
45
+ /**
46
+ * This component will be shown if the name fails to be retreived
47
+ * If not passed, the component will return `null`.
48
+ *
49
+ * You can/should pass a descriptive text/component to this prop, indicating that the
50
+ * name was not fetched succesfully
51
+ * @example
52
+ * ```tsx
53
+ * <TokenName fallbackComponent={"Failed to load"}
54
+ * />
55
+ * ```
56
+ */
57
+ fallbackComponent?: JSX.Element;
58
+ /**
59
+ * Optional `useQuery` params
60
+ */
61
+ queryOptions?: Omit<UseQueryOptions<string>, "queryFn" | "queryKey">;
62
+ }
63
+
64
+ /**
65
+ * This component fetches then shows the name of a token. For ERC20 tokens, it calls the `name` function in the ERC20 contract.
66
+ * It inherits all the attributes of a HTML <span> component, hence you can style it just like how you would style a normal <span>
67
+ *
68
+ *
69
+ * @example
70
+ * ### Basic usage
71
+ * ```tsx
72
+ * import { TokenProvider, TokenName } from "thirdweb/react";
73
+ * import { ethereum } from "thirdweb/chains";
74
+ *
75
+ * <TokenProvider {...props}>
76
+ * <TokenName />
77
+ * </TokenProvider>
78
+ * ```
79
+ * Result:
80
+ * ```html
81
+ * <span>Ether</span>
82
+ * ```
83
+ *
84
+ * ### Custom name resolver
85
+ * By default TokenName will call the `name` method of the token contract.
86
+ * However if you have a different way to fetch the name, you can pass the function to the `nameResolver` prop.
87
+ * Note: nameResolver should either be a string or a function (async) that returns a string.
88
+ * ```tsx
89
+ * async function fetchNameMethod() {
90
+ * // your own fetching logic
91
+ * return "the token name";
92
+ * }
93
+ *
94
+ * <TokenName nameResolver={fetchNameMethod} />
95
+ * ```
96
+ *
97
+ * Alternatively you can also pass in a string directly:
98
+ * ```tsx
99
+ * <TokenName nameResolver="USD Coin Circle" />
100
+ * ```
101
+ *
102
+ *
103
+ * ### Format the name (capitalize, truncate, etc.)
104
+ * The TokenName component accepts a `formatFn` which takes in a string and outputs a string
105
+ * The function is used to modify the name of the token
106
+ *
107
+ * ```tsx
108
+ * const concatStr = (str: string):string => str + "Token"
109
+ *
110
+ * <TokenName formatFn={concatStr} />
111
+ * ```
112
+ *
113
+ * Result:
114
+ * ```html
115
+ * <span>Ether Token</span>
116
+ * ```
117
+ *
118
+ * ### Show a loading sign when the name is being fetched
119
+ * ```tsx
120
+ * import { TokenProvider, TokenName } from "thirdweb/react";
121
+ *
122
+ * <TokenProvider address="0x...">
123
+ * <TokenName loadingComponent={<Spinner />} />
124
+ * </TokenProvider>
125
+ * ```
126
+ *
127
+ * ### Fallback to something when the name fails to resolve
128
+ * ```tsx
129
+ * <TokenProvider address="0x...">
130
+ * <TokenName fallbackComponent={"Failed to load"} />
131
+ * </TokenProvider>
132
+ * ```
133
+ *
134
+ * ### Custom query options for useQuery
135
+ * This component uses `@tanstack-query`'s useQuery internally.
136
+ * You can use the `queryOptions` prop for more fine-grained control
137
+ * ```tsx
138
+ * <TokenName
139
+ * queryOptions={{
140
+ * enabled: isEnabled,
141
+ * retry: 4,
142
+ * }}
143
+ * />
144
+ * ```
145
+ *
146
+ * @component
147
+ * @token
148
+ * @beta
149
+ */
150
+ export function TokenName({
151
+ nameResolver,
152
+ formatFn,
153
+ loadingComponent,
154
+ fallbackComponent,
155
+ queryOptions,
156
+ ...restProps
157
+ }: TokenNameProps) {
158
+ const { address, client, chain } = useTokenContext();
159
+ const nameQuery = useQuery({
160
+ queryKey: ["_internal_token_name_", chain.id, address] as const,
161
+ queryFn: async () => {
162
+ if (typeof nameResolver === "string") {
163
+ return nameResolver;
164
+ }
165
+ if (typeof nameResolver === "function") {
166
+ return nameResolver();
167
+ }
168
+ if (address.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()) {
169
+ // Don't wanna use `getChainNativeCurrencyName` because it has some side effect (it catches error and defaults to "ETH")
170
+ return getChainMetadata(chain).then((data) => data.nativeCurrency.name);
171
+ }
172
+ // Try to fetch the name from both the `name()` function and the contract metadata
173
+ // then prioritize the `name()`
174
+ const contract = getContract({ address, client, chain });
175
+ const [_name, contractMetadata] = await Promise.all([
176
+ name({ contract }),
177
+ getContractMetadata({ contract }),
178
+ ]);
179
+ if (!_name && !contractMetadata.name) {
180
+ throw new Error(
181
+ "Failed to resolve name from both name() and contract metadata",
182
+ );
183
+ }
184
+
185
+ return _name || contractMetadata.name;
186
+ },
187
+ ...queryOptions,
188
+ });
189
+
190
+ if (nameQuery.isLoading) {
191
+ return loadingComponent || null;
192
+ }
193
+
194
+ if (!nameQuery.data) {
195
+ return fallbackComponent || null;
196
+ }
197
+
198
+ const displayValue = formatFn ? formatFn(nameQuery.data) : nameQuery.data;
199
+
200
+ return <span {...restProps}>{displayValue}</span>;
201
+ }
@@ -0,0 +1,86 @@
1
+ "use client";
2
+
3
+ import type { Address } from "abitype";
4
+ import type React from "react";
5
+ import { createContext, useContext } from "react";
6
+ import type { Chain } from "../../../../../chains/types.js";
7
+ import type { ThirdwebClient } from "../../../../../client/client.js";
8
+
9
+ /**
10
+ * Props for the <TokenProvider /> component
11
+ * @component
12
+ * @token
13
+ */
14
+ export type TokenProviderProps = {
15
+ /**
16
+ * The token (ERC20) contract address
17
+ */
18
+ address: Address;
19
+ /**
20
+ * thirdweb Client
21
+ */
22
+ client: ThirdwebClient;
23
+ /**
24
+ * The chain (network) that the token is on
25
+ */
26
+ chain: Chain;
27
+ };
28
+
29
+ const TokenProviderContext = /* @__PURE__ */ createContext<
30
+ TokenProviderProps | undefined
31
+ >(undefined);
32
+
33
+ /**
34
+ * A React context provider component that supplies Token-related data to its child components.
35
+ *
36
+ * This component serves as a wrapper around the `TokenProviderContext.Provider` and passes
37
+ * the provided token data down to all of its child components through the context API.
38
+ *
39
+ * @example
40
+ * ### Basic usage
41
+ * ```tsx
42
+ * import { TokenProvider, TokenIcon, TokenName } from "thirdweb/react";
43
+ * import { ethereum } from "thirdweb/chains";
44
+ *
45
+ * <TokenProvider address="0x..." client={...} chain={ethereum}>
46
+ * <TokenIcon />
47
+ * <TokenName />
48
+ * </TokenProvider>
49
+ * ```
50
+ *
51
+ * ### This component also works with native token!
52
+ * ```tsx
53
+ * import { NATIVE_TOKEN_ADDRESS} from "thirdweb";
54
+ * import { ethereum } from "thirdweb/chains";
55
+ *
56
+ * <TokenProvider address={NATIVE_TOKEN_ADDRESS} chain={ethereum} client={client}>
57
+ * <TokenSymbol /> // "ETH"
58
+ * </TokenProvider>
59
+ * ```
60
+ *
61
+ * @component
62
+ * @token
63
+ * @beta
64
+ */
65
+ export function TokenProvider(
66
+ props: React.PropsWithChildren<TokenProviderProps>,
67
+ ) {
68
+ return (
69
+ <TokenProviderContext.Provider value={props}>
70
+ {props.children}
71
+ </TokenProviderContext.Provider>
72
+ );
73
+ }
74
+
75
+ /**
76
+ * @internal
77
+ */
78
+ export function useTokenContext() {
79
+ const ctx = useContext(TokenProviderContext);
80
+ if (!ctx) {
81
+ throw new Error(
82
+ "TokenProviderContext not found. Make sure you are using TokenName, TokenIcon, TokenSymbol etc. inside a <TokenProvider /> component",
83
+ );
84
+ }
85
+ return ctx;
86
+ }
@@ -0,0 +1,201 @@
1
+ "use client";
2
+
3
+ import { type UseQueryOptions, useQuery } from "@tanstack/react-query";
4
+ import type React from "react";
5
+ import type { JSX } from "react";
6
+ import { getChainMetadata } from "../../../../../chains/utils.js";
7
+ import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js";
8
+ import { getContract } from "../../../../../contract/contract.js";
9
+ import { getContractMetadata } from "../../../../../extensions/common/read/getContractMetadata.js";
10
+ import { symbol } from "../../../../../extensions/common/read/symbol.js";
11
+ import { useTokenContext } from "./provider.js";
12
+
13
+ /**
14
+ * Props for the TokenSymbol component
15
+ * @component
16
+ * @token
17
+ */
18
+ export interface TokenSymbolProps
19
+ extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
20
+ /**
21
+ * This prop can be a string or a (async) function that resolves to a string, representing the symbol of the token
22
+ * This is particularly useful if you already have a way to fetch the token symbol.
23
+ */
24
+ symbolResolver?: string | (() => string) | (() => Promise<string>);
25
+ /**
26
+ * A function to format the symbol's value
27
+ * Particularly useful to avoid overflowing-UI issues
28
+ *
29
+ * ```tsx
30
+ * <TokenSymbol formatFn={(str: string) => doSomething()} />
31
+ * ```
32
+ */
33
+ formatFn?: (str: string) => string;
34
+ /**
35
+ * This component will be shown while the symbol of the token is being fetched
36
+ * If not passed, the component will return `null`.
37
+ *
38
+ * You can/should pass a loading sign or spinner to this prop.
39
+ * @example
40
+ * ```tsx
41
+ * <TokenSymbol loadingComponent={<Spinner />} />
42
+ * ```
43
+ */
44
+ loadingComponent?: JSX.Element;
45
+ /**
46
+ * This component will be shown if the symbol fails to be retreived
47
+ * If not passed, the component will return `null`.
48
+ *
49
+ * You can/should pass a descriptive text/component to this prop, indicating that the
50
+ * symbol was not fetched succesfully
51
+ * @example
52
+ * ```tsx
53
+ * <TokenSymbol fallbackComponent={"Failed to load"}
54
+ * />
55
+ * ```
56
+ */
57
+ fallbackComponent?: JSX.Element;
58
+ /**
59
+ * Optional `useQuery` params
60
+ */
61
+ queryOptions?: Omit<UseQueryOptions<string>, "queryFn" | "queryKey">;
62
+ }
63
+
64
+ /**
65
+ * This component fetches then shows the symbol of a token. For ERC20 tokens, it calls the `symbol` function in the ERC20 contract.
66
+ * It inherits all the attributes of a HTML <span> component, hence you can style it just like how you would style a normal <span>
67
+ *
68
+ *
69
+ * @example
70
+ * ### Basic usage
71
+ * ```tsx
72
+ * import { TokenProvider, TokenSymbol } from "thirdweb/react";
73
+ * import { ethereum } from "thirdweb/chains";
74
+ *
75
+ * <TokenProvider {...props}>
76
+ * <TokenSymbol />
77
+ * </TokenProvider>
78
+ * ```
79
+ * Result:
80
+ * ```html
81
+ * <span>ETH</span>
82
+ * ```
83
+ *
84
+ * ### Custom symbol resolver
85
+ * By default, TokenSymbol calls the `symbol` function of your contract,
86
+ * however, if your token as an unconventional way to fetch the symbol, you can pass the custom logic to the `symbolResolver` prop.
87
+ * It can either be a string or a function (async) that returns or resolves to a string.
88
+ * ```tsx
89
+ * async function getSymbol() {
90
+ * // your own fetching logic
91
+ * return "the symbol";
92
+ * }
93
+ *
94
+ * <TokenSymbol symbolResolver={getSymbol} />
95
+ * ```
96
+ * Alternatively, you can pass in a string directly:
97
+ * ```tsx
98
+ * <TokenSymbol symbolResolver="USDC.e" />
99
+ * ```
100
+ *
101
+ * ### Format the symbol (capitalize, truncate, etc.)
102
+ * The TokenSymbol component accepts a `formatFn` which takes in a string and outputs a string
103
+ * The function is used to modify the symbol of the token
104
+ *
105
+ * ```tsx
106
+ * const concatStr = (str: string):string => str + "Token"
107
+ *
108
+ * <TokenSymbol formatFn={concatStr} />
109
+ * ```
110
+ *
111
+ * Result:
112
+ * ```html
113
+ * <span>Ether Token</span>
114
+ * ```
115
+ *
116
+ * ### Show a loading sign when the symbol is being fetched
117
+ * ```tsx
118
+ * import { TokenProvider, TokenSymbol } from "thirdweb/react";
119
+ *
120
+ * <TokenProvider address="0x...">
121
+ * <TokenSymbol loadingComponent={<Spinner />} />
122
+ * </TokenProvider>
123
+ * ```
124
+ *
125
+ * ### Fallback to something when the symbol fails to resolve
126
+ * ```tsx
127
+ * <TokenProvider address="0x...">
128
+ * <TokenSymbol fallbackComponent={"Failed to load"} />
129
+ * </TokenProvider>
130
+ * ```
131
+ *
132
+ * ### Custom query options for useQuery
133
+ * This component uses `@tanstack-query`'s useQuery internally.
134
+ * You can use the `queryOptions` prop for more fine-grained control
135
+ * ```tsx
136
+ * <TokenSymbol queryOptions={{
137
+ * enabled: isEnabled,
138
+ * retry: 4,
139
+ * }}
140
+ * />
141
+ * ```
142
+ *
143
+ * @component
144
+ * @token
145
+ * @beta
146
+ */
147
+ export function TokenSymbol({
148
+ symbolResolver,
149
+ formatFn,
150
+ loadingComponent,
151
+ fallbackComponent,
152
+ queryOptions,
153
+ ...restProps
154
+ }: TokenSymbolProps) {
155
+ const { address, client, chain } = useTokenContext();
156
+ const symbolQuery = useQuery({
157
+ queryKey: ["_internal_token_symbol_", chain.id, address] as const,
158
+ queryFn: async () => {
159
+ if (typeof symbolResolver === "string") {
160
+ return symbolResolver;
161
+ }
162
+ if (typeof symbolResolver === "function") {
163
+ return symbolResolver();
164
+ }
165
+ if (address.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()) {
166
+ // Don't wanna use `getChainSymbol` because it has some side effect (it catches error and defaults to "ETH")
167
+ return getChainMetadata(chain).then(
168
+ (data) => data.nativeCurrency.symbol,
169
+ );
170
+ }
171
+
172
+ // Try to fetch the symbol from both the `symbol` function and the contract metadata
173
+ // then prioritize the `symbol()`
174
+ const contract = getContract({ address, client, chain });
175
+ const [_symbol, contractMetadata] = await Promise.all([
176
+ symbol({ contract }),
177
+ getContractMetadata({ contract }),
178
+ ]);
179
+ if (!_symbol && !contractMetadata.symbol) {
180
+ throw new Error(
181
+ "Failed to resolve symbol from both symbol() and contract metadata",
182
+ );
183
+ }
184
+
185
+ return _symbol || contractMetadata.symbol;
186
+ },
187
+ ...queryOptions,
188
+ });
189
+
190
+ if (symbolQuery.isLoading) {
191
+ return loadingComponent || null;
192
+ }
193
+
194
+ if (!symbolQuery.data) {
195
+ return fallbackComponent || null;
196
+ }
197
+
198
+ const displayValue = formatFn ? formatFn(symbolQuery.data) : symbolQuery.data;
199
+
200
+ return <span {...restProps}>{displayValue}</span>;
201
+ }
@@ -79,6 +79,7 @@ export type BuyDirectListingButtonProps = Omit<
79
79
  * For error handling & callbacks on transaction-sent and transaction-confirmed,
80
80
  * please refer to the TransactionButton docs.
81
81
  * @component
82
+ * @transaction
82
83
  */
83
84
  export function BuyDirectListingButton(props: BuyDirectListingButtonProps) {
84
85
  const {
@@ -106,6 +106,7 @@ import type {
106
106
  *
107
107
  * For error handling & callbacks on transaction-sent and transaction-confirmed,
108
108
  * please refer to the TransactionButton docs.
109
+ * @transaction
109
110
  */
110
111
  export function ClaimButton(props: ClaimButtonProps) {
111
112
  const { children, contractAddress, client, chain, claimParams, payModal } =
@@ -55,6 +55,7 @@ export type CreateDirectListingButtonProps = Omit<
55
55
  * For error handling & callbacks on transaction-sent and transaction-confirmed,
56
56
  * please refer to the TransactionButton docs.
57
57
  * @component
58
+ * @transaction
58
59
  */
59
60
  export function CreateDirectListingButton(
60
61
  props: CreateDirectListingButtonProps,
@@ -9,7 +9,7 @@ export type UnpinOptions = {
9
9
 
10
10
  /**
11
11
  * Unpins a file from IPFS.
12
- * @note For security purposes, this method requires a secret key to be set in the ThirdwebClient instance.
12
+ * For security purposes, this method requires a secret key to be set in the ThirdwebClient instance.
13
13
  * @param options - The options for unpinning the file.
14
14
  * @param options.client - The Thirdweb client instance.
15
15
  * @param options.cid - The content identifier (CID) of the file to unpin.
@@ -49,6 +49,7 @@ type UploadReturnType<TFiles extends UploadableFile[]> = TFiles extends {
49
49
  * },
50
50
  * ],
51
51
  * });
52
+ * ```
52
53
  *
53
54
  * ### Uploading files
54
55
  *
@@ -25,7 +25,7 @@ export type ToSerializableTransactionOptions = {
25
25
  * @param options - The transaction and additional options for conversion
26
26
  * @returns A serializable transaction for inspection or submission to an account.
27
27
  *
28
- * @note For easier transaction sending, {@see sendTransaction}
28
+ * For easier transaction sending, {@see sendTransaction}
29
29
  * @example
30
30
  * ```ts
31
31
  * import { prepareTransaction, toSerializableTransaction } from "thirdweb";
@@ -84,6 +84,11 @@ export async function signEip712Transaction(options: {
84
84
  });
85
85
  }
86
86
 
87
+ /**
88
+ * Populate a prepared transaction to be serialized as a EIP712 transaction
89
+ * @param options
90
+ * @internal
91
+ */
87
92
  export async function populateEip712Transaction(
88
93
  options: SendEip712TransactionOptions,
89
94
  ): Promise<EIP721TransactionSerializable> {
@@ -1,5 +1,10 @@
1
1
  import type { Chain } from "../../../chains/types.js";
2
2
 
3
+ /**
4
+ * Checks whether the given chain is part of the zksync stack
5
+ * @param chain
6
+ * @chain
7
+ */
3
8
  export async function isZkSyncChain(chain: Chain) {
4
9
  if (chain.id === 1337 || chain.id === 31337) {
5
10
  return false;
@@ -8,6 +8,9 @@ let transactionDecorator:
8
8
  }) => Promise<{ account: Account; transaction: PreparedTransaction }>)
9
9
  | null = null;
10
10
 
11
+ /**
12
+ * @internal
13
+ */
11
14
  export function setTransactionDecorator(
12
15
  decoratorFunction: (args: {
13
16
  account: Account;
@@ -17,10 +20,16 @@ export function setTransactionDecorator(
17
20
  transactionDecorator = decoratorFunction;
18
21
  }
19
22
 
23
+ /**
24
+ * @internal
25
+ */
20
26
  export function clearTransactionDecorator() {
21
27
  transactionDecorator = null;
22
28
  }
23
29
 
30
+ /**
31
+ * @internal
32
+ */
24
33
  export function getTransactionDecorator() {
25
34
  return transactionDecorator;
26
35
  }
package/src/utils/json.ts CHANGED
@@ -14,7 +14,13 @@
14
14
  * ```
15
15
  * @utils
16
16
  */
17
- export const stringify: typeof JSON.stringify = (value, replacer, space) => {
17
+ export function stringify(
18
+ // biome-ignore lint/suspicious/noExplicitAny: JSON.stringify signature
19
+ value: any,
20
+ // biome-ignore lint/suspicious/noExplicitAny: JSON.stringify signature
21
+ replacer?: ((this: any, key: string, value: any) => any) | null,
22
+ space?: string | number,
23
+ ) {
18
24
  const res = JSON.stringify(
19
25
  value,
20
26
  (key, value_) => {
@@ -24,4 +30,4 @@ export const stringify: typeof JSON.stringify = (value, replacer, space) => {
24
30
  space,
25
31
  );
26
32
  return res;
27
- };
33
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.69.0";
1
+ export const version = "5.70.0-nightly-ecaa304a812188da3c81888bb52ca6064093c139-20241121000332";
@@ -16,7 +16,7 @@ export type GetCallsStatusOptions = {
16
16
  /**
17
17
  * Get the status of an [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle.
18
18
  *
19
- * @note This function is dependent on the wallet's support for EIP-5792 and could fail.
19
+ * This function is dependent on the wallet's support for EIP-5792 and could fail.
20
20
  *
21
21
  * @param {GetCallsStatusOptions} options
22
22
  * @param {Wallet} options.wallet - The wallet that send the original calls.
@@ -19,7 +19,7 @@ export type GetCapabilitiesResult = Prettify<
19
19
  /**
20
20
  * Get the capabilities of a wallet based on the [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) specification.
21
21
  *
22
- * @note This function is dependent on the wallet's support for EIP-5792, but will not throw.
22
+ * This function is dependent on the wallet's support for EIP-5792, but will not throw.
23
23
  * **The returned object contains a `message` field detailing any issues with the wallet's support for EIP-5792.**
24
24
  *
25
25
  * @param {GetCapabilitiesOptions} options
@@ -59,7 +59,7 @@ export type SendCallsResult = WalletSendCallsId;
59
59
  * This function works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792.
60
60
  * Transactions will be bundled and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions.
61
61
  *
62
- * @note This function is dependent on the wallet's support for EIP-5792 and could fail.
62
+ * This function is dependent on the wallet's support for EIP-5792 and could fail.
63
63
  *
64
64
  * @param {SendCallsOptions} options
65
65
  * @param {Wallet} options.wallet - The wallet to send the calls to.
@@ -109,7 +109,7 @@ export type SendCallsResult = WalletSendCallsId;
109
109
  * }
110
110
  * }
111
111
  * });
112
- * @note We recommend proxying any paymaster calls via an API route you setup and control.
112
+ * We recommend proxying any paymaster calls via an API route you setup and control.
113
113
  * ```
114
114
  * @extension EIP5792
115
115
  */
@@ -21,7 +21,7 @@ export type WaitForBundleOptions = Prettify<{
21
21
  /**
22
22
  * Waits for the [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) bundle to be confirmed.
23
23
  *
24
- * @note This function is dependent on the wallet's support for EIP-5792 and could fail.
24
+ * This function is dependent on the wallet's support for EIP-5792 and could fail.
25
25
  *
26
26
  * @param options - The options for waiting for the bundle.
27
27
  * By default, the max wait time is 100 blocks.
@@ -16,7 +16,7 @@ export type GetUserResult = {
16
16
 
17
17
  /**
18
18
  * Gets user based on the provided query parameters.
19
- * @note This function is only available on the server (a secret key is required in the client).
19
+ * This function is only available on the server (a secret key is required in the client).
20
20
  *
21
21
  * @param options - The options for the get user function.
22
22
  * @param options.client - The Thirdweb client with a secret key included.