@dynamic-labs/global-wallet 3.0.0-alpha.48 → 3.0.0-alpha.50
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/index.js +8 -6
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -59,7 +59,6 @@ const GlobalWalletExtension = {
|
|
|
59
59
|
extend: (connector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
60
|
let web3wallet;
|
|
61
61
|
let WCListenersOn = false;
|
|
62
|
-
const signer = (yield connector.getSigner());
|
|
63
62
|
let pendingSessionProposal;
|
|
64
63
|
const globalWallet = {
|
|
65
64
|
confirmPairing: (confirm) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -125,15 +124,13 @@ const GlobalWalletExtension = {
|
|
|
125
124
|
const sessionMessageListener = (_b) => __awaiter(void 0, [_b], void 0, function* ({ params, id, topic }) {
|
|
126
125
|
const { request, chainId } = params;
|
|
127
126
|
// since we cant listen to chain events from the dapp, just change when a request comes in
|
|
128
|
-
if (chainId) {
|
|
129
|
-
yield connector.switchNetwork({
|
|
130
|
-
networkChainId: chainId.split(':')[1],
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
127
|
const [requestParamsMessage, typedDataToSign] = request.params;
|
|
128
|
+
const signer = (yield connector.getSigner());
|
|
134
129
|
const handleRequest = (handler) => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
130
|
try {
|
|
131
|
+
connector.isGlobalTransaction = true;
|
|
136
132
|
const result = yield handler();
|
|
133
|
+
connector.isGlobalTransaction = false;
|
|
137
134
|
return { id, jsonrpc: '2.0', result };
|
|
138
135
|
}
|
|
139
136
|
catch (e) {
|
|
@@ -158,6 +155,11 @@ const GlobalWalletExtension = {
|
|
|
158
155
|
response = yield handleRequest(() => connector.signMessage(message));
|
|
159
156
|
}
|
|
160
157
|
else if (request.method === 'eth_sendTransaction') {
|
|
158
|
+
if (chainId) {
|
|
159
|
+
yield connector.switchNetwork({
|
|
160
|
+
networkChainId: chainId.split(':')[1],
|
|
161
|
+
});
|
|
162
|
+
}
|
|
161
163
|
response = yield handleRequest(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
162
164
|
return signer.sendTransaction(Object.assign(Object.assign({}, requestParamsMessage), { gas: fromHex(requestParamsMessage.gas, 'bigint'), value: requestParamsMessage.value
|
|
163
165
|
? fromHex(requestParamsMessage.value, 'bigint')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/global-wallet",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.50",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"viem": "2.7.6",
|
|
35
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
35
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.50"
|
|
36
36
|
}
|
|
37
37
|
}
|