Skip to content

Commit 5beb2b2

Browse files
fixed async request bug for websites like debank (#3)
* fixed async request bug for websites like debank * fix: pulls in new settings * release: updated version
1 parent f62c836 commit 5beb2b2

File tree

4 files changed

+17
-20
lines changed

4 files changed

+17
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Wallet Guard: Browse Web3 Securely",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"description": "A browser extension for detecting phishing attacks on crypto wallets",
55
"main": "index.js",
66
"scripts": {

src/background.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,11 @@ chrome.runtime.onInstalled.addListener(async (details) => {
107107
// TODO: Signin Anonymously
108108
}
109109

110-
chrome.storage.local.set({ settings: WG_DEFAULT_SETTINGS });
111-
112-
// TODO: Re-add this after txn simulation release
113-
// localStorageHelpers.get<Settings>(WgKeys.Settings).then((res) => {
114-
// if (!res) {
115-
// chrome.storage.local.set({ settings: WG_DEFAULT_SETTINGS });
116-
// }
117-
// });
110+
localStorageHelpers.get<Settings>(WgKeys.Settings).then((res) => {
111+
if (!res) {
112+
chrome.storage.local.set({ settings: WG_DEFAULT_SETTINGS });
113+
}
114+
});
118115

119116
const ONE_DAY_AS_MINUTES = 1440;
120117
chrome.alarms.create('checkVersions', {

src/injected/injectWalletGuard.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ const addWalletGuardProxy = (provider: any) => {
211211
log.info(request, 'Request being sent');
212212
provider
213213
.request({ method: 'eth_chainId' })
214-
.then((chainId: any) =>
215-
REQUEST_MANAGER.request({
214+
.then((chainId: any) => {
215+
return REQUEST_MANAGER.request({
216216
chainId,
217217
signer: request.params[0].from,
218218
transaction: request.params[0],
219219
method: request.method,
220-
})
221-
)
220+
});
221+
})
222222
.then((response: any) => {
223223
if (response === Response.Reject) {
224224
log.info('Reject');
@@ -252,16 +252,16 @@ const addWalletGuardProxy = (provider: any) => {
252252

253253
provider
254254
.request({ method: 'eth_chainId' })
255-
.then((chainId: any) =>
256-
REQUEST_MANAGER.request({
255+
.then((chainId: any) => {
256+
return REQUEST_MANAGER.request({
257257
chainId,
258258
signer: params[0],
259259
domain: params['domain'],
260260
message: params['message'],
261261
primaryType: params['primaryType'],
262262
method: request.method,
263-
})
264-
)
263+
});
264+
})
265265
.then((response: any) => {
266266
if (response === Response.Reject) {
267267
log.info('Reject');
@@ -293,7 +293,7 @@ const addWalletGuardProxy = (provider: any) => {
293293
provider
294294
.request({ method: 'eth_chainId' })
295295
.then((chainId: any) => {
296-
REQUEST_MANAGER.request({
296+
return REQUEST_MANAGER.request({
297297
chainId,
298298
signer: request.params[0],
299299
hash: request.params[1],
@@ -331,7 +331,7 @@ const addWalletGuardProxy = (provider: any) => {
331331
provider
332332
.request({ method: 'eth_chainId' })
333333
.then((chainId: any) => {
334-
REQUEST_MANAGER.request({
334+
return REQUEST_MANAGER.request({
335335
chainId,
336336
signer: request.params[1],
337337
signMessage: request.params[0],

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Wallet Guard: Browse Web3 Securely",
44
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0SMGNwLFsP2k1jAD54vtDqLJuIpeZWCc9gdvo2N8hzE1qIkOt29ynU1VgkJbtfuWHqWSyOCo1ljs2MjbqqFjG4qz5o3ZrEAMwmEbWGCuPddUIIiWIK0oF+BkwZiRpRS2nw/i9Dmeusf0eOlxxLYD0NpKszX73lqGt4LBIY8Wva7vmqdnKPa1F6+DDZviXcBRa8CLCzqDujTjON37o+NvQOq2u49UzVXr/DcePFrUTnnjdNkKTQkLlH00lwvxUUJl0g5IVdlxNgZXPY/C6P39YIIxsBFJH0rXvQrLgED6NGR17CBnLhOmmYghku17yoUGg3KrT4aeh8+uG5NrQZuqGwIDAQAB",
55
"description": "Wallet Guard acts as a security companion to your crypto wallet of choice, so you can browse at ease.",
6-
"version": "0.7.0",
6+
"version": "0.7.1",
77
"icons": {
88
"128": "images/wg_logos/logo_128x128.png"
99
},

0 commit comments

Comments
 (0)