From d84c7c1d5c7b3f982175299f73dd6c342303d4c6 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Mon, 27 Oct 2025 22:10:50 +0700 Subject: [PATCH 1/2] Update x402 default payment validity window Allows for systems with retries to process at their own pace, and guards against slightly descynced block.timestamp --- packages/thirdweb/src/x402/common.ts | 2 +- packages/thirdweb/src/x402/sign.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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), From 445e77e022327d682b007ab3e5f382f1f369f021 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Mon, 27 Oct 2025 22:14:52 +0700 Subject: [PATCH 2/2] Create good-ducks-eat.md --- .changeset/good-ducks-eat.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/good-ducks-eat.md 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