Skip to content

Commit 38f79b7

Browse files
committed
docs: add bridge submodules
1 parent 9b90a28 commit 38f79b7

File tree

7 files changed

+80
-11
lines changed

7 files changed

+80
-11
lines changed

apps/portal/src/app/connect/pay/guides/build-a-custom-experience/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ In this guide, we'll show you how to purchase 0.01 Base ETH from USD in Typescri
3636
<Step title='Install the Connect SDK'>
3737
<InstallTabs
3838
npm="npm i thirdweb"
39-
yarn="yarn install thirdweb"
39+
yarn="yarn add thirdweb"
4040
pnpm="pnpm i thirdweb"
4141
/>
4242
<Step title='Get Your Client ID'>

apps/portal/src/app/connect/pay/guides/cross-chain-swapping/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In this guide, we'll show you how to purchase 10 USDC on Optimism in Typescript.
3030
<Step title='Install the Connect SDK'>
3131
<InstallTabs
3232
npm="npm i thirdweb"
33-
yarn="yarn install thirdweb"
33+
yarn="yarn add thirdweb"
3434
pnpm="pnpm i thirdweb"
3535
/>
3636
<Step title='Get Your Client ID'>
@@ -79,7 +79,7 @@ In this example, we'll use the `Buy.quote` function to get a quote for buying 10
7979
<Callout variant="info">
8080
The `Buy` namespace is purpose-built for when you want to obtain a specific amount of the output token.
8181
If you have a specific input amount and are flexible on the output amount, you can use the `Sell` namespace.
82-
Learn more about sells [here](
82+
Learn more about sells [here](https://portal.thirdweb.com/references/typescript/v5/sell/prepare).
8383
</Callout>
8484

8585
Quote allows us to get an expected amount before the user has connected their wallet. This quote won't come with executable transactions, and won't be a guaranteed price.

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

Lines changed: 64 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,67 @@ 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+
}
312+
250313
const nonExtensions = docs.filter((d) => {
251314
const [tag] = getCustomTag(d) || [];
252-
return tag !== "@extension" && tag !== "@modules";
315+
return tag !== "@extension" && tag !== "@modules" && tag !== "@bridge";
253316
});
254317

255318
// sort into groups

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ export function getSlugToDocMap(doc: TransformedDoc) {
3636
const extensionBlockTag = v.signatures
3737
?.find((s) =>
3838
s.blockTags?.some(
39-
(tag) => tag.tag === "@extension" || tag.tag === "@modules",
39+
(tag) =>
40+
tag.tag === "@extension" ||
41+
tag.tag === "@modules" ||
42+
tag.tag === "@bridge",
4043
),
4144
)
4245
?.blockTags?.find(
43-
(tag) => tag.tag === "@extension" || tag.tag === "@modules",
46+
(tag) =>
47+
tag.tag === "@extension" ||
48+
tag.tag === "@modules" ||
49+
tag.tag === "@bridge",
4450
);
4551

4652
if (extensionBlockTag) {

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)