Skip to content

Commit 5f74b3c

Browse files
authored
Chore: Update UB jsdocs to include types (#7629)
1 parent 761cde6 commit 5f74b3c

File tree

8 files changed

+221
-1
lines changed

8 files changed

+221
-1
lines changed

apps/portal/src/components/Document/AuthMethodsTabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ function AuthMethodsTabsContent() {
762762
>
763763
<img
764764
alt={method.label}
765-
className="size-5 flex-shrink-0"
765+
className="size-5 shrink-0"
766766
src={getSocialIcon(method.id)}
767767
/>
768768
<div className="min-w-0 flex-1">

packages/thirdweb/src/bridge/Buy.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,47 @@ export async function quote(options: quote.Options): Promise<quote.Result> {
155155
};
156156
}
157157

158+
/**
159+
* Namespace containing types for the buy quote function.
160+
* @namespace quote
161+
* @bridge Buy
162+
*/
158163
export declare namespace quote {
164+
/**
165+
* Options for getting a buy quote.
166+
* @interface Options
167+
* @bridge Buy
168+
*/
159169
type Options = {
170+
/** The origin chain ID */
160171
originChainId: number;
172+
/** The origin token address */
161173
originTokenAddress: ox__Address.Address;
174+
/** The destination chain ID */
162175
destinationChainId: number;
176+
/** The destination token address */
163177
destinationTokenAddress: ox__Address.Address;
178+
/** Your thirdweb client */
164179
client: ThirdwebClient;
180+
/** Maximum number of steps in the route */
165181
maxSteps?: number;
166182
} & (
167183
| {
184+
/** The amount to buy in wei */
168185
buyAmountWei: bigint;
169186
}
170187
| {
188+
/** The amount to spend in wei */
171189
amount: bigint;
172190
}
173191
);
174192

193+
/**
194+
* Result returned from getting a buy quote.
195+
* Contains quote details and intent information.
196+
* @interface Result
197+
* @bridge Buy
198+
*/
175199
type Result = Quote & {
176200
intent: {
177201
originChainId: number;
@@ -404,24 +428,50 @@ export async function prepare(
404428
};
405429
}
406430

431+
/**
432+
* Namespace containing types for the buy prepare function.
433+
* @namespace prepare
434+
* @bridge Buy
435+
*/
407436
export declare namespace prepare {
437+
/**
438+
* Options for preparing a buy transaction.
439+
* @interface Options
440+
* @bridge Buy
441+
*/
408442
type Options = {
443+
/** The origin chain ID */
409444
originChainId: number;
445+
/** The origin token address */
410446
originTokenAddress: ox__Address.Address;
447+
/** The destination chain ID */
411448
destinationChainId: number;
449+
/** The destination token address */
412450
destinationTokenAddress: ox__Address.Address;
451+
/** The sender address */
413452
sender: ox__Address.Address;
453+
/** The receiver address */
414454
receiver: ox__Address.Address;
455+
/** The amount to buy in wei */
415456
amount: bigint;
457+
/** Your thirdweb client */
416458
client: ThirdwebClient;
459+
/** Arbitrary purchase data */
417460
purchaseData?: PurchaseData;
461+
/** Maximum number of steps in the route */
418462
maxSteps?: number;
419463
/**
420464
* @hidden
421465
*/
422466
paymentLinkId?: string;
423467
};
424468

469+
/**
470+
* Result returned from preparing a buy transaction.
471+
* Contains prepared quote with transaction data and intent information.
472+
* @interface Result
473+
* @bridge Buy
474+
*/
425475
type Result = PreparedQuote & {
426476
intent: {
427477
originChainId: number;

packages/thirdweb/src/bridge/Chains.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,27 @@ export async function chains(options: chains.Options): Promise<chains.Result> {
8181
);
8282
}
8383

84+
/**
85+
* Namespace containing types for the chains function.
86+
* @namespace chains
87+
* @bridge
88+
*/
8489
export declare namespace chains {
90+
/**
91+
* Options for fetching supported bridge chains.
92+
* @interface Options
93+
* @bridge
94+
*/
8595
type Options = {
96+
/** Your thirdweb client */
8697
client: ThirdwebClient;
8798
};
8899

100+
/**
101+
* Result returned from fetching supported bridge chains.
102+
* Contains an array of supported chains.
103+
* @interface Result
104+
* @bridge
105+
*/
89106
type Result = Chain[];
90107
}

packages/thirdweb/src/bridge/Onramp.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,27 +258,57 @@ export async function prepare(
258258
};
259259
}
260260

261+
/**
262+
* Namespace containing types for the onramp prepare function.
263+
* @namespace prepare
264+
* @bridge Onramp
265+
*/
261266
export declare namespace prepare {
267+
/**
268+
* Options for preparing an onramp transaction.
269+
* @interface Options
270+
* @bridge Onramp
271+
*/
262272
export type Options = {
273+
/** Your thirdweb client */
263274
client: ThirdwebClient;
275+
/** The onramp provider to use (e.g., "stripe", "coinbase", "transak") */
264276
onramp: "stripe" | "coinbase" | "transak";
277+
/** The destination chain ID */
265278
chainId: number;
279+
/** The destination token address */
266280
tokenAddress: ox__Address.Address;
281+
/** The address that will receive the output token */
267282
receiver: ox__Address.Address;
283+
/** The desired token amount in wei */
268284
amount?: bigint;
285+
/** Arbitrary purchase data */
269286
purchaseData?: PurchaseData;
287+
/** An optional address to associate as the onramp sender */
270288
sender?: ox__Address.Address;
289+
/** The token to initially onramp to if the destination token is not supported by the provider */
271290
onrampTokenAddress?: ox__Address.Address;
291+
/** The chain ID to initially onramp to if the destination chain is not supported */
272292
onrampChainId?: number;
293+
/** The currency for the onramp (e.g., "USD", "GBP"). Defaults to user's preferred or "USD" */
273294
currency?: string;
295+
/** Maximum number of post-onramp steps */
274296
maxSteps?: number;
297+
/** Chain IDs to exclude from the route (string or array of strings) */
275298
excludeChainIds?: string | string[];
299+
/** The user's country code (e.g. "US", "JP"). Defaults to "US". We highly recommend this be set (based on the user's IP address) */
276300
country?: string;
277301
/**
278302
* @hidden
279303
*/
280304
paymentLinkId?: string;
281305
};
282306

307+
/**
308+
* Result returned from preparing an onramp transaction.
309+
* Contains the onramp link, quote information, and routing steps.
310+
* @interface Result
311+
* @bridge Onramp
312+
*/
283313
export type Result = OnrampPrepareQuoteResponseData;
284314
}

packages/thirdweb/src/bridge/Routes.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,47 @@ export async function routes(options: routes.Options): Promise<routes.Result> {
179179
return data;
180180
}
181181

182+
/**
183+
* Namespace containing types for the routes function.
184+
* @namespace routes
185+
* @bridge
186+
*/
182187
export declare namespace routes {
188+
/**
189+
* Options for fetching available bridge routes.
190+
* @interface Options
191+
* @bridge
192+
*/
183193
type Options = {
194+
/** Your thirdweb client */
184195
client: ThirdwebClient;
196+
/** The origin chain ID to filter routes by */
185197
originChainId?: number;
198+
/** The origin token address to filter routes by */
186199
originTokenAddress?: ox__Address.Address;
200+
/** The destination chain ID to filter routes by */
187201
destinationChainId?: number;
202+
/** The destination token address to filter routes by */
188203
destinationTokenAddress?: ox__Address.Address;
204+
/** Transaction hash to filter routes by */
189205
transactionHash?: ox__Hex.Hex;
206+
/** Sort routes by popularity */
190207
sortBy?: "popularity";
208+
/** Maximum number of steps in the route */
191209
maxSteps?: number;
210+
/** Whether to include price information in the response */
192211
includePrices?: boolean;
212+
/** Number of results to return (pagination) */
193213
limit?: number;
214+
/** Number of results to skip (pagination) */
194215
offset?: number;
195216
};
196217

218+
/**
219+
* Result returned from fetching bridge routes.
220+
* Contains an array of available routes.
221+
* @interface Result
222+
* @bridge
223+
*/
197224
type Result = Route[];
198225
}

packages/thirdweb/src/bridge/Sell.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,40 @@ export async function quote(options: quote.Options): Promise<quote.Result> {
154154
};
155155
}
156156

157+
/**
158+
* Namespace containing types for the sell quote function.
159+
* @namespace quote
160+
* @bridge Sell
161+
*/
157162
export declare namespace quote {
163+
/**
164+
* Options for getting a sell quote.
165+
* @interface Options
166+
* @bridge Sell
167+
*/
158168
type Options = {
169+
/** The origin chain ID */
159170
originChainId: number;
171+
/** The origin token address */
160172
originTokenAddress: ox__Address.Address;
173+
/** The destination chain ID */
161174
destinationChainId: number;
175+
/** The destination token address */
162176
destinationTokenAddress: ox__Address.Address;
177+
/** The amount to sell in wei */
163178
amount: bigint;
179+
/** Your thirdweb client */
164180
client: ThirdwebClient;
181+
/** Maximum number of steps in the route */
165182
maxSteps?: number;
166183
};
167184

185+
/**
186+
* Result returned from getting a sell quote.
187+
* Contains quote details and intent information.
188+
* @interface Result
189+
* @bridge Sell
190+
*/
168191
type Result = Quote & {
169192
intent: {
170193
originChainId: number;
@@ -393,24 +416,50 @@ export async function prepare(
393416
};
394417
}
395418

419+
/**
420+
* Namespace containing types for the sell prepare function.
421+
* @namespace prepare
422+
* @bridge Sell
423+
*/
396424
export declare namespace prepare {
425+
/**
426+
* Options for preparing a sell transaction.
427+
* @interface Options
428+
* @bridge Sell
429+
*/
397430
type Options = {
431+
/** The origin chain ID */
398432
originChainId: number;
433+
/** The origin token address */
399434
originTokenAddress: ox__Address.Address;
435+
/** The destination chain ID */
400436
destinationChainId: number;
437+
/** The destination token address */
401438
destinationTokenAddress: ox__Address.Address;
439+
/** The amount to sell in wei */
402440
amount: bigint;
441+
/** The sender address */
403442
sender: ox__Address.Address;
443+
/** The receiver address */
404444
receiver: ox__Address.Address;
445+
/** Your thirdweb client */
405446
client: ThirdwebClient;
447+
/** Arbitrary purchase data */
406448
purchaseData?: PurchaseData;
449+
/** Maximum number of steps in the route */
407450
maxSteps?: number;
408451
/**
409452
* @hidden
410453
*/
411454
paymentLinkId?: string;
412455
};
413456

457+
/**
458+
* Result returned from preparing a sell transaction.
459+
* Contains prepared quote with transaction data and intent information.
460+
* @interface Result
461+
* @bridge Sell
462+
*/
414463
type Result = PreparedQuote & {
415464
intent: {
416465
originChainId: number;

packages/thirdweb/src/bridge/Status.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,41 @@ export async function status(options: status.Options): Promise<status.Result> {
177177
};
178178
}
179179

180+
/**
181+
* Namespace containing types for the status function.
182+
* @namespace status
183+
* @bridge
184+
*/
180185
export declare namespace status {
186+
/**
187+
* Options for checking transaction status.
188+
* Can specify either chainId or chain object.
189+
* @interface Options
190+
* @bridge
191+
*/
181192
type Options =
182193
| {
194+
/** The transaction hash to check status for */
183195
transactionHash: ox__Hex.Hex;
196+
/** The chain ID where the transaction occurred */
184197
chainId: number;
198+
/** Your thirdweb client */
185199
client: ThirdwebClient;
186200
}
187201
| {
202+
/** The transaction hash to check status for */
188203
transactionHash: ox__Hex.Hex;
204+
/** The chain object where the transaction occurred */
189205
chain: Chain;
206+
/** Your thirdweb client */
190207
client: ThirdwebClient;
191208
};
192209

210+
/**
211+
* Result returned from checking transaction status.
212+
* Contains the current status and transaction details.
213+
* @interface Result
214+
* @bridge
215+
*/
193216
type Result = Status;
194217
}

0 commit comments

Comments
 (0)