@@ -3,37 +3,12 @@ import type { ThirdwebClient } from "../client/client.js";
33import { getThirdwebBaseUrl } from "../utils/domains.js" ;
44import { getClientFetch } from "../utils/fetch.js" ;
55import { stringify } from "../utils/json.js" ;
6- import type { BridgeAction } from "./types/BridgeAction .js" ;
6+ import type { RouteStep } from "./types/Route .js" ;
77import type { Token } from "./types/Token.js" ;
88
99// export status within the Onramp module
1010export { status } from "./OnrampStatus.js" ;
1111
12- // API-specific type for Transactions as returned by the Onramp prepare endpoint
13- type ApiBridgeTransaction = {
14- id : string ;
15- chainId : number ;
16- maxPriorityFeePerGas ?: string ;
17- maxFeePerGas ?: string ;
18- to : string ;
19- from ?: string | null ;
20- value ?: string ;
21- gas ?: string ;
22- data ?: string ;
23- type : "eip1559" ;
24- action : BridgeAction ;
25- } ;
26-
27- // Helper types based on OpenAPI spec for POST /v1/onramp/prepare response
28- type OnrampStep = {
29- originToken : Token ;
30- destinationToken : Token ;
31- transactions : ApiBridgeTransaction [ ] ;
32- originAmount : string ;
33- destinationAmount : string ;
34- estimatedExecutionTimeMs : number ;
35- } ;
36-
3712type OnrampIntent = {
3813 onramp : "stripe" | "coinbase" | "transak" ;
3914 chainId : number ;
@@ -54,10 +29,11 @@ type OnrampPrepareQuoteResponseData = {
5429 link : string ;
5530 currency : string ;
5631 currencyAmount : number ;
57- destinationAmount : string ;
32+ destinationAmount : bigint ;
33+ destinationToken : Token ;
5834 timestamp ?: number ;
5935 expiration ?: number ;
60- steps : OnrampStep [ ] ;
36+ steps : RouteStep [ ] ;
6137 intent : OnrampIntent ;
6238} ;
6339
@@ -231,11 +207,6 @@ export async function prepare(
231207 transactions : step . transactions . map ( ( tx ) => ( {
232208 ...tx ,
233209 value : tx . value ? BigInt ( tx . value ) : undefined ,
234- gas : tx . gas ? BigInt ( tx . gas ) : undefined ,
235- maxFeePerGas : tx . maxFeePerGas ? BigInt ( tx . maxFeePerGas ) : undefined ,
236- maxPriorityFeePerGas : tx . maxPriorityFeePerGas
237- ? BigInt ( tx . maxPriorityFeePerGas )
238- : undefined ,
239210 } ) ) ,
240211 } ) ) ;
241212
@@ -269,31 +240,5 @@ export declare namespace prepare {
269240 excludeChainIds ?: string | string [ ] ;
270241 } ;
271242
272- export type Result = Omit <
273- OnrampPrepareQuoteResponseData ,
274- "destinationAmount" | "steps" | "intent"
275- > & {
276- destinationAmount : bigint ;
277- steps : Array <
278- Omit <
279- OnrampStep ,
280- "originAmount" | "destinationAmount" | "transactions"
281- > & {
282- originAmount : bigint ;
283- destinationAmount : bigint ;
284- transactions : Array <
285- Omit <
286- ApiBridgeTransaction ,
287- "value" | "gas" | "maxFeePerGas" | "maxPriorityFeePerGas"
288- > & {
289- value ?: bigint ;
290- gas ?: bigint ;
291- maxFeePerGas ?: bigint ;
292- maxPriorityFeePerGas ?: bigint ;
293- }
294- > ;
295- }
296- > ;
297- intent : OnrampIntent ;
298- } ;
243+ export type Result = OnrampPrepareQuoteResponseData ;
299244}
0 commit comments