@dynamic-labs/waas-svm 5.3.1 → 5.4.0

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,43 @@
1
1
 
2
+ ## [5.4.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.2...v5.4.0) (2026-08-25)
3
+
4
+
5
+ ### Features
6
+
7
+ * **aleo:** wire up signMessage on the WaaS Aleo connector ([#12235](https://github.com/dynamic-labs/dynamic-auth/issues/12235)) ([e56cbf5](https://github.com/dynamic-labs/dynamic-auth/commit/e56cbf5546bdcc21ce916dece43ae36dcea9b808))
8
+ * **waas:** thread isRawScalarImport through importPrivateKey for ed25519 chains ([#12220](https://github.com/dynamic-labs/dynamic-auth/issues/12220)) ([ced9efa](https://github.com/dynamic-labs/dynamic-auth/commit/ced9efac5fa5a4a1280383419f56fe22733722cd))
9
+ * **webview:** add policies message contract and controller ([#12248](https://github.com/dynamic-labs/dynamic-auth/issues/12248)) ([8557c1e](https://github.com/dynamic-labs/dynamic-auth/commit/8557c1ed3861e12f1f06b2bb610184813b577daa))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **bitcoin:** pass the wallet's address type when signing ([#12265](https://github.com/dynamic-labs/dynamic-auth/issues/12265)) ([b8a8eab](https://github.com/dynamic-labs/dynamic-auth/commit/b8a8eab7e4cc294cc307fb10ea6814e76111a274))
15
+ * remediate high-severity tar vulnerability and prune a dead override ([#12268](https://github.com/dynamic-labs/dynamic-auth/issues/12268)) ([6b1b343](https://github.com/dynamic-labs/dynamic-auth/commit/6b1b343e7947e8da30012446677e342ae9bfe14a))
16
+ * **waas-svm:** fix retry-classification and environmentId gaps in [#12240](https://github.com/dynamic-labs/dynamic-auth/issues/12240) ([#12247](https://github.com/dynamic-labs/dynamic-auth/issues/12247)) ([e79cecc](https://github.com/dynamic-labs/dynamic-auth/commit/e79ceccd424c48c3a7f45fdd6ea288c269ac0171))
17
+ * **wallet-connect:** reopen WalletConnect IndexedDB when the browser closes the connection ([#12262](https://github.com/dynamic-labs/dynamic-auth/issues/12262)) ([1a20dde](https://github.com/dynamic-labs/dynamic-auth/commit/1a20ddeaeec590ae3390c9e47ef3c14738379b83))
18
+
19
+
20
+ ### Performance Improvements
21
+
22
+ * **ethereum-gasless-core:** parallel 7702 auth signing and long-poll sponsored-tx status ([#12225](https://github.com/dynamic-labs/dynamic-auth/issues/12225)) ([53ca916](https://github.com/dynamic-labs/dynamic-auth/commit/53ca91668f8dd839c52d55a0e5d7bb5257f7f415))
23
+
24
+ ### [5.3.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.1...v5.3.2) (2026-08-19)
25
+
26
+
27
+ ### Features
28
+
29
+ * **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))
30
+ * **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))
31
+ * 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))
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **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))
37
+ * **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))
38
+ * 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))
39
+ * **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))
40
+
2
41
  ### [5.3.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.0...v5.3.1) (2026-08-14)
3
42
 
4
43
  ## [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.4.0";
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.4.0";
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.4.0",
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.4.0",
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.4.0",
27
+ "@dynamic-labs/logger": "5.4.0",
28
+ "@dynamic-labs/rpc-providers": "5.4.0",
29
+ "@dynamic-labs/solana-core": "5.4.0",
30
+ "@dynamic-labs/types": "5.4.0",
31
+ "@dynamic-labs/utils": "5.4.0",
32
+ "@dynamic-labs/waas": "5.4.0",
33
+ "@dynamic-labs/wallet-connector-core": "5.4.0"
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,28 @@ 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
+ * Only a classified HTTP rejection can be proven permanent; everything
46
+ * else (network errors, missing auth token, malformed response) defaults
47
+ * to retryable. Classified rejections only retry on rate limits and
48
+ * server errors.
49
+ */
50
+ isRetryableSponsorshipError(error) {
51
+ // Only a classified HTTP rejection can be proven permanent (e.g. a
52
+ // definitive 400/403 sponsor refusal). Everything else — network/fetch
53
+ // failures, a missing auth token, a malformed response body — has no
54
+ // evidence it won't clear on retry (e.g. a token hydration race), so it
55
+ // defaults to retryable rather than being guessed as permanent.
56
+ if (error instanceof utils.DynamicError && typeof error.code === 'string') {
57
+ const match = error.code.match(/^sponsorship_http_(\d+)$/);
58
+ if (match) {
59
+ const status = Number(match[1]);
60
+ return status === 429 || status >= 500;
61
+ }
62
+ }
63
+ return true;
64
+ }
38
65
  /**
39
66
  * Check if a transaction is already signed (has non-zero signatures).
40
67
  */
@@ -46,7 +73,9 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
46
73
  }
47
74
  /**
48
75
  * Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
49
- * Falls back to original transaction on error.
76
+ * Retries transient failures; throws if sponsorship never succeeds so callers
77
+ * never sign and return a transaction that silently skipped sponsorship
78
+ * (e.g. a 0-SOL wallet still set as fee payer).
50
79
  */
51
80
  maybeSponsorTransaction(transaction) {
52
81
  return _tslib.__awaiter(this, void 0, void 0, function* () {
@@ -58,18 +87,31 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
58
87
  return transaction;
59
88
  }
60
89
  if (!this.environmentId) {
61
- logger.logger.warn('[maybeSponsorTransaction] Missing environmentId, skipping sponsorship');
62
- return transaction;
90
+ // A missing environmentId can't resolve itself on retry, and silently
91
+ // returning the unsponsored transaction is exactly the fail-open
92
+ // behavior this method exists to eliminate.
93
+ throw new utils.DynamicError('Missing environmentId, cannot sponsor transaction', 'sponsorship_missing_environment_id');
63
94
  }
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;
95
+ for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
96
+ try {
97
+ const sponsoredTransaction = yield embeddedWalletSolana.sponsorSolanaTransaction(this.environmentId, transaction);
98
+ logger.logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
99
+ return sponsoredTransaction;
100
+ }
101
+ catch (error) {
102
+ logger.logger.warn(`[maybeSponsorTransaction] Sponsorship attempt ${attempt}/${SPONSORSHIP_MAX_ATTEMPTS} failed`, { error });
103
+ if (attempt === SPONSORSHIP_MAX_ATTEMPTS ||
104
+ !this.isRetryableSponsorshipError(error)) {
105
+ if (error instanceof utils.DynamicError) {
106
+ throw error;
107
+ }
108
+ throw new utils.DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
109
+ }
110
+ yield utils.sleep(SPONSORSHIP_RETRY_INTERVAL_MS);
111
+ }
72
112
  }
113
+ // Unreachable: the loop always returns or throws on its final attempt.
114
+ throw new utils.DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
73
115
  });
74
116
  }
75
117
  /**
@@ -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;
@@ -96,13 +93,14 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
96
93
  }): Promise<{
97
94
  shareSetId: string;
98
95
  }>;
99
- importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, password, }: {
96
+ importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, password, isRawScalarImport, }: {
100
97
  privateKey: string;
101
98
  thresholdSignatureScheme?: string | undefined;
102
99
  publicAddressCheck?: string | undefined;
103
100
  addressType?: string | undefined;
104
101
  legacyWalletId?: string | undefined;
105
102
  password?: string | undefined;
103
+ isRawScalarImport?: boolean | undefined;
106
104
  }): Promise<void>;
107
105
  migrateFromFireblocks({ deviceId, jwt, walletPassword, ncwStorage, expectedAddresses, coinTypes, password, }: {
108
106
  deviceId: string;
@@ -193,6 +191,12 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
193
191
  getWalletRecoveryState({ accountAddress, }: {
194
192
  accountAddress: string;
195
193
  }): Promise<import("@dynamic-labs-wallet/browser-wallet-client").WalletRecoveryState>;
194
+ createOfflineRecoveryShares({ accountAddress, password, cloudProviderAccessToken, mfaToken, }: {
195
+ accountAddress: string;
196
+ password?: string | undefined;
197
+ cloudProviderAccessToken?: string | undefined;
198
+ mfaToken?: string | undefined;
199
+ }): Promise<void>;
196
200
  endSession(reason?: import("@dynamic-labs-sdk/client").LogoutReason | undefined): Promise<void>;
197
201
  getActiveAccountAddress(): Promise<string | undefined>;
198
202
  getConnectedAccounts(): Promise<string[]>;
@@ -238,13 +242,23 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
238
242
  * Using a getter avoids stale values from initialization race conditions.
239
243
  */
240
244
  setSvmGasSponsorshipEnabled(getEnabled: () => boolean): void;
245
+ /**
246
+ * Determines whether a sponsorship failure is worth retrying.
247
+ * Only a classified HTTP rejection can be proven permanent; everything
248
+ * else (network errors, missing auth token, malformed response) defaults
249
+ * to retryable. Classified rejections only retry on rate limits and
250
+ * 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,28 @@ 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
+ * Only a classified HTTP rejection can be proven permanent; everything
42
+ * else (network errors, missing auth token, malformed response) defaults
43
+ * to retryable. Classified rejections only retry on rate limits and
44
+ * server errors.
45
+ */
46
+ isRetryableSponsorshipError(error) {
47
+ // Only a classified HTTP rejection can be proven permanent (e.g. a
48
+ // definitive 400/403 sponsor refusal). Everything else — network/fetch
49
+ // failures, a missing auth token, a malformed response body — has no
50
+ // evidence it won't clear on retry (e.g. a token hydration race), so it
51
+ // defaults to retryable rather than being guessed as permanent.
52
+ if (error instanceof DynamicError && typeof error.code === 'string') {
53
+ const match = error.code.match(/^sponsorship_http_(\d+)$/);
54
+ if (match) {
55
+ const status = Number(match[1]);
56
+ return status === 429 || status >= 500;
57
+ }
58
+ }
59
+ return true;
60
+ }
34
61
  /**
35
62
  * Check if a transaction is already signed (has non-zero signatures).
36
63
  */
@@ -42,7 +69,9 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
42
69
  }
43
70
  /**
44
71
  * Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
45
- * Falls back to original transaction on error.
72
+ * Retries transient failures; throws if sponsorship never succeeds so callers
73
+ * never sign and return a transaction that silently skipped sponsorship
74
+ * (e.g. a 0-SOL wallet still set as fee payer).
46
75
  */
47
76
  maybeSponsorTransaction(transaction) {
48
77
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,18 +83,31 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
54
83
  return transaction;
55
84
  }
56
85
  if (!this.environmentId) {
57
- logger.warn('[maybeSponsorTransaction] Missing environmentId, skipping sponsorship');
58
- return transaction;
86
+ // A missing environmentId can't resolve itself on retry, and silently
87
+ // returning the unsponsored transaction is exactly the fail-open
88
+ // behavior this method exists to eliminate.
89
+ throw new DynamicError('Missing environmentId, cannot sponsor transaction', 'sponsorship_missing_environment_id');
59
90
  }
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;
91
+ for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
92
+ try {
93
+ const sponsoredTransaction = yield sponsorSolanaTransaction(this.environmentId, transaction);
94
+ logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
95
+ return sponsoredTransaction;
96
+ }
97
+ catch (error) {
98
+ 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 DynamicError) {
102
+ throw error;
103
+ }
104
+ throw new DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
105
+ }
106
+ yield sleep(SPONSORSHIP_RETRY_INTERVAL_MS);
107
+ }
68
108
  }
109
+ // Unreachable: the loop always returns or throws on its final attempt.
110
+ throw new DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
69
111
  });
70
112
  }
71
113
  /**