File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
packages/thirdweb/src/pay/buyWithFiat Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ updated pay interface for onramp + gas
Original file line number Diff line number Diff line change @@ -75,6 +75,13 @@ export type GetBuyWithFiatQuoteParams = {
75
75
* This details will be stored with the purchase and can be retrieved later via the status API or Webhook
76
76
*/
77
77
purchaseData ?: object ;
78
+
79
+ /**
80
+ * Optional parameter to onramp gas with the purchase
81
+ * If native token, will onramp extra native token amount
82
+ * If erc20, will onramp native token + erc20
83
+ */
84
+ toGasAmountWei ?: string ;
78
85
} ;
79
86
80
87
/**
@@ -190,6 +197,27 @@ export type BuyWithFiatQuote = {
190
197
} ;
191
198
} ;
192
199
200
+ /**
201
+ * Gas Token that will be sent to the user's wallet address by the on-ramp provider.
202
+ *
203
+ * Only used for ERC20 + Gas on-ramp flow. This will hold the details of the gas token and amount sent for gas.
204
+ *
205
+ * In Native Currency case, extra for gas will be added to the output amount of the onramp.
206
+ */
207
+ gasToken ?: {
208
+ amount : string ;
209
+ amountWei : string ;
210
+ amountUSDCents : number ;
211
+ token : {
212
+ chainId : number ;
213
+ decimals : number ;
214
+ name : string ;
215
+ priceUSDCents : number ;
216
+ symbol : string ;
217
+ tokenAddress : string ;
218
+ } ;
219
+ } ;
220
+
193
221
/**
194
222
* Link to the on-ramp provider UI that will prompt the user to buy the token with fiat currency.
195
223
*
@@ -274,6 +302,7 @@ export async function getBuyWithFiatQuote(
274
302
isTestMode : params . isTestMode ,
275
303
purchaseData : params . purchaseData ,
276
304
fromAddress : params . fromAddress ,
305
+ toGasAmountWei : params . toGasAmountWei ,
277
306
} ) ,
278
307
} ) ;
279
308
You can’t perform that action at this time.
0 commit comments