@armory-sh/client-web3 0.2.22-beta.20260216.68 → 0.2.23-alpha.23.73

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 +16 -11
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Web3 } from 'web3';
2
- import { encodePaymentV2, validatePaymentConfig, isValidationError, resolveNetwork, resolveToken, V2_HEADERS, getNetworkConfig, getNetworkByChainId, combineSignatureV2, networkToCaip2, isX402V2PaymentRequired } from '@armory-sh/base';
2
+ import { encodePaymentV2, validatePaymentConfig, isValidationError, resolveNetwork, resolveToken, V2_HEADERS, getNetworkConfig, getNetworkByChainId, networkToCaip2, combineSignatureV2, isX402V2PaymentRequired } from '@armory-sh/base';
3
3
 
4
4
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
5
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -262,8 +262,21 @@ var signTypedDataWrapper = async (account, domain, message) => {
262
262
  };
263
263
  var signPaymentV2 = async (state, network, params) => {
264
264
  const { from, to, amount, nonce, expiry, accepted } = params;
265
- const { domainName, domainVersion } = state;
266
- const domain = createEIP712Domain(network.chainId, network.usdcAddress, domainName, domainVersion);
265
+ const defaultAccepted = accepted ?? {
266
+ scheme: "exact",
267
+ network: networkToCaip2(network.name),
268
+ amount,
269
+ asset: network.usdcAddress,
270
+ payTo: to,
271
+ maxTimeoutSeconds: expiry - Math.floor(Date.now() / 1e3)
272
+ };
273
+ const domainExtra = defaultAccepted.extra;
274
+ const requirementDomainName = defaultAccepted.name ?? (domainExtra && typeof domainExtra === "object" && typeof domainExtra["name"] === "string" ? domainExtra["name"] : void 0);
275
+ const requirementDomainVersion = defaultAccepted.version ?? (domainExtra && typeof domainExtra === "object" && typeof domainExtra["version"] === "string" ? domainExtra["version"] : void 0);
276
+ const effectiveDomainName = state.domainName ?? requirementDomainName;
277
+ const effectiveDomainVersion = state.domainVersion ?? requirementDomainVersion;
278
+ const chainId = parseInt(defaultAccepted.network.split(":")[1], 10);
279
+ const domain = createEIP712Domain(chainId, defaultAccepted.asset, effectiveDomainName, effectiveDomainVersion);
267
280
  const message = createTransferWithAuthorization({
268
281
  from,
269
282
  to,
@@ -274,14 +287,6 @@ var signPaymentV2 = async (state, network, params) => {
274
287
  });
275
288
  const signature = await signTypedDataWrapper(state.account, domain, message);
276
289
  const combinedSig = combineSignatureV2(signature.v, signature.r, signature.s);
277
- const defaultAccepted = accepted ?? {
278
- scheme: "exact",
279
- network: networkToCaip2(network.name),
280
- amount,
281
- asset: network.usdcAddress,
282
- payTo: to,
283
- maxTimeoutSeconds: expiry - Math.floor(Date.now() / 1e3)
284
- };
285
290
  const x402Payload = createX402V2Payment({
286
291
  from,
287
292
  to,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armory-sh/client-web3",
3
- "version": "0.2.22-beta.20260216.68",
3
+ "version": "0.2.23-alpha.23.73",
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.26-beta.20260216.68",
49
+ "@armory-sh/base": "0.2.27-alpha.23.73",
50
50
  "web3": "4.16.0",
51
51
  "web3-types": "1.10.0"
52
52
  },