thirdweb 5.100.0-nightly-713ebe0a2d6d8a409e41ce0f0317fc34b1f221bb-20250520000414 → 5.100.1

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 (228) hide show
  1. package/dist/cjs/bridge/Buy.js +1 -1
  2. package/dist/cjs/bridge/Onramp.js +152 -0
  3. package/dist/cjs/bridge/Onramp.js.map +1 -0
  4. package/dist/cjs/bridge/OnrampStatus.js +78 -0
  5. package/dist/cjs/bridge/OnrampStatus.js.map +1 -0
  6. package/dist/cjs/bridge/Sell.js +1 -1
  7. package/dist/cjs/bridge/index.js +2 -1
  8. package/dist/cjs/bridge/index.js.map +1 -1
  9. package/dist/cjs/{react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js → bridge/types/BridgeAction.js} +1 -1
  10. package/dist/cjs/bridge/types/BridgeAction.js.map +1 -0
  11. package/dist/cjs/extensions/ens/resolve-l2-name.js +0 -2
  12. package/dist/cjs/extensions/ens/resolve-l2-name.js.map +1 -1
  13. package/dist/cjs/pay/buyWithFiat/getQuote.js +129 -33
  14. package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
  15. package/dist/cjs/pay/buyWithFiat/getStatus.js +71 -20
  16. package/dist/cjs/pay/buyWithFiat/getStatus.js.map +1 -1
  17. package/dist/cjs/pay/utils/commonTypes.js +1 -1
  18. package/dist/cjs/pay/utils/commonTypes.js.map +1 -1
  19. package/dist/cjs/pay/utils/definitions.js +1 -13
  20. package/dist/cjs/pay/utils/definitions.js.map +1 -1
  21. package/dist/cjs/react/core/hooks/auth/useSiweAuth.js +1 -1
  22. package/dist/cjs/react/core/hooks/auth/useSiweAuth.js.map +1 -1
  23. package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -3
  24. package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
  25. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +42 -38
  26. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  27. package/dist/cjs/react/core/utils/wallet.js +15 -0
  28. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  29. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +1 -1
  30. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  31. package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js +0 -9
  32. package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js +1 -1
  34. package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +0 -177
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -10
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
  39. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +5 -8
  40. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  41. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +0 -15
  42. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  43. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js +0 -60
  44. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js.map +1 -1
  45. package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js +133 -0
  46. package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js.map +1 -0
  47. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +4 -3
  48. package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
  49. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +9 -1
  50. package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  51. package/dist/cjs/version.js +1 -1
  52. package/dist/cjs/version.js.map +1 -1
  53. package/dist/esm/bridge/Buy.js +1 -1
  54. package/dist/esm/bridge/Onramp.js +147 -0
  55. package/dist/esm/bridge/Onramp.js.map +1 -0
  56. package/dist/esm/bridge/OnrampStatus.js +75 -0
  57. package/dist/esm/bridge/OnrampStatus.js.map +1 -0
  58. package/dist/esm/bridge/Sell.js +1 -1
  59. package/dist/esm/bridge/index.js +1 -0
  60. package/dist/esm/bridge/index.js.map +1 -1
  61. package/dist/esm/bridge/types/BridgeAction.js +2 -0
  62. package/dist/esm/bridge/types/BridgeAction.js.map +1 -0
  63. package/dist/esm/extensions/ens/resolve-l2-name.js +0 -2
  64. package/dist/esm/extensions/ens/resolve-l2-name.js.map +1 -1
  65. package/dist/esm/pay/buyWithFiat/getQuote.js +129 -33
  66. package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
  67. package/dist/esm/pay/buyWithFiat/getStatus.js +71 -20
  68. package/dist/esm/pay/buyWithFiat/getStatus.js.map +1 -1
  69. package/dist/esm/pay/utils/commonTypes.js +1 -1
  70. package/dist/esm/pay/utils/commonTypes.js.map +1 -1
  71. package/dist/esm/pay/utils/definitions.js +0 -10
  72. package/dist/esm/pay/utils/definitions.js.map +1 -1
  73. package/dist/esm/react/core/hooks/auth/useSiweAuth.js +1 -1
  74. package/dist/esm/react/core/hooks/auth/useSiweAuth.js.map +1 -1
  75. package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -3
  76. package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
  77. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +42 -38
  78. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  79. package/dist/esm/react/core/utils/wallet.js +15 -0
  80. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  81. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +1 -1
  82. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  83. package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js +0 -9
  84. package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
  85. package/dist/esm/react/web/ui/ConnectWallet/locale/en.js +1 -1
  86. package/dist/esm/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
  87. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +4 -180
  88. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  89. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -10
  90. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
  91. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +5 -8
  92. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
  93. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +2 -16
  94. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
  95. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js +0 -59
  96. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js.map +1 -1
  97. package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js +130 -0
  98. package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js.map +1 -0
  99. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +4 -3
  100. package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
  101. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +9 -1
  102. package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
  103. package/dist/esm/version.js +1 -1
  104. package/dist/esm/version.js.map +1 -1
  105. package/dist/types/bridge/Buy.d.ts +1 -1
  106. package/dist/types/bridge/Onramp.d.ts +123 -0
  107. package/dist/types/bridge/Onramp.d.ts.map +1 -0
  108. package/dist/types/bridge/OnrampStatus.d.ts +108 -0
  109. package/dist/types/bridge/OnrampStatus.d.ts.map +1 -0
  110. package/dist/types/bridge/Sell.d.ts +1 -1
  111. package/dist/types/bridge/index.d.ts +6 -3
  112. package/dist/types/bridge/index.d.ts.map +1 -1
  113. package/dist/types/bridge/types/BridgeAction.d.ts +2 -0
  114. package/dist/types/bridge/types/BridgeAction.d.ts.map +1 -0
  115. package/dist/types/bridge/types/Quote.d.ts +3 -65
  116. package/dist/types/bridge/types/Quote.d.ts.map +1 -1
  117. package/dist/types/bridge/types/Route.d.ts +35 -0
  118. package/dist/types/bridge/types/Route.d.ts.map +1 -1
  119. package/dist/types/bridge/types/Token.d.ts +1 -0
  120. package/dist/types/bridge/types/Token.d.ts.map +1 -1
  121. package/dist/types/extensions/ens/resolve-l2-name.d.ts.map +1 -1
  122. package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
  123. package/dist/types/pay/buyWithFiat/getStatus.d.ts +1 -12
  124. package/dist/types/pay/buyWithFiat/getStatus.d.ts.map +1 -1
  125. package/dist/types/pay/utils/commonTypes.d.ts +1 -1
  126. package/dist/types/pay/utils/commonTypes.d.ts.map +1 -1
  127. package/dist/types/pay/utils/definitions.d.ts +0 -10
  128. package/dist/types/pay/utils/definitions.d.ts.map +1 -1
  129. package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts.map +1 -1
  130. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +1 -0
  131. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  132. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  133. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  134. package/dist/types/react/web/ui/ConnectWallet/TransactionsScreen.d.ts.map +1 -1
  135. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts +1 -30
  136. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
  137. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +2 -0
  138. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts.map +1 -1
  139. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts +2 -0
  140. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts.map +1 -1
  141. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts +0 -5
  142. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts.map +1 -1
  143. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.d.ts +1 -3
  144. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.d.ts.map +1 -1
  145. package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts +15 -0
  146. package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts.map +1 -0
  147. package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -1
  148. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +1 -0
  149. package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
  150. package/dist/types/version.d.ts +1 -1
  151. package/dist/types/version.d.ts.map +1 -1
  152. package/package.json +15 -15
  153. package/src/bridge/Buy.ts +1 -1
  154. package/src/bridge/Onramp.test.ts +118 -0
  155. package/src/bridge/Onramp.ts +244 -0
  156. package/src/bridge/OnrampStatus.ts +133 -0
  157. package/src/bridge/Sell.ts +1 -1
  158. package/src/bridge/index.ts +11 -3
  159. package/src/bridge/types/BridgeAction.ts +1 -0
  160. package/src/bridge/types/Quote.ts +3 -65
  161. package/src/bridge/types/Route.ts +39 -0
  162. package/src/bridge/types/Token.ts +1 -0
  163. package/src/extensions/ens/resolve-l2-name.ts +0 -2
  164. package/src/pay/buyWithFiat/getQuote.ts +184 -33
  165. package/src/pay/buyWithFiat/getStatus.ts +101 -42
  166. package/src/pay/convert/cryptoToFiat.test.ts +7 -5
  167. package/src/pay/convert/fiatToCrypto.test.ts +6 -4
  168. package/src/pay/utils/commonTypes.ts +1 -1
  169. package/src/pay/utils/definitions.ts +0 -14
  170. package/src/react/core/hooks/auth/useSiweAuth.ts +1 -1
  171. package/src/react/core/hooks/pay/useBuyWithFiatStatus.ts +0 -2
  172. package/src/react/core/hooks/transaction/useSendTransaction.ts +48 -41
  173. package/src/react/core/utils/wallet.ts +15 -0
  174. package/src/react/web/hooks/transaction/useSendTransaction.tsx +1 -0
  175. package/src/react/web/ui/ConnectWallet/TransactionsScreen.tsx +0 -53
  176. package/src/react/web/ui/ConnectWallet/locale/en.ts +1 -1
  177. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +3 -510
  178. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +2 -12
  179. package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +2 -0
  180. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +19 -20
  181. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +1 -37
  182. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.test.ts +1 -95
  183. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.ts +0 -69
  184. package/src/react/web/ui/TransactionButton/DepositScreen.tsx +295 -0
  185. package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +4 -3
  186. package/src/react/web/ui/TransactionButton/TransactionModal.tsx +20 -1
  187. package/src/version.ts +1 -1
  188. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +0 -37
  189. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +0 -1
  190. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +0 -86
  191. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +0 -1
  192. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +0 -25
  193. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +0 -1
  194. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +0 -81
  195. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +0 -1
  196. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +0 -17
  197. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +0 -1
  198. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js.map +0 -1
  199. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +0 -34
  200. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +0 -1
  201. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +0 -83
  202. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +0 -1
  203. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +0 -22
  204. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +0 -1
  205. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +0 -78
  206. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +0 -1
  207. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +0 -14
  208. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +0 -1
  209. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js +0 -2
  210. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js.map +0 -1
  211. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts +0 -26
  212. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +0 -1
  213. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts +0 -16
  214. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts.map +0 -1
  215. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts +0 -23
  216. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts.map +0 -1
  217. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts +0 -14
  218. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts.map +0 -1
  219. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts +0 -14
  220. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts.map +0 -1
  221. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.d.ts +0 -10
  222. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.d.ts.map +0 -1
  223. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +0 -142
  224. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.tsx +0 -170
  225. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.tsx +0 -63
  226. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.tsx +0 -138
  227. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.tsx +0 -45
  228. package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.ts +0 -12
@@ -1,10 +1,9 @@
1
+ import { status as onrampStatus } from "../../bridge/OnrampStatus.js";
1
2
  import type { ThirdwebClient } from "../../client/client.js";
2
- import { getClientFetch } from "../../utils/fetch.js";
3
3
  import type {
4
4
  PayOnChainTransactionDetails,
5
5
  PayTokenInfo,
6
6
  } from "../utils/commonTypes.js";
7
- import { getPayBuyWithFiatStatusEndpoint } from "../utils/definitions.js";
8
7
 
9
8
  /**
10
9
  * Parameters for the [`getBuyWithFiatStatus`](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatStatus) function
@@ -25,11 +24,6 @@ export type GetBuyWithFiatStatusParams = {
25
24
  intentId: string;
26
25
  };
27
26
 
28
- export type ValidBuyWithFiatStatus = Exclude<
29
- BuyWithFiatStatus,
30
- { status: "NOT_FOUND" }
31
- >;
32
-
33
27
  /**
34
28
  * The returned object from [`getBuyWithFiatStatus`](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatStatus) function
35
29
  *
@@ -50,28 +44,13 @@ export type BuyWithFiatStatus =
50
44
  * - `NONE` - No status
51
45
  * - `PENDING_PAYMENT` - Payment is not done yet in the on-ramp provider
52
46
  * - `PAYMENT_FAILED` - Payment failed in the on-ramp provider
53
- * - `PENDING_ON_RAMP_TRANSFER` - Payment is done but the on-ramp provider is yet to transfer the tokens to the user's wallet
54
- * - `ON_RAMP_TRANSFER_IN_PROGRESS` - On-ramp provider is transferring the tokens to the user's wallet
55
47
  * - `ON_RAMP_TRANSFER_COMPLETED` - On-ramp provider has transferred the tokens to the user's wallet
56
- * - `ON_RAMP_TRANSFER_FAILED` - On-ramp provider failed to transfer the tokens to the user's wallet
57
- * - `CRYPTO_SWAP_REQUIRED` - On-ramp provider has sent the tokens to the user's wallet but a swap is required to convert it to the desired token
58
- * - `CRYPTO_SWAP_IN_PROGRESS` - Swap is in progress
59
- * - `CRYPTO_SWAP_COMPLETED` - Swap is completed and the user has received the desired token
60
- * - `CRYPTO_SWAP_FALLBACK` - Swap failed and the user has received a fallback token which is not the desired token
61
48
  */
62
49
  status:
63
50
  | "NONE"
64
51
  | "PENDING_PAYMENT"
65
52
  | "PAYMENT_FAILED"
66
- | "PENDING_ON_RAMP_TRANSFER"
67
- | "ON_RAMP_TRANSFER_IN_PROGRESS"
68
- | "ON_RAMP_TRANSFER_COMPLETED"
69
- | "ON_RAMP_TRANSFER_FAILED"
70
- | "CRYPTO_SWAP_REQUIRED"
71
- | "CRYPTO_SWAP_COMPLETED"
72
- | "CRYPTO_SWAP_FALLBACK"
73
- | "CRYPTO_SWAP_IN_PROGRESS"
74
- | "CRYPTO_SWAP_FAILED";
53
+ | "ON_RAMP_TRANSFER_COMPLETED";
75
54
  /**
76
55
  * The wallet address to which the desired tokens are sent to
77
56
  */
@@ -171,7 +150,6 @@ export type BuyWithFiatStatus =
171
150
  * })
172
151
  *
173
152
  * // when the fiatStatus.status is "ON_RAMP_TRANSFER_COMPLETED" - the process is complete
174
- * // when the fiatStatus.status is "CRYPTO_SWAP_REQUIRED" - start the swap process
175
153
  * ```
176
154
  * @deprecated
177
155
  * @buyCrypto
@@ -179,26 +157,107 @@ export type BuyWithFiatStatus =
179
157
  export async function getBuyWithFiatStatus(
180
158
  params: GetBuyWithFiatStatusParams,
181
159
  ): Promise<BuyWithFiatStatus> {
182
- try {
183
- const queryParams = new URLSearchParams({
184
- intentId: params.intentId,
185
- });
160
+ const result = await onrampStatus({
161
+ id: params.intentId,
162
+ client: params.client,
163
+ });
186
164
 
187
- const queryString = queryParams.toString();
188
- const url = `${getPayBuyWithFiatStatusEndpoint()}?${queryString}`;
165
+ return toBuyWithFiatStatus({ intentId: params.intentId, result });
166
+ }
189
167
 
190
- const response = await getClientFetch(params.client)(url);
168
+ ////////////////////////////////////////////////////////////////////////////////
169
+ // Helpers
170
+ ////////////////////////////////////////////////////////////////////////////////
191
171
 
192
- if (!response.ok) {
193
- const error = await response.text().catch(() => null);
194
- throw new Error(
195
- `HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
196
- );
197
- }
172
+ function toBuyWithFiatStatus(args: {
173
+ intentId: string;
174
+ result: Awaited<ReturnType<typeof onrampStatus>>;
175
+ }): BuyWithFiatStatus {
176
+ const { intentId, result } = args;
177
+
178
+ // Map status constants from the Bridge.Onramp.status response to BuyWithFiatStatus equivalents.
179
+ const STATUS_MAP: Record<
180
+ typeof result.status,
181
+ "NONE" | "PENDING_PAYMENT" | "PAYMENT_FAILED" | "ON_RAMP_TRANSFER_COMPLETED"
182
+ > = {
183
+ CREATED: "PENDING_PAYMENT",
184
+ PENDING: "PENDING_PAYMENT",
185
+ FAILED: "PAYMENT_FAILED",
186
+ COMPLETED: "ON_RAMP_TRANSFER_COMPLETED",
187
+ } as const;
188
+
189
+ const mappedStatus = STATUS_MAP[result.status];
190
+
191
+ return buildPlaceholderStatus({
192
+ intentId,
193
+ status: mappedStatus,
194
+ purchaseData: result.purchaseData,
195
+ });
196
+ }
197
+
198
+ function buildPlaceholderStatus(args: {
199
+ intentId: string;
200
+ status:
201
+ | "NONE"
202
+ | "PENDING_PAYMENT"
203
+ | "PAYMENT_FAILED"
204
+ | "ON_RAMP_TRANSFER_COMPLETED";
205
+ purchaseData?: unknown;
206
+ }): BuyWithFiatStatus {
207
+ const { intentId, status, purchaseData } = args;
208
+
209
+ // Build a minimal—but type-complete—object that satisfies BuyWithFiatStatus.
210
+ const emptyToken: PayTokenInfo = {
211
+ chainId: 0,
212
+ tokenAddress: "",
213
+ decimals: 18,
214
+ priceUSDCents: 0,
215
+ name: "",
216
+ symbol: "",
217
+ };
218
+
219
+ type BuyWithFiatStatusWithData = Exclude<
220
+ BuyWithFiatStatus,
221
+ { status: "NOT_FOUND" }
222
+ >;
223
+
224
+ const quote: BuyWithFiatStatusWithData["quote"] = {
225
+ estimatedOnRampAmount: "0",
226
+ estimatedOnRampAmountWei: "0",
227
+
228
+ estimatedToTokenAmount: "0",
229
+ estimatedToTokenAmountWei: "0",
230
+
231
+ fromCurrency: {
232
+ amount: "0",
233
+ amountUnits: "USD",
234
+ decimals: 2,
235
+ currencySymbol: "USD",
236
+ },
237
+ fromCurrencyWithFees: {
238
+ amount: "0",
239
+ amountUnits: "USD",
240
+ decimals: 2,
241
+ currencySymbol: "USD",
242
+ },
243
+ onRampToken: emptyToken,
244
+ toToken: emptyToken,
245
+ estimatedDurationSeconds: 0,
246
+ createdAt: new Date().toISOString(),
247
+ } as BuyWithFiatStatusWithData["quote"];
248
+
249
+ // The source/destination fields can only be filled accurately when extra context is returned
250
+ // by the API. Since Bridge.Onramp.status doesn't yet provide these details, we omit them for
251
+ // now (they are optional).
252
+
253
+ const base: Exclude<BuyWithFiatStatus, { status: "NOT_FOUND" }> = {
254
+ intentId,
255
+ status,
256
+ toAddress: "",
257
+ fromAddress: "",
258
+ quote,
259
+ purchaseData: purchaseData as object | undefined,
260
+ };
198
261
 
199
- return (await response.json()).result;
200
- } catch (error) {
201
- console.error("Fetch error:", error);
202
- throw new Error(`Fetch failed: ${error}`);
203
- }
262
+ return base;
204
263
  }
@@ -1,10 +1,12 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
2
  import { TEST_CLIENT } from "~test/test-clients.js";
3
- import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
4
3
  import { base } from "../../chains/chain-definitions/base.js";
5
4
  import { ethereum } from "../../chains/chain-definitions/ethereum.js";
6
5
  import { sepolia } from "../../chains/chain-definitions/sepolia.js";
7
- import { NATIVE_TOKEN_ADDRESS } from "../../constants/addresses.js";
6
+ import {
7
+ NATIVE_TOKEN_ADDRESS,
8
+ ZERO_ADDRESS,
9
+ } from "../../constants/addresses.js";
8
10
  import { convertCryptoToFiat } from "./cryptoToFiat.js";
9
11
 
10
12
  describe.runIf(process.env.TW_SECRET_KEY)("Pay: crypto-to-fiat", () => {
@@ -49,7 +51,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("Pay: crypto-to-fiat", () => {
49
51
  expect(data.result).toBe(0);
50
52
  });
51
53
 
52
- it("should throw error for testnet chain (because testnets are not supported", async () => {
54
+ it("should throw error for testnet chain (because testnets are not supported)", async () => {
53
55
  await expect(
54
56
  convertCryptoToFiat({
55
57
  chain: sepolia,
@@ -81,13 +83,13 @@ describe.runIf(process.env.TW_SECRET_KEY)("Pay: crypto-to-fiat", () => {
81
83
  await expect(
82
84
  convertCryptoToFiat({
83
85
  chain: base,
84
- fromTokenAddress: TEST_ACCOUNT_A.address,
86
+ fromTokenAddress: ZERO_ADDRESS,
85
87
  fromAmount: 1,
86
88
  to: "USD",
87
89
  client: TEST_CLIENT,
88
90
  }),
89
91
  ).rejects.toThrowError(
90
- `Error: ${TEST_ACCOUNT_A.address} on chainId: ${base.id} is not a valid contract address.`,
92
+ `Error: ${ZERO_ADDRESS} on chainId: ${base.id} is not a valid contract address.`,
91
93
  );
92
94
  });
93
95
  it("should throw if response is not OK", async () => {
@@ -1,10 +1,12 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
2
  import { TEST_CLIENT } from "~test/test-clients.js";
3
- import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
4
3
  import { base } from "../../chains/chain-definitions/base.js";
5
4
  import { ethereum } from "../../chains/chain-definitions/ethereum.js";
6
5
  import { sepolia } from "../../chains/chain-definitions/sepolia.js";
7
- import { NATIVE_TOKEN_ADDRESS } from "../../constants/addresses.js";
6
+ import {
7
+ NATIVE_TOKEN_ADDRESS,
8
+ ZERO_ADDRESS,
9
+ } from "../../constants/addresses.js";
8
10
  import { convertFiatToCrypto } from "./fiatToCrypto.js";
9
11
 
10
12
  describe.runIf(process.env.TW_SECRET_KEY)("Pay: fiatToCrypto", () => {
@@ -84,13 +86,13 @@ describe.runIf(process.env.TW_SECRET_KEY)("Pay: fiatToCrypto", () => {
84
86
  await expect(
85
87
  convertFiatToCrypto({
86
88
  chain: base,
87
- to: TEST_ACCOUNT_A.address,
89
+ to: ZERO_ADDRESS,
88
90
  fromAmount: 1,
89
91
  from: "USD",
90
92
  client: TEST_CLIENT,
91
93
  }),
92
94
  ).rejects.toThrowError(
93
- `Error: ${TEST_ACCOUNT_A.address} on chainId: ${base.id} is not a valid contract address.`,
95
+ `Error: ${ZERO_ADDRESS} on chainId: ${base.id} is not a valid contract address.`,
94
96
  );
95
97
  });
96
98
  it("should throw if response is not OK", async () => {
@@ -19,4 +19,4 @@ export type PayOnChainTransactionDetails = {
19
19
 
20
20
  export type FiatProvider = (typeof FiatProviders)[number];
21
21
 
22
- export const FiatProviders = ["COINBASE", "STRIPE", "TRANSAK", "KADO"] as const;
22
+ export const FiatProviders = ["COINBASE", "STRIPE", "TRANSAK"] as const;
@@ -7,20 +7,6 @@ const getPayBaseUrl = () => {
7
7
  : `https://${payDomain}`;
8
8
  };
9
9
 
10
- /**
11
- * Endpoint to get a "Buy with Fiat" quote.
12
- * @internal
13
- */
14
- export const getPayBuyWithFiatQuoteEndpoint = () =>
15
- `${getPayBaseUrl()}/buy-with-fiat/quote/v1`;
16
-
17
- /**
18
- * Endpoint to get the status of a "Buy with Fiat" transaction status.
19
- * @internal
20
- */
21
- export const getPayBuyWithFiatStatusEndpoint = () =>
22
- `${getPayBaseUrl()}/buy-with-fiat/status/v1`;
23
-
24
10
  /**
25
11
  * Endpoint to get history of "Buy with Fiat" transactions for given wallet address.
26
12
  * @internal
@@ -97,7 +97,7 @@ export function useSiweAuth(
97
97
  import("../../../../auth/core/sign-login-payload.js"),
98
98
  ]);
99
99
 
100
- if (payload.chain_id) {
100
+ if (payload.chain_id && Number(payload.chain_id) !== chain.id) {
101
101
  await activeWallet.switchChain(
102
102
  getCachedChain(Number(payload.chain_id)),
103
103
  );
@@ -51,9 +51,7 @@ export function useBuyWithFiatStatus(
51
51
  const data = query.state.data as BuyWithFiatStatus;
52
52
  const status = data?.status;
53
53
  if (
54
- status === "ON_RAMP_TRANSFER_FAILED" ||
55
54
  status === "PAYMENT_FAILED" ||
56
- status === "CRYPTO_SWAP_COMPLETED" ||
57
55
  // onRampToken and toToken being the same means there is no additional swap step
58
56
  (status === "ON_RAMP_TRANSFER_COMPLETED" &&
59
57
  data?.quote.toToken.chainId === data?.quote.onRampToken.chainId &&
@@ -104,6 +104,7 @@ export type SendTransactionConfig = {
104
104
  };
105
105
 
106
106
  export type ShowModalData = {
107
+ mode: "buy" | "deposit";
107
108
  tx: PreparedTransaction;
108
109
  sendTx: () => void;
109
110
  rejectTx: (reason: Error) => void;
@@ -184,47 +185,6 @@ export function useSendTransactionCore(args: {
184
185
  resolvePromisedValue(tx.erc20Value),
185
186
  ]);
186
187
 
187
- const supportedDestinations = await Bridge.routes({
188
- client: tx.client,
189
- destinationChainId: tx.chain.id,
190
- destinationTokenAddress: _erc20Value?.tokenAddress,
191
- }).catch((err) => {
192
- trackPayEvent({
193
- client: tx.client,
194
- walletAddress: account.address,
195
- walletType: wallet?.id,
196
- toChainId: tx.chain.id,
197
- event: "pay_transaction_modal_pay_api_error",
198
- error: err?.message,
199
- });
200
- return null;
201
- });
202
-
203
- if (!supportedDestinations) {
204
- // could not fetch supported destinations, just send the tx
205
- sendTx();
206
- return;
207
- }
208
-
209
- if (supportedDestinations.length === 0) {
210
- trackPayEvent({
211
- client: tx.client,
212
- walletAddress: account.address,
213
- walletType: wallet?.id,
214
- toChainId: tx.chain.id,
215
- toToken: _erc20Value?.tokenAddress || undefined,
216
- event: "pay_transaction_modal_chain_token_not_supported",
217
- error: JSON.stringify({
218
- chain: tx.chain.id,
219
- token: _erc20Value?.tokenAddress,
220
- message: "chain/token not supported",
221
- }),
222
- });
223
- // chain/token not supported, just send the tx
224
- sendTx();
225
- return;
226
- }
227
-
228
188
  const nativeValue = _nativeValue || 0n;
229
189
  const erc20Value = _erc20Value?.amountWei || 0n;
230
190
 
@@ -256,7 +216,54 @@ export function useSendTransactionCore(args: {
256
216
  (nativeCost > 0n && nativeBalance.value < nativeCost);
257
217
 
258
218
  if (shouldShowModal) {
219
+ const supportedDestinations = await Bridge.routes({
220
+ client: tx.client,
221
+ destinationChainId: tx.chain.id,
222
+ destinationTokenAddress: _erc20Value?.tokenAddress,
223
+ }).catch((err) => {
224
+ trackPayEvent({
225
+ client: tx.client,
226
+ walletAddress: account.address,
227
+ walletType: wallet?.id,
228
+ toChainId: tx.chain.id,
229
+ event: "pay_transaction_modal_pay_api_error",
230
+ error: err?.message,
231
+ });
232
+ return null;
233
+ });
234
+
235
+ if (
236
+ !supportedDestinations ||
237
+ supportedDestinations.length === 0
238
+ ) {
239
+ // not a supported destination -> show deposit screen
240
+ trackPayEvent({
241
+ client: tx.client,
242
+ walletAddress: account.address,
243
+ walletType: wallet?.id,
244
+ toChainId: tx.chain.id,
245
+ toToken: _erc20Value?.tokenAddress || undefined,
246
+ event: "pay_transaction_modal_chain_token_not_supported",
247
+ error: JSON.stringify({
248
+ chain: tx.chain.id,
249
+ token: _erc20Value?.tokenAddress,
250
+ message: "chain/token not supported",
251
+ }),
252
+ });
253
+
254
+ showPayModal({
255
+ mode: "deposit",
256
+ tx,
257
+ sendTx,
258
+ rejectTx: reject,
259
+ resolveTx: resolve,
260
+ });
261
+ return;
262
+ }
263
+
264
+ // chain is supported, show buy mode
259
265
  showPayModal({
266
+ mode: "buy",
260
267
  tx,
261
268
  sendTx,
262
269
  rejectTx: reject,
@@ -244,6 +244,21 @@ export function hasSponsoredTransactionsEnabled(wallet: Wallet | undefined) {
244
244
  sponsoredTransactionsEnabled = smartOptions.gasless;
245
245
  }
246
246
  }
247
+ if (options?.executionMode) {
248
+ const execMode = options.executionMode;
249
+ if (execMode.mode === "EIP4337") {
250
+ const smartOptions = execMode.smartAccount;
251
+ if (smartOptions && "sponsorGas" in smartOptions) {
252
+ sponsoredTransactionsEnabled = smartOptions.sponsorGas;
253
+ }
254
+ if (smartOptions && "gasless" in smartOptions) {
255
+ sponsoredTransactionsEnabled = smartOptions.gasless;
256
+ }
257
+ }
258
+ if (execMode.mode === "EIP7702") {
259
+ sponsoredTransactionsEnabled = execMode.sponsorGas || false;
260
+ }
261
+ }
247
262
  }
248
263
  return sponsoredTransactionsEnabled;
249
264
  }
@@ -121,6 +121,7 @@ export function useSendTransaction(config: SendTransactionConfig = {}) {
121
121
  localeId={payModal?.locale || "en_US"}
122
122
  supportedTokens={payModal?.supportedTokens}
123
123
  theme={payModal?.theme || "dark"}
124
+ modalMode={data.mode}
124
125
  payOptions={{
125
126
  buyWithCrypto: payModal?.buyWithCrypto,
126
127
  buyWithFiat: payModal?.buyWithFiat,
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
 
3
3
  import { ExternalLinkIcon } from "@radix-ui/react-icons";
4
- import { useState } from "react";
5
4
  import type { ThirdwebClient } from "../../../../client/client.js";
6
5
  import { formatExplorerAddressUrl } from "../../../../utils/url.js";
7
6
  import { iconSize } from "../../../core/design-system/index.js";
@@ -14,14 +13,10 @@ import { Spacer } from "../components/Spacer.js";
14
13
  import { Container, Line, ModalHeader } from "../components/basic.js";
15
14
  import { ButtonLink } from "../components/buttons.js";
16
15
  import type { ConnectLocale } from "./locale/types.js";
17
- import { TxDetailsScreen } from "./screens/Buy/pay-transactions/TxDetailsScreen.js";
18
- import type { TxStatusInfo } from "./screens/Buy/pay-transactions/useBuyTransactionsToShow.js";
19
16
  import type { PayerInfo } from "./screens/Buy/types.js";
20
17
  import { WalletTransactionHistory } from "./screens/WalletTransactionHistory.js";
21
18
  import type { WalletDetailsModalScreen } from "./screens/types.js";
22
19
 
23
- //
24
-
25
20
  /**
26
21
  * @internal
27
22
  */
@@ -33,10 +28,6 @@ export function TransactionsScreen(props: {
33
28
  locale: ConnectLocale;
34
29
  client: ThirdwebClient;
35
30
  }) {
36
- // const [activeTab, setActiveTab] = useState("Transactions");
37
- // For now, you can only select pay transactions (purcahses)
38
- const [selectedTx, setSelectedTx] = useState<TxStatusInfo | null>(null);
39
-
40
31
  const activeChain = useActiveWalletChain();
41
32
  const activeWallet = useActiveWallet();
42
33
  const activeAccount = useActiveAccount();
@@ -51,21 +42,6 @@ export function TransactionsScreen(props: {
51
42
  return <LoadingScreen />;
52
43
  }
53
44
 
54
- if (selectedTx) {
55
- return (
56
- <TxDetailsScreen
57
- title={props.title}
58
- client={props.client}
59
- statusInfo={selectedTx}
60
- onBack={() => setSelectedTx(null)}
61
- onDone={() => setSelectedTx(null)}
62
- payer={payer}
63
- transactionMode={false}
64
- isEmbed={false}
65
- />
66
- );
67
- }
68
-
69
45
  return (
70
46
  <Container animate="fadein">
71
47
  <Container p="lg">
@@ -80,40 +56,11 @@ export function TransactionsScreen(props: {
80
56
  }}
81
57
  >
82
58
  <Spacer y="md" />
83
- {/* <Tabs */}
84
- {/* options={[ */}
85
- {/* {
86
- label: (
87
- <span className="flex gap-2">
88
- <CoinsIcon size={iconSize.sm} /> Transactions
89
- </span>
90
- ),
91
- value: "Transactions",
92
- // },
93
- // TODO (UB): add back in once we have a way to show purchases with new service
94
- // {
95
- // label: (
96
- // <span className="flex gap-2">
97
- // <FundsIcon size={iconSize.sm} /> Purchases
98
- // </span>
99
- // ),
100
- // value: "Purchases",
101
- // },
102
- // ]}
103
- // selected={activeTab}
104
- // onSelect={setActiveTab}
105
- {/* > */}
106
- {/* {activeTab === "Purchases" && ( */}
107
- {/* <PayTxHistoryList client={props.client} onSelectTx={setSelectedTx} /> */}
108
- {/* )} */}
109
- {/* {activeTab === "Transactions" && ( */}
110
59
  <WalletTransactionHistory
111
60
  locale={props.locale}
112
61
  client={props.client}
113
62
  address={payer.account.address}
114
63
  />
115
- {/* })} */}
116
- {/* </Tabs> */}
117
64
  </Container>
118
65
  <Line />
119
66
  <Container p="lg">
@@ -68,7 +68,7 @@ const connectLocaleEn: ConnectLocale = {
68
68
  },
69
69
  receiveFundsScreen: {
70
70
  title: "Receive Funds",
71
- instruction: "Copy the wallet address to send funds to this wallet",
71
+ instruction: "Copy the address to send funds to this wallet",
72
72
  },
73
73
  sendFundsScreen: {
74
74
  title: "Send Funds",