@dynamic-labs/waas-svm 5.3.2 → 5.4.1
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 +34 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/connector/DynamicWaasSVMConnector.cjs +30 -21
- package/src/connector/DynamicWaasSVMConnector.d.ts +13 -47
- package/src/connector/DynamicWaasSVMConnector.js +30 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
|
|
2
|
+
### [5.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.0...v5.4.1) (2026-08-26)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **webview-controller:** resolve which keychain key a session belongs to ([#12246](https://github.com/dynamic-labs/dynamic-auth/issues/12246)) ([3d110db](https://github.com/dynamic-labs/dynamic-auth/commit/3d110db831c6e9d82d07d86841f5c7733924b17e))
|
|
8
|
+
* **bitcoin:** forward the password through the BTC importPrivateKey override ([#12278](https://github.com/dynamic-labs/dynamic-auth/issues/12278)) ([21e1df3](https://github.com/dynamic-labs/dynamic-auth/commit/21e1df3e33e96e2efdb15ffa0fd29a441056202e))
|
|
9
|
+
* **react-native-extension:** recover 4.x expo-secure-store sessions on keychain miss ([#12254](https://github.com/dynamic-labs/dynamic-auth/issues/12254)) ([217e991](https://github.com/dynamic-labs/dynamic-auth/commit/217e991838f3073c12e2d2fab7a2e12830faad9e)), closes [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12242](https://github.com/dynamic-labs/dynamic-auth/issues/12242) [#12242](https://github.com/dynamic-labs/dynamic-auth/issues/12242)
|
|
10
|
+
* **transaction-card:** use walletConnector prop for network/fee instead of primaryWallet ([#12063](https://github.com/dynamic-labs/dynamic-auth/issues/12063)) ([81314d2](https://github.com/dynamic-labs/dynamic-auth/commit/81314d25fba4b20ab89631bc2d9ceeb9e2b6b2ac))
|
|
11
|
+
* **waas-svm:** instrument sponsorship retry attempts ([#12281](https://github.com/dynamic-labs/dynamic-auth/issues/12281)) ([7273a4b](https://github.com/dynamic-labs/dynamic-auth/commit/7273a4bc456cad512c0e9fbcd2abd66532a2f7df))
|
|
12
|
+
* **webview-controller:** recover 4.x secure-storage sessions and surface init failures ([#12242](https://github.com/dynamic-labs/dynamic-auth/issues/12242)) ([b51605c](https://github.com/dynamic-labs/dynamic-auth/commit/b51605cc9bdbb5d695173192c502a58d899bbbdd)), closes [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094) [#12095](https://github.com/dynamic-labs/dynamic-auth/issues/12095) [#12098](https://github.com/dynamic-labs/dynamic-auth/issues/12098) [dynamic-labs/flutter-sdk#256](https://github.com/dynamic-labs/flutter-sdk/issues/256)
|
|
13
|
+
|
|
14
|
+
## [5.4.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.2...v5.4.0) (2026-08-25)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **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))
|
|
20
|
+
* **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))
|
|
21
|
+
* **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))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **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))
|
|
27
|
+
* 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))
|
|
28
|
+
* **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))
|
|
29
|
+
* **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))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Performance Improvements
|
|
33
|
+
|
|
34
|
+
* **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))
|
|
35
|
+
|
|
2
36
|
### [5.3.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.1...v5.3.2) (2026-08-19)
|
|
3
37
|
|
|
4
38
|
|
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": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
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",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@dynamic-labs/sdk-api-core": "0.12.0",
|
|
22
|
-
"@dynamic-labs/embedded-wallet-solana": "5.
|
|
22
|
+
"@dynamic-labs/embedded-wallet-solana": "5.4.1",
|
|
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.
|
|
27
|
-
"@dynamic-labs/logger": "5.
|
|
28
|
-
"@dynamic-labs/rpc-providers": "5.
|
|
29
|
-
"@dynamic-labs/solana-core": "5.
|
|
30
|
-
"@dynamic-labs/types": "5.
|
|
31
|
-
"@dynamic-labs/utils": "5.
|
|
32
|
-
"@dynamic-labs/waas": "5.
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
26
|
+
"@dynamic-labs/assert-package-version": "5.4.1",
|
|
27
|
+
"@dynamic-labs/logger": "5.4.1",
|
|
28
|
+
"@dynamic-labs/rpc-providers": "5.4.1",
|
|
29
|
+
"@dynamic-labs/solana-core": "5.4.1",
|
|
30
|
+
"@dynamic-labs/types": "5.4.1",
|
|
31
|
+
"@dynamic-labs/utils": "5.4.1",
|
|
32
|
+
"@dynamic-labs/waas": "5.4.1",
|
|
33
|
+
"@dynamic-labs/wallet-connector-core": "5.4.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {}
|
|
36
36
|
}
|
|
@@ -42,22 +42,24 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Determines whether a sponsorship failure is worth retrying.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
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.
|
|
47
49
|
*/
|
|
48
50
|
isRetryableSponsorshipError(error) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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') {
|
|
53
57
|
const match = error.code.match(/^sponsorship_http_(\d+)$/);
|
|
54
|
-
if (
|
|
55
|
-
|
|
58
|
+
if (match) {
|
|
59
|
+
const status = Number(match[1]);
|
|
60
|
+
return status === 429 || status >= 500;
|
|
56
61
|
}
|
|
57
|
-
const status = Number(match[1]);
|
|
58
|
-
return status === 429 || status >= 500;
|
|
59
62
|
}
|
|
60
|
-
// Network/fetch failures are retried.
|
|
61
63
|
return true;
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
@@ -85,12 +87,20 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
85
87
|
return transaction;
|
|
86
88
|
}
|
|
87
89
|
if (!this.environmentId) {
|
|
88
|
-
|
|
89
|
-
|
|
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');
|
|
90
94
|
}
|
|
95
|
+
const { environmentId } = this;
|
|
91
96
|
for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
|
|
92
97
|
try {
|
|
93
|
-
const sponsoredTransaction = yield
|
|
98
|
+
const sponsoredTransaction = yield this.instrumentAsync({
|
|
99
|
+
context: { attempt, maxAttempts: SPONSORSHIP_MAX_ATTEMPTS },
|
|
100
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () { return embeddedWalletSolana.sponsorSolanaTransaction(environmentId, transaction); }),
|
|
101
|
+
operation: 'maybeSponsorTransaction',
|
|
102
|
+
resource: `sponsorSolanaTransaction-attempt-${attempt}`,
|
|
103
|
+
});
|
|
94
104
|
logger.logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
|
|
95
105
|
return sponsoredTransaction;
|
|
96
106
|
}
|
|
@@ -532,12 +542,12 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
532
542
|
return this.getWalletClient();
|
|
533
543
|
}
|
|
534
544
|
// Chain-specific override for exportClientKeyshares - SVM needs to handle optional account address
|
|
535
|
-
exportClientKeyshares(
|
|
545
|
+
exportClientKeyshares(params) {
|
|
536
546
|
const _super = Object.create(null, {
|
|
537
547
|
exportClientKeyshares: { get: () => super.exportClientKeyshares }
|
|
538
548
|
});
|
|
539
|
-
return _tslib.__awaiter(this,
|
|
540
|
-
const targetAccountAddress = accountAddress || this.activeAccountAddress;
|
|
549
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
550
|
+
const targetAccountAddress = params.accountAddress || this.activeAccountAddress;
|
|
541
551
|
if (!targetAccountAddress) {
|
|
542
552
|
throw new Error('Account address is required');
|
|
543
553
|
}
|
|
@@ -549,10 +559,9 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
549
559
|
time: 0,
|
|
550
560
|
traceId,
|
|
551
561
|
});
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
});
|
|
562
|
+
// Spread, so a field added to ExportClientKeysharesParams later still
|
|
563
|
+
// reaches the base instead of being silently dropped here.
|
|
564
|
+
const result = yield _super.exportClientKeyshares.call(this, Object.assign(Object.assign({}, params), { accountAddress: targetAccountAddress }));
|
|
556
565
|
this.instrument('[exportClientKeyshares] completed', {
|
|
557
566
|
key: 'exportClientKeyshares-completed',
|
|
558
567
|
startTime,
|
|
@@ -2,7 +2,7 @@ import { Connection, SendOptions, Transaction, VersionedTransaction } from '@sol
|
|
|
2
2
|
import { MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
3
3
|
import { ISolanaSigner, SolanaWalletConnector, SolanaWalletConnectorOpts } from '@dynamic-labs/solana-core';
|
|
4
4
|
import { IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
5
|
-
import { IDynamicWaasConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { ExportClientKeysharesParams, IDynamicWaasConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import { Logger } from '../../utils/logger';
|
|
7
7
|
export type DynamicWaasSVMConnectorProps = SolanaWalletConnectorOpts & {
|
|
8
8
|
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
@@ -68,12 +68,7 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
68
68
|
getWaasWalletClient(traceContext?: import("dist/packages/waas/utils/instrumentation").TraceContext | undefined, { forceRebuild }?: {
|
|
69
69
|
forceRebuild?: boolean | undefined;
|
|
70
70
|
} | undefined): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
|
|
71
|
-
createWalletAccount({ thresholdSignatureScheme, password, bitcoinConfig, businessAccountId, }?: {
|
|
72
|
-
thresholdSignatureScheme?: string | undefined;
|
|
73
|
-
password?: string | undefined;
|
|
74
|
-
bitcoinConfig?: import("@dynamic-labs-wallet/browser-wallet-client").BitcoinConfig | undefined;
|
|
75
|
-
businessAccountId?: string | undefined;
|
|
76
|
-
} | undefined): Promise<{
|
|
71
|
+
createWalletAccount({ thresholdSignatureScheme, password, bitcoinConfig, businessAccountId, }?: import("@dynamic-labs/wallet-connector-core").CreateWalletAccountParams | undefined): Promise<{
|
|
77
72
|
chainName: string;
|
|
78
73
|
accountAddress: string;
|
|
79
74
|
publicKeyHex: string;
|
|
@@ -93,17 +88,7 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
93
88
|
}): Promise<{
|
|
94
89
|
shareSetId: string;
|
|
95
90
|
}>;
|
|
96
|
-
importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, password, }:
|
|
97
|
-
privateKey: string;
|
|
98
|
-
/**
|
|
99
|
-
* Override setEnvironmentId to ensure it's set on the global logger
|
|
100
|
-
*/
|
|
101
|
-
thresholdSignatureScheme?: string | undefined;
|
|
102
|
-
publicAddressCheck?: string | undefined;
|
|
103
|
-
addressType?: string | undefined;
|
|
104
|
-
legacyWalletId?: string | undefined;
|
|
105
|
-
password?: string | undefined;
|
|
106
|
-
}): Promise<void>;
|
|
91
|
+
importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, password, isRawScalarImport, }: import("@dynamic-labs/wallet-connector-core").ImportPrivateKeyParams): Promise<void>;
|
|
107
92
|
migrateFromFireblocks({ deviceId, jwt, walletPassword, ncwStorage, expectedAddresses, coinTypes, password, }: {
|
|
108
93
|
deviceId: string;
|
|
109
94
|
jwt: string;
|
|
@@ -121,10 +106,7 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
121
106
|
getExportHandler(): {
|
|
122
107
|
clear: () => void;
|
|
123
108
|
};
|
|
124
|
-
exportClientKeyshares({ accountAddress, password, }:
|
|
125
|
-
accountAddress: string;
|
|
126
|
-
password?: string | undefined;
|
|
127
|
-
}): Promise<void>;
|
|
109
|
+
exportClientKeyshares({ accountAddress, password, }: ExportClientKeysharesParams): Promise<void>;
|
|
128
110
|
runBackupLifecycle({ provider, accountAddress, password, performBackup, }: {
|
|
129
111
|
provider: string;
|
|
130
112
|
accountAddress: string;
|
|
@@ -140,11 +122,7 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
140
122
|
};
|
|
141
123
|
}) => Promise<void>;
|
|
142
124
|
}): Promise<void>;
|
|
143
|
-
backupKeySharesToGoogleDrive({ accountAddress, password, googleDriveAccessToken, }:
|
|
144
|
-
accountAddress: string;
|
|
145
|
-
password?: string | undefined;
|
|
146
|
-
googleDriveAccessToken?: string | undefined;
|
|
147
|
-
}): Promise<void>;
|
|
125
|
+
backupKeySharesToGoogleDrive({ accountAddress, password, googleDriveAccessToken, }: import("@dynamic-labs/wallet-connector-core").BackupKeySharesToGoogleDriveParams): Promise<void>;
|
|
148
126
|
exportClientKeysharesFromGoogleDrive({ accountAddress, password, }: {
|
|
149
127
|
accountAddress: string;
|
|
150
128
|
password?: string | undefined;
|
|
@@ -158,24 +136,13 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
158
136
|
}): Promise<void>;
|
|
159
137
|
hideICloudSignIn(): Promise<void>;
|
|
160
138
|
isICloudAuthenticated(): Promise<boolean>;
|
|
161
|
-
refreshWalletAccountShares({ accountAddress, password, }:
|
|
162
|
-
|
|
163
|
-
password?: string | undefined;
|
|
164
|
-
}): Promise<void>;
|
|
165
|
-
reshareWalletAccountShares({ accountAddress, thresholdSignatureScheme, password, }: {
|
|
166
|
-
accountAddress: string;
|
|
167
|
-
thresholdSignatureScheme: string;
|
|
168
|
-
password?: string | undefined;
|
|
169
|
-
}): Promise<void>;
|
|
139
|
+
refreshWalletAccountShares({ accountAddress, password, }: import("@dynamic-labs/wallet-connector-core").RefreshWalletAccountSharesParams): Promise<void>;
|
|
140
|
+
reshareWalletAccountShares({ accountAddress, thresholdSignatureScheme, password, }: import("@dynamic-labs/wallet-connector-core").ReshareWalletAccountSharesParams): Promise<void>;
|
|
170
141
|
revokeDelegation({ accountAddress, password, }: {
|
|
171
142
|
accountAddress: string;
|
|
172
143
|
password?: string | undefined;
|
|
173
144
|
}): Promise<void>;
|
|
174
|
-
updatePassword({ accountAddress, existingPassword, newPassword, }:
|
|
175
|
-
accountAddress: string;
|
|
176
|
-
existingPassword?: string | undefined;
|
|
177
|
-
newPassword: string;
|
|
178
|
-
}): Promise<void>;
|
|
145
|
+
updatePassword({ accountAddress, existingPassword, newPassword, }: import("@dynamic-labs/wallet-connector-core").UpdatePasswordParams): Promise<void>;
|
|
179
146
|
setPassword({ accountAddress, newPassword, }: {
|
|
180
147
|
accountAddress: string;
|
|
181
148
|
newPassword: string;
|
|
@@ -246,8 +213,10 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
|
|
|
246
213
|
setSvmGasSponsorshipEnabled(getEnabled: () => boolean): void;
|
|
247
214
|
/**
|
|
248
215
|
* Determines whether a sponsorship failure is worth retrying.
|
|
249
|
-
*
|
|
250
|
-
*
|
|
216
|
+
* Only a classified HTTP rejection can be proven permanent; everything
|
|
217
|
+
* else (network errors, missing auth token, malformed response) defaults
|
|
218
|
+
* to retryable. Classified rejections only retry on rate limits and
|
|
219
|
+
* server errors.
|
|
251
220
|
*/
|
|
252
221
|
private isRetryableSponsorshipError;
|
|
253
222
|
/**
|
|
@@ -294,10 +263,7 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
|
|
|
294
263
|
getWalletClientByAddress({ accountAddress, }: {
|
|
295
264
|
accountAddress: string;
|
|
296
265
|
}): Connection;
|
|
297
|
-
exportClientKeyshares(
|
|
298
|
-
accountAddress: string;
|
|
299
|
-
password?: string;
|
|
300
|
-
}): Promise<void>;
|
|
266
|
+
exportClientKeyshares(params: ExportClientKeysharesParams): Promise<void>;
|
|
301
267
|
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
302
268
|
signMessageWithContext(): Promise<string>;
|
|
303
269
|
}
|
|
@@ -38,22 +38,24 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Determines whether a sponsorship failure is worth retrying.
|
|
41
|
-
*
|
|
42
|
-
*
|
|
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.
|
|
43
45
|
*/
|
|
44
46
|
isRetryableSponsorshipError(error) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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') {
|
|
49
53
|
const match = error.code.match(/^sponsorship_http_(\d+)$/);
|
|
50
|
-
if (
|
|
51
|
-
|
|
54
|
+
if (match) {
|
|
55
|
+
const status = Number(match[1]);
|
|
56
|
+
return status === 429 || status >= 500;
|
|
52
57
|
}
|
|
53
|
-
const status = Number(match[1]);
|
|
54
|
-
return status === 429 || status >= 500;
|
|
55
58
|
}
|
|
56
|
-
// Network/fetch failures are retried.
|
|
57
59
|
return true;
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
@@ -81,12 +83,20 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
81
83
|
return transaction;
|
|
82
84
|
}
|
|
83
85
|
if (!this.environmentId) {
|
|
84
|
-
|
|
85
|
-
|
|
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');
|
|
86
90
|
}
|
|
91
|
+
const { environmentId } = this;
|
|
87
92
|
for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
|
|
88
93
|
try {
|
|
89
|
-
const sponsoredTransaction = yield
|
|
94
|
+
const sponsoredTransaction = yield this.instrumentAsync({
|
|
95
|
+
context: { attempt, maxAttempts: SPONSORSHIP_MAX_ATTEMPTS },
|
|
96
|
+
fn: () => __awaiter(this, void 0, void 0, function* () { return sponsorSolanaTransaction(environmentId, transaction); }),
|
|
97
|
+
operation: 'maybeSponsorTransaction',
|
|
98
|
+
resource: `sponsorSolanaTransaction-attempt-${attempt}`,
|
|
99
|
+
});
|
|
90
100
|
logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
|
|
91
101
|
return sponsoredTransaction;
|
|
92
102
|
}
|
|
@@ -528,12 +538,12 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
528
538
|
return this.getWalletClient();
|
|
529
539
|
}
|
|
530
540
|
// Chain-specific override for exportClientKeyshares - SVM needs to handle optional account address
|
|
531
|
-
exportClientKeyshares(
|
|
541
|
+
exportClientKeyshares(params) {
|
|
532
542
|
const _super = Object.create(null, {
|
|
533
543
|
exportClientKeyshares: { get: () => super.exportClientKeyshares }
|
|
534
544
|
});
|
|
535
|
-
return __awaiter(this,
|
|
536
|
-
const targetAccountAddress = accountAddress || this.activeAccountAddress;
|
|
545
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
546
|
+
const targetAccountAddress = params.accountAddress || this.activeAccountAddress;
|
|
537
547
|
if (!targetAccountAddress) {
|
|
538
548
|
throw new Error('Account address is required');
|
|
539
549
|
}
|
|
@@ -545,10 +555,9 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
545
555
|
time: 0,
|
|
546
556
|
traceId,
|
|
547
557
|
});
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
});
|
|
558
|
+
// Spread, so a field added to ExportClientKeysharesParams later still
|
|
559
|
+
// reaches the base instead of being silently dropped here.
|
|
560
|
+
const result = yield _super.exportClientKeyshares.call(this, Object.assign(Object.assign({}, params), { accountAddress: targetAccountAddress }));
|
|
552
561
|
this.instrument('[exportClientKeyshares] completed', {
|
|
553
562
|
key: 'exportClientKeyshares-completed',
|
|
554
563
|
startTime,
|