From 186cfab9e4b600a43b4a8729a64b7b028785a18e Mon Sep 17 00:00:00 2001 From: fritzschoff Date: Thu, 27 Jan 2022 16:24:12 +0100 Subject: [PATCH 1/2] added new contract interface types --- packages/queries/package.json | 4 ++-- packages/queries/src/types.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/queries/package.json b/packages/queries/package.json index db7672c11..22ab2bfcd 100644 --- a/packages/queries/package.json +++ b/packages/queries/package.json @@ -33,9 +33,9 @@ }, "dependencies": { "@snapshot-labs/snapshot.js": "0.3.22", - "@synthetixio/contracts-interface": "2.57.1", + "@synthetixio/contracts-interface": "2.57.2", "@synthetixio/optimism-networks": "2.57.1", - "@synthetixio/providers": "2.57.1", + "@synthetixio/providers": "2.57.2", "@synthetixio/transaction-notifier": "2.57.1", "@synthetixio/wei": "2.57.1", "axios": "0.21.1", diff --git a/packages/queries/src/types.ts b/packages/queries/src/types.ts index b2bee62a9..af28e3a05 100644 --- a/packages/queries/src/types.ts +++ b/packages/queries/src/types.ts @@ -1,5 +1,5 @@ import Wei from '@synthetixio/wei'; -import { CurrencyKey } from '@synthetixio/contracts-interface'; +import { CurrencyKey, NetworkId, NetworkName } from '@synthetixio/contracts-interface'; import { BigNumber } from 'ethers'; export type GasPrice = { @@ -103,7 +103,7 @@ export type GlobalStakingInfo = { export type Token = { address: string; - chainId: number; + chainId: NetworkId; decimals: number; logoURI: string; name: string; @@ -140,7 +140,7 @@ export type SpaceData = { }; members: string[]; name: string; - network: string; + network: NetworkName; skin: string; strategies: SpaceStrategy[]; symbol: string; @@ -161,7 +161,7 @@ export type Proposal = { author: string; created: number; space: SpaceData; - network: string; + network: NetworkName; strategies: SpaceStrategy[]; plugins: any; title: string; From 48216f60b62c93d0cf1becd8843e1af43d4d25a4 Mon Sep 17 00:00:00 2001 From: fritzschoff Date: Thu, 27 Jan 2022 16:46:48 +0100 Subject: [PATCH 2/2] converted ether to token --- packages/queries/src/queries/misc/useTokenListQuery.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/queries/src/queries/misc/useTokenListQuery.ts b/packages/queries/src/queries/misc/useTokenListQuery.ts index ce5186f89..bdd2e80a1 100644 --- a/packages/queries/src/queries/misc/useTokenListQuery.ts +++ b/packages/queries/src/queries/misc/useTokenListQuery.ts @@ -2,19 +2,20 @@ import { useQuery, UseQueryOptions } from 'react-query'; import axios from 'axios'; import keyBy from 'lodash/keyBy'; -import { TokenListQueryResponse, TokenListResponse } from '../../types'; +import { Token, TokenListQueryResponse, TokenListResponse } from '../../types'; import { CryptoCurrency, ETH_ADDRESS } from '../../currency'; import { QueryContext } from '../../context'; +import { NetworkIdByName } from '@synthetixio/contracts-interface'; const ether = { address: ETH_ADDRESS, - chainId: 1, + chainId: NetworkIdByName.mainnet, decimals: 18, logoURI: '', name: 'Ethereum', symbol: CryptoCurrency.ETH, tags: [], -}; +} as Token; const useTokenListQuery = ( _: QueryContext, @@ -25,7 +26,6 @@ const useTokenListQuery = ( ['misc', 'tokenList', tokenListUrl], async () => { const response = await axios.get(tokenListUrl); - const tokens = [ether, ...response.data.tokens]; return {