Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/portal/src/components/Document/AuthMethodsTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ function AuthMethodsTabsContent() {
>
<img
alt={method.label}
className="size-5 flex-shrink-0"
className="size-5 shrink-0"
src={getSocialIcon(method.id)}
/>
<div className="min-w-0 flex-1">
Expand Down
50 changes: 50 additions & 0 deletions packages/thirdweb/src/bridge/Buy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,47 @@ export async function quote(options: quote.Options): Promise<quote.Result> {
};
}

/**
* Namespace containing types for the buy quote function.
* @namespace quote
* @bridge Buy
*/
export declare namespace quote {
/**
* Options for getting a buy quote.
* @interface Options
* @bridge Buy
*/
type Options = {
/** The origin chain ID */
originChainId: number;
/** The origin token address */
originTokenAddress: ox__Address.Address;
/** The destination chain ID */
destinationChainId: number;
/** The destination token address */
destinationTokenAddress: ox__Address.Address;
/** Your thirdweb client */
client: ThirdwebClient;
/** Maximum number of steps in the route */
maxSteps?: number;
} & (
| {
/** The amount to buy in wei */
buyAmountWei: bigint;
}
| {
/** The amount to spend in wei */
amount: bigint;
}
);

/**
* Result returned from getting a buy quote.
* Contains quote details and intent information.
* @interface Result
* @bridge Buy
*/
type Result = Quote & {
intent: {
originChainId: number;
Expand Down Expand Up @@ -404,24 +428,50 @@ export async function prepare(
};
}

/**
* Namespace containing types for the buy prepare function.
* @namespace prepare
* @bridge Buy
*/
export declare namespace prepare {
/**
* Options for preparing a buy transaction.
* @interface Options
* @bridge Buy
*/
type Options = {
/** The origin chain ID */
originChainId: number;
/** The origin token address */
originTokenAddress: ox__Address.Address;
/** The destination chain ID */
destinationChainId: number;
/** The destination token address */
destinationTokenAddress: ox__Address.Address;
/** The sender address */
sender: ox__Address.Address;
/** The receiver address */
receiver: ox__Address.Address;
/** The amount to buy in wei */
amount: bigint;
/** Your thirdweb client */
client: ThirdwebClient;
/** Arbitrary purchase data */
purchaseData?: PurchaseData;
/** Maximum number of steps in the route */
maxSteps?: number;
/**
* @hidden
*/
paymentLinkId?: string;
};

/**
* Result returned from preparing a buy transaction.
* Contains prepared quote with transaction data and intent information.
* @interface Result
* @bridge Buy
*/
type Result = PreparedQuote & {
intent: {
originChainId: number;
Expand Down
17 changes: 17 additions & 0 deletions packages/thirdweb/src/bridge/Chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,27 @@ export async function chains(options: chains.Options): Promise<chains.Result> {
);
}

/**
* Namespace containing types for the chains function.
* @namespace chains
* @bridge
*/
export declare namespace chains {
/**
* Options for fetching supported bridge chains.
* @interface Options
* @bridge
*/
type Options = {
/** Your thirdweb client */
client: ThirdwebClient;
};

/**
* Result returned from fetching supported bridge chains.
* Contains an array of supported chains.
* @interface Result
* @bridge
*/
type Result = Chain[];
}
30 changes: 30 additions & 0 deletions packages/thirdweb/src/bridge/Onramp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,27 +258,57 @@ export async function prepare(
};
}

/**
* Namespace containing types for the onramp prepare function.
* @namespace prepare
* @bridge Onramp
*/
export declare namespace prepare {
/**
* Options for preparing an onramp transaction.
* @interface Options
* @bridge Onramp
*/
export type Options = {
/** Your thirdweb client */
client: ThirdwebClient;
/** The onramp provider to use (e.g., "stripe", "coinbase", "transak") */
onramp: "stripe" | "coinbase" | "transak";
/** The destination chain ID */
chainId: number;
/** The destination token address */
tokenAddress: ox__Address.Address;
/** The address that will receive the output token */
receiver: ox__Address.Address;
/** The desired token amount in wei */
amount?: bigint;
/** Arbitrary purchase data */
purchaseData?: PurchaseData;
/** An optional address to associate as the onramp sender */
sender?: ox__Address.Address;
/** The token to initially onramp to if the destination token is not supported by the provider */
onrampTokenAddress?: ox__Address.Address;
/** The chain ID to initially onramp to if the destination chain is not supported */
onrampChainId?: number;
/** The currency for the onramp (e.g., "USD", "GBP"). Defaults to user's preferred or "USD" */
currency?: string;
/** Maximum number of post-onramp steps */
maxSteps?: number;
/** Chain IDs to exclude from the route (string or array of strings) */
excludeChainIds?: string | string[];
/** 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) */
country?: string;
/**
* @hidden
*/
paymentLinkId?: string;
};

/**
* Result returned from preparing an onramp transaction.
* Contains the onramp link, quote information, and routing steps.
* @interface Result
* @bridge Onramp
*/
export type Result = OnrampPrepareQuoteResponseData;
}
27 changes: 27 additions & 0 deletions packages/thirdweb/src/bridge/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,47 @@ export async function routes(options: routes.Options): Promise<routes.Result> {
return data;
}

/**
* Namespace containing types for the routes function.
* @namespace routes
* @bridge
*/
export declare namespace routes {
/**
* Options for fetching available bridge routes.
* @interface Options
* @bridge
*/
type Options = {
/** Your thirdweb client */
client: ThirdwebClient;
/** The origin chain ID to filter routes by */
originChainId?: number;
/** The origin token address to filter routes by */
originTokenAddress?: ox__Address.Address;
/** The destination chain ID to filter routes by */
destinationChainId?: number;
/** The destination token address to filter routes by */
destinationTokenAddress?: ox__Address.Address;
/** Transaction hash to filter routes by */
transactionHash?: ox__Hex.Hex;
/** Sort routes by popularity */
sortBy?: "popularity";
/** Maximum number of steps in the route */
maxSteps?: number;
/** Whether to include price information in the response */
includePrices?: boolean;
/** Number of results to return (pagination) */
limit?: number;
/** Number of results to skip (pagination) */
offset?: number;
};

/**
* Result returned from fetching bridge routes.
* Contains an array of available routes.
* @interface Result
* @bridge
*/
type Result = Route[];
}
49 changes: 49 additions & 0 deletions packages/thirdweb/src/bridge/Sell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,40 @@ export async function quote(options: quote.Options): Promise<quote.Result> {
};
}

/**
* Namespace containing types for the sell quote function.
* @namespace quote
* @bridge Sell
*/
export declare namespace quote {
/**
* Options for getting a sell quote.
* @interface Options
* @bridge Sell
*/
type Options = {
/** The origin chain ID */
originChainId: number;
/** The origin token address */
originTokenAddress: ox__Address.Address;
/** The destination chain ID */
destinationChainId: number;
/** The destination token address */
destinationTokenAddress: ox__Address.Address;
/** The amount to sell in wei */
amount: bigint;
/** Your thirdweb client */
client: ThirdwebClient;
/** Maximum number of steps in the route */
maxSteps?: number;
};

/**
* Result returned from getting a sell quote.
* Contains quote details and intent information.
* @interface Result
* @bridge Sell
*/
type Result = Quote & {
intent: {
originChainId: number;
Expand Down Expand Up @@ -393,24 +416,50 @@ export async function prepare(
};
}

/**
* Namespace containing types for the sell prepare function.
* @namespace prepare
* @bridge Sell
*/
export declare namespace prepare {
/**
* Options for preparing a sell transaction.
* @interface Options
* @bridge Sell
*/
type Options = {
/** The origin chain ID */
originChainId: number;
/** The origin token address */
originTokenAddress: ox__Address.Address;
/** The destination chain ID */
destinationChainId: number;
/** The destination token address */
destinationTokenAddress: ox__Address.Address;
/** The amount to sell in wei */
amount: bigint;
/** The sender address */
sender: ox__Address.Address;
/** The receiver address */
receiver: ox__Address.Address;
/** Your thirdweb client */
client: ThirdwebClient;
/** Arbitrary purchase data */
purchaseData?: PurchaseData;
/** Maximum number of steps in the route */
maxSteps?: number;
/**
* @hidden
*/
paymentLinkId?: string;
};

/**
* Result returned from preparing a sell transaction.
* Contains prepared quote with transaction data and intent information.
* @interface Result
* @bridge Sell
*/
type Result = PreparedQuote & {
intent: {
originChainId: number;
Expand Down
23 changes: 23 additions & 0 deletions packages/thirdweb/src/bridge/Status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,41 @@ export async function status(options: status.Options): Promise<status.Result> {
};
}

/**
* Namespace containing types for the status function.
* @namespace status
* @bridge
*/
export declare namespace status {
/**
* Options for checking transaction status.
* Can specify either chainId or chain object.
* @interface Options
* @bridge
*/
type Options =
| {
/** The transaction hash to check status for */
transactionHash: ox__Hex.Hex;
/** The chain ID where the transaction occurred */
chainId: number;
/** Your thirdweb client */
client: ThirdwebClient;
}
| {
/** The transaction hash to check status for */
transactionHash: ox__Hex.Hex;
/** The chain object where the transaction occurred */
chain: Chain;
/** Your thirdweb client */
client: ThirdwebClient;
};

/**
* Result returned from checking transaction status.
* Contains the current status and transaction details.
* @interface Result
* @bridge
*/
type Result = Status;
}
Loading
Loading