thirdweb 5.58.5 → 5.59.0-nightly-e2b3484764275560aa899f3f894b767faedaa9a1-20240925000331

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 (377) hide show
  1. package/dist/cjs/exports/react.js +3 -3
  2. package/dist/cjs/exports/react.js.map +1 -1
  3. package/dist/cjs/exports/react.native.js +5 -3
  4. package/dist/cjs/exports/react.native.js.map +1 -1
  5. package/dist/cjs/exports/wallets/in-app.js +3 -1
  6. package/dist/cjs/exports/wallets/in-app.js.map +1 -1
  7. package/dist/cjs/exports/wallets/in-app.native.js +3 -1
  8. package/dist/cjs/exports/wallets/in-app.native.js.map +1 -1
  9. package/dist/cjs/exports/wallets.js +15 -10
  10. package/dist/cjs/exports/wallets.js.map +1 -1
  11. package/dist/cjs/exports/wallets.native.js +18 -7
  12. package/dist/cjs/exports/wallets.native.js.map +1 -1
  13. package/dist/cjs/react/core/hooks/wallets/{useAdminAccount.js → useAdminWallet.js} +1 -1
  14. package/dist/cjs/react/core/hooks/wallets/useAdminWallet.js.map +1 -0
  15. package/dist/cjs/react/{core/hooks/others → native/hooks/wallets}/useProfiles.js +15 -7
  16. package/dist/cjs/react/native/hooks/wallets/useProfiles.js.map +1 -0
  17. package/dist/cjs/react/native/ui/connect/ConnectedButton.js +1 -1
  18. package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
  19. package/dist/cjs/react/native/ui/connect/ConnectedModal.js +1 -1
  20. package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
  21. package/dist/cjs/react/native/ui/connect/TokenListScreen.js +1 -1
  22. package/dist/cjs/react/native/ui/connect/TokenListScreen.js.map +1 -1
  23. package/dist/cjs/react/web/hooks/wallets/useProfiles.js +45 -0
  24. package/dist/cjs/react/web/hooks/wallets/useProfiles.js.map +1 -0
  25. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +4 -4
  26. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/Modal/TOS.js +2 -2
  28. package/dist/cjs/react/web/ui/ConnectWallet/Modal/TOS.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +2 -2
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  31. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +1 -1
  32. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +1 -1
  34. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +6 -6
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +1 -1
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
  39. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js +2 -2
  40. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js.map +1 -1
  41. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +1 -1
  42. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  43. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +3 -3
  44. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
  45. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  46. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  47. package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +2 -2
  48. package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
  49. package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +4 -2
  50. package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
  51. package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +2 -2
  52. package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
  53. package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js +2 -2
  54. package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
  55. package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +5 -4
  56. package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
  57. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +10 -10
  58. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  59. package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js +4 -3
  60. package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
  61. package/dist/cjs/react/web/wallets/shared/PassKeyLogin.js +9 -7
  62. package/dist/cjs/react/web/wallets/shared/PassKeyLogin.js.map +1 -1
  63. package/dist/cjs/react/web/wallets/shared/SocialLogin.js +3 -2
  64. package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
  65. package/dist/cjs/version.js +1 -1
  66. package/dist/cjs/version.js.map +1 -1
  67. package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js +7 -7
  68. package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
  69. package/dist/cjs/wallets/in-app/core/authentication/types.js.map +1 -1
  70. package/dist/cjs/wallets/in-app/core/wallet/ecosystem-core.js +0 -20
  71. package/dist/cjs/wallets/in-app/core/wallet/ecosystem-core.js.map +1 -1
  72. package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js +0 -39
  73. package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js.map +1 -1
  74. package/dist/cjs/wallets/in-app/native/auth/index.js +57 -2
  75. package/dist/cjs/wallets/in-app/native/auth/index.js.map +1 -1
  76. package/dist/cjs/wallets/in-app/native/auth/native-auth.js.map +1 -1
  77. package/dist/cjs/wallets/in-app/native/native-connector.js +61 -19
  78. package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
  79. package/dist/cjs/wallets/in-app/web/lib/actions/sign-message.enclave.js +1 -1
  80. package/dist/cjs/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +1 -1
  81. package/dist/cjs/wallets/in-app/web/lib/actions/sign-transaction.enclave.js +1 -1
  82. package/dist/cjs/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +1 -1
  83. package/dist/cjs/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js +1 -1
  84. package/dist/cjs/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +1 -1
  85. package/dist/cjs/wallets/in-app/web/lib/auth/abstract-login.js.map +1 -1
  86. package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js +2 -8
  87. package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -1
  88. package/dist/cjs/wallets/in-app/web/lib/auth/index.js +80 -4
  89. package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
  90. package/dist/cjs/wallets/in-app/web/lib/enclave-wallet.js +2 -8
  91. package/dist/cjs/wallets/in-app/web/lib/enclave-wallet.js.map +1 -1
  92. package/dist/cjs/wallets/in-app/web/lib/get-auth-token.js +1 -0
  93. package/dist/cjs/wallets/in-app/web/lib/get-auth-token.js.map +1 -1
  94. package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js +2 -8
  95. package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
  96. package/dist/cjs/wallets/in-app/web/lib/web-connector.js +31 -0
  97. package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
  98. package/dist/esm/exports/react.js +2 -2
  99. package/dist/esm/exports/react.js.map +1 -1
  100. package/dist/esm/exports/react.native.js +2 -1
  101. package/dist/esm/exports/react.native.js.map +1 -1
  102. package/dist/esm/exports/wallets/in-app.js +1 -1
  103. package/dist/esm/exports/wallets/in-app.js.map +1 -1
  104. package/dist/esm/exports/wallets/in-app.native.js +1 -1
  105. package/dist/esm/exports/wallets/in-app.native.js.map +1 -1
  106. package/dist/esm/exports/wallets.js +1 -1
  107. package/dist/esm/exports/wallets.js.map +1 -1
  108. package/dist/esm/exports/wallets.native.js +4 -0
  109. package/dist/esm/exports/wallets.native.js.map +1 -1
  110. package/dist/esm/react/core/hooks/wallets/{useAdminAccount.js → useAdminWallet.js} +1 -1
  111. package/dist/esm/react/core/hooks/wallets/useAdminWallet.js.map +1 -0
  112. package/dist/esm/react/{core/hooks/others → native/hooks/wallets}/useProfiles.js +14 -6
  113. package/dist/esm/react/native/hooks/wallets/useProfiles.js.map +1 -0
  114. package/dist/esm/react/native/ui/connect/ConnectedButton.js +1 -1
  115. package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
  116. package/dist/esm/react/native/ui/connect/ConnectedModal.js +1 -1
  117. package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
  118. package/dist/esm/react/native/ui/connect/TokenListScreen.js +1 -1
  119. package/dist/esm/react/native/ui/connect/TokenListScreen.js.map +1 -1
  120. package/dist/esm/react/web/hooks/wallets/useProfiles.js +42 -0
  121. package/dist/esm/react/web/hooks/wallets/useProfiles.js.map +1 -0
  122. package/dist/esm/react/web/ui/ConnectWallet/Details.js +3 -3
  123. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  124. package/dist/esm/react/web/ui/ConnectWallet/Modal/TOS.js +2 -2
  125. package/dist/esm/react/web/ui/ConnectWallet/Modal/TOS.js.map +1 -1
  126. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +2 -2
  127. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  128. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +1 -1
  129. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
  130. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +1 -1
  131. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
  132. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +6 -6
  133. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  134. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +1 -1
  135. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
  136. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js +2 -2
  137. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js.map +1 -1
  138. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +1 -1
  139. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  140. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +3 -3
  141. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
  142. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  143. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  144. package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +1 -1
  145. package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
  146. package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +4 -2
  147. package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
  148. package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +1 -1
  149. package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
  150. package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js +1 -1
  151. package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
  152. package/dist/esm/react/web/wallets/in-app/WalletAuth.js +3 -2
  153. package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
  154. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +2 -2
  155. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  156. package/dist/esm/react/web/wallets/shared/OTPLoginUI.js +5 -4
  157. package/dist/esm/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
  158. package/dist/esm/react/web/wallets/shared/PassKeyLogin.js +5 -3
  159. package/dist/esm/react/web/wallets/shared/PassKeyLogin.js.map +1 -1
  160. package/dist/esm/react/web/wallets/shared/SocialLogin.js +3 -2
  161. package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
  162. package/dist/esm/version.js +1 -1
  163. package/dist/esm/version.js.map +1 -1
  164. package/dist/esm/wallets/in-app/core/authentication/linkAccount.js +7 -7
  165. package/dist/esm/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
  166. package/dist/esm/wallets/in-app/core/authentication/types.js.map +1 -1
  167. package/dist/esm/wallets/in-app/core/wallet/ecosystem-core.js +0 -20
  168. package/dist/esm/wallets/in-app/core/wallet/ecosystem-core.js.map +1 -1
  169. package/dist/esm/wallets/in-app/core/wallet/in-app-core.js +0 -39
  170. package/dist/esm/wallets/in-app/core/wallet/in-app-core.js.map +1 -1
  171. package/dist/esm/wallets/in-app/native/auth/index.js +55 -2
  172. package/dist/esm/wallets/in-app/native/auth/index.js.map +1 -1
  173. package/dist/esm/wallets/in-app/native/auth/native-auth.js.map +1 -1
  174. package/dist/esm/wallets/in-app/native/native-connector.js +61 -19
  175. package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
  176. package/dist/esm/wallets/in-app/web/lib/actions/sign-message.enclave.js +1 -1
  177. package/dist/esm/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +1 -1
  178. package/dist/esm/wallets/in-app/web/lib/actions/sign-transaction.enclave.js +1 -1
  179. package/dist/esm/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +1 -1
  180. package/dist/esm/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js +1 -1
  181. package/dist/esm/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +1 -1
  182. package/dist/esm/wallets/in-app/web/lib/auth/abstract-login.js.map +1 -1
  183. package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js +2 -8
  184. package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -1
  185. package/dist/esm/wallets/in-app/web/lib/auth/index.js +77 -4
  186. package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
  187. package/dist/esm/wallets/in-app/web/lib/enclave-wallet.js +2 -8
  188. package/dist/esm/wallets/in-app/web/lib/enclave-wallet.js.map +1 -1
  189. package/dist/esm/wallets/in-app/web/lib/get-auth-token.js +1 -0
  190. package/dist/esm/wallets/in-app/web/lib/get-auth-token.js.map +1 -1
  191. package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js +2 -8
  192. package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
  193. package/dist/esm/wallets/in-app/web/lib/web-connector.js +31 -0
  194. package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
  195. package/dist/types/exports/react.d.ts +2 -2
  196. package/dist/types/exports/react.d.ts.map +1 -1
  197. package/dist/types/exports/react.native.d.ts +2 -1
  198. package/dist/types/exports/react.native.d.ts.map +1 -1
  199. package/dist/types/exports/wallets/in-app.d.ts +1 -1
  200. package/dist/types/exports/wallets/in-app.d.ts.map +1 -1
  201. package/dist/types/exports/wallets/in-app.native.d.ts +1 -1
  202. package/dist/types/exports/wallets/in-app.native.d.ts.map +1 -1
  203. package/dist/types/exports/wallets.d.ts +1 -1
  204. package/dist/types/exports/wallets.d.ts.map +1 -1
  205. package/dist/types/exports/wallets.native.d.ts +2 -0
  206. package/dist/types/exports/wallets.native.d.ts.map +1 -1
  207. package/dist/types/react/core/hooks/wallets/useActiveAccount.d.ts +1 -1
  208. package/dist/types/react/core/hooks/wallets/useActiveAccount.d.ts.map +1 -1
  209. package/dist/types/react/core/hooks/wallets/useActiveWallet.d.ts +1 -1
  210. package/dist/types/react/core/hooks/wallets/useActiveWallet.d.ts.map +1 -1
  211. package/dist/types/react/core/hooks/wallets/useActiveWalletConnectionStatus.d.ts +1 -1
  212. package/dist/types/react/core/hooks/wallets/useActiveWalletConnectionStatus.d.ts.map +1 -1
  213. package/dist/types/react/core/hooks/wallets/useAddConnectedWallet.d.ts +1 -1
  214. package/dist/types/react/core/hooks/wallets/useAddConnectedWallet.d.ts.map +1 -1
  215. package/dist/types/react/core/hooks/wallets/{useAdminAccount.d.ts → useAdminWallet.d.ts} +2 -2
  216. package/dist/types/react/core/hooks/wallets/useAdminWallet.d.ts.map +1 -0
  217. package/dist/types/react/core/hooks/wallets/useConnectedWallets.d.ts +1 -1
  218. package/dist/types/react/core/hooks/wallets/useConnectedWallets.d.ts.map +1 -1
  219. package/dist/types/react/core/hooks/wallets/useDisconnect.d.ts +1 -1
  220. package/dist/types/react/core/hooks/wallets/useSetActiveWallet.d.ts +1 -1
  221. package/dist/types/react/core/hooks/wallets/useSetActiveWallet.d.ts.map +1 -1
  222. package/dist/types/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.d.ts +1 -1
  223. package/dist/types/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.d.ts.map +1 -1
  224. package/dist/types/react/core/providers/connection-manager.d.ts +27 -27
  225. package/dist/types/react/{core/hooks/others → native/hooks/wallets}/useProfiles.d.ts +8 -3
  226. package/dist/types/react/native/hooks/wallets/useProfiles.d.ts.map +1 -0
  227. package/dist/types/react/web/hooks/wallets/useProfiles.d.ts +28 -0
  228. package/dist/types/react/web/hooks/wallets/useProfiles.d.ts.map +1 -0
  229. package/dist/types/react/web/ui/ConnectWallet/Modal/TOS.d.ts.map +1 -1
  230. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts.map +1 -1
  231. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.d.ts.map +1 -1
  232. package/dist/types/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.d.ts.map +1 -1
  233. package/dist/types/react/web/ui/MediaRenderer/ModelViewer.d.ts +1 -1
  234. package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts.map +1 -1
  235. package/dist/types/react/web/wallets/shared/OTPLoginUI.d.ts.map +1 -1
  236. package/dist/types/react/web/wallets/shared/PassKeyLogin.d.ts +1 -1
  237. package/dist/types/react/web/wallets/shared/PassKeyLogin.d.ts.map +1 -1
  238. package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
  239. package/dist/types/react/web/wallets/shared/oauthSignIn.d.ts +1 -2
  240. package/dist/types/react/web/wallets/shared/oauthSignIn.d.ts.map +1 -1
  241. package/dist/types/utils/fetch.d.ts +1 -1
  242. package/dist/types/utils/fetch.d.ts.map +1 -1
  243. package/dist/types/version.d.ts +1 -1
  244. package/dist/types/version.d.ts.map +1 -1
  245. package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +1 -1
  246. package/dist/types/wallets/in-app/core/authentication/guest.d.ts +1 -1
  247. package/dist/types/wallets/in-app/core/authentication/linkAccount.d.ts +6 -3
  248. package/dist/types/wallets/in-app/core/authentication/linkAccount.d.ts.map +1 -1
  249. package/dist/types/wallets/in-app/core/authentication/passkeys.d.ts +1 -1
  250. package/dist/types/wallets/in-app/core/authentication/siwe.d.ts +1 -1
  251. package/dist/types/wallets/in-app/core/authentication/types.d.ts +4 -3
  252. package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
  253. package/dist/types/wallets/in-app/core/interfaces/connector.d.ts +3 -1
  254. package/dist/types/wallets/in-app/core/interfaces/connector.d.ts.map +1 -1
  255. package/dist/types/wallets/in-app/core/wallet/ecosystem-core.d.ts.map +1 -1
  256. package/dist/types/wallets/in-app/core/wallet/in-app-core.d.ts +1 -1
  257. package/dist/types/wallets/in-app/core/wallet/in-app-core.d.ts.map +1 -1
  258. package/dist/types/wallets/in-app/core/wallet/types.d.ts +5 -0
  259. package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
  260. package/dist/types/wallets/in-app/native/auth/index.d.ts +48 -2
  261. package/dist/types/wallets/in-app/native/auth/index.d.ts.map +1 -1
  262. package/dist/types/wallets/in-app/native/auth/native-auth.d.ts +1 -1
  263. package/dist/types/wallets/in-app/native/auth/native-auth.d.ts.map +1 -1
  264. package/dist/types/wallets/in-app/native/native-connector.d.ts +8 -2
  265. package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
  266. package/dist/types/wallets/in-app/web/lib/actions/generate-wallet.enclave.d.ts +1 -1
  267. package/dist/types/wallets/in-app/web/lib/actions/generate-wallet.enclave.d.ts.map +1 -1
  268. package/dist/types/wallets/in-app/web/lib/actions/get-enclave-user-status.d.ts +1 -1
  269. package/dist/types/wallets/in-app/web/lib/actions/get-enclave-user-status.d.ts.map +1 -1
  270. package/dist/types/wallets/in-app/web/lib/actions/sign-message.enclave.d.ts +1 -1
  271. package/dist/types/wallets/in-app/web/lib/actions/sign-message.enclave.d.ts.map +1 -1
  272. package/dist/types/wallets/in-app/web/lib/actions/sign-transaction.enclave.d.ts +1 -1
  273. package/dist/types/wallets/in-app/web/lib/actions/sign-transaction.enclave.d.ts.map +1 -1
  274. package/dist/types/wallets/in-app/web/lib/actions/sign-typed-data.enclave.d.ts +1 -1
  275. package/dist/types/wallets/in-app/web/lib/actions/sign-typed-data.enclave.d.ts.map +1 -1
  276. package/dist/types/wallets/in-app/web/lib/auth/abstract-login.d.ts +2 -1
  277. package/dist/types/wallets/in-app/web/lib/auth/abstract-login.d.ts.map +1 -1
  278. package/dist/types/wallets/in-app/web/lib/auth/iframe-auth.d.ts +5 -3
  279. package/dist/types/wallets/in-app/web/lib/auth/iframe-auth.d.ts.map +1 -1
  280. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +68 -8
  281. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
  282. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +1 -1
  283. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts.map +1 -1
  284. package/dist/types/wallets/in-app/web/lib/auth/otp.d.ts +1 -1
  285. package/dist/types/wallets/in-app/web/lib/auth/otp.d.ts.map +1 -1
  286. package/dist/types/wallets/in-app/web/lib/enclave-wallet.d.ts +8 -7
  287. package/dist/types/wallets/in-app/web/lib/enclave-wallet.d.ts.map +1 -1
  288. package/dist/types/wallets/in-app/web/lib/get-auth-token.d.ts +1 -1
  289. package/dist/types/wallets/in-app/web/lib/get-auth-token.d.ts.map +1 -1
  290. package/dist/types/wallets/in-app/web/lib/iframe-wallet.d.ts +5 -3
  291. package/dist/types/wallets/in-app/web/lib/iframe-wallet.d.ts.map +1 -1
  292. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +9 -8
  293. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
  294. package/dist/types/wallets/in-app/web/types.d.ts +1 -5
  295. package/dist/types/wallets/in-app/web/types.d.ts.map +1 -1
  296. package/dist/types/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.d.ts +1 -1
  297. package/dist/types/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.d.ts.map +1 -1
  298. package/package.json +4 -4
  299. package/src/exports/react.native.ts +2 -1
  300. package/src/exports/react.ts +2 -2
  301. package/src/exports/wallets/in-app.native.ts +2 -0
  302. package/src/exports/wallets/in-app.ts +2 -0
  303. package/src/exports/wallets.native.ts +12 -0
  304. package/src/exports/wallets.ts +6 -1
  305. package/src/react/{core/hooks/others → native/hooks/wallets}/useProfiles.ts +19 -8
  306. package/src/react/native/ui/connect/ConnectedButton.tsx +1 -1
  307. package/src/react/native/ui/connect/ConnectedModal.tsx +1 -1
  308. package/src/react/native/ui/connect/TokenListScreen.tsx +1 -1
  309. package/src/react/web/hooks/wallets/useProfiles.ts +48 -0
  310. package/src/react/web/ui/ConnectWallet/Details.tsx +4 -4
  311. package/src/react/web/ui/ConnectWallet/Modal/TOS.tsx +3 -2
  312. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +4 -1
  313. package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +1 -1
  314. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +2 -3
  315. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +10 -10
  316. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +1 -1
  317. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx +2 -2
  318. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +1 -1
  319. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.tsx +3 -4
  320. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +1 -1
  321. package/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx +1 -1
  322. package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.tsx +4 -2
  323. package/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.tsx +1 -1
  324. package/src/react/web/ui/ConnectWallet/screens/SignatureScreen.tsx +1 -1
  325. package/src/react/web/ui/prebuilt/NFT/NFT.test.tsx +2 -2
  326. package/src/react/web/wallets/in-app/WalletAuth.tsx +3 -2
  327. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +2 -2
  328. package/src/react/web/wallets/shared/OTPLoginUI.tsx +8 -4
  329. package/src/react/web/wallets/shared/PassKeyLogin.tsx +6 -3
  330. package/src/react/web/wallets/shared/SocialLogin.tsx +3 -2
  331. package/src/react/web/wallets/shared/oauthSignIn.ts +1 -1
  332. package/src/utils/fetch.test.ts +1 -1
  333. package/src/utils/fetch.ts +1 -1
  334. package/src/version.ts +1 -1
  335. package/src/wallets/in-app/core/authentication/getLoginPath.ts +1 -1
  336. package/src/wallets/in-app/core/authentication/guest.ts +1 -1
  337. package/src/wallets/in-app/core/authentication/linkAccount.ts +15 -11
  338. package/src/wallets/in-app/core/authentication/passkeys.ts +1 -1
  339. package/src/wallets/in-app/core/authentication/siwe.ts +1 -1
  340. package/src/wallets/in-app/core/authentication/types.ts +10 -8
  341. package/src/wallets/in-app/core/interfaces/connector.ts +4 -0
  342. package/src/wallets/in-app/core/wallet/ecosystem-core.ts +1 -40
  343. package/src/wallets/in-app/core/wallet/in-app-core.ts +1 -58
  344. package/src/wallets/in-app/core/wallet/types.ts +6 -0
  345. package/src/wallets/in-app/native/auth/index.ts +62 -6
  346. package/src/wallets/in-app/native/auth/native-auth.ts +1 -1
  347. package/src/wallets/in-app/native/native-connector.ts +53 -27
  348. package/src/wallets/in-app/web/lib/actions/generate-wallet.enclave.ts +1 -1
  349. package/src/wallets/in-app/web/lib/actions/get-enclave-user-status.ts +1 -1
  350. package/src/wallets/in-app/web/lib/actions/sign-message.enclave.ts +2 -2
  351. package/src/wallets/in-app/web/lib/actions/sign-transaction.enclave.ts +2 -2
  352. package/src/wallets/in-app/web/lib/actions/sign-typed-data.enclave.ts +2 -2
  353. package/src/wallets/in-app/web/lib/auth/abstract-login.ts +2 -1
  354. package/src/wallets/in-app/web/lib/auth/iframe-auth.ts +6 -8
  355. package/src/wallets/in-app/web/lib/auth/index.ts +89 -19
  356. package/src/wallets/in-app/web/lib/auth/oauth.ts +1 -1
  357. package/src/wallets/in-app/web/lib/auth/otp.ts +1 -1
  358. package/src/wallets/in-app/web/lib/enclave-wallet.ts +9 -13
  359. package/src/wallets/in-app/web/lib/get-auth-token.ts +2 -1
  360. package/src/wallets/in-app/web/lib/iframe-wallet.ts +5 -9
  361. package/src/wallets/in-app/web/lib/web-connector.ts +37 -4
  362. package/src/wallets/in-app/web/types.ts +1 -6
  363. package/src/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.ts +1 -1
  364. package/dist/cjs/react/core/hooks/others/useProfiles.js.map +0 -1
  365. package/dist/cjs/react/core/hooks/wallets/useAdminAccount.js.map +0 -1
  366. package/dist/cjs/wallets/in-app/core/wallet/profiles.js +0 -61
  367. package/dist/cjs/wallets/in-app/core/wallet/profiles.js.map +0 -1
  368. package/dist/esm/react/core/hooks/others/useProfiles.js.map +0 -1
  369. package/dist/esm/react/core/hooks/wallets/useAdminAccount.js.map +0 -1
  370. package/dist/esm/wallets/in-app/core/wallet/profiles.js +0 -57
  371. package/dist/esm/wallets/in-app/core/wallet/profiles.js.map +0 -1
  372. package/dist/types/react/core/hooks/others/useProfiles.d.ts.map +0 -1
  373. package/dist/types/react/core/hooks/wallets/useAdminAccount.d.ts.map +0 -1
  374. package/dist/types/wallets/in-app/core/wallet/profiles.d.ts +0 -49
  375. package/dist/types/wallets/in-app/core/wallet/profiles.d.ts.map +0 -1
  376. package/src/wallets/in-app/core/wallet/profiles.ts +0 -76
  377. /package/src/react/core/hooks/wallets/{useAdminAccount.ts → useAdminWallet.ts} +0 -0
@@ -1,12 +1,12 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import {
3
3
  type AuthArgsType,
4
- type AuthLoginReturnType,
5
4
  type GetAuthenticatedUserParams,
6
5
  type PreAuthArgsType,
7
6
  UserWalletStatus,
8
7
  } from "../../core/authentication/types.js";
9
8
  import { getOrCreateInAppWalletConnector } from "../../core/wallet/in-app-core.js";
9
+ import type { Ecosystem } from "../../core/wallet/types.js";
10
10
 
11
11
  // ---- KEEP IN SYNC WITH /wallets/in-app/web/lib/auth/index.ts ---- //
12
12
  // duplication needed for separate exports between web and native
@@ -14,11 +14,15 @@ import { getOrCreateInAppWalletConnector } from "../../core/wallet/in-app-core.j
14
14
  /**
15
15
  * @internal
16
16
  */
17
- async function getInAppWalletConnector(client: ThirdwebClient) {
17
+ async function getInAppWalletConnector(
18
+ client: ThirdwebClient,
19
+ ecosystem?: Ecosystem,
20
+ ) {
18
21
  return getOrCreateInAppWalletConnector(client, async (client) => {
19
22
  const { InAppNativeConnector } = await import("../native-connector.js");
20
23
  return new InAppNativeConnector({
21
24
  client: client,
25
+ ecosystem: ecosystem,
22
26
  });
23
27
  });
24
28
  }
@@ -131,9 +135,61 @@ export async function preAuthenticate(args: PreAuthArgsType) {
131
135
  * ```
132
136
  * @wallet
133
137
  */
134
- export async function authenticate(
135
- args: AuthArgsType,
136
- ): Promise<AuthLoginReturnType> {
138
+ export async function authenticate(args: AuthArgsType) {
137
139
  const connector = await getInAppWalletConnector(args.client);
138
- return connector.connect(args);
140
+ return connector.authenticate(args);
141
+ }
142
+
143
+ /**
144
+ * Connects a new profile (authentication method) to the current user.
145
+ * The connected profile can be any valid in-app wallet including email, phone, passkey, etc.
146
+ * The inputs mirror those used when authenticating normally.
147
+ *
148
+ * **When a profile is linked to the account, that profile can then be used to sign into the account.**
149
+ *
150
+ * This method is only available for in-app wallets.
151
+ *
152
+ * @param wallet - The wallet to link an additional profile to.
153
+ * @param auth - The authentications options to add the new profile.
154
+ * @returns A promise that resolves to the currently linked profiles when the connection is successful.
155
+ * @throws If the connection fails, if the profile is already linked to the account, or if the profile is already associated with another account.
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * const wallet = inAppWallet();
160
+ *
161
+ * await wallet.connect({ client, strategy: "google" });
162
+ * const profiles = await linkProfile({ client, strategy: "discord" });
163
+ * ```
164
+ * @wallet
165
+ */
166
+ export async function linkProfile(args: AuthArgsType) {
167
+ const connector = await getInAppWalletConnector(args.client, args.ecosystem);
168
+ return await connector.linkProfile(args);
169
+ }
170
+
171
+ /**
172
+ * Gets the linked profiles for the connected in-app or ecosystem wallet.
173
+ *
174
+ * @returns An array of accounts user profiles linked to the connected wallet.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * import { inAppWallet } from "thirdweb/wallets";
179
+ *
180
+ * const wallet = inAppWallet();
181
+ * wallet.connect({ strategy: "google" });
182
+ *
183
+ * const profiles = await getProfiles({
184
+ * client,
185
+ * });
186
+ *
187
+ * console.log(profiles[0].type);
188
+ * console.log(profiles[0].details.email);
189
+ * ```
190
+ * @wallet
191
+ */
192
+ export async function getProfiles(args: GetAuthenticatedUserParams) {
193
+ const connector = await getInAppWalletConnector(args.client, args.ecosystem);
194
+ return connector.getProfiles();
139
195
  }
@@ -11,8 +11,8 @@ import type {
11
11
  MultiStepAuthArgsType,
12
12
  OAuthRedirectObject,
13
13
  } from "../../core/authentication/types.js";
14
+ import type { Ecosystem } from "../../core/wallet/types.js";
14
15
  import { verifyOtp } from "../../web/lib/auth/otp.js";
15
- import type { Ecosystem } from "../../web/types.js";
16
16
  import {
17
17
  deleteAccount,
18
18
  getSessionHeaders,
@@ -3,7 +3,12 @@ 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 { ClientScopedStorage } from "../core/authentication/client-scoped-storage.js";
6
7
  import { guestAuthenticate } from "../core/authentication/guest.js";
8
+ import {
9
+ getLinkedProfilesInternal,
10
+ linkAccount,
11
+ } from "../core/authentication/linkAccount.js";
7
12
  import {
8
13
  loginWithPasskey,
9
14
  registerPasskey,
@@ -21,8 +26,8 @@ import {
21
26
  UserWalletStatus,
22
27
  } from "../core/authentication/types.js";
23
28
  import type { InAppConnector } from "../core/interfaces/connector.js";
29
+ import type { Ecosystem } from "../core/wallet/types.js";
24
30
  import { sendOtp, verifyOtp } from "../web/lib/auth/otp.js";
25
- import type { Ecosystem } from "../web/types.js";
26
31
  import {
27
32
  authEndpoint,
28
33
  authenticate,
@@ -41,21 +46,31 @@ import { getExistingUserAccount } from "./helpers/wallet/retrieval.js";
41
46
 
42
47
  type NativeConnectorOptions = {
43
48
  client: ThirdwebClient;
44
- partnerId?: string | undefined;
49
+ ecosystem?: Ecosystem;
45
50
  passkeyDomain?: string;
46
51
  };
47
52
 
48
53
  export class InAppNativeConnector implements InAppConnector {
49
- private options: NativeConnectorOptions;
54
+ private client: ThirdwebClient;
55
+ private ecosystem?: Ecosystem;
56
+ private passkeyDomain?: string;
57
+ private localStorage: ClientScopedStorage;
50
58
 
51
59
  constructor(options: NativeConnectorOptions) {
52
- this.options = options;
60
+ this.client = options.client;
61
+ this.ecosystem = options.ecosystem;
62
+ this.passkeyDomain = options.passkeyDomain;
63
+ this.localStorage = new ClientScopedStorage({
64
+ storage: nativeLocalStorage,
65
+ clientId: this.client.clientId,
66
+ ecosystemId: this.ecosystem?.id,
67
+ });
53
68
  }
54
69
 
55
70
  async getUser(): Promise<GetUser> {
56
- const localData = await getWalletUserDetails(this.options.client.clientId);
71
+ const localData = await getWalletUserDetails(this.client.clientId);
57
72
  const userStatus = await fetchUserDetails({
58
- client: this.options.client,
73
+ client: this.client,
59
74
  email: localData?.email,
60
75
  });
61
76
  if (userStatus.status === UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED) {
@@ -82,13 +97,13 @@ export class InAppNativeConnector implements InAppConnector {
82
97
  return { status: UserWalletStatus.LOGGED_OUT };
83
98
  }
84
99
  getAccount(): Promise<Account> {
85
- return getExistingUserAccount({ client: this.options.client });
100
+ return getExistingUserAccount({ client: this.client });
86
101
  }
87
102
 
88
103
  preAuthenticate(args: MultiStepAuthProviderType): Promise<void> {
89
104
  return sendOtp({
90
105
  ...args,
91
- client: this.options.client,
106
+ client: this.client,
92
107
  });
93
108
  }
94
109
 
@@ -103,14 +118,14 @@ export class InAppNativeConnector implements InAppConnector {
103
118
  }
104
119
  case "guest": {
105
120
  return guestAuthenticate({
106
- client: this.options.client,
121
+ client: this.client,
107
122
  ecosystem: params.ecosystem,
108
123
  storage: nativeLocalStorage,
109
124
  });
110
125
  }
111
126
  case "wallet": {
112
127
  return siweAuthenticate({
113
- client: this.options.client,
128
+ client: this.client,
114
129
  wallet: params.wallet,
115
130
  chain: params.chain,
116
131
  });
@@ -124,7 +139,7 @@ export class InAppNativeConnector implements InAppConnector {
124
139
  const ExpoLinking = require("expo-linking");
125
140
  const redirectUrl =
126
141
  params.redirectUrl || (ExpoLinking.createURL("") as string);
127
- return authenticate({ strategy, redirectUrl }, this.options.client);
142
+ return authenticate({ strategy, redirectUrl }, this.client);
128
143
  }
129
144
  case "passkey":
130
145
  return this.passkeyAuth(params);
@@ -141,7 +156,7 @@ export class InAppNativeConnector implements InAppConnector {
141
156
  email: params.email,
142
157
  verificationCode: params.verificationCode,
143
158
  strategy: "email",
144
- client: this.options.client,
159
+ client: this.client,
145
160
  });
146
161
  }
147
162
  case "phone": {
@@ -149,7 +164,7 @@ export class InAppNativeConnector implements InAppConnector {
149
164
  phoneNumber: params.phoneNumber,
150
165
  verificationCode: params.verificationCode,
151
166
  strategy: "phone",
152
- client: this.options.client,
167
+ client: this.client,
153
168
  });
154
169
  }
155
170
  case "google":
@@ -222,7 +237,7 @@ export class InAppNativeConnector implements InAppConnector {
222
237
  ecosystem?: Ecosystem;
223
238
  }): Promise<AuthStoredTokenWithCookieReturnType> {
224
239
  const { type, passkeyName, client, ecosystem } = args;
225
- const domain = this.options.passkeyDomain;
240
+ const domain = this.passkeyDomain;
226
241
  if (!domain) {
227
242
  throw new Error(
228
243
  "Passkey domain is required for native platforms. Please pass it in the 'auth' options when creating the inAppWallet().",
@@ -312,14 +327,14 @@ export class InAppNativeConnector implements InAppConnector {
312
327
 
313
328
  // TODO (rn) expose in the interface
314
329
  async deleteActiveAccount() {
315
- return deleteActiveAccount({ client: this.options.client });
330
+ return deleteActiveAccount({ client: this.client });
316
331
  }
317
332
 
318
333
  private async socialLogin(
319
334
  auth: OAuthRedirectObject,
320
335
  ): Promise<AuthLoginReturnType> {
321
336
  try {
322
- const { storedToken } = await socialLogin(auth, this.options.client);
337
+ const { storedToken } = await socialLogin(auth, this.client);
323
338
  const account = await this.getAccount();
324
339
  return {
325
340
  user: {
@@ -344,7 +359,7 @@ export class InAppNativeConnector implements InAppConnector {
344
359
  }): Promise<AuthLoginReturnType> {
345
360
  try {
346
361
  const { storedToken } = await siweLogin(
347
- this.options.client,
362
+ this.client,
348
363
  options.wallet,
349
364
  options.chain,
350
365
  );
@@ -376,10 +391,7 @@ export class InAppNativeConnector implements InAppConnector {
376
391
  ecosystem?: Ecosystem;
377
392
  }): Promise<AuthLoginReturnType> {
378
393
  try {
379
- const { storedToken } = await guestLogin(
380
- this.options.client,
381
- options.ecosystem,
382
- );
394
+ const { storedToken } = await guestLogin(this.client, options.ecosystem);
383
395
  const account = await this.getAccount();
384
396
  return {
385
397
  user: {
@@ -402,7 +414,7 @@ export class InAppNativeConnector implements InAppConnector {
402
414
  password: string;
403
415
  }): Promise<AuthLoginReturnType> {
404
416
  try {
405
- const { storedToken } = await customJwt(authOptions, this.options.client);
417
+ const { storedToken } = await customJwt(authOptions, this.client);
406
418
  const account = await this.getAccount();
407
419
  return {
408
420
  user: {
@@ -423,10 +435,7 @@ export class InAppNativeConnector implements InAppConnector {
423
435
  encryptionKey: string;
424
436
  }): Promise<AuthLoginReturnType> {
425
437
  try {
426
- const { storedToken } = await authEndpoint(
427
- authOptions,
428
- this.options.client,
429
- );
438
+ const { storedToken } = await authEndpoint(authOptions, this.client);
430
439
  const account = await this.getAccount();
431
440
  return {
432
441
  user: {
@@ -443,7 +452,24 @@ export class InAppNativeConnector implements InAppConnector {
443
452
  }
444
453
 
445
454
  logout(): Promise<LogoutReturnType> {
446
- return logoutUser(this.options.client.clientId);
455
+ return logoutUser(this.client.clientId);
456
+ }
457
+
458
+ async linkProfile(args: AuthArgsType) {
459
+ const { storedToken } = await this.authenticate(args);
460
+ return await linkAccount({
461
+ client: args.client,
462
+ tokenToLink: storedToken.cookieString,
463
+ storage: this.localStorage,
464
+ });
465
+ }
466
+
467
+ async getProfiles() {
468
+ return getLinkedProfilesInternal({
469
+ client: this.client,
470
+ ecosystem: this.ecosystem,
471
+ storage: this.localStorage,
472
+ });
447
473
  }
448
474
  }
449
475
 
@@ -1,7 +1,7 @@
1
1
  import type { ThirdwebClient } from "../../../../../client/client.js";
2
2
  import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
3
3
  import { getClientFetch } from "../../../../../utils/fetch.js";
4
- import type { Ecosystem } from "../../types.js";
4
+ import type { Ecosystem } from "../../../core/wallet/types.js";
5
5
 
6
6
  /**
7
7
  * Generate a new enclave wallet using an auth token
@@ -1,8 +1,8 @@
1
1
  import type { ThirdwebClient } from "../../../../../client/client.js";
2
2
  import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
3
3
  import { getClientFetch } from "../../../../../utils/fetch.js";
4
+ import type { Ecosystem } from "../../../core/wallet/types.js";
4
5
  import type { UserStatus } from "../../lib/enclave-wallet.js";
5
- import type { Ecosystem } from "../../types.js";
6
6
 
7
7
  /**
8
8
  * Gets the user's status from the backend.
@@ -2,7 +2,7 @@ import type { ThirdwebClient } from "../../../../../client/client.js";
2
2
  import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
3
3
  import { getClientFetch } from "../../../../../utils/fetch.js";
4
4
  import { stringify } from "../../../../../utils/json.js";
5
- import type { Ecosystem } from "../../types.js";
5
+ import type { Ecosystem } from "../../../core/wallet/types.js";
6
6
  import { getAuthToken } from "../get-auth-token.js";
7
7
 
8
8
  export async function signMessage({
@@ -18,7 +18,7 @@ export async function signMessage({
18
18
  };
19
19
  }) {
20
20
  const clientFetch = getClientFetch(client, ecosystem);
21
- const authToken = await getAuthToken(client, ecosystem);
21
+ const authToken = await getAuthToken(client, ecosystem); // TODO (enclave): pass storage from web/native
22
22
 
23
23
  const response = await clientFetch(
24
24
  `${getThirdwebBaseUrl("inAppWallet")}/api/v1/enclave-wallet/sign-message`,
@@ -3,7 +3,7 @@ import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
3
3
  import type { Hex } from "../../../../../utils/encoding/hex.js";
4
4
  import { getClientFetch } from "../../../../../utils/fetch.js";
5
5
  import { stringify } from "../../../../../utils/json.js";
6
- import type { Ecosystem } from "../../types.js";
6
+ import type { Ecosystem } from "../../../core/wallet/types.js";
7
7
  import { getAuthToken } from "../get-auth-token.js";
8
8
 
9
9
  export async function signTransaction({
@@ -17,7 +17,7 @@ export async function signTransaction({
17
17
  }) {
18
18
  console.log("payload", payload);
19
19
  const clientFetch = getClientFetch(client, ecosystem);
20
- const authToken = await getAuthToken(client, ecosystem);
20
+ const authToken = await getAuthToken(client, ecosystem); // TODO (enclave): pass storage from web/native
21
21
 
22
22
  const response = await clientFetch(
23
23
  `${getThirdwebBaseUrl("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,
@@ -4,7 +4,7 @@ import type { ThirdwebClient } from "../../../../../client/client.js";
4
4
  import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
5
5
  import { getClientFetch } from "../../../../../utils/fetch.js";
6
6
  import { stringify } from "../../../../../utils/json.js";
7
- import type { Ecosystem } from "../../types.js";
7
+ import type { Ecosystem } from "../../../core/wallet/types.js";
8
8
  import { getAuthToken } from "../get-auth-token.js";
9
9
 
10
10
  export async function signTypedData<
@@ -20,7 +20,7 @@ export async function signTypedData<
20
20
  payload: TypedDataDefinition<typedData, primaryType>;
21
21
  }) {
22
22
  const clientFetch = getClientFetch(client, ecosystem);
23
- const authToken = await getAuthToken(client, ecosystem);
23
+ const authToken = await getAuthToken(client, ecosystem); // TODO (enclave): pass storage from web/native
24
24
 
25
25
  const response = await clientFetch(
26
26
  `${getThirdwebBaseUrl("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,
@@ -5,7 +5,8 @@ import type {
5
5
  AuthProvider,
6
6
  SendEmailOtpReturnType,
7
7
  } from "../../../core/authentication/types.js";
8
- import type { ClientIdWithQuerierType, Ecosystem } from "../../types.js";
8
+ import type { Ecosystem } from "../../../core/wallet/types.js";
9
+ import type { ClientIdWithQuerierType } from "../../types.js";
9
10
  import type { InAppWalletIframeCommunicator } from "../../utils/iFrameCommunication/InAppWalletIframeCommunicator.js";
10
11
 
11
12
  export type LoginQuerierTypes = {
@@ -1,6 +1,5 @@
1
1
  import type { ThirdwebClient } from "../../../../../client/client.js";
2
- import { webLocalStorage } from "../../../../../utils/storage/webStorage.js";
3
- import { ClientScopedStorage } from "../../../core/authentication/client-scoped-storage.js";
2
+ import type { ClientScopedStorage } from "../../../core/authentication/client-scoped-storage.js";
4
3
  import type {
5
4
  AuthAndWalletRpcReturnType,
6
5
  AuthLoginReturnType,
@@ -8,7 +7,8 @@ import type {
8
7
  LogoutReturnType,
9
8
  SendEmailOtpReturnType,
10
9
  } from "../../../core/authentication/types.js";
11
- import type { ClientIdWithQuerierType, Ecosystem } from "../../types.js";
10
+ import type { Ecosystem } from "../../../core/wallet/types.js";
11
+ import type { ClientIdWithQuerierType } from "../../types.js";
12
12
  import type { InAppWalletIframeCommunicator } from "../../utils/iFrameCommunication/InAppWalletIframeCommunicator.js";
13
13
  import { generateWallet } from "../actions/generate-wallet.enclave.js";
14
14
  import { getUserStatus } from "../actions/get-enclave-user-status.js";
@@ -56,22 +56,20 @@ export class Auth {
56
56
  onAuthSuccess,
57
57
  ecosystem,
58
58
  baseUrl,
59
+ localStorage,
59
60
  }: ClientIdWithQuerierType & {
60
61
  baseUrl: string;
61
62
  ecosystem?: Ecosystem;
62
63
  onAuthSuccess: (
63
64
  authDetails: AuthAndWalletRpcReturnType,
64
65
  ) => Promise<AuthLoginReturnType>;
66
+ localStorage: ClientScopedStorage;
65
67
  }) {
66
68
  this.client = client;
67
69
  this.ecosystem = ecosystem;
68
70
 
69
71
  this.AuthQuerier = querier;
70
- this.localStorage = new ClientScopedStorage({
71
- storage: webLocalStorage,
72
- clientId: client.clientId,
73
- ecosystemId: ecosystem?.id,
74
- });
72
+ this.localStorage = localStorage;
75
73
  this.onAuthSuccess = onAuthSuccess;
76
74
  this.BaseLogin = new BaseLogin({
77
75
  postLogin: async (result) => {
@@ -1,14 +1,14 @@
1
1
  import type { ThirdwebClient } from "../../../../../client/client.js";
2
- import type { OneOf } from "../../../../../utils/type-utils.js";
3
2
  import type { SocialAuthOption } from "../../../../../wallets/types.js";
4
3
  import {
5
4
  type AuthArgsType,
6
5
  type GetAuthenticatedUserParams,
7
6
  type PreAuthArgsType,
7
+ type SocialAuthArgsType,
8
8
  UserWalletStatus,
9
9
  } from "../../../core/authentication/types.js";
10
10
  import { getOrCreateInAppWalletConnector } from "../../../core/wallet/in-app-core.js";
11
- import type { Ecosystem } from "../../types.js";
11
+ import type { Ecosystem } from "../../../core/wallet/types.js";
12
12
 
13
13
  // ---- KEEP IN SYNC WITH /wallets/in-app/native/auth/index.ts ---- //
14
14
  // duplication needed for separate exports between web and native
@@ -142,24 +142,94 @@ export async function preAuthenticate(args: PreAuthArgsType) {
142
142
  * ```
143
143
  * @wallet
144
144
  */
145
- export async function authenticate(
146
- args: OneOf<
147
- | AuthArgsType
148
- | {
149
- strategy: SocialAuthOption;
150
- client: ThirdwebClient;
151
- ecosystem?: Ecosystem;
152
- redirect: boolean;
153
- }
154
- >,
145
+ export async function authenticate(args: AuthArgsType) {
146
+ const connector = await getInAppWalletConnector(args.client, args.ecosystem);
147
+ return connector.authenticate(args);
148
+ }
149
+
150
+ /**
151
+ * Authenticates the user based on the provided authentication arguments using a redirect.
152
+ * @param args - The authentication arguments.
153
+ * @returns A promise that resolves to the authentication result.
154
+ * @example
155
+ * ```ts
156
+ * import { authenticate } from "thirdweb/wallets/in-app";
157
+ *
158
+ * const result = await authenticate({
159
+ * client,
160
+ * strategy: "google",
161
+ * mode: "redirect",
162
+ * redirectUrl: "https://example.org",
163
+ * });
164
+ * ```
165
+ * @wallet
166
+ */
167
+ export async function authenticateWithRedirect(
168
+ args: SocialAuthArgsType & { client: ThirdwebClient; ecosystem?: Ecosystem },
155
169
  ) {
156
170
  const connector = await getInAppWalletConnector(args.client, args.ecosystem);
157
- const isRedirect = args.redirect || args.mode !== "popup";
158
- if (isRedirect && connector.authenticateWithRedirect && args.strategy)
159
- return connector.authenticateWithRedirect(
160
- args.strategy as SocialAuthOption,
161
- args.mode,
162
- args.redirectUrl,
171
+ if (!connector.authenticateWithRedirect) {
172
+ throw new Error(
173
+ "authenticateWithRedirect is not supported on this platform",
163
174
  );
164
- return connector.connect(args);
175
+ }
176
+ return connector.authenticateWithRedirect(
177
+ args.strategy as SocialAuthOption,
178
+ args.mode,
179
+ args.redirectUrl,
180
+ );
181
+ }
182
+
183
+ /**
184
+ * Connects a new profile (authentication method) to the current user.
185
+ * The connected profile can be any valid in-app wallet including email, phone, passkey, etc.
186
+ * The inputs mirror those used when authenticating normally.
187
+ *
188
+ * **When a profile is linked to the account, that profile can then be used to sign into the account.**
189
+ *
190
+ * This method is only available for in-app wallets.
191
+ *
192
+ * @param wallet - The wallet to link an additional profile to.
193
+ * @param auth - The authentications options to add the new profile.
194
+ * @returns A promise that resolves to the currently linked profiles when the connection is successful.
195
+ * @throws If the connection fails, if the profile is already linked to the account, or if the profile is already associated with another account.
196
+ *
197
+ * @example
198
+ * ```ts
199
+ * const wallet = inAppWallet();
200
+ *
201
+ * await wallet.connect({ client, strategy: "google" });
202
+ * const profiles = await linkProfile({ client, strategy: "discord" });
203
+ * ```
204
+ * @wallet
205
+ */
206
+ export async function linkProfile(args: AuthArgsType) {
207
+ const connector = await getInAppWalletConnector(args.client, args.ecosystem);
208
+ return await connector.linkProfile(args);
209
+ }
210
+
211
+ /**
212
+ * Gets the linked profiles for the connected in-app or ecosystem wallet.
213
+ *
214
+ * @returns An array of accounts user profiles linked to the connected wallet.
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * import { inAppWallet } from "thirdweb/wallets";
219
+ *
220
+ * const wallet = inAppWallet();
221
+ * wallet.connect({ strategy: "google" });
222
+ *
223
+ * const profiles = await getProfiles({
224
+ * client,
225
+ * });
226
+ *
227
+ * console.log(profiles[0].type);
228
+ * console.log(profiles[0].details.email);
229
+ * ```
230
+ * @wallet
231
+ */
232
+ export async function getProfiles(args: GetAuthenticatedUserParams) {
233
+ const connector = await getInAppWalletConnector(args.client, args.ecosystem);
234
+ return connector.getProfiles();
165
235
  }
@@ -3,7 +3,7 @@ import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
3
3
  import type { OAuthOption } from "../../../../../wallets/types.js";
4
4
  import { getLoginUrl } from "../../../core/authentication/getLoginPath.js";
5
5
  import type { AuthStoredTokenWithCookieReturnType } from "../../../core/authentication/types.js";
6
- import type { Ecosystem } from "../../types.js";
6
+ import type { Ecosystem } from "../../../core/wallet/types.js";
7
7
  import { DEFAULT_POP_UP_SIZE } from "./constants.js";
8
8
 
9
9
  const closeWindow = ({
@@ -8,7 +8,7 @@ import type {
8
8
  MultiStepAuthArgsType,
9
9
  PreAuthArgsType,
10
10
  } from "../../../core/authentication/types.js";
11
- import type { Ecosystem } from "../../types.js";
11
+ import type { Ecosystem } from "../../../core/wallet/types.js";
12
12
 
13
13
  /**
14
14
  * @internal
@@ -6,20 +6,19 @@ import { getRpcClient } from "../../../../rpc/rpc.js";
6
6
  import { getAddress } from "../../../../utils/address.js";
7
7
  import { type Hex, toHex } from "../../../../utils/encoding/hex.js";
8
8
  import { parseTypedData } from "../../../../utils/signatures/helpers/parseTypedData.js";
9
- import { webLocalStorage } from "../../../../utils/storage/webStorage.js";
10
9
  import type { Prettify } from "../../../../utils/type-utils.js";
11
10
  import type {
12
11
  Account,
13
12
  SendTransactionOption,
14
13
  } from "../../../interfaces/wallet.js";
15
- import { ClientScopedStorage } from "../../core/authentication/client-scoped-storage.js";
14
+ import type { ClientScopedStorage } from "../../core/authentication/client-scoped-storage.js";
16
15
  import {
17
16
  type GetUser,
18
17
  RecoveryShareManagement,
19
18
  UserWalletStatus,
20
19
  type WalletAddressObjectType,
21
20
  } from "../../core/authentication/types.js";
22
- import type { Ecosystem } from "../types.js";
21
+ import type { Ecosystem } from "../../core/wallet/types.js";
23
22
  import { getUserStatus } from "./actions/get-enclave-user-status.js";
24
23
  import { signMessage as signEnclaveMessage } from "./actions/sign-message.enclave.js";
25
24
  import { signTransaction as signEnclaveTransaction } from "./actions/sign-transaction.enclave.js";
@@ -48,29 +47,26 @@ export type UserStatus = {
48
47
  };
49
48
 
50
49
  export class EnclaveWallet implements IWebWallet {
51
- public client: ThirdwebClient;
52
- public ecosystem?: Ecosystem;
53
- public address: string;
54
- protected localStorage: ClientScopedStorage;
50
+ private client: ThirdwebClient;
51
+ private ecosystem?: Ecosystem;
52
+ private address: string;
53
+ private localStorage: ClientScopedStorage;
55
54
 
56
55
  constructor({
57
56
  client,
58
57
  ecosystem,
59
58
  address,
59
+ storage,
60
60
  }: Prettify<{
61
61
  client: ThirdwebClient;
62
62
  ecosystem?: Ecosystem;
63
63
  address: string;
64
+ storage: ClientScopedStorage;
64
65
  }>) {
65
66
  this.client = client;
66
67
  this.ecosystem = ecosystem;
67
68
  this.address = address;
68
-
69
- this.localStorage = new ClientScopedStorage({
70
- storage: webLocalStorage,
71
- clientId: client.clientId,
72
- ecosystemId: ecosystem?.id,
73
- });
69
+ this.localStorage = storage;
74
70
  }
75
71
 
76
72
  /**
@@ -1,8 +1,9 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import { webLocalStorage } from "../../../../utils/storage/webStorage.js";
3
3
  import { ClientScopedStorage } from "../../core/authentication/client-scoped-storage.js";
4
- import type { Ecosystem } from "../types.js";
4
+ import type { Ecosystem } from "../../core/wallet/types.js";
5
5
 
6
+ // TODO: Remove this and properly pass storage from web / native
6
7
  export async function getAuthToken(
7
8
  client: ThirdwebClient,
8
9
  ecosystem?: Ecosystem,