thirdweb 5.39.0 → 5.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/dist/cjs/exports/react.js +7 -2
  2. package/dist/cjs/exports/react.js.map +1 -1
  3. package/dist/cjs/react/core/design-system/index.js +2 -0
  4. package/dist/cjs/react/core/design-system/index.js.map +1 -1
  5. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +13 -94
  6. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  7. package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js +16 -3
  8. package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
  9. package/dist/cjs/react/core/utils/defaultTokens.js +32 -25
  10. package/dist/cjs/react/core/utils/defaultTokens.js.map +1 -1
  11. package/dist/cjs/react/core/utils/wallet.js +91 -13
  12. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  13. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +18 -127
  14. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  15. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +3 -1
  16. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +7 -3
  18. package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
  19. package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -1
  20. package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
  21. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +184 -118
  22. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  23. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +104 -0
  24. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -0
  25. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +69 -0
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -0
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +23 -5
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +4 -4
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
  31. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +2 -2
  32. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -2
  34. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +1 -1
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +132 -45
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  39. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +2 -5
  40. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
  41. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +13 -8
  42. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  43. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +1 -1
  44. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +1 -1
  45. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +1 -1
  46. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +1 -1
  47. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +1 -1
  48. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  49. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js +1 -1
  50. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +1 -1
  51. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +1 -1
  52. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +1 -1
  53. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +9 -5
  54. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  55. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +1 -1
  56. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
  57. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +8 -3
  58. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
  59. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +1 -1
  60. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +1 -1
  61. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  62. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  63. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +84 -0
  64. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -0
  65. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +13 -7
  66. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -1
  67. package/dist/cjs/react/web/ui/ConnectWallet/screens/nativeToken.js +3 -1
  68. package/dist/cjs/react/web/ui/ConnectWallet/screens/nativeToken.js.map +1 -1
  69. package/dist/cjs/react/web/ui/PayEmbed.js +16 -9
  70. package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
  71. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +53 -0
  72. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -0
  73. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +33 -0
  74. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -0
  75. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +16 -5
  76. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  77. package/dist/cjs/react/web/wallets/shared/SocialLogin.js +18 -2
  78. package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
  79. package/dist/cjs/react/web/wallets/shared/{openOauthSignInWindow.js → oauthSignIn.js} +2 -3
  80. package/dist/cjs/react/web/wallets/shared/oauthSignIn.js.map +1 -0
  81. package/dist/cjs/version.js +1 -1
  82. package/dist/cjs/wallets/in-app/core/wallet/index.js +15 -0
  83. package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
  84. package/dist/cjs/wallets/in-app/web/in-app.js +10 -0
  85. package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
  86. package/dist/cjs/wallets/in-app/web/lib/auth/index.js +2 -0
  87. package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
  88. package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js +9 -1
  89. package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
  90. package/dist/cjs/wallets/in-app/web/lib/get-url-token.js +26 -0
  91. package/dist/cjs/wallets/in-app/web/lib/get-url-token.js.map +1 -0
  92. package/dist/cjs/wallets/in-app/web/lib/web-connector.js +13 -3
  93. package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
  94. package/dist/esm/exports/react.js +3 -1
  95. package/dist/esm/exports/react.js.map +1 -1
  96. package/dist/esm/react/core/design-system/index.js +2 -0
  97. package/dist/esm/react/core/design-system/index.js.map +1 -1
  98. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +13 -93
  99. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  100. package/dist/esm/react/core/hooks/wallets/useAutoConnect.js +16 -3
  101. package/dist/esm/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
  102. package/dist/esm/react/core/utils/defaultTokens.js +31 -25
  103. package/dist/esm/react/core/utils/defaultTokens.js.map +1 -1
  104. package/dist/esm/react/core/utils/wallet.js +88 -13
  105. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  106. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +20 -129
  107. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  108. package/dist/esm/react/web/ui/ConnectWallet/Details.js +3 -1
  109. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  110. package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +7 -3
  111. package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
  112. package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -1
  113. package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
  114. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +188 -122
  115. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  116. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +101 -0
  117. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -0
  118. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +66 -0
  119. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -0
  120. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +22 -5
  121. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
  122. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +4 -4
  123. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
  124. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +2 -2
  125. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
  126. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -2
  127. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
  128. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +1 -1
  129. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
  130. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +130 -44
  131. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  132. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +2 -5
  133. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
  134. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +13 -8
  135. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  136. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +1 -1
  137. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +1 -1
  138. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +1 -1
  139. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +1 -1
  140. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +1 -1
  141. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  142. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js +1 -1
  143. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +1 -1
  144. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +1 -1
  145. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +1 -1
  146. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +7 -4
  147. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  148. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +1 -1
  149. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
  150. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +9 -4
  151. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
  152. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +1 -1
  153. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +1 -1
  154. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  155. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  156. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +81 -0
  157. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -0
  158. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +14 -8
  159. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -1
  160. package/dist/esm/react/web/ui/ConnectWallet/screens/nativeToken.js +3 -1
  161. package/dist/esm/react/web/ui/ConnectWallet/screens/nativeToken.js.map +1 -1
  162. package/dist/esm/react/web/ui/PayEmbed.js +16 -9
  163. package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
  164. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +50 -0
  165. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -0
  166. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +29 -0
  167. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -0
  168. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +15 -4
  169. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  170. package/dist/esm/react/web/wallets/shared/SocialLogin.js +17 -1
  171. package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
  172. package/dist/esm/react/web/wallets/shared/{openOauthSignInWindow.js → oauthSignIn.js} +2 -3
  173. package/dist/esm/react/web/wallets/shared/oauthSignIn.js.map +1 -0
  174. package/dist/esm/version.js +1 -1
  175. package/dist/esm/wallets/in-app/core/wallet/index.js +15 -0
  176. package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
  177. package/dist/esm/wallets/in-app/web/in-app.js +10 -0
  178. package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
  179. package/dist/esm/wallets/in-app/web/lib/auth/index.js +2 -0
  180. package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
  181. package/dist/esm/wallets/in-app/web/lib/auth/oauth.js +7 -0
  182. package/dist/esm/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
  183. package/dist/esm/wallets/in-app/web/lib/get-url-token.js +23 -0
  184. package/dist/esm/wallets/in-app/web/lib/get-url-token.js.map +1 -0
  185. package/dist/esm/wallets/in-app/web/lib/web-connector.js +14 -4
  186. package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
  187. package/dist/types/exports/react.d.ts +3 -2
  188. package/dist/types/exports/react.d.ts.map +1 -1
  189. package/dist/types/exports/utils.d.ts +1 -0
  190. package/dist/types/exports/utils.d.ts.map +1 -1
  191. package/dist/types/react/core/design-system/index.d.ts +2 -0
  192. package/dist/types/react/core/design-system/index.d.ts.map +1 -1
  193. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +80 -34
  194. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  195. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -15
  196. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  197. package/dist/types/react/core/hooks/wallets/useAutoConnect.d.ts.map +1 -1
  198. package/dist/types/react/core/utils/defaultTokens.d.ts +222 -0
  199. package/dist/types/react/core/utils/defaultTokens.d.ts.map +1 -1
  200. package/dist/types/react/core/utils/wallet.d.ts +43 -1
  201. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  202. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +2 -4
  203. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  204. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +3 -1
  205. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  206. package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
  207. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts +0 -3
  208. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
  209. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts +18 -0
  210. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts.map +1 -0
  211. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts +18 -0
  212. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +1 -0
  213. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts +5 -0
  214. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts.map +1 -1
  215. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts +1 -2
  216. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts.map +1 -1
  217. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts +1 -2
  218. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts.map +1 -1
  219. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts +1 -2
  220. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts.map +1 -1
  221. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts +1 -2
  222. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts.map +1 -1
  223. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +14 -8
  224. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts.map +1 -1
  225. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts +19 -9
  226. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts.map +1 -1
  227. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts +6 -5
  228. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts.map +1 -1
  229. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +0 -2
  230. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
  231. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts +1 -1
  232. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts.map +1 -1
  233. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts +1 -1
  234. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts.map +1 -1
  235. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts +1 -1
  236. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts.map +1 -1
  237. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts +4 -0
  238. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
  239. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.d.ts.map +1 -1
  240. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts +1 -0
  241. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts.map +1 -1
  242. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts +1 -2
  243. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts.map +1 -1
  244. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +1 -2
  245. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
  246. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts +19 -0
  247. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +1 -0
  248. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts.map +1 -1
  249. package/dist/types/react/web/ui/ConnectWallet/screens/nativeToken.d.ts.map +1 -1
  250. package/dist/types/react/web/ui/PayEmbed.d.ts +0 -6
  251. package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
  252. package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts +9 -0
  253. package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -0
  254. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +24 -0
  255. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -0
  256. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
  257. package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
  258. package/dist/types/react/web/wallets/shared/{openOauthSignInWindow.d.ts → oauthSignIn.d.ts} +1 -2
  259. package/dist/types/react/web/wallets/shared/oauthSignIn.d.ts.map +1 -0
  260. package/dist/types/version.d.ts +1 -1
  261. package/dist/types/wallets/ecosystem/types.d.ts +3 -0
  262. package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
  263. package/dist/types/wallets/in-app/core/interfaces/connector.d.ts +4 -1
  264. package/dist/types/wallets/in-app/core/interfaces/connector.d.ts.map +1 -1
  265. package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
  266. package/dist/types/wallets/in-app/core/wallet/types.d.ts +4 -1
  267. package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
  268. package/dist/types/wallets/in-app/web/in-app.d.ts +10 -0
  269. package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
  270. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +11 -2
  271. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
  272. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +5 -0
  273. package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts.map +1 -1
  274. package/dist/types/wallets/in-app/web/lib/get-url-token.d.ts +12 -0
  275. package/dist/types/wallets/in-app/web/lib/get-url-token.d.ts.map +1 -0
  276. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +4 -1
  277. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
  278. package/package.json +1 -1
  279. package/src/exports/react.ts +14 -2
  280. package/src/exports/utils.ts +2 -0
  281. package/src/react/core/design-system/index.ts +2 -0
  282. package/src/react/core/hooks/connection/ConnectButtonProps.ts +103 -51
  283. package/src/react/core/hooks/transaction/useSendTransaction.ts +17 -127
  284. package/src/react/core/hooks/wallets/useAutoConnect.ts +17 -3
  285. package/src/react/core/utils/defaultTokens.ts +38 -26
  286. package/src/react/core/utils/wallet.ts +102 -18
  287. package/src/react/web/hooks/transaction/useSendTransaction.tsx +34 -278
  288. package/src/react/web/ui/ConnectWallet/Details.tsx +6 -4
  289. package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +9 -3
  290. package/src/react/web/ui/ConnectWallet/TransactionsScreen.tsx +1 -1
  291. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +347 -383
  292. package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +266 -0
  293. package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +253 -0
  294. package/src/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.tsx +52 -21
  295. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx +3 -6
  296. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +5 -6
  297. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.tsx +2 -4
  298. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.tsx +2 -4
  299. package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +16 -12
  300. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +155 -60
  301. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.ts +8 -3
  302. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +17 -12
  303. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.tsx +2 -2
  304. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.tsx +2 -3
  305. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +1 -1
  306. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.tsx +1 -1
  307. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.tsx +2 -2
  308. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +27 -19
  309. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.tsx +8 -4
  310. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +12 -5
  311. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.tsx +2 -4
  312. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -4
  313. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +243 -0
  314. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx +30 -17
  315. package/src/react/web/ui/ConnectWallet/screens/nativeToken.ts +5 -1
  316. package/src/react/web/ui/PayEmbed.tsx +31 -32
  317. package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +127 -0
  318. package/src/react/web/ui/TransactionButton/TransactionModal.tsx +83 -0
  319. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +18 -4
  320. package/src/react/web/wallets/shared/SocialLogin.tsx +20 -1
  321. package/src/react/web/wallets/shared/{openOauthSignInWindow.ts → oauthSignIn.ts} +1 -2
  322. package/src/version.ts +1 -1
  323. package/src/wallets/ecosystem/types.ts +3 -0
  324. package/src/wallets/in-app/core/interfaces/connector.ts +6 -0
  325. package/src/wallets/in-app/core/wallet/index.ts +22 -0
  326. package/src/wallets/in-app/core/wallet/types.ts +4 -0
  327. package/src/wallets/in-app/web/in-app.ts +10 -0
  328. package/src/wallets/in-app/web/lib/auth/index.ts +14 -3
  329. package/src/wallets/in-app/web/lib/auth/oauth.ts +12 -0
  330. package/src/wallets/in-app/web/lib/get-url-token.ts +36 -0
  331. package/src/wallets/in-app/web/lib/web-connector.ts +18 -4
  332. package/dist/cjs/react/web/wallets/shared/openOauthSignInWindow.js.map +0 -1
  333. package/dist/esm/react/web/wallets/shared/openOauthSignInWindow.js.map +0 -1
  334. package/dist/types/react/web/wallets/shared/openOauthSignInWindow.d.ts.map +0 -1
@@ -7,9 +7,7 @@ const react_1 = require("react");
7
7
  const addresses_js_1 = require("../../../../../../constants/addresses.js");
8
8
  const isSwapRequiredPostOnramp_js_1 = require("../../../../../../pay/buyWithFiat/isSwapRequiredPostOnramp.js");
9
9
  const formatNumber_js_1 = require("../../../../../../utils/formatNumber.js");
10
- const units_js_1 = require("../../../../../../utils/units.js");
11
10
  const index_js_1 = require("../../../../../core/design-system/index.js");
12
- const useChainQuery_js_1 = require("../../../../../core/hooks/others/useChainQuery.js");
13
11
  const useWalletBalance_js_1 = require("../../../../../core/hooks/others/useWalletBalance.js");
14
12
  const useBuyWithCryptoQuote_js_1 = require("../../../../../core/hooks/pay/useBuyWithCryptoQuote.js");
15
13
  const useBuyWithFiatQuote_js_1 = require("../../../../../core/hooks/pay/useBuyWithFiatQuote.js");
@@ -17,11 +15,9 @@ const useActiveAccount_js_1 = require("../../../../hooks/wallets/useActiveAccoun
17
15
  const LoadingScreen_js_1 = require("../../../../wallets/shared/LoadingScreen.js");
18
16
  const ChainName_js_1 = require("../../../components/ChainName.js");
19
17
  const Drawer_js_1 = require("../../../components/Drawer.js");
20
- const Skeleton_js_1 = require("../../../components/Skeleton.js");
21
18
  const Spacer_js_1 = require("../../../components/Spacer.js");
22
19
  const Spinner_js_1 = require("../../../components/Spinner.js");
23
20
  const SwitchNetwork_js_1 = require("../../../components/SwitchNetwork.js");
24
- const TokenIcon_js_1 = require("../../../components/TokenIcon.js");
25
21
  const basic_js_1 = require("../../../components/basic.js");
26
22
  const buttons_js_1 = require("../../../components/buttons.js");
27
23
  const text_js_1 = require("../../../components/text.js");
@@ -32,14 +28,14 @@ const CoinsIcon_js_1 = require("../../icons/CoinsIcon.js");
32
28
  const TokenSelector_js_1 = require("../TokenSelector.js");
33
29
  const WalletSwitcherConnectionScreen_js_1 = require("../WalletSwitcherConnectionScreen.js");
34
30
  const nativeToken_js_1 = require("../nativeToken.js");
31
+ const DirectPaymentModeScreen_js_1 = require("./DirectPaymentModeScreen.js");
35
32
  const EstimatedTimeAndFees_js_1 = require("./EstimatedTimeAndFees.js");
36
33
  const PayTokenIcon_js_1 = require("./PayTokenIcon.js");
37
34
  const PayWIthCreditCard_js_1 = require("./PayWIthCreditCard.js");
38
- const ReceiverWalletSelectionScreen_js_1 = require("./ReceiverWalletSelectionScreen.js");
35
+ const TransactionModeScreen_js_1 = require("./TransactionModeScreen.js");
39
36
  const WalletSelectorButton_js_1 = require("./WalletSelectorButton.js");
40
37
  const CurrencySelection_js_1 = require("./fiat/CurrencySelection.js");
41
38
  const FiatFlow_js_1 = require("./fiat/FiatFlow.js");
42
- const useBuyTxStates_js_1 = require("./main/useBuyTxStates.js");
43
39
  const useEnabledPaymentMethods_js_1 = require("./main/useEnabledPaymentMethods.js");
44
40
  const useUISelectionStates_js_1 = require("./main/useUISelectionStates.js");
45
41
  const openOnRamppopup_js_1 = require("./openOnRamppopup.js");
@@ -47,6 +43,7 @@ const BuyTokenInput_js_1 = require("./swap/BuyTokenInput.js");
47
43
  const Fees_js_1 = require("./swap/Fees.js");
48
44
  const PayWithCrypto_js_1 = require("./swap/PayWithCrypto.js");
49
45
  const SwapFlow_js_1 = require("./swap/SwapFlow.js");
46
+ const TransferFlow_js_1 = require("./swap/TransferFlow.js");
50
47
  const WalletSwitcherDrawerContent_js_1 = require("./swap/WalletSwitcherDrawerContent.js");
51
48
  const pendingSwapTx_js_1 = require("./swap/pendingSwapTx.js");
52
49
  const useSwapSupportedChains_js_1 = require("./swap/useSwapSupportedChains.js");
@@ -59,23 +56,26 @@ function BuyScreen(props) {
59
56
  if (!supportedDestinationsQuery.data) {
60
57
  return (0, jsx_runtime_1.jsx)(LoadingScreen_js_1.LoadingScreen, {});
61
58
  }
62
- return ((0, jsx_runtime_1.jsx)(BuyScreenContent, { ...props, onViewPendingTx: props.onViewPendingTx, supportedDestinations: supportedDestinationsQuery.data, buyForTx: props.buyForTx }));
59
+ return ((0, jsx_runtime_1.jsx)(BuyScreenContent, { ...props, supportedDestinations: supportedDestinationsQuery.data }));
63
60
  }
64
61
  /**
65
62
  * @internal
66
63
  */
67
64
  function BuyScreenContent(props) {
68
- const { client, supportedDestinations, connectLocale, payOptions, buyForTx } = props;
65
+ const { client, supportedDestinations, connectLocale, payOptions } = props;
69
66
  const activeAccount = (0, useActiveAccount_js_1.useActiveAccount)();
70
67
  const { payer, setPayer } = (0, usePayerSetup_js_1.usePayerSetup)();
71
68
  const [screen, setScreen] = (0, react_1.useState)({
72
69
  id: "main",
73
70
  });
74
71
  const [hasEditedAmount, setHasEditedAmount] = (0, react_1.useState)(false);
72
+ const onDone = (0, react_1.useCallback)(() => {
73
+ setScreen({ id: "main" });
74
+ props.onDone();
75
+ }, [props.onDone]);
75
76
  // UI selection
76
77
  const { tokenAmount, setTokenAmount, toChain, setToChain, deferredTokenAmount, fromChain, setFromChain, toToken, setToToken, fromToken, setFromToken, selectedCurrency, setSelectedCurrency, } = (0, useUISelectionStates_js_1.useUISelectionStates)({
77
78
  payOptions,
78
- buyForTx,
79
79
  supportedDestinations,
80
80
  });
81
81
  // check if the screen is expanded or not
@@ -96,6 +96,15 @@ function BuyScreenContent(props) {
96
96
  }
97
97
  return createSupportedTokens(supportedSourcesQuery.data, payOptions, props.supportedTokens);
98
98
  }, [props.supportedTokens, supportedSourcesQuery.data, payOptions]);
99
+ const enabledPaymentMethods = (0, useEnabledPaymentMethods_js_1.useEnabledPaymentMethods)({
100
+ payOptions: props.payOptions,
101
+ supportedDestinations: props.supportedDestinations,
102
+ toChain: toChain,
103
+ toToken: toToken,
104
+ });
105
+ const payDisabled = enabledPaymentMethods.showPaymentSelection === false &&
106
+ enabledPaymentMethods.buyWithCryptoEnabled === false &&
107
+ enabledPaymentMethods.buyWithFiatEnabled === false;
99
108
  // screens ----------------------------
100
109
  if (screen.id === "connect-payer-wallet") {
101
110
  return ((0, jsx_runtime_1.jsx)(WalletSwitcherConnectionScreen_js_1.WalletSwitcherConnectionScreen, { accountAbstraction: props.connectOptions?.accountAbstraction, appMetadata: props.connectOptions?.appMetadata, chain: props.connectOptions?.chain, chains: props.connectOptions?.chains, client: props.client, connectLocale: props.connectLocale, isEmbed: props.isEmbed, onBack: () => setScreen(screen.backScreen), onSelect: (w) => {
@@ -111,23 +120,30 @@ function BuyScreenContent(props) {
111
120
  }, recommendedWallets: props.connectOptions?.recommendedWallets, showAllWallets: !!props.connectOptions?.showAllWallets, walletConnect: props.connectOptions?.walletConnect, wallets: props.connectOptions?.wallets }));
112
121
  }
113
122
  if (screen.id === "swap-flow" && payer) {
114
- return ((0, jsx_runtime_1.jsx)(SwapFlow_js_1.SwapFlow, { title: props.title, isBuyForTx: !!props.buyForTx, isEmbed: props.isEmbed, client: client, onBack: () => {
123
+ return ((0, jsx_runtime_1.jsx)(SwapFlow_js_1.SwapFlow, { title: props.title, transactionMode: payOptions.mode === "transaction", isEmbed: props.isEmbed, client: client, onBack: () => {
115
124
  setScreen({
116
125
  id: "buy-with-crypto",
117
126
  });
118
- }, buyWithCryptoQuote: screen.quote, payer: payer, onViewPendingTx: props.onViewPendingTx, isFiatFlow: false, onDone: props.onDone, onTryAgain: () => {
127
+ }, buyWithCryptoQuote: screen.quote, payer: payer, isFiatFlow: false, onDone: onDone, onTryAgain: () => {
119
128
  setScreen({
120
129
  id: "buy-with-crypto",
121
130
  });
122
131
  } }));
123
132
  }
124
133
  if (screen.id === "fiat-flow" && payer) {
125
- return ((0, jsx_runtime_1.jsx)(FiatFlow_js_1.FiatFlow, { title: props.title, isBuyForTx: !!props.buyForTx, quote: screen.quote, onBack: () => {
134
+ return ((0, jsx_runtime_1.jsx)(FiatFlow_js_1.FiatFlow, { title: props.title, transactionMode: payOptions.mode === "transaction", quote: screen.quote, onBack: () => {
126
135
  setScreen({
127
136
  id: "buy-with-fiat",
128
137
  });
129
138
  }, client: client, testMode: props.payOptions.buyWithFiat !== false &&
130
- props.payOptions.buyWithFiat?.testMode === true, theme: typeof props.theme === "string" ? props.theme : props.theme.type, onViewPendingTx: props.onViewPendingTx, openedWindow: screen.openedWindow, onDone: props.onDone, isEmbed: props.isEmbed, payer: payer }));
139
+ props.payOptions.buyWithFiat?.testMode === true, theme: typeof props.theme === "string" ? props.theme : props.theme.type, openedWindow: screen.openedWindow, onDone: onDone, isEmbed: props.isEmbed, payer: payer }));
140
+ }
141
+ if (screen.id === "transfer-flow" && payer && activeAccount) {
142
+ const goBack = () => setScreen({ id: "buy-with-crypto" });
143
+ // TODO (pay) pass it via screen props
144
+ const defaultRecipientAddress = props.payOptions?.paymentInfo?.sellerAddress;
145
+ const receiverAddress = defaultRecipientAddress || activeAccount.address;
146
+ return ((0, jsx_runtime_1.jsx)(TransferFlow_js_1.TransferFlow, { title: props.title, onBack: goBack, payer: payer, client: props.client, onDone: onDone, chain: toChain, token: toToken, tokenAmount: tokenAmount, receiverAddress: receiverAddress, transactionMode: props.payOptions.mode === "transaction" }));
131
147
  }
132
148
  if (screen.id === "select-currency") {
133
149
  const goBack = () => setScreen(screen.backScreen);
@@ -139,8 +155,10 @@ function BuyScreenContent(props) {
139
155
  if (screen.id === "select-to-token") {
140
156
  const chains = supportedDestinations.map((x) => x.chain);
141
157
  const goBack = () => setScreen(screen.backScreen);
158
+ const allowEdits = payOptions?.prefillBuy
159
+ ?.allowEdits;
142
160
  // if token selection is disabled - only show network selector screen
143
- if (payOptions.prefillBuy?.allowEdits?.token === false) {
161
+ if (allowEdits?.token === false) {
144
162
  return ((0, jsx_runtime_1.jsx)(ChainSelectionScreen, { chains: chains, client: props.client, connectLocale: props.connectLocale, setChain: setToChain, goBack: goBack }));
145
163
  }
146
164
  return ((0, jsx_runtime_1.jsx)(TokenSelector_js_1.TokenSelector, { onBack: goBack, tokenList: ((toChain?.id ? destinationSupportedTokens[toChain.id] : undefined) ||
@@ -149,7 +167,7 @@ function BuyScreenContent(props) {
149
167
  goBack();
150
168
  }, chain: toChain, chainSelection:
151
169
  // hide chain selection if it's disabled
152
- payOptions.prefillBuy?.allowEdits?.chain !== false
170
+ allowEdits?.chain !== false
153
171
  ? {
154
172
  chains: chains,
155
173
  select: (c) => {
@@ -182,25 +200,55 @@ function BuyScreenContent(props) {
182
200
  }
183
201
  : undefined, connectLocale: connectLocale, client: client, modalTitle: "Pay with" }));
184
202
  }
185
- return ((0, jsx_runtime_1.jsx)(basic_js_1.Container, { animate: "fadein", children: (0, jsx_runtime_1.jsxs)("div", { children: [screen.id === "main" && ((0, jsx_runtime_1.jsx)(MainScreen, { title: props.title, payerAccount: payer?.account, buyForTx: buyForTx, client: client, onSelectBuyToken: () => setScreen({ id: "select-to-token", backScreen: screen }), payOptions: payOptions, setTokenAmount: setTokenAmount, toChain: toChain, toToken: toToken, tokenAmount: tokenAmount, connectOptions: props.connectOptions, onViewPendingTx: props.onViewPendingTx, setScreen: setScreen, supportedDestinations: supportedDestinations, onBack: props.onBack, theme: props.theme, hasEditedAmount: hasEditedAmount, setHasEditedAmount: setHasEditedAmount })), (screen.id === "select-payment-method" ||
203
+ return ((0, jsx_runtime_1.jsx)(basic_js_1.Container, { animate: "fadein", children: (0, jsx_runtime_1.jsxs)("div", { children: [screen.id === "main" && ((0, jsx_runtime_1.jsx)(MainScreen, { title: props.title, payerAccount: payer?.account, client: client, onSelectBuyToken: () => setScreen({ id: "select-to-token", backScreen: screen }), payOptions: payOptions, setTokenAmount: setTokenAmount, setToChain: setToChain, setToToken: setToToken, setFromChain: setFromChain, setFromToken: setFromToken, toChain: toChain, toToken: toToken, tokenAmount: tokenAmount, connectOptions: props.connectOptions, setScreen: setScreen, supportedDestinations: supportedDestinations, onBack: props.onBack, theme: props.theme, hasEditedAmount: hasEditedAmount, setHasEditedAmount: setHasEditedAmount, enabledPaymentMethods: enabledPaymentMethods })), (screen.id === "select-payment-method" ||
204
+ screen.id === "select-wallet" ||
186
205
  screen.id === "buy-with-crypto" ||
187
206
  screen.id === "buy-with-fiat") &&
188
207
  payer && ((0, jsx_runtime_1.jsxs)(TokenSelectedLayout, { title: props.title, selectedChain: toChain, selectedToken: toToken, tokenAmount: tokenAmount, client: client, onBack: () => {
189
- if (screen.id === "buy-with-crypto" ||
190
- screen.id === "buy-with-fiat") {
208
+ if (enabledPaymentMethods.showPaymentSelection &&
209
+ (screen.id === "select-wallet" ||
210
+ screen.id === "buy-with-fiat")) {
191
211
  setScreen({ id: "select-payment-method" });
192
212
  }
193
- else if (screen.id === "select-payment-method") {
213
+ else if (screen.id === "buy-with-crypto") {
214
+ setScreen({ id: "select-wallet" });
215
+ }
216
+ else {
194
217
  setScreen({ id: "main" });
195
218
  }
196
- }, children: [screen.id === "select-payment-method" && ((0, jsx_runtime_1.jsx)(PaymentMethodSelection, { setScreen: (id) => setScreen({ id }) })), screen.id === "buy-with-crypto" && activeAccount && ((0, jsx_runtime_1.jsx)(SwapScreenContent, { setScreen: setScreen, tokenAmount: deferredTokenAmount, toChain: toChain, toToken: toToken, fromChain: fromChain, fromToken: fromToken, showFromTokenSelector: () => {
219
+ }, children: [screen.id === "select-payment-method" && ((0, jsx_runtime_1.jsx)(PaymentMethodSelection, { setScreen: (id) => setScreen({ id }) })), screen.id === "select-wallet" && ((0, jsx_runtime_1.jsx)(WalletSwitcherDrawerContent_js_1.WalletSwitcherDrawerContent, { client: client, onSelect: (w) => {
220
+ const chain = w.getChain();
221
+ const account = w.getAccount();
222
+ if (chain && account) {
223
+ setPayer({
224
+ account,
225
+ chain,
226
+ wallet: w,
227
+ });
228
+ setScreen({ id: "buy-with-crypto" });
229
+ }
230
+ }, showAllWallets: !!props.connectOptions?.showAllWallets, wallets: props.connectOptions?.wallets, onBack: () => {
231
+ // no-op
232
+ }, onConnect: () => {
233
+ setScreen({
234
+ id: "connect-payer-wallet",
235
+ backScreen: {
236
+ id: "select-wallet",
237
+ },
238
+ });
239
+ }, selectedAddress: payer.account.address })), screen.id === "buy-with-crypto" && activeAccount && ((0, jsx_runtime_1.jsx)(SwapScreenContent, { setScreen: setScreen, tokenAmount: deferredTokenAmount, toChain: toChain, toToken: toToken, fromChain: fromChain, fromToken: fromToken, showFromTokenSelector: () => {
197
240
  setScreen({
198
241
  id: "select-from-token",
199
242
  backScreen: screen,
200
243
  });
201
- }, payer: payer, buyForTx: buyForTx || null, client: client, isEmbed: props.isEmbed, onDone: props.onDone, onViewPendingTx: props.onViewPendingTx, payOptions: payOptions, connectLocale: connectLocale, connectOptions: props.connectOptions, setPayer: setPayer,
244
+ }, payer: payer, client: client, isEmbed: props.isEmbed, onDone: onDone, payOptions: payOptions, connectLocale: connectLocale, connectOptions: props.connectOptions, setPayer: setPayer,
202
245
  // pass it even though we are passing payer, because payer might be different
203
- activeAccount: activeAccount, setTokenAmount: setTokenAmount, setHasEditedAmount: setHasEditedAmount })), screen.id === "buy-with-fiat" && ((0, jsx_runtime_1.jsx)(FiatScreenContent, { setScreen: setScreen, tokenAmount: deferredTokenAmount, toChain: toChain, toToken: toToken, selectedCurrency: selectedCurrency, buyForTx: buyForTx || null, client: client, isEmbed: props.isEmbed, onDone: props.onDone, onViewPendingTx: props.onViewPendingTx, payOptions: payOptions, theme: props.theme, showCurrencySelector: () => {
246
+ activeAccount: activeAccount, setTokenAmount: setTokenAmount, setHasEditedAmount: setHasEditedAmount, disableTokenSelection: payDisabled === true ||
247
+ (payOptions.buyWithCrypto !== false &&
248
+ payOptions.buyWithCrypto?.prefillSource?.allowEdits
249
+ ?.chain === false &&
250
+ payOptions.buyWithCrypto?.prefillSource?.allowEdits
251
+ ?.token === false) })), screen.id === "buy-with-fiat" && ((0, jsx_runtime_1.jsx)(FiatScreenContent, { setScreen: setScreen, tokenAmount: deferredTokenAmount, toChain: toChain, toToken: toToken, selectedCurrency: selectedCurrency, client: client, isEmbed: props.isEmbed, onDone: onDone, payOptions: payOptions, theme: props.theme, showCurrencySelector: () => {
204
252
  setScreen({
205
253
  id: "select-currency",
206
254
  backScreen: screen,
@@ -213,48 +261,79 @@ function SelectedTokenInfo(props) {
213
261
  }, children: [(0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "row", gap: "xs", center: "y", children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "primaryText", "data-testid": "tokenAmount", size: "xl", children: (0, formatNumber_js_1.formatNumber)(Number(props.tokenAmount), 6) }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "row", gap: "xxs", center: "y", children: [(0, jsx_runtime_1.jsx)(TokenSymbol_js_1.TokenSymbol, { token: props.selectedToken, chain: props.selectedChain, size: "md", color: "secondaryText" }), (0, jsx_runtime_1.jsx)(PayTokenIcon_js_1.PayTokenIcon, { chain: props.selectedChain, client: props.client, size: "sm", token: props.selectedToken })] })] }), (0, jsx_runtime_1.jsx)(ChainName_js_1.ChainName, { chain: props.selectedChain, client: props.client, size: "sm", short: true })] }) }));
214
262
  }
215
263
  function MainScreen(props) {
216
- const { showPaymentSelection, buyWithCryptoEnabled, buyWithFiatEnabled } = (0, useEnabledPaymentMethods_js_1.useEnabledPaymentMethods)({
217
- payOptions: props.payOptions,
218
- supportedDestinations: props.supportedDestinations,
219
- toChain: props.toChain,
220
- toToken: props.toToken,
221
- });
222
- const { buyForTx, setTokenAmount, payerAccount, client, tokenAmount, payOptions, toToken, toChain, } = props;
223
- // Buy Transaction flow states
224
- const { amountNeeded } = (0, useBuyTxStates_js_1.useBuyTxStates)({
225
- setTokenAmount,
226
- buyForTx: buyForTx || null,
227
- hasEditedAmount: props.hasEditedAmount,
228
- account: payerAccount || null,
229
- });
264
+ const { setTokenAmount, setToChain, setToToken, setFromChain, setFromToken, payerAccount, client, tokenAmount, payOptions, toToken, toChain, supportedDestinations, enabledPaymentMethods, } = props;
265
+ const { showPaymentSelection, buyWithCryptoEnabled, buyWithFiatEnabled } = enabledPaymentMethods;
230
266
  const disableContinue = !tokenAmount;
231
- return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { p: "lg", children: [(0, jsx_runtime_1.jsx)(basic_js_1.ModalHeader, { title: props.buyForTx
232
- ? `Not enough ${props.buyForTx.tokenSymbol}`
233
- : props.title, onBack: props.onBack }), amountNeeded && props.buyForTx ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "lg" }), (0, jsx_runtime_1.jsx)(BuyForTxUI, { amountNeeded: String((0, formatNumber_js_1.formatNumber)(Number((0, units_js_1.toTokens)(amountNeeded, props.buyForTx.tokenDecimals)), 6)), buyForTx: props.buyForTx, client: client })] })) : ((0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xl" })), (0, jsx_runtime_1.jsx)(BuyTokenInput_js_1.BuyTokenInput, { value: tokenAmount, onChange: async (value) => {
234
- props.setHasEditedAmount(true);
235
- setTokenAmount(value);
236
- }, freezeAmount: payOptions.prefillBuy?.allowEdits?.amount === false, freezeChainAndToken: payOptions.prefillBuy?.allowEdits?.chain === false &&
237
- payOptions.prefillBuy?.allowEdits?.token === false, token: toToken, chain: toChain, onSelectToken: props.onSelectBuyToken, client: props.client, hideTokenSelector: !!props.buyForTx }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xl" }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "sm", children: [!payerAccount ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ConnectButton_js_1.ConnectButton, { ...props.connectOptions, client: props.client, theme: props.theme, connectButton: {
238
- style: {
239
- width: "100%",
240
- },
241
- } }) })) : ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "accent", fullWidth: true, disabled: disableContinue, "data-disabled": disableContinue, onClick: () => {
242
- if (showPaymentSelection) {
243
- props.setScreen({ id: "select-payment-method" });
244
- }
245
- else if (buyWithCryptoEnabled) {
246
- props.setScreen({ id: "buy-with-crypto" });
247
- }
248
- else if (buyWithFiatEnabled) {
249
- props.setScreen({ id: "buy-with-fiat" });
250
- }
251
- else {
252
- console.error("No payment method enabled");
253
- }
254
- }, children: "Continue" })), payerAccount && ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "outline", fullWidth: true, style: {
255
- padding: index_js_1.spacing.xs,
256
- fontSize: index_js_1.fontSize.sm,
257
- }, onClick: props.onViewPendingTx, children: "View all transactions" }))] })] }));
267
+ switch (payOptions.mode) {
268
+ case "transaction": {
269
+ return ((0, jsx_runtime_1.jsx)(TransactionModeScreen_js_1.TransactionModeScreen, { supportedDestinations: supportedDestinations, payUiOptions: payOptions, payerAccount: payerAccount, connectOptions: props.connectOptions, client: client, onContinue: (tokenAmount, toChain, toToken) => {
270
+ setTokenAmount(tokenAmount);
271
+ setToChain(toChain);
272
+ setFromChain(toChain);
273
+ setFromToken(toToken);
274
+ setToToken(toToken);
275
+ if (showPaymentSelection) {
276
+ props.setScreen({ id: "select-payment-method" });
277
+ }
278
+ else if (buyWithCryptoEnabled) {
279
+ props.setScreen({ id: "select-wallet" });
280
+ }
281
+ else if (buyWithFiatEnabled) {
282
+ props.setScreen({ id: "buy-with-fiat" });
283
+ }
284
+ else {
285
+ // default to buy with crypto with connected wallet if chain not supported by pay
286
+ props.setScreen({ id: "select-wallet" });
287
+ }
288
+ } }));
289
+ }
290
+ case "direct_payment": {
291
+ return ((0, jsx_runtime_1.jsx)(DirectPaymentModeScreen_js_1.DirectPaymentModeScreen, { client: client, payUiOptions: payOptions, payerAccount: payerAccount, connectOptions: props.connectOptions, supportedDestinations: supportedDestinations, onContinue: (tokenAmount, toChain, toToken) => {
292
+ setTokenAmount(tokenAmount);
293
+ setToChain(toChain);
294
+ setFromChain(toChain);
295
+ setFromToken(toToken);
296
+ setToToken(toToken);
297
+ if (showPaymentSelection) {
298
+ props.setScreen({ id: "select-payment-method" });
299
+ }
300
+ else if (buyWithCryptoEnabled) {
301
+ props.setScreen({ id: "buy-with-crypto" });
302
+ }
303
+ else if (buyWithFiatEnabled) {
304
+ props.setScreen({ id: "buy-with-fiat" });
305
+ }
306
+ else {
307
+ // default to buy with crypto with connected wallet if chain not supported by pay
308
+ props.setScreen({ id: "select-wallet" });
309
+ }
310
+ } }));
311
+ }
312
+ default: {
313
+ return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { p: "lg", children: [(0, jsx_runtime_1.jsx)(basic_js_1.ModalHeader, { title: props.title, onBack: props.onBack }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xl" }), (0, jsx_runtime_1.jsx)(BuyTokenInput_js_1.BuyTokenInput, { value: tokenAmount, onChange: async (value) => {
314
+ props.setHasEditedAmount(true);
315
+ setTokenAmount(value);
316
+ }, freezeAmount: payOptions.prefillBuy?.allowEdits?.amount === false, freezeChainAndToken: payOptions.prefillBuy?.allowEdits?.chain === false &&
317
+ payOptions.prefillBuy?.allowEdits?.token === false, token: toToken, chain: toChain, onSelectToken: props.onSelectBuyToken, client: props.client }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xl" }), (0, jsx_runtime_1.jsx)(basic_js_1.Container, { flex: "column", gap: "sm", children: !payerAccount ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ConnectButton_js_1.ConnectButton, { ...props.connectOptions, client: props.client, theme: props.theme, connectButton: {
318
+ style: {
319
+ width: "100%",
320
+ },
321
+ } }) })) : ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "accent", fullWidth: true, disabled: disableContinue, "data-disabled": disableContinue, onClick: () => {
322
+ if (showPaymentSelection) {
323
+ props.setScreen({ id: "select-payment-method" });
324
+ }
325
+ else if (buyWithCryptoEnabled) {
326
+ props.setScreen({ id: "buy-with-crypto" });
327
+ }
328
+ else if (buyWithFiatEnabled) {
329
+ props.setScreen({ id: "buy-with-fiat" });
330
+ }
331
+ else {
332
+ console.error("No payment method enabled");
333
+ }
334
+ }, children: "Continue" })) })] }));
335
+ }
336
+ }
258
337
  }
259
338
  function TokenSelectedLayout(props) {
260
339
  return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { children: [(0, jsx_runtime_1.jsx)(basic_js_1.Container, { p: "lg", children: (0, jsx_runtime_1.jsx)(basic_js_1.ModalHeader, { title: props.title, onBack: props.onBack }) }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { px: "lg", style: {
@@ -268,13 +347,14 @@ function PaymentMethodSelection(props) {
268
347
  }, children: [(0, jsx_runtime_1.jsx)(basic_js_1.Container, { color: "secondaryText", flex: "row", center: "both", children: (0, jsx_runtime_1.jsx)(react_icons_1.IdCardIcon, { style: {
269
348
  width: index_js_1.iconSize.md,
270
349
  height: index_js_1.iconSize.md,
271
- } }) }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "xxs", children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "md", color: "primaryText", children: "Credit Card" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "xs", children: "Easily and securely make payments" })] })] }), (0, jsx_runtime_1.jsxs)(buttons_js_1.Button, { variant: "outline", bg: "tertiaryBg", onClick: () => props.setScreen("buy-with-crypto"), style: {
350
+ } }) }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "xxs", children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "md", color: "primaryText", children: "Credit Card" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "xs", children: "Securely pay with credit card" })] })] }), (0, jsx_runtime_1.jsxs)(buttons_js_1.Button, { variant: "outline", bg: "tertiaryBg", onClick: () => props.setScreen("select-wallet"), style: {
272
351
  justifyContent: "flex-start",
273
- }, gap: "sm", children: [(0, jsx_runtime_1.jsx)(basic_js_1.Container, { color: "secondaryText", flex: "row", center: "both", children: (0, jsx_runtime_1.jsx)(CoinsIcon_js_1.CoinsIcon, { size: index_js_1.iconSize.md }) }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "xxs", children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "md", color: "primaryText", children: "Crypto" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "xs", children: "Pay with confidence using crypto" })] })] })] }) }));
352
+ }, gap: "sm", children: [(0, jsx_runtime_1.jsx)(basic_js_1.Container, { color: "secondaryText", flex: "row", center: "both", children: (0, jsx_runtime_1.jsx)(CoinsIcon_js_1.CoinsIcon, { size: index_js_1.iconSize.md }) }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "xxs", children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "md", color: "primaryText", children: "Crypto" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "xs", children: "Pay with your connected wallet" })] })] })] }) }));
274
353
  }
275
354
  function SwapScreenContent(props) {
276
- const { setScreen, payer, client, toChain, tokenAmount, toToken, fromChain, fromToken, showFromTokenSelector, payOptions, } = props;
277
- const [receiverAddress, setReceiverAddress] = (0, react_1.useState)(props.payOptions.recipientAddress || props.activeAccount.address);
355
+ const { setScreen, payer, client, toChain, tokenAmount, toToken, fromChain, fromToken, showFromTokenSelector, payOptions, disableTokenSelection, } = props;
356
+ const defaultRecipientAddress = props.payOptions?.paymentInfo?.sellerAddress;
357
+ const receiverAddress = defaultRecipientAddress || props.activeAccount.address;
278
358
  const { drawerRef, drawerOverlayRef, isOpen, setIsOpen } = (0, Drawer_js_1.useDrawer)();
279
359
  const [drawerScreen, setDrawerScreen] = (0, react_1.useState)("fees");
280
360
  const fromTokenBalanceQuery = (0, useWalletBalance_js_1.useWalletBalance)({
@@ -283,7 +363,15 @@ function SwapScreenContent(props) {
283
363
  tokenAddress: (0, nativeToken_js_1.isNativeToken)(fromToken) ? undefined : fromToken.address,
284
364
  client,
285
365
  });
286
- const quoteParams = tokenAmount && !(fromChain.id === toChain.id && fromToken === toToken)
366
+ const fromTokenId = (0, nativeToken_js_1.isNativeToken)(fromToken)
367
+ ? addresses_js_1.NATIVE_TOKEN_ADDRESS
368
+ : fromToken.address.toLowerCase();
369
+ const toTokenId = (0, nativeToken_js_1.isNativeToken)(toToken)
370
+ ? addresses_js_1.NATIVE_TOKEN_ADDRESS
371
+ : toToken.address.toLowerCase();
372
+ const swapRequired = !!tokenAmount &&
373
+ !(fromChain.id === toChain.id && fromTokenId === toTokenId);
374
+ const quoteParams = swapRequired
287
375
  ? {
288
376
  // wallets
289
377
  fromAddress: payer.account.address,
@@ -309,11 +397,13 @@ function SwapScreenContent(props) {
309
397
  refetchInterval: 30 * 1000,
310
398
  gcTime: 30 * 1000,
311
399
  });
312
- const sourceTokenAmount = quoteQuery.data?.swapDetails.fromAmount;
400
+ const sourceTokenAmount = swapRequired
401
+ ? quoteQuery.data?.swapDetails.fromAmount
402
+ : tokenAmount;
313
403
  const isNotEnoughBalance = !!sourceTokenAmount &&
314
404
  !!fromTokenBalanceQuery.data &&
315
405
  Number(fromTokenBalanceQuery.data.displayValue) < Number(sourceTokenAmount);
316
- const disableContinue = !quoteQuery.data || isNotEnoughBalance;
406
+ const disableContinue = (swapRequired && !quoteQuery.data) || isNotEnoughBalance;
317
407
  const switchChainRequired = props.payer.chain.id !== fromChain.id;
318
408
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
319
409
  function getErrorMessage(err) {
@@ -336,6 +426,22 @@ function SwapScreenContent(props) {
336
426
  ? getErrorMessage(quoteQuery.error)
337
427
  : undefined;
338
428
  function showSwapFlow() {
429
+ if ((props.payOptions.mode === "transaction" ||
430
+ props.payOptions.mode === "direct_payment") &&
431
+ !isNotEnoughBalance &&
432
+ !swapRequired) {
433
+ if (payer.account.address !== receiverAddress) {
434
+ // same currency, just transfer, but from another wallet
435
+ setScreen({
436
+ id: "transfer-flow",
437
+ });
438
+ }
439
+ else {
440
+ // has enough balance to just do the transaction directly
441
+ props.onDone();
442
+ }
443
+ return;
444
+ }
339
445
  if (!quoteQuery.data) {
340
446
  return;
341
447
  }
@@ -351,40 +457,12 @@ function SwapScreenContent(props) {
351
457
  setIsOpen(true);
352
458
  setDrawerScreen("fees");
353
459
  }
354
- const prefillSource = payOptions.buyWithCrypto !== false
355
- ? payOptions.buyWithCrypto?.prefillSource
356
- : undefined;
357
- const disableReceiverSelection = !!props.payOptions.recipientAddress;
358
- return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "md", animate: "fadein", children: [isOpen && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Drawer_js_1.DrawerOverlay, { ref: drawerOverlayRef }), (0, jsx_runtime_1.jsxs)(Drawer_js_1.Drawer, { ref: drawerRef, close: () => setIsOpen(false), children: [drawerScreen === "fees" && quoteQuery.data && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "lg", color: "primaryText", children: "Fees" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "lg" }), (0, jsx_runtime_1.jsx)(Fees_js_1.SwapFees, { quote: quoteQuery.data, align: "left" })] })), drawerScreen === "receiver" && ((0, jsx_runtime_1.jsx)(ReceiverWalletSelectionScreen_js_1.ReceiverWalletDrawerScreen, { client: props.client, onSelect: (x) => setReceiverAddress(x), receiverAddress: receiverAddress, onBack: () => setIsOpen(false) })), drawerScreen === "payer" && ((0, jsx_runtime_1.jsx)(WalletSwitcherDrawerContent_js_1.WalletSwitcherDrawerContent, { client: client, onSelect: (w) => {
359
- const chain = w.getChain();
360
- const account = w.getAccount();
361
- if (chain && account) {
362
- props.setPayer({
363
- account,
364
- chain,
365
- wallet: w,
366
- });
367
- }
368
- }, showAllWallets: !!props.connectOptions?.showAllWallets, wallets: props.connectOptions?.wallets, onBack: () => {
369
- setIsOpen(false);
370
- }, onConnect: () => {
371
- setScreen({
372
- id: "connect-payer-wallet",
373
- backScreen: {
374
- id: "buy-with-crypto",
375
- },
376
- });
377
- }, selectedAddress: payer.account.address }))] })] })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(WalletSelectorButton_js_1.WalletSelectorButton, { client: props.client, onClick: () => {
378
- setIsOpen(true);
379
- setDrawerScreen("payer");
460
+ return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "md", animate: "fadein", children: [isOpen && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Drawer_js_1.DrawerOverlay, { ref: drawerOverlayRef }), (0, jsx_runtime_1.jsx)(Drawer_js_1.Drawer, { ref: drawerRef, close: () => setIsOpen(false), children: drawerScreen === "fees" && quoteQuery.data && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "lg", color: "primaryText", children: "Fees" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "lg" }), (0, jsx_runtime_1.jsx)(Fees_js_1.SwapFees, { quote: quoteQuery.data, align: "left" })] })) })] })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(WalletSelectorButton_js_1.WalletSelectorButton, { client: props.client, onClick: () => {
461
+ setScreen({ id: "select-wallet" });
380
462
  }, address: props.payer.account.address, walletId: props.payer.wallet.id, containerStyle: {
381
463
  borderBottomRightRadius: 0,
382
464
  borderBottomLeftRadius: 0,
383
- } }), (0, jsx_runtime_1.jsx)(PayWithCrypto_js_1.PayWithCrypto, { value: sourceTokenAmount || "", onSelectToken: showFromTokenSelector, chain: fromChain, token: fromToken, isLoading: quoteQuery.isLoading && !sourceTokenAmount, client: client, freezeChainAndTokenSelection: prefillSource?.allowEdits?.chain === false &&
384
- prefillSource?.allowEdits?.token === false, payerAccount: props.payer.account }), (0, jsx_runtime_1.jsx)(EstimatedTimeAndFees_js_1.EstimatedTimeAndFees, { quoteIsLoading: quoteQuery.isLoading, estimatedSeconds: quoteQuery.data?.swapDetails.estimated.durationSeconds, onViewFees: showFees }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "sm", children: "Send to" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xs" }), (0, jsx_runtime_1.jsx)(WalletSelectorButton_js_1.WalletSelectorButton, { client: props.client, disabled: disableReceiverSelection, disableChevron: disableReceiverSelection, onClick: () => {
385
- setIsOpen(true);
386
- setDrawerScreen("receiver");
387
- }, address: receiverAddress, walletId: undefined })] }), errorMsg && ((0, jsx_runtime_1.jsxs)("div", { children: [errorMsg.minAmount && ((0, jsx_runtime_1.jsxs)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: ["Minimum amount is ", errorMsg.minAmount, " ", (0, jsx_runtime_1.jsx)(TokenSymbol_js_1.TokenSymbol, { token: toToken, chain: toChain, size: "sm", inline: true, color: "danger" })] })), errorMsg.msg?.map((msg) => ((0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: msg }, msg)))] })), errorMsg?.minAmount ? ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "accent", fullWidth: true, onClick: () => {
465
+ } }), (0, jsx_runtime_1.jsx)(PayWithCrypto_js_1.PayWithCrypto, { value: sourceTokenAmount || "", onSelectToken: showFromTokenSelector, chain: fromChain, token: fromToken, isLoading: quoteQuery.isLoading && !sourceTokenAmount, client: client, freezeChainAndTokenSelection: disableTokenSelection, payerAccount: props.payer.account, swapRequired: swapRequired }), swapRequired && ((0, jsx_runtime_1.jsx)(EstimatedTimeAndFees_js_1.EstimatedTimeAndFees, { quoteIsLoading: quoteQuery.isLoading, estimatedSeconds: quoteQuery.data?.swapDetails.estimated.durationSeconds, onViewFees: showFees })), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" })] }), errorMsg && ((0, jsx_runtime_1.jsxs)("div", { children: [errorMsg.minAmount && ((0, jsx_runtime_1.jsxs)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: ["Minimum amount is ", errorMsg.minAmount, " ", (0, jsx_runtime_1.jsx)(TokenSymbol_js_1.TokenSymbol, { token: toToken, chain: toChain, size: "sm", inline: true, color: "danger" })] })), errorMsg.msg?.map((msg) => ((0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: msg }, msg)))] })), !errorMsg && isNotEnoughBalance && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: "Not enough funds." }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: "Try a different wallet or token." })] })), errorMsg?.minAmount ? ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "accent", fullWidth: true, onClick: () => {
388
466
  props.setTokenAmount(String(errorMsg.minAmount));
389
467
  props.setHasEditedAmount(true);
390
468
  }, children: "Set Minimum" })) : switchChainRequired &&
@@ -396,11 +474,12 @@ function SwapScreenContent(props) {
396
474
  if (!disableContinue) {
397
475
  showSwapFlow();
398
476
  }
399
- }, gap: "xs", children: isNotEnoughBalance ? ((0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "danger", children: "Not Enough Funds" })) : quoteQuery.isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Getting price quote", (0, jsx_runtime_1.jsx)(Spinner_js_1.Spinner, { size: "sm", color: "accentText" })] })) : ("Continue") }))] }));
477
+ }, gap: "xs", children: quoteQuery.isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Getting price quote", (0, jsx_runtime_1.jsx)(Spinner_js_1.Spinner, { size: "sm", color: "accentText" })] })) : ("Continue") }))] }));
400
478
  }
401
479
  function FiatScreenContent(props) {
402
480
  const { toToken, tokenAmount, payer, client, setScreen, toChain, showCurrencySelector, selectedCurrency, } = props;
403
- const [receiverAddress, setReceiverAddress] = (0, react_1.useState)(props.payOptions.recipientAddress || props.payer.account.address);
481
+ const defaultRecipientAddress = props.payOptions?.paymentInfo?.sellerAddress;
482
+ const receiverAddress = defaultRecipientAddress || props.payer.account.address;
404
483
  const { drawerRef, drawerOverlayRef, isOpen, setIsOpen } = (0, Drawer_js_1.useDrawer)();
405
484
  const [drawerScreen, setDrawerScreen] = (0, react_1.useState)("fees");
406
485
  const buyWithFiatOptions = props.payOptions.buyWithFiat;
@@ -463,32 +542,19 @@ function FiatScreenContent(props) {
463
542
  };
464
543
  }
465
544
  const disableSubmit = !fiatQuoteQuery.data;
466
- const disableReceiverSelection = !!props.payOptions.recipientAddress;
467
545
  const errorMsg = !fiatQuoteQuery.isLoading && fiatQuoteQuery.error
468
546
  ? getErrorMessage(fiatQuoteQuery.error)
469
547
  : undefined;
470
- return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "md", animate: "fadein", children: [isOpen && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Drawer_js_1.DrawerOverlay, { ref: drawerOverlayRef }), (0, jsx_runtime_1.jsxs)(Drawer_js_1.Drawer, { ref: drawerRef, close: () => setIsOpen(false), children: [drawerScreen === "fees" && fiatQuoteQuery.data && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "lg", color: "primaryText", children: "Fees" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "lg" }), (0, jsx_runtime_1.jsx)(Fees_js_1.FiatFees, { quote: fiatQuoteQuery.data })] })), drawerScreen === "receiver" && ((0, jsx_runtime_1.jsx)(ReceiverWalletSelectionScreen_js_1.ReceiverWalletDrawerScreen, { client: props.client, onSelect: (x) => setReceiverAddress(x), receiverAddress: receiverAddress, onBack: () => setIsOpen(false) }))] })] })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(PayWIthCreditCard_js_1.PayWithCreditCard, { isLoading: fiatQuoteQuery.isLoading, value: fiatQuoteQuery.data?.fromCurrencyWithFees.amount, client: client, currency: selectedCurrency, onSelectCurrency: showCurrencySelector }), (0, jsx_runtime_1.jsx)(EstimatedTimeAndFees_js_1.EstimatedTimeAndFees, { quoteIsLoading: fiatQuoteQuery.isLoading, estimatedSeconds: fiatQuoteQuery.data?.estimatedDurationSeconds, onViewFees: showFees }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "sm", children: "Send to" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xs" }), (0, jsx_runtime_1.jsx)(WalletSelectorButton_js_1.WalletSelectorButton, { client: props.client, onClick: () => {
471
- setDrawerScreen("receiver");
472
- setIsOpen(true);
473
- }, address: receiverAddress, disabled: disableReceiverSelection, disableChevron: disableReceiverSelection, walletId: undefined })] }), errorMsg && ((0, jsx_runtime_1.jsxs)("div", { children: [errorMsg.minAmount && ((0, jsx_runtime_1.jsxs)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: ["Minimum amount is ", errorMsg.minAmount, " ", (0, jsx_runtime_1.jsx)(TokenSymbol_js_1.TokenSymbol, { token: toToken, chain: toChain, size: "sm", inline: true, color: "danger" })] })), errorMsg.msg?.map((msg) => ((0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: msg }, msg)))] })), errorMsg?.minAmount ? ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "accent", fullWidth: true, onClick: () => {
548
+ return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", gap: "md", animate: "fadein", children: [isOpen && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Drawer_js_1.DrawerOverlay, { ref: drawerOverlayRef }), (0, jsx_runtime_1.jsx)(Drawer_js_1.Drawer, { ref: drawerRef, close: () => setIsOpen(false), children: drawerScreen === "fees" && fiatQuoteQuery.data && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "lg", color: "primaryText", children: "Fees" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "lg" }), (0, jsx_runtime_1.jsx)(Fees_js_1.FiatFees, { quote: fiatQuoteQuery.data })] })) })] })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(PayWIthCreditCard_js_1.PayWithCreditCard, { isLoading: fiatQuoteQuery.isLoading, value: fiatQuoteQuery.data?.fromCurrencyWithFees.amount, client: client, currency: selectedCurrency, onSelectCurrency: showCurrencySelector }), (0, jsx_runtime_1.jsx)(EstimatedTimeAndFees_js_1.EstimatedTimeAndFees, { quoteIsLoading: fiatQuoteQuery.isLoading, estimatedSeconds: fiatQuoteQuery.data?.estimatedDurationSeconds, onViewFees: showFees }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" })] }), errorMsg && ((0, jsx_runtime_1.jsxs)("div", { children: [errorMsg.minAmount && ((0, jsx_runtime_1.jsxs)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: ["Minimum amount is ", errorMsg.minAmount, " ", (0, jsx_runtime_1.jsx)(TokenSymbol_js_1.TokenSymbol, { token: toToken, chain: toChain, size: "sm", inline: true, color: "danger" })] })), errorMsg.msg?.map((msg) => ((0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "danger", size: "sm", center: true, multiline: true, children: msg }, msg)))] })), errorMsg?.minAmount ? ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "accent", fullWidth: true, onClick: () => {
474
549
  props.setTokenAmount(String(errorMsg.minAmount));
475
550
  props.setHasEditedAmount(true);
476
551
  }, children: "Set Minimum" })) : ((0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: disableSubmit ? "outline" : "accent", "data-disabled": disableSubmit, disabled: disableSubmit, fullWidth: true, onClick: handleSubmit, gap: "xs", children: fiatQuoteQuery.isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Getting price quote", (0, jsx_runtime_1.jsx)(Spinner_js_1.Spinner, { size: "sm", color: "accentText" })] })) : ("Continue") }))] }));
477
552
  }
478
- function BuyForTxUI(props) {
479
- const chainNameQuery = (0, useChainQuery_js_1.useChainName)(props.buyForTx.tx.chain);
480
- return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xs" }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "row", style: {
481
- justifyContent: "space-between",
482
- }, children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "sm", children: "Amount Needed" }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "column", style: {
483
- alignItems: "flex-end",
484
- }, children: [(0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "row", gap: "xs", center: "y", children: [(0, jsx_runtime_1.jsxs)(text_js_1.Text, { color: "primaryText", size: "sm", children: [props.amountNeeded, " ", props.buyForTx.tokenSymbol] }), (0, jsx_runtime_1.jsx)(TokenIcon_js_1.TokenIcon, { chain: props.buyForTx.tx.chain, client: props.client, size: "sm", token: nativeToken_js_1.NATIVE_TOKEN })] }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xxs" }), chainNameQuery.name ? ((0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "sm", children: chainNameQuery.name })) : ((0, jsx_runtime_1.jsx)(Skeleton_js_1.Skeleton, { height: index_js_1.fontSize.sm, width: "50px" }))] })] }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(basic_js_1.Line, {}), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "row", style: {
485
- justifyContent: "space-between",
486
- }, children: [(0, jsx_runtime_1.jsx)(text_js_1.Text, { size: "sm", children: "Your Balance" }), (0, jsx_runtime_1.jsxs)(basic_js_1.Container, { flex: "row", gap: "xs", children: [(0, jsx_runtime_1.jsxs)(text_js_1.Text, { color: "primaryText", size: "sm", children: [(0, formatNumber_js_1.formatNumber)(Number((0, units_js_1.toEther)(props.buyForTx.balance)), 6), " ", props.buyForTx.tokenSymbol] }), (0, jsx_runtime_1.jsx)(TokenIcon_js_1.TokenIcon, { chain: props.buyForTx.tx.chain, client: props.client, size: "sm", token: nativeToken_js_1.NATIVE_TOKEN })] })] }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(basic_js_1.Line, {}), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xl" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { center: true, size: "sm", children: "Purchase" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xxs" })] }));
487
- }
488
553
  function createSupportedTokens(data, payOptions, supportedTokensOverrides) {
489
554
  const tokens = {};
490
555
  const isBuyWithFiatDisabled = payOptions.buyWithFiat === false;
491
556
  const isBuyWithCryptoDisabled = payOptions.buyWithCrypto === false;
557
+ // FIXME (pay) when buywithFiat is disabled, missing a bunch of tokens on base??
492
558
  for (const x of data) {
493
559
  tokens[x.chain.id] = x.tokens.filter((t) => {
494
560
  // it token supports both - include it