@dynamic-labs-wallet/node-svm 0.0.193 → 0.0.195

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
@@ -173,10 +173,15 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
173
173
  if (!accountAddress) {
174
174
  throw new Error('Account address is required');
175
175
  }
176
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
177
- throw new Error('External server key shares are required');
178
- }
179
176
  try {
177
+ // Attempt to recover key shares from backup if not provided
178
+ await this.ensureKeySharesRecovered({
179
+ accountAddress,
180
+ password,
181
+ walletOperation: node.WalletOperation.SIGN_MESSAGE,
182
+ externalServerKeyShares,
183
+ errorMessage: 'External server key shares are required to sign a message. No backup shares available for recovery.'
184
+ });
180
185
  const messageBytes = typeof message === 'string' ? new TextEncoder().encode(message) : message;
181
186
  const messageHex = toHex(messageBytes);
182
187
  const signatureEd25519 = await this.sign({
@@ -198,15 +203,20 @@ class DynamicSvmWalletClient extends node.DynamicWalletClient {
198
203
  if (!senderAddress) {
199
204
  throw new Error('Sender address is required');
200
205
  }
201
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
202
- throw new Error('External server key shares are required');
203
- }
204
206
  await this.verifyPassword({
205
207
  accountAddress: senderAddress,
206
208
  password,
207
209
  walletOperation: node.WalletOperation.SIGN_TRANSACTION
208
210
  });
209
211
  try {
212
+ // Attempt to recover key shares from backup if not provided
213
+ await this.ensureKeySharesRecovered({
214
+ accountAddress: senderAddress,
215
+ password,
216
+ walletOperation: node.WalletOperation.SIGN_TRANSACTION,
217
+ externalServerKeyShares,
218
+ errorMessage: 'External server key shares are required to sign transaction. No backup shares available for recovery.'
219
+ });
210
220
  let messageToSign;
211
221
  if (typeof transaction === 'string') {
212
222
  messageToSign = transaction.startsWith('0x') ? transaction.slice(2) : transaction;
package/index.esm.js CHANGED
@@ -171,10 +171,15 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
171
171
  if (!accountAddress) {
172
172
  throw new Error('Account address is required');
173
173
  }
174
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
175
- throw new Error('External server key shares are required');
176
- }
177
174
  try {
175
+ // Attempt to recover key shares from backup if not provided
176
+ await this.ensureKeySharesRecovered({
177
+ accountAddress,
178
+ password,
179
+ walletOperation: WalletOperation.SIGN_MESSAGE,
180
+ externalServerKeyShares,
181
+ errorMessage: 'External server key shares are required to sign a message. No backup shares available for recovery.'
182
+ });
178
183
  const messageBytes = typeof message === 'string' ? new TextEncoder().encode(message) : message;
179
184
  const messageHex = toHex(messageBytes);
180
185
  const signatureEd25519 = await this.sign({
@@ -196,15 +201,20 @@ class DynamicSvmWalletClient extends DynamicWalletClient {
196
201
  if (!senderAddress) {
197
202
  throw new Error('Sender address is required');
198
203
  }
199
- if (Array.isArray(externalServerKeyShares) && externalServerKeyShares.length === 0) {
200
- throw new Error('External server key shares are required');
201
- }
202
204
  await this.verifyPassword({
203
205
  accountAddress: senderAddress,
204
206
  password,
205
207
  walletOperation: WalletOperation.SIGN_TRANSACTION
206
208
  });
207
209
  try {
210
+ // Attempt to recover key shares from backup if not provided
211
+ await this.ensureKeySharesRecovered({
212
+ accountAddress: senderAddress,
213
+ password,
214
+ walletOperation: WalletOperation.SIGN_TRANSACTION,
215
+ externalServerKeyShares,
216
+ errorMessage: 'External server key shares are required to sign transaction. No backup shares available for recovery.'
217
+ });
208
218
  let messageToSign;
209
219
  if (typeof transaction === 'string') {
210
220
  messageToSign = transaction.startsWith('0x') ? transaction.slice(2) : transaction;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node-svm",
3
- "version": "0.0.193",
3
+ "version": "0.0.195",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/node": "0.0.193",
7
+ "@dynamic-labs-wallet/node": "0.0.195",
8
8
  "@solana/web3.js": "^1.98.2"
9
9
  },
10
10
  "publishConfig": {
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAI7B,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,WAAW,EAChB,oBAAoB,EAErB,MAAM,iBAAiB,CAAC;AAQzB,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;gBAEZ,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,oBAAoB,GACrB,EAAE,wBAAwB;IAS3B;;;;;OAKG;IACG,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,EACP,0BAAkC,GACnC,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;QACjC,0BAA0B,CAAC,EAAE,OAAO,CAAC;KACtC,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,UAAU,GAAG,MAAM,CAAC;QAClC,uBAAuB,EAAE,cAAc,EAAE,CAAC;KAC3C,CAAC;IA4EI,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU;;;IAc5D;;;;;;OAMG;IACG,WAAW,CAAC,EAChB,OAAO,EACP,cAAc,EACd,QAAoB,EACpB,uBAAuB,GACxB,EAAE;QACD,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;QAC7B,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,uBAAuB,CAAC,EAAE,cAAc,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