@dynamic-labs-wallet/evm 0.0.81 → 0.0.83

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
@@ -56,7 +56,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
56
56
  transport: viem.http(rpcUrl)
57
57
  });
58
58
  }
59
- async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
59
+ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
60
60
  try {
61
61
  // Create a promise that will resolve when the ceremony is complete
62
62
  let ceremonyCeremonyCompleteResolver;
@@ -101,7 +101,8 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
101
101
  await this.storeEncryptedBackupByWalletWithRetry({
102
102
  accountAddress,
103
103
  clientKeyShares,
104
- password
104
+ password,
105
+ signedSessionId
105
106
  });
106
107
  return {
107
108
  accountAddress,
@@ -113,11 +114,12 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
113
114
  throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
114
115
  }
115
116
  }
116
- async signMessage({ message, accountAddress, password = undefined }) {
117
+ async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
117
118
  await this.verifyPassword({
118
119
  accountAddress,
119
120
  password,
120
- walletOperation: browser.WalletOperation.SIGN_MESSAGE
121
+ walletOperation: browser.WalletOperation.SIGN_MESSAGE,
122
+ signedSessionId
121
123
  });
122
124
  try {
123
125
  if (!accountAddress) {
@@ -130,7 +132,8 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
130
132
  message: formattedMessage,
131
133
  accountAddress: accountAddress,
132
134
  chainName: this.chainName,
133
- password
135
+ password,
136
+ signedSessionId
134
137
  });
135
138
  // Serialize the signature
136
139
  const serializedSignature = serializeECDSASignature(signatureEcdsa);
@@ -157,11 +160,12 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
157
160
  throw new Error(ERROR_VERIFY_MESSAGE_SIGNATURE);
158
161
  }
159
162
  }
160
- async signTransaction({ senderAddress, transaction, password = undefined }) {
163
+ async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId }) {
161
164
  await this.verifyPassword({
162
165
  accountAddress: senderAddress,
163
166
  password,
164
- walletOperation: browser.WalletOperation.SIGN_TRANSACTION
167
+ walletOperation: browser.WalletOperation.SIGN_TRANSACTION,
168
+ signedSessionId
165
169
  });
166
170
  const serializedTx = viem.serializeTransaction(transaction);
167
171
  const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
@@ -173,7 +177,8 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
173
177
  message: serializedTxBytes,
174
178
  accountAddress: senderAddress,
175
179
  chainName: this.chainName,
176
- password
180
+ password,
181
+ signedSessionId
177
182
  });
178
183
  if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
179
184
  throw new Error('Invalid signature format returned from MPC signing');
@@ -206,16 +211,18 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
206
211
  publicKeyHex
207
212
  };
208
213
  }
209
- async exportPrivateKey({ accountAddress, password = undefined }) {
214
+ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
210
215
  await this.verifyPassword({
211
216
  accountAddress,
212
217
  password,
213
- walletOperation: browser.WalletOperation.EXPORT_PRIVATE_KEY
218
+ walletOperation: browser.WalletOperation.EXPORT_PRIVATE_KEY,
219
+ signedSessionId
214
220
  });
215
221
  const { derivedPrivateKey } = await this.exportKey({
216
222
  accountAddress,
217
223
  chainName: this.chainName,
218
- password
224
+ password,
225
+ signedSessionId
219
226
  });
220
227
  return derivedPrivateKey;
221
228
  }
@@ -229,7 +236,7 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
229
236
  derivedPrivateKey
230
237
  };
231
238
  }
232
- async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
239
+ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
233
240
  // TODO: validate private key for EVM
234
241
  const { rawPublicKey, clientKeyShares } = await this.importRawPrivateKey({
235
242
  chainName,
@@ -265,7 +272,8 @@ class DynamicEvmWalletClient extends browser.DynamicWalletClient {
265
272
  await this.storeEncryptedBackupByWalletWithRetry({
266
273
  accountAddress,
267
274
  clientKeyShares,
268
- password
275
+ password,
276
+ signedSessionId
269
277
  });
270
278
  return {
271
279
  accountAddress,
package/index.esm.js CHANGED
@@ -54,7 +54,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
54
54
  transport: http(rpcUrl)
55
55
  });
56
56
  }
57
- async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError }) {
57
+ async createWalletAccount({ thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
58
58
  try {
59
59
  // Create a promise that will resolve when the ceremony is complete
60
60
  let ceremonyCeremonyCompleteResolver;
@@ -99,7 +99,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
99
99
  await this.storeEncryptedBackupByWalletWithRetry({
100
100
  accountAddress,
101
101
  clientKeyShares,
102
- password
102
+ password,
103
+ signedSessionId
103
104
  });
104
105
  return {
105
106
  accountAddress,
@@ -111,11 +112,12 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
111
112
  throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
112
113
  }
113
114
  }
114
- async signMessage({ message, accountAddress, password = undefined }) {
115
+ async signMessage({ message, accountAddress, password = undefined, signedSessionId }) {
115
116
  await this.verifyPassword({
116
117
  accountAddress,
117
118
  password,
118
- walletOperation: WalletOperation.SIGN_MESSAGE
119
+ walletOperation: WalletOperation.SIGN_MESSAGE,
120
+ signedSessionId
119
121
  });
120
122
  try {
121
123
  if (!accountAddress) {
@@ -128,7 +130,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
128
130
  message: formattedMessage,
129
131
  accountAddress: accountAddress,
130
132
  chainName: this.chainName,
131
- password
133
+ password,
134
+ signedSessionId
132
135
  });
133
136
  // Serialize the signature
134
137
  const serializedSignature = serializeECDSASignature(signatureEcdsa);
@@ -155,11 +158,12 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
155
158
  throw new Error(ERROR_VERIFY_MESSAGE_SIGNATURE);
156
159
  }
157
160
  }
158
- async signTransaction({ senderAddress, transaction, password = undefined }) {
161
+ async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId }) {
159
162
  await this.verifyPassword({
160
163
  accountAddress: senderAddress,
161
164
  password,
162
- walletOperation: WalletOperation.SIGN_TRANSACTION
165
+ walletOperation: WalletOperation.SIGN_TRANSACTION,
166
+ signedSessionId
163
167
  });
164
168
  const serializedTx = serializeTransaction(transaction);
165
169
  const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
@@ -171,7 +175,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
171
175
  message: serializedTxBytes,
172
176
  accountAddress: senderAddress,
173
177
  chainName: this.chainName,
174
- password
178
+ password,
179
+ signedSessionId
175
180
  });
176
181
  if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
177
182
  throw new Error('Invalid signature format returned from MPC signing');
@@ -204,16 +209,18 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
204
209
  publicKeyHex
205
210
  };
206
211
  }
207
- async exportPrivateKey({ accountAddress, password = undefined }) {
212
+ async exportPrivateKey({ accountAddress, password = undefined, signedSessionId }) {
208
213
  await this.verifyPassword({
209
214
  accountAddress,
210
215
  password,
211
- walletOperation: WalletOperation.EXPORT_PRIVATE_KEY
216
+ walletOperation: WalletOperation.EXPORT_PRIVATE_KEY,
217
+ signedSessionId
212
218
  });
213
219
  const { derivedPrivateKey } = await this.exportKey({
214
220
  accountAddress,
215
221
  chainName: this.chainName,
216
- password
222
+ password,
223
+ signedSessionId
217
224
  });
218
225
  return derivedPrivateKey;
219
226
  }
@@ -227,7 +234,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
227
234
  derivedPrivateKey
228
235
  };
229
236
  }
230
- async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError }) {
237
+ async importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password = undefined, onError, signedSessionId }) {
231
238
  // TODO: validate private key for EVM
232
239
  const { rawPublicKey, clientKeyShares } = await this.importRawPrivateKey({
233
240
  chainName,
@@ -263,7 +270,8 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
263
270
  await this.storeEncryptedBackupByWalletWithRetry({
264
271
  accountAddress,
265
272
  clientKeyShares,
266
- password
273
+ password,
274
+ signedSessionId
267
275
  });
268
276
  return {
269
277
  accountAddress,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/evm",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@dynamic-labs-wallet/browser": "0.0.81"
6
+ "@dynamic-labs-wallet/browser": "0.0.83"
7
7
  },
8
8
  "peerDependencies": {
9
9
  "viem": "^2.22.1"
@@ -7,29 +7,32 @@ 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 | string | undefined;
18
19
  }>;
19
- signMessage({ message, accountAddress, password, }: {
20
+ signMessage({ message, accountAddress, password, signedSessionId, }: {
20
21
  message: string;
21
22
  accountAddress: string;
22
23
  password?: string;
24
+ signedSessionId?: string;
23
25
  }): Promise<`0x${string}`>;
24
26
  verifyMessageSignature({ accountAddress, message, signature, }: {
25
27
  accountAddress: string;
26
28
  message: SignableMessage;
27
29
  signature: any;
28
30
  }): Promise<boolean>;
29
- signTransaction({ senderAddress, transaction, password, }: {
31
+ signTransaction({ senderAddress, transaction, password, signedSessionId, }: {
30
32
  senderAddress: string;
31
33
  transaction: TransactionSerializable;
32
34
  password?: string;
35
+ signedSessionId?: string;
33
36
  }): Promise<string>;
34
37
  deriveAccountAddress({ rawPublicKey }: {
35
38
  rawPublicKey: EcdsaPublicKey;
@@ -37,9 +40,10 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
37
40
  accountAddress: `0x${string}`;
38
41
  publicKeyHex: any;
39
42
  };
40
- exportPrivateKey({ accountAddress, password, }: {
43
+ exportPrivateKey({ accountAddress, password, signedSessionId, }: {
41
44
  accountAddress: string;
42
45
  password?: string;
46
+ signedSessionId?: string;
43
47
  }): Promise<string | undefined>;
44
48
  offlineExportPrivateKey({ keyShares, derivationPath, }: {
45
49
  keyShares: (EcdsaKeygenResult | Ed25519KeygenResult)[];
@@ -47,12 +51,13 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
47
51
  }): Promise<{
48
52
  derivedPrivateKey: string | undefined;
49
53
  }>;
50
- importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, }: {
54
+ importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, signedSessionId, }: {
51
55
  privateKey: string;
52
56
  chainName: string;
53
57
  thresholdSignatureScheme: ThresholdSignatureScheme;
54
58
  password?: string;
55
59
  onError?: (error: Error) => void;
60
+ signedSessionId?: string;
56
61
  }): Promise<{
57
62
  accountAddress: string;
58
63
  publicKeyHex: string;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EAEd,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EAIzB,MAAM,8BAA8B,CAA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