@dynamic-labs-wallet/node-evm 0.0.119 → 0.0.121

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
@@ -53,7 +53,7 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
53
53
  transport: viem.http(rpcUrl)
54
54
  });
55
55
  }
56
- async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
56
+ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
57
57
  try {
58
58
  let ceremonyCeremonyCompleteResolver;
59
59
  const ceremonyCompletePromise = new Promise((resolve)=>{
@@ -96,7 +96,8 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
96
96
  await this.storeEncryptedBackupByWalletWithRetry({
97
97
  accountAddress,
98
98
  externalServerKeyShares,
99
- password
99
+ password,
100
+ signedSessionId
100
101
  });
101
102
  return {
102
103
  accountAddress,
@@ -109,15 +110,17 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
109
110
  throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
110
111
  }
111
112
  }
112
- async signMessage({ message, accountAddress, password = undefined }) {
113
+ async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
113
114
  await this.verifyPassword({
114
115
  accountAddress,
115
116
  password,
116
- walletOperation: node.WalletOperation.SIGN_MESSAGE
117
+ walletOperation: node.WalletOperation.SIGN_MESSAGE,
118
+ signedSessionId
117
119
  });
118
120
  await this.getWallet({
119
121
  accountAddress,
120
- walletOperation: node.WalletOperation.SIGN_MESSAGE
122
+ walletOperation: node.WalletOperation.SIGN_MESSAGE,
123
+ signedSessionId
121
124
  });
122
125
  try {
123
126
  if (!accountAddress) {
@@ -130,7 +133,8 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
130
133
  message: formattedMessage,
131
134
  accountAddress: accountAddress,
132
135
  chainName: this.chainName,
133
- password
136
+ password,
137
+ signedSessionId
134
138
  });
135
139
  // Serialize the signature
136
140
  const serializedSignature = serializeECDSASignature(signatureEcdsa);
@@ -157,11 +161,12 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
157
161
  throw new Error(ERROR_VERIFY_MESSAGE_SIGNATURE);
158
162
  }
159
163
  }
160
- async signTransaction({ senderAddress, transaction, password = undefined }) {
164
+ async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId }) {
161
165
  await this.verifyPassword({
162
166
  accountAddress: senderAddress,
163
167
  password,
164
- walletOperation: node.WalletOperation.SIGN_TRANSACTION
168
+ walletOperation: node.WalletOperation.SIGN_TRANSACTION,
169
+ signedSessionId
165
170
  });
166
171
  const serializedTx = viem.serializeTransaction(transaction);
167
172
  const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
@@ -173,7 +178,8 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
173
178
  message: serializedTxBytes,
174
179
  accountAddress: senderAddress,
175
180
  chainName: this.chainName,
176
- password
181
+ password,
182
+ signedSessionId
177
183
  });
178
184
  if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
179
185
  throw new Error('Invalid signature format returned from MPC signing');
@@ -194,16 +200,18 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
194
200
  throw error;
195
201
  }
196
202
  }
197
- async exportPrivateKey({ accountAddress, password = undefined }) {
203
+ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
198
204
  await this.verifyPassword({
199
205
  accountAddress,
200
206
  password,
201
- walletOperation: node.WalletOperation.EXPORT_PRIVATE_KEY
207
+ walletOperation: node.WalletOperation.EXPORT_PRIVATE_KEY,
208
+ signedSessionId
202
209
  });
203
210
  const { derivedPrivateKey } = await this.exportKey({
204
211
  accountAddress,
205
212
  chainName: this.chainName,
206
- password
213
+ password,
214
+ signedSessionId
207
215
  });
208
216
  return {
209
217
  derivedPrivateKey
@@ -219,7 +227,7 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
219
227
  derivedPrivateKey
220
228
  };
221
229
  }
222
- async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
230
+ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
223
231
  let ceremonyCeremonyCompleteResolver;
224
232
  const ceremonyCompletePromise = new Promise((resolve)=>{
225
233
  ceremonyCeremonyCompleteResolver = resolve;
@@ -254,7 +262,8 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
254
262
  await this.storeEncryptedBackupByWalletWithRetry({
255
263
  accountAddress,
256
264
  externalServerKeyShares,
257
- password
265
+ password,
266
+ signedSessionId
258
267
  });
259
268
  return {
260
269
  accountAddress,
package/index.esm.js CHANGED
@@ -51,7 +51,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
51
51
  transport: http(rpcUrl)
52
52
  });
53
53
  }
54
- async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
54
+ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
55
55
  try {
56
56
  let ceremonyCeremonyCompleteResolver;
57
57
  const ceremonyCompletePromise = new Promise((resolve)=>{
@@ -94,7 +94,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
94
94
  await this.storeEncryptedBackupByWalletWithRetry({
95
95
  accountAddress,
96
96
  externalServerKeyShares,
97
- password
97
+ password,
98
+ signedSessionId
98
99
  });
99
100
  return {
100
101
  accountAddress,
@@ -107,15 +108,17 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
107
108
  throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
108
109
  }
109
110
  }
110
- async signMessage({ message, accountAddress, password = undefined }) {
111
+ async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
111
112
  await this.verifyPassword({
112
113
  accountAddress,
113
114
  password,
114
- walletOperation: WalletOperation.SIGN_MESSAGE
115
+ walletOperation: WalletOperation.SIGN_MESSAGE,
116
+ signedSessionId
115
117
  });
116
118
  await this.getWallet({
117
119
  accountAddress,
118
- walletOperation: WalletOperation.SIGN_MESSAGE
120
+ walletOperation: WalletOperation.SIGN_MESSAGE,
121
+ signedSessionId
119
122
  });
120
123
  try {
121
124
  if (!accountAddress) {
@@ -128,7 +131,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
128
131
  message: formattedMessage,
129
132
  accountAddress: accountAddress,
130
133
  chainName: this.chainName,
131
- password
134
+ password,
135
+ signedSessionId
132
136
  });
133
137
  // Serialize the signature
134
138
  const serializedSignature = serializeECDSASignature(signatureEcdsa);
@@ -155,11 +159,12 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
155
159
  throw new Error(ERROR_VERIFY_MESSAGE_SIGNATURE);
156
160
  }
157
161
  }
158
- async signTransaction({ senderAddress, transaction, password = undefined }) {
162
+ async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId }) {
159
163
  await this.verifyPassword({
160
164
  accountAddress: senderAddress,
161
165
  password,
162
- walletOperation: WalletOperation.SIGN_TRANSACTION
166
+ walletOperation: WalletOperation.SIGN_TRANSACTION,
167
+ signedSessionId
163
168
  });
164
169
  const serializedTx = serializeTransaction(transaction);
165
170
  const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
@@ -171,7 +176,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
171
176
  message: serializedTxBytes,
172
177
  accountAddress: senderAddress,
173
178
  chainName: this.chainName,
174
- password
179
+ password,
180
+ signedSessionId
175
181
  });
176
182
  if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
177
183
  throw new Error('Invalid signature format returned from MPC signing');
@@ -192,16 +198,18 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
192
198
  throw error;
193
199
  }
194
200
  }
195
- async exportPrivateKey({ accountAddress, password = undefined }) {
201
+ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
196
202
  await this.verifyPassword({
197
203
  accountAddress,
198
204
  password,
199
- walletOperation: WalletOperation.EXPORT_PRIVATE_KEY
205
+ walletOperation: WalletOperation.EXPORT_PRIVATE_KEY,
206
+ signedSessionId
200
207
  });
201
208
  const { derivedPrivateKey } = await this.exportKey({
202
209
  accountAddress,
203
210
  chainName: this.chainName,
204
- password
211
+ password,
212
+ signedSessionId
205
213
  });
206
214
  return {
207
215
  derivedPrivateKey
@@ -217,7 +225,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
217
225
  derivedPrivateKey
218
226
  };
219
227
  }
220
- async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
228
+ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
221
229
  let ceremonyCeremonyCompleteResolver;
222
230
  const ceremonyCompletePromise = new Promise((resolve)=>{
223
231
  ceremonyCeremonyCompleteResolver = resolve;
@@ -252,7 +260,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
252
260
  await this.storeEncryptedBackupByWalletWithRetry({
253
261
  accountAddress,
254
262
  externalServerKeyShares,
255
- password
263
+ password,
264
+ signedSessionId
256
265
  });
257
266
  return {
258
267
  accountAddress,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node-evm",
3
- "version": "0.0.119",
3
+ "version": "0.0.121",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@dynamic-labs-wallet/node": "0.0.119"
6
+ "@dynamic-labs-wallet/node": "0.0.121"
7
7
  },
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -7,34 +7,38 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
7
7
  chain: Chain;
8
8
  rpcUrl?: string;
9
9
  }): PublicClient;
10
- createWalletAccount({ thresholdSignatureScheme, password, onError, }: {
10
+ createWalletAccount({ thresholdSignatureScheme, password, onError, signedSessionId, }: {
11
11
  thresholdSignatureScheme: ThresholdSignatureScheme;
12
12
  password?: string;
13
13
  onError?: (error: Error) => void;
14
+ signedSessionId: string;
14
15
  }): Promise<{
15
16
  accountAddress: string;
16
17
  publicKeyHex: string;
17
18
  rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
18
19
  externalServerKeyShares: ServerKeyShare[];
19
20
  }>;
20
- signMessage({ message, accountAddress, password, }: {
21
+ signMessage({ message, accountAddress, password, signedSessionId, }: {
21
22
  message: string;
22
23
  accountAddress: string;
23
24
  password?: string;
25
+ signedSessionId: string;
24
26
  }): Promise<`0x${string}`>;
25
27
  verifyMessageSignature({ accountAddress, message, signature, }: {
26
28
  accountAddress: string;
27
29
  message: SignableMessage;
28
30
  signature: any;
29
31
  }): Promise<boolean>;
30
- signTransaction({ senderAddress, transaction, password, }: {
32
+ signTransaction({ senderAddress, transaction, password, signedSessionId, }: {
31
33
  senderAddress: string;
32
34
  transaction: TransactionSerializable;
33
35
  password?: string;
36
+ signedSessionId: string;
34
37
  }): Promise<string>;
35
- exportPrivateKey({ accountAddress, password, }: {
38
+ exportPrivateKey({ accountAddress, password, signedSessionId, }: {
36
39
  accountAddress: string;
37
40
  password?: string;
41
+ signedSessionId: string;
38
42
  }): Promise<{
39
43
  derivedPrivateKey: string | undefined;
40
44
  }>;
@@ -44,12 +48,13 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
44
48
  }): Promise<{
45
49
  derivedPrivateKey: string | undefined;
46
50
  }>;
47
- importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, }: {
51
+ importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, signedSessionId, }: {
48
52
  privateKey: string;
49
53
  chainName: string;
50
54
  thresholdSignatureScheme: ThresholdSignatureScheme;
51
55
  password?: string;
52
56
  onError?: (error: Error) => void;
57
+ signedSessionId: string;
53
58
  }): Promise<{
54
59
  accountAddress: string;
55
60
  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,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