@dynamic-labs/waas-evm 4.74.0 → 4.75.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 +12 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/DynamicWaasEVMConnector.cjs +62 -8
- package/src/DynamicWaasEVMConnector.d.ts +21 -0
- package/src/DynamicWaasEVMConnector.js +62 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.75.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.74.1...v4.75.0) (2026-04-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **midnight:** add midnight base package scaffolding ([#10850](https://github.com/dynamic-labs/dynamic-auth/issues/10850)) ([5844849](https://github.com/dynamic-labs/dynamic-auth/commit/584484916cf49d7ec46ec5cf862e2e6b8308d90f))
|
|
8
|
+
* **tempo:** add FeeTokenSelector component for fee token selection ([#10842](https://github.com/dynamic-labs/dynamic-auth/issues/10842)) ([18bc637](https://github.com/dynamic-labs/dynamic-auth/commit/18bc6374bea6eeff6656edaa725b0620bc8b36dd))
|
|
9
|
+
|
|
10
|
+
### [4.74.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.74.0...v4.74.1) (2026-04-02)
|
|
11
|
+
|
|
12
|
+
This was a version bump only, there were no code changes.
|
|
13
|
+
|
|
2
14
|
## [4.74.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.73.2...v4.74.0) (2026-04-02)
|
|
3
15
|
|
|
4
16
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/waas-evm",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.75.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,15 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.923",
|
|
22
22
|
"viem": "^2.45.3",
|
|
23
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
24
|
-
"@dynamic-labs/ethereum-core": "4.
|
|
25
|
-
"@dynamic-labs/logger": "4.
|
|
26
|
-
"@dynamic-labs/types": "4.
|
|
27
|
-
"@dynamic-labs/utils": "4.
|
|
28
|
-
"@dynamic-labs/waas": "4.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
23
|
+
"@dynamic-labs/assert-package-version": "4.75.0",
|
|
24
|
+
"@dynamic-labs/ethereum-core": "4.75.0",
|
|
25
|
+
"@dynamic-labs/logger": "4.75.0",
|
|
26
|
+
"@dynamic-labs/types": "4.75.0",
|
|
27
|
+
"@dynamic-labs/utils": "4.75.0",
|
|
28
|
+
"@dynamic-labs/waas": "4.75.0",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.75.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {}
|
|
32
32
|
}
|
|
@@ -16,12 +16,42 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
|
16
16
|
|
|
17
17
|
const logger = new logger$1.Logger('DynamicWaasConnector');
|
|
18
18
|
class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.EthereumWalletConnector) {
|
|
19
|
+
isUnsupportedChainId(chainId) {
|
|
20
|
+
return (chainId !== undefined && this.unsupportedChainIds.has(Number(chainId)));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns EVM networks filtered to only those this connector supports.
|
|
24
|
+
* Networks handled by dedicated connectors (e.g. Tempo) are excluded.
|
|
25
|
+
*/
|
|
26
|
+
get supportedEvmNetworks() {
|
|
27
|
+
return this.evmNetworks.filter((network) => !this.isUnsupportedChainId(network.chainId));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Override getEnabledNetworks to filter out unsupported networks.
|
|
31
|
+
* This is the UI-facing method used by network pickers.
|
|
32
|
+
*
|
|
33
|
+
* Note: We override getEnabledNetworks() instead of the evmNetworks getter because
|
|
34
|
+
* evmNetworks is a class field in EthereumWalletConnector, and class fields create
|
|
35
|
+
* own properties that shadow prototype-based getters/setters.
|
|
36
|
+
*/
|
|
37
|
+
getEnabledNetworks() {
|
|
38
|
+
return this.supportedEvmNetworks;
|
|
39
|
+
}
|
|
19
40
|
constructor(props) {
|
|
20
41
|
super(props);
|
|
21
42
|
this.name = 'Dynamic Waas';
|
|
22
43
|
this.logger = logger;
|
|
23
44
|
this.overrideKey = 'dynamicwaas';
|
|
24
45
|
this.isEmbeddedWallet = true;
|
|
46
|
+
/**
|
|
47
|
+
* Chain IDs that have dedicated connectors and should not be handled by this connector.
|
|
48
|
+
* Networks with these chain IDs are filtered from network lists and rejected during switching.
|
|
49
|
+
*/
|
|
50
|
+
this.unsupportedChainIds = new Set([
|
|
51
|
+
4217, // Tempo Mainnet
|
|
52
|
+
42429, // Tempo Testnet
|
|
53
|
+
42431, // Tempo Moderato
|
|
54
|
+
]);
|
|
25
55
|
this._selectedChainId = this.getLastUsedChainId();
|
|
26
56
|
this.__exportHandler = new waas.WaasExportHandler();
|
|
27
57
|
}
|
|
@@ -34,10 +64,10 @@ class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.Ethereum
|
|
|
34
64
|
if (this.lastUsedChainId) {
|
|
35
65
|
return this.lastUsedChainId;
|
|
36
66
|
}
|
|
37
|
-
if (!((_a = this.
|
|
67
|
+
if (!((_a = this.supportedEvmNetworks) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
38
68
|
return undefined;
|
|
39
69
|
}
|
|
40
|
-
return this.
|
|
70
|
+
return this.supportedEvmNetworks[0].chainId;
|
|
41
71
|
}
|
|
42
72
|
set verifiedCredentials(verifiedCredentials) {
|
|
43
73
|
this._verifiedCredentials = verifiedCredentials;
|
|
@@ -80,6 +110,7 @@ class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.Ethereum
|
|
|
80
110
|
this._selectedChainId = chainId;
|
|
81
111
|
}
|
|
82
112
|
get lastUsedChainId() {
|
|
113
|
+
var _a, _b;
|
|
83
114
|
const lastUsedChainIdLS = localStorage.getItem(DynamicWaasEVMConnector.lastUsedChainIdStorageKey);
|
|
84
115
|
if (!lastUsedChainIdLS)
|
|
85
116
|
return undefined;
|
|
@@ -88,10 +119,20 @@ class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.Ethereum
|
|
|
88
119
|
if (isNaN(chainId)) {
|
|
89
120
|
return undefined;
|
|
90
121
|
}
|
|
91
|
-
|
|
122
|
+
// Reject unsupported chain IDs even if stored in localStorage
|
|
123
|
+
if (this.isUnsupportedChainId(chainId)) {
|
|
124
|
+
const fallbackChainId = (_a = this.supportedEvmNetworks[0]) === null || _a === void 0 ? void 0 : _a.chainId;
|
|
125
|
+
if (fallbackChainId) {
|
|
126
|
+
this.lastUsedChainId = fallbackChainId;
|
|
127
|
+
}
|
|
128
|
+
return fallbackChainId;
|
|
129
|
+
}
|
|
130
|
+
const isChainCurrentlyEnabled = this.supportedEvmNetworks.some((network) => network.chainId === chainId);
|
|
92
131
|
if (!isChainCurrentlyEnabled) {
|
|
93
|
-
const lastUsedChainId = this.
|
|
94
|
-
|
|
132
|
+
const lastUsedChainId = (_b = this.supportedEvmNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
133
|
+
if (lastUsedChainId) {
|
|
134
|
+
this.lastUsedChainId = lastUsedChainId;
|
|
135
|
+
}
|
|
95
136
|
return lastUsedChainId;
|
|
96
137
|
}
|
|
97
138
|
return chainId;
|
|
@@ -102,8 +143,11 @@ class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.Ethereum
|
|
|
102
143
|
}
|
|
103
144
|
}
|
|
104
145
|
get currentChainId() {
|
|
105
|
-
var _a, _b
|
|
106
|
-
|
|
146
|
+
var _a, _b;
|
|
147
|
+
const selected = this._selectedChainId && !this.isUnsupportedChainId(this._selectedChainId)
|
|
148
|
+
? this._selectedChainId
|
|
149
|
+
: undefined;
|
|
150
|
+
return selected !== null && selected !== void 0 ? selected : (_b = (_a = this.supportedEvmNetworks) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
107
151
|
}
|
|
108
152
|
getNetwork() {
|
|
109
153
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -111,7 +155,7 @@ class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.Ethereum
|
|
|
111
155
|
});
|
|
112
156
|
}
|
|
113
157
|
getEvmNetworkByChainId(chainId) {
|
|
114
|
-
return this.
|
|
158
|
+
return this.supportedEvmNetworks.find((network) => network.chainId === chainId);
|
|
115
159
|
}
|
|
116
160
|
currentEvmNetwork() {
|
|
117
161
|
const chainId = this.currentChainId;
|
|
@@ -122,6 +166,7 @@ class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.Ethereum
|
|
|
122
166
|
}
|
|
123
167
|
switchNetwork(_a) {
|
|
124
168
|
return _tslib.__awaiter(this, arguments, void 0, function* ({ networkChainId, }) {
|
|
169
|
+
var _b;
|
|
125
170
|
if (!networkChainId) {
|
|
126
171
|
return;
|
|
127
172
|
}
|
|
@@ -129,6 +174,15 @@ class DynamicWaasEVMConnector extends waas.withDynamicWaas(ethereumCore.Ethereum
|
|
|
129
174
|
if (typeof networkChainId === 'string') {
|
|
130
175
|
networkChainIdInt = parseInt(networkChainId);
|
|
131
176
|
}
|
|
177
|
+
// Reject unsupported chain IDs - fall back to first supported network
|
|
178
|
+
if (this.isUnsupportedChainId(networkChainIdInt)) {
|
|
179
|
+
const fallbackChainId = (_b = this.supportedEvmNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
180
|
+
if (!fallbackChainId) {
|
|
181
|
+
// No supported networks available
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
networkChainIdInt = fallbackChainId;
|
|
185
|
+
}
|
|
132
186
|
this.lastUsedChainId = networkChainIdInt;
|
|
133
187
|
this._selectedChainId = networkChainIdInt;
|
|
134
188
|
this.emit('chainChange', {
|
|
@@ -6,6 +6,7 @@ import { JwtVerifiedCredential, MFAAction, SignMessageContext, TokenScope } from
|
|
|
6
6
|
import { IUITransaction } from '@dynamic-labs/types';
|
|
7
7
|
import { WaasExportHandler } from '@dynamic-labs/waas';
|
|
8
8
|
import { IDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
|
|
9
|
+
type EvmNetwork = EthereumWalletConnector['evmNetworks'][number];
|
|
9
10
|
interface JwtVerifiedCredentialWithSmartWalletRef extends JwtVerifiedCredential {
|
|
10
11
|
smartWalletRefId?: string;
|
|
11
12
|
smartWalletRefAddress?: string;
|
|
@@ -162,6 +163,26 @@ export declare class DynamicWaasEVMConnector extends DynamicWaasEVMConnector_bas
|
|
|
162
163
|
logger: Logger;
|
|
163
164
|
overrideKey: string;
|
|
164
165
|
isEmbeddedWallet: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Chain IDs that have dedicated connectors and should not be handled by this connector.
|
|
168
|
+
* Networks with these chain IDs are filtered from network lists and rejected during switching.
|
|
169
|
+
*/
|
|
170
|
+
private unsupportedChainIds;
|
|
171
|
+
private isUnsupportedChainId;
|
|
172
|
+
/**
|
|
173
|
+
* Returns EVM networks filtered to only those this connector supports.
|
|
174
|
+
* Networks handled by dedicated connectors (e.g. Tempo) are excluded.
|
|
175
|
+
*/
|
|
176
|
+
private get supportedEvmNetworks();
|
|
177
|
+
/**
|
|
178
|
+
* Override getEnabledNetworks to filter out unsupported networks.
|
|
179
|
+
* This is the UI-facing method used by network pickers.
|
|
180
|
+
*
|
|
181
|
+
* Note: We override getEnabledNetworks() instead of the evmNetworks getter because
|
|
182
|
+
* evmNetworks is a class field in EthereumWalletConnector, and class fields create
|
|
183
|
+
* own properties that shadow prototype-based getters/setters.
|
|
184
|
+
*/
|
|
185
|
+
getEnabledNetworks(): EvmNetwork[];
|
|
165
186
|
/**
|
|
166
187
|
* Relationship between verifiedCredential and verifiedCredentials:
|
|
167
188
|
* - verifiedCredential: The first/primary credential from the array (used for active account)
|
|
@@ -12,12 +12,42 @@ import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
|
12
12
|
|
|
13
13
|
const logger = new Logger('DynamicWaasConnector');
|
|
14
14
|
class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
15
|
+
isUnsupportedChainId(chainId) {
|
|
16
|
+
return (chainId !== undefined && this.unsupportedChainIds.has(Number(chainId)));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns EVM networks filtered to only those this connector supports.
|
|
20
|
+
* Networks handled by dedicated connectors (e.g. Tempo) are excluded.
|
|
21
|
+
*/
|
|
22
|
+
get supportedEvmNetworks() {
|
|
23
|
+
return this.evmNetworks.filter((network) => !this.isUnsupportedChainId(network.chainId));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Override getEnabledNetworks to filter out unsupported networks.
|
|
27
|
+
* This is the UI-facing method used by network pickers.
|
|
28
|
+
*
|
|
29
|
+
* Note: We override getEnabledNetworks() instead of the evmNetworks getter because
|
|
30
|
+
* evmNetworks is a class field in EthereumWalletConnector, and class fields create
|
|
31
|
+
* own properties that shadow prototype-based getters/setters.
|
|
32
|
+
*/
|
|
33
|
+
getEnabledNetworks() {
|
|
34
|
+
return this.supportedEvmNetworks;
|
|
35
|
+
}
|
|
15
36
|
constructor(props) {
|
|
16
37
|
super(props);
|
|
17
38
|
this.name = 'Dynamic Waas';
|
|
18
39
|
this.logger = logger;
|
|
19
40
|
this.overrideKey = 'dynamicwaas';
|
|
20
41
|
this.isEmbeddedWallet = true;
|
|
42
|
+
/**
|
|
43
|
+
* Chain IDs that have dedicated connectors and should not be handled by this connector.
|
|
44
|
+
* Networks with these chain IDs are filtered from network lists and rejected during switching.
|
|
45
|
+
*/
|
|
46
|
+
this.unsupportedChainIds = new Set([
|
|
47
|
+
4217, // Tempo Mainnet
|
|
48
|
+
42429, // Tempo Testnet
|
|
49
|
+
42431, // Tempo Moderato
|
|
50
|
+
]);
|
|
21
51
|
this._selectedChainId = this.getLastUsedChainId();
|
|
22
52
|
this.__exportHandler = new WaasExportHandler();
|
|
23
53
|
}
|
|
@@ -30,10 +60,10 @@ class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
|
30
60
|
if (this.lastUsedChainId) {
|
|
31
61
|
return this.lastUsedChainId;
|
|
32
62
|
}
|
|
33
|
-
if (!((_a = this.
|
|
63
|
+
if (!((_a = this.supportedEvmNetworks) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
34
64
|
return undefined;
|
|
35
65
|
}
|
|
36
|
-
return this.
|
|
66
|
+
return this.supportedEvmNetworks[0].chainId;
|
|
37
67
|
}
|
|
38
68
|
set verifiedCredentials(verifiedCredentials) {
|
|
39
69
|
this._verifiedCredentials = verifiedCredentials;
|
|
@@ -76,6 +106,7 @@ class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
|
76
106
|
this._selectedChainId = chainId;
|
|
77
107
|
}
|
|
78
108
|
get lastUsedChainId() {
|
|
109
|
+
var _a, _b;
|
|
79
110
|
const lastUsedChainIdLS = localStorage.getItem(DynamicWaasEVMConnector.lastUsedChainIdStorageKey);
|
|
80
111
|
if (!lastUsedChainIdLS)
|
|
81
112
|
return undefined;
|
|
@@ -84,10 +115,20 @@ class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
|
84
115
|
if (isNaN(chainId)) {
|
|
85
116
|
return undefined;
|
|
86
117
|
}
|
|
87
|
-
|
|
118
|
+
// Reject unsupported chain IDs even if stored in localStorage
|
|
119
|
+
if (this.isUnsupportedChainId(chainId)) {
|
|
120
|
+
const fallbackChainId = (_a = this.supportedEvmNetworks[0]) === null || _a === void 0 ? void 0 : _a.chainId;
|
|
121
|
+
if (fallbackChainId) {
|
|
122
|
+
this.lastUsedChainId = fallbackChainId;
|
|
123
|
+
}
|
|
124
|
+
return fallbackChainId;
|
|
125
|
+
}
|
|
126
|
+
const isChainCurrentlyEnabled = this.supportedEvmNetworks.some((network) => network.chainId === chainId);
|
|
88
127
|
if (!isChainCurrentlyEnabled) {
|
|
89
|
-
const lastUsedChainId = this.
|
|
90
|
-
|
|
128
|
+
const lastUsedChainId = (_b = this.supportedEvmNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
129
|
+
if (lastUsedChainId) {
|
|
130
|
+
this.lastUsedChainId = lastUsedChainId;
|
|
131
|
+
}
|
|
91
132
|
return lastUsedChainId;
|
|
92
133
|
}
|
|
93
134
|
return chainId;
|
|
@@ -98,8 +139,11 @@ class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
|
98
139
|
}
|
|
99
140
|
}
|
|
100
141
|
get currentChainId() {
|
|
101
|
-
var _a, _b
|
|
102
|
-
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const selected = this._selectedChainId && !this.isUnsupportedChainId(this._selectedChainId)
|
|
144
|
+
? this._selectedChainId
|
|
145
|
+
: undefined;
|
|
146
|
+
return selected !== null && selected !== void 0 ? selected : (_b = (_a = this.supportedEvmNetworks) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
103
147
|
}
|
|
104
148
|
getNetwork() {
|
|
105
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -107,7 +151,7 @@ class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
|
107
151
|
});
|
|
108
152
|
}
|
|
109
153
|
getEvmNetworkByChainId(chainId) {
|
|
110
|
-
return this.
|
|
154
|
+
return this.supportedEvmNetworks.find((network) => network.chainId === chainId);
|
|
111
155
|
}
|
|
112
156
|
currentEvmNetwork() {
|
|
113
157
|
const chainId = this.currentChainId;
|
|
@@ -118,6 +162,7 @@ class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
|
118
162
|
}
|
|
119
163
|
switchNetwork(_a) {
|
|
120
164
|
return __awaiter(this, arguments, void 0, function* ({ networkChainId, }) {
|
|
165
|
+
var _b;
|
|
121
166
|
if (!networkChainId) {
|
|
122
167
|
return;
|
|
123
168
|
}
|
|
@@ -125,6 +170,15 @@ class DynamicWaasEVMConnector extends withDynamicWaas(EthereumWalletConnector) {
|
|
|
125
170
|
if (typeof networkChainId === 'string') {
|
|
126
171
|
networkChainIdInt = parseInt(networkChainId);
|
|
127
172
|
}
|
|
173
|
+
// Reject unsupported chain IDs - fall back to first supported network
|
|
174
|
+
if (this.isUnsupportedChainId(networkChainIdInt)) {
|
|
175
|
+
const fallbackChainId = (_b = this.supportedEvmNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
176
|
+
if (!fallbackChainId) {
|
|
177
|
+
// No supported networks available
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
networkChainIdInt = fallbackChainId;
|
|
181
|
+
}
|
|
128
182
|
this.lastUsedChainId = networkChainIdInt;
|
|
129
183
|
this._selectedChainId = networkChainIdInt;
|
|
130
184
|
this.emit('chainChange', {
|