Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit b3841a5

Browse files
mmv08Daniel Sanchez
andauthored
Fix desktop localstorage (#3491)
* Filter desktop owners based on chainId * Bump safe-deployments lib to add Aurora compatibility Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
1 parent ff17ccd commit b3841a5

9 files changed

Lines changed: 57 additions & 23 deletions

File tree

.github/workflows/release-mainnet-desktop.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@ jobs:
1717
fail-fast: false
1818
max-parallel: 15
1919
matrix:
20-
os: [macos-latest, windows-latest, ubuntu-18.04]
20+
os: [macos-10.15, windows-2019, ubuntu-18.04]
2121

2222
steps:
2323
- name: Check out Git repository
2424
uses: actions/checkout@v2
2525

26+
- name: Install Node.js, NPM and Yarn
27+
uses: actions/setup-node@v2
28+
with:
29+
node-version: 14
30+
2631
# Linux build patches
2732
- name: Install linux dependencies
2833
if: startsWith(matrix.os, 'ubuntu')
@@ -34,11 +39,6 @@ jobs:
3439
path: '**/node_modules'
3540
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
3641

37-
- name: Install Node.js, NPM and Yarn
38-
uses: actions/setup-node@v2
39-
with:
40-
node-version: 14
41-
4242
- name: Run yarn install
4343
run: yarn install --frozen-lockfile --network-timeout 1000000
4444

@@ -70,18 +70,18 @@ jobs:
7070
uses: actions/upload-artifact@v2
7171
with:
7272
name: Desktop OSX
73-
path: ./dist/Safe[ ]Multisig*.dmg
73+
path: ./dist/Safe*.dmg
7474

7575
- name: 'Upload Artifacts Linux'
7676
if: startsWith(matrix.os, 'ubuntu')
7777
uses: actions/upload-artifact@v2
7878
with:
7979
name: Desktop Linux
80-
path: ./dist/Safe[ ]Multisig*.AppImage
80+
path: ./dist/Safe*.AppImage
8181

8282
- name: 'Upload Artifacts Windows'
8383
if: startsWith(matrix.os, 'windows')
8484
uses: actions/upload-artifact@v2
8585
with:
8686
name: Desktop Windows
87-
path: ./dist/Safe[ ]Multisig*.exe
87+
path: ./dist/Safe*.exe

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"build": "cross-env REACT_APP_APP_VERSION=$npm_package_version rescripts --max-old-space-size=8192 build",
2424
"compile-electron": "tsc --project tsconfig.electron.json",
2525
"eject": "rescripts eject",
26-
"electron-build": "yarn compile-electron && electron-builder --windows",
26+
"electron-build": "yarn compile-electron && electron-builder --mac",
2727
"electron-dev": "yarn compile-electron && concurrently \"cross-env BROWSER=none REACT_APP_BUILD_FOR_DESKTOP=true yarn start\" \"wait-on http://localhost:3000 && electron .\"",
2828
"format:staged": "lint-staged",
2929
"generate-types": "yarn generate-types:spendingLimit && yarn generate-types:safeDeployments && yarn generate-types:erc20 && yarn generate-types:erc721",
@@ -72,7 +72,7 @@
7272
"!src/**/assets/**"
7373
]
7474
},
75-
"productName": "Safe",
75+
"productName": "Safe Multisig",
7676
"build": {
7777
"appId": "io.gnosis.safe",
7878
"afterSign": "scripts/notarize.js",
@@ -168,9 +168,9 @@
168168
"@gnosis.pm/safe-apps-sdk": "6.1.0",
169169
"@gnosis.pm/safe-apps-sdk-v1": "npm:@gnosis.pm/safe-apps-sdk@0.4.2",
170170
"@gnosis.pm/safe-core-sdk": "^1.1.1",
171-
"@gnosis.pm/safe-deployments": "^1.5.0",
171+
"@gnosis.pm/safe-deployments": "^1.8.0",
172172
"@gnosis.pm/safe-react-components": "^0.9.0",
173-
"@gnosis.pm/safe-react-gateway-sdk": "2.7.5",
173+
"@gnosis.pm/safe-react-gateway-sdk": "2.8.1",
174174
"@ledgerhq/hw-transport-node-hid-singleton": "6.20.0",
175175
"@material-ui/core": "^4.12.3",
176176
"@material-ui/icons": "^4.11.0",

src/config/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from '@gnosis.pm/safe-react-gateway-sdk'
99

1010
import {
11-
GATEWAY_URL,
1211
DEFAULT_CHAIN_ID,
1312
ETHERSCAN_API_KEY,
1413
INFURA_TOKEN,

src/logic/safe/api/fetchSafeApps.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ import { _getChainId } from 'src/config'
44
import { GATEWAY_URL } from 'src/utils/constants'
55

66
export const fetchSafeAppsList = async (): Promise<SafeAppData[]> => {
7-
return getSafeApps(GATEWAY_URL, _getChainId())
7+
return getSafeApps(GATEWAY_URL, _getChainId(), {
8+
client_url: window.location.origin,
9+
})
810
}

src/logic/wallets/utils/walletList.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ const wallets = (): Wallet[] => {
7474
export const getSupportedWallets = (): WalletInitOptions[] => {
7575
if (window.isDesktop) {
7676
return wallets()
77-
.filter((wallet) => wallet.desktop)
77+
.filter(({ desktop }) => desktop)
78+
.filter(({ walletName }) => !getDisabledWallets().includes(walletName))
7879
.map(({ desktop, ...rest }) => rest)
7980
}
8081

src/routes/safe/components/Apps/components/AppCard/index.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { SafeAppAccessPolicyTypes } from '@gnosis.pm/safe-react-gateway-sdk'
12
import { FETCH_STATUS } from 'src/utils/requests'
23
import { getEmptySafeApp } from '../../utils'
34
import { AppCard, AddCustomAppCard } from './index'
@@ -22,6 +23,9 @@ export const LoadedApp = (): React.ReactElement => (
2223
description: 'Gnosis safe app',
2324
fetchStatus: FETCH_STATUS.SUCCESS,
2425
chainIds: ['4'],
26+
accessControl: {
27+
type: SafeAppAccessPolicyTypes.NoRestrictions,
28+
},
2529
}}
2630
/>
2731
)

src/routes/safe/components/Apps/components/AppsList.test.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import AppsList, { PINNED_APPS_LIST_TEST_ID, ALL_APPS_LIST_TEST_ID } from './AppsList'
2-
import { render, screen, fireEvent, within, act, waitFor } from 'src/utils/test-utils'
1+
import { SafeAppAccessPolicyTypes } from '@gnosis.pm/safe-react-gateway-sdk'
32

3+
import { render, screen, fireEvent, within, act, waitFor } from 'src/utils/test-utils'
44
import * as appUtils from 'src/routes/safe/components/Apps/utils'
55
import { FETCH_STATUS } from 'src/utils/requests'
66
import { loadFromStorage, saveToStorage } from 'src/utils/storage'
77
import * as googleAnalytics from 'src/utils/googleAnalytics'
88

9+
import AppsList, { PINNED_APPS_LIST_TEST_ID, ALL_APPS_LIST_TEST_ID } from './AppsList'
10+
911
jest.mock('src/routes/routes', () => {
1012
const original = jest.requireActual('src/routes/routes')
1113
return {
@@ -30,6 +32,9 @@ jest.mock('@gnosis.pm/safe-react-gateway-sdk', () => ({
3032
fetchStatus: 'SUCCESS',
3133
chainIds: ['1', '4'],
3234
provider: null,
35+
accessControl: {
36+
type: 'NO_RESTRICTIONS',
37+
},
3338
},
3439
{
3540
id: 3,
@@ -41,6 +46,10 @@ jest.mock('@gnosis.pm/safe-react-gateway-sdk', () => ({
4146
fetchStatus: 'SUCCESS',
4247
chainIds: ['1', '4'],
4348
provider: null,
49+
accessControl: {
50+
type: 'DOMAIN_ALLOWLIST',
51+
value: ['https://gnosis-safe.io'],
52+
},
4453
},
4554
{
4655
id: 14,
@@ -51,6 +60,9 @@ jest.mock('@gnosis.pm/safe-react-gateway-sdk', () => ({
5160
fetchStatus: 'SUCCESS',
5261
chainIds: ['1', '4'],
5362
provider: null,
63+
accessControl: {
64+
type: 'NO_RESTRICTIONS',
65+
},
5466
},
5567
{
5668
id: 24,
@@ -61,6 +73,10 @@ jest.mock('@gnosis.pm/safe-react-gateway-sdk', () => ({
6173
fetchStatus: 'SUCCESS',
6274
chainIds: ['1', '4', '56', '100', '137', '246', '73799'],
6375
provider: null,
76+
accessControl: {
77+
type: 'DOMAIN_ALLOWLIST',
78+
value: ['https://gnosis-safe.io'],
79+
},
6480
},
6581
]),
6682
}))
@@ -92,6 +108,9 @@ beforeEach(() => {
92108
chainIds: ['4'],
93109
provider: undefined,
94110
fetchStatus: FETCH_STATUS.SUCCESS,
111+
accessControl: {
112+
type: SafeAppAccessPolicyTypes.NoRestrictions,
113+
},
95114
}),
96115
)
97116
})

src/routes/safe/components/Apps/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import memoize from 'lodash/memoize'
44
import { getContentFromENS } from 'src/logic/wallets/getWeb3'
55
import appsIconSvg from 'src/assets/icons/apps.svg'
66
import { FETCH_STATUS } from 'src/utils/requests'
7+
import { SafeAppAccessPolicyTypes } from '@gnosis.pm/safe-react-gateway-sdk'
78

89
import { SafeApp } from './types'
910

@@ -47,6 +48,9 @@ export const getEmptySafeApp = (url = ''): SafeApp => {
4748
description: '',
4849
fetchStatus: FETCH_STATUS.LOADING,
4950
chainIds: [],
51+
accessControl: {
52+
type: SafeAppAccessPolicyTypes.NoRestrictions,
53+
},
5054
}
5155
}
5256

yarn.lock

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,11 +2150,16 @@
21502150
"@gnosis.pm/safe-deployments" "^1.4.0"
21512151
ethereumjs-util "^7.1.3"
21522152

2153-
"@gnosis.pm/safe-deployments@^1.4.0", "@gnosis.pm/safe-deployments@^1.5.0":
2153+
"@gnosis.pm/safe-deployments@^1.4.0":
21542154
version "1.5.0"
21552155
resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-deployments/-/safe-deployments-1.5.0.tgz#5e01ccc2e2d78bf91ecb4453a64d1cac3a5ba2d6"
21562156
integrity sha512-IDU7I+IQr1zUU94/uD8shDVI+/nUA1unQUg8jtbTG0YGcmm49Lu8G01rqtWt2mhLxZWzFsgbLWGnU+/BzUqk7g==
21572157

2158+
"@gnosis.pm/safe-deployments@^1.8.0":
2159+
version "1.8.0"
2160+
resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-deployments/-/safe-deployments-1.8.0.tgz#856c15517274f924539ea4df40fffe6f009249a7"
2161+
integrity sha512-xK2ZZXxCEGOw+6UZAeUmvqE/4C/XTpYmv1a8KzKUgSOxcGkHsIDqcjdKjqif7gOdnwHl4+XXJUtDQEuSLT4Scg==
2162+
21582163
"@gnosis.pm/safe-react-components@^0.9.0":
21592164
version "0.9.0"
21602165
resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-react-components/-/safe-react-components-0.9.0.tgz#c5169cab41cde96c9a375005f380cd37bd909fe0"
@@ -2163,10 +2168,10 @@
21632168
react-media "^1.10.0"
21642169
web3-utils "^1.6.0"
21652170

2166-
"@gnosis.pm/safe-react-gateway-sdk@2.7.5":
2167-
version "2.7.5"
2168-
resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-react-gateway-sdk/-/safe-react-gateway-sdk-2.7.5.tgz#5640fc8c3972397ea1135f1e552d0c3333acb8fa"
2169-
integrity sha512-kY2aOLqfm9fxZbeMa8JkyKr7S3RYdxL/B0n2rU2fRAoPULleq+a6wZ2Y+zHC+XrHpjsNi6QIA183apP+XcRYIQ==
2171+
"@gnosis.pm/safe-react-gateway-sdk@2.8.1":
2172+
version "2.8.1"
2173+
resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-react-gateway-sdk/-/safe-react-gateway-sdk-2.8.1.tgz#3ed166fb49fa19837c9ce8d9ba4f29a14755e9c4"
2174+
integrity sha512-J6gJT6sbXvEPqhrWepEEgwYseo4UVUU3wNS9GNIpGMuh0zi7ZU0Gld+yXqSAoZWtS3hCntg7lyuM8W31AEjQLQ==
21702175
dependencies:
21712176
isomorphic-unfetch "^3.1.0"
21722177

0 commit comments

Comments
 (0)