thirdweb 5.40.0-nightly-3848327373e49aa83c5902e6a16d5b8e96cf1eeb-20240726000343 → 5.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/dist/cjs/exports/react.js +7 -2
  2. package/dist/cjs/exports/react.js.map +1 -1
  3. package/dist/cjs/react/core/design-system/index.js +2 -0
  4. package/dist/cjs/react/core/design-system/index.js.map +1 -1
  5. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +13 -94
  6. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  7. package/dist/cjs/react/core/utils/defaultTokens.js +32 -25
  8. package/dist/cjs/react/core/utils/defaultTokens.js.map +1 -1
  9. package/dist/cjs/react/core/utils/wallet.js +91 -13
  10. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  11. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +18 -127
  12. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  13. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +3 -1
  14. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  15. package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -1
  16. package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +184 -118
  18. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  19. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +104 -0
  20. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -0
  21. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +69 -0
  22. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -0
  23. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +23 -5
  24. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
  25. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +4 -4
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +2 -2
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -2
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
  31. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +1 -1
  32. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +132 -45
  34. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +2 -5
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +13 -8
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  39. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +1 -1
  40. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +1 -1
  41. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +1 -1
  42. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +1 -1
  43. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +1 -1
  44. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  45. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js +1 -1
  46. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +1 -1
  47. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +1 -1
  48. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +1 -1
  49. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +9 -5
  50. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  51. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +1 -1
  52. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
  53. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +8 -3
  54. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
  55. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +1 -1
  56. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +1 -1
  57. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  58. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  59. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +84 -0
  60. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -0
  61. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +13 -7
  62. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -1
  63. package/dist/cjs/react/web/ui/ConnectWallet/screens/nativeToken.js +3 -1
  64. package/dist/cjs/react/web/ui/ConnectWallet/screens/nativeToken.js.map +1 -1
  65. package/dist/cjs/react/web/ui/PayEmbed.js +16 -9
  66. package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
  67. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +53 -0
  68. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -0
  69. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +33 -0
  70. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -0
  71. package/dist/cjs/version.js +1 -1
  72. package/dist/cjs/version.js.map +1 -1
  73. package/dist/esm/exports/react.js +3 -1
  74. package/dist/esm/exports/react.js.map +1 -1
  75. package/dist/esm/react/core/design-system/index.js +2 -0
  76. package/dist/esm/react/core/design-system/index.js.map +1 -1
  77. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +13 -93
  78. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  79. package/dist/esm/react/core/utils/defaultTokens.js +31 -25
  80. package/dist/esm/react/core/utils/defaultTokens.js.map +1 -1
  81. package/dist/esm/react/core/utils/wallet.js +88 -13
  82. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  83. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +20 -129
  84. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  85. package/dist/esm/react/web/ui/ConnectWallet/Details.js +3 -1
  86. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  87. package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -1
  88. package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
  89. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +188 -122
  90. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  91. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +101 -0
  92. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -0
  93. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +66 -0
  94. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -0
  95. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +22 -5
  96. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
  97. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +4 -4
  98. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
  99. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +2 -2
  100. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
  101. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -2
  102. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
  103. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +1 -1
  104. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
  105. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +130 -44
  106. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  107. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +2 -5
  108. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
  109. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +13 -8
  110. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  111. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +1 -1
  112. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +1 -1
  113. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +1 -1
  114. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +1 -1
  115. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +1 -1
  116. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  117. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js +1 -1
  118. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +1 -1
  119. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +1 -1
  120. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +1 -1
  121. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +7 -4
  122. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  123. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +1 -1
  124. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
  125. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +9 -4
  126. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
  127. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +1 -1
  128. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js.map +1 -1
  129. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
  130. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
  131. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +81 -0
  132. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -0
  133. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +14 -8
  134. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -1
  135. package/dist/esm/react/web/ui/ConnectWallet/screens/nativeToken.js +3 -1
  136. package/dist/esm/react/web/ui/ConnectWallet/screens/nativeToken.js.map +1 -1
  137. package/dist/esm/react/web/ui/PayEmbed.js +16 -9
  138. package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
  139. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +50 -0
  140. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -0
  141. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +29 -0
  142. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -0
  143. package/dist/esm/version.js +1 -1
  144. package/dist/esm/version.js.map +1 -1
  145. package/dist/types/exports/react.d.ts +3 -2
  146. package/dist/types/exports/react.d.ts.map +1 -1
  147. package/dist/types/react/core/design-system/index.d.ts +2 -0
  148. package/dist/types/react/core/design-system/index.d.ts.map +1 -1
  149. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +80 -34
  150. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  151. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -15
  152. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  153. package/dist/types/react/core/utils/defaultTokens.d.ts +222 -0
  154. package/dist/types/react/core/utils/defaultTokens.d.ts.map +1 -1
  155. package/dist/types/react/core/utils/wallet.d.ts +43 -1
  156. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  157. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +2 -4
  158. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  159. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +3 -1
  160. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  161. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts +0 -3
  162. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
  163. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts +18 -0
  164. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts.map +1 -0
  165. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts +18 -0
  166. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +1 -0
  167. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts +5 -0
  168. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts.map +1 -1
  169. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts +1 -2
  170. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts.map +1 -1
  171. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts +1 -2
  172. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts.map +1 -1
  173. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts +1 -2
  174. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts.map +1 -1
  175. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts +1 -2
  176. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts.map +1 -1
  177. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +14 -8
  178. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts.map +1 -1
  179. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts +19 -9
  180. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts.map +1 -1
  181. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts +6 -5
  182. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts.map +1 -1
  183. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +0 -2
  184. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
  185. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts +1 -1
  186. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts.map +1 -1
  187. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts +1 -1
  188. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts.map +1 -1
  189. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts +1 -1
  190. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts.map +1 -1
  191. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts +4 -0
  192. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
  193. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.d.ts.map +1 -1
  194. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts +1 -0
  195. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts.map +1 -1
  196. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts +1 -2
  197. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts.map +1 -1
  198. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +1 -2
  199. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
  200. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts +19 -0
  201. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +1 -0
  202. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts.map +1 -1
  203. package/dist/types/react/web/ui/ConnectWallet/screens/nativeToken.d.ts.map +1 -1
  204. package/dist/types/react/web/ui/PayEmbed.d.ts +0 -6
  205. package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
  206. package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts +9 -0
  207. package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -0
  208. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +24 -0
  209. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -0
  210. package/dist/types/version.d.ts +1 -1
  211. package/dist/types/version.d.ts.map +1 -1
  212. package/package.json +1 -1
  213. package/src/exports/react.ts +14 -2
  214. package/src/react/core/design-system/index.ts +2 -0
  215. package/src/react/core/hooks/connection/ConnectButtonProps.ts +103 -51
  216. package/src/react/core/hooks/transaction/useSendTransaction.ts +17 -127
  217. package/src/react/core/utils/defaultTokens.ts +38 -26
  218. package/src/react/core/utils/wallet.ts +102 -18
  219. package/src/react/web/hooks/transaction/useSendTransaction.tsx +34 -278
  220. package/src/react/web/ui/ConnectWallet/Details.tsx +6 -4
  221. package/src/react/web/ui/ConnectWallet/TransactionsScreen.tsx +1 -1
  222. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +347 -383
  223. package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +266 -0
  224. package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +253 -0
  225. package/src/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.tsx +52 -21
  226. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx +3 -6
  227. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +5 -6
  228. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.tsx +2 -4
  229. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.tsx +2 -4
  230. package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +16 -12
  231. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +155 -60
  232. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.ts +8 -3
  233. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +17 -12
  234. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.tsx +2 -2
  235. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.tsx +2 -3
  236. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +1 -1
  237. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.tsx +1 -1
  238. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.tsx +2 -2
  239. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +27 -19
  240. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.tsx +8 -4
  241. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +12 -5
  242. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.tsx +2 -4
  243. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -4
  244. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +243 -0
  245. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx +30 -17
  246. package/src/react/web/ui/ConnectWallet/screens/nativeToken.ts +5 -1
  247. package/src/react/web/ui/PayEmbed.tsx +31 -32
  248. package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +127 -0
  249. package/src/react/web/ui/TransactionButton/TransactionModal.tsx +83 -0
  250. package/src/version.ts +1 -1
@@ -34,13 +34,12 @@ export function OnrampStatusScreen(props: {
34
34
  client: ThirdwebClient;
35
35
  onBack: () => void;
36
36
  intentId: string;
37
- onViewPendingTx: () => void;
38
37
  hasTwoSteps: boolean;
39
38
  openedWindow: Window | null;
40
39
  quote: BuyWithFiatQuote;
41
40
  onDone: () => void;
42
41
  onShowSwapFlow: (status: BuyWithFiatStatus) => void;
43
- isBuyForTx: boolean;
42
+ transactionMode: boolean;
44
43
  isEmbed: boolean;
45
44
  }) {
46
45
  const queryClient = useQueryClient();
@@ -117,7 +116,7 @@ export function OnrampStatusScreen(props: {
117
116
  onDone={props.onDone}
118
117
  fiatStatus={statusQuery.data}
119
118
  client={props.client}
120
- isBuyForTx={props.isBuyForTx}
119
+ transactionMode={props.transactionMode}
121
120
  quote={props.quote}
122
121
  isEmbed={props.isEmbed}
123
122
  />
@@ -130,7 +129,7 @@ function OnrampStatusScreenUI(props: {
130
129
  fiatStatus?: BuyWithFiatStatus;
131
130
  onDone: () => void;
132
131
  client: ThirdwebClient;
133
- isBuyForTx: boolean;
132
+ transactionMode: boolean;
134
133
  isEmbed: boolean;
135
134
  quote: BuyWithFiatQuote;
136
135
  }) {
@@ -189,7 +188,7 @@ function OnrampStatusScreenUI(props: {
189
188
  <>
190
189
  <Spacer y="md" />
191
190
  <Container flex="row" center="x">
192
- <Spinner size="3xl" color="accentText" />
191
+ <Spinner size="xxl" color="accentText" />
193
192
  </Container>
194
193
  <Spacer y="md" />
195
194
  <Text color="primaryText" size="lg" center>
@@ -240,7 +239,7 @@ function OnrampStatusScreenUI(props: {
240
239
 
241
240
  {!props.isEmbed && (
242
241
  <Button variant="accent" fullWidth onClick={props.onDone}>
243
- {props.isBuyForTx ? "Continue Transaction" : "Done"}
242
+ {props.transactionMode ? "Continue Transaction" : "Done"}
244
243
  </Button>
245
244
  )}
246
245
  </>
@@ -19,9 +19,8 @@ export function PostOnRampSwap(props: {
19
19
  client: ThirdwebClient;
20
20
  buyWithFiatStatus: BuyWithFiatStatus;
21
21
  onBack?: () => void;
22
- onViewPendingTx: () => void;
23
22
  onDone: () => void;
24
- isBuyForTx: boolean;
23
+ transactionMode: boolean;
25
24
  isEmbed: boolean;
26
25
  payer: PayerInfo;
27
26
  }) {
@@ -123,14 +122,13 @@ export function PostOnRampSwap(props: {
123
122
  buyWithCryptoQuote={lockedOnRampQuote}
124
123
  client={props.client}
125
124
  onBack={props.onBack}
126
- onViewPendingTx={props.onViewPendingTx}
127
125
  isFiatFlow={true}
128
126
  onDone={props.onDone}
129
127
  onTryAgain={() => {
130
128
  setLockedOnRampQuote(undefined);
131
129
  postOnRampQuoteQuery.refetch();
132
130
  }}
133
- isBuyForTx={props.isBuyForTx}
131
+ transactionMode={props.transactionMode}
134
132
  isEmbed={props.isEmbed}
135
133
  />
136
134
  );
@@ -17,10 +17,9 @@ export function PostOnRampSwapFlow(props: {
17
17
  quote: BuyWithFiatPartialQuote;
18
18
  client: ThirdwebClient;
19
19
  onBack: () => void;
20
- onViewPendingTx: () => void;
21
20
  onDone: () => void;
22
21
  onSwapFlowStarted: () => void;
23
- isBuyForTx: boolean;
22
+ transactionMode: boolean;
24
23
  isEmbed: boolean;
25
24
  payer: PayerInfo;
26
25
  }) {
@@ -35,9 +34,8 @@ export function PostOnRampSwapFlow(props: {
35
34
  title={props.title}
36
35
  buyWithFiatStatus={statusForSwap}
37
36
  client={props.client}
38
- onViewPendingTx={props.onViewPendingTx}
39
37
  onDone={props.onDone}
40
- isBuyForTx={props.isBuyForTx}
38
+ transactionMode={props.transactionMode}
41
39
  isEmbed={props.isEmbed}
42
40
  payer={props.payer}
43
41
  />
@@ -1,22 +1,23 @@
1
1
  import type { BuyWithCryptoQuote } from "../../../../../../../pay/buyWithCrypto/getQuote.js";
2
2
  import type { BuyWithFiatQuote } from "../../../../../../../pay/buyWithFiat/getQuote.js";
3
- import type { PreparedTransaction } from "../../../../../../../transaction/prepare-transaction.js";
3
+ import type { GetWalletBalanceResult } from "../../../../../../../wallets/utils/getWalletBalance.js";
4
+ import type { TokenInfo } from "../../../../../../core/utils/defaultTokens.js";
4
5
 
5
- export type BuyForTx = {
6
- cost: bigint;
7
- balance: bigint;
8
- tx: PreparedTransaction;
9
- tokenSymbol: string;
10
- tokenDecimals: number;
6
+ export type TransactionCostAndData = {
7
+ token: TokenInfo;
8
+ decimals: number;
9
+ walletBalance: GetWalletBalanceResult;
10
+ transactionValueWei: bigint;
11
+ gasCostWei: bigint;
11
12
  };
12
13
 
13
14
  export type SelectedScreen =
14
15
  | {
15
- id:
16
- | "main"
17
- | "select-payment-method"
18
- | "buy-with-fiat"
19
- | "buy-with-crypto";
16
+ id: "main" | "select-payment-method" | "buy-with-fiat" | "select-wallet";
17
+ }
18
+ | {
19
+ id: "buy-with-crypto";
20
+ payDisabled?: boolean;
20
21
  }
21
22
  | {
22
23
  id: "select-from-token";
@@ -39,6 +40,9 @@ export type SelectedScreen =
39
40
  quote: BuyWithFiatQuote;
40
41
  openedWindow: Window | null;
41
42
  }
43
+ | {
44
+ id: "transfer-flow";
45
+ }
42
46
  | {
43
47
  id: "connect-payer-wallet";
44
48
  backScreen: SelectedScreen;
@@ -1,76 +1,171 @@
1
+ import { useQuery } from "@tanstack/react-query";
1
2
  import { useEffect, useState } from "react";
2
- import { toEther } from "../../../../../../../utils/units.js";
3
+ import { getChainMetadata } from "../../../../../../../chains/utils.js";
4
+ import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.js";
5
+ import { getContract } from "../../../../../../../contract/contract.js";
6
+ import { getCurrencyMetadata } from "../../../../../../../extensions/erc20/read/getCurrencyMetadata.js";
7
+ import { getGasPrice } from "../../../../../../../gas/get-gas-price.js";
8
+ import { encode } from "../../../../../../../transaction/actions/encode.js";
9
+ import { estimateGasCost } from "../../../../../../../transaction/actions/estimate-gas-cost.js";
10
+ import type { PreparedTransaction } from "../../../../../../../transaction/prepare-transaction.js";
11
+ import type { Hex } from "../../../../../../../utils/encoding/hex.js";
12
+ import { resolvePromisedValue } from "../../../../../../../utils/promise/resolve-promised-value.js";
3
13
  import type { Account } from "../../../../../../../wallets/interfaces/wallet.js";
4
- import { getTotalTxCostForBuy } from "../../../../../../core/hooks/transaction/useSendTransaction.js";
5
- import { wait } from "../../../../../../core/utils/wait.js";
6
- import type { BuyForTx } from "./types.js";
14
+ import { getWalletBalance } from "../../../../../../../wallets/utils/getWalletBalance.js";
15
+ import type { SupportedChainAndTokens } from "../swap/useSwapSupportedChains.js";
16
+ import type { TransactionCostAndData } from "./types.js";
7
17
 
8
- export function useBuyTxStates(options: {
9
- setTokenAmount: (value: string) => void;
10
- buyForTx: BuyForTx | null;
11
- hasEditedAmount: boolean;
12
- account: Account | null;
18
+ export function useTransactionCostAndData(args: {
19
+ transaction: PreparedTransaction;
20
+ account: Account | undefined;
21
+ supportedDestinations: SupportedChainAndTokens;
13
22
  }) {
14
- const { buyForTx, hasEditedAmount, setTokenAmount, account } = options;
15
- const shouldRefreshTokenAmount = !hasEditedAmount;
16
-
17
- const [amountNeeded, setAmountNeeded] = useState<bigint | undefined>(
18
- buyForTx?.cost,
19
- );
20
-
21
- // update amount needed every 30 seconds
22
- // also update the token amount if allowed
23
- // ( Can't use useQuery because tx can't be added to queryKey )
23
+ const { transaction, account, supportedDestinations } = args;
24
+ // Compute query key of the transaction first
25
+ const [txQueryKey, setTxQueryKey] = useState<
26
+ | {
27
+ value: string | undefined;
28
+ erc20Value: string | undefined;
29
+ erc20Currency: string | undefined;
30
+ to: string | undefined;
31
+ data: Hex | undefined;
32
+ }
33
+ | undefined
34
+ >();
24
35
  useEffect(() => {
25
- if (!buyForTx) {
26
- return;
27
- }
28
-
29
- let mounted = true;
30
-
31
- if (buyForTx.tx.erc20Value) {
32
- // if erc20 value is set, we don't need to poll
33
- return;
34
- }
36
+ Promise.all([
37
+ resolvePromisedValue(transaction.value),
38
+ resolvePromisedValue(transaction.erc20Value),
39
+ resolvePromisedValue(transaction.to),
40
+ encode(transaction),
41
+ ]).then(([value, erc20Value, to, data]) => {
42
+ setTxQueryKey({
43
+ value: value?.toString(),
44
+ erc20Value: erc20Value?.amountWei?.toString(),
45
+ erc20Currency: erc20Value?.tokenAddress,
46
+ to,
47
+ data,
48
+ });
49
+ });
50
+ }, [transaction]);
35
51
 
36
- async function pollTxCost() {
37
- if (!buyForTx || !mounted) {
38
- return;
52
+ return useQuery({
53
+ queryKey: [
54
+ "transaction-cost",
55
+ transaction.chain.id,
56
+ account?.address,
57
+ txQueryKey,
58
+ ],
59
+ queryFn: async () => {
60
+ if (!account) {
61
+ throw new Error("No account");
39
62
  }
40
63
 
41
- try {
42
- const totalCost = await getTotalTxCostForBuy(
43
- buyForTx.tx,
44
- account?.address,
45
- );
46
-
47
- if (!mounted) {
48
- return;
49
- }
64
+ const erc20Value = await resolvePromisedValue(transaction.erc20Value);
65
+ if (erc20Value) {
66
+ const [tokenBalance, tokenMeta, gasCostWei] = await Promise.all([
67
+ getWalletBalance({
68
+ address: account.address,
69
+ chain: transaction.chain,
70
+ client: transaction.client,
71
+ tokenAddress: erc20Value.tokenAddress,
72
+ }),
73
+ getCurrencyMetadata({
74
+ contract: getContract({
75
+ address: erc20Value.tokenAddress,
76
+ chain: transaction.chain,
77
+ client: transaction.client,
78
+ }),
79
+ }),
80
+ getTransactionGasCost(transaction, account?.address),
81
+ ]);
82
+ const transactionValueWei = erc20Value.amountWei;
83
+ const walletBalance = tokenBalance;
84
+ const currency = {
85
+ address: erc20Value.tokenAddress,
86
+ name: tokenMeta.name,
87
+ symbol: tokenMeta.symbol,
88
+ icon: supportedDestinations
89
+ .find((c) => c.chain.id === transaction.chain.id)
90
+ ?.tokens.find(
91
+ (t) =>
92
+ t.address.toLowerCase() ===
93
+ erc20Value.tokenAddress.toLowerCase(),
94
+ )?.icon,
95
+ };
96
+ return {
97
+ token: currency,
98
+ decimals: tokenMeta.decimals,
99
+ walletBalance,
100
+ gasCostWei,
101
+ transactionValueWei,
102
+ } satisfies TransactionCostAndData;
103
+ }
50
104
 
51
- setAmountNeeded(totalCost);
105
+ const [nativeWalletBalance, chainMetadata, gasCostWei] =
106
+ await Promise.all([
107
+ getWalletBalance({
108
+ address: account.address,
109
+ chain: transaction.chain,
110
+ client: transaction.client,
111
+ }),
112
+ getChainMetadata(transaction.chain),
113
+ getTransactionGasCost(transaction, account?.address),
114
+ ]);
52
115
 
53
- if (shouldRefreshTokenAmount) {
54
- if (totalCost > buyForTx.balance) {
55
- setTokenAmount(toEther(totalCost - buyForTx.balance));
56
- }
57
- }
58
- } catch (error) {
59
- // no op
116
+ const walletBalance = nativeWalletBalance;
117
+ const transactionValueWei =
118
+ (await resolvePromisedValue(transaction.value)) || 0n;
119
+ return {
120
+ token: {
121
+ address: NATIVE_TOKEN_ADDRESS,
122
+ name: chainMetadata.nativeCurrency.name,
123
+ symbol: chainMetadata.nativeCurrency.symbol,
124
+ icon: chainMetadata.icon?.url,
125
+ },
126
+ decimals: 18,
127
+ walletBalance,
128
+ gasCostWei,
129
+ transactionValueWei,
130
+ } satisfies TransactionCostAndData;
131
+ },
132
+ enabled: !!transaction && !!account && !!txQueryKey,
133
+ refetchInterval: () => {
134
+ if (transaction.erc20Value) {
135
+ // if erc20 value is set, we don't need to poll
136
+ return undefined;
60
137
  }
138
+ return 30_000;
139
+ },
140
+ });
141
+ }
61
142
 
62
- await wait(30000);
63
- pollTxCost();
64
- }
143
+ export async function getTransactionGasCost(
144
+ tx: PreparedTransaction,
145
+ from?: string,
146
+ ) {
147
+ try {
148
+ const gasCost = await estimateGasCost({
149
+ transaction: tx,
150
+ from,
151
+ });
65
152
 
66
- pollTxCost();
153
+ const bufferCost = gasCost.wei / 10n;
67
154
 
68
- return () => {
69
- mounted = false;
70
- };
71
- }, [buyForTx, shouldRefreshTokenAmount, setTokenAmount, account]);
155
+ // Note: get tx.value AFTER estimateGasCost
156
+ // add 10% extra gas cost to the estimate to ensure user buys enough to cover the tx cost
157
+ return gasCost.wei + bufferCost;
158
+ } catch (e) {
159
+ if (from) {
160
+ // try again without passing from
161
+ return await getTransactionGasCost(tx);
162
+ }
163
+ // fallback if both fail, use the tx value + 2M * gas price
164
+ const gasPrice = await getGasPrice({
165
+ client: tx.client,
166
+ chain: tx.chain,
167
+ });
72
168
 
73
- return {
74
- amountNeeded,
75
- };
169
+ return 2_000_000n * gasPrice;
170
+ }
76
171
  }
@@ -7,13 +7,18 @@ import type { SupportedChainAndTokens } from "../swap/useSwapSupportedChains.js"
7
7
  // Based on what toToken, toChain, and supportedDestinations are, determine which payment methods should be enabled
8
8
  // change the current method if it should be disabled
9
9
  // return whether the payment selection should be shown or not ( if only one payment method is enabled, don't show the selection )
10
+ export type PaymentMethods = {
11
+ showPaymentSelection: boolean;
12
+ buyWithFiatEnabled: boolean;
13
+ buyWithCryptoEnabled: boolean;
14
+ };
10
15
 
11
16
  export function useEnabledPaymentMethods(options: {
12
17
  payOptions: PayUIOptions;
13
18
  supportedDestinations: SupportedChainAndTokens;
14
19
  toChain: Chain;
15
20
  toToken: ERC20OrNativeToken;
16
- }) {
21
+ }): PaymentMethods {
17
22
  const { payOptions, supportedDestinations, toChain, toToken } = options;
18
23
 
19
24
  function getEnabledPayMethodsForSelectedToken(): {
@@ -23,8 +28,8 @@ export function useEnabledPaymentMethods(options: {
23
28
  const chain = supportedDestinations.find((c) => c.chain.id === toChain.id);
24
29
  if (!chain) {
25
30
  return {
26
- fiat: true,
27
- swap: true,
31
+ fiat: false,
32
+ swap: false,
28
33
  };
29
34
  }
30
35
 
@@ -1,29 +1,29 @@
1
1
  import { useState } from "react";
2
2
  import { polygon } from "../../../../../../../chains/chain-definitions/polygon.js";
3
3
  import type { Chain } from "../../../../../../../chains/types.js";
4
- import { toEther } from "../../../../../../../utils/units.js";
5
- import type { PayUIOptions } from "../../../../../../core/hooks/connection/ConnectButtonProps.js";
4
+ import type {
5
+ FundWalletOptions,
6
+ PayUIOptions,
7
+ } from "../../../../../../core/hooks/connection/ConnectButtonProps.js";
6
8
  import { useActiveWalletChain } from "../../../../../hooks/wallets/useActiveWalletChain.js";
7
9
  import { useDebouncedValue } from "../../../../hooks/useDebouncedValue.js";
8
10
  import { type ERC20OrNativeToken, NATIVE_TOKEN } from "../../nativeToken.js";
9
11
  import { defaultSelectedCurrency } from "../fiat/currencies.js";
10
12
  import type { SupportedChainAndTokens } from "../swap/useSwapSupportedChains.js";
11
- import type { BuyForTx } from "./types.js";
12
13
 
13
14
  // handle states for token and chain selection
14
15
 
15
16
  export function useUISelectionStates(options: {
16
17
  payOptions: PayUIOptions;
17
- buyForTx?: BuyForTx;
18
18
  supportedDestinations: SupportedChainAndTokens;
19
19
  }) {
20
20
  const activeChain = useActiveWalletChain();
21
- const { payOptions, buyForTx, supportedDestinations } = options;
21
+ const { payOptions, supportedDestinations } = options;
22
22
 
23
23
  // buy token amount ---------------------------------------------------------
24
- const initialTokenAmount =
25
- payOptions.prefillBuy?.amount ||
26
- (buyForTx ? String(toEther(buyForTx.cost - buyForTx.balance)) : "");
24
+ // NOTE - for transaction / direct payment modes, the token amount is set when the user tap continue
25
+ const prefillBuy = (payOptions as FundWalletOptions)?.prefillBuy;
26
+ const initialTokenAmount = prefillBuy?.amount || "";
27
27
 
28
28
  const [tokenAmount, setTokenAmount] = useState<string>(initialTokenAmount);
29
29
  const deferredTokenAmount = useDebouncedValue(tokenAmount, 300);
@@ -33,9 +33,9 @@ export function useUISelectionStates(options: {
33
33
  // Destination chain and token selection -----------------------------------
34
34
  const [toChain, setToChain] = useState<Chain>(
35
35
  // use prefill chain if available
36
- payOptions.prefillBuy?.chain ||
37
- // use buyForTx chain if available
38
- buyForTx?.tx.chain ||
36
+ prefillBuy?.chain ||
37
+ (payOptions.mode === "transaction" && payOptions.transaction?.chain) ||
38
+ (payOptions.mode === "direct_payment" && payOptions.paymentInfo?.chain) ||
39
39
  // use active chain if its supported as destination
40
40
  supportedDestinations.find((x) => x.chain.id === activeChain?.id)
41
41
  ?.chain ||
@@ -44,7 +44,9 @@ export function useUISelectionStates(options: {
44
44
  );
45
45
 
46
46
  const [toToken, setToToken] = useState<ERC20OrNativeToken>(
47
- payOptions.prefillBuy?.token || NATIVE_TOKEN,
47
+ prefillBuy?.token ||
48
+ (payOptions.mode === "direct_payment" && payOptions.paymentInfo.token) ||
49
+ NATIVE_TOKEN,
48
50
  );
49
51
  // --------------------------------------------------------------------------
50
52
 
@@ -53,6 +55,8 @@ export function useUISelectionStates(options: {
53
55
  // use prefill chain if available
54
56
  (payOptions.buyWithCrypto !== false &&
55
57
  payOptions.buyWithCrypto?.prefillSource?.chain) ||
58
+ (payOptions.mode === "transaction" && payOptions.transaction?.chain) ||
59
+ (payOptions.mode === "direct_payment" && payOptions.paymentInfo?.chain) ||
56
60
  // default to polygon
57
61
  polygon,
58
62
  );
@@ -61,6 +65,7 @@ export function useUISelectionStates(options: {
61
65
  // use prefill token if available
62
66
  (payOptions.buyWithCrypto !== false &&
63
67
  payOptions.buyWithCrypto?.prefillSource?.token) ||
68
+ (payOptions.mode === "direct_payment" && payOptions.paymentInfo.token) ||
64
69
  // default to native token
65
70
  NATIVE_TOKEN,
66
71
  );
@@ -40,7 +40,7 @@ export function PayTxHistoryScreen(props: {
40
40
  onBack?: () => void;
41
41
  client: ThirdwebClient;
42
42
  onDone: () => void;
43
- isBuyForTx: boolean;
43
+ transactionMode: boolean;
44
44
  isEmbed: boolean;
45
45
  }) {
46
46
  const [selectedTx, setSelectedTx] = useState<TxStatusInfo | null>(null);
@@ -66,7 +66,7 @@ export function PayTxHistoryScreen(props: {
66
66
  statusInfo={selectedTx}
67
67
  onBack={() => setSelectedTx(null)}
68
68
  onDone={props.onDone}
69
- isBuyForTx={props.isBuyForTx}
69
+ transactionMode={props.transactionMode}
70
70
  isEmbed={props.isEmbed}
71
71
  payer={payer}
72
72
  />
@@ -17,7 +17,7 @@ export function FiatDetailsScreen(props: {
17
17
  onBack: () => void;
18
18
  client: ThirdwebClient;
19
19
  onDone: () => void;
20
- isBuyForTx: boolean;
20
+ transactionMode: boolean;
21
21
  isEmbed: boolean;
22
22
  payer: PayerInfo;
23
23
  }) {
@@ -48,8 +48,7 @@ export function FiatDetailsScreen(props: {
48
48
  client={props.client}
49
49
  status={status}
50
50
  onBack={props.onBack}
51
- onViewPendingTx={props.onBack}
52
- isBuyForTx={props.isBuyForTx}
51
+ transactionMode={props.transactionMode}
53
52
  isEmbed={props.isEmbed}
54
53
  quote={{
55
54
  fromCurrencyAmount: fiatQuote.fromCurrencyWithFees.amount,
@@ -289,7 +289,7 @@ export function SwapTxDetailsTable(
289
289
  >
290
290
  <Text>Send to</Text>
291
291
  <Container flex="row" gap="xs" center="y">
292
- <Text color="primaryText">
292
+ <Text color="primaryText" size="sm">
293
293
  {shortenAddress(uiData.toAddress)}
294
294
  </Text>
295
295
  </Container>
@@ -28,7 +28,7 @@ export function TokenInfoRow(props: {
28
28
  justifyContent: "space-between",
29
29
  }}
30
30
  >
31
- <Text>{props.label}</Text>
31
+ <Text size="sm">{props.label}</Text>
32
32
  <Container
33
33
  flex="column"
34
34
  gap="xxs"
@@ -10,7 +10,7 @@ export function TxDetailsScreen(props: {
10
10
  statusInfo: TxStatusInfo;
11
11
  onBack: () => void;
12
12
  onDone: () => void;
13
- isBuyForTx: boolean;
13
+ transactionMode: boolean;
14
14
  isEmbed: boolean;
15
15
  payer: PayerInfo;
16
16
  }) {
@@ -34,7 +34,7 @@ export function TxDetailsScreen(props: {
34
34
  status={statusInfo.status}
35
35
  onBack={props.onBack}
36
36
  onDone={props.onDone}
37
- isBuyForTx={props.isBuyForTx}
37
+ transactionMode={props.transactionMode}
38
38
  isEmbed={props.isEmbed}
39
39
  payer={props.payer}
40
40
  />