Skip to content

Commit 8761fb1

Browse files
committed
docs: add bridge submodules
1 parent 9b90a28 commit 8761fb1

File tree

4 files changed

+70
-6
lines changed

4 files changed

+70
-6
lines changed

apps/portal/src/app/references/components/TDoc/utils/getSidebarLinkgroups.ts

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ export function getSidebarLinkGroups(doc: TransformedDoc, path: string) {
167167
return tag === "@modules";
168168
});
169169

170+
const bridge = docs.filter((d) => {
171+
const [tag] = getCustomTag(d) || [];
172+
return tag === "@bridge";
173+
});
174+
170175
// sort extensions into their own groups
171176
if (extensions.length) {
172177
const extensionGroups = extensions.reduce(
@@ -247,9 +252,68 @@ export function getSidebarLinkGroups(doc: TransformedDoc, path: string) {
247252
}
248253
}
249254

255+
if (bridge.length) {
256+
const bridgeGroups = bridge.reduce(
257+
(acc, d) => {
258+
const [, moduleName] = getCustomTag(d) || [];
259+
if (moduleName) {
260+
if (!acc[moduleName]) {
261+
acc[moduleName] = [];
262+
}
263+
acc[moduleName]?.push(d);
264+
}
265+
return acc;
266+
},
267+
{} as Record<string, SomeDoc[]>,
268+
);
269+
const bridgeLinkGroups: {
270+
name: string;
271+
href: string;
272+
links?: { name: string; href?: string }[];
273+
}[] = Object.entries(bridgeGroups)
274+
.filter(([namespaceName]) => namespaceName.toLowerCase() !== "common")
275+
.map(([namespaceName, docs]) => {
276+
const links = docs.map((d) => ({
277+
name: d.name,
278+
href: getLink(`${path}/${namespaceName.toLowerCase()}/${d.name}`),
279+
}));
280+
return {
281+
name: namespaceName,
282+
href: "",
283+
links,
284+
};
285+
});
286+
287+
// Add the top-level functions
288+
for (const [_, docs] of Object.entries(bridgeGroups).filter(
289+
([namespaceName]) => namespaceName.toLowerCase() === "common",
290+
)) {
291+
for (const doc of docs) {
292+
bridgeLinkGroups.push({
293+
name: doc.name,
294+
href: getLink(`${path}/${doc.name}`),
295+
});
296+
}
297+
}
298+
299+
if (!linkGroups.find((group) => group.name === name)) {
300+
linkGroups.push({
301+
name: name,
302+
href: getLink(`${path}/${key}`),
303+
links: [{ name: "Universal Bridge", links: bridgeLinkGroups }],
304+
isCollapsible: false,
305+
});
306+
} else {
307+
linkGroups
308+
.find((group) => group.name === name)
309+
?.links.push({ name: "Universal Bridge", links: bridgeLinkGroups });
310+
}
311+
console.log(linkGroups);
312+
}
313+
250314
const nonExtensions = docs.filter((d) => {
251315
const [tag] = getCustomTag(d) || [];
252-
return tag !== "@extension" && tag !== "@modules";
316+
return tag !== "@extension" && tag !== "@modules" && tag !== "@bridge";
253317
});
254318

255319
// sort into groups

packages/thirdweb/src/bridge/Buy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import type { PreparedQuote, Quote } from "./types/Quote.js";
5555
* @returns A promise that resolves to a non-finalized quote for the requested buy.
5656
*
5757
* @throws Will throw an error if there is an issue fetching the quote.
58-
* @bridge
58+
* @bridge Buy
5959
* @beta
6060
*/
6161
export async function quote(options: quote.Options): Promise<quote.Result> {
@@ -188,7 +188,7 @@ export declare namespace quote {
188188
* @returns A promise that resolves to a non-finalized quote for the requested buy.
189189
*
190190
* @throws Will throw an error if there is an issue fetching the quote.
191-
* @bridge
191+
* @bridge Buy
192192
* @beta
193193
*/
194194
export async function prepare(

packages/thirdweb/src/bridge/Sell.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import type { PreparedQuote, Quote } from "./types/Quote.js";
5555
* @returns A promise that resolves to a non-finalized quote for the requested sell.
5656
*
5757
* @throws Will throw an error if there is an issue fetching the quote.
58-
* @bridge
58+
* @bridge Sell
5959
* @beta
6060
*/
6161
export async function quote(options: quote.Options): Promise<quote.Result> {
@@ -188,7 +188,7 @@ export declare namespace quote {
188188
* @returns A promise that resolves to a non-finalized quote for the requested buy.
189189
*
190190
* @throws Will throw an error if there is an issue fetching the quote.
191-
* @bridge
191+
* @bridge Sell
192192
* @beta
193193
*/
194194
export async function prepare(

packages/thirdweb/src/bridge/Status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { Status } from "./types/Status.js";
77
/**
88
* Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option.
99
*
10-
+ * The returned status will include both the origin and destination transactions and any finalized amounts for the route.
10+
* The returned status will include both the origin and destination transactions and any finalized amounts for the route.
1111
*
1212
* @example
1313
* ```typescript

0 commit comments

Comments
 (0)