@dynamic-labs-wallet/node-evm 0.0.196 → 0.0.197
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 +279 -236
- package/index.esm.js +281 -239
- package/package.json +2 -2
- package/src/{zerodev/viemSignerAdapter.d.ts → client/accountAdapter.d.ts} +3 -3
- package/src/client/accountAdapter.d.ts.map +1 -0
- package/src/client/client.d.ts +10 -1
- package/src/client/client.d.ts.map +1 -1
- package/src/client/index.d.ts +1 -0
- package/src/client/index.d.ts.map +1 -1
- package/src/zerodev/client.d.ts.map +1 -1
- package/src/zerodev/viemSignerAdapter.d.ts.map +0 -1
package/index.cjs.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var accounts = require('viem/accounts');
|
|
3
4
|
var node = require('@dynamic-labs-wallet/node');
|
|
4
5
|
var viem = require('viem');
|
|
5
|
-
var chains = require('viem/chains');
|
|
6
6
|
var utils = require('viem/utils');
|
|
7
|
+
var chains = require('viem/chains');
|
|
7
8
|
var client = require('@dynamic-labs-sdk/client');
|
|
8
9
|
var core = require('@dynamic-labs-sdk/client/core');
|
|
9
10
|
var viem$1 = require('@dynamic-labs-sdk/evm/viem');
|
|
@@ -12,7 +13,6 @@ var zerodev = require('@dynamic-labs-sdk/zerodev');
|
|
|
12
13
|
var core$1 = require('@dynamic-labs-sdk/zerodev/core');
|
|
13
14
|
var ecdsaValidator = require('@zerodev/ecdsa-validator');
|
|
14
15
|
var sdk = require('@zerodev/sdk');
|
|
15
|
-
var accounts = require('viem/accounts');
|
|
16
16
|
|
|
17
17
|
function _extends() {
|
|
18
18
|
_extends = Object.assign || function assign(target) {
|
|
@@ -69,6 +69,239 @@ const deriveAccountAddress = ({ rawPublicKey })=>{
|
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Creates a delegated EVM wallet client for functional operations
|
|
74
|
+
*/ const createDelegatedEvmWalletClient = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug = false })=>{
|
|
75
|
+
const baseClient = node.createDelegatedWalletClient({
|
|
76
|
+
environmentId,
|
|
77
|
+
baseApiUrl,
|
|
78
|
+
baseMPCRelayApiUrl,
|
|
79
|
+
apiKey,
|
|
80
|
+
debug
|
|
81
|
+
});
|
|
82
|
+
const evmClient = _extends({}, baseClient, {
|
|
83
|
+
chainName: 'EVM'
|
|
84
|
+
});
|
|
85
|
+
return evmClient;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Signs a message using delegated signing for EVM
|
|
89
|
+
*/ const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
90
|
+
try {
|
|
91
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
92
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
93
|
+
}
|
|
94
|
+
const formattedMessage = formatEVMMessage(message);
|
|
95
|
+
const resolvedContext = context != null ? context : {
|
|
96
|
+
evmMessage: message
|
|
97
|
+
};
|
|
98
|
+
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
99
|
+
walletId,
|
|
100
|
+
walletApiKey,
|
|
101
|
+
keyShare,
|
|
102
|
+
message: formattedMessage,
|
|
103
|
+
chainName: client.chainName,
|
|
104
|
+
context: resolvedContext,
|
|
105
|
+
onError
|
|
106
|
+
});
|
|
107
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
108
|
+
return serializedSignature;
|
|
109
|
+
} catch (error) {
|
|
110
|
+
client.logger.error('Error in delegatedSignMessage', error);
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Signs a transaction using delegated signing for EVM
|
|
116
|
+
*/ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
|
|
117
|
+
try {
|
|
118
|
+
// Serialize the transaction
|
|
119
|
+
const serializedTx = viem.serializeTransaction(transaction);
|
|
120
|
+
const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
|
|
121
|
+
if (!(serializedTxBytes instanceof Uint8Array)) {
|
|
122
|
+
throw new Error('Invalid serializedTxBytes');
|
|
123
|
+
}
|
|
124
|
+
// Use the delegated sign message function from node package
|
|
125
|
+
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
126
|
+
walletId,
|
|
127
|
+
walletApiKey,
|
|
128
|
+
keyShare,
|
|
129
|
+
message: serializedTxBytes,
|
|
130
|
+
chainName: client.chainName
|
|
131
|
+
});
|
|
132
|
+
if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
|
|
133
|
+
throw new Error('Invalid signature format returned from MPC signing');
|
|
134
|
+
}
|
|
135
|
+
// Construct the signed transaction
|
|
136
|
+
const r = `0x${Buffer.from(signatureEcdsa.r).toString('hex')}`;
|
|
137
|
+
const s = `0x${Buffer.from(signatureEcdsa.s).toString('hex')}`;
|
|
138
|
+
const v = BigInt(signatureEcdsa.v);
|
|
139
|
+
const signedTx = _extends({}, transaction, {
|
|
140
|
+
r: r,
|
|
141
|
+
s: s,
|
|
142
|
+
v: v
|
|
143
|
+
});
|
|
144
|
+
const serializedSignedTx = viem.serializeTransaction(signedTx);
|
|
145
|
+
return serializedSignedTx;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
client.logger.error('Error in delegatedSignTransaction', error);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Signs typed data using delegated signing for EVM
|
|
153
|
+
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData })=>{
|
|
154
|
+
try {
|
|
155
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
156
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
157
|
+
}
|
|
158
|
+
const formattedTypedData = formatTypedData(typedData);
|
|
159
|
+
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
160
|
+
walletId,
|
|
161
|
+
walletApiKey,
|
|
162
|
+
keyShare,
|
|
163
|
+
message: formattedTypedData,
|
|
164
|
+
chainName: client.chainName,
|
|
165
|
+
isFormatted: true,
|
|
166
|
+
context: {
|
|
167
|
+
evmTypedData: typedData
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
171
|
+
return serializedSignature;
|
|
172
|
+
} catch (error) {
|
|
173
|
+
client.logger.error('Error in delegatedSignTypedData', error);
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Signs EIP-7702 authorization using delegated signing for EVM
|
|
179
|
+
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization })=>{
|
|
180
|
+
try {
|
|
181
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
182
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
183
|
+
}
|
|
184
|
+
const digest = utils.hashAuthorization(authorization);
|
|
185
|
+
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
186
|
+
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
187
|
+
walletId,
|
|
188
|
+
walletApiKey,
|
|
189
|
+
keyShare,
|
|
190
|
+
message: prehashed,
|
|
191
|
+
chainName: client.chainName,
|
|
192
|
+
isFormatted: true,
|
|
193
|
+
context: {
|
|
194
|
+
eip7702Auth: authorization
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
198
|
+
const signature = viem.parseSignature(serializedSignature);
|
|
199
|
+
return signature;
|
|
200
|
+
} catch (error) {
|
|
201
|
+
client.logger.error('Error in delegatedSignAuthorization', error);
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Revoke delegation - delegates to the node package
|
|
207
|
+
*/ const revokeDelegation = async (client, params)=>{
|
|
208
|
+
return node.revokeDelegation(client, params);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const createAccountAdapter = ({ evmClient, accountAddress, password, externalServerKeyShares, delegated })=>{
|
|
212
|
+
return accounts.toAccount({
|
|
213
|
+
address: accountAddress,
|
|
214
|
+
signMessage: async ({ message })=>{
|
|
215
|
+
if (delegated) {
|
|
216
|
+
return delegatedSignMessage(delegated.delegatedClient, {
|
|
217
|
+
walletId: delegated.walletId,
|
|
218
|
+
walletApiKey: delegated.walletApiKey,
|
|
219
|
+
keyShare: delegated.keyShare,
|
|
220
|
+
message: message
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
const signature = await evmClient.signMessage({
|
|
224
|
+
message: message,
|
|
225
|
+
accountAddress,
|
|
226
|
+
password,
|
|
227
|
+
externalServerKeyShares
|
|
228
|
+
});
|
|
229
|
+
return signature;
|
|
230
|
+
},
|
|
231
|
+
signTypedData: async (typedData)=>{
|
|
232
|
+
if (delegated) {
|
|
233
|
+
return delegatedSignTypedData(delegated.delegatedClient, {
|
|
234
|
+
walletId: delegated.walletId,
|
|
235
|
+
walletApiKey: delegated.walletApiKey,
|
|
236
|
+
keyShare: delegated.keyShare,
|
|
237
|
+
typedData: typedData
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
return evmClient.signTypedData({
|
|
241
|
+
accountAddress,
|
|
242
|
+
typedData: typedData,
|
|
243
|
+
password: password,
|
|
244
|
+
externalServerKeyShares
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
signTransaction: async (transaction)=>{
|
|
248
|
+
if (delegated) {
|
|
249
|
+
return delegatedSignTransaction(delegated.delegatedClient, {
|
|
250
|
+
walletId: delegated.walletId,
|
|
251
|
+
walletApiKey: delegated.walletApiKey,
|
|
252
|
+
keyShare: delegated.keyShare,
|
|
253
|
+
transaction
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
const signedTx = await evmClient.signTransaction({
|
|
257
|
+
senderAddress: accountAddress,
|
|
258
|
+
transaction,
|
|
259
|
+
password,
|
|
260
|
+
externalServerKeyShares
|
|
261
|
+
});
|
|
262
|
+
return signedTx;
|
|
263
|
+
},
|
|
264
|
+
signAuthorization: async (authorization)=>{
|
|
265
|
+
if (delegated) {
|
|
266
|
+
const signature = await delegatedSignAuthorization(delegated.delegatedClient, {
|
|
267
|
+
walletId: delegated.walletId,
|
|
268
|
+
walletApiKey: delegated.walletApiKey,
|
|
269
|
+
keyShare: delegated.keyShare,
|
|
270
|
+
authorization
|
|
271
|
+
});
|
|
272
|
+
var _authorization_address;
|
|
273
|
+
const signedAuthorization = {
|
|
274
|
+
address: (_authorization_address = authorization.address) != null ? _authorization_address : authorization.contractAddress,
|
|
275
|
+
chainId: authorization.chainId,
|
|
276
|
+
nonce: authorization.nonce,
|
|
277
|
+
r: signature.r,
|
|
278
|
+
s: signature.s,
|
|
279
|
+
v: signature.v,
|
|
280
|
+
yParity: signature.yParity
|
|
281
|
+
};
|
|
282
|
+
return signedAuthorization;
|
|
283
|
+
}
|
|
284
|
+
const signature = await evmClient.signAuthorization({
|
|
285
|
+
authorization,
|
|
286
|
+
accountAddress,
|
|
287
|
+
password,
|
|
288
|
+
externalServerKeyShares
|
|
289
|
+
});
|
|
290
|
+
var _authorization_address1;
|
|
291
|
+
const signedAuthorization = {
|
|
292
|
+
address: (_authorization_address1 = authorization.address) != null ? _authorization_address1 : authorization.contractAddress,
|
|
293
|
+
chainId: authorization.chainId,
|
|
294
|
+
nonce: authorization.nonce,
|
|
295
|
+
r: signature.r,
|
|
296
|
+
s: signature.s,
|
|
297
|
+
v: signature.v,
|
|
298
|
+
yParity: signature.yParity
|
|
299
|
+
};
|
|
300
|
+
return signedAuthorization;
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
|
|
72
305
|
class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
73
306
|
get jwtAuthToken() {
|
|
74
307
|
return this.baseJWTAuthToken;
|
|
@@ -83,6 +316,45 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
83
316
|
transport: viem.http(rpcUrl)
|
|
84
317
|
});
|
|
85
318
|
}
|
|
319
|
+
async getWalletClient({ accountAddress, password, externalServerKeyShares, chain, chainId, rpcUrl }) {
|
|
320
|
+
const account = createAccountAdapter({
|
|
321
|
+
evmClient: this,
|
|
322
|
+
accountAddress: accountAddress,
|
|
323
|
+
password,
|
|
324
|
+
externalServerKeyShares
|
|
325
|
+
});
|
|
326
|
+
let viemChain;
|
|
327
|
+
if (chain) {
|
|
328
|
+
viemChain = chain;
|
|
329
|
+
} else if (chainId) {
|
|
330
|
+
if (!rpcUrl) {
|
|
331
|
+
throw new Error('rpcUrl is required when providing chainId. Please provide a valid RPC URL for the chain.');
|
|
332
|
+
}
|
|
333
|
+
viemChain = viem.defineChain({
|
|
334
|
+
id: chainId,
|
|
335
|
+
name: `Chain ${chainId}`,
|
|
336
|
+
nativeCurrency: {
|
|
337
|
+
name: 'Ether',
|
|
338
|
+
symbol: 'ETH',
|
|
339
|
+
decimals: 18
|
|
340
|
+
},
|
|
341
|
+
rpcUrls: {
|
|
342
|
+
default: {
|
|
343
|
+
http: [
|
|
344
|
+
rpcUrl
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
} else {
|
|
350
|
+
viemChain = chains.mainnet;
|
|
351
|
+
}
|
|
352
|
+
return viem.createWalletClient({
|
|
353
|
+
account,
|
|
354
|
+
chain: viemChain,
|
|
355
|
+
transport: viem.http(rpcUrl)
|
|
356
|
+
});
|
|
357
|
+
}
|
|
86
358
|
/**
|
|
87
359
|
* Creates a new wallet account and stores the key shares in the wallet map.
|
|
88
360
|
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
@@ -189,6 +461,9 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
189
461
|
throw new Error(ERROR_SIGN_MESSAGE);
|
|
190
462
|
}
|
|
191
463
|
}
|
|
464
|
+
isSignAuthorizationSupported() {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
192
467
|
async signAuthorization({ authorization, accountAddress, password = undefined, externalServerKeyShares, onError }) {
|
|
193
468
|
try {
|
|
194
469
|
if (!accountAddress) {
|
|
@@ -432,145 +707,6 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
432
707
|
}
|
|
433
708
|
}
|
|
434
709
|
|
|
435
|
-
/**
|
|
436
|
-
* Creates a delegated EVM wallet client for functional operations
|
|
437
|
-
*/ const createDelegatedEvmWalletClient = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug = false })=>{
|
|
438
|
-
const baseClient = node.createDelegatedWalletClient({
|
|
439
|
-
environmentId,
|
|
440
|
-
baseApiUrl,
|
|
441
|
-
baseMPCRelayApiUrl,
|
|
442
|
-
apiKey,
|
|
443
|
-
debug
|
|
444
|
-
});
|
|
445
|
-
const evmClient = _extends({}, baseClient, {
|
|
446
|
-
chainName: 'EVM'
|
|
447
|
-
});
|
|
448
|
-
return evmClient;
|
|
449
|
-
};
|
|
450
|
-
/**
|
|
451
|
-
* Signs a message using delegated signing for EVM
|
|
452
|
-
*/ const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
453
|
-
try {
|
|
454
|
-
if (!keyShare || !walletId || !walletApiKey) {
|
|
455
|
-
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
456
|
-
}
|
|
457
|
-
const formattedMessage = formatEVMMessage(message);
|
|
458
|
-
const resolvedContext = context != null ? context : {
|
|
459
|
-
evmMessage: message
|
|
460
|
-
};
|
|
461
|
-
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
462
|
-
walletId,
|
|
463
|
-
walletApiKey,
|
|
464
|
-
keyShare,
|
|
465
|
-
message: formattedMessage,
|
|
466
|
-
chainName: client.chainName,
|
|
467
|
-
context: resolvedContext,
|
|
468
|
-
onError
|
|
469
|
-
});
|
|
470
|
-
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
471
|
-
return serializedSignature;
|
|
472
|
-
} catch (error) {
|
|
473
|
-
client.logger.error('Error in delegatedSignMessage', error);
|
|
474
|
-
throw error;
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
/**
|
|
478
|
-
* Signs a transaction using delegated signing for EVM
|
|
479
|
-
*/ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
|
|
480
|
-
try {
|
|
481
|
-
// Serialize the transaction
|
|
482
|
-
const serializedTx = viem.serializeTransaction(transaction);
|
|
483
|
-
const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
|
|
484
|
-
if (!(serializedTxBytes instanceof Uint8Array)) {
|
|
485
|
-
throw new Error('Invalid serializedTxBytes');
|
|
486
|
-
}
|
|
487
|
-
// Use the delegated sign message function from node package
|
|
488
|
-
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
489
|
-
walletId,
|
|
490
|
-
walletApiKey,
|
|
491
|
-
keyShare,
|
|
492
|
-
message: serializedTxBytes,
|
|
493
|
-
chainName: client.chainName
|
|
494
|
-
});
|
|
495
|
-
if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
|
|
496
|
-
throw new Error('Invalid signature format returned from MPC signing');
|
|
497
|
-
}
|
|
498
|
-
// Construct the signed transaction
|
|
499
|
-
const r = `0x${Buffer.from(signatureEcdsa.r).toString('hex')}`;
|
|
500
|
-
const s = `0x${Buffer.from(signatureEcdsa.s).toString('hex')}`;
|
|
501
|
-
const v = BigInt(signatureEcdsa.v);
|
|
502
|
-
const signedTx = _extends({}, transaction, {
|
|
503
|
-
r: r,
|
|
504
|
-
s: s,
|
|
505
|
-
v: v
|
|
506
|
-
});
|
|
507
|
-
const serializedSignedTx = viem.serializeTransaction(signedTx);
|
|
508
|
-
return serializedSignedTx;
|
|
509
|
-
} catch (error) {
|
|
510
|
-
client.logger.error('Error in delegatedSignTransaction', error);
|
|
511
|
-
throw error;
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
/**
|
|
515
|
-
* Signs typed data using delegated signing for EVM
|
|
516
|
-
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData })=>{
|
|
517
|
-
try {
|
|
518
|
-
if (!keyShare || !walletId || !walletApiKey) {
|
|
519
|
-
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
520
|
-
}
|
|
521
|
-
const formattedTypedData = formatTypedData(typedData);
|
|
522
|
-
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
523
|
-
walletId,
|
|
524
|
-
walletApiKey,
|
|
525
|
-
keyShare,
|
|
526
|
-
message: formattedTypedData,
|
|
527
|
-
chainName: client.chainName,
|
|
528
|
-
isFormatted: true,
|
|
529
|
-
context: {
|
|
530
|
-
evmTypedData: typedData
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
534
|
-
return serializedSignature;
|
|
535
|
-
} catch (error) {
|
|
536
|
-
client.logger.error('Error in delegatedSignTypedData', error);
|
|
537
|
-
throw error;
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
/**
|
|
541
|
-
* Signs EIP-7702 authorization using delegated signing for EVM
|
|
542
|
-
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization })=>{
|
|
543
|
-
try {
|
|
544
|
-
if (!keyShare || !walletId || !walletApiKey) {
|
|
545
|
-
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
546
|
-
}
|
|
547
|
-
const digest = utils.hashAuthorization(authorization);
|
|
548
|
-
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
549
|
-
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
550
|
-
walletId,
|
|
551
|
-
walletApiKey,
|
|
552
|
-
keyShare,
|
|
553
|
-
message: prehashed,
|
|
554
|
-
chainName: client.chainName,
|
|
555
|
-
isFormatted: true,
|
|
556
|
-
context: {
|
|
557
|
-
eip7702Auth: authorization
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
561
|
-
const signature = viem.parseSignature(serializedSignature);
|
|
562
|
-
return signature;
|
|
563
|
-
} catch (error) {
|
|
564
|
-
client.logger.error('Error in delegatedSignAuthorization', error);
|
|
565
|
-
throw error;
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
/**
|
|
569
|
-
* Revoke delegation - delegates to the node package
|
|
570
|
-
*/ const revokeDelegation = async (client, params)=>{
|
|
571
|
-
return node.revokeDelegation(client, params);
|
|
572
|
-
};
|
|
573
|
-
|
|
574
710
|
const getJwtExpiration = (jwt)=>{
|
|
575
711
|
if (!jwt) {
|
|
576
712
|
return 0;
|
|
@@ -617,100 +753,6 @@ const createMemoryStorageAdapter = (jwt)=>{
|
|
|
617
753
|
return new MemoryStorageAdapter(jwt);
|
|
618
754
|
};
|
|
619
755
|
|
|
620
|
-
const createViemSignerAdapter = ({ evmClient, accountAddress, password, externalServerKeyShares, delegated })=>{
|
|
621
|
-
return accounts.toAccount({
|
|
622
|
-
address: accountAddress,
|
|
623
|
-
signMessage: async ({ message })=>{
|
|
624
|
-
if (delegated) {
|
|
625
|
-
return delegatedSignMessage(delegated.delegatedClient, {
|
|
626
|
-
walletId: delegated.walletId,
|
|
627
|
-
walletApiKey: delegated.walletApiKey,
|
|
628
|
-
keyShare: delegated.keyShare,
|
|
629
|
-
message: message
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
const signature = await evmClient.signMessage({
|
|
633
|
-
message: message,
|
|
634
|
-
accountAddress,
|
|
635
|
-
password,
|
|
636
|
-
externalServerKeyShares
|
|
637
|
-
});
|
|
638
|
-
return signature;
|
|
639
|
-
},
|
|
640
|
-
signTypedData: async (typedData)=>{
|
|
641
|
-
if (delegated) {
|
|
642
|
-
return delegatedSignTypedData(delegated.delegatedClient, {
|
|
643
|
-
walletId: delegated.walletId,
|
|
644
|
-
walletApiKey: delegated.walletApiKey,
|
|
645
|
-
keyShare: delegated.keyShare,
|
|
646
|
-
typedData: typedData
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
return evmClient.signTypedData({
|
|
650
|
-
accountAddress,
|
|
651
|
-
typedData: typedData,
|
|
652
|
-
password: password,
|
|
653
|
-
externalServerKeyShares
|
|
654
|
-
});
|
|
655
|
-
},
|
|
656
|
-
signTransaction: async (transaction)=>{
|
|
657
|
-
if (delegated) {
|
|
658
|
-
return delegatedSignTransaction(delegated.delegatedClient, {
|
|
659
|
-
walletId: delegated.walletId,
|
|
660
|
-
walletApiKey: delegated.walletApiKey,
|
|
661
|
-
keyShare: delegated.keyShare,
|
|
662
|
-
transaction
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
const signedTx = await evmClient.signTransaction({
|
|
666
|
-
senderAddress: accountAddress,
|
|
667
|
-
transaction,
|
|
668
|
-
password,
|
|
669
|
-
externalServerKeyShares
|
|
670
|
-
});
|
|
671
|
-
return signedTx;
|
|
672
|
-
},
|
|
673
|
-
signAuthorization: async (authorization)=>{
|
|
674
|
-
if (delegated) {
|
|
675
|
-
const signature = await delegatedSignAuthorization(delegated.delegatedClient, {
|
|
676
|
-
walletId: delegated.walletId,
|
|
677
|
-
walletApiKey: delegated.walletApiKey,
|
|
678
|
-
keyShare: delegated.keyShare,
|
|
679
|
-
authorization
|
|
680
|
-
});
|
|
681
|
-
var _authorization_address;
|
|
682
|
-
const signedAuthorization = {
|
|
683
|
-
address: (_authorization_address = authorization.address) != null ? _authorization_address : authorization.contractAddress,
|
|
684
|
-
chainId: authorization.chainId,
|
|
685
|
-
nonce: authorization.nonce,
|
|
686
|
-
r: signature.r,
|
|
687
|
-
s: signature.s,
|
|
688
|
-
v: signature.v,
|
|
689
|
-
yParity: signature.yParity
|
|
690
|
-
};
|
|
691
|
-
return signedAuthorization;
|
|
692
|
-
}
|
|
693
|
-
const signature = await evmClient.signAuthorization({
|
|
694
|
-
authorization,
|
|
695
|
-
accountAddress,
|
|
696
|
-
password,
|
|
697
|
-
externalServerKeyShares
|
|
698
|
-
});
|
|
699
|
-
var _authorization_address1;
|
|
700
|
-
const signedAuthorization = {
|
|
701
|
-
address: (_authorization_address1 = authorization.address) != null ? _authorization_address1 : authorization.contractAddress,
|
|
702
|
-
chainId: authorization.chainId,
|
|
703
|
-
nonce: authorization.nonce,
|
|
704
|
-
r: signature.r,
|
|
705
|
-
s: signature.s,
|
|
706
|
-
v: signature.v,
|
|
707
|
-
yParity: signature.yParity
|
|
708
|
-
};
|
|
709
|
-
return signedAuthorization;
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
};
|
|
713
|
-
|
|
714
756
|
class DynamicEvmZeroDevClient {
|
|
715
757
|
async initialize() {
|
|
716
758
|
await client.initializeClient(this.dynamicClient);
|
|
@@ -728,7 +770,7 @@ class DynamicEvmZeroDevClient {
|
|
|
728
770
|
return networkData;
|
|
729
771
|
}
|
|
730
772
|
async createKernelClientForAddress(options) {
|
|
731
|
-
const viemSigner =
|
|
773
|
+
const viemSigner = createAccountAdapter({
|
|
732
774
|
evmClient: this.evmClient,
|
|
733
775
|
accountAddress: options.address,
|
|
734
776
|
password: options.password,
|
|
@@ -856,6 +898,7 @@ exports.ERROR_SIGN_MESSAGE = ERROR_SIGN_MESSAGE;
|
|
|
856
898
|
exports.ERROR_SIGN_TYPED_DATA = ERROR_SIGN_TYPED_DATA;
|
|
857
899
|
exports.ERROR_VERIFY_MESSAGE_SIGNATURE = ERROR_VERIFY_MESSAGE_SIGNATURE;
|
|
858
900
|
exports.EVM_SIGN_MESSAGE_PREFIX = EVM_SIGN_MESSAGE_PREFIX;
|
|
901
|
+
exports.createAccountAdapter = createAccountAdapter;
|
|
859
902
|
exports.createDelegatedEvmWalletClient = createDelegatedEvmWalletClient;
|
|
860
903
|
exports.createZerodevClient = createZerodevClient;
|
|
861
904
|
exports.delegatedSignAuthorization = delegatedSignAuthorization;
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { toAccount } from 'viem/accounts';
|
|
2
|
+
import { MessageHash, createDelegatedWalletClient, delegatedSignMessage as delegatedSignMessage$1, revokeDelegation as revokeDelegation$1, DynamicWalletClient, getMPCChainConfig, getExternalServerKeyShareBackupInfo, WalletOperation } from '@dynamic-labs-wallet/node';
|
|
3
|
+
import { stringToHex, bytesToHex, size, concat, hashTypedData, serializeSignature, getAddress, serializeTransaction, parseSignature, createPublicClient, http, defineChain, createWalletClient } from 'viem';
|
|
4
4
|
import { hashAuthorization } from 'viem/utils';
|
|
5
|
+
import { mainnet } from 'viem/chains';
|
|
5
6
|
import { initializeClient, refreshUser, getNetworksData, createDynamicClient } from '@dynamic-labs-sdk/client';
|
|
6
7
|
import { assertDefined } from '@dynamic-labs-sdk/client/core';
|
|
7
8
|
import { mapNetworkDataToViemChain } from '@dynamic-labs-sdk/evm/viem';
|
|
@@ -10,7 +11,6 @@ import { addZerodevExtension } from '@dynamic-labs-sdk/zerodev';
|
|
|
10
11
|
import { getZerodevRpc, getPaymasterConfig, getZerodevProviderFromSettings, getEntryPoint, getKernelVersion, getEcdsaValidator } from '@dynamic-labs-sdk/zerodev/core';
|
|
11
12
|
import { createEcdsaKernelMigrationAccount } from '@zerodev/ecdsa-validator';
|
|
12
13
|
import { createKernelAccountClient, getUserOperationGasPrice, createKernelAccount, constants } from '@zerodev/sdk';
|
|
13
|
-
import { toAccount } from 'viem/accounts';
|
|
14
14
|
|
|
15
15
|
function _extends() {
|
|
16
16
|
_extends = Object.assign || function assign(target) {
|
|
@@ -67,6 +67,239 @@ const deriveAccountAddress = ({ rawPublicKey })=>{
|
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Creates a delegated EVM wallet client for functional operations
|
|
72
|
+
*/ const createDelegatedEvmWalletClient = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug = false })=>{
|
|
73
|
+
const baseClient = createDelegatedWalletClient({
|
|
74
|
+
environmentId,
|
|
75
|
+
baseApiUrl,
|
|
76
|
+
baseMPCRelayApiUrl,
|
|
77
|
+
apiKey,
|
|
78
|
+
debug
|
|
79
|
+
});
|
|
80
|
+
const evmClient = _extends({}, baseClient, {
|
|
81
|
+
chainName: 'EVM'
|
|
82
|
+
});
|
|
83
|
+
return evmClient;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Signs a message using delegated signing for EVM
|
|
87
|
+
*/ const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
88
|
+
try {
|
|
89
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
90
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
91
|
+
}
|
|
92
|
+
const formattedMessage = formatEVMMessage(message);
|
|
93
|
+
const resolvedContext = context != null ? context : {
|
|
94
|
+
evmMessage: message
|
|
95
|
+
};
|
|
96
|
+
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
97
|
+
walletId,
|
|
98
|
+
walletApiKey,
|
|
99
|
+
keyShare,
|
|
100
|
+
message: formattedMessage,
|
|
101
|
+
chainName: client.chainName,
|
|
102
|
+
context: resolvedContext,
|
|
103
|
+
onError
|
|
104
|
+
});
|
|
105
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
106
|
+
return serializedSignature;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
client.logger.error('Error in delegatedSignMessage', error);
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Signs a transaction using delegated signing for EVM
|
|
114
|
+
*/ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
|
|
115
|
+
try {
|
|
116
|
+
// Serialize the transaction
|
|
117
|
+
const serializedTx = serializeTransaction(transaction);
|
|
118
|
+
const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
|
|
119
|
+
if (!(serializedTxBytes instanceof Uint8Array)) {
|
|
120
|
+
throw new Error('Invalid serializedTxBytes');
|
|
121
|
+
}
|
|
122
|
+
// Use the delegated sign message function from node package
|
|
123
|
+
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
124
|
+
walletId,
|
|
125
|
+
walletApiKey,
|
|
126
|
+
keyShare,
|
|
127
|
+
message: serializedTxBytes,
|
|
128
|
+
chainName: client.chainName
|
|
129
|
+
});
|
|
130
|
+
if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
|
|
131
|
+
throw new Error('Invalid signature format returned from MPC signing');
|
|
132
|
+
}
|
|
133
|
+
// Construct the signed transaction
|
|
134
|
+
const r = `0x${Buffer.from(signatureEcdsa.r).toString('hex')}`;
|
|
135
|
+
const s = `0x${Buffer.from(signatureEcdsa.s).toString('hex')}`;
|
|
136
|
+
const v = BigInt(signatureEcdsa.v);
|
|
137
|
+
const signedTx = _extends({}, transaction, {
|
|
138
|
+
r: r,
|
|
139
|
+
s: s,
|
|
140
|
+
v: v
|
|
141
|
+
});
|
|
142
|
+
const serializedSignedTx = serializeTransaction(signedTx);
|
|
143
|
+
return serializedSignedTx;
|
|
144
|
+
} catch (error) {
|
|
145
|
+
client.logger.error('Error in delegatedSignTransaction', error);
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Signs typed data using delegated signing for EVM
|
|
151
|
+
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData })=>{
|
|
152
|
+
try {
|
|
153
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
154
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
155
|
+
}
|
|
156
|
+
const formattedTypedData = formatTypedData(typedData);
|
|
157
|
+
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
158
|
+
walletId,
|
|
159
|
+
walletApiKey,
|
|
160
|
+
keyShare,
|
|
161
|
+
message: formattedTypedData,
|
|
162
|
+
chainName: client.chainName,
|
|
163
|
+
isFormatted: true,
|
|
164
|
+
context: {
|
|
165
|
+
evmTypedData: typedData
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
169
|
+
return serializedSignature;
|
|
170
|
+
} catch (error) {
|
|
171
|
+
client.logger.error('Error in delegatedSignTypedData', error);
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Signs EIP-7702 authorization using delegated signing for EVM
|
|
177
|
+
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization })=>{
|
|
178
|
+
try {
|
|
179
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
180
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
181
|
+
}
|
|
182
|
+
const digest = hashAuthorization(authorization);
|
|
183
|
+
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
184
|
+
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
185
|
+
walletId,
|
|
186
|
+
walletApiKey,
|
|
187
|
+
keyShare,
|
|
188
|
+
message: prehashed,
|
|
189
|
+
chainName: client.chainName,
|
|
190
|
+
isFormatted: true,
|
|
191
|
+
context: {
|
|
192
|
+
eip7702Auth: authorization
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
196
|
+
const signature = parseSignature(serializedSignature);
|
|
197
|
+
return signature;
|
|
198
|
+
} catch (error) {
|
|
199
|
+
client.logger.error('Error in delegatedSignAuthorization', error);
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Revoke delegation - delegates to the node package
|
|
205
|
+
*/ const revokeDelegation = async (client, params)=>{
|
|
206
|
+
return revokeDelegation$1(client, params);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const createAccountAdapter = ({ evmClient, accountAddress, password, externalServerKeyShares, delegated })=>{
|
|
210
|
+
return toAccount({
|
|
211
|
+
address: accountAddress,
|
|
212
|
+
signMessage: async ({ message })=>{
|
|
213
|
+
if (delegated) {
|
|
214
|
+
return delegatedSignMessage(delegated.delegatedClient, {
|
|
215
|
+
walletId: delegated.walletId,
|
|
216
|
+
walletApiKey: delegated.walletApiKey,
|
|
217
|
+
keyShare: delegated.keyShare,
|
|
218
|
+
message: message
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
const signature = await evmClient.signMessage({
|
|
222
|
+
message: message,
|
|
223
|
+
accountAddress,
|
|
224
|
+
password,
|
|
225
|
+
externalServerKeyShares
|
|
226
|
+
});
|
|
227
|
+
return signature;
|
|
228
|
+
},
|
|
229
|
+
signTypedData: async (typedData)=>{
|
|
230
|
+
if (delegated) {
|
|
231
|
+
return delegatedSignTypedData(delegated.delegatedClient, {
|
|
232
|
+
walletId: delegated.walletId,
|
|
233
|
+
walletApiKey: delegated.walletApiKey,
|
|
234
|
+
keyShare: delegated.keyShare,
|
|
235
|
+
typedData: typedData
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return evmClient.signTypedData({
|
|
239
|
+
accountAddress,
|
|
240
|
+
typedData: typedData,
|
|
241
|
+
password: password,
|
|
242
|
+
externalServerKeyShares
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
signTransaction: async (transaction)=>{
|
|
246
|
+
if (delegated) {
|
|
247
|
+
return delegatedSignTransaction(delegated.delegatedClient, {
|
|
248
|
+
walletId: delegated.walletId,
|
|
249
|
+
walletApiKey: delegated.walletApiKey,
|
|
250
|
+
keyShare: delegated.keyShare,
|
|
251
|
+
transaction
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
const signedTx = await evmClient.signTransaction({
|
|
255
|
+
senderAddress: accountAddress,
|
|
256
|
+
transaction,
|
|
257
|
+
password,
|
|
258
|
+
externalServerKeyShares
|
|
259
|
+
});
|
|
260
|
+
return signedTx;
|
|
261
|
+
},
|
|
262
|
+
signAuthorization: async (authorization)=>{
|
|
263
|
+
if (delegated) {
|
|
264
|
+
const signature = await delegatedSignAuthorization(delegated.delegatedClient, {
|
|
265
|
+
walletId: delegated.walletId,
|
|
266
|
+
walletApiKey: delegated.walletApiKey,
|
|
267
|
+
keyShare: delegated.keyShare,
|
|
268
|
+
authorization
|
|
269
|
+
});
|
|
270
|
+
var _authorization_address;
|
|
271
|
+
const signedAuthorization = {
|
|
272
|
+
address: (_authorization_address = authorization.address) != null ? _authorization_address : authorization.contractAddress,
|
|
273
|
+
chainId: authorization.chainId,
|
|
274
|
+
nonce: authorization.nonce,
|
|
275
|
+
r: signature.r,
|
|
276
|
+
s: signature.s,
|
|
277
|
+
v: signature.v,
|
|
278
|
+
yParity: signature.yParity
|
|
279
|
+
};
|
|
280
|
+
return signedAuthorization;
|
|
281
|
+
}
|
|
282
|
+
const signature = await evmClient.signAuthorization({
|
|
283
|
+
authorization,
|
|
284
|
+
accountAddress,
|
|
285
|
+
password,
|
|
286
|
+
externalServerKeyShares
|
|
287
|
+
});
|
|
288
|
+
var _authorization_address1;
|
|
289
|
+
const signedAuthorization = {
|
|
290
|
+
address: (_authorization_address1 = authorization.address) != null ? _authorization_address1 : authorization.contractAddress,
|
|
291
|
+
chainId: authorization.chainId,
|
|
292
|
+
nonce: authorization.nonce,
|
|
293
|
+
r: signature.r,
|
|
294
|
+
s: signature.s,
|
|
295
|
+
v: signature.v,
|
|
296
|
+
yParity: signature.yParity
|
|
297
|
+
};
|
|
298
|
+
return signedAuthorization;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
|
|
70
303
|
class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
71
304
|
get jwtAuthToken() {
|
|
72
305
|
return this.baseJWTAuthToken;
|
|
@@ -81,6 +314,45 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
81
314
|
transport: http(rpcUrl)
|
|
82
315
|
});
|
|
83
316
|
}
|
|
317
|
+
async getWalletClient({ accountAddress, password, externalServerKeyShares, chain, chainId, rpcUrl }) {
|
|
318
|
+
const account = createAccountAdapter({
|
|
319
|
+
evmClient: this,
|
|
320
|
+
accountAddress: accountAddress,
|
|
321
|
+
password,
|
|
322
|
+
externalServerKeyShares
|
|
323
|
+
});
|
|
324
|
+
let viemChain;
|
|
325
|
+
if (chain) {
|
|
326
|
+
viemChain = chain;
|
|
327
|
+
} else if (chainId) {
|
|
328
|
+
if (!rpcUrl) {
|
|
329
|
+
throw new Error('rpcUrl is required when providing chainId. Please provide a valid RPC URL for the chain.');
|
|
330
|
+
}
|
|
331
|
+
viemChain = defineChain({
|
|
332
|
+
id: chainId,
|
|
333
|
+
name: `Chain ${chainId}`,
|
|
334
|
+
nativeCurrency: {
|
|
335
|
+
name: 'Ether',
|
|
336
|
+
symbol: 'ETH',
|
|
337
|
+
decimals: 18
|
|
338
|
+
},
|
|
339
|
+
rpcUrls: {
|
|
340
|
+
default: {
|
|
341
|
+
http: [
|
|
342
|
+
rpcUrl
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
} else {
|
|
348
|
+
viemChain = mainnet;
|
|
349
|
+
}
|
|
350
|
+
return createWalletClient({
|
|
351
|
+
account,
|
|
352
|
+
chain: viemChain,
|
|
353
|
+
transport: http(rpcUrl)
|
|
354
|
+
});
|
|
355
|
+
}
|
|
84
356
|
/**
|
|
85
357
|
* Creates a new wallet account and stores the key shares in the wallet map.
|
|
86
358
|
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
@@ -187,6 +459,9 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
187
459
|
throw new Error(ERROR_SIGN_MESSAGE);
|
|
188
460
|
}
|
|
189
461
|
}
|
|
462
|
+
isSignAuthorizationSupported() {
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
190
465
|
async signAuthorization({ authorization, accountAddress, password = undefined, externalServerKeyShares, onError }) {
|
|
191
466
|
try {
|
|
192
467
|
if (!accountAddress) {
|
|
@@ -430,145 +705,6 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
430
705
|
}
|
|
431
706
|
}
|
|
432
707
|
|
|
433
|
-
/**
|
|
434
|
-
* Creates a delegated EVM wallet client for functional operations
|
|
435
|
-
*/ const createDelegatedEvmWalletClient = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug = false })=>{
|
|
436
|
-
const baseClient = createDelegatedWalletClient({
|
|
437
|
-
environmentId,
|
|
438
|
-
baseApiUrl,
|
|
439
|
-
baseMPCRelayApiUrl,
|
|
440
|
-
apiKey,
|
|
441
|
-
debug
|
|
442
|
-
});
|
|
443
|
-
const evmClient = _extends({}, baseClient, {
|
|
444
|
-
chainName: 'EVM'
|
|
445
|
-
});
|
|
446
|
-
return evmClient;
|
|
447
|
-
};
|
|
448
|
-
/**
|
|
449
|
-
* Signs a message using delegated signing for EVM
|
|
450
|
-
*/ const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
451
|
-
try {
|
|
452
|
-
if (!keyShare || !walletId || !walletApiKey) {
|
|
453
|
-
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
454
|
-
}
|
|
455
|
-
const formattedMessage = formatEVMMessage(message);
|
|
456
|
-
const resolvedContext = context != null ? context : {
|
|
457
|
-
evmMessage: message
|
|
458
|
-
};
|
|
459
|
-
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
460
|
-
walletId,
|
|
461
|
-
walletApiKey,
|
|
462
|
-
keyShare,
|
|
463
|
-
message: formattedMessage,
|
|
464
|
-
chainName: client.chainName,
|
|
465
|
-
context: resolvedContext,
|
|
466
|
-
onError
|
|
467
|
-
});
|
|
468
|
-
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
469
|
-
return serializedSignature;
|
|
470
|
-
} catch (error) {
|
|
471
|
-
client.logger.error('Error in delegatedSignMessage', error);
|
|
472
|
-
throw error;
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
/**
|
|
476
|
-
* Signs a transaction using delegated signing for EVM
|
|
477
|
-
*/ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
|
|
478
|
-
try {
|
|
479
|
-
// Serialize the transaction
|
|
480
|
-
const serializedTx = serializeTransaction(transaction);
|
|
481
|
-
const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
|
|
482
|
-
if (!(serializedTxBytes instanceof Uint8Array)) {
|
|
483
|
-
throw new Error('Invalid serializedTxBytes');
|
|
484
|
-
}
|
|
485
|
-
// Use the delegated sign message function from node package
|
|
486
|
-
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
487
|
-
walletId,
|
|
488
|
-
walletApiKey,
|
|
489
|
-
keyShare,
|
|
490
|
-
message: serializedTxBytes,
|
|
491
|
-
chainName: client.chainName
|
|
492
|
-
});
|
|
493
|
-
if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
|
|
494
|
-
throw new Error('Invalid signature format returned from MPC signing');
|
|
495
|
-
}
|
|
496
|
-
// Construct the signed transaction
|
|
497
|
-
const r = `0x${Buffer.from(signatureEcdsa.r).toString('hex')}`;
|
|
498
|
-
const s = `0x${Buffer.from(signatureEcdsa.s).toString('hex')}`;
|
|
499
|
-
const v = BigInt(signatureEcdsa.v);
|
|
500
|
-
const signedTx = _extends({}, transaction, {
|
|
501
|
-
r: r,
|
|
502
|
-
s: s,
|
|
503
|
-
v: v
|
|
504
|
-
});
|
|
505
|
-
const serializedSignedTx = serializeTransaction(signedTx);
|
|
506
|
-
return serializedSignedTx;
|
|
507
|
-
} catch (error) {
|
|
508
|
-
client.logger.error('Error in delegatedSignTransaction', error);
|
|
509
|
-
throw error;
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
/**
|
|
513
|
-
* Signs typed data using delegated signing for EVM
|
|
514
|
-
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData })=>{
|
|
515
|
-
try {
|
|
516
|
-
if (!keyShare || !walletId || !walletApiKey) {
|
|
517
|
-
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
518
|
-
}
|
|
519
|
-
const formattedTypedData = formatTypedData(typedData);
|
|
520
|
-
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
521
|
-
walletId,
|
|
522
|
-
walletApiKey,
|
|
523
|
-
keyShare,
|
|
524
|
-
message: formattedTypedData,
|
|
525
|
-
chainName: client.chainName,
|
|
526
|
-
isFormatted: true,
|
|
527
|
-
context: {
|
|
528
|
-
evmTypedData: typedData
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
532
|
-
return serializedSignature;
|
|
533
|
-
} catch (error) {
|
|
534
|
-
client.logger.error('Error in delegatedSignTypedData', error);
|
|
535
|
-
throw error;
|
|
536
|
-
}
|
|
537
|
-
};
|
|
538
|
-
/**
|
|
539
|
-
* Signs EIP-7702 authorization using delegated signing for EVM
|
|
540
|
-
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization })=>{
|
|
541
|
-
try {
|
|
542
|
-
if (!keyShare || !walletId || !walletApiKey) {
|
|
543
|
-
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
544
|
-
}
|
|
545
|
-
const digest = hashAuthorization(authorization);
|
|
546
|
-
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
547
|
-
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
548
|
-
walletId,
|
|
549
|
-
walletApiKey,
|
|
550
|
-
keyShare,
|
|
551
|
-
message: prehashed,
|
|
552
|
-
chainName: client.chainName,
|
|
553
|
-
isFormatted: true,
|
|
554
|
-
context: {
|
|
555
|
-
eip7702Auth: authorization
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
559
|
-
const signature = parseSignature(serializedSignature);
|
|
560
|
-
return signature;
|
|
561
|
-
} catch (error) {
|
|
562
|
-
client.logger.error('Error in delegatedSignAuthorization', error);
|
|
563
|
-
throw error;
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
/**
|
|
567
|
-
* Revoke delegation - delegates to the node package
|
|
568
|
-
*/ const revokeDelegation = async (client, params)=>{
|
|
569
|
-
return revokeDelegation$1(client, params);
|
|
570
|
-
};
|
|
571
|
-
|
|
572
708
|
const getJwtExpiration = (jwt)=>{
|
|
573
709
|
if (!jwt) {
|
|
574
710
|
return 0;
|
|
@@ -615,100 +751,6 @@ const createMemoryStorageAdapter = (jwt)=>{
|
|
|
615
751
|
return new MemoryStorageAdapter(jwt);
|
|
616
752
|
};
|
|
617
753
|
|
|
618
|
-
const createViemSignerAdapter = ({ evmClient, accountAddress, password, externalServerKeyShares, delegated })=>{
|
|
619
|
-
return toAccount({
|
|
620
|
-
address: accountAddress,
|
|
621
|
-
signMessage: async ({ message })=>{
|
|
622
|
-
if (delegated) {
|
|
623
|
-
return delegatedSignMessage(delegated.delegatedClient, {
|
|
624
|
-
walletId: delegated.walletId,
|
|
625
|
-
walletApiKey: delegated.walletApiKey,
|
|
626
|
-
keyShare: delegated.keyShare,
|
|
627
|
-
message: message
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
const signature = await evmClient.signMessage({
|
|
631
|
-
message: message,
|
|
632
|
-
accountAddress,
|
|
633
|
-
password,
|
|
634
|
-
externalServerKeyShares
|
|
635
|
-
});
|
|
636
|
-
return signature;
|
|
637
|
-
},
|
|
638
|
-
signTypedData: async (typedData)=>{
|
|
639
|
-
if (delegated) {
|
|
640
|
-
return delegatedSignTypedData(delegated.delegatedClient, {
|
|
641
|
-
walletId: delegated.walletId,
|
|
642
|
-
walletApiKey: delegated.walletApiKey,
|
|
643
|
-
keyShare: delegated.keyShare,
|
|
644
|
-
typedData: typedData
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
return evmClient.signTypedData({
|
|
648
|
-
accountAddress,
|
|
649
|
-
typedData: typedData,
|
|
650
|
-
password: password,
|
|
651
|
-
externalServerKeyShares
|
|
652
|
-
});
|
|
653
|
-
},
|
|
654
|
-
signTransaction: async (transaction)=>{
|
|
655
|
-
if (delegated) {
|
|
656
|
-
return delegatedSignTransaction(delegated.delegatedClient, {
|
|
657
|
-
walletId: delegated.walletId,
|
|
658
|
-
walletApiKey: delegated.walletApiKey,
|
|
659
|
-
keyShare: delegated.keyShare,
|
|
660
|
-
transaction
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
const signedTx = await evmClient.signTransaction({
|
|
664
|
-
senderAddress: accountAddress,
|
|
665
|
-
transaction,
|
|
666
|
-
password,
|
|
667
|
-
externalServerKeyShares
|
|
668
|
-
});
|
|
669
|
-
return signedTx;
|
|
670
|
-
},
|
|
671
|
-
signAuthorization: async (authorization)=>{
|
|
672
|
-
if (delegated) {
|
|
673
|
-
const signature = await delegatedSignAuthorization(delegated.delegatedClient, {
|
|
674
|
-
walletId: delegated.walletId,
|
|
675
|
-
walletApiKey: delegated.walletApiKey,
|
|
676
|
-
keyShare: delegated.keyShare,
|
|
677
|
-
authorization
|
|
678
|
-
});
|
|
679
|
-
var _authorization_address;
|
|
680
|
-
const signedAuthorization = {
|
|
681
|
-
address: (_authorization_address = authorization.address) != null ? _authorization_address : authorization.contractAddress,
|
|
682
|
-
chainId: authorization.chainId,
|
|
683
|
-
nonce: authorization.nonce,
|
|
684
|
-
r: signature.r,
|
|
685
|
-
s: signature.s,
|
|
686
|
-
v: signature.v,
|
|
687
|
-
yParity: signature.yParity
|
|
688
|
-
};
|
|
689
|
-
return signedAuthorization;
|
|
690
|
-
}
|
|
691
|
-
const signature = await evmClient.signAuthorization({
|
|
692
|
-
authorization,
|
|
693
|
-
accountAddress,
|
|
694
|
-
password,
|
|
695
|
-
externalServerKeyShares
|
|
696
|
-
});
|
|
697
|
-
var _authorization_address1;
|
|
698
|
-
const signedAuthorization = {
|
|
699
|
-
address: (_authorization_address1 = authorization.address) != null ? _authorization_address1 : authorization.contractAddress,
|
|
700
|
-
chainId: authorization.chainId,
|
|
701
|
-
nonce: authorization.nonce,
|
|
702
|
-
r: signature.r,
|
|
703
|
-
s: signature.s,
|
|
704
|
-
v: signature.v,
|
|
705
|
-
yParity: signature.yParity
|
|
706
|
-
};
|
|
707
|
-
return signedAuthorization;
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
};
|
|
711
|
-
|
|
712
754
|
class DynamicEvmZeroDevClient {
|
|
713
755
|
async initialize() {
|
|
714
756
|
await initializeClient(this.dynamicClient);
|
|
@@ -726,7 +768,7 @@ class DynamicEvmZeroDevClient {
|
|
|
726
768
|
return networkData;
|
|
727
769
|
}
|
|
728
770
|
async createKernelClientForAddress(options) {
|
|
729
|
-
const viemSigner =
|
|
771
|
+
const viemSigner = createAccountAdapter({
|
|
730
772
|
evmClient: this.evmClient,
|
|
731
773
|
accountAddress: options.address,
|
|
732
774
|
password: options.password,
|
|
@@ -846,4 +888,4 @@ const createZerodevClient = async (evmClient)=>{
|
|
|
846
888
|
return client;
|
|
847
889
|
};
|
|
848
890
|
|
|
849
|
-
export { DynamicEvmWalletClient, ERROR_ACCOUNT_ADDRESS_REQUIRED, ERROR_CREATE_WALLET_ACCOUNT, ERROR_KEYGEN_FAILED, ERROR_SIGN_MESSAGE, ERROR_SIGN_TYPED_DATA, ERROR_VERIFY_MESSAGE_SIGNATURE, EVM_SIGN_MESSAGE_PREFIX, createDelegatedEvmWalletClient, createZerodevClient, delegatedSignAuthorization, delegatedSignMessage, delegatedSignTransaction, delegatedSignTypedData, deriveAccountAddress, formatEVMMessage, formatTypedData, revokeDelegation, serializeECDSASignature };
|
|
891
|
+
export { DynamicEvmWalletClient, ERROR_ACCOUNT_ADDRESS_REQUIRED, ERROR_CREATE_WALLET_ACCOUNT, ERROR_KEYGEN_FAILED, ERROR_SIGN_MESSAGE, ERROR_SIGN_TYPED_DATA, ERROR_VERIFY_MESSAGE_SIGNATURE, EVM_SIGN_MESSAGE_PREFIX, createAccountAdapter, createDelegatedEvmWalletClient, createZerodevClient, delegatedSignAuthorization, delegatedSignMessage, delegatedSignTransaction, delegatedSignTypedData, deriveAccountAddress, formatEVMMessage, formatTypedData, revokeDelegation, serializeECDSASignature };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node-evm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.197",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/node": "0.0.
|
|
7
|
+
"@dynamic-labs-wallet/node": "0.0.197",
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "^0.0.801",
|
|
9
9
|
"@dynamic-labs-sdk/client": "^0.1.0-alpha.22",
|
|
10
10
|
"@dynamic-labs-sdk/zerodev": "^0.1.0-alpha.22",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ServerKeyShare } from '@dynamic-labs-wallet/node';
|
|
2
2
|
import type { Account } from 'viem';
|
|
3
3
|
import { type createDelegatedEvmWalletClient } from '../delegatedClient.js';
|
|
4
|
-
import type { EvmClientBase } from '
|
|
5
|
-
export declare const
|
|
4
|
+
import type { EvmClientBase } from '../zerodev/types.js';
|
|
5
|
+
export declare const createAccountAdapter: ({ evmClient, accountAddress, password, externalServerKeyShares, delegated, }: {
|
|
6
6
|
evmClient: EvmClientBase;
|
|
7
7
|
accountAddress: `0x${string}`;
|
|
8
8
|
password?: string;
|
|
@@ -14,4 +14,4 @@ export declare const createViemSignerAdapter: ({ evmClient, accountAddress, pass
|
|
|
14
14
|
keyShare: ServerKeyShare;
|
|
15
15
|
};
|
|
16
16
|
}) => Account;
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=accountAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountAdapter.d.ts","sourceRoot":"","sources":["../../src/client/accountAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,MAAM,CAAC;AAGpD,OAAO,EACL,KAAK,8BAA8B,EAKpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAO,MAAM,oBAAoB,iFAM9B;IACD,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3C,SAAS,CAAC,EAAE;QACV,eAAe,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC;QACnE,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH,KAAG,OAsGH,CAAC"}
|
package/src/client/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DynamicWalletClient, type DynamicWalletClientProps, type EcdsaKeygenResult, type EcdsaPublicKey, type Ed25519KeygenResult, type ServerKeyShare, type ThresholdSignatureScheme } from '@dynamic-labs-wallet/node';
|
|
2
2
|
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
3
|
-
import { type Chain, type PublicClient, type SignableMessage, type TransactionSerializable, type TypedData } from 'viem';
|
|
3
|
+
import { type Account, type Chain, type PublicClient, type SignableMessage, type TransactionSerializable, type Transport, type TypedData, type WalletClient } from 'viem';
|
|
4
4
|
export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
5
5
|
readonly chainName = "EVM";
|
|
6
6
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, enableMPCAccelerator, }: DynamicWalletClientProps);
|
|
@@ -10,6 +10,14 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
10
10
|
chain: Chain;
|
|
11
11
|
rpcUrl?: string;
|
|
12
12
|
}): PublicClient;
|
|
13
|
+
getWalletClient({ accountAddress, password, externalServerKeyShares, chain, chainId, rpcUrl, }: {
|
|
14
|
+
accountAddress: string;
|
|
15
|
+
password?: string;
|
|
16
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
17
|
+
chain?: Chain;
|
|
18
|
+
chainId?: number;
|
|
19
|
+
rpcUrl?: string;
|
|
20
|
+
}): Promise<WalletClient<Transport, Chain, Account>>;
|
|
13
21
|
/**
|
|
14
22
|
* Creates a new wallet account and stores the key shares in the wallet map.
|
|
15
23
|
* @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
|
|
@@ -38,6 +46,7 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
38
46
|
context?: SignMessageContext;
|
|
39
47
|
onError?: (error: Error) => void;
|
|
40
48
|
}): Promise<`0x${string}`>;
|
|
49
|
+
isSignAuthorizationSupported(): boolean;
|
|
41
50
|
signAuthorization({ authorization, accountAddress, password, externalServerKeyShares, onError, }: {
|
|
42
51
|
authorization: any;
|
|
43
52
|
accountAddress: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEnB,KAAK,mBAAmB,EAGxB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EACL,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"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"}
|
package/src/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/zerodev/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/zerodev/client.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyC;IACvE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;gBAE9B,SAAS,EAAE,aAAa;IAsB9B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC;;OAEG;IACH,OAAO,CAAC,cAAc;IAehB,4BAA4B,CAChC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,YAAY,CAAC;YAuEV,mCAAmC;CAoElD;AAED,eAAO,MAAM,mBAAmB,cACnB,aAAa,KACvB,OAAO,CAAC,uBAAuB,CAMjC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viemSignerAdapter.d.ts","sourceRoot":"","sources":["../../src/zerodev/viemSignerAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,MAAM,CAAC;AAGpD,OAAO,EACL,KAAK,8BAA8B,EAKpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,eAAO,MAAM,uBAAuB,iFAMjC;IACD,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3C,SAAS,CAAC,EAAE;QACV,eAAe,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC;QACnE,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH,KAAG,OAsGH,CAAC"}
|