@dynamic-labs-wallet/evm 0.0.48 → 0.0.49

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
@@ -69,8 +69,10 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
69
69
  // Update client key shares in wallet map
70
70
  // warning: this might result in race condition if `onCeremonyComplete` executes at the same time
71
71
  // TODO: remove this once iframe handling for secret shares is implemented
72
- this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
73
- clientKeyShares
72
+ await this.setClientKeySharesToLocalStorage({
73
+ accountAddress,
74
+ clientKeyShares,
75
+ overwriteOrMerge: 'overwrite'
74
76
  });
75
77
  // Backup the new wallet without waiting for the promise to resolve
76
78
  void this.storeEncryptedBackupByWalletWithRetry({
@@ -174,7 +176,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
174
176
  throw error;
175
177
  }
176
178
  }
177
- async deriveAccountAddress({ rawPublicKey }) {
179
+ deriveAccountAddress({ rawPublicKey }) {
178
180
  const serializedUncompressed = rawPublicKey.serializeUncompressed();
179
181
  const firstByteRemoved = serializedUncompressed.slice(1);
180
182
  const hashed = browser.MessageHash.keccak256(firstByteRemoved).bytes;
@@ -186,7 +188,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
186
188
  publicKeyHex
187
189
  };
188
190
  }
189
- async exportPrivateKey({ accountAddress, password = undefined }) {
191
+ async exportPrivateKey({ accountAddress, displayContainer, password = undefined }) {
190
192
  await this.verifyPassword({
191
193
  accountAddress,
192
194
  password,
@@ -194,9 +196,16 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
194
196
  });
195
197
  const { derivedPrivateKey } = await this.exportKey({
196
198
  accountAddress,
199
+ displayContainer,
197
200
  chainName: this.chainName,
198
201
  password
199
202
  });
203
+ if (this.useIframeStorage) {
204
+ const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
205
+ container: displayContainer
206
+ });
207
+ iframeDisplay.displayPrivateKey(accountAddress, derivedPrivateKey);
208
+ }
200
209
  return {
201
210
  derivedPrivateKey
202
211
  };
@@ -239,8 +248,10 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
239
248
  // Update client key shares in wallet map
240
249
  // warning: this might result in race condition if `onCeremonyComplete` executes at the same time
241
250
  // TODO: remove this once iframe handling for secret shares is implemented
242
- this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
243
- clientKeyShares
251
+ await this.setClientKeySharesToLocalStorage({
252
+ accountAddress,
253
+ clientKeyShares,
254
+ overwriteOrMerge: 'overwrite'
244
255
  });
245
256
  // Backup the new wallet without waiting for the promise to resolve
246
257
  void this.storeEncryptedBackupByWalletWithRetry({
package/index.esm.js CHANGED
@@ -67,8 +67,10 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
67
67
  // Update client key shares in wallet map
68
68
  // warning: this might result in race condition if `onCeremonyComplete` executes at the same time
69
69
  // TODO: remove this once iframe handling for secret shares is implemented
70
- this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
71
- clientKeyShares
70
+ await this.setClientKeySharesToLocalStorage({
71
+ accountAddress,
72
+ clientKeyShares,
73
+ overwriteOrMerge: 'overwrite'
72
74
  });
73
75
  // Backup the new wallet without waiting for the promise to resolve
74
76
  void this.storeEncryptedBackupByWalletWithRetry({
@@ -172,7 +174,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
172
174
  throw error;
173
175
  }
174
176
  }
175
- async deriveAccountAddress({ rawPublicKey }) {
177
+ deriveAccountAddress({ rawPublicKey }) {
176
178
  const serializedUncompressed = rawPublicKey.serializeUncompressed();
177
179
  const firstByteRemoved = serializedUncompressed.slice(1);
178
180
  const hashed = MessageHash.keccak256(firstByteRemoved).bytes;
@@ -184,7 +186,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
184
186
  publicKeyHex
185
187
  };
186
188
  }
187
- async exportPrivateKey({ accountAddress, password = undefined }) {
189
+ async exportPrivateKey({ accountAddress, displayContainer, password = undefined }) {
188
190
  await this.verifyPassword({
189
191
  accountAddress,
190
192
  password,
@@ -192,9 +194,16 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
192
194
  });
193
195
  const { derivedPrivateKey } = await this.exportKey({
194
196
  accountAddress,
197
+ displayContainer,
195
198
  chainName: this.chainName,
196
199
  password
197
200
  });
201
+ if (this.useIframeStorage) {
202
+ const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
203
+ container: displayContainer
204
+ });
205
+ iframeDisplay.displayPrivateKey(accountAddress, derivedPrivateKey);
206
+ }
198
207
  return {
199
208
  derivedPrivateKey
200
209
  };
@@ -237,8 +246,10 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
237
246
  // Update client key shares in wallet map
238
247
  // warning: this might result in race condition if `onCeremonyComplete` executes at the same time
239
248
  // TODO: remove this once iframe handling for secret shares is implemented
240
- this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
241
- clientKeyShares
249
+ await this.setClientKeySharesToLocalStorage({
250
+ accountAddress,
251
+ clientKeyShares,
252
+ overwriteOrMerge: 'overwrite'
242
253
  });
243
254
  // Backup the new wallet without waiting for the promise to resolve
244
255
  void this.storeEncryptedBackupByWalletWithRetry({
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/evm",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@dynamic-labs-wallet/browser": "0.0.48"
6
+ "@dynamic-labs-wallet/browser": "0.0.49"
7
7
  },
8
8
  "peerDependencies": {
9
9
  "viem": "^2.22.1"
@@ -32,14 +32,15 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
32
32
  transaction: TransactionSerializable;
33
33
  password?: string;
34
34
  }): Promise<string>;
35
- deriveAccountAddress({ rawPublicKey, }: {
35
+ deriveAccountAddress({ rawPublicKey }: {
36
36
  rawPublicKey: EcdsaPublicKey;
37
- }): Promise<{
37
+ }): {
38
38
  accountAddress: `0x${string}`;
39
39
  publicKeyHex: any;
40
- }>;
41
- exportPrivateKey({ accountAddress, password, }: {
40
+ };
41
+ exportPrivateKey({ accountAddress, displayContainer, password, }: {
42
42
  accountAddress: string;
43
+ displayContainer: HTMLElement;
43
44
  password?: string;
44
45
  }): Promise<{
45
46
  derivedPrivateKey: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EAEd,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EAIzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,KAAK,EAEV,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE7B,MAAM,MAAM,CAAC;AAWd,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;gBAEf,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,KAAK,GACN,EAAE,wBAAwB;IAW3B,sBAAsB,CAAC,EACrB,KAAK,EACL,MAAM,GACP,EAAE;QACD,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,YAAY;IAOV,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,GACR,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAClC,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,cAAc,GAAG,UAAU,GAAG,SAAS,CAAC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