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,11 +1,7 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
- import type { ThirdwebClient } from "../../client/client.js";
3
- import type { WindowAdapter } from "../../react/core/adapters/WindowAdapter.js";
4
- import type { Theme } from "../../react/core/design-system/index.js";
5
- import type { BridgePrepareRequest } from "../../react/core/hooks/useBridgePrepare.js";
6
2
  import type { CompletedStatusResult } from "../../react/core/hooks/useStepExecutor.js";
3
+ import { webWindowAdapter } from "../../react/web/adapters/WindowAdapter.js";
7
4
  import { StepRunner } from "../../react/web/ui/Bridge/StepRunner.js";
8
- import type { Wallet } from "../../wallets/interfaces/wallet.js";
9
5
  import { ModalThemeWrapper, storyClient } from "../utils.js";
10
6
  import {
11
7
  STORY_MOCK_WALLET,
@@ -13,80 +9,37 @@ import {
13
9
  simpleBuyRequest,
14
10
  } from "./fixtures.js";
15
11
 
16
- // Mock window adapter
17
- const mockWindowAdapter: WindowAdapter = {
18
- open: async (_url: string) => {},
19
- };
20
-
21
- // Props interface for the wrapper component
22
- interface StepRunnerWithThemeProps {
23
- request: BridgePrepareRequest;
24
- wallet: Wallet;
25
- client: ThirdwebClient;
26
- windowAdapter: WindowAdapter;
27
- onComplete: (completedStatuses: CompletedStatusResult[]) => void;
28
- onError: (error: Error) => void;
29
- onCancel?: () => void;
30
- onBack?: () => void;
31
- theme: "light" | "dark" | Theme;
32
- }
33
-
34
- // Wrapper component to provide theme context
35
- const StepRunnerWithTheme = (props: StepRunnerWithThemeProps) => {
36
- const { theme, ...componentProps } = props;
37
- return (
38
- <ModalThemeWrapper theme={theme}>
39
- <StepRunner {...componentProps} preparedQuote={simpleBuyQuote} />
40
- </ModalThemeWrapper>
41
- );
42
- };
43
-
44
- const meta = {
12
+ const meta: Meta<typeof StepRunner> = {
45
13
  args: {
46
14
  client: storyClient,
47
15
  onCancel: () => {},
48
16
  onComplete: (_completedStatuses: CompletedStatusResult[]) => {},
49
- onError: (error: Error) => console.error("Error:", error),
50
- theme: "dark",
51
17
  wallet: STORY_MOCK_WALLET,
52
- windowAdapter: mockWindowAdapter,
53
- },
54
- argTypes: {
55
- onCancel: { action: "execution cancelled" },
56
- onComplete: { action: "execution completed" },
57
- onError: { action: "error occurred" },
58
- theme: {
59
- control: "select",
60
- description: "Theme for the component",
61
- options: ["light", "dark"],
62
- },
18
+ windowAdapter: webWindowAdapter,
19
+ title: undefined,
20
+ autoStart: true,
21
+ onBack: undefined,
22
+ preparedQuote: simpleBuyQuote,
63
23
  },
64
- component: StepRunnerWithTheme,
24
+ component: StepRunner,
25
+ decorators: [
26
+ (Story) => (
27
+ <ModalThemeWrapper>
28
+ <Story />
29
+ </ModalThemeWrapper>
30
+ ),
31
+ ],
65
32
  parameters: {
66
33
  layout: "centered",
67
34
  },
68
- title: "Bridge/StepRunner",
69
- } satisfies Meta<typeof StepRunnerWithTheme>;
35
+ title: "Bridge/screens/StepRunner",
36
+ };
70
37
 
71
38
  export default meta;
72
39
  type Story = StoryObj<typeof meta>;
73
40
 
74
- export const Light: Story = {
75
- args: {
76
- request: simpleBuyRequest,
77
- theme: "light",
78
- },
79
- parameters: {
80
- backgrounds: { default: "light" },
81
- },
82
- };
83
-
84
- export const Dark: Story = {
41
+ export const Basic: Story = {
85
42
  args: {
86
43
  request: simpleBuyRequest,
87
- theme: "dark",
88
- },
89
- parameters: {
90
- backgrounds: { default: "dark" },
91
44
  },
92
45
  };
@@ -1,19 +1,10 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
  import { stringify } from "viem";
3
- import type { Theme } from "../../react/core/design-system/index.js";
4
3
  import type { CompletedStatusResult } from "../../react/core/hooks/useStepExecutor.js";
5
4
  import { webWindowAdapter } from "../../react/web/adapters/WindowAdapter.js";
6
- import {
7
- SuccessScreen,
8
- type SuccessScreenProps,
9
- } from "../../react/web/ui/Bridge/payment-success/SuccessScreen.js";
5
+ import { SuccessScreen } from "../../react/web/ui/Bridge/payment-success/SuccessScreen.js";
10
6
  import { ModalThemeWrapper, storyClient } from "../utils.js";
11
- import {
12
- FUND_WALLET_UI_OPTIONS,
13
- simpleBuyQuote,
14
- simpleOnrampQuote,
15
- TRANSACTION_UI_OPTIONS,
16
- } from "./fixtures.js";
7
+ import { simpleBuyQuote, simpleOnrampQuote } from "./fixtures.js";
17
8
 
18
9
  const mockBuyCompletedStatuses: CompletedStatusResult[] = JSON.parse(
19
10
  stringify([
@@ -75,164 +66,64 @@ const mockOnrampCompletedStatuses: CompletedStatusResult[] = JSON.parse(
75
66
  ]),
76
67
  );
77
68
 
78
- // Props interface for the wrapper component
79
- interface SuccessScreenWithThemeProps extends SuccessScreenProps {
80
- theme: "light" | "dark" | Theme;
81
- }
82
-
83
- // Wrapper component to provide theme context
84
- const SuccessScreenWithTheme = (props: SuccessScreenWithThemeProps) => {
85
- const { theme, ...componentProps } = props;
86
- return (
87
- <ModalThemeWrapper theme={theme}>
88
- <SuccessScreen {...componentProps} />
89
- </ModalThemeWrapper>
90
- );
91
- };
92
-
93
- const meta = {
69
+ const meta: Meta<typeof SuccessScreen> = {
94
70
  args: {
95
71
  completedStatuses: mockBuyCompletedStatuses,
96
72
  onDone: () => {},
97
73
  preparedQuote: simpleBuyQuote,
98
- theme: "dark",
99
- uiOptions: FUND_WALLET_UI_OPTIONS.ethDefault,
74
+ showContinueWithTx: false,
100
75
  windowAdapter: webWindowAdapter,
101
- },
102
- argTypes: {
103
- onDone: { action: "success screen closed" },
104
- theme: {
105
- control: "select",
106
- description: "Theme for the component",
107
- options: ["light", "dark"],
108
- },
109
- },
110
- component: SuccessScreenWithTheme,
111
- parameters: {
112
- docs: {
113
- description: {
114
- component:
115
- "Success screen that displays completion confirmation with transaction summary, payment details, and action buttons for next steps. Includes animated success icon and detailed transaction view.",
116
- },
117
- },
118
- layout: "centered",
119
- },
120
- tags: ["autodocs"],
121
- title: "Bridge/SuccessScreen",
122
- } satisfies Meta<typeof SuccessScreenWithTheme>;
76
+ client: storyClient,
77
+ hasPaymentId: false,
78
+ },
79
+ component: SuccessScreen,
80
+ decorators: [
81
+ (Story) => (
82
+ <ModalThemeWrapper>
83
+ <Story />
84
+ </ModalThemeWrapper>
85
+ ),
86
+ ],
87
+ title: "Bridge/screens/SuccessScreen",
88
+ };
123
89
 
124
90
  export default meta;
125
91
  type Story = StoryObj<typeof meta>;
126
92
 
127
- export const Default: Story = {
128
- args: {
129
- client: storyClient,
130
- theme: "dark",
131
- },
132
- parameters: {
133
- backgrounds: { default: "dark" },
134
- },
135
- };
136
-
137
- export const DefaultLight: Story = {
138
- args: {
139
- client: storyClient,
140
- theme: "light",
141
- },
142
- parameters: {
143
- backgrounds: { default: "light" },
144
- },
93
+ export const Basic: Story = {
94
+ args: {},
145
95
  };
146
96
 
147
97
  export const OnrampPayment: Story = {
148
98
  args: {
149
- client: storyClient,
150
- completedStatuses: mockOnrampCompletedStatuses,
151
- preparedQuote: simpleOnrampQuote,
152
- theme: "dark",
153
- },
154
- parameters: {
155
- backgrounds: { default: "dark" },
156
- docs: {
157
- description: {
158
- story:
159
- "Success screen for onramp payments showing payment ID that can be copied to clipboard.",
160
- },
161
- },
162
- },
163
- };
164
-
165
- export const OnrampPaymentLight: Story = {
166
- args: {
167
- client: storyClient,
168
99
  completedStatuses: mockOnrampCompletedStatuses,
169
100
  preparedQuote: simpleOnrampQuote,
170
- theme: "light",
171
- },
172
- parameters: {
173
- backgrounds: { default: "light" },
174
101
  },
175
102
  };
176
103
 
177
104
  export const ComplexPayment: Story = {
178
105
  args: {
179
- client: storyClient,
180
- completedStatuses: [
181
- ...mockOnrampCompletedStatuses,
182
- ...mockBuyCompletedStatuses,
183
- ],
184
- preparedQuote: simpleOnrampQuote,
185
- theme: "dark",
186
- },
187
- parameters: {
188
- backgrounds: { default: "dark" },
189
- docs: {
190
- description: {
191
- story:
192
- "Success screen for onramp payments showing payment ID that can be copied to clipboard.",
193
- },
194
- },
195
- },
196
- };
197
-
198
- export const ComplexPaymentLight: Story = {
199
- args: {
200
- client: storyClient,
201
106
  completedStatuses: [
202
107
  ...mockOnrampCompletedStatuses,
203
108
  ...mockBuyCompletedStatuses,
204
109
  ],
205
110
  preparedQuote: simpleOnrampQuote,
206
- theme: "light",
207
- },
208
- parameters: {
209
- backgrounds: { default: "light" },
210
111
  },
211
112
  };
212
113
 
213
114
  export const TransactionPayment: Story = {
214
115
  args: {
215
- client: storyClient,
216
116
  completedStatuses: mockBuyCompletedStatuses,
217
117
  preparedQuote: simpleBuyQuote,
218
- theme: "light",
219
- uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
220
- },
221
- parameters: {
222
- backgrounds: { default: "light" },
118
+ showContinueWithTx: true,
223
119
  },
224
120
  };
225
121
 
226
122
  export const PaymentId: Story = {
227
123
  args: {
228
- client: storyClient,
229
124
  completedStatuses: mockBuyCompletedStatuses,
230
125
  hasPaymentId: true,
231
126
  preparedQuote: simpleBuyQuote,
232
- theme: "light",
233
- uiOptions: TRANSACTION_UI_OPTIONS.contractInteraction,
234
- },
235
- parameters: {
236
- backgrounds: { default: "light" },
127
+ showContinueWithTx: true,
237
128
  },
238
129
  };
@@ -0,0 +1,63 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import {
3
+ TransactionWidget,
4
+ type TransactionWidgetProps,
5
+ } from "../../../react/web/ui/Bridge/TransactionWidget.js";
6
+ import { storyClient } from "../../utils.js";
7
+ import { TRANSACTION_UI_OPTIONS } from "../fixtures.js";
8
+
9
+ const meta: Meta<typeof StoryVariant> = {
10
+ args: {
11
+ client: storyClient,
12
+ onSuccess: () => {},
13
+ onError: () => {},
14
+ onCancel: () => {},
15
+ currency: "USD",
16
+ ...TRANSACTION_UI_OPTIONS.ethTransfer,
17
+ },
18
+ component: StoryVariant,
19
+ title: "Bridge/Transaction/TransactionWidget",
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ export const EthereumTransfer: Story = {
26
+ args: {
27
+ ...TRANSACTION_UI_OPTIONS.ethTransfer,
28
+ },
29
+ };
30
+
31
+ export const ERC20TokenTransfer: Story = {
32
+ args: {
33
+ ...TRANSACTION_UI_OPTIONS.erc20Transfer,
34
+ },
35
+ };
36
+
37
+ export const ContractInteraction: Story = {
38
+ args: {
39
+ ...TRANSACTION_UI_OPTIONS.contractInteraction,
40
+ },
41
+ };
42
+
43
+ export const CustomButtonLabel: Story = {
44
+ args: {
45
+ ...TRANSACTION_UI_OPTIONS.customButton,
46
+ },
47
+ };
48
+
49
+ function StoryVariant(props: TransactionWidgetProps) {
50
+ return (
51
+ <div
52
+ style={{
53
+ display: "flex",
54
+ flexDirection: "column",
55
+ gap: "40px",
56
+ alignItems: "center",
57
+ }}
58
+ >
59
+ <TransactionWidget {...props} theme="dark" />
60
+ <TransactionWidget {...props} theme="light" />
61
+ </div>
62
+ );
63
+ }
@@ -0,0 +1,68 @@
1
+ import type { Meta } from "@storybook/react";
2
+ import { base } from "../../../chains/chain-definitions/base.js";
3
+ import { sepolia } from "../../../chains/chain-definitions/sepolia.js";
4
+ import { useActiveAccount } from "../../../react/core/hooks/wallets/useActiveAccount.js";
5
+ import { useSendTransaction } from "../../../react/web/hooks/transaction/useSendTransaction.js";
6
+ import { ConnectButton } from "../../../react/web/ui/ConnectWallet/ConnectButton.js";
7
+ import { Button } from "../../../react/web/ui/components/buttons.js";
8
+ import { Spinner } from "../../../react/web/ui/components/Spinner.js";
9
+ import {
10
+ type PreparedTransaction,
11
+ prepareTransaction,
12
+ } from "../../../transaction/prepare-transaction.js";
13
+ import { toWei } from "../../../utils/units.js";
14
+ import { storyClient } from "../../utils.js";
15
+
16
+ const meta: Meta<typeof Variant> = {
17
+ component: Variant,
18
+ title: "Bridge/Transaction/useSendTransaction",
19
+ };
20
+ export default meta;
21
+
22
+ const sendBase = prepareTransaction({
23
+ chain: base,
24
+ client: storyClient,
25
+ to: "0x83Dd93fA5D8343094f850f90B3fb90088C1bB425",
26
+ value: toWei("100"),
27
+ });
28
+
29
+ // using an unsupported chain to popup deposit screen
30
+ const sendSepolia = prepareTransaction({
31
+ chain: sepolia,
32
+ client: storyClient,
33
+ to: "0x83Dd93fA5D8343094f850f90B3fb90088C1bB425",
34
+ value: toWei("100"),
35
+ });
36
+
37
+ export const BuyAndExecuteTx = {
38
+ args: {
39
+ transaction: sendBase,
40
+ },
41
+ };
42
+
43
+ export const DepositAndExecuteTx = {
44
+ args: {
45
+ transaction: sendSepolia,
46
+ },
47
+ };
48
+
49
+ function Variant(props: { transaction: PreparedTransaction }) {
50
+ const sendTx = useSendTransaction();
51
+ const account = useActiveAccount();
52
+
53
+ if (!account) {
54
+ return <ConnectButton client={storyClient} />;
55
+ }
56
+ return (
57
+ <Button
58
+ variant="primary"
59
+ gap="xs"
60
+ onClick={() => {
61
+ sendTx.mutate(props.transaction);
62
+ }}
63
+ >
64
+ {sendTx.isPending && <Spinner size="sm" />}
65
+ Execute
66
+ </Button>
67
+ );
68
+ }
@@ -1,58 +1,25 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
  import { defineChain } from "../../chains/utils.js";
3
- import { createThirdwebClient } from "../../client/client.js";
4
- import type { Theme } from "../../react/core/design-system/index.js";
5
- import {
6
- UnsupportedTokenScreen,
7
- type UnsupportedTokenScreenProps,
8
- } from "../../react/web/ui/Bridge/UnsupportedTokenScreen.js";
9
- import { ModalThemeWrapper } from "../utils.js";
3
+ import { NATIVE_TOKEN_ADDRESS } from "../../constants/addresses.js";
4
+ import { UnsupportedTokenScreen } from "../../react/web/ui/Bridge/UnsupportedTokenScreen.js";
5
+ import { ModalThemeWrapper, storyClient } from "../utils.js";
10
6
 
11
- const TEST_CLIENT = createThirdwebClient({ clientId: "test" });
12
-
13
- // Props interface for the wrapper component
14
- interface UnsupportedTokenScreenWithThemeProps
15
- extends UnsupportedTokenScreenProps {
16
- theme: "light" | "dark" | Theme;
17
- }
18
-
19
- // Wrapper component to provide theme context
20
- const UnsupportedTokenScreenWithTheme = (
21
- props: UnsupportedTokenScreenWithThemeProps,
22
- ) => {
23
- const { theme, ...componentProps } = props;
24
- return (
25
- <ModalThemeWrapper theme={theme}>
26
- <UnsupportedTokenScreen {...componentProps} />
27
- </ModalThemeWrapper>
28
- );
29
- };
30
-
31
- const meta = {
7
+ const meta: Meta<typeof UnsupportedTokenScreen> = {
32
8
  args: {
33
- chain: defineChain(1), // Ethereum mainnet
34
- theme: "dark",
35
- },
36
- argTypes: {
37
- theme: {
38
- control: "select",
39
- description: "Theme for the component",
40
- options: ["light", "dark"],
41
- },
42
- },
43
- component: UnsupportedTokenScreenWithTheme,
44
- parameters: {
45
- docs: {
46
- description: {
47
- component:
48
- "Screen displayed when a token is being indexed or when using an unsupported testnet. Shows loading state for indexing tokens or error state for testnets.",
49
- },
50
- },
51
- layout: "centered",
52
- },
53
- tags: ["autodocs"],
54
- title: "Bridge/UnsupportedTokenScreen",
55
- } satisfies Meta<typeof UnsupportedTokenScreenWithTheme>;
9
+ client: storyClient,
10
+ chain: defineChain(1),
11
+ tokenAddress: NATIVE_TOKEN_ADDRESS,
12
+ },
13
+ component: UnsupportedTokenScreen,
14
+ title: "Bridge/screens/UnsupportedTokenScreen",
15
+ decorators: [
16
+ (Story) => (
17
+ <ModalThemeWrapper>
18
+ <Story />
19
+ </ModalThemeWrapper>
20
+ ),
21
+ ],
22
+ };
56
23
 
57
24
  export default meta;
58
25
  type Story = StoryObj<typeof meta>;
@@ -60,67 +27,11 @@ type Story = StoryObj<typeof meta>;
60
27
  export const TokenNotSupported: Story = {
61
28
  args: {
62
29
  chain: defineChain(1),
63
- client: TEST_CLIENT,
64
- theme: "dark", // Ethereum mainnet - will show indexing spinner
65
- },
66
- parameters: {
67
- backgrounds: { default: "dark" },
68
- docs: {
69
- description: {
70
- story:
71
- "Shows the loading state when a token is being indexed by the Bridge on a mainnet chain.",
72
- },
73
- },
74
- },
75
- };
76
-
77
- export const TokenNotSupportedLight: Story = {
78
- args: {
79
- chain: defineChain(1),
80
- client: TEST_CLIENT,
81
- theme: "light", // Ethereum mainnet - will show indexing spinner
82
- },
83
- parameters: {
84
- backgrounds: { default: "light" },
85
- docs: {
86
- description: {
87
- story:
88
- "Shows the loading state when a token is being indexed by the Bridge on a mainnet chain (light theme).",
89
- },
90
- },
91
30
  },
92
31
  };
93
32
 
94
33
  export const TestnetNotSupported: Story = {
95
34
  args: {
96
- chain: defineChain(11155111),
97
- client: TEST_CLIENT,
98
- theme: "dark", // Sepolia testnet - will show error state
99
- },
100
- parameters: {
101
- backgrounds: { default: "dark" },
102
- docs: {
103
- description: {
104
- story:
105
- "Shows the error state when trying to use the Bridge on a testnet chain (Sepolia in this example).",
106
- },
107
- },
108
- },
109
- };
110
-
111
- export const TestnetNotSupportedLight: Story = {
112
- args: {
113
- chain: defineChain(11155111),
114
- client: TEST_CLIENT,
115
- theme: "light", // Sepolia testnet - will show error state
116
- },
117
- parameters: {
118
- backgrounds: { default: "light" },
119
- docs: {
120
- description: {
121
- story:
122
- "Shows the error state when trying to use the Bridge on a testnet chain (Sepolia in this example, light theme).",
123
- },
124
- },
35
+ chain: defineChain(11155111), // Sepolia testnet
125
36
  },
126
37
  };