@armory-sh/client-web3 0.2.23-alpha.23.73 → 0.2.23-alpha.23.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +5 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -277,11 +277,13 @@ var signPaymentV2 = async (state, network, params) => {
277
277
  const effectiveDomainVersion = state.domainVersion ?? requirementDomainVersion;
278
278
  const chainId = parseInt(defaultAccepted.network.split(":")[1], 10);
279
279
  const domain = createEIP712Domain(chainId, defaultAccepted.asset, effectiveDomainName, effectiveDomainVersion);
280
+ const nowSeconds = Math.floor(Date.now() / 1e3);
281
+ const validAfterHex = `0x${(nowSeconds - 600).toString(16)}`;
280
282
  const message = createTransferWithAuthorization({
281
283
  from,
282
284
  to,
283
285
  value: amount,
284
- validAfter: "0x0",
286
+ validAfter: validAfterHex,
285
287
  validBefore: `0x${expiry.toString(16)}`,
286
288
  nonce: `0x${nonce}`
287
289
  });
@@ -292,7 +294,7 @@ var signPaymentV2 = async (state, network, params) => {
292
294
  to,
293
295
  value: amount,
294
296
  nonce: `0x${nonce.padStart(64, "0")}`,
295
- validAfter: "0x0",
297
+ validAfter: validAfterHex,
296
298
  validBefore: `0x${expiry.toString(16)}`,
297
299
  signature: combinedSig,
298
300
  network: defaultAccepted.network,
@@ -339,7 +341,7 @@ var createX402Client = (config) => {
339
341
  to,
340
342
  amount: req.amount,
341
343
  nonce: crypto.randomUUID(),
342
- expiry: Math.floor(Date.now() / 1e3) + DEFAULT_EXPIRY_SECONDS,
344
+ expiry: Math.floor(Date.now() / 1e3) + req.maxTimeoutSeconds,
343
345
  accepted: req
344
346
  });
345
347
  const paymentHeaders = new Headers(init?.headers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armory-sh/client-web3",
3
- "version": "0.2.23-alpha.23.73",
3
+ "version": "0.2.23-alpha.23.74",
4
4
  "license": "MIT",
5
5
  "author": "Sawyer Cutler <sawyer@dirtroad.dev>",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  "directory": "packages/client-web3"
47
47
  },
48
48
  "dependencies": {
49
- "@armory-sh/base": "0.2.27-alpha.23.73",
49
+ "@armory-sh/base": "0.2.27-alpha.23.74",
50
50
  "web3": "4.16.0",
51
51
  "web3-types": "1.10.0"
52
52
  },