thirdweb 5.108.6 → 5.108.7

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 +0 -1
  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 +0 -1
  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 +2 -3
  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 +1 -1
  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 +3 -3
  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
@@ -13,8 +13,11 @@ import type {
13
13
  BridgePrepareResult,
14
14
  } from "../../react/core/hooks/useBridgePrepare.js";
15
15
  import { getDefaultToken } from "../../react/core/utils/defaultTokens.js";
16
- import type { UIOptions } from "../../react/web/ui/Bridge/BridgeOrchestrator.js";
17
- import { prepareTransaction } from "../../transaction/prepare-transaction.js";
16
+ import type { DirectPaymentInfo } from "../../react/web/ui/Bridge/types.js";
17
+ import {
18
+ type PreparedTransaction,
19
+ prepareTransaction,
20
+ } from "../../transaction/prepare-transaction.js";
18
21
  import { toWei } from "../../utils/units.js";
19
22
  import type { Account, Wallet } from "../../wallets/interfaces/wallet.js";
20
23
  import { storyClient } from "../utils.js";
@@ -636,7 +639,7 @@ const contractInteractionTransaction = claimTo({
636
639
  // ========== COMMON DUMMY DATA FOR STORYBOOK ========== //
637
640
 
638
641
  // Common receiver addresses for testing
639
- export const RECEIVER_ADDRESSES = {
642
+ const RECEIVER_ADDRESSES = {
640
643
  physical: "0x5555666677778888999900001111222233334444" as const,
641
644
  primary: "0x2247d5d238d0f9d37184d8332aE0289d1aD9991b" as const,
642
645
  secondary: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD" as const,
@@ -677,57 +680,24 @@ const PRODUCT_METADATA = {
677
680
  },
678
681
  };
679
682
 
680
- // Type aliases for better type safety
681
- type FundWalletUIOptions = Extract<UIOptions, { mode: "fund_wallet" }>;
682
- type DirectPaymentUIOptions = Extract<UIOptions, { mode: "direct_payment" }>;
683
- type TransactionUIOptions = Extract<UIOptions, { mode: "transaction" }>;
683
+ type DirectPaymentUIOptions = {
684
+ metadata: {
685
+ description: string | undefined;
686
+ title: string | undefined;
687
+ image: string | undefined;
688
+ };
689
+ paymentInfo: DirectPaymentInfo;
690
+ buttonLabel: string | undefined;
691
+ };
684
692
 
685
- // UI Options for FundWallet mode
686
- export const FUND_WALLET_UI_OPTIONS: Record<
687
- "ethDefault" | "ethWithAmount" | "usdcDefault" | "uniLarge" | "customButton",
688
- FundWalletUIOptions
689
- > = {
690
- ethDefault: {
691
- destinationToken: ETH,
692
- metadata: {
693
- description: "Add funds to your wallet",
694
- title: "Fund Wallet",
695
- },
696
- mode: "fund_wallet" as const,
697
- },
698
- ethWithAmount: {
699
- destinationToken: ETH,
700
- initialAmount: "0.001",
701
- metadata: {
702
- description: "Add funds to your wallet",
703
- title: "Fund Wallet",
704
- },
705
- mode: "fund_wallet" as const,
706
- },
707
- uniLarge: {
708
- destinationToken: UNI,
709
- initialAmount: "150000",
710
- metadata: {
711
- description: "Add UNI tokens to your wallet",
712
- title: "Fund Wallet",
713
- },
714
- mode: "fund_wallet" as const,
715
- },
716
- usdcDefault: {
717
- destinationToken: USDC,
718
- initialAmount: "5",
719
- mode: "fund_wallet" as const,
720
- },
721
- customButton: {
722
- destinationToken: ETH,
723
- initialAmount: "0.01",
724
- metadata: {
725
- description: "Test custom button label for funding",
726
- title: "Custom Fund Wallet",
727
- },
728
- mode: "fund_wallet" as const,
729
- buttonLabel: "Add Funds Now",
730
- },
693
+ type TransactionUIOptions = {
694
+ metadata: {
695
+ description: string | undefined;
696
+ title: string | undefined;
697
+ image: string | undefined;
698
+ };
699
+ transaction: PreparedTransaction;
700
+ buttonLabel: string | undefined;
731
701
  };
732
702
 
733
703
  // UI Options for DirectPayment mode
@@ -746,7 +716,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
746
716
  image: PRODUCT_METADATA.concertTicket.image,
747
717
  title: "Buy Concert Ticket",
748
718
  },
749
- mode: "direct_payment" as const,
719
+ buttonLabel: undefined,
750
720
  paymentInfo: {
751
721
  amount: "25.00",
752
722
  feePayer: "receiver" as const,
@@ -758,8 +728,9 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
758
728
  metadata: {
759
729
  description: PRODUCT_METADATA.credits.description,
760
730
  title: "Add Credits",
731
+ image: undefined,
761
732
  },
762
- mode: "direct_payment" as const,
733
+ buttonLabel: undefined,
763
734
  paymentInfo: {
764
735
  amount: "25",
765
736
  feePayer: "receiver" as const,
@@ -773,7 +744,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
773
744
  image: PRODUCT_METADATA.digitalArt.image,
774
745
  title: "Purchase Digital Art",
775
746
  },
776
- mode: "direct_payment" as const,
747
+ buttonLabel: undefined,
777
748
  paymentInfo: {
778
749
  amount: "0.1",
779
750
  feePayer: "sender" as const,
@@ -787,7 +758,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
787
758
  image: PRODUCT_METADATA.sneakers.image,
788
759
  title: "Buy Sneakers",
789
760
  },
790
- mode: "direct_payment" as const,
761
+ buttonLabel: undefined,
791
762
  paymentInfo: {
792
763
  amount: "0.05",
793
764
  feePayer: "receiver" as const,
@@ -801,7 +772,7 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
801
772
  image: PRODUCT_METADATA.subscription.image,
802
773
  title: "Subscribe to Premium",
803
774
  },
804
- mode: "direct_payment" as const,
775
+ buttonLabel: undefined,
805
776
  paymentInfo: {
806
777
  amount: "9.99",
807
778
  feePayer: "sender" as const,
@@ -815,7 +786,6 @@ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
815
786
  image: PRODUCT_METADATA.digitalArt.image,
816
787
  title: "Custom Button Test",
817
788
  },
818
- mode: "direct_payment" as const,
819
789
  buttonLabel: "Purchase Now",
820
790
  paymentInfo: {
821
791
  amount: "0.05",
@@ -835,32 +805,35 @@ export const TRANSACTION_UI_OPTIONS: Record<
835
805
  metadata: {
836
806
  description: "Interact with smart contract",
837
807
  title: "Contract Interaction",
808
+ image: undefined,
838
809
  },
839
- mode: "transaction" as const,
810
+ buttonLabel: undefined,
840
811
  transaction: contractInteractionTransaction,
841
812
  },
842
813
  erc20Transfer: {
843
814
  metadata: {
844
815
  description: "Transfer ERC20 tokens",
845
816
  title: "Token Transfer",
817
+ image: undefined,
846
818
  },
847
- mode: "transaction" as const,
819
+ buttonLabel: undefined,
848
820
  transaction: erc20Transaction,
849
821
  },
850
822
  ethTransfer: {
851
823
  metadata: {
852
824
  description: "Review and execute transaction",
853
825
  title: "Execute Transaction",
826
+ image: undefined,
854
827
  },
855
- mode: "transaction" as const,
828
+ buttonLabel: undefined,
856
829
  transaction: ethTransferTransaction,
857
830
  },
858
831
  customButton: {
859
832
  metadata: {
860
833
  description: "Test custom button label for transactions",
861
834
  title: "Custom Transaction",
835
+ image: undefined,
862
836
  },
863
- mode: "transaction" as const,
864
837
  buttonLabel: "Execute Now",
865
838
  transaction: ethTransferTransaction,
866
839
  },
@@ -1,30 +1,105 @@
1
1
  import type { Meta } from "@storybook/react-vite";
2
2
  import { base } from "../chains/chain-definitions/base.js";
3
+ import { ethereum } from "../chains/chain-definitions/ethereum.js";
3
4
  import { defineChain } from "../chains/utils.js";
4
- import { BuyWidget } from "../react/web/ui/Bridge/BuyWidget.js";
5
+ import {
6
+ BuyWidget,
7
+ type BuyWidgetProps,
8
+ } from "../react/web/ui/Bridge/BuyWidget.js";
5
9
  import { storyClient } from "./utils.js";
6
10
 
7
11
  const meta = {
8
12
  parameters: {
9
13
  layout: "centered",
10
14
  },
11
- title: "Connect/BuyWidget",
15
+ title: "Bridge/Buy/BuyWidget",
12
16
  } satisfies Meta<typeof BuyWidget>;
13
17
  export default meta;
14
18
 
15
- export function BasicUsage() {
16
- return <BuyWidget client={storyClient} chain={base} amount="0.1" />;
19
+ export function Basic() {
20
+ return <Variant client={storyClient} />;
21
+ }
22
+
23
+ export function PayAnotherWallet() {
24
+ return (
25
+ <Variant
26
+ client={storyClient}
27
+ amount="10"
28
+ chain={base}
29
+ tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
30
+ receiverAddress="0x83Dd93fA5D8343094f850f90B3fb90088C1bB425"
31
+ />
32
+ );
33
+ }
34
+
35
+ export function BuyBaseNativeToken() {
36
+ return <Variant client={storyClient} chain={base} amount="0.1" />;
37
+ }
38
+
39
+ export function JPYCurrency() {
40
+ return (
41
+ <Variant client={storyClient} chain={base} amount="0.1" currency="JPY" />
42
+ );
43
+ }
44
+
45
+ export function NoThirdwebBranding() {
46
+ return (
47
+ <Variant
48
+ client={storyClient}
49
+ chain={base}
50
+ amount="0.1"
51
+ currency="JPY"
52
+ showThirdwebBranding={false}
53
+ />
54
+ );
55
+ }
56
+
57
+ export function BuyBaseUSDC() {
58
+ return (
59
+ <Variant
60
+ client={storyClient}
61
+ chain={base}
62
+ amount="0.1"
63
+ tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
64
+ />
65
+ );
66
+ }
67
+
68
+ export function CustomTitleDescriptionAndButtonLabel() {
69
+ return (
70
+ <Variant
71
+ client={storyClient}
72
+ title="Custom Title"
73
+ description="Custom Description"
74
+ chain={base}
75
+ amount="0.1"
76
+ tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
77
+ buttonLabel="Custom Button Label"
78
+ />
79
+ );
80
+ }
81
+
82
+ export function HideTitle() {
83
+ return (
84
+ <Variant
85
+ client={storyClient}
86
+ title=""
87
+ chain={base}
88
+ amount="0.1"
89
+ tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
90
+ />
91
+ );
17
92
  }
18
93
 
19
94
  export function UnsupportedChain() {
20
95
  return (
21
- <BuyWidget client={storyClient} chain={defineChain(84532)} amount="0.1" />
96
+ <Variant client={storyClient} chain={defineChain(84532)} amount="0.1" />
22
97
  );
23
98
  }
24
99
 
25
100
  export function UnsupportedToken() {
26
101
  return (
27
- <BuyWidget
102
+ <Variant
28
103
  client={storyClient}
29
104
  chain={base}
30
105
  amount="0.1"
@@ -35,7 +110,7 @@ export function UnsupportedToken() {
35
110
 
36
111
  export function OnlyCardSupported() {
37
112
  return (
38
- <BuyWidget
113
+ <Variant
39
114
  client={storyClient}
40
115
  chain={base}
41
116
  amount="0.1"
@@ -46,7 +121,7 @@ export function OnlyCardSupported() {
46
121
 
47
122
  export function OnlyCryptoSupported() {
48
123
  return (
49
- <BuyWidget
124
+ <Variant
50
125
  client={storyClient}
51
126
  chain={base}
52
127
  amount="0.1"
@@ -54,3 +129,23 @@ export function OnlyCryptoSupported() {
54
129
  />
55
130
  );
56
131
  }
132
+
133
+ export function LargeAmount() {
134
+ return (
135
+ <Variant
136
+ client={storyClient}
137
+ chain={ethereum}
138
+ tokenAddress="0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"
139
+ amount="150000"
140
+ />
141
+ );
142
+ }
143
+
144
+ function Variant(props: BuyWidgetProps) {
145
+ return (
146
+ <div style={{ display: "flex", flexDirection: "column", gap: "40px" }}>
147
+ <BuyWidget {...props} theme="dark" />
148
+ <BuyWidget {...props} theme="light" />
149
+ </div>
150
+ );
151
+ }
@@ -3,7 +3,6 @@ import {
3
3
  CustomThemeProvider,
4
4
  useCustomTheme,
5
5
  } from "../react/core/design-system/CustomThemeProvider.js";
6
- import type { Theme } from "../react/core/design-system/index.js";
7
6
  import { radius } from "../react/native/design-system/index.js";
8
7
 
9
8
  const clientId = process.env.STORYBOOK_CLIENT_ID;
@@ -16,15 +15,23 @@ export const storyClient = createThirdwebClient({
16
15
  clientId: clientId,
17
16
  });
18
17
 
19
- export const ModalThemeWrapper = (props: {
20
- children: React.ReactNode;
21
- theme: "light" | "dark" | Theme;
22
- }) => {
23
- const { theme } = props;
18
+ export const ModalThemeWrapper = (props: { children: React.ReactNode }) => {
24
19
  return (
25
- <CustomThemeProvider theme={theme}>
26
- <ModalWrapper>{props.children}</ModalWrapper>
27
- </CustomThemeProvider>
20
+ <div
21
+ style={{
22
+ display: "flex",
23
+ flexDirection: "column",
24
+ gap: "40px",
25
+ }}
26
+ >
27
+ <CustomThemeProvider theme={"dark"}>
28
+ <ModalWrapper>{props.children}</ModalWrapper>
29
+ </CustomThemeProvider>
30
+
31
+ <CustomThemeProvider theme={"light"}>
32
+ <ModalWrapper>{props.children}</ModalWrapper>
33
+ </CustomThemeProvider>
34
+ </div>
28
35
  );
29
36
  };
30
37
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.108.6";
1
+ export const version = "5.108.7";
@@ -46,7 +46,6 @@ export async function decodePaymentRequest(
46
46
  facilitator,
47
47
  resourceUrl,
48
48
  routeConfig = {},
49
- payTo,
50
49
  method,
51
50
  paymentData,
52
51
  } = args;
@@ -105,10 +104,9 @@ export async function decodePaymentRequest(
105
104
  resource: resourceUrl,
106
105
  description: description ?? "",
107
106
  mimeType: mimeType ?? "application/json",
108
- payTo: getAddress(payTo),
107
+ payTo: getAddress(facilitator.address),
109
108
  maxTimeoutSeconds: maxTimeoutSeconds ?? 300,
110
109
  asset: getAddress(asset.address),
111
- // TODO: Rename outputSchema to requestStructure
112
110
  outputSchema: {
113
111
  input: {
114
112
  type: "http",
@@ -119,7 +117,6 @@ export async function decodePaymentRequest(
119
117
  output: outputSchema,
120
118
  },
121
119
  extra: {
122
- facilitatorAddress: facilitator.address,
123
120
  ...((asset as ERC20TokenAmount["asset"]).eip712 ?? {}),
124
121
  },
125
122
  });
@@ -139,7 +136,7 @@ export async function decodePaymentRequest(
139
136
  };
140
137
  }
141
138
 
142
- // Verify payment
139
+ // decode b64 payment
143
140
  let decodedPayment: RequestedPaymentPayload;
144
141
  try {
145
142
  decodedPayment = decodePayment(paymentData);
@@ -5,6 +5,7 @@ import { withCache } from "../utils/promise/withCache.js";
5
5
  import type {
6
6
  FacilitatorSettleResponse,
7
7
  FacilitatorSupportedResponse,
8
+ FacilitatorVerifyResponse,
8
9
  RequestedPaymentPayload,
9
10
  RequestedPaymentRequirements,
10
11
  } from "./schemas.js";
@@ -35,7 +36,7 @@ export type ThirdwebX402Facilitator = {
35
36
  verify: (
36
37
  payload: RequestedPaymentPayload,
37
38
  paymentRequirements: RequestedPaymentRequirements,
38
- ) => Promise<VerifyResponse>;
39
+ ) => Promise<FacilitatorVerifyResponse>;
39
40
  settle: (
40
41
  payload: RequestedPaymentPayload,
41
42
  paymentRequirements: RequestedPaymentRequirements,
@@ -126,7 +127,6 @@ export function facilitator(
126
127
  },
127
128
  settle: {
128
129
  "x-secret-key": secretKey,
129
- "x-settlement-wallet-address": serverWalletAddress,
130
130
  ...(config.vaultAccessToken
131
131
  ? { "x-vault-access-token": config.vaultAccessToken }
132
132
  : {}),
@@ -149,7 +149,7 @@ export function facilitator(
149
149
  async verify(
150
150
  payload: RequestedPaymentPayload,
151
151
  paymentRequirements: RequestedPaymentRequirements,
152
- ): Promise<VerifyResponse> {
152
+ ): Promise<FacilitatorVerifyResponse> {
153
153
  const url = config.baseUrl ?? DEFAULT_BASE_URL;
154
154
 
155
155
  let headers = { "Content-Type": "application/json" };
@@ -6,6 +6,7 @@ import {
6
6
  PaymentRequirementsSchema,
7
7
  SettleResponseSchema,
8
8
  SupportedPaymentKindsResponseSchema,
9
+ VerifyResponseSchema,
9
10
  } from "x402/types";
10
11
  import { z } from "zod";
11
12
  import type { Chain } from "../chains/types.js";
@@ -52,11 +53,20 @@ export type RequestedPaymentRequirements = z.infer<
52
53
 
53
54
  const FacilitatorSettleResponseSchema = SettleResponseSchema.extend({
54
55
  network: FacilitatorNetworkSchema,
56
+ errorMessage: z.string().optional(),
55
57
  });
56
58
  export type FacilitatorSettleResponse = z.infer<
57
59
  typeof FacilitatorSettleResponseSchema
58
60
  >;
59
61
 
62
+ const FacilitatorVerifyResponseSchema = VerifyResponseSchema.extend({
63
+ errorMessage: z.string().optional(),
64
+ });
65
+
66
+ export type FacilitatorVerifyResponse = z.infer<
67
+ typeof FacilitatorVerifyResponseSchema
68
+ >;
69
+
60
70
  export const SupportedSignatureTypeSchema = z.enum([
61
71
  "TransferWithAuthorization",
62
72
  "Permit",
@@ -156,6 +156,7 @@ export async function settlePayment(
156
156
  },
157
157
  };
158
158
  } else {
159
+ const error = settlement.errorReason || "Settlement error";
159
160
  return {
160
161
  status: 402,
161
162
  responseHeaders: {
@@ -163,10 +164,9 @@ export async function settlePayment(
163
164
  },
164
165
  responseBody: {
165
166
  x402Version,
166
- error:
167
- errorMessages?.settlementFailed ||
168
- settlement.errorReason ||
169
- "Settlement failed",
167
+ error,
168
+ errorMessage:
169
+ errorMessages?.settlementFailed || settlement.errorMessage,
170
170
  accepts: paymentRequirements,
171
171
  },
172
172
  };
@@ -179,9 +179,10 @@ export async function settlePayment(
179
179
  },
180
180
  responseBody: {
181
181
  x402Version,
182
- error:
182
+ error: "Settlement error",
183
+ errorMessage:
183
184
  errorMessages?.settlementFailed ||
184
- (error instanceof Error ? error.message : "Settlement error"),
185
+ (error instanceof Error ? error.message : undefined),
185
186
  accepts: paymentRequirements,
186
187
  },
187
188
  };
package/src/x402/sign.ts CHANGED
@@ -230,18 +230,13 @@ async function signERC3009Authorization(
230
230
 
231
231
  async function signERC2612Permit(
232
232
  account: Account,
233
- { from, value, validBefore, nonce }: ExactEvmPayloadAuthorization,
233
+ { from, to, value, validBefore, nonce }: ExactEvmPayloadAuthorization,
234
234
  { asset, network, extra }: RequestedPaymentRequirements,
235
235
  ): Promise<{ signature: Hex }> {
236
236
  const chainId = networkToChainId(network);
237
237
  const name = extra?.name;
238
238
  const version = extra?.version;
239
- const facilitatorAddress = extra?.facilitatorAddress;
240
- if (!facilitatorAddress) {
241
- throw new Error(
242
- "facilitatorAddress is required in PaymentRequirements extra to pay with permit-based assets",
243
- );
244
- }
239
+
245
240
  if (!name || !version) {
246
241
  throw new Error(
247
242
  "name and version are required in PaymentRequirements extra to pay with permit-based assets",
@@ -268,7 +263,7 @@ async function signERC2612Permit(
268
263
  primaryType: "Permit" as const,
269
264
  message: {
270
265
  owner: getAddress(from),
271
- spender: getAddress(facilitatorAddress), // approve the facilitator
266
+ spender: getAddress(to),
272
267
  value: BigInt(value),
273
268
  nonce: hexToBigInt(nonce as Hex),
274
269
  deadline: BigInt(validBefore),
package/src/x402/types.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { Money, PaymentMiddlewareConfig } from "x402/types";
2
2
  import type z from "zod";
3
3
  import type { Chain } from "../chains/types.js";
4
- import type { Address } from "../utils/address.js";
5
4
  import type { Prettify } from "../utils/type-utils.js";
6
5
  import type { ThirdwebX402Facilitator, WaitUntil } from "./facilitator.js";
7
6
  import type {
@@ -27,8 +26,6 @@ export type PaymentArgs = {
27
26
  method: "GET" | "POST" | ({} & string);
28
27
  /** The payment data/proof provided by the client, typically from the X-PAYMENT header */
29
28
  paymentData?: string | null;
30
- /** The wallet address that should receive the payment */
31
- payTo: Address;
32
29
  /** The blockchain network where the payment should be processed */
33
30
  network: FacilitatorNetwork | Chain;
34
31
  /** The price for accessing the resource - either a USD amount (e.g., "$0.10") or a specific token amount */
@@ -37,6 +34,8 @@ export type PaymentArgs = {
37
34
  facilitator: ThirdwebX402Facilitator;
38
35
  /** Optional configuration for the payment middleware route */
39
36
  routeConfig?: PaymentMiddlewareConfig;
37
+ /** @deprecated Use facilitator.address instead */
38
+ payTo?: string;
40
39
  };
41
40
 
42
41
  export type SettlePaymentArgs = PaymentArgs & {
@@ -50,8 +49,10 @@ export type PaymentRequiredResult = {
50
49
  responseBody: {
51
50
  /** The X402 protocol version */
52
51
  x402Version: number;
53
- /** Human-readable error message */
52
+ /** error code */
54
53
  error: string;
54
+ /** Human-readable error message */
55
+ errorMessage?: string;
55
56
  /** Array of acceptable payment methods and requirements */
56
57
  accepts: RequestedPaymentRequirements[];
57
58
  /** Optional payer address if verification partially succeeded */
@@ -101,6 +101,7 @@ export async function verifyPayment(
101
101
  selectedPaymentRequirements,
102
102
  };
103
103
  } else {
104
+ const error = verification.invalidReason || "Verification failed";
104
105
  return {
105
106
  status: 402,
106
107
  responseHeaders: {
@@ -108,10 +109,9 @@ export async function verifyPayment(
108
109
  },
109
110
  responseBody: {
110
111
  x402Version,
111
- error:
112
- errorMessages?.verificationFailed ||
113
- verification.invalidReason ||
114
- "Verification failed",
112
+ error: error,
113
+ errorMessage:
114
+ errorMessages?.verificationFailed || verification.errorMessage,
115
115
  accepts: paymentRequirements,
116
116
  },
117
117
  };
@@ -124,9 +124,10 @@ export async function verifyPayment(
124
124
  },
125
125
  responseBody: {
126
126
  x402Version,
127
- error:
127
+ error: "Verification error",
128
+ errorMessage:
128
129
  errorMessages?.verificationFailed ||
129
- (error instanceof Error ? error.message : "Verification error"),
130
+ (error instanceof Error ? error.message : undefined),
130
131
  accepts: paymentRequirements,
131
132
  },
132
133
  };