thirdweb 5.56.0 → 5.57.0

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 (280) hide show
  1. package/dist/cjs/contract/verification/index.js +29 -33
  2. package/dist/cjs/contract/verification/index.js.map +1 -1
  3. package/dist/cjs/extensions/erc1155/read/getNFTs.js +4 -1
  4. package/dist/cjs/extensions/erc1155/read/getNFTs.js.map +1 -1
  5. package/dist/cjs/react/core/utils/walletIcon.js +4 -1
  6. package/dist/cjs/react/core/utils/walletIcon.js.map +1 -1
  7. package/dist/cjs/react/native/ui/components/WalletImage.js +2 -0
  8. package/dist/cjs/react/native/ui/components/WalletImage.js.map +1 -1
  9. package/dist/cjs/react/native/ui/connect/InAppWalletUI.js +21 -1
  10. package/dist/cjs/react/native/ui/connect/InAppWalletUI.js.map +1 -1
  11. package/dist/cjs/react/native/ui/connect/TokenListScreen.js +2 -1
  12. package/dist/cjs/react/native/ui/connect/TokenListScreen.js.map +1 -1
  13. package/dist/cjs/react/native/ui/icons/svgs.js +2 -1
  14. package/dist/cjs/react/native/ui/icons/svgs.js.map +1 -1
  15. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +15 -2
  16. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js +12 -12
  18. package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
  19. package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js +5 -5
  20. package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
  21. package/dist/cjs/react/web/ui/MediaRenderer/MediaRenderer.js +1 -1
  22. package/dist/cjs/react/web/ui/MediaRenderer/MediaRenderer.js.map +1 -1
  23. package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletHeader.js +3 -3
  24. package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletHeader.js.map +1 -1
  25. package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js +4 -0
  26. package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
  27. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +38 -19
  28. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  29. package/dist/cjs/react/web/wallets/shared/GuestLogin.js +81 -0
  30. package/dist/cjs/react/web/wallets/shared/GuestLogin.js.map +1 -0
  31. package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js +1 -1
  32. package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
  33. package/dist/cjs/react/web/wallets/shared/SocialLogin.js +1 -1
  34. package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
  35. package/dist/cjs/react/web/wallets/shared/locale/de.js +2 -1
  36. package/dist/cjs/react/web/wallets/shared/locale/de.js.map +1 -1
  37. package/dist/cjs/react/web/wallets/shared/locale/en.js +1 -0
  38. package/dist/cjs/react/web/wallets/shared/locale/en.js.map +1 -1
  39. package/dist/cjs/react/web/wallets/shared/locale/es.js +2 -1
  40. package/dist/cjs/react/web/wallets/shared/locale/es.js.map +1 -1
  41. package/dist/cjs/react/web/wallets/shared/locale/fr.js +2 -1
  42. package/dist/cjs/react/web/wallets/shared/locale/fr.js.map +1 -1
  43. package/dist/cjs/react/web/wallets/shared/locale/ja.js +2 -1
  44. package/dist/cjs/react/web/wallets/shared/locale/ja.js.map +1 -1
  45. package/dist/cjs/react/web/wallets/shared/locale/kr.js +2 -1
  46. package/dist/cjs/react/web/wallets/shared/locale/kr.js.map +1 -1
  47. package/dist/cjs/react/web/wallets/shared/locale/tl.js +2 -1
  48. package/dist/cjs/react/web/wallets/shared/locale/tl.js.map +1 -1
  49. package/dist/cjs/react/web/wallets/shared/locale/vi.js +1 -0
  50. package/dist/cjs/react/web/wallets/shared/locale/vi.js.map +1 -1
  51. package/dist/cjs/react/web/wallets/shared/oauthSignIn.js +1 -0
  52. package/dist/cjs/react/web/wallets/shared/oauthSignIn.js.map +1 -1
  53. package/dist/cjs/utils/any-evm/deploy-metadata.js +1 -0
  54. package/dist/cjs/utils/any-evm/deploy-metadata.js.map +1 -1
  55. package/dist/cjs/utils/encoding/hex.js +1 -3
  56. package/dist/cjs/utils/encoding/hex.js.map +1 -1
  57. package/dist/cjs/utils/fetch.js +7 -12
  58. package/dist/cjs/utils/fetch.js.map +1 -1
  59. package/dist/cjs/utils/promise/p-limit.js.map +1 -1
  60. package/dist/cjs/utils/signatures/sign-message.js +2 -4
  61. package/dist/cjs/utils/signatures/sign-message.js.map +1 -1
  62. package/dist/cjs/version.js +1 -1
  63. package/dist/cjs/wallets/in-app/core/authentication/guest.js +33 -0
  64. package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -0
  65. package/dist/cjs/wallets/in-app/core/authentication/types.js +1 -0
  66. package/dist/cjs/wallets/in-app/core/authentication/types.js.map +1 -1
  67. package/dist/cjs/wallets/in-app/native/auth/native-auth.js +25 -0
  68. package/dist/cjs/wallets/in-app/native/auth/native-auth.js.map +1 -1
  69. package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js +1 -3
  70. package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
  71. package/dist/cjs/wallets/in-app/native/helpers/wallet/sss.js.map +1 -1
  72. package/dist/cjs/wallets/in-app/native/native-connector.js +32 -0
  73. package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
  74. package/dist/cjs/wallets/in-app/web/in-app.js +13 -1
  75. package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
  76. package/dist/cjs/wallets/in-app/web/lib/web-connector.js +8 -0
  77. package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
  78. package/dist/cjs/wallets/manager/index.js +5 -0
  79. package/dist/cjs/wallets/manager/index.js.map +1 -1
  80. package/dist/cjs/wallets/types.js +1 -0
  81. package/dist/cjs/wallets/types.js.map +1 -1
  82. package/dist/cjs/wallets/wallet-connect/receiver/request-handlers/switch-chain.js +2 -4
  83. package/dist/cjs/wallets/wallet-connect/receiver/request-handlers/switch-chain.js.map +1 -1
  84. package/dist/esm/contract/verification/index.js +29 -33
  85. package/dist/esm/contract/verification/index.js.map +1 -1
  86. package/dist/esm/extensions/erc1155/read/getNFTs.js +4 -1
  87. package/dist/esm/extensions/erc1155/read/getNFTs.js.map +1 -1
  88. package/dist/esm/react/core/utils/walletIcon.js +3 -0
  89. package/dist/esm/react/core/utils/walletIcon.js.map +1 -1
  90. package/dist/esm/react/native/ui/components/WalletImage.js +3 -1
  91. package/dist/esm/react/native/ui/components/WalletImage.js.map +1 -1
  92. package/dist/esm/react/native/ui/connect/InAppWalletUI.js +21 -1
  93. package/dist/esm/react/native/ui/connect/InAppWalletUI.js.map +1 -1
  94. package/dist/esm/react/native/ui/connect/TokenListScreen.js +2 -1
  95. package/dist/esm/react/native/ui/connect/TokenListScreen.js.map +1 -1
  96. package/dist/esm/react/native/ui/icons/svgs.js +1 -0
  97. package/dist/esm/react/native/ui/icons/svgs.js.map +1 -1
  98. package/dist/esm/react/web/ui/ConnectWallet/Details.js +15 -2
  99. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  100. package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js +12 -12
  101. package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
  102. package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js +6 -6
  103. package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
  104. package/dist/esm/react/web/ui/MediaRenderer/MediaRenderer.js +1 -1
  105. package/dist/esm/react/web/ui/MediaRenderer/MediaRenderer.js.map +1 -1
  106. package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletHeader.js +3 -3
  107. package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletHeader.js.map +1 -1
  108. package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js +4 -0
  109. package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
  110. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +38 -19
  111. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  112. package/dist/esm/react/web/wallets/shared/GuestLogin.js +78 -0
  113. package/dist/esm/react/web/wallets/shared/GuestLogin.js.map +1 -0
  114. package/dist/esm/react/web/wallets/shared/OTPLoginUI.js +1 -1
  115. package/dist/esm/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
  116. package/dist/esm/react/web/wallets/shared/SocialLogin.js +1 -1
  117. package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
  118. package/dist/esm/react/web/wallets/shared/locale/de.js +2 -1
  119. package/dist/esm/react/web/wallets/shared/locale/de.js.map +1 -1
  120. package/dist/esm/react/web/wallets/shared/locale/en.js +1 -0
  121. package/dist/esm/react/web/wallets/shared/locale/en.js.map +1 -1
  122. package/dist/esm/react/web/wallets/shared/locale/es.js +2 -1
  123. package/dist/esm/react/web/wallets/shared/locale/es.js.map +1 -1
  124. package/dist/esm/react/web/wallets/shared/locale/fr.js +2 -1
  125. package/dist/esm/react/web/wallets/shared/locale/fr.js.map +1 -1
  126. package/dist/esm/react/web/wallets/shared/locale/ja.js +2 -1
  127. package/dist/esm/react/web/wallets/shared/locale/ja.js.map +1 -1
  128. package/dist/esm/react/web/wallets/shared/locale/kr.js +2 -1
  129. package/dist/esm/react/web/wallets/shared/locale/kr.js.map +1 -1
  130. package/dist/esm/react/web/wallets/shared/locale/tl.js +2 -1
  131. package/dist/esm/react/web/wallets/shared/locale/tl.js.map +1 -1
  132. package/dist/esm/react/web/wallets/shared/locale/vi.js +1 -0
  133. package/dist/esm/react/web/wallets/shared/locale/vi.js.map +1 -1
  134. package/dist/esm/react/web/wallets/shared/oauthSignIn.js +1 -0
  135. package/dist/esm/react/web/wallets/shared/oauthSignIn.js.map +1 -1
  136. package/dist/esm/utils/any-evm/deploy-metadata.js +1 -0
  137. package/dist/esm/utils/any-evm/deploy-metadata.js.map +1 -1
  138. package/dist/esm/utils/encoding/hex.js +1 -3
  139. package/dist/esm/utils/encoding/hex.js.map +1 -1
  140. package/dist/esm/utils/fetch.js +1 -7
  141. package/dist/esm/utils/fetch.js.map +1 -1
  142. package/dist/esm/utils/promise/p-limit.js.map +1 -1
  143. package/dist/esm/utils/signatures/sign-message.js +2 -4
  144. package/dist/esm/utils/signatures/sign-message.js.map +1 -1
  145. package/dist/esm/version.js +1 -1
  146. package/dist/esm/wallets/in-app/core/authentication/guest.js +30 -0
  147. package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -0
  148. package/dist/esm/wallets/in-app/core/authentication/types.js +1 -0
  149. package/dist/esm/wallets/in-app/core/authentication/types.js.map +1 -1
  150. package/dist/esm/wallets/in-app/native/auth/native-auth.js +24 -0
  151. package/dist/esm/wallets/in-app/native/auth/native-auth.js.map +1 -1
  152. package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js +1 -3
  153. package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
  154. package/dist/esm/wallets/in-app/native/helpers/wallet/sss.js.map +1 -1
  155. package/dist/esm/wallets/in-app/native/native-connector.js +33 -1
  156. package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
  157. package/dist/esm/wallets/in-app/web/in-app.js +13 -1
  158. package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
  159. package/dist/esm/wallets/in-app/web/lib/web-connector.js +8 -0
  160. package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
  161. package/dist/esm/wallets/manager/index.js +5 -0
  162. package/dist/esm/wallets/manager/index.js.map +1 -1
  163. package/dist/esm/wallets/types.js +1 -0
  164. package/dist/esm/wallets/types.js.map +1 -1
  165. package/dist/esm/wallets/wallet-connect/receiver/request-handlers/switch-chain.js +2 -4
  166. package/dist/esm/wallets/wallet-connect/receiver/request-handlers/switch-chain.js.map +1 -1
  167. package/dist/types/contract/verification/index.d.ts.map +1 -1
  168. package/dist/types/extensions/erc1155/read/getNFTs.d.ts.map +1 -1
  169. package/dist/types/react/core/utils/storage.d.ts +1 -1
  170. package/dist/types/react/core/utils/storage.d.ts.map +1 -1
  171. package/dist/types/react/core/utils/walletIcon.d.ts +2 -1
  172. package/dist/types/react/core/utils/walletIcon.d.ts.map +1 -1
  173. package/dist/types/react/native/ui/components/WalletImage.d.ts.map +1 -1
  174. package/dist/types/react/native/ui/connect/InAppWalletUI.d.ts.map +1 -1
  175. package/dist/types/react/native/ui/connect/TokenListScreen.d.ts.map +1 -1
  176. package/dist/types/react/native/ui/icons/svgs.d.ts +1 -0
  177. package/dist/types/react/native/ui/icons/svgs.d.ts.map +1 -1
  178. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  179. package/dist/types/react/web/ui/ConnectWallet/screens/TokenSelector.d.ts.map +1 -1
  180. package/dist/types/react/web/wallets/ecosystem/EcosystemWalletHeader.d.ts.map +1 -1
  181. package/dist/types/react/web/wallets/in-app/InAppWalletConnectUI.d.ts.map +1 -1
  182. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts +3 -0
  183. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
  184. package/dist/types/react/web/wallets/shared/GuestLogin.d.ts +19 -0
  185. package/dist/types/react/web/wallets/shared/GuestLogin.d.ts.map +1 -0
  186. package/dist/types/react/web/wallets/shared/OTPLoginUI.d.ts.map +1 -1
  187. package/dist/types/react/web/wallets/shared/locale/de.d.ts +1 -0
  188. package/dist/types/react/web/wallets/shared/locale/de.d.ts.map +1 -1
  189. package/dist/types/react/web/wallets/shared/locale/en.d.ts +1 -0
  190. package/dist/types/react/web/wallets/shared/locale/en.d.ts.map +1 -1
  191. package/dist/types/react/web/wallets/shared/locale/es.d.ts +1 -0
  192. package/dist/types/react/web/wallets/shared/locale/es.d.ts.map +1 -1
  193. package/dist/types/react/web/wallets/shared/locale/fr.d.ts +1 -0
  194. package/dist/types/react/web/wallets/shared/locale/fr.d.ts.map +1 -1
  195. package/dist/types/react/web/wallets/shared/locale/ja.d.ts +1 -0
  196. package/dist/types/react/web/wallets/shared/locale/ja.d.ts.map +1 -1
  197. package/dist/types/react/web/wallets/shared/locale/kr.d.ts +1 -0
  198. package/dist/types/react/web/wallets/shared/locale/kr.d.ts.map +1 -1
  199. package/dist/types/react/web/wallets/shared/locale/tl.d.ts +1 -0
  200. package/dist/types/react/web/wallets/shared/locale/tl.d.ts.map +1 -1
  201. package/dist/types/react/web/wallets/shared/locale/types.d.ts +1 -0
  202. package/dist/types/react/web/wallets/shared/locale/types.d.ts.map +1 -1
  203. package/dist/types/react/web/wallets/shared/locale/vi.d.ts +1 -0
  204. package/dist/types/react/web/wallets/shared/locale/vi.d.ts.map +1 -1
  205. package/dist/types/react/web/wallets/shared/oauthSignIn.d.ts.map +1 -1
  206. package/dist/types/utils/any-evm/deploy-metadata.d.ts.map +1 -1
  207. package/dist/types/utils/encoding/hex.d.ts.map +1 -1
  208. package/dist/types/utils/fetch.d.ts +4 -2
  209. package/dist/types/utils/fetch.d.ts.map +1 -1
  210. package/dist/types/utils/promise/p-limit.d.ts.map +1 -1
  211. package/dist/types/version.d.ts +1 -1
  212. package/dist/types/wallets/in-app/core/authentication/guest.d.ts +12 -0
  213. package/dist/types/wallets/in-app/core/authentication/guest.d.ts.map +1 -0
  214. package/dist/types/wallets/in-app/core/authentication/types.d.ts +8 -4
  215. package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
  216. package/dist/types/wallets/in-app/core/wallet/types.d.ts +2 -1
  217. package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
  218. package/dist/types/wallets/in-app/native/auth/native-auth.d.ts +4 -3
  219. package/dist/types/wallets/in-app/native/auth/native-auth.d.ts.map +1 -1
  220. package/dist/types/wallets/in-app/native/helpers/api/fetchers.d.ts.map +1 -1
  221. package/dist/types/wallets/in-app/native/helpers/wallet/sss.d.ts.map +1 -1
  222. package/dist/types/wallets/in-app/native/native-connector.d.ts +1 -0
  223. package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
  224. package/dist/types/wallets/in-app/web/in-app.d.ts +13 -1
  225. package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
  226. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +3 -3
  227. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts.map +1 -1
  228. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
  229. package/dist/types/wallets/manager/index.d.ts.map +1 -1
  230. package/dist/types/wallets/types.d.ts +2 -1
  231. package/dist/types/wallets/types.d.ts.map +1 -1
  232. package/dist/types/wallets/wallet-connect/receiver/request-handlers/switch-chain.d.ts.map +1 -1
  233. package/package.json +10 -10
  234. package/src/contract/verification/index.ts +32 -34
  235. package/src/extensions/erc1155/read/getNFTs.ts +4 -1
  236. package/src/react/core/utils/walletIcon.ts +5 -0
  237. package/src/react/native/ui/components/WalletImage.tsx +3 -0
  238. package/src/react/native/ui/connect/InAppWalletUI.tsx +30 -0
  239. package/src/react/native/ui/connect/TokenListScreen.tsx +9 -12
  240. package/src/react/native/ui/icons/svgs.ts +2 -0
  241. package/src/react/web/ui/ConnectWallet/Details.tsx +15 -2
  242. package/src/react/web/ui/ConnectWallet/screens/SignatureScreen.tsx +36 -38
  243. package/src/react/web/ui/ConnectWallet/screens/TokenSelector.tsx +34 -36
  244. package/src/react/web/ui/MediaRenderer/MediaRenderer.tsx +1 -1
  245. package/src/react/web/wallets/ecosystem/EcosystemWalletHeader.tsx +18 -20
  246. package/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx +16 -0
  247. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +128 -101
  248. package/src/react/web/wallets/shared/GuestLogin.tsx +159 -0
  249. package/src/react/web/wallets/shared/OTPLoginUI.tsx +3 -5
  250. package/src/react/web/wallets/shared/SocialLogin.tsx +1 -1
  251. package/src/react/web/wallets/shared/locale/de.ts +2 -1
  252. package/src/react/web/wallets/shared/locale/en.ts +1 -0
  253. package/src/react/web/wallets/shared/locale/es.ts +2 -1
  254. package/src/react/web/wallets/shared/locale/fr.ts +2 -1
  255. package/src/react/web/wallets/shared/locale/ja.ts +2 -1
  256. package/src/react/web/wallets/shared/locale/kr.ts +2 -1
  257. package/src/react/web/wallets/shared/locale/tl.ts +2 -1
  258. package/src/react/web/wallets/shared/locale/types.ts +1 -0
  259. package/src/react/web/wallets/shared/locale/vi.ts +1 -0
  260. package/src/react/web/wallets/shared/oauthSignIn.ts +6 -2
  261. package/src/utils/any-evm/deploy-metadata.ts +1 -0
  262. package/src/utils/encoding/hex.ts +2 -3
  263. package/src/utils/fetch.test.ts +94 -0
  264. package/src/utils/fetch.ts +1 -12
  265. package/src/utils/promise/p-limit.ts +165 -165
  266. package/src/utils/signatures/sign-message.ts +3 -3
  267. package/src/version.ts +1 -1
  268. package/src/wallets/in-app/core/authentication/guest.ts +37 -0
  269. package/src/wallets/in-app/core/authentication/types.ts +9 -4
  270. package/src/wallets/in-app/core/wallet/types.ts +6 -1
  271. package/src/wallets/in-app/native/auth/native-auth.ts +34 -3
  272. package/src/wallets/in-app/native/helpers/api/fetchers.ts +1 -2
  273. package/src/wallets/in-app/native/helpers/wallet/sss.ts +1 -6
  274. package/src/wallets/in-app/native/native-connector.ts +42 -2
  275. package/src/wallets/in-app/web/in-app.ts +13 -1
  276. package/src/wallets/in-app/web/lib/auth/oauth.ts +3 -3
  277. package/src/wallets/in-app/web/lib/web-connector.ts +8 -0
  278. package/src/wallets/manager/index.ts +5 -0
  279. package/src/wallets/types.ts +2 -0
  280. package/src/wallets/wallet-connect/receiver/request-handlers/switch-chain.ts +2 -3
@@ -1,105 +1,105 @@
1
1
  // source code of yocto-queue + modified to add types
2
2
  // https://github.com/sindresorhus/yocto-queue
3
3
  class Node<T> {
4
- value: T;
5
- next: Node<T> | undefined;
4
+ value: T;
5
+ next: Node<T> | undefined;
6
6
 
7
- constructor(value: T) {
8
- this.value = value;
9
- }
7
+ constructor(value: T) {
8
+ this.value = value;
9
+ }
10
10
  }
11
11
 
12
12
  class Queue<T> {
13
- private head: Node<T> | undefined;
14
- private tail: Node<T> | undefined;
15
- size: number;
16
-
17
- constructor() {
18
- this.clear();
19
- this.size = 0;
20
- }
21
-
22
- enqueue(value: T) {
23
- const node = new Node(value);
24
-
25
- if (this.head) {
26
- if (this.tail) {
27
- this.tail.next = node;
28
- }
29
- this.tail = node;
30
- } else {
31
- this.head = node;
32
- this.tail = node;
33
- }
34
-
35
- this.size++;
36
- }
37
-
38
- dequeue() {
39
- const current = this.head;
40
- if (!current) {
41
- return;
42
- }
43
-
44
- this.head = this.head?.next;
45
- this.size--;
46
- return current.value;
47
- }
48
-
49
- clear() {
50
- this.head = undefined;
51
- this.tail = undefined;
52
- this.size = 0;
53
- }
54
-
55
- *[Symbol.iterator]() {
56
- let current = this.head;
57
-
58
- while (current) {
59
- yield current.value;
60
- current = current.next;
61
- }
62
- }
13
+ private head: Node<T> | undefined;
14
+ private tail: Node<T> | undefined;
15
+ size: number;
16
+
17
+ constructor() {
18
+ this.clear();
19
+ this.size = 0;
20
+ }
21
+
22
+ enqueue(value: T) {
23
+ const node = new Node(value);
24
+
25
+ if (this.head) {
26
+ if (this.tail) {
27
+ this.tail.next = node;
28
+ }
29
+ this.tail = node;
30
+ } else {
31
+ this.head = node;
32
+ this.tail = node;
33
+ }
34
+
35
+ this.size++;
36
+ }
37
+
38
+ dequeue() {
39
+ const current = this.head;
40
+ if (!current) {
41
+ return;
42
+ }
43
+
44
+ this.head = this.head?.next;
45
+ this.size--;
46
+ return current.value;
47
+ }
48
+
49
+ clear() {
50
+ this.head = undefined;
51
+ this.tail = undefined;
52
+ this.size = 0;
53
+ }
54
+
55
+ *[Symbol.iterator]() {
56
+ let current = this.head;
57
+
58
+ while (current) {
59
+ yield current.value;
60
+ current = current.next;
61
+ }
62
+ }
63
63
  }
64
64
 
65
65
  // source code of p-limit - https://github.com/sindresorhus/p-limit/ + modified to add types
66
66
  const AsyncResource = {
67
- bind(fn: () => void, _type?: any, thisArg?: any) {
68
- return fn.bind(thisArg);
69
- },
67
+ bind(fn: () => void, _type?: any, thisArg?: any) {
68
+ return fn.bind(thisArg);
69
+ },
70
70
  };
71
71
 
72
72
  type LimitFunctionCallSignature = {
73
- /**
74
- * @param fn - Promise-returning/async function.
75
- * @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions.
76
- * @returns The promise returned by calling `fn(...arguments)`.
77
- */
78
- <Arguments extends unknown[], ReturnType>(
79
- fn: (...arguments_: Arguments) => PromiseLike<ReturnType> | ReturnType,
80
- ...arguments_: Arguments
81
- ): Promise<ReturnType>;
73
+ /**
74
+ * @param fn - Promise-returning/async function.
75
+ * @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions.
76
+ * @returns The promise returned by calling `fn(...arguments)`.
77
+ */
78
+ <Arguments extends unknown[], ReturnType>(
79
+ fn: (...arguments_: Arguments) => PromiseLike<ReturnType> | ReturnType,
80
+ ...arguments_: Arguments
81
+ ): Promise<ReturnType>;
82
82
  };
83
83
 
84
84
  export type LimitFunction = {
85
- /**
86
- * The number of promises that are currently running.
87
- */
88
- readonly activeCount: number;
89
-
90
- /**
91
- * The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
92
- */
93
- readonly pendingCount: number;
94
-
95
- /**
96
- * Discard pending promises that are waiting to run.
97
- *
98
- * This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
99
- *
100
- * Note: This does not cancel promises that are already running.
101
- */
102
- clearQueue: () => void;
85
+ /**
86
+ * The number of promises that are currently running.
87
+ */
88
+ readonly activeCount: number;
89
+
90
+ /**
91
+ * The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
92
+ */
93
+ readonly pendingCount: number;
94
+
95
+ /**
96
+ * Discard pending promises that are waiting to run.
97
+ *
98
+ * This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
99
+ *
100
+ * Note: This does not cancel promises that are already running.
101
+ */
102
+ clearQueue: () => void;
103
103
  } & LimitFunctionCallSignature;
104
104
 
105
105
  type Fn = () => void;
@@ -110,84 +110,84 @@ type Fn = () => void;
110
110
  * @internal
111
111
  */
112
112
  export function pLimit(concurrency: number): LimitFunction {
113
- if (
114
- !(
115
- (Number.isInteger(concurrency) ||
116
- concurrency === Number.POSITIVE_INFINITY) &&
117
- concurrency > 0
118
- )
119
- ) {
120
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
121
- }
122
-
123
- const queue = new Queue<Fn>();
124
- let activeCount = 0;
125
-
126
- const next = () => {
127
- activeCount--;
128
-
129
- if (queue.size > 0) {
130
- const fn = queue.dequeue();
131
- if (fn) {
132
- fn();
133
- }
134
- }
135
- };
136
-
137
- const run = async (function_: Fn, resolve: any, arguments_: any[]) => {
138
- activeCount++;
139
-
140
- // @ts-ignore
141
- const result = (async () => function_(...arguments_))();
142
-
143
- resolve(result);
144
-
145
- try {
146
- await result;
147
- } catch {}
148
-
149
- next();
150
- };
151
-
152
- const enqueue = (function_: Fn, resolve: any, arguments_: any[]) => {
153
- queue.enqueue(
154
- AsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),
155
- );
156
-
157
- (async () => {
158
- // This function needs to wait until the next microtask before comparing
159
- // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
160
- // when the run function is dequeued and called. The comparison in the if-statement
161
- // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
162
- await Promise.resolve();
163
-
164
- if (activeCount < concurrency && queue.size > 0) {
165
- const fn = queue.dequeue();
166
- if (fn) {
167
- fn();
168
- }
169
- }
170
- })();
171
- };
172
-
173
- const generator: LimitFunctionCallSignature = (function_, ...arguments_) =>
174
- new Promise((resolve) => {
175
- enqueue(function_, resolve, arguments_);
176
- });
177
-
178
- Object.defineProperties(generator, {
179
- activeCount: {
180
- get: () => activeCount,
181
- },
182
- pendingCount: {
183
- get: () => queue.size,
184
- },
185
- clearQueue: {
186
- value() {
187
- queue.clear();
188
- },
189
- },
190
- });
191
-
192
- return generator as LimitFunction;
113
+ if (
114
+ !(
115
+ (Number.isInteger(concurrency) ||
116
+ concurrency === Number.POSITIVE_INFINITY) &&
117
+ concurrency > 0
118
+ )
119
+ ) {
120
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
121
+ }
122
+
123
+ const queue = new Queue<Fn>();
124
+ let activeCount = 0;
125
+
126
+ const next = () => {
127
+ activeCount--;
128
+
129
+ if (queue.size > 0) {
130
+ const fn = queue.dequeue();
131
+ if (fn) {
132
+ fn();
133
+ }
134
+ }
135
+ };
136
+
137
+ const run = async (function_: Fn, resolve: any, arguments_: any[]) => {
138
+ activeCount++;
139
+
140
+ // @ts-ignore
141
+ const result = (async () => function_(...arguments_))();
142
+
143
+ resolve(result);
144
+
145
+ try {
146
+ await result;
147
+ } catch {}
148
+
149
+ next();
150
+ };
151
+
152
+ const enqueue = (function_: Fn, resolve: any, arguments_: any[]) => {
153
+ queue.enqueue(
154
+ AsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),
155
+ );
156
+
157
+ (async () => {
158
+ // This function needs to wait until the next microtask before comparing
159
+ // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
160
+ // when the run function is dequeued and called. The comparison in the if-statement
161
+ // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
162
+ await Promise.resolve();
163
+
164
+ if (activeCount < concurrency && queue.size > 0) {
165
+ const fn = queue.dequeue();
166
+ if (fn) {
167
+ fn();
168
+ }
169
+ }
170
+ })();
171
+ };
172
+
173
+ const generator: LimitFunctionCallSignature = (function_, ...arguments_) =>
174
+ new Promise((resolve) => {
175
+ enqueue(function_, resolve, arguments_);
176
+ });
177
+
178
+ Object.defineProperties(generator, {
179
+ activeCount: {
180
+ get: () => activeCount,
181
+ },
182
+ pendingCount: {
183
+ get: () => queue.size,
184
+ },
185
+ clearQueue: {
186
+ value() {
187
+ queue.clear();
188
+ },
189
+ },
190
+ });
191
+
192
+ return generator as LimitFunction;
193
193
  }
@@ -62,10 +62,10 @@ export function signMessage(
62
62
  const { message, privateKey } = options;
63
63
  const signature = sign({ hash: hashMessage(message), privateKey });
64
64
  return signatureToHex(signature);
65
- } else if ("account" in options) {
65
+ }
66
+ if ("account" in options) {
66
67
  const { message, account } = options;
67
68
  return account.signMessage({ message });
68
- } else {
69
- throw new Error("Either privateKey or account is required");
70
69
  }
70
+ throw new Error("Either privateKey or account is required");
71
71
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.56.0";
1
+ export const version = "5.57.0";
@@ -0,0 +1,37 @@
1
+ import type { ThirdwebClient } from "../../../../client/client.js";
2
+ import { getClientFetch } from "../../../../utils/fetch.js";
3
+ import type { Ecosystem } from "../../web/types.js";
4
+ import { getLoginCallbackUrl } from "./getLoginPath.js";
5
+ import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
6
+
7
+ /**
8
+ * Does no real authentication, just issues a temporary token for the user.
9
+ * @internal
10
+ */
11
+ export async function guestAuthenticate(args: {
12
+ client: ThirdwebClient;
13
+ ecosystem?: Ecosystem;
14
+ }): Promise<AuthStoredTokenWithCookieReturnType> {
15
+ const clientFetch = getClientFetch(args.client, args.ecosystem);
16
+ const authResult = await (async () => {
17
+ const path = getLoginCallbackUrl({
18
+ authOption: "guest",
19
+ client: args.client,
20
+ ecosystem: args.ecosystem,
21
+ });
22
+ const res = await clientFetch(`${path}`, {
23
+ method: "POST",
24
+ headers: {
25
+ "Content-Type": "application/json",
26
+ },
27
+ body: JSON.stringify({
28
+ sessionId: "guest",
29
+ }),
30
+ });
31
+
32
+ if (!res.ok) throw new Error("Failed to generate guest account");
33
+
34
+ return (await res.json()) satisfies AuthStoredTokenWithCookieReturnType;
35
+ })();
36
+ return authResult;
37
+ }
@@ -3,7 +3,7 @@ import type { ThirdwebClient } from "../../../../client/client.js";
3
3
  import type { Address } from "../../../../utils/address.js";
4
4
  import type { Account } from "../../../interfaces/wallet.js";
5
5
  import type { Wallet } from "../../../interfaces/wallet.js";
6
- import type { AuthOption, SocialAuthOption } from "../../../types.js";
6
+ import type { AuthOption, OAuthOption } from "../../../types.js";
7
7
  import type { Ecosystem } from "../../web/types.js";
8
8
 
9
9
  export type MultiStepAuthProviderType =
@@ -26,7 +26,7 @@ export type MultiStepAuthArgsType = MultiStepAuthProviderType & {
26
26
 
27
27
  export type SingleStepAuthArgsType =
28
28
  | {
29
- strategy: SocialAuthOption;
29
+ strategy: OAuthOption;
30
30
  openedWindow?: Window;
31
31
  closeOpenedWindow?: (window: Window) => void;
32
32
  redirectUrl?: string;
@@ -52,6 +52,10 @@ export type SingleStepAuthArgsType =
52
52
  strategy: "wallet";
53
53
  wallet: Wallet;
54
54
  chain: Chain;
55
+ }
56
+ | {
57
+ strategy: "guest";
58
+ client: ThirdwebClient;
55
59
  };
56
60
 
57
61
  export type AuthArgsType = (MultiStepAuthArgsType | SingleStepAuthArgsType) & {
@@ -68,6 +72,7 @@ export enum RecoveryShareManagement {
68
72
  // TODO: remove usage of enums, instead use object with as const
69
73
  export enum AuthProvider {
70
74
  COGNITO = "Cognito",
75
+ GUEST = "Guest",
71
76
  GOOGLE = "Google",
72
77
  EMAIL_OTP = "EmailOtp",
73
78
  CUSTOM_JWT = "CustomJWT",
@@ -82,8 +87,8 @@ export enum AuthProvider {
82
87
  TELEGRAM = "Telegram",
83
88
  }
84
89
 
85
- export type OauthOption = {
86
- strategy: SocialAuthOption;
90
+ export type OAuthRedirectObject = {
91
+ strategy: OAuthOption;
87
92
  redirectUrl: string;
88
93
  };
89
94
 
@@ -1,7 +1,11 @@
1
1
  import type { Chain } from "../../../../chains/types.js";
2
2
  import type { ThirdwebClient } from "../../../../client/client.js";
3
3
  import type { SmartWalletOptions } from "../../../smart/types.js";
4
- import type { AuthOption, SocialAuthOption } from "../../../types.js";
4
+ import type {
5
+ AuthOption,
6
+ OAuthOption,
7
+ SocialAuthOption,
8
+ } from "../../../types.js";
5
9
  import type {
6
10
  AuthStoredTokenWithCookieReturnType,
7
11
  MultiStepAuthArgsType,
@@ -24,6 +28,7 @@ export type InAppWalletAutoConnectOptions = {
24
28
  };
25
29
 
26
30
  export type InAppWalletSocialAuth = SocialAuthOption;
31
+ export type InAppWalletOAuth = OAuthOption;
27
32
  export type InAppWalletAuth = AuthOption;
28
33
 
29
34
  export type InAppWalletCreationOptions =
@@ -3,11 +3,12 @@ import type { Chain } from "../../../../chains/types.js";
3
3
  import type { ThirdwebClient } from "../../../../client/client.js";
4
4
  import type { Wallet } from "../../../interfaces/wallet.js";
5
5
  import { getLoginUrl } from "../../core/authentication/getLoginPath.js";
6
+ import { guestAuthenticate } from "../../core/authentication/guest.js";
6
7
  import { siweAuthenticate } from "../../core/authentication/siwe.js";
7
8
  import type {
8
9
  AuthStoredTokenWithCookieReturnType,
9
10
  MultiStepAuthArgsType,
10
- OauthOption,
11
+ OAuthRedirectObject,
11
12
  } from "../../core/authentication/types.js";
12
13
  import { verifyOtp } from "../../web/lib/auth/otp.js";
13
14
  import type { Ecosystem } from "../../web/types.js";
@@ -53,7 +54,7 @@ export async function otpLogin(
53
54
  }
54
55
 
55
56
  export async function authenticate(
56
- auth: OauthOption,
57
+ auth: OAuthRedirectObject,
57
58
  client: ThirdwebClient,
58
59
  ): Promise<AuthStoredTokenWithCookieReturnType> {
59
60
  const loginUrl = getLoginUrl({
@@ -98,7 +99,7 @@ export async function authenticate(
98
99
  }
99
100
 
100
101
  export async function socialLogin(
101
- auth: OauthOption,
102
+ auth: OAuthRedirectObject,
102
103
  client: ThirdwebClient,
103
104
  ): Promise<AuthStoredTokenWithCookieReturnType> {
104
105
  const { storedToken } = await authenticate(auth, client);
@@ -158,6 +159,36 @@ export async function siweLogin(
158
159
  }
159
160
  }
160
161
 
162
+ export async function guestLogin(
163
+ client: ThirdwebClient,
164
+ ecosystem?: Ecosystem,
165
+ ): Promise<AuthStoredTokenWithCookieReturnType> {
166
+ const { storedToken } = await guestAuthenticate({
167
+ client,
168
+ ecosystem,
169
+ });
170
+ try {
171
+ const toStoreToken: AuthStoredTokenWithCookieReturnType["storedToken"] = {
172
+ jwtToken: storedToken.jwtToken,
173
+ authDetails: storedToken.authDetails,
174
+ authProvider: storedToken.authProvider,
175
+ developerClientId: storedToken.developerClientId,
176
+ cookieString: storedToken.cookieString,
177
+ // we should always store the jwt cookie since there's no concept of cookie in react native
178
+ shouldStoreCookieString: true,
179
+ isNewUser: storedToken.isNewUser,
180
+ };
181
+
182
+ await postAuth({ storedToken: toStoreToken, client });
183
+
184
+ return { storedToken };
185
+ } catch (e) {
186
+ throw new Error(
187
+ createErrorMessage("Malformed response from post authentication", e),
188
+ );
189
+ }
190
+ }
191
+
161
192
  export async function customJwt(
162
193
  authOptions: { jwt: string; password: string },
163
194
  client: ThirdwebClient,
@@ -91,9 +91,8 @@ export const authFetchEmbeddedWalletUser = async (
91
91
  params,
92
92
  retries - 1,
93
93
  );
94
- } else {
95
- throw e;
96
94
  }
95
+ throw e;
97
96
  }
98
97
  };
99
98
 
@@ -206,12 +206,7 @@ function getRNG(type) {
206
206
  size = 32;
207
207
  elems = Math.ceil(bits / 32);
208
208
  while (str === null) {
209
- str = construct(
210
- bits,
211
- randomBytesBuffer(elems),
212
- radix,
213
- size,
214
- );
209
+ str = construct(bits, randomBytesBuffer(elems), radix, size);
215
210
  }
216
211
 
217
212
  return str;
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
3
3
  import { stringify } from "../../../utils/json.js";
4
4
  import { nativeLocalStorage } from "../../../utils/storage/nativeStorage.js";
5
5
  import type { Account, Wallet } from "../../interfaces/wallet.js";
6
+ import { guestAuthenticate } from "../core/authentication/guest.js";
6
7
  import {
7
8
  loginWithPasskey,
8
9
  registerPasskey,
@@ -16,7 +17,7 @@ import {
16
17
  type LogoutReturnType,
17
18
  type MultiStepAuthArgsType,
18
19
  type MultiStepAuthProviderType,
19
- type OauthOption,
20
+ type OAuthRedirectObject,
20
21
  UserWalletStatus,
21
22
  } from "../core/authentication/types.js";
22
23
  import type { InAppConnector } from "../core/interfaces/connector.js";
@@ -27,6 +28,7 @@ import {
27
28
  authenticate,
28
29
  customJwt,
29
30
  deleteActiveAccount,
31
+ guestLogin,
30
32
  otpLogin,
31
33
  siweLogin,
32
34
  socialLogin,
@@ -99,6 +101,12 @@ export class InAppNativeConnector implements InAppConnector {
99
101
  case "phone": {
100
102
  return verifyOtp(params);
101
103
  }
104
+ case "guest": {
105
+ return guestAuthenticate({
106
+ client: this.options.client,
107
+ ecosystem: params.ecosystem,
108
+ });
109
+ }
102
110
  case "wallet": {
103
111
  return siweAuthenticate({
104
112
  client: this.options.client,
@@ -159,6 +167,11 @@ export class InAppNativeConnector implements InAppConnector {
159
167
  redirectUrl,
160
168
  });
161
169
  }
170
+ case "guest": {
171
+ return this.guestLogin({
172
+ ecosystem: params.ecosystem,
173
+ });
174
+ }
162
175
  case "wallet": {
163
176
  return this.siweLogin({
164
177
  wallet: params.wallet,
@@ -300,7 +313,9 @@ export class InAppNativeConnector implements InAppConnector {
300
313
  return deleteActiveAccount({ client: this.options.client });
301
314
  }
302
315
 
303
- private async socialLogin(auth: OauthOption): Promise<AuthLoginReturnType> {
316
+ private async socialLogin(
317
+ auth: OAuthRedirectObject,
318
+ ): Promise<AuthLoginReturnType> {
304
319
  try {
305
320
  const { storedToken } = await socialLogin(auth, this.options.client);
306
321
  const account = await this.getAccount();
@@ -355,6 +370,31 @@ export class InAppNativeConnector implements InAppConnector {
355
370
  }
356
371
  }
357
372
 
373
+ private async guestLogin(options: {
374
+ ecosystem?: Ecosystem;
375
+ }): Promise<AuthLoginReturnType> {
376
+ try {
377
+ const { storedToken } = await guestLogin(
378
+ this.options.client,
379
+ options.ecosystem,
380
+ );
381
+ const account = await this.getAccount();
382
+ return {
383
+ user: {
384
+ status: UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED,
385
+ account,
386
+ authDetails: storedToken.authDetails,
387
+ walletAddress: account.address,
388
+ },
389
+ };
390
+ } catch (error) {
391
+ if (error instanceof Error) {
392
+ throw new Error(`Error generating guest account: ${error.message}`);
393
+ }
394
+ throw new Error("An unknown error occurred generating guest account");
395
+ }
396
+ }
397
+
358
398
  private async customJwt(authOptions: {
359
399
  jwt: string;
360
400
  password: string;