From b3692fb75638f69f59a3fa8fb5de060d575c3d1d Mon Sep 17 00:00:00 2001 From: schmanu Date: Thu, 8 Feb 2024 14:15:57 +0100 Subject: [PATCH 1/2] feat: use isTestnet flag --- package.json | 2 +- src/components/common/NetworkSelector/index.tsx | 7 +------ src/hooks/loadables/useLoadTxQueue.ts | 2 +- src/tests/mocks/chains.ts | 12 ++++++++++++ yarn.lock | 8 ++++---- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index f7c2a23ec7..c5d3a9e81d 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@safe-global/safe-core-sdk-utils": "^1.7.4", "@safe-global/safe-deployments": "1.32.0", "@safe-global/safe-ethers-lib": "^1.9.4", - "@safe-global/safe-gateway-typescript-sdk": "^3.14.0", + "@safe-global/safe-gateway-typescript-sdk": "^3.15.0", "@safe-global/safe-modules-deployments": "^1.2.0", "@sentry/react": "^7.91.0", "@spindl-xyz/attribution-lite": "^1.4.0", diff --git a/src/components/common/NetworkSelector/index.tsx b/src/components/common/NetworkSelector/index.tsx index b1e76fea60..60d45f68bf 100644 --- a/src/components/common/NetworkSelector/index.tsx +++ b/src/components/common/NetworkSelector/index.tsx @@ -31,11 +31,6 @@ const MenuWithTooltip = forwardRef(function MenuWithTooltip(pr ) }) -const testNets = ['gor', 'base-gor', 'sep'] -const isTestnet = (shortName: string) => { - return testNets.includes(shortName) -} - const NetworkSelector = (props: { onChainSelect?: () => void }): ReactElement => { const wallet = useWallet() const isDarkMode = useDarkMode() @@ -44,7 +39,7 @@ const NetworkSelector = (props: { onChainSelect?: () => void }): ReactElement => const chainId = useChainId() const router = useRouter() - const [testNets, prodNets] = useMemo(() => partition(configs, (config) => isTestnet(config.shortName)), [configs]) + const [testNets, prodNets] = useMemo(() => partition(configs, (config) => config.isTestnet), [configs]) const getNetworkLink = useCallback( (shortName: string) => { diff --git a/src/hooks/loadables/useLoadTxQueue.ts b/src/hooks/loadables/useLoadTxQueue.ts index 8cbaeacf66..3e8a1aea2b 100644 --- a/src/hooks/loadables/useLoadTxQueue.ts +++ b/src/hooks/loadables/useLoadTxQueue.ts @@ -10,7 +10,7 @@ export const useLoadTxQueue = (): AsyncResult => { const { chainId, txQueuedTag, txHistoryTag } = safe const [proposedId, setProposedId] = useState('') // N.B. we reload when txQueuedTag/txHistoryTag/proposedId changes as txQueuedTag alone is not enough - const reloadTag = txQueuedTag + txHistoryTag + proposedId + const reloadTag = (txQueuedTag ?? '') + (txHistoryTag ?? '') + proposedId // Re-fetch when chainId/address, or txQueueTag change const [data, error, loading] = useAsync( diff --git a/src/tests/mocks/chains.ts b/src/tests/mocks/chains.ts index dd99cfadeb..9d0f6cfeb8 100644 --- a/src/tests/mocks/chains.ts +++ b/src/tests/mocks/chains.ts @@ -8,6 +8,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Ethereum', shortName: 'eth', l2: false, + isTestnet: false, description: 'The main Ethereum network', rpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://mainnet.infura.io/v3/' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://mainnet.infura.io/v3/' }, @@ -57,6 +58,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Gnosis Chain', shortName: 'gno', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://rpc.gnosischain.com/' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://rpc.gnosischain.com/' }, @@ -105,6 +107,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Polygon', shortName: 'matic', l2: true, + isTestnet: false, description: 'L2 chain (MATIC)', rpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://polygon-mainnet.infura.io/v3/' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://polygon-mainnet.infura.io/v3/' }, @@ -159,6 +162,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'BNB Smart Chain', shortName: 'bnb', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://bsc-dataseed.binance.org/' }, safeAppsRpcUri: { @@ -209,6 +213,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Energy Web Chain', shortName: 'ewt', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://rpc.energyweb.org' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://rpc.energyweb.org' }, @@ -257,6 +262,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Arbitrum', shortName: 'arb1', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://arb1.arbitrum.io/rpc' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://arb1.arbitrum.io/rpc' }, @@ -303,6 +309,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Aurora', shortName: 'aurora', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://mainnet.aurora.dev' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://mainnet.aurora.dev' }, @@ -344,6 +351,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Avalanche', shortName: 'avax', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://api.avax.network/ext/bc/C/rpc' }, safeAppsRpcUri: { @@ -397,6 +405,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Optimism', shortName: 'oeth', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://mainnet.optimism.io/' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://mainnet.optimism.io/' }, @@ -443,6 +452,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Goerli', shortName: 'gor', l2: true, + isTestnet: true, description: 'Ethereum Testnet Görli', rpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://goerli.infura.io/v3/' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://goerli.infura.io/v3/' }, @@ -492,6 +502,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Rinkeby', shortName: 'rin', l2: false, + isTestnet: true, description: 'Ethereum testnet', rpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://rinkeby.infura.io/v3/' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.API_KEY_PATH, value: 'https://rinkeby.infura.io/v3/' }, @@ -531,6 +542,7 @@ const CONFIG_SERVICE_CHAINS: ChainInfo[] = [ chainName: 'Volta', shortName: 'vt', l2: true, + isTestnet: false, description: '', rpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://volta-rpc.energyweb.org' }, safeAppsRpcUri: { authentication: RPC_AUTHENTICATION.NO_AUTHENTICATION, value: 'https://volta-rpc.energyweb.org' }, diff --git a/yarn.lock b/yarn.lock index ec3a888815..49b97edeec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4003,10 +4003,10 @@ "@safe-global/safe-core-sdk-utils" "^1.7.4" ethers "5.7.2" -"@safe-global/safe-gateway-typescript-sdk@^3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.14.0.tgz#9581c524c1ea4956555f40761eb6b4007392aa82" - integrity sha512-/dqU66RvHw50n+7x3nwnJedq8V6iLQyoWitNdjx5cFTBmae+rpP+LvHq+LqZfXJVkB1qNytMdjFjdyES0t79gQ== +"@safe-global/safe-gateway-typescript-sdk@^3.15.0": + version "3.15.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.15.0.tgz#2a99e7eca7aecfad1f5e00744ffdd949cefa4f6a" + integrity sha512-zAzhPgUwzdp89ZrZwCAOImUyAQMQE0LQKcK4vLO5eMbfAcNOxz5g4eVdBRBRa+kVXxjyW5wii58ZlGaYUVBa7g== "@safe-global/safe-gateway-typescript-sdk@^3.5.3": version "3.12.0" From 5c069a495975bd3843e1e7a3179bf54dc63a9034 Mon Sep 17 00:00:00 2001 From: schmanu Date: Thu, 8 Feb 2024 14:41:09 +0100 Subject: [PATCH 2/2] 1.29.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c5d3a9e81d..be84cd5a5b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "safe-wallet-web", "homepage": "https://github.com/safe-global/safe-wallet-web", "license": "GPL-3.0", - "version": "1.29.0", + "version": "1.29.1", "type": "module", "scripts": { "dev": "next dev",