-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #300 from pangolindex/dev
To Prod
- Loading branch information
Showing
98 changed files
with
2,193 additions
and
2,202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,51 @@ | ||
import { ChainId } from '@pangolindex/sdk'; | ||
import { CHAINS, ChainId } from '@pangolindex/sdk'; | ||
import { InMemoryCache } from 'apollo-cache-inmemory'; | ||
import { ApolloClient } from 'apollo-client'; | ||
import { HttpLink } from 'apollo-link-http'; | ||
import { GraphQLClient } from 'graphql-request'; | ||
import { SUBGRAPH_BASE_URL } from 'src/constants'; | ||
import { useChainId } from 'src/hooks'; | ||
|
||
export const client = new ApolloClient({ | ||
link: new HttpLink({ | ||
uri: `${SUBGRAPH_BASE_URL}/exchange`, | ||
}), | ||
cache: new InMemoryCache(), | ||
// shouldBatch: true, | ||
}); | ||
export const getExchangeSubgraphApolloClient = (chainId: ChainId) => { | ||
const url = CHAINS[chainId]?.subgraph?.exchange; | ||
|
||
export const blockClient = new ApolloClient({ | ||
link: new HttpLink({ | ||
uri: 'https://api.thegraph.com/subgraphs/name/dasconnor/avalanche-blocks', | ||
}), | ||
cache: new InMemoryCache(), | ||
}); | ||
if (url) { | ||
return new ApolloClient({ | ||
link: new HttpLink({ | ||
uri: url, | ||
}), | ||
cache: new InMemoryCache(), | ||
}); | ||
} | ||
}; | ||
|
||
export const getBlockSubgraphApolloClient = (chainId: ChainId) => { | ||
const url = CHAINS[chainId]?.subgraph?.blocks; | ||
|
||
export const avalancheMininchefV2Client = new GraphQLClient( | ||
'https://api.thegraph.com/subgraphs/name/sarjuhansaliya/minichefv2-dummy', | ||
{ headers: {} }, | ||
); | ||
if (url) { | ||
return new ApolloClient({ | ||
link: new HttpLink({ | ||
uri: url, | ||
}), | ||
cache: new InMemoryCache(), | ||
}); | ||
} | ||
}; | ||
|
||
export const hederaTestnetSubgraphGql = new GraphQLClient( | ||
'https://hedera-test.pangolin.network/subgraphs/name/pangolin', | ||
{ | ||
headers: {}, | ||
}, | ||
); | ||
export enum SubgraphEnum { | ||
Exchange = 'exchange', | ||
Pangochef = 'pangochef', | ||
Minichef = 'minichef', | ||
} | ||
|
||
export const hederaMainnetSubgraphGql = new GraphQLClient( | ||
'https://hedera-graph.pangolin.network/subgraphs/name/pangolin', | ||
{ | ||
headers: {}, | ||
}, | ||
); | ||
export const getSubgraphClient = (chainId: ChainId, subgraph: SubgraphEnum) => { | ||
const url = CHAINS[chainId]?.subgraph?.[subgraph]; | ||
|
||
export const subgraphClient = { | ||
[ChainId.AVALANCHE]: avalancheMininchefV2Client, | ||
[ChainId.FUJI]: undefined, | ||
[ChainId.WAGMI]: undefined, | ||
[ChainId.COSTON]: undefined, | ||
[ChainId.SONGBIRD]: undefined, | ||
[ChainId.FLARE_MAINNET]: undefined, | ||
[ChainId.HEDERA_TESTNET]: hederaTestnetSubgraphGql, | ||
[ChainId.HEDERA_MAINNET]: hederaMainnetSubgraphGql, | ||
[ChainId.NEAR_MAINNET]: undefined, | ||
[ChainId.NEAR_TESTNET]: undefined, | ||
[ChainId.COSTON2]: undefined, | ||
[ChainId.EVMOS_TESTNET]: undefined, | ||
[ChainId.EVMOS_MAINNET]: undefined, | ||
[ChainId.ETHEREUM]: undefined, | ||
[ChainId.POLYGON]: undefined, | ||
[ChainId.FANTOM]: undefined, | ||
[ChainId.XDAI]: undefined, | ||
[ChainId.BSC]: undefined, | ||
[ChainId.ARBITRUM]: undefined, | ||
[ChainId.CELO]: undefined, | ||
[ChainId.OKXCHAIN]: undefined, | ||
[ChainId.VELAS]: undefined, | ||
[ChainId.AURORA]: undefined, | ||
[ChainId.CRONOS]: undefined, | ||
[ChainId.FUSE]: undefined, | ||
[ChainId.MOONRIVER]: undefined, | ||
[ChainId.MOONBEAM]: undefined, | ||
[ChainId.OP]: undefined, | ||
if (url) { | ||
return new GraphQLClient(url); | ||
} | ||
}; | ||
|
||
export function useSubgraphClient(subgraph: SubgraphEnum): GraphQLClient | undefined { | ||
const chainId = useChainId(); | ||
return getSubgraphClient(chainId, subgraph); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
884aee9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
components – ./
components-dusky.vercel.app
components.pangolin.exchange
components-pangolindex.vercel.app
components-git-main-pangolindex.vercel.app