@dynamic-labs-wallet/node-evm 0.0.0-beta.321 → 0.0.0-beta.323
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 +99 -10
- package/index.esm.js +97 -12
- package/package.json +2 -2
- package/src/client/client.d.ts +18 -1
- package/src/client/client.d.ts.map +1 -1
- package/src/client/constants.d.ts +1 -0
- package/src/client/constants.d.ts.map +1 -1
- package/src/delegatedClient.d.ts +22 -1
- package/src/delegatedClient.d.ts.map +1 -1
- package/src/utils.d.ts +4 -0
- package/src/utils.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -21,6 +21,7 @@ const EVM_SIGN_MESSAGE_PREFIX = `\x19Ethereum Signed Message:\n`;
|
|
|
21
21
|
const ERROR_KEYGEN_FAILED = 'Error with keygen';
|
|
22
22
|
const ERROR_CREATE_WALLET_ACCOUNT = 'Error creating evm wallet account';
|
|
23
23
|
const ERROR_SIGN_MESSAGE = 'Error signing message';
|
|
24
|
+
const ERROR_SIGN_TYPED_DATA = 'Error signing typed data';
|
|
24
25
|
const ERROR_ACCOUNT_ADDRESS_REQUIRED = 'Account address is required';
|
|
25
26
|
const ERROR_VERIFY_MESSAGE_SIGNATURE = 'Error verifying message signature';
|
|
26
27
|
|
|
@@ -36,6 +37,9 @@ const formatEVMMessage = (message_)=>{
|
|
|
36
37
|
message
|
|
37
38
|
]);
|
|
38
39
|
};
|
|
40
|
+
const formatTypedData = (typedData)=>{
|
|
41
|
+
return viem.hashTypedData(typedData).slice(2);
|
|
42
|
+
};
|
|
39
43
|
const serializeECDSASignature = (signature)=>{
|
|
40
44
|
return viem.serializeSignature({
|
|
41
45
|
r: `0x${Buffer.from(signature.r).toString('hex')}`,
|
|
@@ -166,9 +170,7 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
166
170
|
if (!accountAddress) {
|
|
167
171
|
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
168
172
|
}
|
|
169
|
-
console.log('authorization', authorization);
|
|
170
173
|
const digest = utils.hashAuthorization(authorization);
|
|
171
|
-
console.log('digest', digest);
|
|
172
174
|
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
173
175
|
const signatureEcdsa = await this.sign({
|
|
174
176
|
message: prehashed,
|
|
@@ -182,20 +184,39 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
182
184
|
},
|
|
183
185
|
onError
|
|
184
186
|
});
|
|
185
|
-
console.log('signatureEcdsa', signatureEcdsa);
|
|
186
187
|
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
authorization,
|
|
190
|
-
signature: serializedSignature
|
|
191
|
-
});
|
|
192
|
-
console.log('isVerified', isVerified);
|
|
193
|
-
return serializedSignature;
|
|
188
|
+
const signature = viem.parseSignature(serializedSignature);
|
|
189
|
+
return signature;
|
|
194
190
|
} catch (error) {
|
|
195
191
|
this.logger.error(ERROR_SIGN_MESSAGE, error);
|
|
196
192
|
throw new Error(ERROR_SIGN_MESSAGE);
|
|
197
193
|
}
|
|
198
194
|
}
|
|
195
|
+
async signTypedData({ accountAddress, typedData, password = undefined, externalServerKeyShares, onError }) {
|
|
196
|
+
try {
|
|
197
|
+
if (!accountAddress) {
|
|
198
|
+
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
199
|
+
}
|
|
200
|
+
const formattedTypedData = formatTypedData(typedData);
|
|
201
|
+
const signatureEcdsa = await this.sign({
|
|
202
|
+
message: formattedTypedData,
|
|
203
|
+
accountAddress: accountAddress,
|
|
204
|
+
chainName: this.chainName,
|
|
205
|
+
password,
|
|
206
|
+
externalServerKeyShares,
|
|
207
|
+
isFormatted: true,
|
|
208
|
+
context: {
|
|
209
|
+
evmTypedData: typedData
|
|
210
|
+
},
|
|
211
|
+
onError
|
|
212
|
+
});
|
|
213
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
214
|
+
return serializedSignature;
|
|
215
|
+
} catch (error) {
|
|
216
|
+
this.logger.error(ERROR_SIGN_TYPED_DATA, error);
|
|
217
|
+
throw new Error(ERROR_SIGN_TYPED_DATA);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
199
220
|
async verifyMessageSignature({ accountAddress, message, signature }) {
|
|
200
221
|
try {
|
|
201
222
|
// Verify the signature using the public client
|
|
@@ -433,6 +454,70 @@ class DynamicEvmWalletClient extends node.DynamicWalletClient {
|
|
|
433
454
|
throw error;
|
|
434
455
|
}
|
|
435
456
|
};
|
|
457
|
+
/**
|
|
458
|
+
* Signs an EIP-7702 authorization using delegated signing for EVM
|
|
459
|
+
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization, address, onError })=>{
|
|
460
|
+
try {
|
|
461
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
462
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
463
|
+
}
|
|
464
|
+
const digest = utils.hashAuthorization(authorization);
|
|
465
|
+
console.log('digest', digest);
|
|
466
|
+
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
467
|
+
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
468
|
+
walletId,
|
|
469
|
+
walletApiKey,
|
|
470
|
+
keyShare,
|
|
471
|
+
message: prehashed,
|
|
472
|
+
chainName: client.chainName,
|
|
473
|
+
isFormatted: true,
|
|
474
|
+
context: {
|
|
475
|
+
eip7702Auth: authorization
|
|
476
|
+
},
|
|
477
|
+
onError
|
|
478
|
+
});
|
|
479
|
+
console.log('signatureEcdsa', signatureEcdsa);
|
|
480
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
481
|
+
console.log('serializedSignature', serializedSignature);
|
|
482
|
+
const isVerified = await utils.verifyAuthorization({
|
|
483
|
+
address: address,
|
|
484
|
+
authorization,
|
|
485
|
+
signature: serializedSignature
|
|
486
|
+
});
|
|
487
|
+
console.log('isVerified', isVerified);
|
|
488
|
+
return serializedSignature;
|
|
489
|
+
} catch (error) {
|
|
490
|
+
client.logger.error('Error in delegatedSignAuthorization', error);
|
|
491
|
+
throw error;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Signs typed data using delegated signing for EVM
|
|
496
|
+
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData, onError })=>{
|
|
497
|
+
try {
|
|
498
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
499
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
500
|
+
}
|
|
501
|
+
const formattedTypedData = formatTypedData(typedData);
|
|
502
|
+
const signatureEcdsa = await node.delegatedSignMessage(client, {
|
|
503
|
+
walletId,
|
|
504
|
+
walletApiKey,
|
|
505
|
+
keyShare,
|
|
506
|
+
message: formattedTypedData,
|
|
507
|
+
chainName: client.chainName,
|
|
508
|
+
isFormatted: true,
|
|
509
|
+
context: {
|
|
510
|
+
evmTypedData: typedData
|
|
511
|
+
},
|
|
512
|
+
onError
|
|
513
|
+
});
|
|
514
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
515
|
+
return serializedSignature;
|
|
516
|
+
} catch (error) {
|
|
517
|
+
client.logger.error('Error in delegatedSignTypedData', error);
|
|
518
|
+
throw error;
|
|
519
|
+
}
|
|
520
|
+
};
|
|
436
521
|
/**
|
|
437
522
|
* Revoke delegation - delegates to the node package
|
|
438
523
|
*/ const revokeDelegation = async (client, params)=>{
|
|
@@ -444,12 +529,16 @@ exports.ERROR_ACCOUNT_ADDRESS_REQUIRED = ERROR_ACCOUNT_ADDRESS_REQUIRED;
|
|
|
444
529
|
exports.ERROR_CREATE_WALLET_ACCOUNT = ERROR_CREATE_WALLET_ACCOUNT;
|
|
445
530
|
exports.ERROR_KEYGEN_FAILED = ERROR_KEYGEN_FAILED;
|
|
446
531
|
exports.ERROR_SIGN_MESSAGE = ERROR_SIGN_MESSAGE;
|
|
532
|
+
exports.ERROR_SIGN_TYPED_DATA = ERROR_SIGN_TYPED_DATA;
|
|
447
533
|
exports.ERROR_VERIFY_MESSAGE_SIGNATURE = ERROR_VERIFY_MESSAGE_SIGNATURE;
|
|
448
534
|
exports.EVM_SIGN_MESSAGE_PREFIX = EVM_SIGN_MESSAGE_PREFIX;
|
|
449
535
|
exports.createDelegatedEvmWalletClient = createDelegatedEvmWalletClient;
|
|
536
|
+
exports.delegatedSignAuthorization = delegatedSignAuthorization;
|
|
450
537
|
exports.delegatedSignMessage = delegatedSignMessage;
|
|
451
538
|
exports.delegatedSignTransaction = delegatedSignTransaction;
|
|
539
|
+
exports.delegatedSignTypedData = delegatedSignTypedData;
|
|
452
540
|
exports.deriveAccountAddress = deriveAccountAddress;
|
|
453
541
|
exports.formatEVMMessage = formatEVMMessage;
|
|
542
|
+
exports.formatTypedData = formatTypedData;
|
|
454
543
|
exports.revokeDelegation = revokeDelegation;
|
|
455
544
|
exports.serializeECDSASignature = serializeECDSASignature;
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MessageHash, DynamicWalletClient, getMPCChainConfig, getExternalServerKeyShareBackupInfo, WalletOperation, createDelegatedWalletClient, delegatedSignMessage as delegatedSignMessage$1, revokeDelegation as revokeDelegation$1 } from '@dynamic-labs-wallet/node';
|
|
2
|
-
import { stringToHex, bytesToHex, size, concat, serializeSignature, getAddress, createPublicClient, http, serializeTransaction } from 'viem';
|
|
2
|
+
import { stringToHex, bytesToHex, size, concat, hashTypedData, serializeSignature, getAddress, createPublicClient, http, parseSignature, serializeTransaction } from 'viem';
|
|
3
3
|
import { mainnet } from 'viem/chains';
|
|
4
4
|
import { hashAuthorization, verifyAuthorization } from 'viem/utils';
|
|
5
5
|
|
|
@@ -19,6 +19,7 @@ const EVM_SIGN_MESSAGE_PREFIX = `\x19Ethereum Signed Message:\n`;
|
|
|
19
19
|
const ERROR_KEYGEN_FAILED = 'Error with keygen';
|
|
20
20
|
const ERROR_CREATE_WALLET_ACCOUNT = 'Error creating evm wallet account';
|
|
21
21
|
const ERROR_SIGN_MESSAGE = 'Error signing message';
|
|
22
|
+
const ERROR_SIGN_TYPED_DATA = 'Error signing typed data';
|
|
22
23
|
const ERROR_ACCOUNT_ADDRESS_REQUIRED = 'Account address is required';
|
|
23
24
|
const ERROR_VERIFY_MESSAGE_SIGNATURE = 'Error verifying message signature';
|
|
24
25
|
|
|
@@ -34,6 +35,9 @@ const formatEVMMessage = (message_)=>{
|
|
|
34
35
|
message
|
|
35
36
|
]);
|
|
36
37
|
};
|
|
38
|
+
const formatTypedData = (typedData)=>{
|
|
39
|
+
return hashTypedData(typedData).slice(2);
|
|
40
|
+
};
|
|
37
41
|
const serializeECDSASignature = (signature)=>{
|
|
38
42
|
return serializeSignature({
|
|
39
43
|
r: `0x${Buffer.from(signature.r).toString('hex')}`,
|
|
@@ -164,9 +168,7 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
164
168
|
if (!accountAddress) {
|
|
165
169
|
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
166
170
|
}
|
|
167
|
-
console.log('authorization', authorization);
|
|
168
171
|
const digest = hashAuthorization(authorization);
|
|
169
|
-
console.log('digest', digest);
|
|
170
172
|
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
171
173
|
const signatureEcdsa = await this.sign({
|
|
172
174
|
message: prehashed,
|
|
@@ -180,20 +182,39 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
180
182
|
},
|
|
181
183
|
onError
|
|
182
184
|
});
|
|
183
|
-
console.log('signatureEcdsa', signatureEcdsa);
|
|
184
185
|
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
authorization,
|
|
188
|
-
signature: serializedSignature
|
|
189
|
-
});
|
|
190
|
-
console.log('isVerified', isVerified);
|
|
191
|
-
return serializedSignature;
|
|
186
|
+
const signature = parseSignature(serializedSignature);
|
|
187
|
+
return signature;
|
|
192
188
|
} catch (error) {
|
|
193
189
|
this.logger.error(ERROR_SIGN_MESSAGE, error);
|
|
194
190
|
throw new Error(ERROR_SIGN_MESSAGE);
|
|
195
191
|
}
|
|
196
192
|
}
|
|
193
|
+
async signTypedData({ accountAddress, typedData, password = undefined, externalServerKeyShares, onError }) {
|
|
194
|
+
try {
|
|
195
|
+
if (!accountAddress) {
|
|
196
|
+
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
197
|
+
}
|
|
198
|
+
const formattedTypedData = formatTypedData(typedData);
|
|
199
|
+
const signatureEcdsa = await this.sign({
|
|
200
|
+
message: formattedTypedData,
|
|
201
|
+
accountAddress: accountAddress,
|
|
202
|
+
chainName: this.chainName,
|
|
203
|
+
password,
|
|
204
|
+
externalServerKeyShares,
|
|
205
|
+
isFormatted: true,
|
|
206
|
+
context: {
|
|
207
|
+
evmTypedData: typedData
|
|
208
|
+
},
|
|
209
|
+
onError
|
|
210
|
+
});
|
|
211
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
212
|
+
return serializedSignature;
|
|
213
|
+
} catch (error) {
|
|
214
|
+
this.logger.error(ERROR_SIGN_TYPED_DATA, error);
|
|
215
|
+
throw new Error(ERROR_SIGN_TYPED_DATA);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
197
218
|
async verifyMessageSignature({ accountAddress, message, signature }) {
|
|
198
219
|
try {
|
|
199
220
|
// Verify the signature using the public client
|
|
@@ -431,10 +452,74 @@ class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
431
452
|
throw error;
|
|
432
453
|
}
|
|
433
454
|
};
|
|
455
|
+
/**
|
|
456
|
+
* Signs an EIP-7702 authorization using delegated signing for EVM
|
|
457
|
+
*/ const delegatedSignAuthorization = async (client, { walletId, walletApiKey, keyShare, authorization, address, onError })=>{
|
|
458
|
+
try {
|
|
459
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
460
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign authorization');
|
|
461
|
+
}
|
|
462
|
+
const digest = hashAuthorization(authorization);
|
|
463
|
+
console.log('digest', digest);
|
|
464
|
+
const prehashed = digest.startsWith('0x') ? digest.slice(2) : digest;
|
|
465
|
+
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
466
|
+
walletId,
|
|
467
|
+
walletApiKey,
|
|
468
|
+
keyShare,
|
|
469
|
+
message: prehashed,
|
|
470
|
+
chainName: client.chainName,
|
|
471
|
+
isFormatted: true,
|
|
472
|
+
context: {
|
|
473
|
+
eip7702Auth: authorization
|
|
474
|
+
},
|
|
475
|
+
onError
|
|
476
|
+
});
|
|
477
|
+
console.log('signatureEcdsa', signatureEcdsa);
|
|
478
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
479
|
+
console.log('serializedSignature', serializedSignature);
|
|
480
|
+
const isVerified = await verifyAuthorization({
|
|
481
|
+
address: address,
|
|
482
|
+
authorization,
|
|
483
|
+
signature: serializedSignature
|
|
484
|
+
});
|
|
485
|
+
console.log('isVerified', isVerified);
|
|
486
|
+
return serializedSignature;
|
|
487
|
+
} catch (error) {
|
|
488
|
+
client.logger.error('Error in delegatedSignAuthorization', error);
|
|
489
|
+
throw error;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* Signs typed data using delegated signing for EVM
|
|
494
|
+
*/ const delegatedSignTypedData = async (client, { walletId, walletApiKey, keyShare, typedData, onError })=>{
|
|
495
|
+
try {
|
|
496
|
+
if (!keyShare || !walletId || !walletApiKey) {
|
|
497
|
+
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign typed data');
|
|
498
|
+
}
|
|
499
|
+
const formattedTypedData = formatTypedData(typedData);
|
|
500
|
+
const signatureEcdsa = await delegatedSignMessage$1(client, {
|
|
501
|
+
walletId,
|
|
502
|
+
walletApiKey,
|
|
503
|
+
keyShare,
|
|
504
|
+
message: formattedTypedData,
|
|
505
|
+
chainName: client.chainName,
|
|
506
|
+
isFormatted: true,
|
|
507
|
+
context: {
|
|
508
|
+
evmTypedData: typedData
|
|
509
|
+
},
|
|
510
|
+
onError
|
|
511
|
+
});
|
|
512
|
+
const serializedSignature = serializeECDSASignature(signatureEcdsa);
|
|
513
|
+
return serializedSignature;
|
|
514
|
+
} catch (error) {
|
|
515
|
+
client.logger.error('Error in delegatedSignTypedData', error);
|
|
516
|
+
throw error;
|
|
517
|
+
}
|
|
518
|
+
};
|
|
434
519
|
/**
|
|
435
520
|
* Revoke delegation - delegates to the node package
|
|
436
521
|
*/ const revokeDelegation = async (client, params)=>{
|
|
437
522
|
return revokeDelegation$1(client, params);
|
|
438
523
|
};
|
|
439
524
|
|
|
440
|
-
export { DynamicEvmWalletClient, ERROR_ACCOUNT_ADDRESS_REQUIRED, ERROR_CREATE_WALLET_ACCOUNT, ERROR_KEYGEN_FAILED, ERROR_SIGN_MESSAGE, ERROR_VERIFY_MESSAGE_SIGNATURE, EVM_SIGN_MESSAGE_PREFIX, createDelegatedEvmWalletClient, delegatedSignMessage, delegatedSignTransaction, deriveAccountAddress, formatEVMMessage, revokeDelegation, serializeECDSASignature };
|
|
525
|
+
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, 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.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.323",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/node": "0.0.0-beta.
|
|
7
|
+
"@dynamic-labs-wallet/node": "0.0.0-beta.323",
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "^0.0.801"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
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 } from 'viem';
|
|
3
|
+
import { type Chain, type PublicClient, type SignableMessage, type TransactionSerializable, type TypedData } from 'viem';
|
|
4
4
|
export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
5
5
|
readonly chainName = "EVM";
|
|
6
6
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, }: DynamicWalletClientProps);
|
|
@@ -42,6 +42,23 @@ export declare class DynamicEvmWalletClient extends DynamicWalletClient {
|
|
|
42
42
|
password?: string;
|
|
43
43
|
externalServerKeyShares?: ServerKeyShare[];
|
|
44
44
|
onError?: (error: Error) => void;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
r: `0x${string}`;
|
|
47
|
+
s: `0x${string}`;
|
|
48
|
+
v: bigint;
|
|
49
|
+
yParity: number;
|
|
50
|
+
} | {
|
|
51
|
+
r: `0x${string}`;
|
|
52
|
+
s: `0x${string}`;
|
|
53
|
+
yParity: number;
|
|
54
|
+
v?: never;
|
|
55
|
+
}>;
|
|
56
|
+
signTypedData({ accountAddress, typedData, password, externalServerKeyShares, onError, }: {
|
|
57
|
+
accountAddress: string;
|
|
58
|
+
typedData: TypedData;
|
|
59
|
+
password?: string;
|
|
60
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
61
|
+
onError?: (error: Error) => void;
|
|
45
62
|
}): Promise<`0x${string}`>;
|
|
46
63
|
verifyMessageSignature({ accountAddress, message, signature, }: {
|
|
47
64
|
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":"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,EAKV,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AAkBd,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;gBAEf,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,KAAK,GACN,EAAE,wBAAwB;IAS3B,sBAAsB,CAAC,EACrB,KAAK,EACL,MAAM,GACP,EAAE;QACD,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,CAAC,EAAE,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nB,SAAS,EAAE,MAAM,CAAC;QAClB,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,0BAA0B,CAAC,EAAE,OAAO,CAAC;QACrC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAClC,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;QAC/D,uBAAuB,EAAE,cAAc,EAAE,CAAC;KAC3C,CAAC;IA8DI,aAAa;CAOpB"}
|
|
@@ -2,6 +2,7 @@ export declare const EVM_SIGN_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n
|
|
|
2
2
|
export declare const ERROR_KEYGEN_FAILED = "Error with keygen";
|
|
3
3
|
export declare const ERROR_CREATE_WALLET_ACCOUNT = "Error creating evm wallet account";
|
|
4
4
|
export declare const ERROR_SIGN_MESSAGE = "Error signing message";
|
|
5
|
+
export declare const ERROR_SIGN_TYPED_DATA = "Error signing typed data";
|
|
5
6
|
export declare const ERROR_ACCOUNT_ADDRESS_REQUIRED = "Account address is required";
|
|
6
7
|
export declare const ERROR_VERIFY_MESSAGE_SIGNATURE = "Error verifying message signature";
|
|
7
8
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,qCAAmC,CAAC;AAGxE,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E,eAAO,MAAM,8BAA8B,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,qCAAmC,CAAC;AAGxE,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAEhE,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E,eAAO,MAAM,8BAA8B,sCAAsC,CAAC"}
|
package/src/delegatedClient.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DelegatedWalletClient, ServerKeyShare } from '@dynamic-labs-wallet/node';
|
|
2
|
-
import { type TransactionSerializable } from 'viem';
|
|
3
2
|
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import { type TransactionSerializable, type TypedData } from 'viem';
|
|
4
4
|
export type DelegatedEvmClientConfig = {
|
|
5
5
|
environmentId: string;
|
|
6
6
|
baseApiUrl?: string;
|
|
@@ -35,6 +35,27 @@ export declare const delegatedSignTransaction: (client: DelegatedEvmWalletClient
|
|
|
35
35
|
keyShare: ServerKeyShare;
|
|
36
36
|
transaction: TransactionSerializable;
|
|
37
37
|
}) => Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Signs an EIP-7702 authorization using delegated signing for EVM
|
|
40
|
+
*/
|
|
41
|
+
export declare const delegatedSignAuthorization: (client: DelegatedEvmWalletClient, { walletId, walletApiKey, keyShare, authorization, address, onError, }: {
|
|
42
|
+
walletId: string;
|
|
43
|
+
walletApiKey: string;
|
|
44
|
+
keyShare: ServerKeyShare;
|
|
45
|
+
authorization: any;
|
|
46
|
+
address: string;
|
|
47
|
+
onError?: (error: Error) => void;
|
|
48
|
+
}) => Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Signs typed data using delegated signing for EVM
|
|
51
|
+
*/
|
|
52
|
+
export declare const delegatedSignTypedData: (client: DelegatedEvmWalletClient, { walletId, walletApiKey, keyShare, typedData, onError, }: {
|
|
53
|
+
walletId: string;
|
|
54
|
+
walletApiKey: string;
|
|
55
|
+
keyShare: ServerKeyShare;
|
|
56
|
+
typedData: TypedData;
|
|
57
|
+
onError?: (error: Error) => void;
|
|
58
|
+
}) => Promise<string>;
|
|
38
59
|
/**
|
|
39
60
|
* Revoke delegation - delegates to the node package
|
|
40
61
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegatedClient.d.ts","sourceRoot":"","sources":["../../packages/src/delegatedClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delegatedClient.d.ts","sourceRoot":"","sources":["../../packages/src/delegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAErB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AAQd,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,KAAK,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,sEAMxC,wBAAwB,KAAG,wBAe7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,wBAAwB,oEAQ7B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACr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dsaSignature, type EcdsaPublicKey } from '@dynamic-labs-wallet/node';
|
|
2
3
|
export declare const formatEVMMessage: (message_: string | {
|
|
3
4
|
raw: string | Uint8Array;
|
|
4
5
|
}) => `0x${string}`;
|
|
6
|
+
export declare const formatTypedData: (typedData: TypedData | {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}) => string;
|
|
5
9
|
export declare const serializeECDSASignature: (signature: EcdsaSignature) => `0x${string}`;
|
|
6
10
|
export declare const deriveAccountAddress: ({ rawPublicKey, }: {
|
|
7
11
|
rawPublicKey: EcdsaPublicKey;
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AACd,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EAEpB,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,gBAAgB,aACjB,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,kBAShD,CAAC;AAEF,eAAO,MAAM,eAAe,cACf,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,WAGlD,CAAC;AAEF,eAAO,MAAM,uBAAuB,cAAe,cAAc,kBAMhE,CAAC;AAEF,eAAO,MAAM,oBAAoB,sBAE9B;IACD,YAAY,EAAE,cAAc,CAAC;CAC9B;;;CAQA,CAAC"}
|