thirdweb 5.34.4-nightly-88fa60d4ad7ee6ce0a8305ce35e023d1a858ea85-20240716000333 → 5.35.0-nightly-aadbd33e9d696bd7dd77561fa3f3a0a0fa7747f5-20240716082511

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 (231) hide show
  1. package/dist/cjs/exports/extensions/airdrop.js +7 -1
  2. package/dist/cjs/exports/extensions/airdrop.js.map +1 -1
  3. package/dist/cjs/exports/thirdweb.js +3 -1
  4. package/dist/cjs/exports/thirdweb.js.map +1 -1
  5. package/dist/cjs/extensions/airdrop/write/claimERC20.js +1 -1
  6. package/dist/cjs/extensions/airdrop/write/claimERC20.js.map +1 -1
  7. package/dist/cjs/react/core/hooks/others/useWalletBalance.js.map +1 -1
  8. package/dist/cjs/react/core/utils/wallet.js +8 -0
  9. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  10. package/dist/cjs/react/native/ui/connect/ConnectButton.js +13 -2
  11. package/dist/cjs/react/native/ui/connect/ConnectButton.js.map +1 -1
  12. package/dist/cjs/react/native/ui/connect/ConnectModal.js +69 -14
  13. package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
  14. package/dist/cjs/react/native/ui/connect/ConnectedModal.js +3 -0
  15. package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
  16. package/dist/cjs/react/native/ui/connect/WalletLoadingThumbnail.js +5 -3
  17. package/dist/cjs/react/native/ui/connect/WalletLoadingThumbnail.js.map +1 -1
  18. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +8 -6
  19. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  20. package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js +11 -0
  21. package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
  22. package/dist/cjs/react/web/ui/ConnectWallet/locale/es.js +11 -0
  23. package/dist/cjs/react/web/ui/ConnectWallet/locale/es.js.map +1 -1
  24. package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
  25. package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
  26. package/dist/cjs/react/web/ui/ConnectWallet/locale/ja.js +11 -0
  27. package/dist/cjs/react/web/ui/ConnectWallet/locale/ja.js.map +1 -1
  28. package/dist/cjs/react/web/ui/ConnectWallet/locale/tl.js +11 -0
  29. package/dist/cjs/react/web/ui/ConnectWallet/locale/tl.js.map +1 -1
  30. package/dist/cjs/react/web/ui/ConnectWallet/locale/vi.js +112 -0
  31. package/dist/cjs/react/web/ui/ConnectWallet/locale/vi.js.map +1 -0
  32. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
  34. package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +3 -3
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewFunds.js +4 -3
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewFunds.js.map +1 -1
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js +2 -1
  39. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
  40. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js +2 -1
  41. package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
  42. package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
  43. package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
  44. package/dist/cjs/react/web/wallets/injected/locale/vi.js +27 -0
  45. package/dist/cjs/react/web/wallets/injected/locale/vi.js.map +1 -0
  46. package/dist/cjs/react/web/wallets/local/locale/getLocalWalletLocale.js +2 -0
  47. package/dist/cjs/react/web/wallets/local/locale/getLocalWalletLocale.js.map +1 -1
  48. package/dist/cjs/react/web/wallets/local/locale/vi.js +44 -0
  49. package/dist/cjs/react/web/wallets/local/locale/vi.js.map +1 -0
  50. package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
  51. package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
  52. package/dist/cjs/react/web/wallets/shared/locale/vi.js +54 -0
  53. package/dist/cjs/react/web/wallets/shared/locale/vi.js.map +1 -0
  54. package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
  55. package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
  56. package/dist/cjs/react/web/wallets/smartWallet/locale/vi.js +13 -0
  57. package/dist/cjs/react/web/wallets/smartWallet/locale/vi.js.map +1 -0
  58. package/dist/cjs/react/web/wallets/walletConnect/locale.js +4 -0
  59. package/dist/cjs/react/web/wallets/walletConnect/locale.js.map +1 -1
  60. package/dist/cjs/transaction/extract-error.js +12 -13
  61. package/dist/cjs/transaction/extract-error.js.map +1 -1
  62. package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc1155.js +34 -0
  63. package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc1155.js.map +1 -1
  64. package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc20.js +36 -2
  65. package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc20.js.map +1 -1
  66. package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc721.js +34 -0
  67. package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc721.js.map +1 -1
  68. package/dist/cjs/version.js +1 -1
  69. package/dist/cjs/wallets/in-app/web/lib/in-app-account.js +12 -8
  70. package/dist/cjs/wallets/in-app/web/lib/in-app-account.js.map +1 -1
  71. package/dist/esm/exports/extensions/airdrop.js +3 -0
  72. package/dist/esm/exports/extensions/airdrop.js.map +1 -1
  73. package/dist/esm/exports/thirdweb.js +1 -0
  74. package/dist/esm/exports/thirdweb.js.map +1 -1
  75. package/dist/esm/extensions/airdrop/write/claimERC20.js +2 -2
  76. package/dist/esm/extensions/airdrop/write/claimERC20.js.map +1 -1
  77. package/dist/esm/react/core/hooks/others/useWalletBalance.js.map +1 -1
  78. package/dist/esm/react/core/utils/wallet.js +8 -0
  79. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  80. package/dist/esm/react/native/ui/connect/ConnectButton.js +13 -2
  81. package/dist/esm/react/native/ui/connect/ConnectButton.js.map +1 -1
  82. package/dist/esm/react/native/ui/connect/ConnectModal.js +70 -15
  83. package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
  84. package/dist/esm/react/native/ui/connect/ConnectedModal.js +3 -0
  85. package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
  86. package/dist/esm/react/native/ui/connect/WalletLoadingThumbnail.js +5 -3
  87. package/dist/esm/react/native/ui/connect/WalletLoadingThumbnail.js.map +1 -1
  88. package/dist/esm/react/web/ui/ConnectWallet/Details.js +8 -6
  89. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  90. package/dist/esm/react/web/ui/ConnectWallet/locale/en.js +11 -0
  91. package/dist/esm/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
  92. package/dist/esm/react/web/ui/ConnectWallet/locale/es.js +11 -0
  93. package/dist/esm/react/web/ui/ConnectWallet/locale/es.js.map +1 -1
  94. package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
  95. package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
  96. package/dist/esm/react/web/ui/ConnectWallet/locale/ja.js +11 -0
  97. package/dist/esm/react/web/ui/ConnectWallet/locale/ja.js.map +1 -1
  98. package/dist/esm/react/web/ui/ConnectWallet/locale/tl.js +11 -0
  99. package/dist/esm/react/web/ui/ConnectWallet/locale/tl.js.map +1 -1
  100. package/dist/esm/react/web/ui/ConnectWallet/locale/vi.js +110 -0
  101. package/dist/esm/react/web/ui/ConnectWallet/locale/vi.js.map +1 -0
  102. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +1 -1
  103. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
  104. package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +3 -3
  105. package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
  106. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewFunds.js +4 -3
  107. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewFunds.js.map +1 -1
  108. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js +2 -1
  109. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
  110. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js +2 -1
  111. package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
  112. package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
  113. package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
  114. package/dist/esm/react/web/wallets/injected/locale/vi.js +25 -0
  115. package/dist/esm/react/web/wallets/injected/locale/vi.js.map +1 -0
  116. package/dist/esm/react/web/wallets/local/locale/getLocalWalletLocale.js +2 -0
  117. package/dist/esm/react/web/wallets/local/locale/getLocalWalletLocale.js.map +1 -1
  118. package/dist/esm/react/web/wallets/local/locale/vi.js +42 -0
  119. package/dist/esm/react/web/wallets/local/locale/vi.js.map +1 -0
  120. package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
  121. package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
  122. package/dist/esm/react/web/wallets/shared/locale/vi.js +52 -0
  123. package/dist/esm/react/web/wallets/shared/locale/vi.js.map +1 -0
  124. package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
  125. package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
  126. package/dist/esm/react/web/wallets/smartWallet/locale/vi.js +11 -0
  127. package/dist/esm/react/web/wallets/smartWallet/locale/vi.js.map +1 -0
  128. package/dist/esm/react/web/wallets/walletConnect/locale.js +4 -0
  129. package/dist/esm/react/web/wallets/walletConnect/locale.js.map +1 -1
  130. package/dist/esm/transaction/extract-error.js +12 -13
  131. package/dist/esm/transaction/extract-error.js.map +1 -1
  132. package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc1155.js +34 -0
  133. package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc1155.js.map +1 -1
  134. package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc20.js +35 -1
  135. package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc20.js.map +1 -1
  136. package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc721.js +34 -0
  137. package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc721.js.map +1 -1
  138. package/dist/esm/version.js +1 -1
  139. package/dist/esm/wallets/in-app/web/lib/in-app-account.js +12 -8
  140. package/dist/esm/wallets/in-app/web/lib/in-app-account.js.map +1 -1
  141. package/dist/types/exports/extensions/airdrop.d.ts +3 -0
  142. package/dist/types/exports/extensions/airdrop.d.ts.map +1 -1
  143. package/dist/types/exports/thirdweb.d.ts +1 -0
  144. package/dist/types/exports/thirdweb.d.ts.map +1 -1
  145. package/dist/types/react/core/hooks/others/useWalletBalance.d.ts +7 -1
  146. package/dist/types/react/core/hooks/others/useWalletBalance.d.ts.map +1 -1
  147. package/dist/types/react/core/utils/wallet.d.ts +2 -2
  148. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  149. package/dist/types/react/native/ui/connect/ConnectButton.d.ts.map +1 -1
  150. package/dist/types/react/native/ui/connect/ConnectModal.d.ts +4 -0
  151. package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
  152. package/dist/types/react/native/ui/connect/ConnectedModal.d.ts.map +1 -1
  153. package/dist/types/react/native/ui/connect/WalletLoadingThumbnail.d.ts +2 -1
  154. package/dist/types/react/native/ui/connect/WalletLoadingThumbnail.d.ts.map +1 -1
  155. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  156. package/dist/types/react/web/ui/ConnectWallet/locale/en.d.ts.map +1 -1
  157. package/dist/types/react/web/ui/ConnectWallet/locale/es.d.ts.map +1 -1
  158. package/dist/types/react/web/ui/ConnectWallet/locale/getConnectLocale.d.ts.map +1 -1
  159. package/dist/types/react/web/ui/ConnectWallet/locale/ja.d.ts.map +1 -1
  160. package/dist/types/react/web/ui/ConnectWallet/locale/tl.d.ts.map +1 -1
  161. package/dist/types/react/web/ui/ConnectWallet/locale/types.d.ts +11 -0
  162. package/dist/types/react/web/ui/ConnectWallet/locale/types.d.ts.map +1 -1
  163. package/dist/types/react/web/ui/ConnectWallet/locale/vi.d.ts +4 -0
  164. package/dist/types/react/web/ui/ConnectWallet/locale/vi.d.ts.map +1 -0
  165. package/dist/types/react/web/ui/ConnectWallet/screens/ManageWalletScreen.d.ts.map +1 -1
  166. package/dist/types/react/web/ui/ConnectWallet/screens/ViewFunds.d.ts +2 -0
  167. package/dist/types/react/web/ui/ConnectWallet/screens/ViewFunds.d.ts.map +1 -1
  168. package/dist/types/react/web/ui/ConnectWallet/screens/ViewNFTs.d.ts +2 -0
  169. package/dist/types/react/web/ui/ConnectWallet/screens/ViewNFTs.d.ts.map +1 -1
  170. package/dist/types/react/web/ui/ConnectWallet/screens/ViewTokens.d.ts +2 -0
  171. package/dist/types/react/web/ui/ConnectWallet/screens/ViewTokens.d.ts.map +1 -1
  172. package/dist/types/react/web/ui/types.d.ts +1 -1
  173. package/dist/types/react/web/ui/types.d.ts.map +1 -1
  174. package/dist/types/react/web/wallets/injected/locale/getInjectedWalletLocale.d.ts.map +1 -1
  175. package/dist/types/react/web/wallets/injected/locale/vi.d.ts +7 -0
  176. package/dist/types/react/web/wallets/injected/locale/vi.d.ts.map +1 -0
  177. package/dist/types/react/web/wallets/local/locale/getLocalWalletLocale.d.ts.map +1 -1
  178. package/dist/types/react/web/wallets/local/locale/vi.d.ts +4 -0
  179. package/dist/types/react/web/wallets/local/locale/vi.d.ts.map +1 -0
  180. package/dist/types/react/web/wallets/shared/locale/getConnectLocale.d.ts.map +1 -1
  181. package/dist/types/react/web/wallets/shared/locale/vi.d.ts +53 -0
  182. package/dist/types/react/web/wallets/shared/locale/vi.d.ts.map +1 -0
  183. package/dist/types/react/web/wallets/smartWallet/locale/getSmartWalletLocale.d.ts.map +1 -1
  184. package/dist/types/react/web/wallets/smartWallet/locale/vi.d.ts +4 -0
  185. package/dist/types/react/web/wallets/smartWallet/locale/vi.d.ts.map +1 -0
  186. package/dist/types/react/web/wallets/walletConnect/locale.d.ts.map +1 -1
  187. package/dist/types/utils/extensions/airdrop/fetch-proofs-erc1155.d.ts.map +1 -1
  188. package/dist/types/utils/extensions/airdrop/fetch-proofs-erc20.d.ts +1 -1
  189. package/dist/types/utils/extensions/airdrop/fetch-proofs-erc20.d.ts.map +1 -1
  190. package/dist/types/utils/extensions/airdrop/fetch-proofs-erc721.d.ts.map +1 -1
  191. package/dist/types/version.d.ts +1 -1
  192. package/dist/types/wallets/in-app/web/lib/in-app-account.d.ts.map +1 -1
  193. package/package.json +1 -1
  194. package/src/exports/extensions/airdrop.ts +3 -0
  195. package/src/exports/thirdweb.ts +5 -0
  196. package/src/extensions/airdrop/write/claimERC20.ts +2 -2
  197. package/src/react/core/hooks/others/useWalletBalance.ts +9 -1
  198. package/src/react/core/utils/wallet.ts +10 -2
  199. package/src/react/native/ui/connect/ConnectButton.tsx +16 -4
  200. package/src/react/native/ui/connect/ConnectModal.tsx +181 -19
  201. package/src/react/native/ui/connect/ConnectedModal.tsx +3 -0
  202. package/src/react/native/ui/connect/WalletLoadingThumbnail.tsx +18 -13
  203. package/src/react/web/ui/ConnectWallet/Details.tsx +8 -2
  204. package/src/react/web/ui/ConnectWallet/locale/en.ts +11 -0
  205. package/src/react/web/ui/ConnectWallet/locale/es.ts +11 -0
  206. package/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts +3 -0
  207. package/src/react/web/ui/ConnectWallet/locale/ja.ts +11 -0
  208. package/src/react/web/ui/ConnectWallet/locale/tl.ts +11 -0
  209. package/src/react/web/ui/ConnectWallet/locale/types.ts +11 -0
  210. package/src/react/web/ui/ConnectWallet/locale/vi.ts +114 -0
  211. package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.tsx +1 -1
  212. package/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.tsx +10 -3
  213. package/src/react/web/ui/ConnectWallet/screens/ViewFunds.tsx +9 -3
  214. package/src/react/web/ui/ConnectWallet/screens/ViewNFTs.tsx +8 -1
  215. package/src/react/web/ui/ConnectWallet/screens/ViewTokens.tsx +7 -1
  216. package/src/react/web/ui/types.ts +1 -1
  217. package/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts +2 -0
  218. package/src/react/web/wallets/injected/locale/vi.ts +27 -0
  219. package/src/react/web/wallets/local/locale/getLocalWalletLocale.ts +2 -0
  220. package/src/react/web/wallets/local/locale/vi.ts +48 -0
  221. package/src/react/web/wallets/shared/locale/getConnectLocale.ts +2 -0
  222. package/src/react/web/wallets/shared/locale/vi.ts +56 -0
  223. package/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts +2 -0
  224. package/src/react/web/wallets/smartWallet/locale/vi.ts +13 -0
  225. package/src/react/web/wallets/walletConnect/locale.ts +4 -0
  226. package/src/transaction/extract-error.ts +9 -9
  227. package/src/utils/extensions/airdrop/fetch-proofs-erc1155.ts +34 -0
  228. package/src/utils/extensions/airdrop/fetch-proofs-erc20.ts +35 -1
  229. package/src/utils/extensions/airdrop/fetch-proofs-erc721.ts +34 -0
  230. package/src/version.ts +1 -1
  231. package/src/wallets/in-app/web/lib/in-app-account.ts +12 -8
@@ -6,11 +6,13 @@ import type { InAppWalletAuth } from "../../../../wallets/in-app/core/wallet/typ
6
6
  import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
7
7
  import { parseTheme } from "../../../core/design-system/CustomThemeProvider.js";
8
8
  import type { Theme } from "../../../core/design-system/index.js";
9
+ import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
9
10
  import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
10
11
  import type { ConnectEmbedProps } from "../../../core/hooks/connection/ConnectEmbedProps.js";
11
12
  import { useWalletInfo } from "../../../core/utils/wallet.js";
12
13
  import { radius, spacing } from "../../design-system/index.js";
13
14
  import { useActiveWallet } from "../../hooks/wallets/useActiveWallet.js";
15
+ import { useDisconnect } from "../../hooks/wallets/useDisconnect.js";
14
16
  import { connectionManager } from "../../index.js";
15
17
  import { getDefaultWallets } from "../../wallets/defaultWallets.js";
16
18
  import { type ContainerType, Header } from "../components/Header.js";
@@ -19,7 +21,7 @@ import {
19
21
  WalletImage,
20
22
  getAuthProviderImage,
21
23
  } from "../components/WalletImage.js";
22
- import { ThemedButtonWithIcon } from "../components/button.js";
24
+ import { ThemedButton, ThemedButtonWithIcon } from "../components/button.js";
23
25
  import { Spacer } from "../components/spacer.js";
24
26
  import { ThemedText } from "../components/text.js";
25
27
  import { ThemedView } from "../components/view.js";
@@ -34,7 +36,8 @@ export type ModalState =
34
36
  | { screen: "connecting"; wallet: Wallet; authMethod?: InAppWalletAuth }
35
37
  | { screen: "error"; error: string }
36
38
  | { screen: "otp"; auth: MultiStepAuthProviderType; wallet: Wallet<"inApp"> }
37
- | { screen: "external_wallets" };
39
+ | { screen: "external_wallets" }
40
+ | { screen: "auth" };
38
41
 
39
42
  /**
40
43
  * A component that allows the user to connect their wallet.
@@ -57,12 +60,20 @@ export type ModalState =
57
60
  export function ConnectEmbed(props: ConnectEmbedProps) {
58
61
  const theme = parseTheme(props.theme);
59
62
  const wallet = useActiveWallet();
63
+ const siweAuth = useSiweAuth(wallet, props.auth);
64
+ const needsAuth = siweAuth.requiresAuth && !siweAuth.isLoggedIn;
65
+ const isConnected = wallet && !needsAuth;
60
66
  const adaptedProps = {
61
67
  ...props,
62
68
  connectModal: { ...props },
63
69
  } as ConnectButtonProps;
64
- return wallet ? null : (
65
- <ConnectModal {...adaptedProps} theme={theme} containerType="embed" />
70
+ return isConnected ? null : (
71
+ <ConnectModal
72
+ {...adaptedProps}
73
+ theme={theme}
74
+ containerType="embed"
75
+ siweAuth={siweAuth}
76
+ />
66
77
  );
67
78
  }
68
79
 
@@ -71,6 +82,7 @@ export function ConnectModal(
71
82
  theme: Theme;
72
83
  onClose?: () => void;
73
84
  containerType: ContainerType;
85
+ siweAuth: ReturnType<typeof useSiweAuth>;
74
86
  },
75
87
  ) {
76
88
  const {
@@ -80,8 +92,20 @@ export function ConnectModal(
80
92
  accountAbstraction,
81
93
  onConnect,
82
94
  onClose,
95
+ siweAuth,
83
96
  } = props;
84
- const [modalState, setModalState] = useState<ModalState>({ screen: "base" });
97
+ const wallet = useActiveWallet();
98
+ const needsAuth = wallet && siweAuth.requiresAuth && !siweAuth.isLoggedIn;
99
+ const [modalState, setModalState] = useState<ModalState>(
100
+ needsAuth ? { screen: "auth" } : { screen: "base" },
101
+ );
102
+ const wallets = props.wallets || getDefaultWallets(props);
103
+ const inAppWallet = wallets.find((wallet) => wallet.id === "inApp") as
104
+ | Wallet<"inApp">
105
+ | undefined;
106
+ const externalWallets = wallets.filter((wallet) => wallet.id !== "inApp");
107
+ const showBranding = props.connectModal?.showThirdwebBranding !== false;
108
+
85
109
  const connector = useCallback(
86
110
  async (args: {
87
111
  wallet: Wallet;
@@ -100,22 +124,30 @@ export function ConnectModal(
100
124
  accountAbstraction,
101
125
  onConnect,
102
126
  });
103
- onClose?.();
127
+ if (siweAuth.requiresAuth && !siweAuth.isLoggedIn) {
128
+ // if in-app wallet, signin headlessly
129
+ // TODO (rn) handle signless smart wallets as well
130
+ if (w.id === "inApp") {
131
+ await siweAuth.doLogin();
132
+ onClose?.();
133
+ } else {
134
+ setModalState({
135
+ screen: "auth",
136
+ });
137
+ }
138
+ } else {
139
+ onClose?.();
140
+ }
104
141
  } catch (error) {
105
142
  setModalState({
106
143
  screen: "error",
107
- error: (error as Error)?.message || "unknown error",
144
+ error: (error as Error)?.message || "Unknown error",
108
145
  });
109
146
  }
110
147
  },
111
- [client, accountAbstraction, onConnect, onClose],
148
+ [client, accountAbstraction, onConnect, onClose, siweAuth],
112
149
  );
113
- const wallets = props.wallets || getDefaultWallets(props);
114
- const inAppWallet = wallets.find((wallet) => wallet.id === "inApp") as
115
- | Wallet<"inApp">
116
- | undefined;
117
- const externalWallets = wallets.filter((wallet) => wallet.id !== "inApp");
118
- const showBranding = props.connectModal?.showThirdwebBranding !== false;
150
+
119
151
  let content: JSX.Element;
120
152
 
121
153
  switch (modalState.screen) {
@@ -192,7 +224,7 @@ export function ConnectModal(
192
224
  ) : (
193
225
  <Spacer size="lg" />
194
226
  )}
195
- <LoadingView
227
+ <WalletLoadingView
196
228
  theme={theme}
197
229
  wallet={modalState.wallet}
198
230
  authProvider={modalState.authMethod}
@@ -206,6 +238,37 @@ export function ConnectModal(
206
238
  );
207
239
  break;
208
240
  }
241
+ case "auth": {
242
+ content = (
243
+ <>
244
+ <Header
245
+ theme={theme}
246
+ onClose={props.onClose}
247
+ containerType={containerType}
248
+ onBack={props.onClose}
249
+ title={props.connectModal?.title || "Sign in"}
250
+ />
251
+ {containerType === "modal" ? (
252
+ <View style={{ flex: 1 }} />
253
+ ) : (
254
+ <Spacer size="lg" />
255
+ )}
256
+ <SignInView
257
+ theme={theme}
258
+ siweAuth={siweAuth}
259
+ onSignIn={() => props.onClose?.()}
260
+ onError={(error) => setModalState({ screen: "error", error })}
261
+ onDisconnect={() => setModalState({ screen: "base" })}
262
+ />
263
+ {containerType === "modal" ? (
264
+ <View style={{ flex: 1 }} />
265
+ ) : (
266
+ <Spacer size="md" />
267
+ )}
268
+ </>
269
+ );
270
+ break;
271
+ }
209
272
  case "error": {
210
273
  content = (
211
274
  <>
@@ -319,11 +382,15 @@ export function ConnectModal(
319
382
  );
320
383
  }
321
384
 
322
- function LoadingView({
385
+ function WalletLoadingView({
323
386
  theme,
324
387
  wallet,
325
388
  authProvider,
326
- }: { theme: Theme; wallet: Wallet; authProvider?: InAppWalletAuth }) {
389
+ }: {
390
+ theme: Theme;
391
+ wallet: Wallet;
392
+ authProvider?: InAppWalletAuth;
393
+ }) {
327
394
  const walletInfo = useWalletInfo(wallet.id);
328
395
  return (
329
396
  <View
@@ -335,7 +402,7 @@ function LoadingView({
335
402
  paddingVertical: spacing.xl,
336
403
  }}
337
404
  >
338
- <WalletLoadingThumbnail theme={theme} imageSize={100}>
405
+ <WalletLoadingThumbnail theme={theme} imageSize={100} animate={true}>
339
406
  {authProvider ? (
340
407
  <View
341
408
  style={{
@@ -363,13 +430,108 @@ function LoadingView({
363
430
  <Spacer size="sm" />
364
431
  <ThemedText theme={theme} type="subtext">
365
432
  {authProvider
366
- ? `Sign into your ${capitalizeFirstLetter(authProvider)} account`
433
+ ? `Signing into your ${capitalizeFirstLetter(authProvider)} account`
367
434
  : `Accept the connection request in ${walletInfo.data?.name}`}
368
435
  </ThemedText>
369
436
  </View>
370
437
  );
371
438
  }
372
439
 
440
+ function SignInView({
441
+ theme,
442
+ siweAuth,
443
+ onSignIn,
444
+ onError,
445
+ onDisconnect,
446
+ }: {
447
+ theme: Theme;
448
+ siweAuth: ReturnType<typeof useSiweAuth>;
449
+ onSignIn: () => void;
450
+ onError: (error: string) => void;
451
+ onDisconnect: () => void;
452
+ }) {
453
+ const wallet = useActiveWallet();
454
+ const walletInfo = useWalletInfo(wallet?.id);
455
+ const { disconnect } = useDisconnect();
456
+ const isSigningIn = siweAuth.isLoggingIn || siweAuth.isLoading;
457
+ return (
458
+ wallet && (
459
+ <View
460
+ style={{
461
+ flexDirection: "column",
462
+ flex: 1,
463
+ alignItems: "center",
464
+ justifyContent: "center",
465
+ padding: spacing.xl,
466
+ }}
467
+ >
468
+ <WalletLoadingThumbnail
469
+ theme={theme}
470
+ imageSize={100}
471
+ animate={isSigningIn}
472
+ >
473
+ <WalletImage theme={theme} size={90} wallet={wallet} />
474
+ </WalletLoadingThumbnail>
475
+ <Spacer size="xl" />
476
+ <ThemedText theme={theme} type="subtitle">
477
+ {"Complete sign in"}
478
+ </ThemedText>
479
+ <Spacer size="xs" />
480
+ <ThemedText theme={theme} type="subtext">
481
+ Sign login request in {walletInfo.data?.name} to continue
482
+ </ThemedText>
483
+ <Spacer size="xl" />
484
+ <ThemedButton
485
+ theme={theme}
486
+ variant="accent"
487
+ disabled={isSigningIn}
488
+ style={{ width: "100%" }}
489
+ onPress={async () => {
490
+ try {
491
+ await siweAuth.doLogin();
492
+ onSignIn();
493
+ } catch (e) {
494
+ onError((e as Error)?.message || "Unknown error");
495
+ }
496
+ }}
497
+ >
498
+ <ThemedText
499
+ theme={theme}
500
+ type="defaultSemiBold"
501
+ style={{
502
+ color: theme.colors.accentButtonText,
503
+ }}
504
+ >
505
+ Sign Login Request
506
+ </ThemedText>
507
+ </ThemedButton>
508
+ <Spacer size="md" />
509
+ <ThemedButton
510
+ theme={theme}
511
+ variant="secondary"
512
+ disabled={isSigningIn}
513
+ style={{ width: "100%" }}
514
+ onPress={async () => {
515
+ disconnect(wallet);
516
+ siweAuth.doLogout();
517
+ onDisconnect();
518
+ }}
519
+ >
520
+ <ThemedText
521
+ theme={theme}
522
+ type="defaultSemiBold"
523
+ style={{
524
+ color: theme.colors.accentButtonText,
525
+ }}
526
+ >
527
+ Disconnect
528
+ </ThemedText>
529
+ </ThemedButton>
530
+ </View>
531
+ )
532
+ );
533
+ }
534
+
373
535
  function OrDivider({ theme }: { theme: Theme }) {
374
536
  return (
375
537
  <View
@@ -5,6 +5,7 @@ import { getContract } from "../../../../contract/contract.js";
5
5
  import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deployed.js";
6
6
  import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
7
7
  import type { Theme } from "../../../core/design-system/index.js";
8
+ import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
8
9
  import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
9
10
  import { useChainName } from "../../../core/hooks/others/useChainQuery.js";
10
11
  import { hasSmartAccount } from "../../../core/utils/isSmartWallet.js";
@@ -290,12 +291,14 @@ const ViewFunds = (props: ConnectedModalPropsInner) => {
290
291
  const DisconnectWallet = (props: ConnectedModalProps) => {
291
292
  const { wallet, theme, onClose } = props;
292
293
  const { disconnect } = useDisconnect();
294
+ const siweAuth = useSiweAuth(wallet, props.auth);
293
295
  return (
294
296
  <TouchableOpacity
295
297
  style={styles.walletMenuRow}
296
298
  onPress={() => {
297
299
  onClose?.();
298
300
  disconnect(wallet);
301
+ siweAuth.doLogout();
299
302
  }}
300
303
  >
301
304
  <RNImage
@@ -14,6 +14,7 @@ interface Props {
14
14
  children?: React.ReactNode;
15
15
  imageSize: number;
16
16
  showError?: boolean;
17
+ animate: boolean;
17
18
  }
18
19
 
19
20
  function WalletLoadingThumbnail({
@@ -21,10 +22,12 @@ function WalletLoadingThumbnail({
21
22
  children,
22
23
  showError,
23
24
  imageSize,
25
+ animate,
24
26
  }: Props) {
25
27
  const spinValue = useRef(new Animated.Value(0));
26
28
 
27
29
  useEffect(() => {
30
+ if (!animate) return;
28
31
  const animation = Animated.timing(spinValue.current, {
29
32
  toValue: 1,
30
33
  duration: 1150,
@@ -38,7 +41,7 @@ function WalletLoadingThumbnail({
38
41
  return () => {
39
42
  loop.stop();
40
43
  };
41
- }, []);
44
+ }, [animate]);
42
45
 
43
46
  const spin = spinValue.current.interpolate({
44
47
  inputRange: [0, 1],
@@ -53,18 +56,20 @@ function WalletLoadingThumbnail({
53
56
  viewBox={`0 0 ${imageSize + PADDING} ${imageSize + PADDING}`}
54
57
  style={styles.loader}
55
58
  >
56
- <AnimatedRect
57
- x="2"
58
- y="2"
59
- width={imageSize + INTERNAL_PADDING}
60
- height={imageSize + INTERNAL_PADDING}
61
- rx={15}
62
- stroke={showError ? "transparent" : theme.colors.accentButtonBg}
63
- strokeWidth={3}
64
- fill="transparent"
65
- strokeDasharray={"100 300"}
66
- strokeDashoffset={spin}
67
- />
59
+ {animate && (
60
+ <AnimatedRect
61
+ x="2"
62
+ y="2"
63
+ width={imageSize + INTERNAL_PADDING}
64
+ height={imageSize + INTERNAL_PADDING}
65
+ rx={15}
66
+ stroke={showError ? "transparent" : theme.colors.accentButtonBg}
67
+ strokeWidth={3}
68
+ fill="transparent"
69
+ strokeDasharray={"100 300"}
70
+ strokeDashoffset={spin}
71
+ />
72
+ )}
68
73
  </Svg>
69
74
  {showError && (
70
75
  <View
@@ -536,7 +536,9 @@ function DetailsModal(props: {
536
536
  >
537
537
  <CoinsIcon size={iconSize.md} />
538
538
  <Text color="primaryText">
539
- {props.supportedNFTs ? "View Assets" : "View Funds"}
539
+ {props.supportedNFTs
540
+ ? locale.viewFunds.viewAssets
541
+ : locale.viewFunds.title}
540
542
  </Text>
541
543
  </MenuButton>
542
544
 
@@ -550,7 +552,7 @@ function DetailsModal(props: {
550
552
  }}
551
553
  >
552
554
  <OutlineWalletIcon size={iconSize.md} />
553
- <Text color="primaryText">Manage Wallet</Text>
555
+ <Text color="primaryText">{props.locale.manageWallet.title}</Text>
554
556
  </MenuButton>
555
557
 
556
558
  {/* Switch to Personal Wallet */}
@@ -702,6 +704,7 @@ function DetailsModal(props: {
702
704
  }}
703
705
  setScreen={setScreen}
704
706
  client={client}
707
+ connectLocale={locale}
705
708
  />
706
709
  );
707
710
  } else {
@@ -713,6 +716,7 @@ function DetailsModal(props: {
713
716
  setScreen("main");
714
717
  }}
715
718
  client={client}
719
+ connectLocale={locale}
716
720
  />
717
721
  );
718
722
  }
@@ -725,6 +729,7 @@ function DetailsModal(props: {
725
729
  setScreen("main");
726
730
  }}
727
731
  client={client}
732
+ connectLocale={locale}
728
733
  />
729
734
  );
730
735
  } else if (screen === "view-tokens") {
@@ -735,6 +740,7 @@ function DetailsModal(props: {
735
740
  setScreen("main");
736
741
  }}
737
742
  client={client}
743
+ connectLocale={locale}
738
744
  />
739
745
  );
740
746
  } else if (screen === "private-key") {
@@ -98,6 +98,17 @@ const connectLocaleEn: ConnectLocale = {
98
98
  inProgress: "Awaiting Confirmation",
99
99
  },
100
100
  },
101
+ manageWallet: {
102
+ title: "Manage Wallet",
103
+ connectAnApp: "Connect an App",
104
+ exportPrivateKey: "Export Private Key",
105
+ },
106
+ viewFunds: {
107
+ title: "View Funds",
108
+ viewNFTs: "View NFTs",
109
+ viewTokens: "View Tokens",
110
+ viewAssets: "View Assets",
111
+ },
101
112
  };
102
113
 
103
114
  export default connectLocaleEn;
@@ -100,6 +100,17 @@ const connectWalletLocalEs: ConnectLocale = {
100
100
  inProgress: "Esperando confirmación",
101
101
  },
102
102
  },
103
+ manageWallet: {
104
+ title: "Manage Wallet",
105
+ connectAnApp: "Connect an App",
106
+ exportPrivateKey: "Export Private Key",
107
+ },
108
+ viewFunds: {
109
+ title: "View Funds",
110
+ viewNFTs: "View NFTs",
111
+ viewTokens: "View Tokens",
112
+ viewAssets: "View Assets",
113
+ },
103
114
  };
104
115
 
105
116
  export default connectWalletLocalEs;
@@ -12,6 +12,9 @@ export async function getConnectLocale(localeId: LocaleId) {
12
12
  case "tl_PH": {
13
13
  return (await import("./tl.js")).default;
14
14
  }
15
+ case "vi_VN": {
16
+ return (await import("./vi.js")).default;
17
+ }
15
18
  default: {
16
19
  return (await import("./en.js")).default;
17
20
  }
@@ -100,6 +100,17 @@ const connectWalletLocalJa: ConnectLocale = {
100
100
  inProgress: "確認待ち",
101
101
  },
102
102
  },
103
+ manageWallet: {
104
+ title: "Manage Wallet",
105
+ connectAnApp: "Connect an App",
106
+ exportPrivateKey: "Export Private Key",
107
+ },
108
+ viewFunds: {
109
+ title: "View Funds",
110
+ viewNFTs: "View NFTs",
111
+ viewTokens: "View Tokens",
112
+ viewAssets: "View Assets",
113
+ },
103
114
  };
104
115
 
105
116
  export default connectWalletLocalJa;
@@ -100,6 +100,17 @@ const connectWalletLocalTl: ConnectLocale = {
100
100
  inProgress: "Naghihintay ng Kumpirmasyon",
101
101
  },
102
102
  },
103
+ manageWallet: {
104
+ title: "Manage Wallet",
105
+ connectAnApp: "Connect an App",
106
+ exportPrivateKey: "Export Private Key",
107
+ },
108
+ viewFunds: {
109
+ title: "View Funds",
110
+ viewNFTs: "View NFTs",
111
+ viewTokens: "View Tokens",
112
+ viewAssets: "View Assets",
113
+ },
103
114
  };
104
115
 
105
116
  export default connectWalletLocalTl;
@@ -90,4 +90,15 @@ export type ConnectLocale = {
90
90
  transactions: string;
91
91
  viewAllTransactions: string;
92
92
  welcomeScreen: { defaultSubtitle: string; defaultTitle: string };
93
+ manageWallet: {
94
+ title: string;
95
+ connectAnApp: string;
96
+ exportPrivateKey: string;
97
+ };
98
+ viewFunds: {
99
+ title: string;
100
+ viewTokens: string;
101
+ viewNFTs: string;
102
+ viewAssets: string;
103
+ };
93
104
  };
@@ -0,0 +1,114 @@
1
+ import type { ConnectLocale } from "./types.js";
2
+
3
+ const connectLocaleVi: ConnectLocale = {
4
+ id: "vi_VN",
5
+ signIn: "Đăng nhập",
6
+ defaultButtonTitle: "Kết nối ví",
7
+ connecting: "Đang kết nối",
8
+ switchNetwork: "Chuyển mạng",
9
+ switchingNetwork: "Đang chuyển mạng",
10
+ defaultModalTitle: "Đăng nhập",
11
+ recommended: "Khuyên dùng",
12
+ installed: "Đã cài đặt",
13
+ buy: "Mua",
14
+ continueAsGuest: "Continue as guest",
15
+ connectAWallet: "Kết nối ví",
16
+ newToWallets: "Tìm hiểu về ví điện tử",
17
+ getStarted: "Bắt đầu",
18
+ guest: "Guest",
19
+ send: "Gửi",
20
+ receive: "Nhận",
21
+ currentNetwork: "Mạng lưới hiện tại",
22
+ switchAccount: "Chuyển tài khoản",
23
+ requestTestnetFunds: "Nhận Testnet Funds",
24
+ transactions: "Giao dịch",
25
+ viewAllTransactions: "Tất cả giao dịch",
26
+ backupWallet: "Sao lưu ví",
27
+ guestWalletWarning:
28
+ "Đây là ví tạm thời cho phiên đăng nhập của bạn. Vui lòng sao lưu ví nếu bạn không muốn dánh mất thông tin",
29
+ switchTo: "Đổi qua ví", // Used in "Switch to <Wallet-Name>"
30
+ connectedToSmartWallet: "Ví Thông Minh",
31
+ confirmInWallet: "Xác nhận bằng ví",
32
+ disconnectWallet: "Ngắt kết nối ví",
33
+ copyAddress: "Sao chép địa chỉ",
34
+ personalWallet: "Ví cá nhân",
35
+ smartWallet: "Ví Thông Minh",
36
+ or: "hoặc",
37
+ goBackButton: "Quay lại",
38
+ welcomeScreen: {
39
+ defaultTitle: "Cánh cổng dẫn tới thế giới phi tập trung",
40
+ defaultSubtitle: "Kết nối ví để bắt đầu",
41
+ },
42
+ agreement: {
43
+ prefix: "Bằng việc kết nối, bạn đồng ý với",
44
+ termsOfService: "Điều khoản dịch vụ",
45
+ and: "và",
46
+ privacyPolicy: "Chính sách bảo mật",
47
+ },
48
+ networkSelector: {
49
+ title: "Chọn mạng lưới",
50
+ mainnets: "Mainnets",
51
+ testnets: "Testnets",
52
+ allNetworks: "Tất cả",
53
+ addCustomNetwork: "Thêm mạng lưới",
54
+ inputPlaceholder: "Tìm theo tên hoặc ID",
55
+ categoryLabel: {
56
+ recentlyUsed: "Gần đây",
57
+ popular: "Thông dụng",
58
+ others: "Tất cả mạng lưới",
59
+ },
60
+ loading: "Đang tải",
61
+ failedToSwitch: "Không thể đổi mạng lưới",
62
+ },
63
+ receiveFundsScreen: {
64
+ title: "Nhận tiền",
65
+ instruction: "Sử dụng địa chỉ ví này để nhận tiền",
66
+ },
67
+ sendFundsScreen: {
68
+ title: "Gửi tiền",
69
+ submitButton: "Gửi",
70
+ token: "Token",
71
+ sendTo: "Gửi tới",
72
+ amount: "Số lượng",
73
+ successMessage: "Giao dịch thành công",
74
+ invalidAddress: "Địa chỉ không hợp lệ",
75
+ noTokensFound: "Không tìm thấy token",
76
+ searchToken: "Tìm kiếm hoặc dán địa chỉ token",
77
+ transactionFailed: "Giao dịch thất baị",
78
+ transactionRejected: "Giao dịch bị huỷ",
79
+ insufficientFunds: "Không đủ vốn",
80
+ selectTokenTitle: "Chọn Token",
81
+ sending: "Đang gửi",
82
+ },
83
+ signatureScreen: {
84
+ instructionScreen: {
85
+ title: "Đăng nhập",
86
+ instruction: "Kí vào yêu cầu tin nhắn trong ví của bạn để tiếp tục",
87
+ signInButton: "Đăng nhập",
88
+ disconnectWallet: "Ngắt kết nối ví",
89
+ },
90
+ signingScreen: {
91
+ title: "Đang đăng nhập",
92
+ prompt: "Ký vào yêu cầu tin nhắn trong ví của bạn",
93
+ promptForSafe:
94
+ "Kí vào yêu cầu tin nhắn trong ví của bạn và chấp nhận giao dịch trong ứng dụng Safe",
95
+ approveTransactionInSafe: "Xác nhận giao dịch bằng ví Safe",
96
+ tryAgain: "Thử lại",
97
+ failedToSignIn: "Đăng nhập thất bại",
98
+ inProgress: "Đang đợi xác nhận",
99
+ },
100
+ },
101
+ manageWallet: {
102
+ title: "Quản lý ví",
103
+ connectAnApp: "Kết nối ứng dụng",
104
+ exportPrivateKey: "Sao lưu private key",
105
+ },
106
+ viewFunds: {
107
+ title: "Tài sản",
108
+ viewTokens: "Tokens",
109
+ viewNFTs: "NFTs",
110
+ viewAssets: "Tài sản",
111
+ },
112
+ };
113
+
114
+ export default connectLocaleVi;
@@ -124,7 +124,7 @@ export function BuyTxHistoryList(props: {
124
124
  }}
125
125
  >
126
126
  <CrossCircledIcon width={iconSize.xl} height={iconSize.xl} />
127
- <Text> No Transactions </Text>
127
+ <Text>No Transactions </Text>
128
128
  </Container>
129
129
  )}
130
130