|
1 | 1 | import type { ThirdwebClient } from "../../client/client.js"; |
| 2 | +import type { CurrencyMeta } from "../../react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js"; |
2 | 3 | import { getClientFetch } from "../../utils/fetch.js"; |
3 | 4 | import { stringify } from "../../utils/json.js"; |
4 | | -import type { FiatProvider } from "../utils/commonTypes.js"; |
| 5 | +import type { FiatProvider, PayTokenInfo } from "../utils/commonTypes.js"; |
5 | 6 | import { getPayBuyWithFiatQuoteEndpoint } from "../utils/definitions.js"; |
6 | | - |
7 | 7 | /** |
8 | 8 | * Parameters for [`getBuyWithFiatQuote`](https://portal.thirdweb.com/references/typescript/v5/getBuyWithFiatQuote) function |
9 | 9 | * @buyCrypto |
@@ -40,7 +40,7 @@ export type GetBuyWithFiatQuoteParams = { |
40 | 40 | /** |
41 | 41 | * Symbol of the fiat currency to buy the token with. |
42 | 42 | */ |
43 | | - fromCurrencySymbol: "USD" | "CAD" | "GBP" | "EUR" | "JPY"; |
| 43 | + fromCurrencySymbol: CurrencyMeta["shorthand"]; |
44 | 44 |
|
45 | 45 | /** |
46 | 46 | * The maximum slippage in basis points (bps) allowed for the transaction. |
@@ -150,14 +150,7 @@ export type BuyWithFiatQuote = { |
150 | 150 | /** |
151 | 151 | * Token information for the desired token. (token the user wants to buy) |
152 | 152 | */ |
153 | | - toToken: { |
154 | | - symbol?: string | undefined; |
155 | | - priceUSDCents?: number | undefined; |
156 | | - name?: string | undefined; |
157 | | - chainId: number; |
158 | | - tokenAddress: string; |
159 | | - decimals: number; |
160 | | - }; |
| 153 | + toToken: PayTokenInfo; |
161 | 154 | /** |
162 | 155 | * Address of the wallet to which the tokens will be sent. |
163 | 156 | */ |
@@ -196,35 +189,17 @@ export type BuyWithFiatQuote = { |
196 | 189 | amount: string; |
197 | 190 | amountWei: string; |
198 | 191 | amountUSDCents: number; |
199 | | - token: { |
200 | | - chainId: number; |
201 | | - decimals: number; |
202 | | - name: string; |
203 | | - priceUSDCents: number; |
204 | | - symbol: string; |
205 | | - tokenAddress: string; |
206 | | - }; |
| 192 | + token: PayTokenInfo; |
207 | 193 | }; |
208 | 194 |
|
209 | 195 | /** |
210 | | - * Gas Token that will be sent to the user's wallet address by the on-ramp provider. |
211 | | - * |
212 | | - * Only used for ERC20 + Gas on-ramp flow. This will hold the details of the gas token and amount sent for gas. |
213 | | - * |
214 | | - * In Native Currency case, extra for gas will be added to the output amount of the onramp. |
| 196 | + * Routing token that will be swapped from the on-ramp token, so that it can be bridged to the destination token. |
215 | 197 | */ |
216 | | - gasToken?: { |
| 198 | + routingToken?: { |
217 | 199 | amount: string; |
218 | 200 | amountWei: string; |
219 | 201 | amountUSDCents: number; |
220 | | - token: { |
221 | | - chainId: number; |
222 | | - decimals: number; |
223 | | - name: string; |
224 | | - priceUSDCents: number; |
225 | | - symbol: string; |
226 | | - tokenAddress: string; |
227 | | - }; |
| 202 | + token: PayTokenInfo; |
228 | 203 | }; |
229 | 204 |
|
230 | 205 | /** |
@@ -318,6 +293,7 @@ export async function getBuyWithFiatQuote( |
318 | 293 | fromAddress: params.fromAddress, |
319 | 294 | toGasAmountWei: params.toGasAmountWei, |
320 | 295 | preferredProvider: params.preferredProvider, |
| 296 | + multiHopSupported: true, |
321 | 297 | }), |
322 | 298 | }); |
323 | 299 |
|
|
0 commit comments