-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
97 additions
and
56 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,2 +1 @@ | ||
export const thegraphUrl = 'https://subgraph.stakestar.io/subgraphs/name/stakestar' | ||
export const uniswapThegraphUrl = 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3' |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Sdk } from '@stakestar/subgraph-client' | ||
import { useMemo } from 'react' | ||
|
||
import { useChainConfig } from '~/features/wallet' | ||
|
||
import { getGraphQLClientSdk } from '../utils/graphQLClient' | ||
|
||
export function useGraphQLClientSdk(): Sdk { | ||
const chainConfig = useChainConfig() | ||
|
||
return useMemo(() => { | ||
return getGraphQLClientSdk(chainConfig.gpaphQlUrl) | ||
}, [chainConfig]) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import axios, { Axios } from 'axios' | ||
import { useMemo } from 'react' | ||
|
||
import { useChainConfig } from '~/features/wallet' | ||
|
||
export function useSSVClient(): Axios { | ||
const chainConfig = useChainConfig() | ||
|
||
return useMemo(() => { | ||
const ssvClient = axios.create() | ||
ssvClient.defaults.baseURL = chainConfig.ssvApiUrL | ||
|
||
return ssvClient | ||
}, [chainConfig]) | ||
} |
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,4 +1,3 @@ | ||
export * from './api' | ||
export * from './components' | ||
export * from './config' | ||
export * from './entities' | ||
|
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,7 +1,7 @@ | ||
import { chainIdLocalSorageKey, defaultChainId } from '../config' | ||
import { chainIdLocalSorageKey, getDefaultChainId } from '../config' | ||
import { ChainId } from '../types' | ||
import { getLocalStorageItem } from '../utils' | ||
|
||
export function getChainId(): ChainId { | ||
return getLocalStorageItem(chainIdLocalSorageKey, defaultChainId) | ||
return getLocalStorageItem(chainIdLocalSorageKey, getDefaultChainId()) | ||
} |
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,8 +1,8 @@ | ||
import { chainConfigs, chainIdLocalSorageKey, defaultChainId } from '../config' | ||
import { chainConfigs, chainIdLocalSorageKey, getDefaultChainId } from '../config' | ||
import { getLocalStorageItem } from '../utils' | ||
|
||
export function getExplorerUrl(path: 'address' | 'tx', hash: string): string { | ||
const chainId = getLocalStorageItem(chainIdLocalSorageKey, defaultChainId) | ||
const chainId = getLocalStorageItem(chainIdLocalSorageKey, getDefaultChainId()) | ||
|
||
return `${chainConfigs[chainId].explorer}/${path}/${hash}` | ||
} |
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,14 +1,18 @@ | ||
import { useMemo } from 'react' | ||
|
||
import { | ||
ChainConfig, | ||
ChainId, | ||
chainConfigs, | ||
chainIdLocalSorageKey, | ||
defaultChainId, | ||
getDefaultChainId, | ||
useLocalStorage | ||
} from '~/features/core' | ||
|
||
export function useChainConfig(): ChainConfig { | ||
const [chainId] = useLocalStorage<ChainId>(chainIdLocalSorageKey, defaultChainId) | ||
const [chainId] = useLocalStorage<ChainId>(chainIdLocalSorageKey, getDefaultChainId()) | ||
|
||
return chainConfigs[chainId] | ||
return useMemo(() => { | ||
return chainConfigs[chainId] | ||
}, [chainId]) | ||
} |
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