@dynamic-labs-wallet/evm 0.0.45 → 0.0.47
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 +40 -30
- package/index.esm.js +40 -30
- package/package.json +2 -2
- package/src/client/client.d.ts.map +1 -1
- package/src/client/constants.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -46,32 +46,35 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
46
46
|
// Generate key shares for given threshold signature scheme (TSS)
|
|
47
47
|
const { rawPublicKey, clientKeyShares } = await this.keyGen({
|
|
48
48
|
chainName: this.chainName,
|
|
49
|
-
thresholdSignatureScheme
|
|
49
|
+
thresholdSignatureScheme,
|
|
50
|
+
onError,
|
|
51
|
+
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
52
|
+
// update wallet map
|
|
53
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
54
|
+
accountAddress,
|
|
55
|
+
walletId,
|
|
56
|
+
chainName: this.chainName,
|
|
57
|
+
thresholdSignatureScheme,
|
|
58
|
+
clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
|
|
59
|
+
});
|
|
60
|
+
}
|
|
50
61
|
});
|
|
51
62
|
if (!rawPublicKey || !clientKeyShares) {
|
|
52
63
|
throw new Error(ERROR_KEYGEN_FAILED);
|
|
53
64
|
}
|
|
54
|
-
// Get EVM address from public key
|
|
55
65
|
const { accountAddress, publicKeyHex } = await this.deriveAccountAddress({
|
|
56
66
|
rawPublicKey: rawPublicKey
|
|
57
67
|
});
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
walletId: newWalletId,
|
|
67
|
-
chainName: this.chainName,
|
|
68
|
-
clientKeyShares: clientKeyShares,
|
|
69
|
-
thresholdSignatureScheme,
|
|
70
|
-
clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
|
|
71
|
-
};
|
|
72
|
-
// Backup the new wallet
|
|
73
|
-
await this.storeEncryptedBackupByWallet({
|
|
68
|
+
// Update client key shares in wallet map
|
|
69
|
+
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
70
|
+
// TODO: remove this once iframe handling for secret shares is implemented
|
|
71
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
72
|
+
clientKeyShares
|
|
73
|
+
});
|
|
74
|
+
// Backup the new wallet without waiting for the promise to resolve
|
|
75
|
+
void this.storeEncryptedBackupByWalletWithRetry({
|
|
74
76
|
accountAddress,
|
|
77
|
+
clientKeyShares,
|
|
75
78
|
password
|
|
76
79
|
});
|
|
77
80
|
return {
|
|
@@ -213,7 +216,17 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
213
216
|
chainName,
|
|
214
217
|
privateKey,
|
|
215
218
|
thresholdSignatureScheme,
|
|
216
|
-
onError
|
|
219
|
+
onError,
|
|
220
|
+
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
221
|
+
// update wallet map
|
|
222
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
223
|
+
accountAddress,
|
|
224
|
+
walletId,
|
|
225
|
+
chainName: this.chainName,
|
|
226
|
+
thresholdSignatureScheme,
|
|
227
|
+
clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
|
|
228
|
+
});
|
|
229
|
+
}
|
|
217
230
|
});
|
|
218
231
|
if (!rawPublicKey || !clientKeyShares) {
|
|
219
232
|
throw new Error('Error creating wallet account');
|
|
@@ -221,19 +234,16 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
221
234
|
const { accountAddress, publicKeyHex } = await this.deriveAccountAddress({
|
|
222
235
|
rawPublicKey: rawPublicKey
|
|
223
236
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
this.walletMap[accountAddress] = {
|
|
237
|
+
// Update client key shares in wallet map
|
|
238
|
+
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
239
|
+
// TODO: remove this once iframe handling for secret shares is implemented
|
|
240
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
241
|
+
clientKeyShares
|
|
242
|
+
});
|
|
243
|
+
// Backup the new wallet without waiting for the promise to resolve
|
|
244
|
+
void this.storeEncryptedBackupByWalletWithRetry({
|
|
228
245
|
accountAddress,
|
|
229
|
-
walletId: newWalletId,
|
|
230
|
-
chainName: this.chainName,
|
|
231
246
|
clientKeyShares,
|
|
232
|
-
thresholdSignatureScheme,
|
|
233
|
-
clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
|
|
234
|
-
};
|
|
235
|
-
await this.storeEncryptedBackupByWallet({
|
|
236
|
-
accountAddress,
|
|
237
247
|
password
|
|
238
248
|
});
|
|
239
249
|
return {
|
package/index.esm.js
CHANGED
|
@@ -44,32 +44,35 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
44
44
|
// Generate key shares for given threshold signature scheme (TSS)
|
|
45
45
|
const { rawPublicKey, clientKeyShares } = await this.keyGen({
|
|
46
46
|
chainName: this.chainName,
|
|
47
|
-
thresholdSignatureScheme
|
|
47
|
+
thresholdSignatureScheme,
|
|
48
|
+
onError,
|
|
49
|
+
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
50
|
+
// update wallet map
|
|
51
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
52
|
+
accountAddress,
|
|
53
|
+
walletId,
|
|
54
|
+
chainName: this.chainName,
|
|
55
|
+
thresholdSignatureScheme,
|
|
56
|
+
clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
|
|
57
|
+
});
|
|
58
|
+
}
|
|
48
59
|
});
|
|
49
60
|
if (!rawPublicKey || !clientKeyShares) {
|
|
50
61
|
throw new Error(ERROR_KEYGEN_FAILED);
|
|
51
62
|
}
|
|
52
|
-
// Get EVM address from public key
|
|
53
63
|
const { accountAddress, publicKeyHex } = await this.deriveAccountAddress({
|
|
54
64
|
rawPublicKey: rawPublicKey
|
|
55
65
|
});
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
walletId: newWalletId,
|
|
65
|
-
chainName: this.chainName,
|
|
66
|
-
clientKeyShares: clientKeyShares,
|
|
67
|
-
thresholdSignatureScheme,
|
|
68
|
-
clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
|
|
69
|
-
};
|
|
70
|
-
// Backup the new wallet
|
|
71
|
-
await this.storeEncryptedBackupByWallet({
|
|
66
|
+
// Update client key shares in wallet map
|
|
67
|
+
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
68
|
+
// TODO: remove this once iframe handling for secret shares is implemented
|
|
69
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
70
|
+
clientKeyShares
|
|
71
|
+
});
|
|
72
|
+
// Backup the new wallet without waiting for the promise to resolve
|
|
73
|
+
void this.storeEncryptedBackupByWalletWithRetry({
|
|
72
74
|
accountAddress,
|
|
75
|
+
clientKeyShares,
|
|
73
76
|
password
|
|
74
77
|
});
|
|
75
78
|
return {
|
|
@@ -211,7 +214,17 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
211
214
|
chainName,
|
|
212
215
|
privateKey,
|
|
213
216
|
thresholdSignatureScheme,
|
|
214
|
-
onError
|
|
217
|
+
onError,
|
|
218
|
+
onCeremonyComplete: (accountAddress, walletId)=>{
|
|
219
|
+
// update wallet map
|
|
220
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
221
|
+
accountAddress,
|
|
222
|
+
walletId,
|
|
223
|
+
chainName: this.chainName,
|
|
224
|
+
thresholdSignatureScheme,
|
|
225
|
+
clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
|
|
226
|
+
});
|
|
227
|
+
}
|
|
215
228
|
});
|
|
216
229
|
if (!rawPublicKey || !clientKeyShares) {
|
|
217
230
|
throw new Error('Error creating wallet account');
|
|
@@ -219,19 +232,16 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
219
232
|
const { accountAddress, publicKeyHex } = await this.deriveAccountAddress({
|
|
220
233
|
rawPublicKey: rawPublicKey
|
|
221
234
|
});
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
this.walletMap[accountAddress] = {
|
|
235
|
+
// Update client key shares in wallet map
|
|
236
|
+
// warning: this might result in race condition if `onCeremonyComplete` executes at the same time
|
|
237
|
+
// TODO: remove this once iframe handling for secret shares is implemented
|
|
238
|
+
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
239
|
+
clientKeyShares
|
|
240
|
+
});
|
|
241
|
+
// Backup the new wallet without waiting for the promise to resolve
|
|
242
|
+
void this.storeEncryptedBackupByWalletWithRetry({
|
|
226
243
|
accountAddress,
|
|
227
|
-
walletId: newWalletId,
|
|
228
|
-
chainName: this.chainName,
|
|
229
244
|
clientKeyShares,
|
|
230
|
-
thresholdSignatureScheme,
|
|
231
|
-
clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
|
|
232
|
-
};
|
|
233
|
-
await this.storeEncryptedBackupByWallet({
|
|
234
|
-
accountAddress,
|
|
235
245
|
password
|
|
236
246
|
});
|
|
237
247
|
return {
|
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.47",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser": "0.0.47"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"viem": "^2.22.1"
|
|
@@ -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;QACtD,eAAe,EAAE,cAAc,EAAE,CAAC;KACnC,CAAC;
|
|
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,mB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vD,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E,eAAO,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,qCAAmC,CAAC;AAGxE,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E,eAAO,MAAM,8BAA8B,sCACN,CAAC"}
|