@dynamic-labs-wallet/evm 0.0.34 → 0.0.36
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 +8 -3
- package/index.esm.js +9 -4
- package/package.json +2 -2
- package/src/client/client.d.ts +3 -2
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -91,6 +91,10 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
91
91
|
password,
|
|
92
92
|
walletOperation: browser.WalletOperation.SIGN_MESSAGE
|
|
93
93
|
});
|
|
94
|
+
await this.getWallet({
|
|
95
|
+
accountAddress,
|
|
96
|
+
walletOperation: browser.WalletOperation.SIGN_MESSAGE
|
|
97
|
+
});
|
|
94
98
|
try {
|
|
95
99
|
if (!accountAddress) {
|
|
96
100
|
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
@@ -174,7 +178,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
174
178
|
const accountAddress = '0x' + Buffer.from(lastTwentyBytes).toString('hex');
|
|
175
179
|
const publicKeyHex = rawPublicKey.pubKeyAsHex();
|
|
176
180
|
return {
|
|
177
|
-
accountAddress,
|
|
181
|
+
accountAddress: viem.getAddress(accountAddress),
|
|
178
182
|
publicKeyHex
|
|
179
183
|
};
|
|
180
184
|
}
|
|
@@ -203,7 +207,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
203
207
|
derivedPrivateKey
|
|
204
208
|
};
|
|
205
209
|
}
|
|
206
|
-
async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme }) {
|
|
210
|
+
async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined }) {
|
|
207
211
|
// TODO: validate private key for EVM
|
|
208
212
|
const { rawPublicKey, clientKeyShares } = await this.importRawPrivateKey({
|
|
209
213
|
chainName,
|
|
@@ -228,7 +232,8 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
|
|
|
228
232
|
clientKeySharesBackupInfo: browser.getClientKeyShareBackupInfo()
|
|
229
233
|
};
|
|
230
234
|
await this.storeEncryptedBackupByWallet({
|
|
231
|
-
accountAddress
|
|
235
|
+
accountAddress,
|
|
236
|
+
password
|
|
232
237
|
});
|
|
233
238
|
return {
|
|
234
239
|
accountAddress,
|
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, serializeTransaction } from 'viem';
|
|
2
|
+
import { serializeSignature, createPublicClient, http, serializeTransaction, getAddress } from 'viem';
|
|
3
3
|
import { mainnet } from 'viem/chains';
|
|
4
4
|
|
|
5
5
|
function _extends() {
|
|
@@ -89,6 +89,10 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
89
89
|
password,
|
|
90
90
|
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
91
91
|
});
|
|
92
|
+
await this.getWallet({
|
|
93
|
+
accountAddress,
|
|
94
|
+
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
95
|
+
});
|
|
92
96
|
try {
|
|
93
97
|
if (!accountAddress) {
|
|
94
98
|
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
@@ -172,7 +176,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
172
176
|
const accountAddress = '0x' + Buffer.from(lastTwentyBytes).toString('hex');
|
|
173
177
|
const publicKeyHex = rawPublicKey.pubKeyAsHex();
|
|
174
178
|
return {
|
|
175
|
-
accountAddress,
|
|
179
|
+
accountAddress: getAddress(accountAddress),
|
|
176
180
|
publicKeyHex
|
|
177
181
|
};
|
|
178
182
|
}
|
|
@@ -201,7 +205,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
201
205
|
derivedPrivateKey
|
|
202
206
|
};
|
|
203
207
|
}
|
|
204
|
-
async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme }) {
|
|
208
|
+
async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined }) {
|
|
205
209
|
// TODO: validate private key for EVM
|
|
206
210
|
const { rawPublicKey, clientKeyShares } = await this.importRawPrivateKey({
|
|
207
211
|
chainName,
|
|
@@ -226,7 +230,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
226
230
|
clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
|
|
227
231
|
};
|
|
228
232
|
await this.storeEncryptedBackupByWallet({
|
|
229
|
-
accountAddress
|
|
233
|
+
accountAddress,
|
|
234
|
+
password
|
|
230
235
|
});
|
|
231
236
|
return {
|
|
232
237
|
accountAddress,
|
package/package.json
CHANGED
package/src/client/client.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
34
34
|
deriveAccountAddress({ rawPublicKey, }: {
|
|
35
35
|
rawPublicKey: EcdsaPublicKey;
|
|
36
36
|
}): Promise<{
|
|
37
|
-
accountAddress: string
|
|
37
|
+
accountAddress: `0x${string}`;
|
|
38
38
|
publicKeyHex: any;
|
|
39
39
|
}>;
|
|
40
40
|
exportPrivateKey({ accountAddress, password, }: {
|
|
@@ -49,10 +49,11 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
49
49
|
}): Promise<{
|
|
50
50
|
derivedPrivateKey: string | undefined;
|
|
51
51
|
}>;
|
|
52
|
-
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, }: {
|
|
52
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, }: {
|
|
53
53
|
privateKey: string;
|
|
54
54
|
chainName: string;
|
|
55
55
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
56
|
+
password?: string;
|
|
56
57
|
}): Promise<{
|
|
57
58
|
accountAddress: string;
|
|
58
59
|
publicKeyHex: string;
|
|
@@ -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,
|
|
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,GACrB,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,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;K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