diff --git a/.changeset/good-ducks-eat.md b/.changeset/good-ducks-eat.md new file mode 100644 index 00000000000..30ae2ea6cd6 --- /dev/null +++ b/.changeset/good-ducks-eat.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +updates default x402 transfer with authorization timeout diff --git a/packages/thirdweb/src/x402/common.ts b/packages/thirdweb/src/x402/common.ts index 00b3adc3906..8e2464aee1e 100644 --- a/packages/thirdweb/src/x402/common.ts +++ b/packages/thirdweb/src/x402/common.ts @@ -107,7 +107,7 @@ export async function decodePaymentRequest( description: description ?? "", mimeType: mimeType ?? "application/json", payTo: getAddress(facilitator.address), // always pay to the facilitator address first - maxTimeoutSeconds: maxTimeoutSeconds ?? 300, + maxTimeoutSeconds: maxTimeoutSeconds ?? 86400, asset: getAddress(asset.address), outputSchema: { input: { diff --git a/packages/thirdweb/src/x402/sign.ts b/packages/thirdweb/src/x402/sign.ts index 360b4bc1958..102fc962959 100644 --- a/packages/thirdweb/src/x402/sign.ts +++ b/packages/thirdweb/src/x402/sign.ts @@ -32,7 +32,7 @@ function preparePaymentHeader( nonce: Hex, ): UnsignedPaymentPayload { const validAfter = BigInt( - Math.floor(Date.now() / 1000) - 600, // 10 minutes before + Math.floor(Date.now() / 1000) - 86400, // 24h before in case weird block timestamp behavior ).toString(); const validBefore = BigInt( Math.floor(Date.now() / 1000 + paymentRequirements.maxTimeoutSeconds),