Skip to content

Commit 536f520

Browse files
types
1 parent da2b065 commit 536f520

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

packages/thirdweb/src/x402/common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { isPermitSupported } from "../extensions/erc20/__generated__/IERC20Permi
99
import { isTransferWithAuthorizationSupported } from "../extensions/erc20/__generated__/USDC/write/transferWithAuthorization.js";
1010
import { getAddress } from "../utils/address.js";
1111
import { decodePayment } from "./encode.js";
12-
import type { facilitator as facilitatorType } from "./facilitator.js";
12+
import type { ThirdwebX402Facilitator } from "./facilitator.js";
1313
import {
1414
networkToChainId,
1515
type RequestedPaymentPayload,
@@ -197,7 +197,7 @@ export async function decodePaymentRequest(
197197
async function processPriceToAtomicAmount(
198198
price: Money | ERC20TokenAmount,
199199
chainId: number,
200-
facilitator: ReturnType<typeof facilitatorType>,
200+
facilitator: ThirdwebX402Facilitator,
201201
): Promise<
202202
| { maxAmountRequired: string; asset: ERC20TokenAmount["asset"] }
203203
| { error: string }
@@ -237,7 +237,7 @@ async function processPriceToAtomicAmount(
237237

238238
async function getDefaultAsset(
239239
chainId: number,
240-
facilitator: ReturnType<typeof facilitatorType>,
240+
facilitator: ThirdwebX402Facilitator,
241241
): Promise<ERC20TokenAmount["asset"] | undefined> {
242242
const supportedAssets = await facilitator.supported();
243243
const matchingAsset = supportedAssets.kinds.find(

packages/thirdweb/src/x402/facilitator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export type ThirdwebX402FacilitatorConfig = {
1515
baseUrl?: string;
1616
};
1717

18+
/**
19+
* facilitator for the x402 payment protocol.
20+
* @public
21+
*/
1822
export type ThirdwebX402Facilitator = {
1923
url: `${string}://${string}`;
2024
address: string;

packages/thirdweb/src/x402/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Money, PaymentMiddlewareConfig } from "x402/types";
22
import type { Chain } from "../chains/types.js";
33
import type { Address } from "../utils/address.js";
44
import type { Prettify } from "../utils/type-utils.js";
5-
import type { facilitator as facilitatorType } from "./facilitator.js";
5+
import type { ThirdwebX402Facilitator } from "./facilitator.js";
66
import type {
77
FacilitatorNetwork,
88
FacilitatorSettleResponse,
@@ -31,7 +31,7 @@ export type PaymentArgs = {
3131
/** The price for accessing the resource - either a USD amount (e.g., "$0.10") or a specific token amount */
3232
price: Money | ERC20TokenAmount;
3333
/** The payment facilitator instance used to verify and settle payments */
34-
facilitator: ReturnType<typeof facilitatorType>;
34+
facilitator: ThirdwebX402Facilitator;
3535
/** Optional configuration for the payment middleware route */
3636
routeConfig?: PaymentMiddlewareConfig;
3737
};

0 commit comments

Comments
 (0)