@@ -7,25 +7,27 @@ import { token } from "../../payments/x402/components/constants";
77// Allow streaming responses up to 5 minutes
88export const maxDuration = 300 ;
99
10- const client = createThirdwebClient ( {
11- secretKey : process . env . THIRDWEB_SECRET_KEY as string ,
12- } ) ;
10+ export async function GET ( request : NextRequest ) {
11+ const SECRET_KEY = process . env . THIRDWEB_SECRET_KEY as string ;
1312
14- const BACKEND_WALLET_ADDRESS = process . env . ENGINE_BACKEND_WALLET as string ;
15- // const BACKEND_WALLET_ADDRESS = process.env.ENGINE_BACKEND_SMART_WALLET as string;
16- const ENGINE_VAULT_ACCESS_TOKEN = process . env
17- . ENGINE_VAULT_ACCESS_TOKEN as string ;
18- // const API_URL = `https://${process.env.NEXT_PUBLIC_API_URL || "api.thirdweb.com"}`;
19- const API_URL = "http://localhost:3030" ;
13+ const client = createThirdwebClient ( {
14+ secretKey : SECRET_KEY ,
15+ } ) ;
2016
21- const twFacilitator = facilitator ( {
22- baseUrl : `${ API_URL } /v1/payments/x402` ,
23- client,
24- serverWalletAddress : BACKEND_WALLET_ADDRESS ,
25- vaultAccessToken : ENGINE_VAULT_ACCESS_TOKEN ,
26- } ) ;
17+ const BACKEND_WALLET_ADDRESS = process . env . ENGINE_BACKEND_WALLET as string ;
18+ // const BACKEND_WALLET_ADDRESS = process.env.ENGINE_BACKEND_SMART_WALLET as string;
19+ const ENGINE_VAULT_ACCESS_TOKEN = process . env
20+ . ENGINE_VAULT_ACCESS_TOKEN as string ;
21+ // const API_URL = `https://${process.env.NEXT_PUBLIC_API_URL || "api.thirdweb.com"}`;
22+ const API_URL = "http://localhost:3030" ;
23+
24+ const twFacilitator = facilitator ( {
25+ baseUrl : `${ API_URL } /v1/payments/x402` ,
26+ client,
27+ serverWalletAddress : BACKEND_WALLET_ADDRESS ,
28+ vaultAccessToken : ENGINE_VAULT_ACCESS_TOKEN ,
29+ } ) ;
2730
28- export async function GET ( request : NextRequest ) {
2931 const paymentData = request . headers . get ( "X-PAYMENT" ) ;
3032 const queryParams = request . nextUrl . searchParams ;
3133
0 commit comments