diff --git a/src/acpX402.ts b/src/acpX402.ts index 70e2fa3..af62a13 100644 --- a/src/acpX402.ts +++ b/src/acpX402.ts @@ -23,7 +23,7 @@ export class AcpX402 { constructor( private config: AcpContractConfig, private sessionKeyClient: ModularAccountV2Client, - private publicClient: ReturnType, + private publicClient: ReturnType ) { this.config = config; this.sessionKeyClient = sessionKeyClient; @@ -32,7 +32,7 @@ export class AcpX402 { async signUpdateJobNonceMessage( jobId: number, - nonce: string, + nonce: string ): Promise<`0x${string}`> { const message = `${jobId}-${nonce}`; const signature = await this.sessionKeyClient.account @@ -63,7 +63,7 @@ export class AcpX402 { if (!response.ok) { throw new AcpError( "Failed to update job X402 nonce", - response.statusText, + response.statusText ); } @@ -80,12 +80,12 @@ export class AcpX402 { async generatePayment( payableRequest: X402PayableRequest, - requirements: X402PayableRequirements, + requirements: X402PayableRequirements ): Promise { try { const USDC_CONTRACT = this.config.baseFare.contractAddress; const timeNow = Math.floor(Date.now() / 1000); - const validAfter = timeNow.toString(); + const validAfter = (timeNow - 60).toString(); // buffer for clock skew const validBefore = ( timeNow + requirements.accepts[0].maxTimeoutSeconds ).toString(); @@ -160,7 +160,7 @@ export class AcpX402 { url: string, version: string, budget?: string, - signature?: string, + signature?: string ) { const baseUrl = this.config.x402Config?.url; if (!baseUrl) throw new AcpError("X402 URL not configured"); @@ -179,7 +179,7 @@ export class AcpX402 { if (!res.ok && res.status !== HTTP_STATUS_CODES.PAYMENT_REQUIRED) { throw new AcpError( "Invalid response status code for X402 request", - data, + data ); }