@dynamic-labs-wallet/node-evm 1.0.0-beta → 1.0.1
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 +32 -19
- package/index.esm.js +32 -19
- package/package.json +3 -3
- package/src/client/accountAdapter.d.ts +1 -0
- package/src/client/accountAdapter.d.ts.map +1 -1
- package/src/delegatedClient.d.ts +18 -6
- package/src/delegatedClient.d.ts.map +1 -1
- package/src/zerodev/types.d.ts +1 -0
- package/src/zerodev/types.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -81,14 +81,13 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
81
81
|
apiKey,
|
|
82
82
|
debug
|
|
83
83
|
});
|
|
84
|
-
|
|
84
|
+
return _extends({}, baseClient, {
|
|
85
85
|
chainName: 'EVM'
|
|
86
86
|
});
|
|
87
|
-
return evmClient;
|
|
88
87
|
};
|
|
89
88
|
/**
|
|
90
89
|
* Signs a message using delegated signing for EVM
|
|
91
|
-
*/ const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
90
|
+
*/ const delegatedSignMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, onError })=>{
|
|
92
91
|
try {
|
|
93
92
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
94
93
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
@@ -99,15 +98,16 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
99
98
|
};
|
|
100
99
|
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
101
100
|
walletId,
|
|
101
|
+
shareSetId,
|
|
102
102
|
walletApiKey,
|
|
103
103
|
keyShare,
|
|
104
104
|
message: formattedMessage,
|
|
105
105
|
chainName: client.chainName,
|
|
106
|
+
derivationPath,
|
|
106
107
|
context: resolvedContext,
|
|
107
108
|
onError
|
|
108
109
|
});
|
|
109
|
-
|
|
110
|
-
return serializedSignature;
|
|
110
|
+
return serializeECDSASignature(signatureEcdsa);
|
|
111
111
|
} catch (error) {
|
|
112
112
|
logError$1({
|
|
113
113
|
message: 'Error in delegatedSignMessage',
|
|
@@ -121,21 +121,25 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
121
121
|
};
|
|
122
122
|
/**
|
|
123
123
|
* Signs a transaction using delegated signing for EVM
|
|
124
|
-
*/ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
|
|
124
|
+
*/ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletApiKey, keyShare, transaction, derivationPath })=>{
|
|
125
125
|
try {
|
|
126
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
127
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a transaction');
|
|
128
|
+
}
|
|
126
129
|
// Serialize the transaction
|
|
127
130
|
const serializedTx = viem.serializeTransaction(transaction);
|
|
128
131
|
const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
|
|
129
132
|
if (!(serializedTxBytes instanceof Uint8Array)) {
|
|
130
133
|
throw new Error('Invalid serializedTxBytes');
|
|
131
134
|
}
|
|
132
|
-
// Use the delegated sign message function from node package
|
|
133
135
|
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
134
136
|
walletId,
|
|
137
|
+
shareSetId,
|
|
135
138
|
walletApiKey,
|
|
136
139
|
keyShare,
|
|
137
140
|
message: serializedTxBytes,
|
|
138
|
-
chainName: client.chainName
|
|
141
|
+
chainName: client.chainName,
|
|
142
|
+
derivationPath
|
|
139
143
|
});
|
|
140
144
|
if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
|
|
141
145
|
throw new Error('Invalid signature format returned from MPC signing');
|
|
@@ -149,8 +153,7 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
149
153
|
s: s,
|
|
150
154
|
v: v
|
|
151
155
|
});
|
|
152
|
-
|
|
153
|
-
return serializedSignedTx;
|
|
156
|
+
return viem.serializeTransaction(signedTx);
|
|
154
157
|
} catch (error) {
|
|
155
158
|
logError$1({
|
|
156
159
|
message: 'Error in delegatedSignTransaction',
|
|
@@ -164,7 +167,7 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
164
167
|
};
|
|
165
168
|
/**
|
|
166
169
|
* Signs typed data using delegated signing for EVM
|
|
167
|
-
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData })=>{
|
|
170
|
+
*/ const delegatedSignTypedData = async (client, { walletId, shareSetId, walletApiKey, keyShare, typedData, derivationPath })=>{
|
|
168
171
|
try {
|
|
169
172
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
170
173
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
@@ -172,17 +175,18 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
172
175
|
const formattedTypedData = formatTypedData(typedData);
|
|
173
176
|
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
174
177
|
walletId,
|
|
178
|
+
shareSetId,
|
|
175
179
|
walletApiKey,
|
|
176
180
|
keyShare,
|
|
177
181
|
message: formattedTypedData,
|
|
178
182
|
chainName: client.chainName,
|
|
183
|
+
derivationPath,
|
|
179
184
|
isFormatted: true,
|
|
180
185
|
context: {
|
|
181
186
|
evmTypedData: typedData
|
|
182
187
|
}
|
|
183
188
|
});
|
|
184
|
-
|
|
185
|
-
return serializedSignature;
|
|
189
|
+
return serializeECDSASignature(signatureEcdsa);
|
|
186
190
|
} catch (error) {
|
|
187
191
|
logError$1({
|
|
188
192
|
message: 'Error in delegatedSignTypedData',
|
|
@@ -196,7 +200,7 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
196
200
|
};
|
|
197
201
|
/**
|
|
198
202
|
* Signs EIP-7702 authorization using delegated signing for EVM
|
|
199
|
-
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization })=>{
|
|
203
|
+
*/ const delegatedSignAuthorization = async (client, { walletId, shareSetId, walletApiKey, keyShare, authorization, derivationPath })=>{
|
|
200
204
|
try {
|
|
201
205
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
202
206
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
@@ -205,18 +209,19 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
205
209
|
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
206
210
|
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
207
211
|
walletId,
|
|
212
|
+
shareSetId,
|
|
208
213
|
walletApiKey,
|
|
209
214
|
keyShare,
|
|
210
215
|
message: prehashed,
|
|
211
216
|
chainName: client.chainName,
|
|
217
|
+
derivationPath,
|
|
212
218
|
isFormatted: true,
|
|
213
219
|
context: {
|
|
214
220
|
eip7702Auth: authorization
|
|
215
221
|
}
|
|
216
222
|
});
|
|
217
223
|
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
218
|
-
|
|
219
|
-
return signature;
|
|
224
|
+
return viem.parseSignature(serializedSignature);
|
|
220
225
|
} catch (error) {
|
|
221
226
|
logError$1({
|
|
222
227
|
message: 'Error in delegatedSignAuthorization',
|
|
@@ -231,7 +236,7 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
231
236
|
/**
|
|
232
237
|
* Signs a pre-formatted (raw) message using delegated signing for EVM.
|
|
233
238
|
* The message must be a hex string representing already-hashed data.
|
|
234
|
-
*/ const delegatedSignRawMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
239
|
+
*/ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, onError })=>{
|
|
235
240
|
try {
|
|
236
241
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
237
242
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a raw message');
|
|
@@ -239,10 +244,12 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
239
244
|
const prehashed = node.stripHexPrefix(message);
|
|
240
245
|
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
241
246
|
walletId,
|
|
247
|
+
shareSetId,
|
|
242
248
|
walletApiKey,
|
|
243
249
|
keyShare,
|
|
244
250
|
message: prehashed,
|
|
245
251
|
chainName: client.chainName,
|
|
252
|
+
derivationPath,
|
|
246
253
|
isFormatted: true,
|
|
247
254
|
context,
|
|
248
255
|
onError
|
|
@@ -261,8 +268,10 @@ const logError$1 = node.createLogError('node-evm');
|
|
|
261
268
|
};
|
|
262
269
|
/**
|
|
263
270
|
* Revoke delegation - delegates to the node package
|
|
264
|
-
*/ const revokeDelegation = async (client,
|
|
265
|
-
return node.revokeDelegation(client,
|
|
271
|
+
*/ const revokeDelegation = async (client, { walletId })=>{
|
|
272
|
+
return node.revokeDelegation(client, {
|
|
273
|
+
walletId
|
|
274
|
+
});
|
|
266
275
|
};
|
|
267
276
|
|
|
268
277
|
const createAccountAdapter = ({ evmClient, walletMetadata, password, externalServerKeyShares, delegated })=>{
|
|
@@ -272,6 +281,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
272
281
|
if (delegated) {
|
|
273
282
|
return delegatedSignMessage(delegated.delegatedClient, {
|
|
274
283
|
walletId: delegated.walletId,
|
|
284
|
+
shareSetId: delegated.shareSetId,
|
|
275
285
|
walletApiKey: delegated.walletApiKey,
|
|
276
286
|
keyShare: delegated.keyShare,
|
|
277
287
|
message: message
|
|
@@ -289,6 +299,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
289
299
|
if (delegated) {
|
|
290
300
|
return delegatedSignTypedData(delegated.delegatedClient, {
|
|
291
301
|
walletId: delegated.walletId,
|
|
302
|
+
shareSetId: delegated.shareSetId,
|
|
292
303
|
walletApiKey: delegated.walletApiKey,
|
|
293
304
|
keyShare: delegated.keyShare,
|
|
294
305
|
typedData: typedData
|
|
@@ -305,6 +316,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
305
316
|
if (delegated) {
|
|
306
317
|
return delegatedSignTransaction(delegated.delegatedClient, {
|
|
307
318
|
walletId: delegated.walletId,
|
|
319
|
+
shareSetId: delegated.shareSetId,
|
|
308
320
|
walletApiKey: delegated.walletApiKey,
|
|
309
321
|
keyShare: delegated.keyShare,
|
|
310
322
|
transaction
|
|
@@ -322,6 +334,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
322
334
|
if (delegated) {
|
|
323
335
|
const signature = await delegatedSignAuthorization(delegated.delegatedClient, {
|
|
324
336
|
walletId: delegated.walletId,
|
|
337
|
+
shareSetId: delegated.shareSetId,
|
|
325
338
|
walletApiKey: delegated.walletApiKey,
|
|
326
339
|
keyShare: delegated.keyShare,
|
|
327
340
|
authorization
|
package/index.esm.js
CHANGED
|
@@ -79,14 +79,13 @@ const logError$1 = createLogError('node-evm');
|
|
|
79
79
|
apiKey,
|
|
80
80
|
debug
|
|
81
81
|
});
|
|
82
|
-
|
|
82
|
+
return _extends({}, baseClient, {
|
|
83
83
|
chainName: 'EVM'
|
|
84
84
|
});
|
|
85
|
-
return evmClient;
|
|
86
85
|
};
|
|
87
86
|
/**
|
|
88
87
|
* Signs a message using delegated signing for EVM
|
|
89
|
-
*/ const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
88
|
+
*/ const delegatedSignMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, onError })=>{
|
|
90
89
|
try {
|
|
91
90
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
92
91
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
@@ -97,15 +96,16 @@ const logError$1 = createLogError('node-evm');
|
|
|
97
96
|
};
|
|
98
97
|
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
99
98
|
walletId,
|
|
99
|
+
shareSetId,
|
|
100
100
|
walletApiKey,
|
|
101
101
|
keyShare,
|
|
102
102
|
message: formattedMessage,
|
|
103
103
|
chainName: client.chainName,
|
|
104
|
+
derivationPath,
|
|
104
105
|
context: resolvedContext,
|
|
105
106
|
onError
|
|
106
107
|
});
|
|
107
|
-
|
|
108
|
-
return serializedSignature;
|
|
108
|
+
return serializeECDSASignature(signatureEcdsa);
|
|
109
109
|
} catch (error) {
|
|
110
110
|
logError$1({
|
|
111
111
|
message: 'Error in delegatedSignMessage',
|
|
@@ -119,21 +119,25 @@ const logError$1 = createLogError('node-evm');
|
|
|
119
119
|
};
|
|
120
120
|
/**
|
|
121
121
|
* Signs a transaction using delegated signing for EVM
|
|
122
|
-
*/ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
|
|
122
|
+
*/ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletApiKey, keyShare, transaction, derivationPath })=>{
|
|
123
123
|
try {
|
|
124
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
125
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a transaction');
|
|
126
|
+
}
|
|
124
127
|
// Serialize the transaction
|
|
125
128
|
const serializedTx = serializeTransaction(transaction);
|
|
126
129
|
const serializedTxBytes = Uint8Array.from(Buffer.from(serializedTx.slice(2), 'hex'));
|
|
127
130
|
if (!(serializedTxBytes instanceof Uint8Array)) {
|
|
128
131
|
throw new Error('Invalid serializedTxBytes');
|
|
129
132
|
}
|
|
130
|
-
// Use the delegated sign message function from node package
|
|
131
133
|
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
132
134
|
walletId,
|
|
135
|
+
shareSetId,
|
|
133
136
|
walletApiKey,
|
|
134
137
|
keyShare,
|
|
135
138
|
message: serializedTxBytes,
|
|
136
|
-
chainName: client.chainName
|
|
139
|
+
chainName: client.chainName,
|
|
140
|
+
derivationPath
|
|
137
141
|
});
|
|
138
142
|
if (!('r' in signatureEcdsa && 's' in signatureEcdsa && 'v' in signatureEcdsa)) {
|
|
139
143
|
throw new Error('Invalid signature format returned from MPC signing');
|
|
@@ -147,8 +151,7 @@ const logError$1 = createLogError('node-evm');
|
|
|
147
151
|
s: s,
|
|
148
152
|
v: v
|
|
149
153
|
});
|
|
150
|
-
|
|
151
|
-
return serializedSignedTx;
|
|
154
|
+
return serializeTransaction(signedTx);
|
|
152
155
|
} catch (error) {
|
|
153
156
|
logError$1({
|
|
154
157
|
message: 'Error in delegatedSignTransaction',
|
|
@@ -162,7 +165,7 @@ const logError$1 = createLogError('node-evm');
|
|
|
162
165
|
};
|
|
163
166
|
/**
|
|
164
167
|
* Signs typed data using delegated signing for EVM
|
|
165
|
-
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData })=>{
|
|
168
|
+
*/ const delegatedSignTypedData = async (client, { walletId, shareSetId, walletApiKey, keyShare, typedData, derivationPath })=>{
|
|
166
169
|
try {
|
|
167
170
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
168
171
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
@@ -170,17 +173,18 @@ const logError$1 = createLogError('node-evm');
|
|
|
170
173
|
const formattedTypedData = formatTypedData(typedData);
|
|
171
174
|
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
172
175
|
walletId,
|
|
176
|
+
shareSetId,
|
|
173
177
|
walletApiKey,
|
|
174
178
|
keyShare,
|
|
175
179
|
message: formattedTypedData,
|
|
176
180
|
chainName: client.chainName,
|
|
181
|
+
derivationPath,
|
|
177
182
|
isFormatted: true,
|
|
178
183
|
context: {
|
|
179
184
|
evmTypedData: typedData
|
|
180
185
|
}
|
|
181
186
|
});
|
|
182
|
-
|
|
183
|
-
return serializedSignature;
|
|
187
|
+
return serializeECDSASignature(signatureEcdsa);
|
|
184
188
|
} catch (error) {
|
|
185
189
|
logError$1({
|
|
186
190
|
message: 'Error in delegatedSignTypedData',
|
|
@@ -194,7 +198,7 @@ const logError$1 = createLogError('node-evm');
|
|
|
194
198
|
};
|
|
195
199
|
/**
|
|
196
200
|
* Signs EIP-7702 authorization using delegated signing for EVM
|
|
197
|
-
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization })=>{
|
|
201
|
+
*/ const delegatedSignAuthorization = async (client, { walletId, shareSetId, walletApiKey, keyShare, authorization, derivationPath })=>{
|
|
198
202
|
try {
|
|
199
203
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
200
204
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
@@ -203,18 +207,19 @@ const logError$1 = createLogError('node-evm');
|
|
|
203
207
|
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
204
208
|
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
205
209
|
walletId,
|
|
210
|
+
shareSetId,
|
|
206
211
|
walletApiKey,
|
|
207
212
|
keyShare,
|
|
208
213
|
message: prehashed,
|
|
209
214
|
chainName: client.chainName,
|
|
215
|
+
derivationPath,
|
|
210
216
|
isFormatted: true,
|
|
211
217
|
context: {
|
|
212
218
|
eip7702Auth: authorization
|
|
213
219
|
}
|
|
214
220
|
});
|
|
215
221
|
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
216
|
-
|
|
217
|
-
return signature;
|
|
222
|
+
return parseSignature(serializedSignature);
|
|
218
223
|
} catch (error) {
|
|
219
224
|
logError$1({
|
|
220
225
|
message: 'Error in delegatedSignAuthorization',
|
|
@@ -229,7 +234,7 @@ const logError$1 = createLogError('node-evm');
|
|
|
229
234
|
/**
|
|
230
235
|
* Signs a pre-formatted (raw) message using delegated signing for EVM.
|
|
231
236
|
* The message must be a hex string representing already-hashed data.
|
|
232
|
-
*/ const delegatedSignRawMessage = async (client, { walletId, walletApiKey, keyShare, message, context, onError })=>{
|
|
237
|
+
*/ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, onError })=>{
|
|
233
238
|
try {
|
|
234
239
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
235
240
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a raw message');
|
|
@@ -237,10 +242,12 @@ const logError$1 = createLogError('node-evm');
|
|
|
237
242
|
const prehashed = stripHexPrefix(message);
|
|
238
243
|
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
239
244
|
walletId,
|
|
245
|
+
shareSetId,
|
|
240
246
|
walletApiKey,
|
|
241
247
|
keyShare,
|
|
242
248
|
message: prehashed,
|
|
243
249
|
chainName: client.chainName,
|
|
250
|
+
derivationPath,
|
|
244
251
|
isFormatted: true,
|
|
245
252
|
context,
|
|
246
253
|
onError
|
|
@@ -259,8 +266,10 @@ const logError$1 = createLogError('node-evm');
|
|
|
259
266
|
};
|
|
260
267
|
/**
|
|
261
268
|
* Revoke delegation - delegates to the node package
|
|
262
|
-
*/ const revokeDelegation = async (client,
|
|
263
|
-
return revokeDelegation$1(client,
|
|
269
|
+
*/ const revokeDelegation = async (client, { walletId })=>{
|
|
270
|
+
return revokeDelegation$1(client, {
|
|
271
|
+
walletId
|
|
272
|
+
});
|
|
264
273
|
};
|
|
265
274
|
|
|
266
275
|
const createAccountAdapter = ({ evmClient, walletMetadata, password, externalServerKeyShares, delegated })=>{
|
|
@@ -270,6 +279,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
270
279
|
if (delegated) {
|
|
271
280
|
return delegatedSignMessage(delegated.delegatedClient, {
|
|
272
281
|
walletId: delegated.walletId,
|
|
282
|
+
shareSetId: delegated.shareSetId,
|
|
273
283
|
walletApiKey: delegated.walletApiKey,
|
|
274
284
|
keyShare: delegated.keyShare,
|
|
275
285
|
message: message
|
|
@@ -287,6 +297,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
287
297
|
if (delegated) {
|
|
288
298
|
return delegatedSignTypedData(delegated.delegatedClient, {
|
|
289
299
|
walletId: delegated.walletId,
|
|
300
|
+
shareSetId: delegated.shareSetId,
|
|
290
301
|
walletApiKey: delegated.walletApiKey,
|
|
291
302
|
keyShare: delegated.keyShare,
|
|
292
303
|
typedData: typedData
|
|
@@ -303,6 +314,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
303
314
|
if (delegated) {
|
|
304
315
|
return delegatedSignTransaction(delegated.delegatedClient, {
|
|
305
316
|
walletId: delegated.walletId,
|
|
317
|
+
shareSetId: delegated.shareSetId,
|
|
306
318
|
walletApiKey: delegated.walletApiKey,
|
|
307
319
|
keyShare: delegated.keyShare,
|
|
308
320
|
transaction
|
|
@@ -320,6 +332,7 @@ const createAccountAdapter = ({ evmClient, walletMetadata, password, externalSer
|
|
|
320
332
|
if (delegated) {
|
|
321
333
|
const signature = await delegatedSignAuthorization(delegated.delegatedClient, {
|
|
322
334
|
walletId: delegated.walletId,
|
|
335
|
+
shareSetId: delegated.shareSetId,
|
|
323
336
|
walletApiKey: delegated.walletApiKey,
|
|
324
337
|
keyShare: delegated.keyShare,
|
|
325
338
|
authorization
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node-evm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/node": "1.0.
|
|
7
|
+
"@dynamic-labs-wallet/node": "1.0.1",
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "^0.0.984",
|
|
9
9
|
"@dynamic-labs-sdk/client": "0.3.0",
|
|
10
10
|
"@dynamic-labs-sdk/zerodev": "0.3.0",
|
|
11
11
|
"@dynamic-labs-sdk/evm": "0.3.0",
|
|
12
12
|
"@zerodev/ecdsa-validator": "5.4.9",
|
|
13
13
|
"@zerodev/sdk": "5.4.36",
|
|
14
|
-
"@dynamic-labs-wallet/core": "1.0.
|
|
14
|
+
"@dynamic-labs-wallet/core": "1.0.1"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|
|
@@ -10,6 +10,7 @@ export declare const createAccountAdapter: ({ evmClient, walletMetadata, passwor
|
|
|
10
10
|
delegated?: {
|
|
11
11
|
delegatedClient: ReturnType<typeof createDelegatedEvmWalletClient>;
|
|
12
12
|
walletId: string;
|
|
13
|
+
shareSetId: string;
|
|
13
14
|
walletApiKey: string;
|
|
14
15
|
keyShare: ServerKeyShare;
|
|
15
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountAdapter.d.ts","sourceRoot":"","sources":["../../src/client/accountAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChF,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,cAAc,CAAC;IAC/B,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,
|
|
1
|
+
{"version":3,"file":"accountAdapter.d.ts","sourceRoot":"","sources":["../../src/client/accountAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChF,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,cAAc,CAAC;IAC/B,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,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH,KAAG,OAiGH,CAAC"}
|
package/src/delegatedClient.d.ts
CHANGED
|
@@ -18,55 +18,67 @@ export declare const createDelegatedEvmWalletClient: ({ environmentId, baseApiUr
|
|
|
18
18
|
/**
|
|
19
19
|
* Signs a message using delegated signing for EVM
|
|
20
20
|
*/
|
|
21
|
-
export declare const delegatedSignMessage: (client: DelegatedEvmWalletClient, { walletId, walletApiKey, keyShare, message, context, onError, }: {
|
|
21
|
+
export declare const delegatedSignMessage: (client: DelegatedEvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, onError, }: {
|
|
22
22
|
walletId: string;
|
|
23
|
+
shareSetId: string;
|
|
23
24
|
walletApiKey: string;
|
|
24
25
|
keyShare: ServerKeyShare;
|
|
25
26
|
message: string;
|
|
27
|
+
derivationPath?: Uint32Array;
|
|
26
28
|
context?: SignMessageContext;
|
|
27
29
|
onError?: (error: Error) => void;
|
|
28
30
|
}) => Promise<string>;
|
|
29
31
|
/**
|
|
30
32
|
* Signs a transaction using delegated signing for EVM
|
|
31
33
|
*/
|
|
32
|
-
export declare const delegatedSignTransaction: (client: DelegatedEvmWalletClient, { walletId, walletApiKey, keyShare, transaction, }: {
|
|
34
|
+
export declare const delegatedSignTransaction: (client: DelegatedEvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, transaction, derivationPath, }: {
|
|
33
35
|
walletId: string;
|
|
36
|
+
shareSetId: string;
|
|
34
37
|
walletApiKey: string;
|
|
35
38
|
keyShare: ServerKeyShare;
|
|
36
39
|
transaction: TransactionSerializable;
|
|
40
|
+
derivationPath?: Uint32Array;
|
|
37
41
|
}) => Promise<string>;
|
|
38
42
|
/**
|
|
39
43
|
* Signs typed data using delegated signing for EVM
|
|
40
44
|
*/
|
|
41
|
-
export declare const delegatedSignTypedData: (client: DelegatedEvmWalletClient, { walletId, walletApiKey, keyShare, typedData, }: {
|
|
45
|
+
export declare const delegatedSignTypedData: (client: DelegatedEvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, typedData, derivationPath, }: {
|
|
42
46
|
walletId: string;
|
|
47
|
+
shareSetId: string;
|
|
43
48
|
walletApiKey: string;
|
|
44
49
|
keyShare: ServerKeyShare;
|
|
45
50
|
typedData: TypedData;
|
|
51
|
+
derivationPath?: Uint32Array;
|
|
46
52
|
}) => Promise<string>;
|
|
47
53
|
/**
|
|
48
54
|
* Signs EIP-7702 authorization using delegated signing for EVM
|
|
49
55
|
*/
|
|
50
|
-
export declare const delegatedSignAuthorization: (client: DelegatedEvmWalletClient, { walletId, walletApiKey, keyShare, authorization, }: {
|
|
56
|
+
export declare const delegatedSignAuthorization: (client: DelegatedEvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, authorization, derivationPath, }: {
|
|
51
57
|
walletId: string;
|
|
58
|
+
shareSetId: string;
|
|
52
59
|
walletApiKey: string;
|
|
53
60
|
keyShare: ServerKeyShare;
|
|
54
61
|
authorization: any;
|
|
62
|
+
derivationPath?: Uint32Array;
|
|
55
63
|
}) => Promise<any>;
|
|
56
64
|
/**
|
|
57
65
|
* Signs a pre-formatted (raw) message using delegated signing for EVM.
|
|
58
66
|
* The message must be a hex string representing already-hashed data.
|
|
59
67
|
*/
|
|
60
|
-
export declare const delegatedSignRawMessage: (client: DelegatedEvmWalletClient, { walletId, walletApiKey, keyShare, message, context, onError, }: {
|
|
68
|
+
export declare const delegatedSignRawMessage: (client: DelegatedEvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, onError, }: {
|
|
61
69
|
walletId: string;
|
|
70
|
+
shareSetId: string;
|
|
62
71
|
walletApiKey: string;
|
|
63
72
|
keyShare: ServerKeyShare;
|
|
64
73
|
message: string;
|
|
74
|
+
derivationPath?: Uint32Array;
|
|
65
75
|
context?: SignMessageContext;
|
|
66
76
|
onError?: (error: Error) => void;
|
|
67
77
|
}) => Promise<string>;
|
|
68
78
|
/**
|
|
69
79
|
* Revoke delegation - delegates to the node package
|
|
70
80
|
*/
|
|
71
|
-
export declare const revokeDelegation: (client: DelegatedEvmWalletClient,
|
|
81
|
+
export declare const revokeDelegation: (client: DelegatedEvmWalletClient, { walletId }: {
|
|
82
|
+
walletId: string;
|
|
83
|
+
}) => Promise<void>;
|
|
72
84
|
//# sourceMappingURL=delegatedClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegatedClient.d.ts","sourceRoot":"","sources":["../../packages/src/delegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAkB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAwC,KAAK,uBAAuB,EAAE,KAAK,SAAS,EAAE,MAAM,MAAM,CAAC;AAM1G,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,GAAG;IAC7D,QAAQ,CAAC,SAAS,EAAE,KAA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