@dynamic-labs-wallet/browser-wallet-client 1.1.22 → 1.1.24

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.
package/index.cjs CHANGED
@@ -2275,7 +2275,7 @@ const limitKeys = [
2275
2275
  const assertMatches = (matches, message)=>{
2276
2276
  if (!matches) throw new Error(message);
2277
2277
  };
2278
- const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPayload, preparedTransaction })=>{
2278
+ const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPayload })=>{
2279
2279
  const sameAddress = request.chainName === 'EVM' ? intent.accountAddress.toLowerCase() === request.accountAddress.toLowerCase() : intent.accountAddress === request.accountAddress;
2280
2280
  assertMatches(Object.values(core.WaasChainEnum).includes(request.chainName) && intent.actionType === 'waasSigningQuorumApprove' && Boolean(intent.intentId) && Number.isFinite(Date.parse(intent.createdAt)) && sameAddress && intent.businessAccountId === request.businessAccountId && intent.initiatorUserId === request.initiatorUserId && intent.completeBy === request.completeBy && intent.operation.chainName === request.chainName && intent.operation.kind === request.kind, 'Prepared signing intent does not match request');
2281
2281
  if (intent.operation.kind === 'transaction') {
@@ -2283,15 +2283,15 @@ const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPa
2283
2283
  throw new Error('Unsupported transaction signing intent');
2284
2284
  }
2285
2285
  const { operation, limits } = intent;
2286
- if (!limits || !preparedTransaction) throw new Error('Prepared transaction signing intent is malformed');
2286
+ if (!limits) throw new Error('Prepared transaction signing intent is malformed');
2287
2287
  assertMatches(operation.from === intent.accountAddress.toLowerCase(), 'Transaction signer does not match request');
2288
2288
  assertMatches(!request.chainId || operation.chainId === request.chainId, 'Transaction chain does not match request');
2289
2289
  assertMatches(!request.refreshLimits || limitKeys.every((key)=>{
2290
2290
  var _request_refreshLimits;
2291
2291
  return limits[key] === ((_request_refreshLimits = request.refreshLimits) == null ? void 0 : _request_refreshLimits[key]);
2292
2292
  }), 'Transaction signing limits do not match request');
2293
- const expectedOperation = preparedTransaction.operation;
2294
- assertMatches(operation.chainId === expectedOperation.chainId && operation.from === expectedOperation.from && operation.to === expectedOperation.to && operation.value === expectedOperation.value && operation.data === expectedOperation.data && operation.nonce === expectedOperation.nonce && limitKeys.every((key)=>limits[key] === preparedTransaction.limits[key]), 'Prepared transaction signing intent does not match request');
2293
+ // Wallet-service parses the transaction it signs and rejects any mismatch with
2294
+ // the approved operation, so the transaction fields are not re-derived here.
2295
2295
  return;
2296
2296
  }
2297
2297
  const { operation } = intent;
@@ -2305,6 +2305,10 @@ const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPa
2305
2305
  assertMatches(request.kind === 'typedData' && request.chainName === 'EVM' && Boolean(request.typedData) && operation.typedData === request.typedData, 'Prepared signing intent typed data does not match request');
2306
2306
  return;
2307
2307
  }
2308
+ if (operation.kind === 'eip7702Auth') {
2309
+ assertMatches(request.kind === 'eip7702Auth' && request.chainName === 'EVM' && operation.eip7702Auth.address === request.eip7702Auth.address && operation.eip7702Auth.chainId === request.eip7702Auth.chainId && operation.eip7702Auth.nonce === request.eip7702Auth.nonce, 'Prepared EIP-7702 authorization does not match request');
2310
+ return;
2311
+ }
2308
2312
  const rawSign = operation.rawSign;
2309
2313
  assertMatches(request.kind === 'raw' && (rawSign == null ? void 0 : rawSign.payload) === request.rawSign.payload && rawSign.hashFunction === request.rawSign.hashFunction && rawSign.prefix === request.rawSign.prefix, 'Prepared raw signing intent does not match request');
2310
2314
  };
package/index.esm.js CHANGED
@@ -2274,7 +2274,7 @@ const limitKeys = [
2274
2274
  const assertMatches = (matches, message)=>{
2275
2275
  if (!matches) throw new Error(message);
2276
2276
  };
2277
- const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPayload, preparedTransaction })=>{
2277
+ const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPayload })=>{
2278
2278
  const sameAddress = request.chainName === 'EVM' ? intent.accountAddress.toLowerCase() === request.accountAddress.toLowerCase() : intent.accountAddress === request.accountAddress;
2279
2279
  assertMatches(Object.values(WaasChainEnum).includes(request.chainName) && intent.actionType === 'waasSigningQuorumApprove' && Boolean(intent.intentId) && Number.isFinite(Date.parse(intent.createdAt)) && sameAddress && intent.businessAccountId === request.businessAccountId && intent.initiatorUserId === request.initiatorUserId && intent.completeBy === request.completeBy && intent.operation.chainName === request.chainName && intent.operation.kind === request.kind, 'Prepared signing intent does not match request');
2280
2280
  if (intent.operation.kind === 'transaction') {
@@ -2282,15 +2282,15 @@ const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPa
2282
2282
  throw new Error('Unsupported transaction signing intent');
2283
2283
  }
2284
2284
  const { operation, limits } = intent;
2285
- if (!limits || !preparedTransaction) throw new Error('Prepared transaction signing intent is malformed');
2285
+ if (!limits) throw new Error('Prepared transaction signing intent is malformed');
2286
2286
  assertMatches(operation.from === intent.accountAddress.toLowerCase(), 'Transaction signer does not match request');
2287
2287
  assertMatches(!request.chainId || operation.chainId === request.chainId, 'Transaction chain does not match request');
2288
2288
  assertMatches(!request.refreshLimits || limitKeys.every((key)=>{
2289
2289
  var _request_refreshLimits;
2290
2290
  return limits[key] === ((_request_refreshLimits = request.refreshLimits) == null ? void 0 : _request_refreshLimits[key]);
2291
2291
  }), 'Transaction signing limits do not match request');
2292
- const expectedOperation = preparedTransaction.operation;
2293
- assertMatches(operation.chainId === expectedOperation.chainId && operation.from === expectedOperation.from && operation.to === expectedOperation.to && operation.value === expectedOperation.value && operation.data === expectedOperation.data && operation.nonce === expectedOperation.nonce && limitKeys.every((key)=>limits[key] === preparedTransaction.limits[key]), 'Prepared transaction signing intent does not match request');
2292
+ // Wallet-service parses the transaction it signs and rejects any mismatch with
2293
+ // the approved operation, so the transaction fields are not re-derived here.
2294
2294
  return;
2295
2295
  }
2296
2296
  const { operation } = intent;
@@ -2304,6 +2304,10 @@ const assertPreparedSigningIntentMatchesRequest = ({ intent, request, preparedPa
2304
2304
  assertMatches(request.kind === 'typedData' && request.chainName === 'EVM' && Boolean(request.typedData) && operation.typedData === request.typedData, 'Prepared signing intent typed data does not match request');
2305
2305
  return;
2306
2306
  }
2307
+ if (operation.kind === 'eip7702Auth') {
2308
+ assertMatches(request.kind === 'eip7702Auth' && request.chainName === 'EVM' && operation.eip7702Auth.address === request.eip7702Auth.address && operation.eip7702Auth.chainId === request.eip7702Auth.chainId && operation.eip7702Auth.nonce === request.eip7702Auth.nonce, 'Prepared EIP-7702 authorization does not match request');
2309
+ return;
2310
+ }
2307
2311
  const rawSign = operation.rawSign;
2308
2312
  assertMatches(request.kind === 'raw' && (rawSign == null ? void 0 : rawSign.payload) === request.rawSign.payload && rawSign.hashFunction === request.rawSign.hashFunction && rawSign.prefix === request.rawSign.prefix, 'Prepared raw signing intent does not match request');
2309
2313
  };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/browser-wallet-client",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/core": "1.1.22",
7
+ "@dynamic-labs-wallet/core": "1.1.24",
8
8
  "@dynamic-labs/logger": "^5.0.0",
9
9
  "@dynamic-labs/message-transport": "^5.0.0"
10
10
  },
@@ -1,8 +1,7 @@
1
- import { type PreparedTransactionSigningIntent, type PrepareSigningIntentRequest, type SigningIntent } from '@dynamic-labs-wallet/core';
2
- export declare const assertPreparedSigningIntentMatchesRequest: ({ intent, request, preparedPayload, preparedTransaction, }: {
1
+ import { type PrepareSigningIntentRequest, type SigningIntent } from '@dynamic-labs-wallet/core';
2
+ export declare const assertPreparedSigningIntentMatchesRequest: ({ intent, request, preparedPayload, }: {
3
3
  intent: SigningIntent;
4
4
  request: PrepareSigningIntentRequest;
5
5
  preparedPayload?: string;
6
- preparedTransaction?: PreparedTransactionSigningIntent;
7
6
  }) => void;
8
7
  //# sourceMappingURL=assertPreparedSigningIntentMatchesRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertPreparedSigningIntentMatchesRequest.d.ts","sourceRoot":"","sources":["../../packages/src/assertPreparedSigningIntentMatchesRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,2BAA2B,EAChC,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AAQnC,eAAO,MAAM,yCAAyC,+DAKnD;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,2BAA2B,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,gCAAgC,CAAC;CACxD,KAAG,IA+EH,CAAC"}
1
+ {"version":3,"file":"assertPreparedSigningIntentMatchesRequest.d.ts","sourceRoot":"","sources":["../../packages/src/assertPreparedSigningIntentMatchesRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,2BAA2B,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAQhH,eAAO,MAAM,yCAAyC,0CAInD;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,2BAA2B,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,KAAG,IAiFH,CAAC"}