@dynamic-labs/global-wallet 4.18.2 → 4.18.4
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/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +4 -4
- package/src/GlobalWalletConnector.cjs +29 -1
- package/src/GlobalWalletConnector.js +29 -1
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/global-wallet",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.4",
|
|
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",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"@walletconnect/utils": "2.19.1",
|
|
23
23
|
"@reown/walletkit": "1.1.2",
|
|
24
24
|
"jsqr": "1.4.0",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "4.18.
|
|
26
|
-
"@dynamic-labs/ethereum-core": "4.18.
|
|
27
|
-
"@dynamic-labs/wallet-connector-core": "4.18.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.18.4",
|
|
26
|
+
"@dynamic-labs/ethereum-core": "4.18.4",
|
|
27
|
+
"@dynamic-labs/wallet-connector-core": "4.18.4"
|
|
28
28
|
},
|
|
29
29
|
"overrides": {
|
|
30
30
|
"elliptic": "6.6.1"
|
|
@@ -38,12 +38,33 @@ const buildCombinedNamespaces = (params) => {
|
|
|
38
38
|
methods: Array.from(methods),
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
+
const globalConnectorState = {
|
|
42
|
+
isGlobalTransaction: false,
|
|
43
|
+
};
|
|
41
44
|
const GlobalWalletExtension = {
|
|
42
45
|
extend: (connector, settings) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
43
46
|
let web3wallet;
|
|
44
47
|
let WCListenersOn = false;
|
|
45
48
|
let pendingSessionProposal;
|
|
46
49
|
let signer = (yield connector.getSigner());
|
|
50
|
+
/**
|
|
51
|
+
* Defines a shared property 'isGlobalTransaction' on the connector instance.
|
|
52
|
+
*
|
|
53
|
+
* This implementation uses a singleton pattern with the globalConnectorState object
|
|
54
|
+
* to ensure that all connector instances share the same transaction state.
|
|
55
|
+
*
|
|
56
|
+
* Previously, the state of the wallet connector was not being shared correctly
|
|
57
|
+
* across different instances, causing connector.isGlobalTransaction to return false
|
|
58
|
+
* even when set to true in another instance of the connector.
|
|
59
|
+
*
|
|
60
|
+
* This property accessor ensures consistent state across all instances.
|
|
61
|
+
*/
|
|
62
|
+
Object.defineProperty(connector, 'isGlobalTransaction', {
|
|
63
|
+
get: () => globalConnectorState.isGlobalTransaction,
|
|
64
|
+
set: (value) => {
|
|
65
|
+
globalConnectorState.isGlobalTransaction = value;
|
|
66
|
+
},
|
|
67
|
+
});
|
|
47
68
|
const globalWallet = {
|
|
48
69
|
confirmPairing: (confirm) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
49
70
|
const { params, id } = pendingSessionProposal;
|
|
@@ -143,7 +164,14 @@ const GlobalWalletExtension = {
|
|
|
143
164
|
});
|
|
144
165
|
const handlePersonalSign = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
145
166
|
const message = Buffer.from(requestParamsMessage.slice(2), 'hex').toString('utf8');
|
|
146
|
-
return handleRequest(() =>
|
|
167
|
+
return handleRequest(() => {
|
|
168
|
+
const chainIdMatch = message.match(/Chain ID: (\d+)/);
|
|
169
|
+
const chainId = chainIdMatch ? chainIdMatch[1] : undefined;
|
|
170
|
+
if ('signMessageForChain' in connector && chainId) {
|
|
171
|
+
return connector.signMessageForChain(message, chainId);
|
|
172
|
+
}
|
|
173
|
+
return connector.signMessage(message);
|
|
174
|
+
});
|
|
147
175
|
});
|
|
148
176
|
const handleEthSendTransaction = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
149
177
|
if (chainId) {
|
|
@@ -30,12 +30,33 @@ const buildCombinedNamespaces = (params) => {
|
|
|
30
30
|
methods: Array.from(methods),
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
const globalConnectorState = {
|
|
34
|
+
isGlobalTransaction: false,
|
|
35
|
+
};
|
|
33
36
|
const GlobalWalletExtension = {
|
|
34
37
|
extend: (connector, settings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
38
|
let web3wallet;
|
|
36
39
|
let WCListenersOn = false;
|
|
37
40
|
let pendingSessionProposal;
|
|
38
41
|
let signer = (yield connector.getSigner());
|
|
42
|
+
/**
|
|
43
|
+
* Defines a shared property 'isGlobalTransaction' on the connector instance.
|
|
44
|
+
*
|
|
45
|
+
* This implementation uses a singleton pattern with the globalConnectorState object
|
|
46
|
+
* to ensure that all connector instances share the same transaction state.
|
|
47
|
+
*
|
|
48
|
+
* Previously, the state of the wallet connector was not being shared correctly
|
|
49
|
+
* across different instances, causing connector.isGlobalTransaction to return false
|
|
50
|
+
* even when set to true in another instance of the connector.
|
|
51
|
+
*
|
|
52
|
+
* This property accessor ensures consistent state across all instances.
|
|
53
|
+
*/
|
|
54
|
+
Object.defineProperty(connector, 'isGlobalTransaction', {
|
|
55
|
+
get: () => globalConnectorState.isGlobalTransaction,
|
|
56
|
+
set: (value) => {
|
|
57
|
+
globalConnectorState.isGlobalTransaction = value;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
39
60
|
const globalWallet = {
|
|
40
61
|
confirmPairing: (confirm) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
62
|
const { params, id } = pendingSessionProposal;
|
|
@@ -135,7 +156,14 @@ const GlobalWalletExtension = {
|
|
|
135
156
|
});
|
|
136
157
|
const handlePersonalSign = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
137
158
|
const message = Buffer.from(requestParamsMessage.slice(2), 'hex').toString('utf8');
|
|
138
|
-
return handleRequest(() =>
|
|
159
|
+
return handleRequest(() => {
|
|
160
|
+
const chainIdMatch = message.match(/Chain ID: (\d+)/);
|
|
161
|
+
const chainId = chainIdMatch ? chainIdMatch[1] : undefined;
|
|
162
|
+
if ('signMessageForChain' in connector && chainId) {
|
|
163
|
+
return connector.signMessageForChain(message, chainId);
|
|
164
|
+
}
|
|
165
|
+
return connector.signMessage(message);
|
|
166
|
+
});
|
|
139
167
|
});
|
|
140
168
|
const handleEthSendTransaction = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
169
|
if (chainId) {
|