@dynamic-labs-wallet/evm 0.0.47 → 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 +23 -10
- package/index.esm.js +24 -11
- package/package.json +2 -2
- package/src/client/client.d.ts +5 -4
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -50,8 +50,9 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
50
50
|
onError,
|
|
51
51
|
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
52
52
|
// update wallet map
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const checksumAddress = viem.getAddress(accountAddress);
|
|
54
|
+
this.walletMap[checksumAddress] = _extends({}, this.walletMap[checksumAddress] || {}, {
|
|
55
|
+
accountAddress: checksumAddress,
|
|
55
56
|
walletId,
|
|
56
57
|
chainName: this.chainName,
|
|
57
58
|
thresholdSignatureScheme,
|
|
@@ -68,8 +69,10 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
68
69
|
// Update client key shares in wallet map
|
|
69
70
|
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
70
71
|
// TODO: remove this once iframe handling for secret shares is implemented
|
|
71
|
-
this.
|
|
72
|
-
|
|
72
|
+
await this.setClientKeySharesToLocalStorage({
|
|
73
|
+
accountAddress,
|
|
74
|
+
clientKeyShares,
|
|
75
|
+
overwriteOrMerge: 'overwrite'
|
|
73
76
|
});
|
|
74
77
|
// Backup the new wallet without waiting for the promise to resolve
|
|
75
78
|
void this.storeEncryptedBackupByWalletWithRetry({
|
|
@@ -173,7 +176,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
173
176
|
throw error;
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
|
-
|
|
179
|
+
deriveAccountAddress({ rawPublicKey }) {
|
|
177
180
|
const serializedUncompressed = rawPublicKey.serializeUncompressed();
|
|
178
181
|
const firstByteRemoved = serializedUncompressed.slice(1);
|
|
179
182
|
const hashed = browser.MessageHash.keccak256(firstByteRemoved).bytes;
|
|
@@ -185,7 +188,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
185
188
|
publicKeyHex
|
|
186
189
|
};
|
|
187
190
|
}
|
|
188
|
-
async exportPrivateKey({ accountAddress, password = undefined }) {
|
|
191
|
+
async exportPrivateKey({ accountAddress, displayContainer, password = undefined }) {
|
|
189
192
|
await this.verifyPassword({
|
|
190
193
|
accountAddress,
|
|
191
194
|
password,
|
|
@@ -193,9 +196,16 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
193
196
|
});
|
|
194
197
|
const { derivedPrivateKey } = await this.exportKey({
|
|
195
198
|
accountAddress,
|
|
199
|
+
displayContainer,
|
|
196
200
|
chainName: this.chainName,
|
|
197
201
|
password
|
|
198
202
|
});
|
|
203
|
+
if (this.useIframeStorage) {
|
|
204
|
+
const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
|
|
205
|
+
container: displayContainer
|
|
206
|
+
});
|
|
207
|
+
iframeDisplay.displayPrivateKey(accountAddress, derivedPrivateKey);
|
|
208
|
+
}
|
|
199
209
|
return {
|
|
200
210
|
derivedPrivateKey
|
|
201
211
|
};
|
|
@@ -219,8 +229,9 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
219
229
|
onError,
|
|
220
230
|
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
221
231
|
// update wallet map
|
|
222
|
-
|
|
223
|
-
|
|
232
|
+
const checksumAddress = viem.getAddress(accountAddress);
|
|
233
|
+
this.walletMap[checksumAddress] = _extends({}, this.walletMap[checksumAddress] || {}, {
|
|
234
|
+
accountAddress: checksumAddress,
|
|
224
235
|
walletId,
|
|
225
236
|
chainName: this.chainName,
|
|
226
237
|
thresholdSignatureScheme,
|
|
@@ -237,8 +248,10 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
237
248
|
// Update client key shares in wallet map
|
|
238
249
|
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
239
250
|
// TODO: remove this once iframe handling for secret shares is implemented
|
|
240
|
-
this.
|
|
241
|
-
|
|
251
|
+
await this.setClientKeySharesToLocalStorage({
|
|
252
|
+
accountAddress,
|
|
253
|
+
clientKeyShares,
|
|
254
|
+
overwriteOrMerge: 'overwrite'
|
|
242
255
|
});
|
|
243
256
|
// Backup the new wallet without waiting for the promise to resolve
|
|
244
257
|
void this.storeEncryptedBackupByWalletWithRetry({
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DynamicWalletClient, getClientKeyShareBackupInfo, WalletOperation, MessageHash } from '@dynamic-labs-wallet/browser';
|
|
2
|
-
import { serializeSignature, createPublicClient, http,
|
|
2
|
+
import { serializeSignature, createPublicClient, http, getAddress, serializeTransaction } from 'viem';
|
|
3
3
|
import { mainnet } from 'viem/chains';
|
|
4
4
|
|
|
5
5
|
function _extends() {
|
|
@@ -48,8 +48,9 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
48
48
|
onError,
|
|
49
49
|
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
50
50
|
// update wallet map
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const checksumAddress = getAddress(accountAddress);
|
|
52
|
+
this.walletMap[checksumAddress] = _extends({}, this.walletMap[checksumAddress] || {}, {
|
|
53
|
+
accountAddress: checksumAddress,
|
|
53
54
|
walletId,
|
|
54
55
|
chainName: this.chainName,
|
|
55
56
|
thresholdSignatureScheme,
|
|
@@ -66,8 +67,10 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
66
67
|
// Update client key shares in wallet map
|
|
67
68
|
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
68
69
|
// TODO: remove this once iframe handling for secret shares is implemented
|
|
69
|
-
this.
|
|
70
|
-
|
|
70
|
+
await this.setClientKeySharesToLocalStorage({
|
|
71
|
+
accountAddress,
|
|
72
|
+
clientKeyShares,
|
|
73
|
+
overwriteOrMerge: 'overwrite'
|
|
71
74
|
});
|
|
72
75
|
// Backup the new wallet without waiting for the promise to resolve
|
|
73
76
|
void this.storeEncryptedBackupByWalletWithRetry({
|
|
@@ -171,7 +174,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
171
174
|
throw error;
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
|
-
|
|
177
|
+
deriveAccountAddress({ rawPublicKey }) {
|
|
175
178
|
const serializedUncompressed = rawPublicKey.serializeUncompressed();
|
|
176
179
|
const firstByteRemoved = serializedUncompressed.slice(1);
|
|
177
180
|
const hashed = MessageHash.keccak256(firstByteRemoved).bytes;
|
|
@@ -183,7 +186,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
183
186
|
publicKeyHex
|
|
184
187
|
};
|
|
185
188
|
}
|
|
186
|
-
async exportPrivateKey({ accountAddress, password = undefined }) {
|
|
189
|
+
async exportPrivateKey({ accountAddress, displayContainer, password = undefined }) {
|
|
187
190
|
await this.verifyPassword({
|
|
188
191
|
accountAddress,
|
|
189
192
|
password,
|
|
@@ -191,9 +194,16 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
191
194
|
});
|
|
192
195
|
const { derivedPrivateKey } = await this.exportKey({
|
|
193
196
|
accountAddress,
|
|
197
|
+
displayContainer,
|
|
194
198
|
chainName: this.chainName,
|
|
195
199
|
password
|
|
196
200
|
});
|
|
201
|
+
if (this.useIframeStorage) {
|
|
202
|
+
const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
|
|
203
|
+
container: displayContainer
|
|
204
|
+
});
|
|
205
|
+
iframeDisplay.displayPrivateKey(accountAddress, derivedPrivateKey);
|
|
206
|
+
}
|
|
197
207
|
return {
|
|
198
208
|
derivedPrivateKey
|
|
199
209
|
};
|
|
@@ -217,8 +227,9 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
217
227
|
onError,
|
|
218
228
|
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
219
229
|
// update wallet map
|
|
220
|
-
|
|
221
|
-
|
|
230
|
+
const checksumAddress = getAddress(accountAddress);
|
|
231
|
+
this.walletMap[checksumAddress] = _extends({}, this.walletMap[checksumAddress] || {}, {
|
|
232
|
+
accountAddress: checksumAddress,
|
|
222
233
|
walletId,
|
|
223
234
|
chainName: this.chainName,
|
|
224
235
|
thresholdSignatureScheme,
|
|
@@ -235,8 +246,10 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
235
246
|
// Update client key shares in wallet map
|
|
236
247
|
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
237
248
|
// TODO: remove this once iframe handling for secret shares is implemented
|
|
238
|
-
this.
|
|
239
|
-
|
|
249
|
+
await this.setClientKeySharesToLocalStorage({
|
|
250
|
+
accountAddress,
|
|
251
|
+
clientKeyShares,
|
|
252
|
+
overwriteOrMerge: 'overwrite'
|
|
240
253
|
});
|
|
241
254
|
// Backup the new wallet without waiting for the promise to resolve
|
|
242
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.
|
|
3
|
+
"version": "0.0.49",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser": "0.0.49"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"viem": "^2.22.1"
|
package/src/client/client.d.ts
CHANGED
|
@@ -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
|
-
}):
|
|
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,CA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