@dynamic-labs-wallet/node-evm 0.0.136 → 0.0.138
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 -5
- package/index.esm.js +23 -5
- package/package.json +2 -2
- package/src/client/client.d.ts +26 -8
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -53,7 +53,14 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
53
53
|
transport: viem.http(rpcUrl)
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new wallet account and stores the key shares in the wallet map.
|
|
58
|
+
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
59
|
+
* @param password - The password to use for the wallet.
|
|
60
|
+
* @param onError - The function to call if an error occurs.
|
|
61
|
+
* @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
|
|
62
|
+
* @returns The account address, public key, raw public key, external server key shares, and wallet id.
|
|
63
|
+
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, backUpToClientShareService = false }) {
|
|
57
64
|
try {
|
|
58
65
|
let ceremonyCeremonyCompleteResolver;
|
|
59
66
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
@@ -96,7 +103,8 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
96
103
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
97
104
|
accountAddress,
|
|
98
105
|
externalServerKeyShares,
|
|
99
|
-
password
|
|
106
|
+
password,
|
|
107
|
+
backUpToClientShareService
|
|
100
108
|
});
|
|
101
109
|
return {
|
|
102
110
|
walletId: this.walletMap[accountAddress].walletId,
|
|
@@ -159,7 +167,7 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
159
167
|
throw new Error(ERROR_VERIFY_MESSAGE_SIGNATURE);
|
|
160
168
|
}
|
|
161
169
|
}
|
|
162
|
-
async signTransaction({ senderAddress, transaction, password = undefined,
|
|
170
|
+
async signTransaction({ senderAddress, transaction, password = undefined, externalServerKeyShares }) {
|
|
163
171
|
await this.verifyPassword({
|
|
164
172
|
accountAddress: senderAddress,
|
|
165
173
|
password,
|
|
@@ -223,7 +231,16 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
223
231
|
derivedPrivateKey
|
|
224
232
|
};
|
|
225
233
|
}
|
|
226
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Imports a private key and stores the key shares in the wallet map.
|
|
236
|
+
* @param privateKey - The private key to import.
|
|
237
|
+
* @param chainName - The chain name to use for the wallet.
|
|
238
|
+
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
239
|
+
* @param password - The password to use for the wallet.
|
|
240
|
+
* @param onError - The function to call if an error occurs.
|
|
241
|
+
* @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
|
|
242
|
+
* @returns The account address, public key, raw public key, external server key shares.
|
|
243
|
+
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, backUpToClientShareService = false }) {
|
|
227
244
|
let ceremonyCeremonyCompleteResolver;
|
|
228
245
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
229
246
|
ceremonyCeremonyCompleteResolver = resolve;
|
|
@@ -258,7 +275,8 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
258
275
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
259
276
|
accountAddress,
|
|
260
277
|
externalServerKeyShares,
|
|
261
|
-
password
|
|
278
|
+
password,
|
|
279
|
+
backUpToClientShareService
|
|
262
280
|
});
|
|
263
281
|
return {
|
|
264
282
|
accountAddress,
|
package/index.esm.js
CHANGED
|
@@ -51,7 +51,14 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
51
51
|
transport: http(rpcUrl)
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new wallet account and stores the key shares in the wallet map.
|
|
56
|
+
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
57
|
+
* @param password - The password to use for the wallet.
|
|
58
|
+
* @param onError - The function to call if an error occurs.
|
|
59
|
+
* @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
|
|
60
|
+
* @returns The account address, public key, raw public key, external server key shares, and wallet id.
|
|
61
|
+
*/ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, backUpToClientShareService = false }) {
|
|
55
62
|
try {
|
|
56
63
|
let ceremonyCeremonyCompleteResolver;
|
|
57
64
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
@@ -94,7 +101,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
94
101
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
95
102
|
accountAddress,
|
|
96
103
|
externalServerKeyShares,
|
|
97
|
-
password
|
|
104
|
+
password,
|
|
105
|
+
backUpToClientShareService
|
|
98
106
|
});
|
|
99
107
|
return {
|
|
100
108
|
walletId: this.walletMap[accountAddress].walletId,
|
|
@@ -157,7 +165,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
157
165
|
throw new Error(ERROR_VERIFY_MESSAGE_SIGNATURE);
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
|
-
async signTransaction({ senderAddress, transaction, password = undefined,
|
|
168
|
+
async signTransaction({ senderAddress, transaction, password = undefined, externalServerKeyShares }) {
|
|
161
169
|
await this.verifyPassword({
|
|
162
170
|
accountAddress: senderAddress,
|
|
163
171
|
password,
|
|
@@ -221,7 +229,16 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
221
229
|
derivedPrivateKey
|
|
222
230
|
};
|
|
223
231
|
}
|
|
224
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Imports a private key and stores the key shares in the wallet map.
|
|
234
|
+
* @param privateKey - The private key to import.
|
|
235
|
+
* @param chainName - The chain name to use for the wallet.
|
|
236
|
+
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
237
|
+
* @param password - The password to use for the wallet.
|
|
238
|
+
* @param onError - The function to call if an error occurs.
|
|
239
|
+
* @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
|
|
240
|
+
* @returns The account address, public key, raw public key, external server key shares.
|
|
241
|
+
*/ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, backUpToClientShareService = false }) {
|
|
225
242
|
let ceremonyCeremonyCompleteResolver;
|
|
226
243
|
const ceremonyCompletePromise = new Promise((resolve)=>{
|
|
227
244
|
ceremonyCeremonyCompleteResolver = resolve;
|
|
@@ -256,7 +273,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
256
273
|
await this.storeEncryptedBackupByWalletWithRetry({
|
|
257
274
|
accountAddress,
|
|
258
275
|
externalServerKeyShares,
|
|
259
|
-
password
|
|
276
|
+
password,
|
|
277
|
+
backUpToClientShareService
|
|
260
278
|
});
|
|
261
279
|
return {
|
|
262
280
|
accountAddress,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node-evm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.138",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/node": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/node": "0.0.138"
|
|
7
7
|
},
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
package/src/client/client.d.ts
CHANGED
|
@@ -7,10 +7,19 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
7
7
|
chain: Chain;
|
|
8
8
|
rpcUrl?: string;
|
|
9
9
|
}): PublicClient;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new wallet account and stores the key shares in the wallet map.
|
|
12
|
+
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
13
|
+
* @param password - The password to use for the wallet.
|
|
14
|
+
* @param onError - The function to call if an error occurs.
|
|
15
|
+
* @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
|
|
16
|
+
* @returns The account address, public key, raw public key, external server key shares, and wallet id.
|
|
17
|
+
*/
|
|
18
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, backUpToClientShareService, }: {
|
|
11
19
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
12
20
|
password?: string;
|
|
13
21
|
onError?: (error: Error) => void;
|
|
22
|
+
backUpToClientShareService?: boolean;
|
|
14
23
|
}): Promise<{
|
|
15
24
|
accountAddress: string;
|
|
16
25
|
publicKeyHex: string;
|
|
@@ -22,24 +31,23 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
22
31
|
message: string;
|
|
23
32
|
accountAddress: string;
|
|
24
33
|
password?: string;
|
|
25
|
-
externalServerKeyShares
|
|
34
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
26
35
|
}): Promise<`0x${string}`>;
|
|
27
36
|
verifyMessageSignature({ accountAddress, message, signature, }: {
|
|
28
37
|
accountAddress: string;
|
|
29
38
|
message: SignableMessage;
|
|
30
39
|
signature: any;
|
|
31
40
|
}): Promise<boolean>;
|
|
32
|
-
signTransaction({ senderAddress, transaction, password,
|
|
41
|
+
signTransaction({ senderAddress, transaction, password, externalServerKeyShares, }: {
|
|
33
42
|
senderAddress: string;
|
|
34
43
|
transaction: TransactionSerializable;
|
|
35
44
|
password?: string;
|
|
36
|
-
|
|
37
|
-
externalServerKeyShares: ServerKeyShare[];
|
|
45
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
38
46
|
}): Promise<string>;
|
|
39
47
|
exportPrivateKey({ accountAddress, password, externalServerKeyShares, }: {
|
|
40
48
|
accountAddress: string;
|
|
41
49
|
password?: string;
|
|
42
|
-
externalServerKeyShares
|
|
50
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
43
51
|
}): Promise<{
|
|
44
52
|
derivedPrivateKey: string | undefined;
|
|
45
53
|
}>;
|
|
@@ -49,13 +57,23 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
49
57
|
}): Promise<{
|
|
50
58
|
derivedPrivateKey: string | undefined;
|
|
51
59
|
}>;
|
|
52
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Imports a private key and stores the key shares in the wallet map.
|
|
62
|
+
* @param privateKey - The private key to import.
|
|
63
|
+
* @param chainName - The chain name to use for the wallet.
|
|
64
|
+
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
65
|
+
* @param password - The password to use for the wallet.
|
|
66
|
+
* @param onError - The function to call if an error occurs.
|
|
67
|
+
* @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
|
|
68
|
+
* @returns The account address, public key, raw public key, external server key shares.
|
|
69
|
+
*/
|
|
70
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, backUpToClientShareService, }: {
|
|
53
71
|
privateKey: string;
|
|
54
72
|
chainName: string;
|
|
55
73
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
56
74
|
password?: string;
|
|
57
75
|
onError?: (error: Error) => void;
|
|
58
|
-
|
|
76
|
+
backUpToClientShareService?: boolean;
|
|
59
77
|
}): Promise<{
|
|
60
78
|
accountAddress: string;
|
|
61
79
|
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,EAGzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,KAAK,EAEV,KAAK,eAAe,EACpB,KAAK,uB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