@dynamic-labs-wallet/node-svm 0.0.0-beta.329 → 0.0.0-beta.330

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  var node = require('@dynamic-labs-wallet/node');
4
4
  var web3_js = require('@solana/web3.js');
5
+ var logger$1 = require('@dynamic-labs/logger');
6
+ var axios = require('axios');
7
+ var core = require('@dynamic-labs-wallet/core');
5
8
 
6
9
  function _extends() {
7
10
  _extends = Object.assign || function assign(target) {
@@ -83,6 +86,17 @@ function decodeBase58(str) {
83
86
  return out;
84
87
  }
85
88
 
89
+ const logger = new logger$1.Logger('DynamicWaasWalletClient');
90
+ const logError = ({ message, error, context })=>{
91
+ if (error instanceof axios.AxiosError) {
92
+ core.handleAxiosError(error, message, context, logger);
93
+ }
94
+ logger.error('[DynamicWaasWalletClient] Error in node-svm client', {
95
+ error: error instanceof Error ? error.message : String(error),
96
+ context
97
+ });
98
+ };
99
+
86
100
  // Helper: normalize bytes to hex without triggering Buffer.from(string, encoding) overload
87
101
  const toHex = (bytes)=>(Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes)).toString('hex');
88
102
  class DynamicSvmWalletClient extends node.DynamicWalletClient {
@@ -146,7 +160,11 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
146
160
  externalServerKeyShares
147
161
  };
148
162
  } catch (error) {
149
- this.logger.error('Error in createWalletAccount:', error);
163
+ logError({
164
+ message: ERROR_CREATE_WALLET_ACCOUNT,
165
+ error: error,
166
+ context: {}
167
+ });
150
168
  throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
151
169
  }
152
170
  }
@@ -173,10 +191,15 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
173
191
  if (!accountAddress) {
174
192
  throw new Error('Account address is required');
175
193
  }
176
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
177
- throw new Error('External server key shares are required');
178
- }
179
194
  try {
195
+ // Attempt to recover key shares from backup if not provided
196
+ await this.ensureKeySharesRecovered({
197
+ accountAddress,
198
+ password,
199
+ walletOperation: node.WalletOperation.SIGN_MESSAGE,
200
+ externalServerKeyShares,
201
+ errorMessage: 'External server key shares are required to sign a message. No backup shares available for recovery.'
202
+ });
180
203
  const messageBytes = typeof message === 'string' ? new TextEncoder().encode(message) : message;
181
204
  const messageHex = toHex(messageBytes);
182
205
  const signatureEd25519 = await this.sign({
@@ -188,7 +211,13 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
188
211
  });
189
212
  return encodeBase58(signatureEd25519);
190
213
  } catch (error) {
191
- this.logger.error('Error signing message:', error);
214
+ logError({
215
+ message: 'Error signing message:',
216
+ error: error,
217
+ context: {
218
+ accountAddress
219
+ }
220
+ });
192
221
  throw error;
193
222
  }
194
223
  }
@@ -198,15 +227,20 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
198
227
  if (!senderAddress) {
199
228
  throw new Error('Sender address is required');
200
229
  }
201
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
202
- throw new Error('External server key shares are required');
203
- }
204
230
  await this.verifyPassword({
205
231
  accountAddress: senderAddress,
206
232
  password,
207
233
  walletOperation: node.WalletOperation.SIGN_TRANSACTION
208
234
  });
209
235
  try {
236
+ // Attempt to recover key shares from backup if not provided
237
+ await this.ensureKeySharesRecovered({
238
+ accountAddress: senderAddress,
239
+ password,
240
+ walletOperation: node.WalletOperation.SIGN_TRANSACTION,
241
+ externalServerKeyShares,
242
+ errorMessage: 'External server key shares are required to sign transaction. No backup shares available for recovery.'
243
+ });
210
244
  let messageToSign;
211
245
  if (typeof transaction === 'string') {
212
246
  messageToSign = transaction.startsWith('0x') ? transaction.slice(2) : transaction;
@@ -229,10 +263,13 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
229
263
  }
230
264
  return encodeBase58(signatureEd25519);
231
265
  } catch (error) {
232
- this.logger.error('Error in signTransaction:', error);
233
- if (error instanceof Error) {
234
- this.logger.error('Error details:', error);
235
- }
266
+ logError({
267
+ message: 'Error in signTransaction:',
268
+ error: error,
269
+ context: {
270
+ senderAddress
271
+ }
272
+ });
236
273
  throw error;
237
274
  }
238
275
  }
@@ -443,13 +480,58 @@ async function sendTransaction({ signedTransaction, rpcUrl = 'https://api.devnet
443
480
  const base58Signature = encodeBase58(signatureEd25519);
444
481
  return base58Signature;
445
482
  } catch (error) {
446
- client.logger.error('Error in delegatedSignMessage', error);
483
+ logError({
484
+ message: 'Error in delegatedSignMessage',
485
+ error: error,
486
+ context: {
487
+ walletId
488
+ }
489
+ });
447
490
  throw error;
448
491
  }
449
492
  };
450
493
  /**
451
494
  * Signs a transaction using delegated signing for SVM
452
- */ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
495
+ *
496
+ * @param client - The delegated SVM wallet client
497
+ * @param options - Signing options
498
+ * @param options.walletId - The wallet ID
499
+ * @param options.walletApiKey - The wallet API key
500
+ * @param options.keyShare - The server key share
501
+ * @param options.transaction - The transaction to sign (VersionedTransaction or Transaction)
502
+ * @param options.signerAddress - Optional. The address that should sign the transaction.
503
+ * If not provided, defaults to the first signer (VersionedTransaction)
504
+ * or fee payer (Transaction). Use this for gasless transactions where
505
+ * a separate fee payer pays the fees.
506
+ *
507
+ * @returns The partially signed transaction with the signature attached for the specified signer
508
+ *
509
+ * @example
510
+ * // Standard transaction where sender is also fee payer
511
+ * const signedTx = await delegatedSignTransaction(client, {
512
+ * walletId,
513
+ * walletApiKey,
514
+ * keyShare,
515
+ * transaction,
516
+ * });
517
+ *
518
+ * @example
519
+ * // Gasless transaction with separate fee payer
520
+ * const transaction = new Transaction();
521
+ * transaction.feePayer = feePayerPublicKey; // Set the actual fee payer
522
+ * transaction.add(instruction); // Instruction that requires sender signature
523
+ *
524
+ * const signedTx = await delegatedSignTransaction(client, {
525
+ * walletId,
526
+ * walletApiKey,
527
+ * keyShare,
528
+ * transaction,
529
+ * signerAddress: senderAddress, // Explicitly specify who signs
530
+ * });
531
+ *
532
+ * // Now sign with fee payer's private key
533
+ * signedTx.partialSign(feePayerKeypair);
534
+ */ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction, signerAddress })=>{
453
535
  try {
454
536
  let messageToSign;
455
537
  if (transaction instanceof web3_js.VersionedTransaction) {
@@ -473,29 +555,40 @@ async function sendTransaction({ signedTransaction, rpcUrl = 'https://api.devnet
473
555
  if (!signatureEd25519) {
474
556
  throw new Error('Signature is undefined');
475
557
  }
476
- // Get the sender address from the transaction
477
- let senderAddress;
478
- if (transaction instanceof web3_js.VersionedTransaction) {
479
- // For versioned transactions, get the first signer
480
- const signers = transaction.message.staticAccountKeys;
481
- senderAddress = signers[0].toBase58();
482
- } else {
558
+ const resolvedSignerAddress = signerAddress != null ? signerAddress : (()=>{
483
559
  var _transaction_feePayer;
484
- // For legacy transactions, use feePayer
485
- senderAddress = ((_transaction_feePayer = transaction.feePayer) == null ? void 0 : _transaction_feePayer.toBase58()) || '';
560
+ if (transaction instanceof web3_js.VersionedTransaction) {
561
+ var _signers_;
562
+ const signers = transaction.message.staticAccountKeys;
563
+ var _signers__toBase58;
564
+ return (_signers__toBase58 = (_signers_ = signers[0]) == null ? void 0 : _signers_.toBase58()) != null ? _signers__toBase58 : '';
565
+ }
566
+ var _transaction_feePayer_toBase58;
567
+ return (_transaction_feePayer_toBase58 = (_transaction_feePayer = transaction.feePayer) == null ? void 0 : _transaction_feePayer.toBase58()) != null ? _transaction_feePayer_toBase58 : '';
568
+ })();
569
+ if (!resolvedSignerAddress) {
570
+ throw new Error('Could not determine signer address. Provide signerAddress explicitly or ensure transaction has a fee payer.');
486
571
  }
487
- if (!senderAddress) {
488
- throw new Error('Could not determine sender address from transaction');
572
+ let signerPublicKey;
573
+ try {
574
+ signerPublicKey = new web3_js.PublicKey(resolvedSignerAddress);
575
+ } catch (error) {
576
+ throw new Error(`Invalid signer address: ${resolvedSignerAddress}. ${error instanceof Error ? error.message : 'Unknown error'}`);
489
577
  }
490
- const senderPublicKey = new web3_js.PublicKey(senderAddress);
491
578
  const signedTransaction = addSignatureToTransaction({
492
579
  transaction,
493
580
  signature: signatureEd25519,
494
- signerPublicKey: senderPublicKey
581
+ signerPublicKey
495
582
  });
496
583
  return signedTransaction;
497
584
  } catch (error) {
498
- client.logger.error('Error in delegatedSignTransaction', error);
585
+ logError({
586
+ message: 'Error in delegatedSignTransaction',
587
+ error: error,
588
+ context: {
589
+ walletId
590
+ }
591
+ });
499
592
  throw error;
500
593
  }
501
594
  };
package/index.esm.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { DynamicWalletClient, getMPCChainConfig, getExternalServerKeyShareBackupInfo, WalletOperation, SOLANA_RPC_URL, createDelegatedWalletClient, delegatedSignMessage as delegatedSignMessage$1, revokeDelegation as revokeDelegation$1 } from '@dynamic-labs-wallet/node';
2
2
  import { PublicKey, VersionedTransaction, Keypair, Connection, Transaction, SystemProgram } from '@solana/web3.js';
3
+ import { Logger } from '@dynamic-labs/logger';
4
+ import { AxiosError } from 'axios';
5
+ import { handleAxiosError } from '@dynamic-labs-wallet/core';
3
6
 
4
7
  function _extends() {
5
8
  _extends = Object.assign || function assign(target) {
@@ -81,6 +84,17 @@ function decodeBase58(str) {
81
84
  return out;
82
85
  }
83
86
 
87
+ const logger = new Logger('DynamicWaasWalletClient');
88
+ const logError = ({ message, error, context })=>{
89
+ if (error instanceof AxiosError) {
90
+ handleAxiosError(error, message, context, logger);
91
+ }
92
+ logger.error('[DynamicWaasWalletClient] Error in node-svm client', {
93
+ error: error instanceof Error ? error.message : String(error),
94
+ context
95
+ });
96
+ };
97
+
84
98
  // Helper: normalize bytes to hex without triggering Buffer.from(string, encoding) overload
85
99
  const toHex = (bytes)=>(Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes)).toString('hex');
86
100
  class DynamicSvmWalletClient extends DynamicWalletClient {
@@ -144,7 +158,11 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
144
158
  externalServerKeyShares
145
159
  };
146
160
  } catch (error) {
147
- this.logger.error('Error in createWalletAccount:', error);
161
+ logError({
162
+ message: ERROR_CREATE_WALLET_ACCOUNT,
163
+ error: error,
164
+ context: {}
165
+ });
148
166
  throw new Error(ERROR_CREATE_WALLET_ACCOUNT);
149
167
  }
150
168
  }
@@ -171,10 +189,15 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
171
189
  if (!accountAddress) {
172
190
  throw new Error('Account address is required');
173
191
  }
174
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
175
- throw new Error('External server key shares are required');
176
- }
177
192
  try {
193
+ // Attempt to recover key shares from backup if not provided
194
+ await this.ensureKeySharesRecovered({
195
+ accountAddress,
196
+ password,
197
+ walletOperation: WalletOperation.SIGN_MESSAGE,
198
+ externalServerKeyShares,
199
+ errorMessage: 'External server key shares are required to sign a message. No backup shares available for recovery.'
200
+ });
178
201
  const messageBytes = typeof message === 'string' ? new TextEncoder().encode(message) : message;
179
202
  const messageHex = toHex(messageBytes);
180
203
  const signatureEd25519 = await this.sign({
@@ -186,7 +209,13 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
186
209
  });
187
210
  return encodeBase58(signatureEd25519);
188
211
  } catch (error) {
189
- this.logger.error('Error signing message:', error);
212
+ logError({
213
+ message: 'Error signing message:',
214
+ error: error,
215
+ context: {
216
+ accountAddress
217
+ }
218
+ });
190
219
  throw error;
191
220
  }
192
221
  }
@@ -196,15 +225,20 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
196
225
  if (!senderAddress) {
197
226
  throw new Error('Sender address is required');
198
227
  }
199
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
200
- throw new Error('External server key shares are required');
201
- }
202
228
  await this.verifyPassword({
203
229
  accountAddress: senderAddress,
204
230
  password,
205
231
  walletOperation: WalletOperation.SIGN_TRANSACTION
206
232
  });
207
233
  try {
234
+ // Attempt to recover key shares from backup if not provided
235
+ await this.ensureKeySharesRecovered({
236
+ accountAddress: senderAddress,
237
+ password,
238
+ walletOperation: WalletOperation.SIGN_TRANSACTION,
239
+ externalServerKeyShares,
240
+ errorMessage: 'External server key shares are required to sign transaction. No backup shares available for recovery.'
241
+ });
208
242
  let messageToSign;
209
243
  if (typeof transaction === 'string') {
210
244
  messageToSign = transaction.startsWith('0x') ? transaction.slice(2) : transaction;
@@ -227,10 +261,13 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
227
261
  }
228
262
  return encodeBase58(signatureEd25519);
229
263
  } catch (error) {
230
- this.logger.error('Error in signTransaction:', error);
231
- if (error instanceof Error) {
232
- this.logger.error('Error details:', error);
233
- }
264
+ logError({
265
+ message: 'Error in signTransaction:',
266
+ error: error,
267
+ context: {
268
+ senderAddress
269
+ }
270
+ });
234
271
  throw error;
235
272
  }
236
273
  }
@@ -441,13 +478,58 @@ async function sendTransaction({ signedTransaction, rpcUrl = 'https://api.devnet
441
478
  const base58Signature = encodeBase58(signatureEd25519);
442
479
  return base58Signature;
443
480
  } catch (error) {
444
- client.logger.error('Error in delegatedSignMessage', error);
481
+ logError({
482
+ message: 'Error in delegatedSignMessage',
483
+ error: error,
484
+ context: {
485
+ walletId
486
+ }
487
+ });
445
488
  throw error;
446
489
  }
447
490
  };
448
491
  /**
449
492
  * Signs a transaction using delegated signing for SVM
450
- */ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction })=>{
493
+ *
494
+ * @param client - The delegated SVM wallet client
495
+ * @param options - Signing options
496
+ * @param options.walletId - The wallet ID
497
+ * @param options.walletApiKey - The wallet API key
498
+ * @param options.keyShare - The server key share
499
+ * @param options.transaction - The transaction to sign (VersionedTransaction or Transaction)
500
+ * @param options.signerAddress - Optional. The address that should sign the transaction.
501
+ * If not provided, defaults to the first signer (VersionedTransaction)
502
+ * or fee payer (Transaction). Use this for gasless transactions where
503
+ * a separate fee payer pays the fees.
504
+ *
505
+ * @returns The partially signed transaction with the signature attached for the specified signer
506
+ *
507
+ * @example
508
+ * // Standard transaction where sender is also fee payer
509
+ * const signedTx = await delegatedSignTransaction(client, {
510
+ * walletId,
511
+ * walletApiKey,
512
+ * keyShare,
513
+ * transaction,
514
+ * });
515
+ *
516
+ * @example
517
+ * // Gasless transaction with separate fee payer
518
+ * const transaction = new Transaction();
519
+ * transaction.feePayer = feePayerPublicKey; // Set the actual fee payer
520
+ * transaction.add(instruction); // Instruction that requires sender signature
521
+ *
522
+ * const signedTx = await delegatedSignTransaction(client, {
523
+ * walletId,
524
+ * walletApiKey,
525
+ * keyShare,
526
+ * transaction,
527
+ * signerAddress: senderAddress, // Explicitly specify who signs
528
+ * });
529
+ *
530
+ * // Now sign with fee payer's private key
531
+ * signedTx.partialSign(feePayerKeypair);
532
+ */ const delegatedSignTransaction = async (client, { walletId, walletApiKey, keyShare, transaction, signerAddress })=>{
451
533
  try {
452
534
  let messageToSign;
453
535
  if (transaction instanceof VersionedTransaction) {
@@ -471,29 +553,40 @@ async function sendTransaction({ signedTransaction, rpcUrl = 'https://api.devnet
471
553
  if (!signatureEd25519) {
472
554
  throw new Error('Signature is undefined');
473
555
  }
474
- // Get the sender address from the transaction
475
- let senderAddress;
476
- if (transaction instanceof VersionedTransaction) {
477
- // For versioned transactions, get the first signer
478
- const signers = transaction.message.staticAccountKeys;
479
- senderAddress = signers[0].toBase58();
480
- } else {
556
+ const resolvedSignerAddress = signerAddress != null ? signerAddress : (()=>{
481
557
  var _transaction_feePayer;
482
- // For legacy transactions, use feePayer
483
- senderAddress = ((_transaction_feePayer = transaction.feePayer) == null ? void 0 : _transaction_feePayer.toBase58()) || '';
558
+ if (transaction instanceof VersionedTransaction) {
559
+ var _signers_;
560
+ const signers = transaction.message.staticAccountKeys;
561
+ var _signers__toBase58;
562
+ return (_signers__toBase58 = (_signers_ = signers[0]) == null ? void 0 : _signers_.toBase58()) != null ? _signers__toBase58 : '';
563
+ }
564
+ var _transaction_feePayer_toBase58;
565
+ return (_transaction_feePayer_toBase58 = (_transaction_feePayer = transaction.feePayer) == null ? void 0 : _transaction_feePayer.toBase58()) != null ? _transaction_feePayer_toBase58 : '';
566
+ })();
567
+ if (!resolvedSignerAddress) {
568
+ throw new Error('Could not determine signer address. Provide signerAddress explicitly or ensure transaction has a fee payer.');
484
569
  }
485
- if (!senderAddress) {
486
- throw new Error('Could not determine sender address from transaction');
570
+ let signerPublicKey;
571
+ try {
572
+ signerPublicKey = new PublicKey(resolvedSignerAddress);
573
+ } catch (error) {
574
+ throw new Error(`Invalid signer address: ${resolvedSignerAddress}. ${error instanceof Error ? error.message : 'Unknown error'}`);
487
575
  }
488
- const senderPublicKey = new PublicKey(senderAddress);
489
576
  const signedTransaction = addSignatureToTransaction({
490
577
  transaction,
491
578
  signature: signatureEd25519,
492
- signerPublicKey: senderPublicKey
579
+ signerPublicKey
493
580
  });
494
581
  return signedTransaction;
495
582
  } catch (error) {
496
- client.logger.error('Error in delegatedSignTransaction', error);
583
+ logError({
584
+ message: 'Error in delegatedSignTransaction',
585
+ error: error,
586
+ context: {
587
+ walletId
588
+ }
589
+ });
497
590
  throw error;
498
591
  }
499
592
  };
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node-svm",
3
- "version": "0.0.0-beta.329",
3
+ "version": "0.0.0-beta.330",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/node": "0.0.0-beta.329",
8
- "@solana/web3.js": "^1.98.2"
7
+ "@dynamic-labs-wallet/core": "0.0.0-beta.330",
8
+ "@dynamic-labs-wallet/node": "0.0.0-beta.330",
9
+ "@dynamic-labs/logger": "^4.25.3",
10
+ "@solana/web3.js": "^1.98.2",
11
+ "axios": "1.13.2"
9
12
  },
10
13
  "publishConfig": {
11
14
  "access": "public"
@@ -28,5 +31,8 @@
28
31
  "import": "./index.esm.js",
29
32
  "require": "./index.cjs.js"
30
33
  }
34
+ },
35
+ "devDependencies": {
36
+ "@types/http-errors": "^2.0.0"
31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AC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;QAC9C,uBAAuB,EAAE,cAAc,EAAE,CAAC;KAC3C,CAAC;IAqEI,aAAa;CAOpB"}
@@ -27,12 +27,52 @@ export declare const delegatedSignMessage: (client: DelegatedSvmWalletClient, {
27
27
  }) => Promise<string>;
28
28
  /**
29
29
  * Signs a transaction using delegated signing for SVM
30
+ *
31
+ * @param client - The delegated SVM wallet client
32
+ * @param options - Signing options
33
+ * @param options.walletId - The wallet ID
34
+ * @param options.walletApiKey - The wallet API key
35
+ * @param options.keyShare - The server key share
36
+ * @param options.transaction - The transaction to sign (VersionedTransaction or Transaction)
37
+ * @param options.signerAddress - Optional. The address that should sign the transaction.
38
+ * If not provided, defaults to the first signer (VersionedTransaction)
39
+ * or fee payer (Transaction). Use this for gasless transactions where
40
+ * a separate fee payer pays the fees.
41
+ *
42
+ * @returns The partially signed transaction with the signature attached for the specified signer
43
+ *
44
+ * @example
45
+ * // Standard transaction where sender is also fee payer
46
+ * const signedTx = await delegatedSignTransaction(client, {
47
+ * walletId,
48
+ * walletApiKey,
49
+ * keyShare,
50
+ * transaction,
51
+ * });
52
+ *
53
+ * @example
54
+ * // Gasless transaction with separate fee payer
55
+ * const transaction = new Transaction();
56
+ * transaction.feePayer = feePayerPublicKey; // Set the actual fee payer
57
+ * transaction.add(instruction); // Instruction that requires sender signature
58
+ *
59
+ * const signedTx = await delegatedSignTransaction(client, {
60
+ * walletId,
61
+ * walletApiKey,
62
+ * keyShare,
63
+ * transaction,
64
+ * signerAddress: senderAddress, // Explicitly specify who signs
65
+ * });
66
+ *
67
+ * // Now sign with fee payer's private key
68
+ * signedTx.partialSign(feePayerKeypair);
30
69
  */
31
- export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient, { walletId, walletApiKey, keyShare, transaction, }: {
70
+ export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient, { walletId, walletApiKey, keyShare, transaction, signerAddress, }: {
32
71
  walletId: string;
33
72
  walletApiKey: string;
34
73
  keyShare: any;
35
74
  transaction: VersionedTransaction | Transaction;
75
+ signerAddress?: string;
36
76
  }) => Promise<VersionedTransaction | Transaction>;
37
77
  /**
38
78
  * Revoke delegation - delegates to the node package
@@ -1 +1 @@
1
- {"version":3,"file":"delegatedClient.d.ts","sourceRoot":"","sources":["../../packages/src/delegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAa,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAIlE,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,+DAO7B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,KACA,OAAO,CAAC,MAAM,CAoBhB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,WAC3B,wBAAwB,sDAM7B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,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B,wBAAwB,qEAO7B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC;IACd,WAAW,EAAE,oBAAoB,GAAG,WAAW,CAAC;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,KACA,OAAO,CAAC,oBAAoB,GAAG,WAAW,CAqE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,WACnB,wBAAwB,UACxB,GAAG,kBAGZ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Logger } from '@dynamic-labs/logger';
2
+ export declare const logger: Logger;
3
+ declare const logError: ({ message, error, context, }: {
4
+ message: string;
5
+ error: Error;
6
+ context: Record<string, unknown>;
7
+ }) => void;
8
+ export { Logger } from '@dynamic-labs/logger';
9
+ export { logError };
10
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,eAAO,MAAM,MAAM,QAAwC,CAAC;AAE5D,QAAA,MAAM,QAAQ,iCAIX;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,KAAG,IAQH,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,CAAC"}