@dynamic-labs/waas-svm 5.3.1 → 5.3.2

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/CHANGELOG.md CHANGED
@@ -1,4 +1,21 @@
1
1
 
2
+ ### [5.3.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.1...v5.3.2) (2026-08-19)
3
+
4
+
5
+ ### Features
6
+
7
+ * **bitcoin:** add allowedSighash to embedded wallet signPsbt ([#12233](https://github.com/dynamic-labs/dynamic-auth/issues/12233)) ([d0ff829](https://github.com/dynamic-labs/dynamic-auth/commit/d0ff8291a3d1771d5ca356172acc10af94349b15))
8
+ * **bitcoin:** forward signingIndexes to embedded PSBT signing ([#12211](https://github.com/dynamic-labs/dynamic-auth/issues/12211)) ([733da3d](https://github.com/dynamic-labs/dynamic-auth/commit/733da3d32f39a9ae6d813df84fcff6350ba12eb5))
9
+ * expose createOfflineRecoveryShares SDK function in webview and legacy client ([#12239](https://github.com/dynamic-labs/dynamic-auth/issues/12239)) ([c8056e8](https://github.com/dynamic-labs/dynamic-auth/commit/c8056e8d5a1c66ac0146b046bc7cc198de118f0b))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **bitcoin:** parse PSBTs with the active network's address encoding ([#12219](https://github.com/dynamic-labs/dynamic-auth/issues/12219)) ([8b151e2](https://github.com/dynamic-labs/dynamic-auth/commit/8b151e23440094cfa0d48728e1d0f19de567ca05))
15
+ * **bitcoin:** stop ensureActiveAccount from resetting a switched network ([#12215](https://github.com/dynamic-labs/dynamic-auth/issues/12215)) ([86668b7](https://github.com/dynamic-labs/dynamic-auth/commit/86668b79d23cd89b7e96518551cdaecab7dd5ce3))
16
+ * remediate high-severity dependency vulnerabilities ([#12238](https://github.com/dynamic-labs/dynamic-auth/issues/12238)) ([a4fc78c](https://github.com/dynamic-labs/dynamic-auth/commit/a4fc78ca27ee44ce6a1038c4e0d07f55528b4994))
17
+ * **waas-svm:** retry SVM gas sponsorship before falling back, then throw ([#12240](https://github.com/dynamic-labs/dynamic-auth/issues/12240)) ([f599a7a](https://github.com/dynamic-labs/dynamic-auth/commit/f599a7af55727e06373772acf574ee7c43e56bbb))
18
+
2
19
  ### [5.3.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.0...v5.3.1) (2026-08-14)
3
20
 
4
21
  ## [5.3.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.2.0...v5.3.0) (2026-08-12)
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "5.3.1";
6
+ var version = "5.3.2";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "5.3.1";
2
+ var version = "5.3.2";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/waas-svm",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,19 +18,19 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/sdk-api-core": "0.0.1118",
22
- "@dynamic-labs/embedded-wallet-solana": "5.3.1",
21
+ "@dynamic-labs/sdk-api-core": "0.12.0",
22
+ "@dynamic-labs/embedded-wallet-solana": "5.3.2",
23
23
  "@solana/web3.js": "1.98.1",
24
24
  "eventemitter3": "5.0.1",
25
25
  "bs58": "5.0.0",
26
- "@dynamic-labs/assert-package-version": "5.3.1",
27
- "@dynamic-labs/logger": "5.3.1",
28
- "@dynamic-labs/rpc-providers": "5.3.1",
29
- "@dynamic-labs/solana-core": "5.3.1",
30
- "@dynamic-labs/types": "5.3.1",
31
- "@dynamic-labs/utils": "5.3.1",
32
- "@dynamic-labs/waas": "5.3.1",
33
- "@dynamic-labs/wallet-connector-core": "5.3.1"
26
+ "@dynamic-labs/assert-package-version": "5.3.2",
27
+ "@dynamic-labs/logger": "5.3.2",
28
+ "@dynamic-labs/rpc-providers": "5.3.2",
29
+ "@dynamic-labs/solana-core": "5.3.2",
30
+ "@dynamic-labs/types": "5.3.2",
31
+ "@dynamic-labs/utils": "5.3.2",
32
+ "@dynamic-labs/waas": "5.3.2",
33
+ "@dynamic-labs/wallet-connector-core": "5.3.2"
34
34
  },
35
35
  "peerDependencies": {}
36
36
  }
@@ -15,6 +15,11 @@ var logger = require('../../utils/logger.cjs');
15
15
  var DynamicWaasSVMSigner = require('../signer/DynamicWaasSVMSigner.cjs');
16
16
  var logger$1 = require('@dynamic-labs/logger');
17
17
 
18
+ // Total sign attempts, including the first, before giving up on sponsorship.
19
+ const SPONSORSHIP_MAX_ATTEMPTS = 3;
20
+ const SPONSORSHIP_RETRY_INTERVAL_MS = 500;
21
+ const SPONSORSHIP_FAILURE_MESSAGE = 'Failed to sponsor Solana transaction';
22
+ const SPONSORSHIP_FAILURE_CODE = 'failed_to_sponsor_solana_transaction';
18
23
  class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWalletConnector) {
19
24
  connect() {
20
25
  throw new Error('Method not implemented.');
@@ -35,6 +40,26 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
35
40
  setSvmGasSponsorshipEnabled(getEnabled) {
36
41
  this.getSvmGasSponsorshipEnabled = getEnabled;
37
42
  }
43
+ /**
44
+ * Determines whether a sponsorship failure is worth retrying.
45
+ * Deterministic local failures are not retried; HTTP rejections are only
46
+ * retried for rate limits and server errors.
47
+ */
48
+ isRetryableSponsorshipError(error) {
49
+ if (error instanceof utils.DynamicError) {
50
+ if (typeof error.code !== 'string') {
51
+ return false;
52
+ }
53
+ const match = error.code.match(/^sponsorship_http_(\d+)$/);
54
+ if (!match) {
55
+ return false;
56
+ }
57
+ const status = Number(match[1]);
58
+ return status === 429 || status >= 500;
59
+ }
60
+ // Network/fetch failures are retried.
61
+ return true;
62
+ }
38
63
  /**
39
64
  * Check if a transaction is already signed (has non-zero signatures).
40
65
  */
@@ -46,7 +71,9 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
46
71
  }
47
72
  /**
48
73
  * Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
49
- * Falls back to original transaction on error.
74
+ * Retries transient failures; throws if sponsorship never succeeds so callers
75
+ * never sign and return a transaction that silently skipped sponsorship
76
+ * (e.g. a 0-SOL wallet still set as fee payer).
50
77
  */
51
78
  maybeSponsorTransaction(transaction) {
52
79
  return _tslib.__awaiter(this, void 0, void 0, function* () {
@@ -61,15 +88,26 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
61
88
  logger.logger.warn('[maybeSponsorTransaction] Missing environmentId, skipping sponsorship');
62
89
  return transaction;
63
90
  }
64
- try {
65
- const sponsoredTransaction = yield embeddedWalletSolana.sponsorSolanaTransaction(this.environmentId, transaction);
66
- logger.logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
67
- return sponsoredTransaction;
68
- }
69
- catch (error) {
70
- logger.logger.warn('[maybeSponsorTransaction] Failed to sponsor transaction, using original', { error });
71
- return transaction;
91
+ for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
92
+ try {
93
+ const sponsoredTransaction = yield embeddedWalletSolana.sponsorSolanaTransaction(this.environmentId, transaction);
94
+ logger.logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
95
+ return sponsoredTransaction;
96
+ }
97
+ catch (error) {
98
+ logger.logger.warn(`[maybeSponsorTransaction] Sponsorship attempt ${attempt}/${SPONSORSHIP_MAX_ATTEMPTS} failed`, { error });
99
+ if (attempt === SPONSORSHIP_MAX_ATTEMPTS ||
100
+ !this.isRetryableSponsorshipError(error)) {
101
+ if (error instanceof utils.DynamicError) {
102
+ throw error;
103
+ }
104
+ throw new utils.DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
105
+ }
106
+ yield utils.sleep(SPONSORSHIP_RETRY_INTERVAL_MS);
107
+ }
72
108
  }
109
+ // Unreachable: the loop always returns or throws on its final attempt.
110
+ throw new utils.DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
73
111
  });
74
112
  }
75
113
  /**
@@ -53,9 +53,6 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
53
53
  setEnvironmentId(environmentId: string): void;
54
54
  setBaseApiUrl(baseApiUrl: string): void;
55
55
  setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl?: string | undefined): void;
56
- /**
57
- * Override setEnvironmentId to ensure it's set on the global logger
58
- */
59
56
  setRelayUrl(relayUrl: string): void;
60
57
  setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
61
58
  setGetSessionPublicKeyFunction(getSessionPublicKey: () => Promise<string | undefined>): void;
@@ -98,6 +95,9 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
98
95
  }>;
99
96
  importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, password, }: {
100
97
  privateKey: string;
98
+ /**
99
+ * Override setEnvironmentId to ensure it's set on the global logger
100
+ */
101
101
  thresholdSignatureScheme?: string | undefined;
102
102
  publicAddressCheck?: string | undefined;
103
103
  addressType?: string | undefined;
@@ -193,6 +193,12 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
193
193
  getWalletRecoveryState({ accountAddress, }: {
194
194
  accountAddress: string;
195
195
  }): Promise<import("@dynamic-labs-wallet/browser-wallet-client").WalletRecoveryState>;
196
+ createOfflineRecoveryShares({ accountAddress, password, cloudProviderAccessToken, mfaToken, }: {
197
+ accountAddress: string;
198
+ password?: string | undefined;
199
+ cloudProviderAccessToken?: string | undefined;
200
+ mfaToken?: string | undefined;
201
+ }): Promise<void>;
196
202
  endSession(reason?: import("@dynamic-labs-sdk/client").LogoutReason | undefined): Promise<void>;
197
203
  getActiveAccountAddress(): Promise<string | undefined>;
198
204
  getConnectedAccounts(): Promise<string[]>;
@@ -238,13 +244,21 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
238
244
  * Using a getter avoids stale values from initialization race conditions.
239
245
  */
240
246
  setSvmGasSponsorshipEnabled(getEnabled: () => boolean): void;
247
+ /**
248
+ * Determines whether a sponsorship failure is worth retrying.
249
+ * Deterministic local failures are not retried; HTTP rejections are only
250
+ * retried for rate limits and server errors.
251
+ */
252
+ private isRetryableSponsorshipError;
241
253
  /**
242
254
  * Check if a transaction is already signed (has non-zero signatures).
243
255
  */
244
256
  private isTxAlreadySigned;
245
257
  /**
246
258
  * Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
247
- * Falls back to original transaction on error.
259
+ * Retries transient failures; throws if sponsorship never succeeds so callers
260
+ * never sign and return a transaction that silently skipped sponsorship
261
+ * (e.g. a 0-SOL wallet still set as fee payer).
248
262
  */
249
263
  private maybeSponsorTransaction;
250
264
  /**
@@ -4,13 +4,18 @@ import { PublicKey } from '@solana/web3.js';
4
4
  import { sponsorSolanaTransaction } from '@dynamic-labs/embedded-wallet-solana';
5
5
  import { MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';
6
6
  import { SolanaWalletConnector, isVersionedTransaction, SolanaUiTransaction } from '@dynamic-labs/solana-core';
7
- import { DynamicError, TransactionFailedError, TransactionConfirmationTimeoutError } from '@dynamic-labs/utils';
7
+ import { DynamicError, sleep, TransactionFailedError, TransactionConfirmationTimeoutError } from '@dynamic-labs/utils';
8
8
  import { withDynamicWaas } from '@dynamic-labs/waas';
9
9
  import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
10
10
  import { logger } from '../../utils/logger.js';
11
11
  import { DynamicWaasSVMSigner } from '../signer/DynamicWaasSVMSigner.js';
12
12
  import { Logger } from '@dynamic-labs/logger';
13
13
 
14
+ // Total sign attempts, including the first, before giving up on sponsorship.
15
+ const SPONSORSHIP_MAX_ATTEMPTS = 3;
16
+ const SPONSORSHIP_RETRY_INTERVAL_MS = 500;
17
+ const SPONSORSHIP_FAILURE_MESSAGE = 'Failed to sponsor Solana transaction';
18
+ const SPONSORSHIP_FAILURE_CODE = 'failed_to_sponsor_solana_transaction';
14
19
  class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
15
20
  connect() {
16
21
  throw new Error('Method not implemented.');
@@ -31,6 +36,26 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
31
36
  setSvmGasSponsorshipEnabled(getEnabled) {
32
37
  this.getSvmGasSponsorshipEnabled = getEnabled;
33
38
  }
39
+ /**
40
+ * Determines whether a sponsorship failure is worth retrying.
41
+ * Deterministic local failures are not retried; HTTP rejections are only
42
+ * retried for rate limits and server errors.
43
+ */
44
+ isRetryableSponsorshipError(error) {
45
+ if (error instanceof DynamicError) {
46
+ if (typeof error.code !== 'string') {
47
+ return false;
48
+ }
49
+ const match = error.code.match(/^sponsorship_http_(\d+)$/);
50
+ if (!match) {
51
+ return false;
52
+ }
53
+ const status = Number(match[1]);
54
+ return status === 429 || status >= 500;
55
+ }
56
+ // Network/fetch failures are retried.
57
+ return true;
58
+ }
34
59
  /**
35
60
  * Check if a transaction is already signed (has non-zero signatures).
36
61
  */
@@ -42,7 +67,9 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
42
67
  }
43
68
  /**
44
69
  * Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
45
- * Falls back to original transaction on error.
70
+ * Retries transient failures; throws if sponsorship never succeeds so callers
71
+ * never sign and return a transaction that silently skipped sponsorship
72
+ * (e.g. a 0-SOL wallet still set as fee payer).
46
73
  */
47
74
  maybeSponsorTransaction(transaction) {
48
75
  return __awaiter(this, void 0, void 0, function* () {
@@ -57,15 +84,26 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
57
84
  logger.warn('[maybeSponsorTransaction] Missing environmentId, skipping sponsorship');
58
85
  return transaction;
59
86
  }
60
- try {
61
- const sponsoredTransaction = yield sponsorSolanaTransaction(this.environmentId, transaction);
62
- logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
63
- return sponsoredTransaction;
64
- }
65
- catch (error) {
66
- logger.warn('[maybeSponsorTransaction] Failed to sponsor transaction, using original', { error });
67
- return transaction;
87
+ for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
88
+ try {
89
+ const sponsoredTransaction = yield sponsorSolanaTransaction(this.environmentId, transaction);
90
+ logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
91
+ return sponsoredTransaction;
92
+ }
93
+ catch (error) {
94
+ logger.warn(`[maybeSponsorTransaction] Sponsorship attempt ${attempt}/${SPONSORSHIP_MAX_ATTEMPTS} failed`, { error });
95
+ if (attempt === SPONSORSHIP_MAX_ATTEMPTS ||
96
+ !this.isRetryableSponsorshipError(error)) {
97
+ if (error instanceof DynamicError) {
98
+ throw error;
99
+ }
100
+ throw new DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
101
+ }
102
+ yield sleep(SPONSORSHIP_RETRY_INTERVAL_MS);
103
+ }
68
104
  }
105
+ // Unreachable: the loop always returns or throws on its final attempt.
106
+ throw new DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
69
107
  });
70
108
  }
71
109
  /**