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
@@ -18,7 +18,7 @@ import type { SupportedTokens } from "../../core/utils/defaultTokens.js";
18
18
  import { EmbedContainer } from "./ConnectWallet/Modal/ConnectEmbed.js";
19
19
  import { useConnectLocale } from "./ConnectWallet/locale/getConnectLocale.js";
20
20
  import BuyScreen from "./ConnectWallet/screens/Buy/BuyScreen.js";
21
- import { PayTxHistoryScreen } from "./ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js";
21
+ import { ExecutingTxScreen } from "./TransactionButton/ExecutingScreen.js";
22
22
  import { DynamicHeight } from "./components/DynamicHeight.js";
23
23
  import { Spinner } from "./components/Spinner.js";
24
24
  import type { LocaleId } from "./types.js";
@@ -125,13 +125,6 @@ export type PayEmbedProps = {
125
125
  */
126
126
  connectOptions?: PayEmbedConnectOptions;
127
127
 
128
- /**
129
- * Customize the display of the PayEmbed UI.
130
- */
131
- metadata?: {
132
- title?: string;
133
- };
134
-
135
128
  style?: React.CSSProperties;
136
129
  };
137
130
 
@@ -159,7 +152,7 @@ export type PayEmbedProps = {
159
152
  */
160
153
  export function PayEmbed(props: PayEmbedProps) {
161
154
  const localeQuery = useConnectLocale(props.locale || "en_US");
162
- const [screen, setScreen] = useState<"buy" | "tx-history">("buy");
155
+ const [screen, setScreen] = useState<"buy" | "execute-tx">("buy");
163
156
  const theme = props.theme || "dark";
164
157
 
165
158
  // to update cached chains ASAP, we skip using useEffect - this does not trigger a re-render so it's fine
@@ -172,6 +165,10 @@ export function PayEmbed(props: PayEmbedProps) {
172
165
  }
173
166
 
174
167
  let content = null;
168
+ const metadata =
169
+ props.payOptions && "metadata" in props.payOptions
170
+ ? props.payOptions.metadata
171
+ : null;
175
172
 
176
173
  if (!localeQuery.data) {
177
174
  content = (
@@ -190,41 +187,43 @@ export function PayEmbed(props: PayEmbedProps) {
190
187
  // show and hide screens with CSS to not lose state when switching between them
191
188
  content = (
192
189
  <>
193
- <div style={{ display: screen === "tx-history" ? "none" : "inherit" }}>
190
+ <div style={{ display: screen === "buy" ? "inherit" : "none" }}>
194
191
  <BuyScreen
195
- title={props.metadata?.title || "Buy"}
192
+ title={metadata?.name || "Buy"}
196
193
  isEmbed={true}
197
194
  supportedTokens={props.supportedTokens}
198
195
  theme={theme}
199
196
  client={props.client}
200
197
  connectLocale={localeQuery.data}
201
- onViewPendingTx={() => {
202
- setScreen("tx-history");
203
- }}
204
- payOptions={props.payOptions || {}}
198
+ payOptions={
199
+ props.payOptions || {
200
+ mode: "fund_wallet",
201
+ }
202
+ }
205
203
  onDone={() => {
206
- // noop
204
+ if (props.payOptions?.mode === "transaction") {
205
+ setScreen("execute-tx");
206
+ }
207
207
  }}
208
208
  connectOptions={props.connectOptions}
209
- buyForTx={undefined}
210
209
  onBack={undefined}
211
210
  />
212
211
  </div>
213
- {/* this does not need to persist so we can just show-hide it with JS */}
214
- {screen === "tx-history" && (
215
- <PayTxHistoryScreen
216
- title={props.metadata?.title || "Buy"}
217
- client={props.client}
218
- onBack={() => {
219
- setScreen("buy");
220
- }}
221
- onDone={() => {
222
- // noop
223
- }}
224
- isBuyForTx={false}
225
- isEmbed={true}
226
- />
227
- )}
212
+
213
+ {screen === "execute-tx" &&
214
+ props.payOptions?.mode === "transaction" &&
215
+ props.payOptions.transaction && (
216
+ <ExecutingTxScreen
217
+ tx={props.payOptions.transaction}
218
+ closeModal={() => {
219
+ setScreen("buy");
220
+ }}
221
+ onBack={() => {
222
+ setScreen("buy");
223
+ }}
224
+ onTxSent={() => {}}
225
+ />
226
+ )}
228
227
  </>
229
228
  );
230
229
  }
@@ -0,0 +1,127 @@
1
+ import { CheckCircledIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ import type { Hex } from "viem";
4
+ import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
5
+ import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
6
+ import { iconSize } from "../../../core/design-system/index.js";
7
+ import { useChainExplorers } from "../../../core/hooks/others/useChainQuery.js";
8
+ import { useSendTransaction } from "../../hooks/transaction/useSendTransaction.js";
9
+ import { AccentFailIcon } from "../ConnectWallet/icons/AccentFailIcon.js";
10
+ import { Spacer } from "../components/Spacer.js";
11
+ import { Spinner } from "../components/Spinner.js";
12
+ import { Container, ModalHeader } from "../components/basic.js";
13
+ import { Button, ButtonLink } from "../components/buttons.js";
14
+ import { Text } from "../components/text.js";
15
+
16
+ export function ExecutingTxScreen(props: {
17
+ tx: PreparedTransaction;
18
+ closeModal: () => void;
19
+ onTxSent: (data: WaitForReceiptOptions) => void;
20
+ onBack?: () => void;
21
+ }) {
22
+ const sendTxCore = useSendTransaction({
23
+ payModal: false,
24
+ });
25
+ const [txHash, setTxHash] = useState<Hex | undefined>();
26
+ const chainExplorers = useChainExplorers(props.tx.chain);
27
+ const [status, setStatus] = useState<"loading" | "failed" | "sent">(
28
+ "loading",
29
+ );
30
+
31
+ const sendTx = useCallback(async () => {
32
+ setStatus("loading");
33
+ try {
34
+ const txData = await sendTxCore.mutateAsync(props.tx);
35
+ setTxHash(txData.transactionHash);
36
+ props.onTxSent(txData);
37
+ setStatus("sent");
38
+ } catch (e) {
39
+ // Do not reject the transaction here, because the user may want to try again
40
+ // we only reject on modal close
41
+ console.error(e);
42
+ setStatus("failed");
43
+ }
44
+ }, [sendTxCore, props.tx, props.onTxSent]);
45
+
46
+ const done = useRef(false);
47
+ useEffect(() => {
48
+ if (done.current) {
49
+ return;
50
+ }
51
+
52
+ done.current = true;
53
+ sendTx();
54
+ }, [sendTx]);
55
+
56
+ return (
57
+ <Container p="lg">
58
+ <ModalHeader title="Transaction" onBack={props.onBack} />
59
+
60
+ <Spacer y="xxl" />
61
+ <Spacer y="xxl" />
62
+
63
+ <Container flex="row" center="x">
64
+ {status === "loading" && <Spinner size="xxl" color="accentText" />}
65
+ {status === "failed" && <AccentFailIcon size={iconSize["3xl"]} />}
66
+ {status === "sent" && (
67
+ <Container color="success" flex="row" center="both">
68
+ <CheckCircledIcon
69
+ width={iconSize["3xl"]}
70
+ height={iconSize["3xl"]}
71
+ />
72
+ </Container>
73
+ )}
74
+ </Container>
75
+ <Spacer y="lg" />
76
+
77
+ <Text color="primaryText" center size="lg">
78
+ {status === "loading" && "Sending transaction"}
79
+ {status === "failed" && "Transaction failed"}
80
+ {status === "sent" && "Transaction sent"}
81
+ </Text>
82
+ <Spacer y="sm" />
83
+ <Text color="danger" center size="sm">
84
+ {status === "failed" && sendTxCore.error
85
+ ? sendTxCore.error.message
86
+ : ""}
87
+ </Text>
88
+
89
+ <Spacer y="xxl" />
90
+ <Spacer y="xxl" />
91
+
92
+ {status === "failed" && (
93
+ <Button variant="accent" fullWidth onClick={sendTx}>
94
+ Try Again
95
+ </Button>
96
+ )}
97
+
98
+ {status === "sent" && (
99
+ <>
100
+ <Button variant="accent" fullWidth onClick={props.closeModal}>
101
+ Done
102
+ </Button>
103
+ {txHash && (
104
+ <>
105
+ <Spacer y="sm" />
106
+ <ButtonLink
107
+ fullWidth
108
+ variant="outline"
109
+ href={`${chainExplorers.explorers[0]?.url}/tx/${txHash}`}
110
+ target="_blank"
111
+ as="a"
112
+ gap="xs"
113
+ style={{
114
+ textDecoration: "none",
115
+ color: "inherit",
116
+ }}
117
+ >
118
+ View on Explorer{" "}
119
+ <ExternalLinkIcon width={iconSize.sm} height={iconSize.sm} />
120
+ </ButtonLink>
121
+ </>
122
+ )}
123
+ </>
124
+ )}
125
+ </Container>
126
+ );
127
+ }
@@ -0,0 +1,83 @@
1
+ import { useState } from "react";
2
+ import type { ThirdwebClient } from "../../../../client/client.js";
3
+ import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
4
+ import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
5
+ import { CustomThemeProvider } from "../../../core/design-system/CustomThemeProvider.js";
6
+ import type { Theme } from "../../../core/design-system/index.js";
7
+ import type { PayUIOptions } from "../../../core/hooks/connection/ConnectButtonProps.js";
8
+ import type { SupportedTokens } from "../../../core/utils/defaultTokens.js";
9
+ import { LoadingScreen } from "../../wallets/shared/LoadingScreen.js";
10
+ import { useConnectLocale } from "../ConnectWallet/locale/getConnectLocale.js";
11
+ import { LazyBuyScreen } from "../ConnectWallet/screens/Buy/LazyBuyScreen.js";
12
+ import { Modal } from "../components/Modal.js";
13
+ import type { LocaleId } from "../types.js";
14
+ import { ExecutingTxScreen } from "./ExecutingScreen.js";
15
+
16
+ export type ModalProps = {
17
+ title: string;
18
+ onComplete: () => void;
19
+ onClose: () => void;
20
+ client: ThirdwebClient;
21
+ localeId: LocaleId;
22
+ supportedTokens?: SupportedTokens;
23
+ theme: Theme | "light" | "dark";
24
+ tx: PreparedTransaction;
25
+ payOptions: PayUIOptions;
26
+ onTxSent: (data: WaitForReceiptOptions) => void;
27
+ };
28
+
29
+ export function TransactionModal(props: ModalProps) {
30
+ return (
31
+ <CustomThemeProvider theme={props.theme}>
32
+ <Modal
33
+ open={true}
34
+ size="compact"
35
+ setOpen={(_open) => {
36
+ if (!_open) {
37
+ props.onClose();
38
+ }
39
+ }}
40
+ >
41
+ <TransactionModalContent {...props} />
42
+ </Modal>
43
+ </CustomThemeProvider>
44
+ );
45
+ }
46
+
47
+ export function TransactionModalContent(
48
+ props: ModalProps & { onBack?: () => void },
49
+ ) {
50
+ const localeQuery = useConnectLocale(props.localeId);
51
+ const [screen, setScreen] = useState<"buy" | "execute-tx">("buy");
52
+
53
+ if (!localeQuery.data) {
54
+ return <LoadingScreen />;
55
+ }
56
+
57
+ if (screen === "execute-tx") {
58
+ return (
59
+ <ExecutingTxScreen
60
+ tx={props.tx}
61
+ closeModal={props.onClose}
62
+ onTxSent={props.onTxSent}
63
+ />
64
+ );
65
+ }
66
+
67
+ return (
68
+ <LazyBuyScreen
69
+ title={props.title}
70
+ isEmbed={false}
71
+ client={props.client}
72
+ onBack={props.onBack}
73
+ supportedTokens={props.supportedTokens}
74
+ connectLocale={localeQuery.data}
75
+ theme={typeof props.theme === "string" ? props.theme : props.theme.type}
76
+ payOptions={props.payOptions}
77
+ onDone={() => {
78
+ setScreen("execute-tx");
79
+ }}
80
+ connectOptions={undefined}
81
+ />
82
+ );
83
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.40.0-nightly-3848327373e49aa83c5902e6a16d5b8e96cf1eeb-20240726000343";
1
+ export const version = "5.40.0";