Skip to content

Commit abf0bba

Browse files
authored
Update x402 default payment validity window (#8317)
1 parent 23cb3bd commit abf0bba

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/good-ducks-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
updates default x402 transfer with authorization timeout

packages/thirdweb/src/x402/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export async function decodePaymentRequest(
107107
description: description ?? "",
108108
mimeType: mimeType ?? "application/json",
109109
payTo: getAddress(facilitator.address), // always pay to the facilitator address first
110-
maxTimeoutSeconds: maxTimeoutSeconds ?? 300,
110+
maxTimeoutSeconds: maxTimeoutSeconds ?? 86400,
111111
asset: getAddress(asset.address),
112112
outputSchema: {
113113
input: {

packages/thirdweb/src/x402/sign.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function preparePaymentHeader(
3232
nonce: Hex,
3333
): UnsignedPaymentPayload {
3434
const validAfter = BigInt(
35-
Math.floor(Date.now() / 1000) - 600, // 10 minutes before
35+
Math.floor(Date.now() / 1000) - 86400, // 24h before in case weird block timestamp behavior
3636
).toString();
3737
const validBefore = BigInt(
3838
Math.floor(Date.now() / 1000 + paymentRequirements.maxTimeoutSeconds),

0 commit comments

Comments
 (0)