thirdweb 5.48.1-nightly-7ef1c721ef693584d153554d46f2e70e8015b261-20240822000343 → 5.48.2-nightly-1405598e7e51e4d415fd57f8169012823db0cedf-20240824000351

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 (253) hide show
  1. package/dist/cjs/exports/pay.js +3 -1
  2. package/dist/cjs/exports/pay.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/pay/buyWithCrypto/commonTypes.js +3 -0
  6. package/dist/cjs/pay/buyWithCrypto/commonTypes.js.map +1 -0
  7. package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
  8. package/dist/cjs/pay/buyWithCrypto/getTransfer.js +95 -0
  9. package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -0
  10. package/dist/cjs/pay/utils/definitions.js +7 -1
  11. package/dist/cjs/pay/utils/definitions.js.map +1 -1
  12. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  13. package/dist/cjs/react/native/ui/connect/ConnectedButton.js +5 -1
  14. package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
  15. package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -1
  16. package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
  17. package/dist/cjs/react/native/ui/connect/TokenListScreen.js +5 -1
  18. package/dist/cjs/react/native/ui/connect/TokenListScreen.js.map +1 -1
  19. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +28 -22
  20. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  21. package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +9 -0
  22. package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
  23. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -1
  24. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  25. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +9 -3
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +34 -2
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  31. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  32. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +118 -0
  34. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +7 -76
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
  39. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
  40. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  41. package/dist/cjs/react/web/wallets/shared/SocialLogin.js +5 -2
  42. package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
  43. package/dist/cjs/stories/ConnectButton.stories.js +28 -0
  44. package/dist/cjs/stories/ConnectButton.stories.js.map +1 -0
  45. package/dist/cjs/stories/PayEmbed.stories.js +38 -0
  46. package/dist/cjs/stories/PayEmbed.stories.js.map +1 -0
  47. package/dist/cjs/stories/utils.js +27 -0
  48. package/dist/cjs/stories/utils.js.map +1 -0
  49. package/dist/cjs/transaction/actions/send-transaction.js.map +1 -1
  50. package/dist/cjs/utils/fetch.js +2 -1
  51. package/dist/cjs/utils/fetch.js.map +1 -1
  52. package/dist/cjs/utils/signatures/sign-message.js +13 -19
  53. package/dist/cjs/utils/signatures/sign-message.js.map +1 -1
  54. package/dist/cjs/version.js +1 -1
  55. package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +8 -7
  56. package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
  57. package/dist/cjs/wallets/in-app/core/authentication/types.js.map +1 -1
  58. package/dist/cjs/wallets/in-app/core/wallet/index.js +2 -2
  59. package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
  60. package/dist/cjs/wallets/in-app/native/auth/native-auth.js +1 -1
  61. package/dist/cjs/wallets/in-app/web/lib/auth/index.js +3 -2
  62. package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
  63. package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js +4 -4
  64. package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
  65. package/dist/cjs/wallets/in-app/web/lib/web-connector.js +5 -3
  66. package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
  67. package/dist/cjs/wallets/smart/lib/constants.js +6 -0
  68. package/dist/cjs/wallets/smart/lib/constants.js.map +1 -1
  69. package/dist/esm/exports/pay.js +2 -0
  70. package/dist/esm/exports/pay.js.map +1 -1
  71. package/dist/esm/exports/thirdweb.js +2 -0
  72. package/dist/esm/exports/thirdweb.js.map +1 -1
  73. package/dist/esm/pay/buyWithCrypto/commonTypes.js +2 -0
  74. package/dist/esm/pay/buyWithCrypto/commonTypes.js.map +1 -0
  75. package/dist/esm/pay/buyWithCrypto/getQuote.js +1 -1
  76. package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
  77. package/dist/esm/pay/buyWithCrypto/getTransfer.js +92 -0
  78. package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -0
  79. package/dist/esm/pay/utils/definitions.js +5 -0
  80. package/dist/esm/pay/utils/definitions.js.map +1 -1
  81. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  82. package/dist/esm/react/native/ui/connect/ConnectedButton.js +5 -1
  83. package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
  84. package/dist/esm/react/native/ui/connect/ConnectedModal.js +2 -1
  85. package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
  86. package/dist/esm/react/native/ui/connect/TokenListScreen.js +5 -1
  87. package/dist/esm/react/native/ui/connect/TokenListScreen.js.map +1 -1
  88. package/dist/esm/react/web/ui/ConnectWallet/Details.js +28 -22
  89. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  90. package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +5 -0
  91. package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
  92. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -1
  93. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  94. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +8 -2
  95. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
  96. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +35 -3
  97. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  98. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
  99. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  100. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  101. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  102. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +115 -0
  103. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
  104. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +8 -77
  105. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
  106. package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
  107. package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
  108. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
  109. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  110. package/dist/esm/react/web/wallets/shared/SocialLogin.js +5 -2
  111. package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
  112. package/dist/esm/stories/ConnectButton.stories.js +25 -0
  113. package/dist/esm/stories/ConnectButton.stories.js.map +1 -0
  114. package/dist/esm/stories/PayEmbed.stories.js +35 -0
  115. package/dist/esm/stories/PayEmbed.stories.js.map +1 -0
  116. package/dist/esm/stories/utils.js +24 -0
  117. package/dist/esm/stories/utils.js.map +1 -0
  118. package/dist/esm/transaction/actions/send-transaction.js.map +1 -1
  119. package/dist/esm/utils/fetch.js +2 -1
  120. package/dist/esm/utils/fetch.js.map +1 -1
  121. package/dist/esm/utils/signatures/sign-message.js +13 -19
  122. package/dist/esm/utils/signatures/sign-message.js.map +1 -1
  123. package/dist/esm/version.js +1 -1
  124. package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +8 -7
  125. package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
  126. package/dist/esm/wallets/in-app/core/authentication/types.js.map +1 -1
  127. package/dist/esm/wallets/in-app/core/wallet/index.js +2 -2
  128. package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
  129. package/dist/esm/wallets/in-app/native/auth/native-auth.js +1 -1
  130. package/dist/esm/wallets/in-app/web/lib/auth/index.js +3 -2
  131. package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
  132. package/dist/esm/wallets/in-app/web/lib/auth/oauth.js +4 -4
  133. package/dist/esm/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
  134. package/dist/esm/wallets/in-app/web/lib/web-connector.js +5 -3
  135. package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
  136. package/dist/esm/wallets/smart/lib/constants.js +6 -0
  137. package/dist/esm/wallets/smart/lib/constants.js.map +1 -1
  138. package/dist/types/exports/pay.d.ts +3 -1
  139. package/dist/types/exports/pay.d.ts.map +1 -1
  140. package/dist/types/exports/thirdweb.d.ts +3 -1
  141. package/dist/types/exports/thirdweb.d.ts.map +1 -1
  142. package/dist/types/pay/buyWithCrypto/commonTypes.d.ts +36 -0
  143. package/dist/types/pay/buyWithCrypto/commonTypes.d.ts.map +1 -0
  144. package/dist/types/pay/buyWithCrypto/getQuote.d.ts +1 -24
  145. package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
  146. package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -1
  147. package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
  148. package/dist/types/pay/buyWithCrypto/getTransfer.d.ts +85 -0
  149. package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -0
  150. package/dist/types/pay/buyWithFiat/getQuote.d.ts +1 -1
  151. package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
  152. package/dist/types/pay/utils/definitions.d.ts +5 -0
  153. package/dist/types/pay/utils/definitions.d.ts.map +1 -1
  154. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +15 -0
  155. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  156. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -0
  157. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  158. package/dist/types/react/native/ui/connect/ConnectedButton.d.ts.map +1 -1
  159. package/dist/types/react/native/ui/connect/ConnectedModal.d.ts.map +1 -1
  160. package/dist/types/react/native/ui/connect/TokenListScreen.d.ts.map +1 -1
  161. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +6 -0
  162. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  163. package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts +3 -0
  164. package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts.map +1 -0
  165. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +2 -2
  166. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts.map +1 -1
  167. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +3 -2
  168. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
  169. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts.map +1 -1
  170. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +1 -1
  171. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
  172. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts +20 -0
  173. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -0
  174. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts +5 -1
  175. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +1 -1
  176. package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
  177. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
  178. package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
  179. package/dist/types/stories/ConnectButton.stories.d.ts +18 -0
  180. package/dist/types/stories/ConnectButton.stories.d.ts.map +1 -0
  181. package/dist/types/stories/PayEmbed.stories.d.ts +19 -0
  182. package/dist/types/stories/PayEmbed.stories.d.ts.map +1 -0
  183. package/dist/types/stories/utils.d.ts +5 -0
  184. package/dist/types/stories/utils.d.ts.map +1 -0
  185. package/dist/types/transaction/actions/send-transaction.d.ts +12 -2
  186. package/dist/types/transaction/actions/send-transaction.d.ts.map +1 -1
  187. package/dist/types/utils/fetch.d.ts.map +1 -1
  188. package/dist/types/utils/signatures/sign-message.d.ts +26 -3
  189. package/dist/types/utils/signatures/sign-message.d.ts.map +1 -1
  190. package/dist/types/version.d.ts +1 -1
  191. package/dist/types/wallets/ecosystem/types.d.ts +1 -2
  192. package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
  193. package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +1 -1
  194. package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
  195. package/dist/types/wallets/in-app/core/authentication/types.d.ts +1 -8
  196. package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
  197. package/dist/types/wallets/in-app/core/interfaces/connector.d.ts +1 -1
  198. package/dist/types/wallets/in-app/core/interfaces/connector.d.ts.map +1 -1
  199. package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
  200. package/dist/types/wallets/in-app/core/wallet/types.d.ts +1 -5
  201. package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
  202. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
  203. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +1 -1
  204. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts.map +1 -1
  205. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +1 -1
  206. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
  207. package/dist/types/wallets/smart/lib/constants.d.ts.map +1 -1
  208. package/package.json +15 -2
  209. package/src/exports/pay.ts +11 -2
  210. package/src/exports/thirdweb.ts +11 -2
  211. package/src/pay/buyWithCrypto/commonTypes.ts +40 -0
  212. package/src/pay/buyWithCrypto/getQuote.ts +8 -42
  213. package/src/pay/buyWithCrypto/getStatus.ts +1 -1
  214. package/src/pay/buyWithCrypto/getTransfer.ts +185 -0
  215. package/src/pay/buyWithFiat/getQuote.ts +1 -1
  216. package/src/pay/utils/definitions.ts +7 -0
  217. package/src/react/core/hooks/connection/ConnectButtonProps.ts +16 -0
  218. package/src/react/core/hooks/transaction/useSendTransaction.ts +3 -0
  219. package/src/react/native/ui/connect/ConnectedButton.tsx +6 -1
  220. package/src/react/native/ui/connect/ConnectedModal.tsx +2 -1
  221. package/src/react/native/ui/connect/TokenListScreen.tsx +6 -1
  222. package/src/react/web/ui/ConnectWallet/Details.tsx +93 -77
  223. package/src/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.tsx +21 -0
  224. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +8 -1
  225. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +9 -3
  226. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +47 -3
  227. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +26 -0
  228. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -3
  229. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +284 -0
  230. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +29 -220
  231. package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +3 -1
  232. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +3 -2
  233. package/src/react/web/wallets/shared/SocialLogin.tsx +7 -2
  234. package/src/stories/ConnectButton.stories.ts +31 -0
  235. package/src/stories/PayEmbed.stories.ts +42 -0
  236. package/src/stories/utils.tsx +29 -0
  237. package/src/transaction/actions/send-transaction.ts +12 -3
  238. package/src/utils/fetch.ts +4 -1
  239. package/src/utils/signatures/sign-message.test.ts +78 -50
  240. package/src/utils/signatures/sign-message.ts +44 -9
  241. package/src/version.ts +1 -1
  242. package/src/wallets/ecosystem/types.ts +1 -2
  243. package/src/wallets/in-app/core/authentication/getLoginPath.ts +11 -9
  244. package/src/wallets/in-app/core/authentication/types.ts +1 -8
  245. package/src/wallets/in-app/core/interfaces/connector.ts +5 -1
  246. package/src/wallets/in-app/core/wallet/index.ts +6 -2
  247. package/src/wallets/in-app/core/wallet/types.ts +1 -5
  248. package/src/wallets/in-app/native/auth/native-auth.ts +1 -1
  249. package/src/wallets/in-app/web/lib/auth/index.ts +7 -2
  250. package/src/wallets/in-app/web/lib/auth/oauth.ts +5 -5
  251. package/src/wallets/in-app/web/lib/web-connector.ts +9 -3
  252. package/src/wallets/smart/lib/constants.ts +6 -0
  253. package/src/wallets/smart/smart-wallet-dev.test.ts +86 -0
@@ -14,6 +14,7 @@ import type { Chain } from "../../../../chains/types.js";
14
14
  import type { ThirdwebClient } from "../../../../client/client.js";
15
15
  import { getContract } from "../../../../contract/contract.js";
16
16
  import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deployed.js";
17
+ import { formatNumber } from "../../../../utils/formatNumber.js";
17
18
  import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
18
19
  import type { SmartWalletOptions } from "../../../../wallets/smart/types.js";
19
20
  import type { AppMetadata } from "../../../../wallets/types.js";
@@ -246,9 +247,7 @@ export const ConnectedWalletDetails: React.FC<{
246
247
  color="secondaryText"
247
248
  weight={400}
248
249
  >
249
- {Number.parseFloat(
250
- Number(balanceQuery.data.displayValue).toFixed(3),
251
- )}{" "}
250
+ {formatBalanceOnButton(Number(balanceQuery.data.displayValue))}{" "}
252
251
  {balanceQuery.data.symbol}
253
252
  </Text>
254
253
  ) : (
@@ -352,9 +351,7 @@ function DetailsModal(props: {
352
351
  {chainNameQuery.name || `Unknown chain #${walletChain?.id}`}
353
352
  <Text color="secondaryText" size="xs">
354
353
  {balanceQuery.data ? (
355
- Number.parseFloat(
356
- Number(balanceQuery.data.displayValue).toFixed(3),
357
- )
354
+ formatNumber(Number(balanceQuery.data.displayValue), 5)
358
355
  ) : (
359
356
  <Skeleton height="1em" width="100px" />
360
357
  )}{" "}
@@ -374,84 +371,91 @@ function DetailsModal(props: {
374
371
  </MenuButton>
375
372
  );
376
373
 
374
+ const avatarContent = (
375
+ <Container
376
+ style={{
377
+ position: "relative",
378
+ height: `${iconSize.xl}px`,
379
+ width: `${iconSize.xl}px`,
380
+ }}
381
+ >
382
+ <Container
383
+ style={{
384
+ width: "100%",
385
+ height: "100%",
386
+ borderRadius: "100%",
387
+ overflow: "hidden",
388
+ }}
389
+ >
390
+ {ensAvatarQuery.data ? (
391
+ <img
392
+ src={ensAvatarQuery.data}
393
+ style={{
394
+ width: iconSize.xxl,
395
+ height: iconSize.xxl,
396
+ }}
397
+ alt=""
398
+ />
399
+ ) : (
400
+ activeAccount && (
401
+ <Blobbie
402
+ address={activeAccount.address}
403
+ size={Number(iconSize.xxl)}
404
+ />
405
+ )
406
+ )}
407
+ </Container>
408
+ <Container
409
+ style={{
410
+ position: "absolute",
411
+ bottom: -2,
412
+ right: -2,
413
+ }}
414
+ >
415
+ <IconContainer
416
+ style={{
417
+ background: theme.colors.modalBg,
418
+ }}
419
+ padding="4px"
420
+ >
421
+ {activeWallet && (
422
+ <WalletImage
423
+ style={{ borderRadius: 0 }}
424
+ id={activeWallet.id}
425
+ client={client}
426
+ size="12"
427
+ />
428
+ )}
429
+ </IconContainer>
430
+ </Container>
431
+ </Container>
432
+ );
433
+
377
434
  let content = (
378
435
  <div>
379
436
  <Spacer y="xs" />
380
437
  <Container p="lg" gap="sm" flex="row" center="y">
381
- <ToolTip tip="Switch wallet">
382
- <div
383
- style={{
384
- cursor: "pointer",
385
- }}
386
- onKeyDown={(e) => {
387
- if (e.key === "w") {
388
- setScreen("wallet-manager");
389
- }
390
- }}
391
- onClick={() => {
392
- setScreen("wallet-manager");
393
- }}
394
- >
395
- <Container
438
+ {props.detailsModal?.hideSwitchWallet ? (
439
+ avatarContent
440
+ ) : (
441
+ <ToolTip tip="Switch wallet">
442
+ <div
396
443
  style={{
397
- position: "relative",
398
- height: `${iconSize.xl}px`,
399
- width: `${iconSize.xl}px`,
444
+ cursor: "pointer",
445
+ }}
446
+ onKeyDown={(e) => {
447
+ if (e.key === "w") {
448
+ setScreen("wallet-manager");
449
+ }
450
+ }}
451
+ onClick={() => {
452
+ setScreen("wallet-manager");
400
453
  }}
401
454
  >
402
- <Container
403
- style={{
404
- width: "100%",
405
- height: "100%",
406
- borderRadius: "100%",
407
- overflow: "hidden",
408
- }}
409
- >
410
- {ensAvatarQuery.data ? (
411
- <img
412
- src={ensAvatarQuery.data}
413
- style={{
414
- width: iconSize.xxl,
415
- height: iconSize.xxl,
416
- }}
417
- alt=""
418
- />
419
- ) : (
420
- activeAccount && (
421
- <Blobbie
422
- address={activeAccount.address}
423
- size={Number(iconSize.xxl)}
424
- />
425
- )
426
- )}
427
- </Container>
428
- <Container
429
- style={{
430
- position: "absolute",
431
- bottom: -2,
432
- right: -2,
433
- }}
434
- >
435
- <IconContainer
436
- style={{
437
- background: theme.colors.modalBg,
438
- }}
439
- padding="4px"
440
- >
441
- {activeWallet && (
442
- <WalletImage
443
- style={{ borderRadius: 0 }}
444
- id={activeWallet.id}
445
- client={client}
446
- size="12"
447
- />
448
- )}
449
- </IconContainer>
450
- </Container>
451
- </Container>
452
- </div>
453
- </ToolTip>
454
-
455
+ {avatarContent}
456
+ </div>
457
+ </ToolTip>
458
+ )}
455
459
  <Container flex="column" gap="3xs">
456
460
  <div
457
461
  style={{
@@ -909,6 +913,10 @@ function DetailsModal(props: {
909
913
  );
910
914
  }
911
915
 
916
+ function formatBalanceOnButton(num: number) {
917
+ return formatNumber(num, num < 1 ? 5 : 4);
918
+ }
919
+
912
920
  const WalletInfoButton = /* @__PURE__ */ StyledButton((_) => {
913
921
  const theme = useCustomTheme();
914
922
  return {
@@ -1257,6 +1265,13 @@ export type UseWalletDetailsModalOptions = {
1257
1265
  */
1258
1266
  hideDisconnect?: boolean;
1259
1267
 
1268
+ /**
1269
+ * Hide the "Switch Wallet" button in the Wallet Details Modal.
1270
+ *
1271
+ * By default it is `false`
1272
+ */
1273
+ hideSwitchWallet?: boolean;
1274
+
1260
1275
  /**
1261
1276
  * Callback to be called when a wallet is disconnected by clicking the "Disconnect Wallet" button in the Wallet Details Modal.
1262
1277
  *
@@ -1363,6 +1378,7 @@ export function useWalletDetailsModal() {
1363
1378
  detailsModal={{
1364
1379
  footer: props.footer,
1365
1380
  hideDisconnect: props.hideDisconnect,
1381
+ hideSwitchWallet: props.hideSwitchWallet,
1366
1382
  networkSelector: props.networkSelector,
1367
1383
  payOptions: props.payOptions,
1368
1384
  showTestnetFaucet: props.showTestnetFaucet,
@@ -0,0 +1,21 @@
1
+ import type { IconFC } from "../types.js";
2
+
3
+ export const JPYIcon: IconFC = (props) => {
4
+ return (
5
+ <svg
6
+ width={props.size}
7
+ height={props.size}
8
+ viewBox="0 0 32 32"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ role="presentation"
11
+ >
12
+ <g fill="none" fill-rule="evenodd">
13
+ <circle cx="16" cy="16" fill="#a81b1b" r="16" />
14
+ <path
15
+ d="M17.548 18.711v1.878h5.063v2.288h-5.063V25.5h-3.096v-2.623H9.389v-2.288h5.063v-1.878H9.389v-2.288h4.171L7.5 7.5h3.752l4.8 7.534L20.853 7.5H24.5l-6.086 8.923h4.197v2.288z"
16
+ fill="#ffffff"
17
+ />
18
+ </g>
19
+ </svg>
20
+ );
21
+ };
@@ -325,12 +325,19 @@ function BuyScreenContent(props: BuyScreenContentProps) {
325
325
  onBack={goBack}
326
326
  payer={payer}
327
327
  client={props.client}
328
- onDone={onDone}
329
328
  chain={toChain}
330
329
  token={toToken}
331
330
  tokenAmount={tokenAmount}
332
331
  receiverAddress={receiverAddress}
333
332
  transactionMode={props.payOptions.mode === "transaction"}
333
+ isEmbed={props.isEmbed}
334
+ onDone={onDone}
335
+ onTryAgain={() => {
336
+ setScreen({
337
+ id: "buy-with-crypto",
338
+ });
339
+ }}
340
+ onSuccess={onSwapSuccess}
334
341
  />
335
342
  );
336
343
  }
@@ -2,23 +2,24 @@ import { RadiobuttonIcon } from "@radix-ui/react-icons";
2
2
  import { CADIcon } from "../../../icons/currencies/CADIcon.js";
3
3
  import { EURIcon } from "../../../icons/currencies/EURIcon.js";
4
4
  import { GBPIcon } from "../../../icons/currencies/GBPIcon.js";
5
+ import { JPYIcon } from "../../../icons/currencies/JPYIcon.js";
5
6
  import { USDIcon } from "../../../icons/currencies/USDIcon.js";
6
7
  import type { IconFC } from "../../../icons/types.js";
7
8
 
8
9
  export type CurrencyMeta = {
9
- shorthand: "USD" | "CAD" | "GBP" | "EUR";
10
+ shorthand: "USD" | "CAD" | "GBP" | "EUR" | "JPY";
10
11
  name: string;
11
12
  icon: IconFC;
12
13
  };
13
14
 
14
- export const defaultSelectedCurrency: CurrencyMeta = {
15
+ export const usdCurrency: CurrencyMeta = {
15
16
  shorthand: "USD",
16
17
  name: "US Dollar",
17
18
  icon: USDIcon,
18
19
  };
19
20
 
20
21
  export const currencies: CurrencyMeta[] = [
21
- defaultSelectedCurrency,
22
+ usdCurrency,
22
23
  {
23
24
  shorthand: "CAD",
24
25
  name: "Canadian Dollar",
@@ -34,6 +35,11 @@ export const currencies: CurrencyMeta[] = [
34
35
  name: "Euro",
35
36
  icon: EURIcon,
36
37
  },
38
+ {
39
+ shorthand: "JPY",
40
+ name: "Japanese Yen",
41
+ icon: JPYIcon,
42
+ },
37
43
  ];
38
44
 
39
45
  export function getCurrencyMeta(shorthand: string): CurrencyMeta {
@@ -8,7 +8,11 @@ import type {
8
8
  import { useActiveWalletChain } from "../../../../../../core/hooks/wallets/useActiveWalletChain.js";
9
9
  import { useDebouncedValue } from "../../../../hooks/useDebouncedValue.js";
10
10
  import { type ERC20OrNativeToken, NATIVE_TOKEN } from "../../nativeToken.js";
11
- import { defaultSelectedCurrency } from "../fiat/currencies.js";
11
+ import {
12
+ type CurrencyMeta,
13
+ currencies,
14
+ usdCurrency,
15
+ } from "../fiat/currencies.js";
12
16
  import type { SupportedChainAndTokens } from "../swap/useSwapSupportedChains.js";
13
17
 
14
18
  // handle states for token and chain selection
@@ -71,10 +75,17 @@ export function useUISelectionStates(options: {
71
75
  );
72
76
 
73
77
  // --------------------------------------------------------------------------
78
+ const devSpecifiedDefaultCurrency =
79
+ payOptions.buyWithFiat !== false
80
+ ? payOptions.buyWithFiat?.prefillSource?.currency
81
+ : undefined;
82
+
83
+ const defaultSelectedCurrencyShorthand =
84
+ devSpecifiedDefaultCurrency || getDefaultCurrencyBasedOnLocation();
74
85
 
75
- // stripe only supports USD, so not using a state right now
76
86
  const [selectedCurrency, setSelectedCurrency] = useState(
77
- defaultSelectedCurrency,
87
+ currencies.find((x) => x.shorthand === defaultSelectedCurrencyShorthand) ||
88
+ usdCurrency,
78
89
  );
79
90
 
80
91
  return {
@@ -95,3 +106,36 @@ export function useUISelectionStates(options: {
95
106
  setSelectedCurrency,
96
107
  };
97
108
  }
109
+
110
+ function getDefaultCurrencyBasedOnLocation(): CurrencyMeta["shorthand"] {
111
+ // if Intl is not supported - browser throws
112
+ try {
113
+ const timeZone = Intl.DateTimeFormat()
114
+ .resolvedOptions()
115
+ .timeZone.toLowerCase();
116
+
117
+ // Europe/London -> GBP
118
+ if (timeZone.includes("london")) {
119
+ return "GBP";
120
+ }
121
+
122
+ // Europe/* -> EUR
123
+ if (timeZone.includes("europe")) {
124
+ return "EUR";
125
+ }
126
+
127
+ // Japan
128
+ if (timeZone.includes("japan")) {
129
+ return "JPY";
130
+ }
131
+
132
+ // canada
133
+ if (timeZone.includes("canada")) {
134
+ return "CAD";
135
+ }
136
+
137
+ return "USD";
138
+ } catch {
139
+ return "USD";
140
+ }
141
+ }
@@ -100,7 +100,9 @@ export function SwapTxDetailsTable(
100
100
  ) {
101
101
  let uiData: SwapTxDetailsData;
102
102
  let showStatusRow = true;
103
+ let isTransfer = false;
103
104
  if (props.type === "status") {
105
+ isTransfer = props.status.swapType === "TRANSFER";
104
106
  const status = props.status;
105
107
  if (props.hideStatusRow) {
106
108
  showStatusRow = false;
@@ -189,6 +191,30 @@ export function SwapTxDetailsTable(
189
191
  </>
190
192
  );
191
193
 
194
+ if (isTransfer) {
195
+ return (
196
+ <div>
197
+ {/* source chain Tx hash link */}
198
+ {fromChainExplorers.explorers?.[0]?.url && sourceTxHash && (
199
+ <ButtonLink
200
+ fullWidth
201
+ variant="outline"
202
+ href={`${fromChainExplorers.explorers[0].url}/tx/${sourceTxHash}`}
203
+ target="_blank"
204
+ gap="xs"
205
+ style={{
206
+ fontSize: fontSize.sm,
207
+ padding: spacing.sm,
208
+ }}
209
+ >
210
+ View on {fromChainName.name} Explorer
211
+ <ExternalLinkIcon width={iconSize.sm} height={iconSize.sm} />
212
+ </ButtonLink>
213
+ )}
214
+ </div>
215
+ );
216
+ }
217
+
192
218
  return (
193
219
  <div>
194
220
  {isPartialSuccess && gotToken ? (
@@ -26,7 +26,7 @@ export function SwapStatusScreen(props: {
26
26
  onDone: () => void;
27
27
  transactionMode: boolean;
28
28
  isEmbed: boolean;
29
- quote: BuyWithCryptoQuote;
29
+ quote: BuyWithCryptoQuote | undefined;
30
30
  onSuccess: ((status: BuyWithCryptoStatus) => void) | undefined;
31
31
  }) {
32
32
  const { onSuccess } = props;
@@ -82,13 +82,13 @@ export function SwapStatusScreen(props: {
82
82
  hideStatusRow={true}
83
83
  client={props.client}
84
84
  />
85
- ) : (
85
+ ) : props.quote ? (
86
86
  <SwapTxDetailsTable
87
87
  type="quote"
88
88
  quote={props.quote}
89
89
  client={props.client}
90
90
  />
91
- );
91
+ ) : null;
92
92
 
93
93
  return (
94
94
  <Container animate="fadein">