thirdweb 5.102.7-nightly-9f6c1a4820e37428dec6427cf77a12ab463f119d-20250616000412 → 5.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (543) hide show
  1. package/dist/cjs/bridge/Routes.js +4 -1
  2. package/dist/cjs/bridge/Routes.js.map +1 -1
  3. package/dist/cjs/bridge/Token.js +57 -0
  4. package/dist/cjs/bridge/Token.js.map +1 -1
  5. package/dist/cjs/bridge/types/Errors.js +9 -0
  6. package/dist/cjs/bridge/types/Errors.js.map +1 -1
  7. package/dist/cjs/exports/react.js +9 -1
  8. package/dist/cjs/exports/react.js.map +1 -1
  9. package/dist/cjs/pay/buyWithFiat/getQuote.js +2 -2
  10. package/dist/cjs/pay/convert/cryptoToFiat.js +3 -3
  11. package/dist/cjs/pay/convert/cryptoToFiat.js.map +1 -1
  12. package/dist/cjs/pay/convert/fiatToCrypto.js +3 -3
  13. package/dist/cjs/pay/convert/fiatToCrypto.js.map +1 -1
  14. package/dist/cjs/pay/convert/get-token.js +15 -3
  15. package/dist/cjs/pay/convert/get-token.js.map +1 -1
  16. package/dist/cjs/pay/utils/commonTypes.js +1 -1
  17. package/dist/cjs/react/core/adapters/WindowAdapter.js +3 -0
  18. package/dist/cjs/react/core/adapters/WindowAdapter.js.map +1 -0
  19. package/dist/cjs/react/core/errors/mapBridgeError.js +27 -0
  20. package/dist/cjs/react/core/errors/mapBridgeError.js.map +1 -0
  21. package/dist/cjs/react/core/hooks/others/useChainQuery.js +1 -1
  22. package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
  23. package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js +40 -0
  24. package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js.map +1 -0
  25. package/dist/cjs/react/core/hooks/useBridgeError.js +94 -0
  26. package/dist/cjs/react/core/hooks/useBridgeError.js.map +1 -0
  27. package/dist/cjs/react/core/hooks/useBridgePrepare.js +90 -0
  28. package/dist/cjs/react/core/hooks/useBridgePrepare.js.map +1 -0
  29. package/dist/cjs/react/core/hooks/useBridgeQuote.js +50 -0
  30. package/dist/cjs/react/core/hooks/useBridgeQuote.js.map +1 -0
  31. package/dist/cjs/react/core/hooks/useBridgeRoutes.js +61 -0
  32. package/dist/cjs/react/core/hooks/useBridgeRoutes.js.map +1 -0
  33. package/dist/cjs/react/core/hooks/usePaymentMethods.js +154 -0
  34. package/dist/cjs/react/core/hooks/usePaymentMethods.js.map +1 -0
  35. package/dist/cjs/react/core/hooks/useStepExecutor.js +408 -0
  36. package/dist/cjs/react/core/hooks/useStepExecutor.js.map +1 -0
  37. package/dist/cjs/react/core/hooks/useTransactionDetails.js +126 -0
  38. package/dist/cjs/react/core/hooks/useTransactionDetails.js.map +1 -0
  39. package/dist/cjs/react/core/machines/paymentMachine.js +189 -0
  40. package/dist/cjs/react/core/machines/paymentMachine.js.map +1 -0
  41. package/dist/cjs/react/web/adapters/WindowAdapter.js +25 -0
  42. package/dist/cjs/react/web/adapters/WindowAdapter.js.map +1 -0
  43. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +5 -0
  44. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  45. package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js +107 -0
  46. package/dist/cjs/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -0
  47. package/dist/cjs/react/web/ui/Bridge/BuyWidget.js +177 -0
  48. package/dist/cjs/react/web/ui/Bridge/BuyWidget.js.map +1 -0
  49. package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js +154 -0
  50. package/dist/cjs/react/web/ui/Bridge/CheckoutWidget.js.map +1 -0
  51. package/dist/cjs/react/web/ui/Bridge/DirectPayment.js +62 -0
  52. package/dist/cjs/react/web/ui/Bridge/DirectPayment.js.map +1 -0
  53. package/dist/cjs/react/web/ui/Bridge/ErrorBanner.js +26 -0
  54. package/dist/cjs/react/web/ui/Bridge/ErrorBanner.js.map +1 -0
  55. package/dist/cjs/react/web/ui/Bridge/FundWallet.js +122 -0
  56. package/dist/cjs/react/web/ui/Bridge/FundWallet.js.map +1 -0
  57. package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js +99 -0
  58. package/dist/cjs/react/web/ui/Bridge/QuoteLoader.js.map +1 -0
  59. package/dist/cjs/react/web/ui/Bridge/StepRunner.js +179 -0
  60. package/dist/cjs/react/web/ui/Bridge/StepRunner.js.map +1 -0
  61. package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js +117 -0
  62. package/dist/cjs/react/web/ui/Bridge/TransactionPayment.js.map +1 -0
  63. package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js +179 -0
  64. package/dist/cjs/react/web/ui/Bridge/TransactionWidget.js.map +1 -0
  65. package/dist/cjs/react/web/ui/Bridge/UnsupportedTokenScreen.js +23 -0
  66. package/dist/cjs/react/web/ui/Bridge/UnsupportedTokenScreen.js.map +1 -0
  67. package/dist/cjs/react/web/ui/Bridge/common/TokenAndChain.js +101 -0
  68. package/dist/cjs/react/web/ui/Bridge/common/TokenAndChain.js.map +1 -0
  69. package/dist/cjs/react/web/ui/Bridge/common/TokenBalanceRow.js +57 -0
  70. package/dist/cjs/react/web/ui/Bridge/common/TokenBalanceRow.js.map +1 -0
  71. package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js +27 -0
  72. package/dist/cjs/react/web/ui/Bridge/common/WithHeader.js.map +1 -0
  73. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js +121 -0
  74. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -0
  75. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js +80 -0
  76. package/dist/cjs/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -0
  77. package/dist/cjs/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js +83 -0
  78. package/dist/cjs/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js.map +1 -0
  79. package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js +111 -0
  80. package/dist/cjs/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -0
  81. package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js +71 -0
  82. package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -0
  83. package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +54 -0
  84. package/dist/cjs/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -0
  85. package/dist/cjs/react/web/ui/Bridge/payment-success/PaymentReceipt.js +140 -0
  86. package/dist/cjs/react/web/ui/Bridge/payment-success/PaymentReceipt.js.map +1 -0
  87. package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js +61 -0
  88. package/dist/cjs/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -0
  89. package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
  90. package/dist/cjs/react/web/ui/ConnectWallet/constants.js +1 -1
  91. package/dist/cjs/react/web/ui/ConnectWallet/icons/CreditCardIcon.js +12 -0
  92. package/dist/cjs/react/web/ui/ConnectWallet/icons/CreditCardIcon.js.map +1 -0
  93. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  94. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +3 -1
  95. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
  96. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +4 -0
  97. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
  98. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  99. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js +4 -1
  100. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js.map +1 -1
  101. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +1 -1
  102. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -1
  103. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +1 -1
  104. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
  105. package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +11 -0
  106. package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
  107. package/dist/cjs/react/web/ui/PayEmbed.js +2 -1
  108. package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
  109. package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js +6 -5
  110. package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
  111. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +43 -4
  112. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
  113. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +8 -4
  114. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  115. package/dist/cjs/react/web/ui/components/ChainName.js +2 -1
  116. package/dist/cjs/react/web/ui/components/ChainName.js.map +1 -1
  117. package/dist/cjs/react/web/ui/components/TokenIcon.js +6 -3
  118. package/dist/cjs/react/web/ui/components/TokenIcon.js.map +1 -1
  119. package/dist/cjs/react/web/ui/components/buttons.js +1 -5
  120. package/dist/cjs/react/web/ui/components/buttons.js.map +1 -1
  121. package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js +228 -0
  122. package/dist/cjs/stories/Bridge/BridgeOrchestrator.stories.js.map +1 -0
  123. package/dist/cjs/stories/Bridge/DirectPayment.stories.js +194 -0
  124. package/dist/cjs/stories/Bridge/DirectPayment.stories.js.map +1 -0
  125. package/dist/cjs/stories/Bridge/ErrorBanner.stories.js +153 -0
  126. package/dist/cjs/stories/Bridge/ErrorBanner.stories.js.map +1 -0
  127. package/dist/cjs/stories/Bridge/FundWallet.stories.js +173 -0
  128. package/dist/cjs/stories/Bridge/FundWallet.stories.js.map +1 -0
  129. package/dist/cjs/stories/Bridge/PaymentDetails.stories.js +430 -0
  130. package/dist/cjs/stories/Bridge/PaymentDetails.stories.js.map +1 -0
  131. package/dist/cjs/stories/Bridge/PaymentSelection.stories.js +151 -0
  132. package/dist/cjs/stories/Bridge/PaymentSelection.stories.js.map +1 -0
  133. package/dist/cjs/stories/Bridge/StepRunner.stories.js +82 -0
  134. package/dist/cjs/stories/Bridge/StepRunner.stories.js.map +1 -0
  135. package/dist/cjs/stories/Bridge/SuccessScreen.stories.js +180 -0
  136. package/dist/cjs/stories/Bridge/SuccessScreen.stories.js.map +1 -0
  137. package/dist/cjs/stories/Bridge/TransactionPayment.stories.js +139 -0
  138. package/dist/cjs/stories/Bridge/TransactionPayment.stories.js.map +1 -0
  139. package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js +94 -0
  140. package/dist/cjs/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -0
  141. package/dist/cjs/stories/Bridge/fixtures.js +731 -0
  142. package/dist/cjs/stories/Bridge/fixtures.js.map +1 -0
  143. package/dist/cjs/stories/TokenBalanceRow.stories.js +81 -0
  144. package/dist/cjs/stories/TokenBalanceRow.stories.js.map +1 -0
  145. package/dist/cjs/stories/WalletRow.stories.js +120 -0
  146. package/dist/cjs/stories/WalletRow.stories.js.map +1 -0
  147. package/dist/cjs/stories/utils.js +19 -1
  148. package/dist/cjs/stories/utils.js.map +1 -1
  149. package/dist/cjs/version.js +1 -1
  150. package/dist/cjs/version.js.map +1 -1
  151. package/dist/esm/bridge/Routes.js +4 -1
  152. package/dist/esm/bridge/Routes.js.map +1 -1
  153. package/dist/esm/bridge/Token.js +56 -0
  154. package/dist/esm/bridge/Token.js.map +1 -1
  155. package/dist/esm/bridge/types/Errors.js +9 -0
  156. package/dist/esm/bridge/types/Errors.js.map +1 -1
  157. package/dist/esm/exports/react.js +4 -0
  158. package/dist/esm/exports/react.js.map +1 -1
  159. package/dist/esm/pay/buyWithFiat/getQuote.js +2 -2
  160. package/dist/esm/pay/convert/cryptoToFiat.js +4 -4
  161. package/dist/esm/pay/convert/cryptoToFiat.js.map +1 -1
  162. package/dist/esm/pay/convert/fiatToCrypto.js +4 -4
  163. package/dist/esm/pay/convert/fiatToCrypto.js.map +1 -1
  164. package/dist/esm/pay/convert/get-token.js +15 -3
  165. package/dist/esm/pay/convert/get-token.js.map +1 -1
  166. package/dist/esm/pay/utils/commonTypes.js +1 -1
  167. package/dist/esm/react/core/adapters/WindowAdapter.js +2 -0
  168. package/dist/esm/react/core/adapters/WindowAdapter.js.map +1 -0
  169. package/dist/esm/react/core/errors/mapBridgeError.js +23 -0
  170. package/dist/esm/react/core/errors/mapBridgeError.js.map +1 -0
  171. package/dist/esm/react/core/hooks/others/useChainQuery.js +1 -1
  172. package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
  173. package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js +37 -0
  174. package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.js.map +1 -0
  175. package/dist/esm/react/core/hooks/useBridgeError.js +91 -0
  176. package/dist/esm/react/core/hooks/useBridgeError.js.map +1 -0
  177. package/dist/esm/react/core/hooks/useBridgePrepare.js +87 -0
  178. package/dist/esm/react/core/hooks/useBridgePrepare.js.map +1 -0
  179. package/dist/esm/react/core/hooks/useBridgeQuote.js +47 -0
  180. package/dist/esm/react/core/hooks/useBridgeQuote.js.map +1 -0
  181. package/dist/esm/react/core/hooks/useBridgeRoutes.js +58 -0
  182. package/dist/esm/react/core/hooks/useBridgeRoutes.js.map +1 -0
  183. package/dist/esm/react/core/hooks/usePaymentMethods.js +151 -0
  184. package/dist/esm/react/core/hooks/usePaymentMethods.js.map +1 -0
  185. package/dist/esm/react/core/hooks/useStepExecutor.js +405 -0
  186. package/dist/esm/react/core/hooks/useStepExecutor.js.map +1 -0
  187. package/dist/esm/react/core/hooks/useTransactionDetails.js +123 -0
  188. package/dist/esm/react/core/hooks/useTransactionDetails.js.map +1 -0
  189. package/dist/esm/react/core/machines/paymentMachine.js +186 -0
  190. package/dist/esm/react/core/machines/paymentMachine.js.map +1 -0
  191. package/dist/esm/react/web/adapters/WindowAdapter.js +21 -0
  192. package/dist/esm/react/web/adapters/WindowAdapter.js.map +1 -0
  193. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +5 -0
  194. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  195. package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js +104 -0
  196. package/dist/esm/react/web/ui/Bridge/BridgeOrchestrator.js.map +1 -0
  197. package/dist/esm/react/web/ui/Bridge/BuyWidget.js +174 -0
  198. package/dist/esm/react/web/ui/Bridge/BuyWidget.js.map +1 -0
  199. package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js +151 -0
  200. package/dist/esm/react/web/ui/Bridge/CheckoutWidget.js.map +1 -0
  201. package/dist/esm/react/web/ui/Bridge/DirectPayment.js +59 -0
  202. package/dist/esm/react/web/ui/Bridge/DirectPayment.js.map +1 -0
  203. package/dist/esm/react/web/ui/Bridge/ErrorBanner.js +23 -0
  204. package/dist/esm/react/web/ui/Bridge/ErrorBanner.js.map +1 -0
  205. package/dist/esm/react/web/ui/Bridge/FundWallet.js +119 -0
  206. package/dist/esm/react/web/ui/Bridge/FundWallet.js.map +1 -0
  207. package/dist/esm/react/web/ui/Bridge/QuoteLoader.js +96 -0
  208. package/dist/esm/react/web/ui/Bridge/QuoteLoader.js.map +1 -0
  209. package/dist/esm/react/web/ui/Bridge/StepRunner.js +176 -0
  210. package/dist/esm/react/web/ui/Bridge/StepRunner.js.map +1 -0
  211. package/dist/esm/react/web/ui/Bridge/TransactionPayment.js +114 -0
  212. package/dist/esm/react/web/ui/Bridge/TransactionPayment.js.map +1 -0
  213. package/dist/esm/react/web/ui/Bridge/TransactionWidget.js +176 -0
  214. package/dist/esm/react/web/ui/Bridge/TransactionWidget.js.map +1 -0
  215. package/dist/esm/react/web/ui/Bridge/UnsupportedTokenScreen.js +20 -0
  216. package/dist/esm/react/web/ui/Bridge/UnsupportedTokenScreen.js.map +1 -0
  217. package/dist/esm/react/web/ui/Bridge/common/TokenAndChain.js +96 -0
  218. package/dist/esm/react/web/ui/Bridge/common/TokenAndChain.js.map +1 -0
  219. package/dist/esm/react/web/ui/Bridge/common/TokenBalanceRow.js +54 -0
  220. package/dist/esm/react/web/ui/Bridge/common/TokenBalanceRow.js.map +1 -0
  221. package/dist/esm/react/web/ui/Bridge/common/WithHeader.js +24 -0
  222. package/dist/esm/react/web/ui/Bridge/common/WithHeader.js.map +1 -0
  223. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js +119 -0
  224. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentDetails.js.map +1 -0
  225. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js +77 -0
  226. package/dist/esm/react/web/ui/Bridge/payment-details/PaymentOverview.js.map +1 -0
  227. package/dist/esm/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js +80 -0
  228. package/dist/esm/react/web/ui/Bridge/payment-selection/FiatProviderSelection.js.map +1 -0
  229. package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js +108 -0
  230. package/dist/esm/react/web/ui/Bridge/payment-selection/PaymentSelection.js.map +1 -0
  231. package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js +68 -0
  232. package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -0
  233. package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js +51 -0
  234. package/dist/esm/react/web/ui/Bridge/payment-selection/WalletFiatSelection.js.map +1 -0
  235. package/dist/esm/react/web/ui/Bridge/payment-success/PaymentReceipt.js +137 -0
  236. package/dist/esm/react/web/ui/Bridge/payment-success/PaymentReceipt.js.map +1 -0
  237. package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js +58 -0
  238. package/dist/esm/react/web/ui/Bridge/payment-success/SuccessScreen.js.map +1 -0
  239. package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
  240. package/dist/esm/react/web/ui/ConnectWallet/constants.js +1 -1
  241. package/dist/esm/react/web/ui/ConnectWallet/icons/CreditCardIcon.js +8 -0
  242. package/dist/esm/react/web/ui/ConnectWallet/icons/CreditCardIcon.js.map +1 -0
  243. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  244. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +3 -1
  245. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
  246. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +3 -0
  247. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
  248. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  249. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js +4 -1
  250. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.js.map +1 -1
  251. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +1 -1
  252. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -1
  253. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +1 -1
  254. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
  255. package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +9 -0
  256. package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
  257. package/dist/esm/react/web/ui/PayEmbed.js +2 -1
  258. package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
  259. package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js +6 -5
  260. package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js.map +1 -1
  261. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +45 -6
  262. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
  263. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +8 -4
  264. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  265. package/dist/esm/react/web/ui/components/ChainName.js +2 -2
  266. package/dist/esm/react/web/ui/components/ChainName.js.map +1 -1
  267. package/dist/esm/react/web/ui/components/TokenIcon.js +7 -4
  268. package/dist/esm/react/web/ui/components/TokenIcon.js.map +1 -1
  269. package/dist/esm/react/web/ui/components/buttons.js +1 -5
  270. package/dist/esm/react/web/ui/components/buttons.js.map +1 -1
  271. package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js +226 -0
  272. package/dist/esm/stories/Bridge/BridgeOrchestrator.stories.js.map +1 -0
  273. package/dist/esm/stories/Bridge/DirectPayment.stories.js +191 -0
  274. package/dist/esm/stories/Bridge/DirectPayment.stories.js.map +1 -0
  275. package/dist/esm/stories/Bridge/ErrorBanner.stories.js +150 -0
  276. package/dist/esm/stories/Bridge/ErrorBanner.stories.js.map +1 -0
  277. package/dist/esm/stories/Bridge/FundWallet.stories.js +170 -0
  278. package/dist/esm/stories/Bridge/FundWallet.stories.js.map +1 -0
  279. package/dist/esm/stories/Bridge/PaymentDetails.stories.js +427 -0
  280. package/dist/esm/stories/Bridge/PaymentDetails.stories.js.map +1 -0
  281. package/dist/esm/stories/Bridge/PaymentSelection.stories.js +148 -0
  282. package/dist/esm/stories/Bridge/PaymentSelection.stories.js.map +1 -0
  283. package/dist/esm/stories/Bridge/StepRunner.stories.js +79 -0
  284. package/dist/esm/stories/Bridge/StepRunner.stories.js.map +1 -0
  285. package/dist/esm/stories/Bridge/SuccessScreen.stories.js +177 -0
  286. package/dist/esm/stories/Bridge/SuccessScreen.stories.js.map +1 -0
  287. package/dist/esm/stories/Bridge/TransactionPayment.stories.js +136 -0
  288. package/dist/esm/stories/Bridge/TransactionPayment.stories.js.map +1 -0
  289. package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js +91 -0
  290. package/dist/esm/stories/Bridge/UnsupportedTokenScreen.stories.js.map +1 -0
  291. package/dist/esm/stories/Bridge/fixtures.js +728 -0
  292. package/dist/esm/stories/Bridge/fixtures.js.map +1 -0
  293. package/dist/esm/stories/TokenBalanceRow.stories.js +78 -0
  294. package/dist/esm/stories/TokenBalanceRow.stories.js.map +1 -0
  295. package/dist/esm/stories/WalletRow.stories.js +117 -0
  296. package/dist/esm/stories/WalletRow.stories.js.map +1 -0
  297. package/dist/esm/stories/utils.js +17 -0
  298. package/dist/esm/stories/utils.js.map +1 -1
  299. package/dist/esm/version.js +1 -1
  300. package/dist/esm/version.js.map +1 -1
  301. package/dist/types/bridge/Routes.d.ts +1 -0
  302. package/dist/types/bridge/Routes.d.ts.map +1 -1
  303. package/dist/types/bridge/Token.d.ts +48 -1
  304. package/dist/types/bridge/Token.d.ts.map +1 -1
  305. package/dist/types/bridge/types/BridgeAction.d.ts +1 -1
  306. package/dist/types/bridge/types/BridgeAction.d.ts.map +1 -1
  307. package/dist/types/bridge/types/Errors.d.ts +1 -0
  308. package/dist/types/bridge/types/Errors.d.ts.map +1 -1
  309. package/dist/types/exports/react.d.ts +4 -0
  310. package/dist/types/exports/react.d.ts.map +1 -1
  311. package/dist/types/pay/convert/get-token.d.ts +2 -1
  312. package/dist/types/pay/convert/get-token.d.ts.map +1 -1
  313. package/dist/types/pay/utils/commonTypes.d.ts +1 -1
  314. package/dist/types/react/core/adapters/WindowAdapter.d.ts +14 -0
  315. package/dist/types/react/core/adapters/WindowAdapter.d.ts.map +1 -0
  316. package/dist/types/react/core/errors/mapBridgeError.d.ts +17 -0
  317. package/dist/types/react/core/errors/mapBridgeError.d.ts.map +1 -0
  318. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +14 -6
  319. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  320. package/dist/types/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.d.ts +54 -0
  321. package/dist/types/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.d.ts.map +1 -0
  322. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +1 -1
  323. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  324. package/dist/types/react/core/hooks/useBridgeError.d.ts +72 -0
  325. package/dist/types/react/core/hooks/useBridgeError.d.ts.map +1 -0
  326. package/dist/types/react/core/hooks/useBridgePrepare.d.ts +75 -0
  327. package/dist/types/react/core/hooks/useBridgePrepare.d.ts.map +1 -0
  328. package/dist/types/react/core/hooks/useBridgeQuote.d.ts +14 -0
  329. package/dist/types/react/core/hooks/useBridgeQuote.d.ts.map +1 -0
  330. package/dist/types/react/core/hooks/useBridgeRoutes.d.ts +30 -0
  331. package/dist/types/react/core/hooks/useBridgeRoutes.d.ts.map +1 -0
  332. package/dist/types/react/core/hooks/usePaymentMethods.d.ts +36 -0
  333. package/dist/types/react/core/hooks/usePaymentMethods.d.ts.map +1 -0
  334. package/dist/types/react/core/hooks/useStepExecutor.d.ts +67 -0
  335. package/dist/types/react/core/hooks/useStepExecutor.d.ts.map +1 -0
  336. package/dist/types/react/core/hooks/useTransactionDetails.d.ts +31 -0
  337. package/dist/types/react/core/hooks/useTransactionDetails.d.ts.map +1 -0
  338. package/dist/types/react/core/machines/paymentMachine.d.ts +86 -0
  339. package/dist/types/react/core/machines/paymentMachine.d.ts.map +1 -0
  340. package/dist/types/react/web/adapters/WindowAdapter.d.ts +19 -0
  341. package/dist/types/react/web/adapters/WindowAdapter.d.ts.map +1 -0
  342. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +5 -0
  343. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  344. package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts +78 -0
  345. package/dist/types/react/web/ui/Bridge/BridgeOrchestrator.d.ts.map +1 -0
  346. package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts +325 -0
  347. package/dist/types/react/web/ui/Bridge/BuyWidget.d.ts.map +1 -0
  348. package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts +328 -0
  349. package/dist/types/react/web/ui/Bridge/CheckoutWidget.d.ts.map +1 -0
  350. package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts +27 -0
  351. package/dist/types/react/web/ui/Bridge/DirectPayment.d.ts.map +1 -0
  352. package/dist/types/react/web/ui/Bridge/ErrorBanner.d.ts +17 -0
  353. package/dist/types/react/web/ui/Bridge/ErrorBanner.d.ts.map +1 -0
  354. package/dist/types/react/web/ui/Bridge/FundWallet.d.ts +35 -0
  355. package/dist/types/react/web/ui/Bridge/FundWallet.d.ts.map +1 -0
  356. package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts +57 -0
  357. package/dist/types/react/web/ui/Bridge/QuoteLoader.d.ts.map +1 -0
  358. package/dist/types/react/web/ui/Bridge/StepRunner.d.ts +39 -0
  359. package/dist/types/react/web/ui/Bridge/StepRunner.d.ts.map +1 -0
  360. package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts +27 -0
  361. package/dist/types/react/web/ui/Bridge/TransactionPayment.d.ts.map +1 -0
  362. package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts +355 -0
  363. package/dist/types/react/web/ui/Bridge/TransactionWidget.d.ts.map +1 -0
  364. package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts +13 -0
  365. package/dist/types/react/web/ui/Bridge/UnsupportedTokenScreen.d.ts.map +1 -0
  366. package/dist/types/react/web/ui/Bridge/common/TokenAndChain.d.ts +16 -0
  367. package/dist/types/react/web/ui/Bridge/common/TokenAndChain.d.ts.map +1 -0
  368. package/dist/types/react/web/ui/Bridge/common/TokenBalanceRow.d.ts +10 -0
  369. package/dist/types/react/web/ui/Bridge/common/TokenBalanceRow.d.ts.map +1 -0
  370. package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts +9 -0
  371. package/dist/types/react/web/ui/Bridge/common/WithHeader.d.ts.map +1 -0
  372. package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts +36 -0
  373. package/dist/types/react/web/ui/Bridge/payment-details/PaymentDetails.d.ts.map +1 -0
  374. package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts +15 -0
  375. package/dist/types/react/web/ui/Bridge/payment-details/PaymentOverview.d.ts.map +1 -0
  376. package/dist/types/react/web/ui/Bridge/payment-selection/FiatProviderSelection.d.ts +12 -0
  377. package/dist/types/react/web/ui/Bridge/payment-selection/FiatProviderSelection.d.ts.map +1 -0
  378. package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts +50 -0
  379. package/dist/types/react/web/ui/Bridge/payment-selection/PaymentSelection.d.ts.map +1 -0
  380. package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts +15 -0
  381. package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts.map +1 -0
  382. package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts +12 -0
  383. package/dist/types/react/web/ui/Bridge/payment-selection/WalletFiatSelection.d.ts.map +1 -0
  384. package/dist/types/react/web/ui/Bridge/payment-success/PaymentReceipt.d.ts +24 -0
  385. package/dist/types/react/web/ui/Bridge/payment-success/PaymentReceipt.d.ts.map +1 -0
  386. package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts +28 -0
  387. package/dist/types/react/web/ui/Bridge/payment-success/SuccessScreen.d.ts.map +1 -0
  388. package/dist/types/react/web/ui/ConnectWallet/constants.d.ts +1 -1
  389. package/dist/types/react/web/ui/ConnectWallet/icons/CreditCardIcon.d.ts +6 -0
  390. package/dist/types/react/web/ui/ConnectWallet/icons/CreditCardIcon.d.ts.map +1 -0
  391. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
  392. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts.map +1 -1
  393. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +4 -0
  394. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts.map +1 -1
  395. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +4 -1
  396. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
  397. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.d.ts.map +1 -1
  398. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts.map +1 -1
  399. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
  400. package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts +2 -0
  401. package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
  402. package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
  403. package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts.map +1 -1
  404. package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts +2 -0
  405. package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -1
  406. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
  407. package/dist/types/react/web/ui/components/ChainName.d.ts +3 -0
  408. package/dist/types/react/web/ui/components/ChainName.d.ts.map +1 -1
  409. package/dist/types/react/web/ui/components/TokenIcon.d.ts.map +1 -1
  410. package/dist/types/react/web/ui/components/buttons.d.ts.map +1 -1
  411. package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts +90 -0
  412. package/dist/types/stories/Bridge/BridgeOrchestrator.stories.d.ts.map +1 -0
  413. package/dist/types/stories/Bridge/DirectPayment.stories.d.ts +65 -0
  414. package/dist/types/stories/Bridge/DirectPayment.stories.d.ts.map +1 -0
  415. package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts +55 -0
  416. package/dist/types/stories/Bridge/ErrorBanner.stories.d.ts.map +1 -0
  417. package/dist/types/stories/Bridge/FundWallet.stories.d.ts +63 -0
  418. package/dist/types/stories/Bridge/FundWallet.stories.d.ts.map +1 -0
  419. package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts +70 -0
  420. package/dist/types/stories/Bridge/PaymentDetails.stories.d.ts.map +1 -0
  421. package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts +65 -0
  422. package/dist/types/stories/Bridge/PaymentSelection.stories.d.ts.map +1 -0
  423. package/dist/types/stories/Bridge/StepRunner.stories.d.ts +61 -0
  424. package/dist/types/stories/Bridge/StepRunner.stories.d.ts.map +1 -0
  425. package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts +58 -0
  426. package/dist/types/stories/Bridge/SuccessScreen.stories.d.ts.map +1 -0
  427. package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts +55 -0
  428. package/dist/types/stories/Bridge/TransactionPayment.stories.d.ts.map +1 -0
  429. package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts +39 -0
  430. package/dist/types/stories/Bridge/UnsupportedTokenScreen.stories.d.ts.map +1 -0
  431. package/dist/types/stories/Bridge/fixtures.d.ts +37 -0
  432. package/dist/types/stories/Bridge/fixtures.d.ts.map +1 -0
  433. package/dist/types/stories/TokenBalanceRow.stories.d.ts +53 -0
  434. package/dist/types/stories/TokenBalanceRow.stories.d.ts.map +1 -0
  435. package/dist/types/stories/WalletRow.stories.d.ts +63 -0
  436. package/dist/types/stories/WalletRow.stories.d.ts.map +1 -0
  437. package/dist/types/stories/utils.d.ts +5 -0
  438. package/dist/types/stories/utils.d.ts.map +1 -1
  439. package/dist/types/utils/nft/parseNft.d.ts +2 -2
  440. package/dist/types/utils/nft/parseNft.d.ts.map +1 -1
  441. package/dist/types/version.d.ts +1 -1
  442. package/dist/types/version.d.ts.map +1 -1
  443. package/package.json +2 -1
  444. package/src/bridge/Routes.ts +5 -0
  445. package/src/bridge/Token.ts +82 -1
  446. package/src/bridge/types/BridgeAction.ts +1 -1
  447. package/src/bridge/types/Errors.ts +11 -0
  448. package/src/exports/react.ts +16 -0
  449. package/src/pay/buyWithFiat/getQuote.ts +2 -2
  450. package/src/pay/convert/cryptoToFiat.ts +4 -4
  451. package/src/pay/convert/fiatToCrypto.ts +4 -4
  452. package/src/pay/convert/get-token.ts +17 -4
  453. package/src/pay/utils/commonTypes.ts +1 -1
  454. package/src/react/components.md +134 -0
  455. package/src/react/core/adapters/.keep +2 -0
  456. package/src/react/core/adapters/WindowAdapter.ts +13 -0
  457. package/src/react/core/errors/.keep +2 -0
  458. package/src/react/core/errors/mapBridgeError.test.ts +98 -0
  459. package/src/react/core/errors/mapBridgeError.ts +25 -0
  460. package/src/react/core/hooks/connection/ConnectButtonProps.ts +42 -37
  461. package/src/react/core/hooks/others/useChainQuery.ts +1 -1
  462. package/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.ts +100 -0
  463. package/src/react/core/hooks/transaction/useSendTransaction.ts +1 -1
  464. package/src/react/core/hooks/useBridgeError.test.ts +172 -0
  465. package/src/react/core/hooks/useBridgeError.ts +149 -0
  466. package/src/react/core/hooks/useBridgePrepare.test.ts +161 -0
  467. package/src/react/core/hooks/useBridgePrepare.ts +133 -0
  468. package/src/react/core/hooks/useBridgeQuote.ts +67 -0
  469. package/src/react/core/hooks/useBridgeRoutes.test.ts +137 -0
  470. package/src/react/core/hooks/useBridgeRoutes.ts +75 -0
  471. package/src/react/core/hooks/usePaymentMethods.test.ts +336 -0
  472. package/src/react/core/hooks/usePaymentMethods.ts +203 -0
  473. package/src/react/core/hooks/useStepExecutor.ts +606 -0
  474. package/src/react/core/hooks/useTransactionDetails.ts +177 -0
  475. package/src/react/core/hooks/wallets/useAutoConnectCore.test.tsx +1 -57
  476. package/src/react/core/machines/.keep +2 -0
  477. package/src/react/core/machines/paymentMachine.test.ts +691 -0
  478. package/src/react/core/machines/paymentMachine.ts +290 -0
  479. package/src/react/core/types/.keep +2 -0
  480. package/src/react/core/utils/wallet.test.ts +77 -0
  481. package/src/react/native/flows/.keep +2 -0
  482. package/src/react/web/adapters/WindowAdapter.ts +23 -0
  483. package/src/react/web/adapters/adapters.test.ts +38 -0
  484. package/src/react/web/flows/.keep +2 -0
  485. package/src/react/web/hooks/transaction/useSendTransaction.tsx +5 -0
  486. package/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +357 -0
  487. package/src/react/web/ui/Bridge/BuyWidget.tsx +494 -0
  488. package/src/react/web/ui/Bridge/CheckoutWidget.tsx +484 -0
  489. package/src/react/web/ui/Bridge/DirectPayment.tsx +234 -0
  490. package/src/react/web/ui/Bridge/ErrorBanner.tsx +86 -0
  491. package/src/react/web/ui/Bridge/FundWallet.tsx +341 -0
  492. package/src/react/web/ui/Bridge/QuoteLoader.tsx +219 -0
  493. package/src/react/web/ui/Bridge/StepRunner.tsx +417 -0
  494. package/src/react/web/ui/Bridge/TransactionPayment.tsx +403 -0
  495. package/src/react/web/ui/Bridge/TransactionWidget.tsx +502 -0
  496. package/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx +84 -0
  497. package/src/react/web/ui/Bridge/common/TokenAndChain.tsx +203 -0
  498. package/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx +112 -0
  499. package/src/react/web/ui/Bridge/common/WithHeader.tsx +65 -0
  500. package/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx +318 -0
  501. package/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx +301 -0
  502. package/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx +186 -0
  503. package/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx +268 -0
  504. package/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx +282 -0
  505. package/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx +172 -0
  506. package/src/react/web/ui/Bridge/payment-success/PaymentReceipt.tsx +392 -0
  507. package/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx +155 -0
  508. package/src/react/web/ui/ConnectWallet/Details.test.tsx +2 -2
  509. package/src/react/web/ui/ConnectWallet/WalletSelector.tsx +2 -2
  510. package/src/react/web/ui/ConnectWallet/constants.ts +1 -1
  511. package/src/react/web/ui/ConnectWallet/icons/CreditCardIcon.tsx +24 -0
  512. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +5 -2
  513. package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +3 -1
  514. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +8 -0
  515. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +3 -2
  516. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx +7 -1
  517. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx +1 -0
  518. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +7 -3
  519. package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +22 -0
  520. package/src/react/web/ui/PayEmbed.tsx +2 -0
  521. package/src/react/web/ui/TransactionButton/DepositScreen.tsx +10 -5
  522. package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +78 -25
  523. package/src/react/web/ui/TransactionButton/TransactionModal.tsx +15 -9
  524. package/src/react/web/ui/components/ChainName.tsx +4 -2
  525. package/src/react/web/ui/components/TokenIcon.tsx +7 -4
  526. package/src/react/web/ui/components/buttons.tsx +1 -5
  527. package/src/stories/Bridge/BridgeOrchestrator.stories.tsx +267 -0
  528. package/src/stories/Bridge/DirectPayment.stories.tsx +225 -0
  529. package/src/stories/Bridge/ErrorBanner.stories.tsx +184 -0
  530. package/src/stories/Bridge/FundWallet.stories.tsx +196 -0
  531. package/src/stories/Bridge/PaymentDetails.stories.tsx +501 -0
  532. package/src/stories/Bridge/PaymentSelection.stories.tsx +177 -0
  533. package/src/stories/Bridge/StepRunner.stories.tsx +109 -0
  534. package/src/stories/Bridge/SuccessScreen.stories.tsx +217 -0
  535. package/src/stories/Bridge/TransactionPayment.stories.tsx +170 -0
  536. package/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx +119 -0
  537. package/src/stories/Bridge/fixtures.ts +802 -0
  538. package/src/stories/TokenBalanceRow.stories.tsx +169 -0
  539. package/src/stories/WalletRow.stories.tsx +166 -0
  540. package/src/stories/utils.tsx +35 -0
  541. package/src/utils/nft/parseNft.ts +2 -2
  542. package/src/version.ts +1 -1
  543. package/src/wallets/connection/autoConnectCore.test.ts +0 -53
@@ -0,0 +1,802 @@
1
+ import { stringify } from "viem";
2
+ import type { Token } from "../../bridge/index.js";
3
+ import { baseSepolia } from "../../chains/chain-definitions/base-sepolia.js";
4
+ import { base } from "../../chains/chain-definitions/base.js";
5
+ import { polygon } from "../../chains/chain-definitions/polygon.js";
6
+ import { defineChain } from "../../chains/utils.js";
7
+ import { NATIVE_TOKEN_ADDRESS } from "../../constants/addresses.js";
8
+ import { getContract } from "../../contract/contract.js";
9
+ import { claimTo } from "../../extensions/erc20/drops/write/claimTo.js";
10
+ import { transfer } from "../../extensions/erc20/write/transfer.js";
11
+ import type { BridgePrepareResult } from "../../react/core/hooks/useBridgePrepare.js";
12
+ import type { BridgePrepareRequest } from "../../react/core/hooks/useBridgePrepare.js";
13
+ import { getDefaultToken } from "../../react/core/utils/defaultTokens.js";
14
+ import type { UIOptions } from "../../react/web/ui/Bridge/BridgeOrchestrator.js";
15
+ import { prepareTransaction } from "../../transaction/prepare-transaction.js";
16
+ import { toWei } from "../../utils/units.js";
17
+ import type { Account, Wallet } from "../../wallets/interfaces/wallet.js";
18
+ import { storyClient } from "../utils.js";
19
+
20
+ export const ETH: Token = {
21
+ address: NATIVE_TOKEN_ADDRESS,
22
+ name: "Ethereum",
23
+ symbol: "ETH",
24
+ chainId: 10,
25
+ decimals: 18,
26
+ priceUsd: 1000,
27
+ iconUri:
28
+ "https://coin-images.coingecko.com/coins/images/279/large/ethereum.png",
29
+ };
30
+
31
+ export const USDC: Token = {
32
+ address: getDefaultToken(base, "USDC")?.address ?? "",
33
+ name: "USD Coin",
34
+ symbol: "USDC",
35
+ chainId: base.id,
36
+ decimals: 6,
37
+ priceUsd: 1,
38
+ iconUri:
39
+ "https://coin-images.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
40
+ };
41
+
42
+ export const UNI: Token = {
43
+ address: "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
44
+ name: "Uniswap",
45
+ symbol: "UNI",
46
+ chainId: 10,
47
+ decimals: 18,
48
+ priceUsd: 1000,
49
+ iconUri:
50
+ "https://coin-images.coingecko.com/coins/images/12504/large/uniswap-uni.png",
51
+ };
52
+
53
+ const createStoryMockWallet = (): Wallet => {
54
+ const mockAccount: Account = {
55
+ address: "0x1234567890123456789012345678901234567890" as `0x${string}`,
56
+ sendTransaction: async () => ({
57
+ transactionHash: "0xmockhash123" as `0x${string}`,
58
+ chain: defineChain(1),
59
+ client: storyClient,
60
+ }),
61
+ signMessage: async () => "0xsignature" as `0x${string}`,
62
+ signTypedData: async () => "0xsignature" as `0x${string}`,
63
+ };
64
+
65
+ // Simple mock wallet implementation for storybook display only
66
+ return {
67
+ id: "inApp",
68
+ getAccount: () => mockAccount,
69
+ getChain: async () => defineChain(1),
70
+ autoConnect: async () => mockAccount,
71
+ connect: async () => mockAccount,
72
+ disconnect: async () => {},
73
+ switchChain: async () => {},
74
+ subscribe: () => () => {},
75
+ getConfig: () => ({}),
76
+ } as unknown as Wallet;
77
+ };
78
+
79
+ export const STORY_MOCK_WALLET = createStoryMockWallet();
80
+
81
+ // Simple onramp quote with no extra steps
82
+ export const simpleOnrampQuote: BridgePrepareResult = JSON.parse(
83
+ stringify({
84
+ type: "onramp",
85
+ id: "onramp-simple-123",
86
+ link: "https://stripe.com/session/simple",
87
+ currency: "USD",
88
+ currencyAmount: 50.0,
89
+ destinationAmount: 50000000n, // 50 USDC
90
+ destinationToken: {
91
+ chainId: 137,
92
+ address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
93
+ name: "USD Coin (PoS)",
94
+ symbol: "USDC",
95
+ decimals: 6,
96
+ priceUsd: 1.0,
97
+ iconUri:
98
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
99
+ },
100
+ timestamp: Date.now(),
101
+ steps: [], // No additional steps needed
102
+ intent: {
103
+ onramp: "stripe",
104
+ chainId: 137,
105
+ tokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
106
+ receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
107
+ amount: 50000000n,
108
+ },
109
+ }),
110
+ );
111
+
112
+ // Onramp quote with 2 extra swap steps
113
+ export const onrampWithSwapsQuote: BridgePrepareResult = JSON.parse(
114
+ stringify({
115
+ type: "onramp",
116
+ id: "onramp-swaps-456",
117
+ link: "https://stripe.com/session/swaps",
118
+ currency: "EUR",
119
+ currencyAmount: 100.0,
120
+ destinationAmount: 1000000000000000000n, // 1 ETH
121
+ destinationToken: {
122
+ chainId: 1,
123
+ address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
124
+ name: "Ethereum",
125
+ symbol: "ETH",
126
+ decimals: 18,
127
+ priceUsd: 2500.0,
128
+ },
129
+ timestamp: Date.now(),
130
+ steps: [
131
+ {
132
+ originToken: {
133
+ chainId: 137,
134
+ address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
135
+ name: "USD Coin (PoS)",
136
+ symbol: "USDC",
137
+ decimals: 6,
138
+ priceUsd: 1.0,
139
+ iconUri:
140
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
141
+ },
142
+ destinationToken: {
143
+ chainId: 137,
144
+ address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
145
+ name: "Wrapped Ether",
146
+ symbol: "WETH",
147
+ decimals: 18,
148
+ priceUsd: 2500.0,
149
+ },
150
+ originAmount: 110000000n, // 110 USDC
151
+ destinationAmount: 44000000000000000n, // 0.044 WETH
152
+ estimatedExecutionTimeMs: 30000,
153
+ transactions: [
154
+ {
155
+ action: "approval",
156
+ id: "0x1a2b3c",
157
+ to: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
158
+ data: "0x095ea7b3",
159
+ chainId: 137,
160
+ client: storyClient,
161
+ chain: defineChain(137),
162
+ },
163
+ {
164
+ action: "buy",
165
+ id: "0x4d5e6f",
166
+ to: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
167
+ data: "0x472b43f3",
168
+ chainId: 137,
169
+ client: storyClient,
170
+ chain: defineChain(137),
171
+ },
172
+ ],
173
+ },
174
+ {
175
+ originToken: {
176
+ chainId: 137,
177
+ address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
178
+ name: "Wrapped Ether",
179
+ symbol: "WETH",
180
+ decimals: 18,
181
+ priceUsd: 2500.0,
182
+ },
183
+ destinationToken: {
184
+ chainId: 1,
185
+ address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
186
+ name: "Ethereum",
187
+ symbol: "ETH",
188
+ decimals: 18,
189
+ priceUsd: 2500.0,
190
+ },
191
+ originAmount: 44000000000000000n, // 0.044 WETH
192
+ destinationAmount: 1000000000000000000n, // 1 ETH
193
+ estimatedExecutionTimeMs: 180000,
194
+ transactions: [
195
+ {
196
+ action: "approval",
197
+ id: "0x7g8h9i",
198
+ to: "0x3fc91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
199
+ data: "0x095ea7b3",
200
+ chainId: 137,
201
+ client: storyClient,
202
+ chain: defineChain(137),
203
+ },
204
+ {
205
+ action: "transfer",
206
+ id: "0xj1k2l3",
207
+ to: "0x3fc91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
208
+ data: "0x3593564c",
209
+ chainId: 137,
210
+ client: storyClient,
211
+ chain: defineChain(137),
212
+ },
213
+ ],
214
+ },
215
+ ],
216
+ intent: {
217
+ onramp: "stripe",
218
+ chainId: 1,
219
+ tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
220
+ sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
221
+ receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
222
+ amount: 1000000000000000000n,
223
+ },
224
+ }),
225
+ );
226
+
227
+ // Simple buy quote with single step (no approval needed)
228
+ export const simpleBuyQuote: BridgePrepareResult = JSON.parse(
229
+ stringify({
230
+ type: "buy",
231
+ originAmount: 1000000000000000000n, // 1 ETH
232
+ destinationAmount: 100000000n, // 100 USDC
233
+ timestamp: Date.now(),
234
+ estimatedExecutionTimeMs: 60000,
235
+ steps: [
236
+ {
237
+ originToken: {
238
+ chainId: 1,
239
+ address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
240
+ name: "Ethereum",
241
+ symbol: "ETH",
242
+ decimals: 18,
243
+ priceUsd: 2500.0,
244
+ iconUri:
245
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
246
+ },
247
+ destinationToken: {
248
+ chainId: 1,
249
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
250
+ name: "USD Coin",
251
+ symbol: "USDC",
252
+ decimals: 6,
253
+ priceUsd: 1.0,
254
+ iconUri:
255
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
256
+ },
257
+ originAmount: 1000000000000000000n,
258
+ destinationAmount: 100000000n,
259
+ estimatedExecutionTimeMs: 60000,
260
+ transactions: [
261
+ {
262
+ action: "buy",
263
+ id: "0xsingle123",
264
+ to: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
265
+ data: "0x472b43f3",
266
+ value: 1000000000000000000n,
267
+ chainId: 1,
268
+ client: storyClient,
269
+ chain: defineChain(1),
270
+ },
271
+ ],
272
+ },
273
+ ],
274
+ intent: {
275
+ originChainId: 1,
276
+ originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
277
+ destinationChainId: 1,
278
+ destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
279
+ amount: 100000000n,
280
+ sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
281
+ receiver: "0x2247d5d238d0f9d37184d8332aE0289d1aD9991b",
282
+ },
283
+ }),
284
+ );
285
+
286
+ export const longTextBuyQuote: BridgePrepareResult = JSON.parse(
287
+ stringify({
288
+ type: "buy",
289
+ originAmount: 1000000000000000000n, // 1 ETH
290
+ destinationAmount: 1000394284092830482309n,
291
+ timestamp: Date.now(),
292
+ estimatedExecutionTimeMs: 60000,
293
+ steps: [
294
+ {
295
+ originToken: {
296
+ chainId: 1,
297
+ address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
298
+ name: "Ethereum",
299
+ symbol: "ETH",
300
+ decimals: 18,
301
+ priceUsd: 2500.0,
302
+ iconUri:
303
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
304
+ },
305
+ destinationToken: {
306
+ chainId: 42793,
307
+ address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
308
+ name: "USD Coin (USDC.e on Etherlink)",
309
+ symbol: "USDC.e",
310
+ decimals: 6,
311
+ priceUsd: 1.0,
312
+ iconUri:
313
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
314
+ },
315
+ originAmount: 1000000000000000000n,
316
+ destinationAmount: 1000394284092830482309n,
317
+ estimatedExecutionTimeMs: 60000,
318
+ transactions: [
319
+ {
320
+ action: "buy",
321
+ id: "0xsingle123",
322
+ to: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
323
+ data: "0x472b43f3",
324
+ value: 1000000000000000000n,
325
+ chainId: 1,
326
+ client: storyClient,
327
+ chain: defineChain(1),
328
+ },
329
+ ],
330
+ },
331
+ ],
332
+ intent: {
333
+ originChainId: 1,
334
+ originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
335
+ destinationChainId: 1,
336
+ destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
337
+ amount: 100000000n,
338
+ sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
339
+ receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
340
+ },
341
+ }),
342
+ );
343
+
344
+ // Buy quote with approval + buy in single step
345
+ export const buyWithApprovalQuote: BridgePrepareResult = JSON.parse(
346
+ stringify({
347
+ type: "buy",
348
+ originAmount: 100000000n, // 100 USDC
349
+ destinationAmount: 100000000n, // 100 USDC on different chain
350
+ timestamp: Date.now(),
351
+ estimatedExecutionTimeMs: 120000,
352
+ steps: [
353
+ {
354
+ originToken: {
355
+ chainId: 1,
356
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
357
+ name: "USD Coin",
358
+ symbol: "USDC",
359
+ decimals: 6,
360
+ priceUsd: 1.0,
361
+ iconUri:
362
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
363
+ },
364
+ destinationToken: {
365
+ chainId: 137,
366
+ address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
367
+ name: "USD Coin (PoS)",
368
+ symbol: "USDC",
369
+ decimals: 6,
370
+ priceUsd: 1.0,
371
+ iconUri:
372
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
373
+ },
374
+ originAmount: 100000000n,
375
+ destinationAmount: 100000000n,
376
+ estimatedExecutionTimeMs: 120000,
377
+ transactions: [
378
+ {
379
+ action: "approval",
380
+ id: "0xapproval789",
381
+ to: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
382
+ data: "0x095ea7b3",
383
+ chainId: 1,
384
+ client: storyClient,
385
+ chain: defineChain(1),
386
+ },
387
+ {
388
+ action: "buy",
389
+ id: "0xbuy456",
390
+ to: "0x3fc91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
391
+ data: "0x3593564c",
392
+ chainId: 1,
393
+ client: storyClient,
394
+ chain: defineChain(1),
395
+ },
396
+ ],
397
+ },
398
+ ],
399
+ intent: {
400
+ originChainId: 1,
401
+ originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
402
+ destinationChainId: 137,
403
+ destinationTokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
404
+ amount: 100000000n,
405
+ sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
406
+ receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
407
+ },
408
+ }),
409
+ );
410
+
411
+ // Complex buy quote with 3 steps, each with approval + buy
412
+ export const complexBuyQuote: BridgePrepareResult = JSON.parse(
413
+ stringify({
414
+ type: "buy",
415
+ originAmount: 1000000000000000000n, // 1 ETH
416
+ destinationAmount: 1000000000000000000n, // 1 ETH on final chain
417
+ timestamp: Date.now(),
418
+ estimatedExecutionTimeMs: 300000,
419
+ steps: [
420
+ {
421
+ originToken: {
422
+ chainId: 1,
423
+ address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
424
+ name: "Ethereum",
425
+ symbol: "ETH",
426
+ decimals: 18,
427
+ priceUsd: 2500.0,
428
+ },
429
+ destinationToken: {
430
+ chainId: 1,
431
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
432
+ name: "USD Coin",
433
+ symbol: "USDC",
434
+ decimals: 6,
435
+ priceUsd: 1.0,
436
+ iconUri:
437
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
438
+ },
439
+ originAmount: 1000000000000000000n,
440
+ destinationAmount: 2500000000n, // 2500 USDC
441
+ estimatedExecutionTimeMs: 60000,
442
+ transactions: [
443
+ {
444
+ action: "approval",
445
+ id: "0xstep1approval",
446
+ to: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
447
+ data: "0x095ea7b3",
448
+ chainId: 1,
449
+ client: storyClient,
450
+ chain: defineChain(1),
451
+ },
452
+ {
453
+ action: "buy",
454
+ id: "0xstep1buy",
455
+ to: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
456
+ data: "0x7ff36ab5",
457
+ value: 1000000000000000000n,
458
+ chainId: 1,
459
+ client: storyClient,
460
+ chain: defineChain(1),
461
+ },
462
+ ],
463
+ },
464
+ {
465
+ originToken: {
466
+ chainId: 1,
467
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
468
+ name: "USD Coin",
469
+ symbol: "USDC",
470
+ decimals: 6,
471
+ priceUsd: 1.0,
472
+ iconUri:
473
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
474
+ },
475
+ destinationToken: {
476
+ chainId: 137,
477
+ address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
478
+ name: "USD Coin (PoS)",
479
+ symbol: "USDC",
480
+ decimals: 6,
481
+ priceUsd: 1.0,
482
+ iconUri:
483
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
484
+ },
485
+ originAmount: 2500000000n,
486
+ destinationAmount: 2495000000n, // 2495 USDC (after bridge fees)
487
+ estimatedExecutionTimeMs: 180000,
488
+ transactions: [
489
+ {
490
+ action: "approval",
491
+ id: "0xstep2approval",
492
+ to: "0x3fc91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
493
+ data: "0x095ea7b3",
494
+ chainId: 1,
495
+ client: storyClient,
496
+ chain: defineChain(1),
497
+ },
498
+ {
499
+ action: "transfer",
500
+ id: "0xstep2bridge",
501
+ to: "0x3fc91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
502
+ data: "0x3593564c",
503
+ chainId: 1,
504
+ client: storyClient,
505
+ chain: defineChain(1),
506
+ },
507
+ ],
508
+ },
509
+ {
510
+ originToken: {
511
+ chainId: 137,
512
+ address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
513
+ name: "USD Coin (PoS)",
514
+ symbol: "USDC",
515
+ decimals: 6,
516
+ priceUsd: 1.0,
517
+ iconUri:
518
+ "https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
519
+ },
520
+ destinationToken: {
521
+ chainId: 43114,
522
+ address: "0x62D0A8458eD7719FDAF978fe5929C6D342B0bFcE",
523
+ symbol: "BEAM",
524
+ name: "Beam",
525
+ decimals: 18,
526
+ priceUsd: 0.00642458,
527
+ iconUri:
528
+ "https://coin-images.coingecko.com/coins/images/32417/small/cgicon.png?1747892021",
529
+ },
530
+ originAmount: 2495000000n,
531
+ destinationAmount: 1000000000000000000n, // 1 BEAM
532
+ estimatedExecutionTimeMs: 60000,
533
+ transactions: [
534
+ {
535
+ action: "approval",
536
+ id: "0xstep3approval",
537
+ to: "0x1111111254fb6c44bAC0beD2854e76F90643097d",
538
+ data: "0x095ea7b3",
539
+ chainId: 137,
540
+ client: storyClient,
541
+ chain: defineChain(137),
542
+ },
543
+ {
544
+ action: "buy",
545
+ id: "0xstep3buy",
546
+ to: "0x1111111254fb6c44bAC0beD2854e76F90643097d",
547
+ data: "0x12aa3caf",
548
+ chainId: 137,
549
+ client: storyClient,
550
+ chain: defineChain(137),
551
+ },
552
+ ],
553
+ },
554
+ ],
555
+ intent: {
556
+ originChainId: 1,
557
+ originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
558
+ destinationChainId: 42161,
559
+ destinationTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
560
+ amount: 1000000000000000000n,
561
+ sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
562
+ receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
563
+ },
564
+ }),
565
+ );
566
+ export const simpleBuyRequest: BridgePrepareRequest = {
567
+ type: "buy",
568
+ originChainId: 1,
569
+ originTokenAddress: NATIVE_TOKEN_ADDRESS,
570
+ destinationChainId: 10,
571
+ destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
572
+ amount: toWei("0.01"),
573
+ sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
574
+ receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
575
+ client: storyClient,
576
+ };
577
+
578
+ // ========== PREPARED TRANSACTIONS FOR TRANSACTION PAYMENT ========== //
579
+
580
+ // mintTo raw transaction
581
+ const ethTransferTransaction = prepareTransaction({
582
+ to: "0x87C52295891f208459F334975a3beE198fE75244",
583
+ data: "0x449a52f80000000000000000000000008447c7a30d18e9adf2abe362689fc994cc6a340d00000000000000000000000000000000000000000000000000038d7ea4c68000",
584
+ chain: baseSepolia,
585
+ client: storyClient,
586
+ });
587
+
588
+ // ERC20 token transaction with value
589
+ const erc20Transaction = transfer({
590
+ contract: getContract({
591
+ client: storyClient,
592
+ address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
593
+ chain: base,
594
+ }),
595
+ to: "0x2247d5d238d0f9d37184d8332aE0289d1aD9991b",
596
+ amount: 100,
597
+ });
598
+
599
+ // claimTo on Polygon
600
+ const contractInteractionTransaction = claimTo({
601
+ contract: getContract({
602
+ client: storyClient,
603
+ address: "0x683f91F407301b90e501492F8A26A3498D8d9638",
604
+ chain: polygon,
605
+ }),
606
+ to: "0x2247d5d238d0f9d37184d8332aE0289d1aD9991b",
607
+ quantity: "10",
608
+ });
609
+
610
+ // ========== COMMON DUMMY DATA FOR STORYBOOK ========== //
611
+
612
+ // Common receiver addresses for testing
613
+ export const RECEIVER_ADDRESSES = {
614
+ primary: "0x2247d5d238d0f9d37184d8332aE0289d1aD9991b" as const,
615
+ secondary: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD" as const,
616
+ seller: "0x1234567890123456789012345678901234567890" as const,
617
+ subscription: "0x9876543210987654321098765432109876543210" as const,
618
+ physical: "0x5555666677778888999900001111222233334444" as const,
619
+ };
620
+
621
+ // Product metadata for direct payments
622
+ const PRODUCT_METADATA = {
623
+ digitalArt: {
624
+ name: "Premium Digital Art NFT",
625
+ image:
626
+ "https://images.unsplash.com/photo-1465101046530-73398c7f28ca?w=500&h=300&fit=crop",
627
+ description: "This is a premium digital art by a famous artist",
628
+ },
629
+ concertTicket: {
630
+ name: "Concert Ticket - The Midnight Live",
631
+ image:
632
+ "https://images.unsplash.com/photo-1501281668745-f7f57925c3b4?w=500&h=300&fit=crop",
633
+ description: "Concert ticket for the upcoming show",
634
+ },
635
+ subscription: {
636
+ name: "Premium Streaming Service - Monthly",
637
+ image:
638
+ "https://images.unsplash.com/photo-1611162617474-5b21e879e113?w=500&h=300&fit=crop",
639
+ description:
640
+ "Get unlimited access to our premium streaming service with this monthly subscription. Enjoy ad-free viewing, exclusive content, and the ability to download shows for offline viewing.",
641
+ },
642
+ sneakers: {
643
+ name: "Limited Edition Sneakers",
644
+ image:
645
+ "https://images.unsplash.com/photo-1549298916-b41d501d3772?w=500&h=300&fit=crop",
646
+ },
647
+ credits: {
648
+ name: "Thirdweb Credits",
649
+ description:
650
+ "Add credits to your account for future billing cycles. Credits are non-refundable and do not expire.",
651
+ },
652
+ };
653
+
654
+ // Type aliases for better type safety
655
+ type FundWalletUIOptions = Extract<UIOptions, { mode: "fund_wallet" }>;
656
+ type DirectPaymentUIOptions = Extract<UIOptions, { mode: "direct_payment" }>;
657
+ type TransactionUIOptions = Extract<UIOptions, { mode: "transaction" }>;
658
+
659
+ // UI Options for FundWallet mode
660
+ export const FUND_WALLET_UI_OPTIONS: Record<
661
+ "ethDefault" | "ethWithAmount" | "usdcDefault" | "uniLarge",
662
+ FundWalletUIOptions
663
+ > = {
664
+ ethDefault: {
665
+ mode: "fund_wallet" as const,
666
+ destinationToken: ETH,
667
+ metadata: {
668
+ title: "Fund Wallet",
669
+ description: "Add funds to your wallet",
670
+ },
671
+ },
672
+ ethWithAmount: {
673
+ mode: "fund_wallet" as const,
674
+ destinationToken: ETH,
675
+ initialAmount: "0.001",
676
+ metadata: {
677
+ title: "Fund Wallet",
678
+ description: "Add funds to your wallet",
679
+ },
680
+ },
681
+ usdcDefault: {
682
+ mode: "fund_wallet" as const,
683
+ destinationToken: USDC,
684
+ initialAmount: "5",
685
+ },
686
+ uniLarge: {
687
+ mode: "fund_wallet" as const,
688
+ destinationToken: UNI,
689
+ initialAmount: "150000",
690
+ metadata: {
691
+ title: "Fund Wallet",
692
+ description: "Add UNI tokens to your wallet",
693
+ },
694
+ },
695
+ };
696
+
697
+ // UI Options for DirectPayment mode
698
+ export const DIRECT_PAYMENT_UI_OPTIONS: Record<
699
+ "digitalArt" | "concertTicket" | "subscription" | "sneakers" | "credits",
700
+ DirectPaymentUIOptions
701
+ > = {
702
+ digitalArt: {
703
+ mode: "direct_payment" as const,
704
+ paymentInfo: {
705
+ sellerAddress: RECEIVER_ADDRESSES.seller,
706
+ token: ETH,
707
+ amount: "0.1",
708
+ feePayer: "sender" as const,
709
+ },
710
+ metadata: {
711
+ title: "Purchase Digital Art",
712
+ description: "Buy premium digital art NFT",
713
+ image: PRODUCT_METADATA.digitalArt.image,
714
+ },
715
+ },
716
+ concertTicket: {
717
+ mode: "direct_payment" as const,
718
+ paymentInfo: {
719
+ sellerAddress: RECEIVER_ADDRESSES.primary,
720
+ token: USDC,
721
+ amount: "25.00",
722
+ feePayer: "receiver" as const,
723
+ },
724
+ metadata: {
725
+ title: "Buy Concert Ticket",
726
+ description: "Get your ticket for The Midnight Live",
727
+ image: PRODUCT_METADATA.concertTicket.image,
728
+ },
729
+ },
730
+ subscription: {
731
+ mode: "direct_payment" as const,
732
+ paymentInfo: {
733
+ sellerAddress: RECEIVER_ADDRESSES.subscription,
734
+ token: USDC,
735
+ amount: "9.99",
736
+ feePayer: "sender" as const,
737
+ },
738
+ metadata: {
739
+ title: "Subscribe to Premium",
740
+ description: PRODUCT_METADATA.subscription.description,
741
+ image: PRODUCT_METADATA.subscription.image,
742
+ },
743
+ },
744
+ sneakers: {
745
+ mode: "direct_payment" as const,
746
+ paymentInfo: {
747
+ sellerAddress: RECEIVER_ADDRESSES.physical,
748
+ token: ETH,
749
+ amount: "0.05",
750
+ feePayer: "receiver" as const,
751
+ },
752
+ metadata: {
753
+ title: "Buy Sneakers",
754
+ description: "Limited edition sneakers",
755
+ image: PRODUCT_METADATA.sneakers.image,
756
+ },
757
+ },
758
+ credits: {
759
+ mode: "direct_payment" as const,
760
+ paymentInfo: {
761
+ sellerAddress: RECEIVER_ADDRESSES.physical,
762
+ token: USDC,
763
+ amount: "25",
764
+ feePayer: "receiver" as const,
765
+ },
766
+ metadata: {
767
+ title: "Add Credits",
768
+ description: PRODUCT_METADATA.credits.description,
769
+ },
770
+ },
771
+ };
772
+
773
+ // UI Options for Transaction mode
774
+ export const TRANSACTION_UI_OPTIONS: Record<
775
+ "ethTransfer" | "erc20Transfer" | "contractInteraction",
776
+ TransactionUIOptions
777
+ > = {
778
+ ethTransfer: {
779
+ mode: "transaction" as const,
780
+ transaction: ethTransferTransaction,
781
+ metadata: {
782
+ title: "Execute Transaction",
783
+ description: "Review and execute transaction",
784
+ },
785
+ },
786
+ erc20Transfer: {
787
+ mode: "transaction" as const,
788
+ transaction: erc20Transaction,
789
+ metadata: {
790
+ title: "Token Transfer",
791
+ description: "Transfer ERC20 tokens",
792
+ },
793
+ },
794
+ contractInteraction: {
795
+ mode: "transaction" as const,
796
+ transaction: contractInteractionTransaction,
797
+ metadata: {
798
+ title: "Contract Interaction",
799
+ description: "Interact with smart contract",
800
+ },
801
+ },
802
+ };