thirdweb 5.108.6 → 5.108.8

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 (391) hide show
  1. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  2. package/dist/cjs/react/core/hooks/usePaymentMethods.js +1 -2
  3. package/dist/cjs/react/core/hooks/usePaymentMethods.js.map +1 -1
  4. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +1 -1
  5. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  6. package/dist/cjs/react/web/ui/Bridge/BuyWidget.js +185 -99
  7. package/dist/cjs/react/web/ui/Bridge/BuyWidget.js.map +1 -1
  8. package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js +210 -56
  9. package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
  10. package/dist/cjs/react/web/ui/Bridge/DirectPayment.js +7 -7
  11. package/dist/cjs/react/web/ui/Bridge/DirectPayment.js.map +1 -1
  12. package/dist/cjs/react/web/ui/Bridge/FundWallet.js +233 -105
  13. package/dist/cjs/react/web/ui/Bridge/FundWallet.js.map +1 -1
  14. package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js +1 -7
  15. package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js.map +1 -1
  16. package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js +16 -12
  17. package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
  18. package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js +199 -36
  19. package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
  20. package/dist/cjs/react/web/ui/Bridge/bridge-widget/bridge-widget.js +2 -2
  21. package/dist/cjs/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -1
  22. package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js +4 -5
  23. package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js.map +1 -1
  24. package/dist/cjs/react/web/ui/Bridge/common/active-wallet-details.js +52 -0
  25. package/dist/cjs/react/web/ui/Bridge/common/active-wallet-details.js.map +1 -0
  26. package/dist/cjs/react/web/ui/Bridge/common/decimal-input.js +36 -0
  27. package/dist/cjs/react/web/ui/Bridge/common/decimal-input.js.map +1 -0
  28. package/dist/cjs/react/web/ui/Bridge/common/selected-token-button.js +58 -0
  29. package/dist/cjs/react/web/ui/Bridge/common/selected-token-button.js.map +1 -0
  30. package/dist/cjs/react/web/ui/Bridge/common/token-balance.js +20 -0
  31. package/dist/cjs/react/web/ui/Bridge/common/token-balance.js.map +1 -0
  32. package/dist/cjs/react/web/ui/Bridge/common/token-query.js +34 -0
  33. package/dist/cjs/react/web/ui/Bridge/common/token-query.js.map +1 -0
  34. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js +3 -3
  35. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
  36. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js +7 -7
  37. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
  38. package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js +1 -4
  39. package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
  40. package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
  41. package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js +3 -3
  42. package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
  43. package/dist/cjs/react/web/ui/Bridge/swap-widget/SwapWidget.js +8 -11
  44. package/dist/cjs/react/web/ui/Bridge/swap-widget/SwapWidget.js.map +1 -1
  45. package/dist/cjs/react/web/ui/Bridge/swap-widget/swap-ui.js +19 -147
  46. package/dist/cjs/react/web/ui/Bridge/swap-widget/swap-ui.js.map +1 -1
  47. package/dist/cjs/react/web/ui/Bridge/types.js +3 -0
  48. package/dist/cjs/react/web/ui/Bridge/types.js.map +1 -0
  49. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +4 -2
  50. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  51. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +1 -1
  52. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
  53. package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
  54. package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js +1 -1
  55. package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
  56. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +17 -10
  57. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  58. package/dist/cjs/react/web/ui/components/CopyIcon.js +1 -1
  59. package/dist/cjs/react/web/ui/components/CopyIcon.js.map +1 -1
  60. package/dist/cjs/stories/Bridge/CheckoutWidget.stories.js +115 -0
  61. package/dist/cjs/stories/Bridge/CheckoutWidget.stories.js.map +1 -0
  62. package/dist/cjs/stories/Bridge/ErrorBanner.stories.js +7 -111
  63. package/dist/cjs/stories/Bridge/ErrorBanner.stories.js.map +1 -1
  64. package/dist/cjs/stories/Bridge/PaymentDetails.stories.js +27 -306
  65. package/dist/cjs/stories/Bridge/PaymentDetails.stories.js.map +1 -1
  66. package/dist/cjs/stories/Bridge/PaymentSelection.stories.js +21 -128
  67. package/dist/cjs/stories/Bridge/PaymentSelection.stories.js.map +1 -1
  68. package/dist/cjs/stories/Bridge/StepRunner.stories.js +13 -39
  69. package/dist/cjs/stories/Bridge/StepRunner.stories.js.map +1 -1
  70. package/dist/cjs/stories/Bridge/SuccessScreen.stories.js +13 -101
  71. package/dist/cjs/stories/Bridge/SuccessScreen.stories.js.map +1 -1
  72. package/dist/cjs/stories/Bridge/Transaction/TransactionWidget.stories.js +49 -0
  73. package/dist/cjs/stories/Bridge/Transaction/TransactionWidget.stories.js.map +1 -0
  74. package/dist/cjs/stories/Bridge/Transaction/useSendTransactionModal.stories.js +53 -0
  75. package/dist/cjs/stories/Bridge/Transaction/useSendTransactionModal.stories.js.map +1 -0
  76. package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js +11 -79
  77. package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -1
  78. package/dist/cjs/stories/Bridge/fixtures.js +21 -62
  79. package/dist/cjs/stories/Bridge/fixtures.js.map +1 -1
  80. package/dist/cjs/stories/BuyWidget.stories.js +44 -8
  81. package/dist/cjs/stories/BuyWidget.stories.js.map +1 -1
  82. package/dist/cjs/stories/utils.js +5 -2
  83. package/dist/cjs/stories/utils.js.map +1 -1
  84. package/dist/cjs/version.js +1 -1
  85. package/dist/cjs/x402/common.js +3 -5
  86. package/dist/cjs/x402/common.js.map +1 -1
  87. package/dist/cjs/x402/facilitator.js +3 -4
  88. package/dist/cjs/x402/facilitator.js.map +1 -1
  89. package/dist/cjs/x402/schemas.js +4 -0
  90. package/dist/cjs/x402/schemas.js.map +1 -1
  91. package/dist/cjs/x402/settle-payment.js +6 -5
  92. package/dist/cjs/x402/settle-payment.js.map +1 -1
  93. package/dist/cjs/x402/sign.js +2 -6
  94. package/dist/cjs/x402/sign.js.map +1 -1
  95. package/dist/cjs/x402/types.js.map +1 -1
  96. package/dist/cjs/x402/verify-payment.js +6 -5
  97. package/dist/cjs/x402/verify-payment.js.map +1 -1
  98. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  99. package/dist/esm/react/core/hooks/usePaymentMethods.js +1 -2
  100. package/dist/esm/react/core/hooks/usePaymentMethods.js.map +1 -1
  101. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +1 -1
  102. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  103. package/dist/esm/react/web/ui/Bridge/BuyWidget.js +185 -99
  104. package/dist/esm/react/web/ui/Bridge/BuyWidget.js.map +1 -1
  105. package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js +211 -57
  106. package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js.map +1 -1
  107. package/dist/esm/react/web/ui/Bridge/DirectPayment.js +7 -7
  108. package/dist/esm/react/web/ui/Bridge/DirectPayment.js.map +1 -1
  109. package/dist/esm/react/web/ui/Bridge/FundWallet.js +237 -109
  110. package/dist/esm/react/web/ui/Bridge/FundWallet.js.map +1 -1
  111. package/dist/esm/react/web/ui/Bridge/QuoteLoader.js +1 -7
  112. package/dist/esm/react/web/ui/Bridge/QuoteLoader.js.map +1 -1
  113. package/dist/esm/react/web/ui/Bridge/TransactionPayment.js +16 -12
  114. package/dist/esm/react/web/ui/Bridge/TransactionPayment.js.map +1 -1
  115. package/dist/esm/react/web/ui/Bridge/TransactionWidget.js +198 -36
  116. package/dist/esm/react/web/ui/Bridge/TransactionWidget.js.map +1 -1
  117. package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js +2 -2
  118. package/dist/esm/react/web/ui/Bridge/bridge-widget/bridge-widget.js.map +1 -1
  119. package/dist/esm/react/web/ui/Bridge/common/WithHeader.js +4 -5
  120. package/dist/esm/react/web/ui/Bridge/common/WithHeader.js.map +1 -1
  121. package/dist/esm/react/web/ui/Bridge/common/active-wallet-details.js +49 -0
  122. package/dist/esm/react/web/ui/Bridge/common/active-wallet-details.js.map +1 -0
  123. package/dist/esm/react/web/ui/Bridge/common/decimal-input.js +33 -0
  124. package/dist/esm/react/web/ui/Bridge/common/decimal-input.js.map +1 -0
  125. package/dist/esm/react/web/ui/Bridge/common/selected-token-button.js +55 -0
  126. package/dist/esm/react/web/ui/Bridge/common/selected-token-button.js.map +1 -0
  127. package/dist/esm/react/web/ui/Bridge/common/token-balance.js +17 -0
  128. package/dist/esm/react/web/ui/Bridge/common/token-balance.js.map +1 -0
  129. package/dist/esm/react/web/ui/Bridge/common/token-query.js +31 -0
  130. package/dist/esm/react/web/ui/Bridge/common/token-query.js.map +1 -0
  131. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js +3 -3
  132. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -1
  133. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js +7 -7
  134. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -1
  135. package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js +1 -4
  136. package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -1
  137. package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
  138. package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js +3 -3
  139. package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -1
  140. package/dist/esm/react/web/ui/Bridge/swap-widget/SwapWidget.js +8 -11
  141. package/dist/esm/react/web/ui/Bridge/swap-widget/SwapWidget.js.map +1 -1
  142. package/dist/esm/react/web/ui/Bridge/swap-widget/swap-ui.js +16 -144
  143. package/dist/esm/react/web/ui/Bridge/swap-widget/swap-ui.js.map +1 -1
  144. package/dist/esm/react/web/ui/Bridge/types.js +2 -0
  145. package/dist/esm/react/web/ui/Bridge/types.js.map +1 -0
  146. package/dist/esm/react/web/ui/ConnectWallet/Details.js +4 -2
  147. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  148. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +1 -1
  149. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
  150. package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
  151. package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js +1 -1
  152. package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
  153. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +17 -10
  154. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  155. package/dist/esm/react/web/ui/components/CopyIcon.js +1 -1
  156. package/dist/esm/react/web/ui/components/CopyIcon.js.map +1 -1
  157. package/dist/esm/stories/Bridge/CheckoutWidget.stories.js +112 -0
  158. package/dist/esm/stories/Bridge/CheckoutWidget.stories.js.map +1 -0
  159. package/dist/esm/stories/Bridge/ErrorBanner.stories.js +7 -111
  160. package/dist/esm/stories/Bridge/ErrorBanner.stories.js.map +1 -1
  161. package/dist/esm/stories/Bridge/PaymentDetails.stories.js +28 -307
  162. package/dist/esm/stories/Bridge/PaymentDetails.stories.js.map +1 -1
  163. package/dist/esm/stories/Bridge/PaymentSelection.stories.js +22 -129
  164. package/dist/esm/stories/Bridge/PaymentSelection.stories.js.map +1 -1
  165. package/dist/esm/stories/Bridge/StepRunner.stories.js +12 -38
  166. package/dist/esm/stories/Bridge/StepRunner.stories.js.map +1 -1
  167. package/dist/esm/stories/Bridge/SuccessScreen.stories.js +14 -102
  168. package/dist/esm/stories/Bridge/SuccessScreen.stories.js.map +1 -1
  169. package/dist/esm/stories/Bridge/Transaction/TransactionWidget.stories.js +46 -0
  170. package/dist/esm/stories/Bridge/Transaction/TransactionWidget.stories.js.map +1 -0
  171. package/dist/esm/stories/Bridge/Transaction/useSendTransactionModal.stories.js +50 -0
  172. package/dist/esm/stories/Bridge/Transaction/useSendTransactionModal.stories.js.map +1 -0
  173. package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js +12 -80
  174. package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -1
  175. package/dist/esm/stories/Bridge/fixtures.js +15 -56
  176. package/dist/esm/stories/Bridge/fixtures.js.map +1 -1
  177. package/dist/esm/stories/BuyWidget.stories.js +37 -9
  178. package/dist/esm/stories/BuyWidget.stories.js.map +1 -1
  179. package/dist/esm/stories/utils.js +6 -3
  180. package/dist/esm/stories/utils.js.map +1 -1
  181. package/dist/esm/version.js +1 -1
  182. package/dist/esm/x402/common.js +3 -5
  183. package/dist/esm/x402/common.js.map +1 -1
  184. package/dist/esm/x402/facilitator.js +3 -4
  185. package/dist/esm/x402/facilitator.js.map +1 -1
  186. package/dist/esm/x402/schemas.js +5 -1
  187. package/dist/esm/x402/schemas.js.map +1 -1
  188. package/dist/esm/x402/settle-payment.js +6 -5
  189. package/dist/esm/x402/settle-payment.js.map +1 -1
  190. package/dist/esm/x402/sign.js +2 -6
  191. package/dist/esm/x402/sign.js.map +1 -1
  192. package/dist/esm/x402/types.js.map +1 -1
  193. package/dist/esm/x402/verify-payment.js +6 -5
  194. package/dist/esm/x402/verify-payment.js.map +1 -1
  195. package/dist/scripts/bridge-widget.d.ts +3 -3
  196. package/dist/scripts/bridge-widget.js +113 -150
  197. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +6 -0
  198. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  199. package/dist/types/react/core/hooks/usePaymentMethods.d.ts +1 -2
  200. package/dist/types/react/core/hooks/usePaymentMethods.d.ts.map +1 -1
  201. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  202. package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts +7 -12
  203. package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts.map +1 -1
  204. package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts +5 -8
  205. package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts.map +1 -1
  206. package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts +15 -12
  207. package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts.map +1 -1
  208. package/dist/types/react/web/ui/Bridge/FundWallet.d.ts +33 -15
  209. package/dist/types/react/web/ui/Bridge/FundWallet.d.ts.map +1 -1
  210. package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts +9 -12
  211. package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts.map +1 -1
  212. package/dist/types/react/web/ui/Bridge/StepRunner.d.ts +7 -7
  213. package/dist/types/react/web/ui/Bridge/StepRunner.d.ts.map +1 -1
  214. package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts +14 -7
  215. package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts.map +1 -1
  216. package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts +3 -5
  217. package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts.map +1 -1
  218. package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts +4 -3
  219. package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts.map +1 -1
  220. package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts +3 -3
  221. package/dist/types/react/web/ui/Bridge/bridge-widget/bridge-widget.d.ts.map +1 -1
  222. package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts +4 -4
  223. package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts.map +1 -1
  224. package/dist/types/react/web/ui/Bridge/common/active-wallet-details.d.ts +8 -0
  225. package/dist/types/react/web/ui/Bridge/common/active-wallet-details.d.ts.map +1 -0
  226. package/dist/types/react/web/ui/Bridge/common/decimal-input.d.ts +6 -0
  227. package/dist/types/react/web/ui/Bridge/common/decimal-input.d.ts.map +1 -0
  228. package/dist/types/react/web/ui/Bridge/common/selected-token-button.d.ts +13 -0
  229. package/dist/types/react/web/ui/Bridge/common/selected-token-button.d.ts.map +1 -0
  230. package/dist/types/react/web/ui/Bridge/common/token-balance.d.ts +8 -0
  231. package/dist/types/react/web/ui/Bridge/common/token-balance.d.ts.map +1 -0
  232. package/dist/types/react/web/ui/Bridge/common/token-query.d.ts +15 -0
  233. package/dist/types/react/web/ui/Bridge/common/token-query.d.ts.map +1 -0
  234. package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts +13 -11
  235. package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts.map +1 -1
  236. package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts +8 -3
  237. package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts.map +1 -1
  238. package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts +12 -16
  239. package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts.map +1 -1
  240. package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts +1 -1
  241. package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts.map +1 -1
  242. package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts +6 -6
  243. package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts.map +1 -1
  244. package/dist/types/react/web/ui/Bridge/swap-widget/swap-ui.d.ts.map +1 -1
  245. package/dist/types/react/web/ui/Bridge/types.d.ts +39 -0
  246. package/dist/types/react/web/ui/Bridge/types.d.ts.map +1 -0
  247. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  248. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
  249. package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts +2 -1
  250. package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
  251. package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts +0 -1
  252. package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts.map +1 -1
  253. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +3 -1
  254. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
  255. package/dist/types/react/web/ui/components/CopyIcon.d.ts +1 -0
  256. package/dist/types/react/web/ui/components/CopyIcon.d.ts.map +1 -1
  257. package/dist/types/script-exports/bridge-widget-script.d.ts +3 -3
  258. package/dist/types/script-exports/bridge-widget-script.d.ts.map +1 -1
  259. package/dist/types/stories/Bridge/CheckoutWidget.stories.d.ts +25 -0
  260. package/dist/types/stories/Bridge/CheckoutWidget.stories.d.ts.map +1 -0
  261. package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts +3 -47
  262. package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts.map +1 -1
  263. package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts +3 -56
  264. package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts.map +1 -1
  265. package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts +5 -63
  266. package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts.map +1 -1
  267. package/dist/types/stories/Bridge/StepRunner.stories.d.ts +4 -52
  268. package/dist/types/stories/Bridge/StepRunner.stories.d.ts.map +1 -1
  269. package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts +4 -54
  270. package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts.map +1 -1
  271. package/dist/types/stories/Bridge/Transaction/TransactionWidget.stories.d.ts +11 -0
  272. package/dist/types/stories/Bridge/Transaction/TransactionWidget.stories.d.ts.map +1 -0
  273. package/dist/types/stories/Bridge/Transaction/useSendTransactionModal.stories.d.ts +18 -0
  274. package/dist/types/stories/Bridge/Transaction/useSendTransactionModal.stories.d.ts.map +1 -0
  275. package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts +3 -34
  276. package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts.map +1 -1
  277. package/dist/types/stories/Bridge/fixtures.d.ts +19 -17
  278. package/dist/types/stories/Bridge/fixtures.d.ts.map +1 -1
  279. package/dist/types/stories/BuyWidget.stories.d.ts +9 -1
  280. package/dist/types/stories/BuyWidget.stories.d.ts.map +1 -1
  281. package/dist/types/stories/utils.d.ts +0 -2
  282. package/dist/types/stories/utils.d.ts.map +1 -1
  283. package/dist/types/version.d.ts +1 -1
  284. package/dist/types/x402/common.d.ts.map +1 -1
  285. package/dist/types/x402/facilitator.d.ts +4 -5
  286. package/dist/types/x402/facilitator.d.ts.map +1 -1
  287. package/dist/types/x402/schemas.d.ts +21 -0
  288. package/dist/types/x402/schemas.d.ts.map +1 -1
  289. package/dist/types/x402/settle-payment.d.ts.map +1 -1
  290. package/dist/types/x402/types.d.ts +5 -4
  291. package/dist/types/x402/types.d.ts.map +1 -1
  292. package/dist/types/x402/verify-payment.d.ts.map +1 -1
  293. package/package.json +3 -3
  294. package/src/react/core/hooks/transaction/useSendTransaction.ts +6 -0
  295. package/src/react/core/hooks/usePaymentMethods.ts +1 -4
  296. package/src/react/web/hooks/transaction/useSendTransaction.tsx +1 -0
  297. package/src/react/web/ui/Bridge/BuyWidget.tsx +355 -160
  298. package/src/react/web/ui/Bridge/CheckoutWidget.tsx +384 -107
  299. package/src/react/web/ui/Bridge/DirectPayment.tsx +34 -26
  300. package/src/react/web/ui/Bridge/FundWallet.tsx +610 -266
  301. package/src/react/web/ui/Bridge/QuoteLoader.tsx +10 -20
  302. package/src/react/web/ui/Bridge/StepRunner.tsx +7 -7
  303. package/src/react/web/ui/Bridge/TransactionPayment.tsx +35 -25
  304. package/src/react/web/ui/Bridge/TransactionWidget.tsx +395 -71
  305. package/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx +3 -3
  306. package/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx +16 -14
  307. package/src/react/web/ui/Bridge/common/WithHeader.tsx +13 -19
  308. package/src/react/web/ui/Bridge/common/active-wallet-details.tsx +103 -0
  309. package/src/react/web/ui/Bridge/common/decimal-input.tsx +61 -0
  310. package/src/react/web/ui/Bridge/common/selected-token-button.tsx +168 -0
  311. package/src/react/web/ui/Bridge/common/token-balance.tsx +23 -0
  312. package/src/react/web/ui/Bridge/common/token-query.ts +49 -0
  313. package/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx +23 -14
  314. package/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx +36 -22
  315. package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +11 -22
  316. package/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx +1 -1
  317. package/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx +7 -8
  318. package/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx +14 -12
  319. package/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx +19 -332
  320. package/src/react/web/ui/Bridge/types.ts +47 -0
  321. package/src/react/web/ui/ConnectWallet/Details.tsx +3 -1
  322. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +1 -5
  323. package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +5 -1
  324. package/src/react/web/ui/TransactionButton/DepositScreen.tsx +1 -2
  325. package/src/react/web/ui/TransactionButton/TransactionModal.tsx +44 -27
  326. package/src/react/web/ui/components/CopyIcon.tsx +11 -2
  327. package/src/script-exports/bridge-widget-script.tsx +3 -3
  328. package/src/script-exports/readme.md +1 -8
  329. package/src/stories/Bridge/CheckoutWidget.stories.tsx +147 -0
  330. package/src/stories/Bridge/ErrorBanner.stories.tsx +13 -138
  331. package/src/stories/Bridge/PaymentDetails.stories.tsx +34 -349
  332. package/src/stories/Bridge/PaymentSelection.stories.tsx +28 -156
  333. package/src/stories/Bridge/StepRunner.stories.tsx +18 -65
  334. package/src/stories/Bridge/SuccessScreen.stories.tsx +21 -130
  335. package/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx +63 -0
  336. package/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx +68 -0
  337. package/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx +19 -108
  338. package/src/stories/Bridge/fixtures.ts +36 -63
  339. package/src/stories/BuyWidget.stories.tsx +103 -8
  340. package/src/stories/utils.tsx +16 -9
  341. package/src/version.ts +1 -1
  342. package/src/x402/common.ts +2 -5
  343. package/src/x402/facilitator.ts +8 -8
  344. package/src/x402/schemas.ts +10 -0
  345. package/src/x402/settle-payment.ts +7 -6
  346. package/src/x402/sign.ts +3 -8
  347. package/src/x402/types.ts +5 -4
  348. package/src/x402/verify-payment.ts +7 -6
  349. package/dist/cjs/react/core/machines/paymentMachine.js +0 -191
  350. package/dist/cjs/react/core/machines/paymentMachine.js.map +0 -1
  351. package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +0 -129
  352. package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +0 -1
  353. package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js +0 -258
  354. package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js.map +0 -1
  355. package/dist/cjs/stories/Bridge/DirectPayment.stories.js +0 -222
  356. package/dist/cjs/stories/Bridge/DirectPayment.stories.js.map +0 -1
  357. package/dist/cjs/stories/Bridge/FundWallet.stories.js +0 -201
  358. package/dist/cjs/stories/Bridge/FundWallet.stories.js.map +0 -1
  359. package/dist/cjs/stories/Bridge/TransactionPayment.stories.js +0 -168
  360. package/dist/cjs/stories/Bridge/TransactionPayment.stories.js.map +0 -1
  361. package/dist/esm/react/core/machines/paymentMachine.js +0 -188
  362. package/dist/esm/react/core/machines/paymentMachine.js.map +0 -1
  363. package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +0 -126
  364. package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +0 -1
  365. package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js +0 -255
  366. package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js.map +0 -1
  367. package/dist/esm/stories/Bridge/DirectPayment.stories.js +0 -219
  368. package/dist/esm/stories/Bridge/DirectPayment.stories.js.map +0 -1
  369. package/dist/esm/stories/Bridge/FundWallet.stories.js +0 -198
  370. package/dist/esm/stories/Bridge/FundWallet.stories.js.map +0 -1
  371. package/dist/esm/stories/Bridge/TransactionPayment.stories.js +0 -165
  372. package/dist/esm/stories/Bridge/TransactionPayment.stories.js.map +0 -1
  373. package/dist/types/react/core/machines/paymentMachine.d.ts +0 -89
  374. package/dist/types/react/core/machines/paymentMachine.d.ts.map +0 -1
  375. package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts +0 -99
  376. package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +0 -1
  377. package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts +0 -97
  378. package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts.map +0 -1
  379. package/dist/types/stories/Bridge/DirectPayment.stories.d.ts +0 -69
  380. package/dist/types/stories/Bridge/DirectPayment.stories.d.ts.map +0 -1
  381. package/dist/types/stories/Bridge/FundWallet.stories.d.ts +0 -67
  382. package/dist/types/stories/Bridge/FundWallet.stories.d.ts.map +0 -1
  383. package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts +0 -60
  384. package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts.map +0 -1
  385. package/src/react/core/machines/paymentMachine.test.ts +0 -519
  386. package/src/react/core/machines/paymentMachine.ts +0 -295
  387. package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +0 -425
  388. package/src/stories/Bridge/BridgeOrchestrator.stories.tsx +0 -298
  389. package/src/stories/Bridge/DirectPayment.stories.tsx +0 -256
  390. package/src/stories/Bridge/FundWallet.stories.tsx +0 -227
  391. package/src/stories/Bridge/TransactionPayment.stories.tsx +0 -202
@@ -1,20 +1,14 @@
1
1
  import styled from "@emotion/styled";
2
- import { ChevronDownIcon } from "@radix-ui/react-icons";
3
2
  import { useQuery } from "@tanstack/react-query";
4
3
  import { useState } from "react";
5
4
  import type { prepare as BuyPrepare } from "../../../../../bridge/Buy.js";
6
5
  import { Buy, Sell } from "../../../../../bridge/index.js";
7
6
  import type { prepare as SellPrepare } from "../../../../../bridge/Sell.js";
8
- import type { BridgeChain } from "../../../../../bridge/types/Chain.js";
9
7
  import type { TokenWithPrices } from "../../../../../bridge/types/Token.js";
10
- import { defineChain } from "../../../../../chains/utils.js";
11
8
  import type { ThirdwebClient } from "../../../../../client/client.js";
12
- import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js";
13
9
  import { getToken } from "../../../../../pay/convert/get-token.js";
14
10
  import type { SupportedFiatCurrency } from "../../../../../pay/convert/type.js";
15
- import { getAddress, shortenAddress } from "../../../../../utils/address.js";
16
11
  import { toTokens, toUnits } from "../../../../../utils/units.js";
17
- import { AccountProvider } from "../../../../core/account/provider.js";
18
12
  import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
19
13
  import {
20
14
  fontSize,
@@ -23,9 +17,7 @@ import {
23
17
  spacing,
24
18
  type Theme,
25
19
  } from "../../../../core/design-system/index.js";
26
- import { useWalletBalance } from "../../../../core/hooks/others/useWalletBalance.js";
27
20
  import type { BridgePrepareRequest } from "../../../../core/hooks/useBridgePrepare.js";
28
- import { WalletProvider } from "../../../../core/wallet/provider.js";
29
21
  import { ConnectButton } from "../../ConnectWallet/ConnectButton.js";
30
22
  import { DetailsModal } from "../../ConnectWallet/Details.js";
31
23
  import { ArrowUpDownIcon } from "../../ConnectWallet/icons/ArrowUpDownIcon.js";
@@ -37,18 +29,16 @@ import {
37
29
  } from "../../ConnectWallet/screens/formatTokenBalance.js";
38
30
  import { Container } from "../../components/basic.js";
39
31
  import { Button } from "../../components/buttons.js";
40
- import { Input } from "../../components/formElements.js";
41
- import { Img } from "../../components/Img.js";
42
32
  import { Modal } from "../../components/Modal.js";
43
33
  import { Skeleton } from "../../components/Skeleton.js";
44
34
  import { Spacer } from "../../components/Spacer.js";
45
35
  import { Spinner } from "../../components/Spinner.js";
46
36
  import { Text } from "../../components/text.js";
47
37
  import { useIsMobile } from "../../hooks/useisMobile.js";
48
- import { AccountAvatar } from "../../prebuilt/Account/avatar.js";
49
- import { AccountBlobbie } from "../../prebuilt/Account/blobbie.js";
50
- import { AccountName } from "../../prebuilt/Account/name.js";
51
- import { WalletIcon } from "../../prebuilt/Wallet/icon.js";
38
+ import { ActiveWalletDetails } from "../common/active-wallet-details.js";
39
+ import { DecimalInput } from "../common/decimal-input.js";
40
+ import { SelectedTokenButton } from "../common/selected-token-button.js";
41
+ import { useTokenBalance } from "../common/token-balance.js";
52
42
  import { SelectToken } from "./select-token-ui.js";
53
43
  import type {
54
44
  ActiveWalletInfo,
@@ -57,7 +47,6 @@ import type {
57
47
  TokenSelection,
58
48
  } from "./types.js";
59
49
  import { useBridgeChains } from "./use-bridge-chains.js";
60
- import { cleanedChainName } from "./utils.js";
61
50
 
62
51
  type SwapUIProps = {
63
52
  activeWalletInfo: ActiveWalletInfo | undefined;
@@ -423,7 +412,7 @@ export function SwapUI(props: SwapUIProps) {
423
412
  label: "Swap",
424
413
  style: {
425
414
  width: "100%",
426
- borderRadius: radius.lg,
415
+ borderRadius: radius.full,
427
416
  },
428
417
  }}
429
418
  theme={props.theme}
@@ -625,66 +614,6 @@ function useSwapQuote(params: {
625
614
  });
626
615
  }
627
616
 
628
- function DecimalInput(props: {
629
- value: string;
630
- setValue: (value: string) => void;
631
- }) {
632
- const handleAmountChange = (inputValue: string) => {
633
- let processedValue = inputValue;
634
-
635
- // Replace comma with period if it exists
636
- processedValue = processedValue.replace(",", ".");
637
-
638
- if (processedValue.startsWith(".")) {
639
- processedValue = `0${processedValue}`;
640
- }
641
-
642
- const numValue = Number(processedValue);
643
- if (Number.isNaN(numValue)) {
644
- return;
645
- }
646
-
647
- if (processedValue.startsWith("0") && !processedValue.startsWith("0.")) {
648
- props.setValue(processedValue.slice(1));
649
- } else {
650
- props.setValue(processedValue);
651
- }
652
- };
653
-
654
- return (
655
- <Input
656
- inputMode="decimal"
657
- onChange={(e) => {
658
- handleAmountChange(e.target.value);
659
- }}
660
- onClick={(e) => {
661
- // put cursor at the end of the input
662
- if (props.value === "") {
663
- e.currentTarget.setSelectionRange(
664
- e.currentTarget.value.length,
665
- e.currentTarget.value.length,
666
- );
667
- }
668
- }}
669
- pattern="^[0-9]*[.,]?[0-9]*$"
670
- placeholder="0.0"
671
- style={{
672
- border: "none",
673
- boxShadow: "none",
674
- fontSize: fontSize.xl,
675
- fontWeight: 500,
676
- paddingInline: 0,
677
- paddingBlock: 0,
678
- letterSpacing: "-0.025em",
679
- height: "30px",
680
- }}
681
- type="text"
682
- value={props.value}
683
- variant="transparent"
684
- />
685
- );
686
- }
687
-
688
617
  function TokenSection(props: {
689
618
  type: "buy" | "sell";
690
619
  amount: {
@@ -774,19 +703,11 @@ function TokenSection(props: {
774
703
  </Text>
775
704
  </Container>
776
705
  {props.activeWalletInfo && (
777
- <WalletButton
778
- variant="ghost-solid"
779
- style={{
780
- paddingInline: spacing.xxs,
781
- paddingBlock: "2px",
782
- }}
706
+ <ActiveWalletDetails
707
+ activeWalletInfo={props.activeWalletInfo}
708
+ client={props.client}
783
709
  onClick={props.onWalletClick}
784
- >
785
- <ActiveWalletDetails
786
- activeWalletInfo={props.activeWalletInfo}
787
- client={props.client}
788
- />
789
- </WalletButton>
710
+ />
790
711
  )}
791
712
  </Container>
792
713
 
@@ -829,6 +750,16 @@ function TokenSection(props: {
829
750
  <DecimalInput
830
751
  value={props.amount.data}
831
752
  setValue={props.setAmount}
753
+ style={{
754
+ border: "none",
755
+ boxShadow: "none",
756
+ fontSize: fontSize.xl,
757
+ fontWeight: 500,
758
+ paddingInline: 0,
759
+ paddingBlock: 0,
760
+ letterSpacing: "-0.025em",
761
+ height: "30px",
762
+ }}
832
763
  />
833
764
  )}
834
765
 
@@ -914,157 +845,6 @@ function TokenSection(props: {
914
845
  );
915
846
  }
916
847
 
917
- function SelectedTokenButton(props: {
918
- selectedToken:
919
- | {
920
- data: TokenWithPrices | undefined;
921
- isFetching: boolean;
922
- }
923
- | undefined;
924
- client: ThirdwebClient;
925
- onSelectToken: () => void;
926
- chain: BridgeChain | undefined;
927
- }) {
928
- const theme = useCustomTheme();
929
- return (
930
- <Button
931
- variant="ghost-solid"
932
- hoverBg="secondaryButtonBg"
933
- fullWidth
934
- onClick={props.onSelectToken}
935
- gap="sm"
936
- style={{
937
- borderBottom: `1px dashed ${theme.colors.borderColor}`,
938
- justifyContent: "space-between",
939
- paddingInline: spacing.md,
940
- paddingBlock: spacing.md,
941
- borderRadius: 0,
942
- }}
943
- >
944
- <Container gap="sm" flex="row" center="y">
945
- {/* icons */}
946
- <Container relative color="secondaryText">
947
- {/* token icon */}
948
- {props.selectedToken ? (
949
- <Img
950
- key={props.selectedToken?.data?.iconUri}
951
- src={
952
- props.selectedToken?.data === undefined
953
- ? undefined
954
- : props.selectedToken.data.iconUri || ""
955
- }
956
- client={props.client}
957
- width="40"
958
- height="40"
959
- fallback={
960
- <Container
961
- style={{
962
- background: `linear-gradient(45deg, white, ${theme.colors.accentText})`,
963
- borderRadius: radius.full,
964
- width: "40px",
965
- height: "40px",
966
- }}
967
- />
968
- }
969
- style={{
970
- objectFit: "cover",
971
- borderRadius: radius.full,
972
- }}
973
- />
974
- ) : (
975
- <Container
976
- style={{
977
- border: `1px solid ${theme.colors.borderColor}`,
978
- background: `linear-gradient(45deg, white, ${theme.colors.accentText})`,
979
- borderRadius: radius.full,
980
- width: "40px",
981
- height: "40px",
982
- }}
983
- />
984
- )}
985
-
986
- {/* chain icon */}
987
- {props.chain && (
988
- <Container
989
- bg="modalBg"
990
- style={{
991
- padding: "2px",
992
- position: "absolute",
993
- bottom: -2,
994
- right: -2,
995
- display: "flex",
996
- borderRadius: radius.full,
997
- }}
998
- >
999
- <Img
1000
- src={props.chain?.icon}
1001
- client={props.client}
1002
- width={iconSize.sm}
1003
- height={iconSize.sm}
1004
- style={{
1005
- borderRadius: radius.full,
1006
- }}
1007
- />
1008
- </Container>
1009
- )}
1010
- </Container>
1011
-
1012
- {/* token symbol and chain name */}
1013
- {props.selectedToken ? (
1014
- <Container flex="column" style={{ gap: "3px" }}>
1015
- {props.selectedToken?.isFetching ? (
1016
- <Skeleton width="60px" height={fontSize.md} />
1017
- ) : (
1018
- <Text size="md" color="primaryText" weight={500}>
1019
- {props.selectedToken?.data?.symbol}
1020
- </Text>
1021
- )}
1022
-
1023
- {props.chain ? (
1024
- <Text
1025
- size="xs"
1026
- color="secondaryText"
1027
- style={{
1028
- overflow: "hidden",
1029
- textOverflow: "ellipsis",
1030
- whiteSpace: "nowrap",
1031
- }}
1032
- >
1033
- {cleanedChainName(props.chain.name)}
1034
- </Text>
1035
- ) : (
1036
- <Skeleton width="140px" height={fontSize.sm} />
1037
- )}
1038
- </Container>
1039
- ) : (
1040
- <Container flex="column" style={{ gap: "3px" }}>
1041
- <Text size="md" color="primaryText" weight={500}>
1042
- Select Token
1043
- </Text>
1044
- <Text size="xs" color="secondaryText">
1045
- Required
1046
- </Text>
1047
- </Container>
1048
- )}
1049
- </Container>
1050
- <Container
1051
- color="secondaryText"
1052
- flex="row"
1053
- center="both"
1054
- borderColor="borderColor"
1055
- style={{
1056
- borderRadius: radius.full,
1057
- borderWidth: 1,
1058
- borderStyle: "solid",
1059
- padding: spacing.xs,
1060
- }}
1061
- >
1062
- <ChevronDownIcon width={iconSize.sm} height={iconSize.sm} />
1063
- </Container>
1064
- </Button>
1065
- );
1066
- }
1067
-
1068
848
  function SwitchButton(props: { onClick: () => void }) {
1069
849
  return (
1070
850
  <div
@@ -1110,96 +890,3 @@ const SwitchButtonInner = /* @__PURE__ */ styled(Button)(() => {
1110
890
  border: `1px solid ${theme.colors.borderColor}`,
1111
891
  };
1112
892
  });
1113
-
1114
- function useTokenBalance(props: {
1115
- chainId: number | undefined;
1116
- tokenAddress: string | undefined;
1117
- client: ThirdwebClient;
1118
- walletAddress: string | undefined;
1119
- }) {
1120
- return useWalletBalance({
1121
- address: props.walletAddress,
1122
- chain: props.chainId ? defineChain(props.chainId) : undefined,
1123
- client: props.client,
1124
- tokenAddress: props.tokenAddress
1125
- ? getAddress(props.tokenAddress) === getAddress(NATIVE_TOKEN_ADDRESS)
1126
- ? undefined
1127
- : getAddress(props.tokenAddress)
1128
- : undefined,
1129
- });
1130
- }
1131
-
1132
- function ActiveWalletDetails(props: {
1133
- activeWalletInfo: ActiveWalletInfo;
1134
- client: ThirdwebClient;
1135
- }) {
1136
- const wallet = props.activeWalletInfo.activeWallet;
1137
- const account = props.activeWalletInfo.activeAccount;
1138
-
1139
- const accountBlobbie = (
1140
- <AccountBlobbie
1141
- style={{
1142
- width: `${iconSize.xs}px`,
1143
- height: `${iconSize.xs}px`,
1144
- borderRadius: radius.full,
1145
- }}
1146
- />
1147
- );
1148
- const accountAvatarFallback = (
1149
- <WalletIcon
1150
- style={{
1151
- width: `${iconSize.xs}px`,
1152
- height: `${iconSize.xs}px`,
1153
- }}
1154
- fallbackComponent={accountBlobbie}
1155
- loadingComponent={accountBlobbie}
1156
- />
1157
- );
1158
-
1159
- return (
1160
- <WalletProvider id={props.activeWalletInfo.activeWallet.id}>
1161
- <AccountProvider address={account.address} client={props.client}>
1162
- <WalletProvider id={wallet.id}>
1163
- <Container flex="row" gap="xxs" center="y">
1164
- <AccountAvatar
1165
- style={{
1166
- width: `${iconSize.xs}px`,
1167
- height: `${iconSize.xs}px`,
1168
- borderRadius: radius.full,
1169
- }}
1170
- fallbackComponent={accountAvatarFallback}
1171
- loadingComponent={accountAvatarFallback}
1172
- />
1173
-
1174
- <span
1175
- style={{
1176
- fontSize: fontSize.xs,
1177
- letterSpacing: "0.025em",
1178
- }}
1179
- >
1180
- <AccountName
1181
- fallbackComponent={
1182
- <span>{shortenAddress(account.address)}</span>
1183
- }
1184
- loadingComponent={
1185
- <span>{shortenAddress(account.address)}</span>
1186
- }
1187
- />
1188
- </span>
1189
- </Container>
1190
- </WalletProvider>
1191
- </AccountProvider>
1192
- </WalletProvider>
1193
- );
1194
- }
1195
-
1196
- const WalletButton = /* @__PURE__ */ styled(Button)(() => {
1197
- const theme = useCustomTheme();
1198
- return {
1199
- color: theme.colors.secondaryText,
1200
- transition: "color 200ms ease",
1201
- "&:hover": {
1202
- color: theme.colors.primaryText,
1203
- },
1204
- };
1205
- });
@@ -0,0 +1,47 @@
1
+ import type { Quote, TokenWithPrices } from "../../../../bridge/index.js";
2
+ import type { SupportedFiatCurrency } from "../../../../pay/convert/type.js";
3
+ import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
4
+ import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
5
+
6
+ export type DirectPaymentInfo = {
7
+ sellerAddress: `0x${string}`;
8
+ token: TokenWithPrices;
9
+ amount: string;
10
+ feePayer?: "sender" | "receiver";
11
+ };
12
+
13
+ export type ModeInfo =
14
+ | {
15
+ mode: "direct_payment";
16
+ paymentInfo: DirectPaymentInfo;
17
+ }
18
+ | {
19
+ mode: "transaction";
20
+ transaction: PreparedTransaction;
21
+ }
22
+ | {
23
+ mode: "fund_wallet";
24
+ };
25
+
26
+ export type RequiredParams<T extends object, keys extends keyof T> = T & {
27
+ [K in keys]-?: T[K];
28
+ };
29
+
30
+ /**
31
+ * Payment method types with their required data
32
+ */
33
+ export type PaymentMethod =
34
+ | {
35
+ type: "wallet";
36
+ action: "buy" | "sell";
37
+ payerWallet: Wallet;
38
+ originToken: TokenWithPrices;
39
+ balance: bigint;
40
+ quote: Quote;
41
+ }
42
+ | {
43
+ type: "fiat";
44
+ payerWallet?: Wallet;
45
+ currency: SupportedFiatCurrency;
46
+ onramp: "stripe" | "coinbase" | "transak";
47
+ };
@@ -985,7 +985,6 @@ export function DetailsModal(props: {
985
985
  chain={getCachedChain(requestedChainId)}
986
986
  client={client}
987
987
  hiddenWallets={props.detailsModal?.hiddenWallets}
988
- locale={locale.id}
989
988
  connectOptions={props.connectOptions}
990
989
  onCancel={() => setScreen("main")}
991
990
  onSuccess={() => setScreen("main")}
@@ -1012,6 +1011,9 @@ export function DetailsModal(props: {
1012
1011
  className="tw-modal__wallet-details"
1013
1012
  title="Manage Wallet"
1014
1013
  open={isOpen}
1014
+ crossContainerStyles={{
1015
+ display: screen === "buy" ? "none" : "block",
1016
+ }}
1015
1017
  setOpen={(_open) => {
1016
1018
  if (!_open) {
1017
1019
  closeModal();
@@ -64,11 +64,7 @@ export function WalletRow(props: {
64
64
  {props.label}
65
65
  </Text>
66
66
  ) : null}
67
- <Text
68
- color="primaryText"
69
- size={props.textSize || "xs"}
70
- style={{ fontFamily: "monospace", fontWeight: 600 }}
71
- >
67
+ <Text color="primaryText" size={props.textSize || "xs"}>
72
68
  {addressOrENS || shortenAddress(props.address)}
73
69
  </Text>
74
70
  {profile.isLoading ? (
@@ -1,3 +1,4 @@
1
+ import type { SupportedFiatCurrency } from "../../../../../pay/convert/type.js";
1
2
  import { formatNumber } from "../../../../../utils/formatNumber.js";
2
3
  import { toTokens } from "../../../../../utils/units.js";
3
4
 
@@ -33,7 +34,10 @@ export function formatTokenAmount(
33
34
  ).toString();
34
35
  }
35
36
 
36
- export function formatCurrencyAmount(currency: string, amount: number) {
37
+ export function formatCurrencyAmount(
38
+ currency: SupportedFiatCurrency,
39
+ amount: number,
40
+ ) {
37
41
  return formatMoney(amount, "en-US", currency);
38
42
  }
39
43
 
@@ -75,7 +75,6 @@ const WaitingBadge = /* @__PURE__ */ StyledDiv(() => {
75
75
  * @internal
76
76
  */
77
77
  export function DepositScreen(props: {
78
- onBack: (() => void) | undefined;
79
78
  connectLocale: ConnectLocale;
80
79
  client: ThirdwebClient;
81
80
  tx: PreparedTransaction;
@@ -144,7 +143,7 @@ export function DepositScreen(props: {
144
143
 
145
144
  return (
146
145
  <Container p="lg">
147
- <ModalHeader onBack={props.onBack} title={"Insufficient funds"} />
146
+ <ModalHeader title={"Insufficient funds"} />
148
147
 
149
148
  <Spacer y="lg" />
150
149
 
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
2
2
  import { useState } from "react";
3
3
  import { trackPayEvent } from "../../../../analytics/track/pay.js";
4
4
  import type { ThirdwebClient } from "../../../../client/client.js";
5
+ import type { SupportedFiatCurrency } from "../../../../pay/convert/type.js";
5
6
  import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
6
7
  import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
7
8
  import { resolvePromisedValue } from "../../../../utils/promise/resolve-promised-value.js";
@@ -13,7 +14,7 @@ import { useActiveWallet } from "../../../core/hooks/wallets/useActiveWallet.js"
13
14
  import type { SupportedTokens } from "../../../core/utils/defaultTokens.js";
14
15
  import { webWindowAdapter } from "../../adapters/WindowAdapter.js";
15
16
  import { LoadingScreen } from "../../wallets/shared/LoadingScreen.js";
16
- import { BridgeOrchestrator } from "../Bridge/BridgeOrchestrator.js";
17
+ import { TransactionWidgetContentWrapper } from "../Bridge/TransactionWidget.js";
17
18
  import { useConnectLocale } from "../ConnectWallet/locale/getConnectLocale.js";
18
19
  import { Modal } from "../components/Modal.js";
19
20
  import type { LocaleId } from "../types.js";
@@ -33,7 +34,8 @@ type ModalProps = {
33
34
  payOptions: PayUIOptions;
34
35
  onTxSent: (data: WaitForReceiptOptions) => void;
35
36
  modalMode: "buy" | "deposit";
36
- country?: string;
37
+ country: string | undefined;
38
+ currency: SupportedFiatCurrency | undefined;
37
39
  };
38
40
 
39
41
  export function TransactionModal(props: ModalProps) {
@@ -84,9 +86,45 @@ export function TransactionModal(props: ModalProps) {
84
86
  );
85
87
  }
86
88
 
87
- function TransactionModalContent(props: ModalProps & { onBack?: () => void }) {
89
+ function TransactionModalContent(props: ModalProps) {
90
+ if (props.modalMode === "deposit") {
91
+ return <DepositAndExecuteTx {...props} />;
92
+ }
93
+
94
+ return (
95
+ <TransactionWidgetContentWrapper
96
+ client={props.client}
97
+ country={props.country}
98
+ currency={props.currency}
99
+ transaction={props.tx}
100
+ onCancel={props.onClose}
101
+ locale={props.localeId}
102
+ onSuccess={(data) => {
103
+ props.onTxSent(data);
104
+ }}
105
+ title={props.payOptions.metadata?.name}
106
+ description={props.payOptions.metadata?.description}
107
+ image={props.payOptions.metadata?.image}
108
+ paymentMethods={
109
+ props.payOptions.buyWithCrypto === false
110
+ ? ["card"]
111
+ : props.payOptions.buyWithFiat === false
112
+ ? ["crypto"]
113
+ : ["crypto", "card"]
114
+ }
115
+ showThirdwebBranding={props.payOptions.showThirdwebBranding}
116
+ supportedTokens={props.supportedTokens}
117
+ onError={undefined}
118
+ paymentLinkId={undefined}
119
+ buttonLabel={undefined}
120
+ purchaseData={undefined}
121
+ />
122
+ );
123
+ }
124
+
125
+ function DepositAndExecuteTx(props: ModalProps) {
88
126
  const localeQuery = useConnectLocale(props.localeId);
89
- const [screen, setScreen] = useState<"buy" | "execute-tx">("buy");
127
+ const [screen, setScreen] = useState<"deposit" | "execute-tx">("deposit");
90
128
 
91
129
  if (!localeQuery.data) {
92
130
  return <LoadingScreen />;
@@ -103,12 +141,11 @@ function TransactionModalContent(props: ModalProps & { onBack?: () => void }) {
103
141
  );
104
142
  }
105
143
 
106
- if (props.modalMode === "deposit") {
144
+ if (screen === "deposit") {
107
145
  return (
108
146
  <DepositScreen
109
147
  client={props.client}
110
148
  connectLocale={localeQuery.data}
111
- onBack={props.onBack}
112
149
  onDone={() => {
113
150
  setScreen("execute-tx");
114
151
  }}
@@ -117,25 +154,5 @@ function TransactionModalContent(props: ModalProps & { onBack?: () => void }) {
117
154
  );
118
155
  }
119
156
 
120
- return (
121
- <BridgeOrchestrator
122
- country={props.country}
123
- client={props.client}
124
- connectLocale={localeQuery.data}
125
- connectOptions={undefined}
126
- onCancel={props.onClose}
127
- onComplete={() => {
128
- setScreen("execute-tx");
129
- }}
130
- onError={(_error) => {}}
131
- paymentLinkId={undefined}
132
- presetOptions={undefined}
133
- purchaseData={undefined}
134
- receiverAddress={undefined}
135
- uiOptions={{
136
- mode: "transaction",
137
- transaction: props.tx,
138
- }}
139
- />
140
- );
157
+ return null;
141
158
  }
@@ -13,6 +13,7 @@ export const CopyIcon: React.FC<{
13
13
  side?: "top" | "bottom" | "left" | "right";
14
14
  align?: "start" | "center" | "end";
15
15
  hasCopied?: boolean;
16
+ iconSize?: number;
16
17
  }> = (props) => {
17
18
  const { hasCopied, onCopy } = useClipboard(props.text);
18
19
  const showCheckIcon = props.hasCopied || hasCopied;
@@ -40,9 +41,17 @@ export const CopyIcon: React.FC<{
40
41
  flex="row"
41
42
  >
42
43
  {showCheckIcon ? (
43
- <CheckIcon className="tw-check-icon" />
44
+ <CheckIcon
45
+ className="tw-check-icon"
46
+ width={props.iconSize || 16}
47
+ height={props.iconSize || 16}
48
+ />
44
49
  ) : (
45
- <CopyIconSVG className="tw-copy-icon" />
50
+ <CopyIconSVG
51
+ className="tw-copy-icon"
52
+ width={props.iconSize || 16}
53
+ height={props.iconSize || 16}
54
+ />
46
55
  )}
47
56
  </Container>
48
57
  </div>