Skip to content

Commit dc86fa2

Browse files
IDubuquejnsdls
andauthored
updated pay interface for onramp + gas (#3894)
Signed-off-by: Jonas Daniels <jonas.daniels@outlook.com> Co-authored-by: Jonas Daniels <jonas.daniels@outlook.com>
1 parent 64d1b79 commit dc86fa2

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.changeset/weak-roses-love.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
updated pay interface for onramp + gas

packages/thirdweb/src/pay/buyWithFiat/getQuote.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ export type GetBuyWithFiatQuoteParams = {
7575
* This details will be stored with the purchase and can be retrieved later via the status API or Webhook
7676
*/
7777
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;
7885
};
7986

8087
/**
@@ -190,6 +197,27 @@ export type BuyWithFiatQuote = {
190197
};
191198
};
192199

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+
193221
/**
194222
* Link to the on-ramp provider UI that will prompt the user to buy the token with fiat currency.
195223
*
@@ -274,6 +302,7 @@ export async function getBuyWithFiatQuote(
274302
isTestMode: params.isTestMode,
275303
purchaseData: params.purchaseData,
276304
fromAddress: params.fromAddress,
305+
toGasAmountWei: params.toGasAmountWei,
277306
}),
278307
});
279308

0 commit comments

Comments
 (0)