@dynamic-labs-wallet/browser 0.0.61 → 0.0.63

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.js CHANGED
@@ -137,6 +137,10 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
137
137
  throw new Error('Unreachable code');
138
138
  }
139
139
  const formatEvmMessage = (message)=>{
140
+ if (typeof message === 'string' && message.startsWith('0x')) {
141
+ const serializedTxBytes = Uint8Array.from(Buffer.from(message.slice(2), 'hex'));
142
+ return web.MessageHash.keccak256(serializedTxBytes);
143
+ }
140
144
  return web.MessageHash.keccak256(message);
141
145
  };
142
146
  const formatSolanaMessage = (message)=>{
@@ -1780,6 +1784,7 @@ exports.DynamicWalletClient = DynamicWalletClient;
1780
1784
  exports.base64ToBytes = base64ToBytes;
1781
1785
  exports.bytesToBase64 = bytesToBase64;
1782
1786
  exports.ensureBase64Padding = ensureBase64Padding;
1787
+ exports.formatEvmMessage = formatEvmMessage;
1783
1788
  exports.formatMessage = formatMessage;
1784
1789
  exports.getClientKeyShareBackupInfo = getClientKeyShareBackupInfo;
1785
1790
  exports.getClientKeyShareExportFileName = getClientKeyShareExportFileName;
package/index.esm.js CHANGED
@@ -137,6 +137,10 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
137
137
  throw new Error('Unreachable code');
138
138
  }
139
139
  const formatEvmMessage = (message)=>{
140
+ if (typeof message === 'string' && message.startsWith('0x')) {
141
+ const serializedTxBytes = Uint8Array.from(Buffer.from(message.slice(2), 'hex'));
142
+ return MessageHash.keccak256(serializedTxBytes);
143
+ }
140
144
  return MessageHash.keccak256(message);
141
145
  };
142
146
  const formatSolanaMessage = (message)=>{
@@ -1728,4 +1732,4 @@ class DynamicWalletClient {
1728
1732
  }
1729
1733
  }
1730
1734
 
1731
- export { DynamicWalletClient, base64ToBytes, bytesToBase64, ensureBase64Padding, formatMessage, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes, timeoutPromise };
1735
+ export { DynamicWalletClient, base64ToBytes, bytesToBase64, ensureBase64Padding, formatEvmMessage, formatMessage, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes, timeoutPromise };
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/browser",
3
- "version": "0.0.61",
3
+ "version": "0.0.63",
4
4
  "license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
5
5
  "dependencies": {
6
- "@dynamic-labs-wallet/core": "0.0.61",
6
+ "@dynamic-labs-wallet/core": "0.0.63",
7
7
  "@dynamic-labs/logger": "^4.9.9",
8
- "@dynamic-labs/message-transport": "^4.9.9"
8
+ "@dynamic-labs/message-transport": "^4.9.9",
9
+ "@noble/hashes": "1.7.1"
9
10
  },
10
11
  "files": [
11
12
  "*",
package/src/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ThresholdSignatureScheme, KeyShareBackupInfo, WaasWalletProperties } from '@dynamic-labs-wallet/core';
2
- import { ClientKeyShare } from './mpc/types';
1
+ import { type ThresholdSignatureScheme, type KeyShareBackupInfo, type WaasWalletProperties } from '@dynamic-labs-wallet/core';
2
+ import type { ClientKeyShare } from './mpc/types';
3
3
  import { MessageHash } from '../../internal/web';
4
4
  export declare const bytesToBase64: (arr: Uint8Array) => string;
5
5
  export declare const stringToBytes: (str: string) => Uint8Array;
@@ -40,6 +40,7 @@ interface RetryConfig {
40
40
  * @throws Last error encountered after all retries are exhausted
41
41
  */
42
42
  export declare function retryPromise<T>(operation: () => Promise<T>, { maxAttempts, retryInterval, operationName, logContext, }?: RetryConfig): Promise<T>;
43
+ export declare const formatEvmMessage: (message: string | Uint8Array) => MessageHash;
43
44
  export declare const formatMessage: (chainName: string, message: string | Uint8Array) => string | Uint8Array | MessageHash;
44
45
  export {};
45
46
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,aAAa,QAAS,UAAU,WAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,eAExC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,eAE3C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAEjD,CAAC;AAEF,eAAO,MAAM,SAAS,eAAsC,CAAC;AAE7D,eAAO,MAAM,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,+BAA+B,kDAGzC;IACD,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,cAAc,EAAE,MAAM,CAAC;CACxB,WAEA,CAAC;AAEF,eAAO,MAAM,2BAA2B,YAAa;IACnD,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,kBAgCH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACZ,cAAc,EAAE,gBACrB,cAAc,EAAE,KAC7B,cAAc,EAchB,CAAC;AAEF,eAAO,MAAM,cAAc,4BAGxB;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,qBAOA,CAAC;AAEF,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CA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