@dynamic-labs/waas-svm 4.96.1 → 4.96.3
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 +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/connector/DynamicWaasSVMConnector.cjs +53 -11
- package/src/connector/DynamicWaasSVMConnector.d.ts +18 -2
- package/src/connector/DynamicWaasSVMConnector.js +54 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.96.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.96.2...v4.96.3) (2026-08-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* remediate high-severity dependency vulnerabilities ([#12237](https://github.com/dynamic-labs/dynamic-auth/issues/12237)) ([daab647](https://github.com/dynamic-labs/dynamic-auth/commit/daab6476d30709a3262369ae656fd9b4416ced5f))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Performance Improvements
|
|
11
|
+
|
|
12
|
+
* **ethereum-gasless-core:** parallel 7702 auth signing and long-poll sponsored-tx status ([#12226](https://github.com/dynamic-labs/dynamic-auth/issues/12226)) ([0ef5c2c](https://github.com/dynamic-labs/dynamic-auth/commit/0ef5c2cae8a8f9972cedeeff11381cbef9b36e88))
|
|
13
|
+
|
|
14
|
+
### [4.96.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.96.1...v4.96.2) (2026-08-14)
|
|
15
|
+
|
|
2
16
|
### [4.96.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.96.0...v4.96.1) (2026-08-10)
|
|
3
17
|
|
|
4
18
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/waas-svm",
|
|
3
|
-
"version": "4.96.
|
|
3
|
+
"version": "4.96.3",
|
|
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
|
|
22
|
-
"@dynamic-labs/embedded-wallet-solana": "4.96.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.12.0",
|
|
22
|
+
"@dynamic-labs/embedded-wallet-solana": "4.96.3",
|
|
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": "4.96.
|
|
27
|
-
"@dynamic-labs/logger": "4.96.
|
|
28
|
-
"@dynamic-labs/rpc-providers": "4.96.
|
|
29
|
-
"@dynamic-labs/solana-core": "4.96.
|
|
30
|
-
"@dynamic-labs/types": "4.96.
|
|
31
|
-
"@dynamic-labs/utils": "4.96.
|
|
32
|
-
"@dynamic-labs/waas": "4.96.
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "4.96.
|
|
26
|
+
"@dynamic-labs/assert-package-version": "4.96.3",
|
|
27
|
+
"@dynamic-labs/logger": "4.96.3",
|
|
28
|
+
"@dynamic-labs/rpc-providers": "4.96.3",
|
|
29
|
+
"@dynamic-labs/solana-core": "4.96.3",
|
|
30
|
+
"@dynamic-labs/types": "4.96.3",
|
|
31
|
+
"@dynamic-labs/utils": "4.96.3",
|
|
32
|
+
"@dynamic-labs/waas": "4.96.3",
|
|
33
|
+
"@dynamic-labs/wallet-connector-core": "4.96.3"
|
|
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
|
-
*
|
|
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
|
-
|
|
62
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
/**
|
|
@@ -41,7 +41,13 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
41
41
|
mfaAction?: MFAAction | undefined;
|
|
42
42
|
} | undefined) => Promise<string | undefined>): void;
|
|
43
43
|
setGetElevatedAccessTokenFunction(getElevatedAccessToken: (params: {
|
|
44
|
-
scope: TokenScope;
|
|
44
|
+
scope: TokenScope; /**
|
|
45
|
+
* Determines whether a sponsorship failure is worth retrying.
|
|
46
|
+
* Only a classified HTTP rejection can be proven permanent; everything
|
|
47
|
+
* else (network errors, missing auth token, malformed response) defaults
|
|
48
|
+
* to retryable. Classified rejections only retry on rate limits and
|
|
49
|
+
* server errors.
|
|
50
|
+
*/
|
|
45
51
|
}) => Promise<string | undefined>): void;
|
|
46
52
|
setGetWalletPasswordFunction(getWalletPassword: import("@dynamic-labs/wallet-connector-core").GetWalletPasswordFn): void;
|
|
47
53
|
getPasswordIfNeeded({ accountAddress, }: {
|
|
@@ -219,13 +225,23 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
|
|
|
219
225
|
* Using a getter avoids stale values from initialization race conditions.
|
|
220
226
|
*/
|
|
221
227
|
setSvmGasSponsorshipEnabled(getEnabled: () => boolean): void;
|
|
228
|
+
/**
|
|
229
|
+
* Determines whether a sponsorship failure is worth retrying.
|
|
230
|
+
* Only a classified HTTP rejection can be proven permanent; everything
|
|
231
|
+
* else (network errors, missing auth token, malformed response) defaults
|
|
232
|
+
* to retryable. Classified rejections only retry on rate limits and
|
|
233
|
+
* server errors.
|
|
234
|
+
*/
|
|
235
|
+
private isRetryableSponsorshipError;
|
|
222
236
|
/**
|
|
223
237
|
* Check if a transaction is already signed (has non-zero signatures).
|
|
224
238
|
*/
|
|
225
239
|
private isTxAlreadySigned;
|
|
226
240
|
/**
|
|
227
241
|
* Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
|
|
228
|
-
*
|
|
242
|
+
* Retries transient failures; throws if sponsorship never succeeds so callers
|
|
243
|
+
* never sign and return a transaction that silently skipped sponsorship
|
|
244
|
+
* (e.g. a 0-SOL wallet still set as fee payer).
|
|
229
245
|
*/
|
|
230
246
|
private maybeSponsorTransaction;
|
|
231
247
|
/**
|
|
@@ -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
|
-
*
|
|
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
|
-
|
|
58
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
/**
|