-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Uniswap subgraph and all exchanges (#363)
* Fetch missing asset prices from Uniswap subgraph * Support historical pricing info from Uniswap * Use only uniswap pairs info for swap receive * Add query for getting all Uniswap exchanges * Section list support * Add sectionlist to react-native-gesture-handler * Set default data in currency selection list to headerless section * Fix swipe conflicting gestures and cleanup * Scroll to top when clearing input * Added 250ms debounce * Fix header section logic Co-authored-by: Bruno Barbieri <brunobar79@gmail.com>
- Loading branch information
1 parent
49a6410
commit 4b0bc0f
Showing
21 changed files
with
757 additions
and
408 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/node_modules/react-native-gesture-handler/GestureComponents.js b/node_modules/react-native-gesture-handler/GestureComponents.js | ||
index b7f2207..26c9fda 100644 | ||
--- a/node_modules/react-native-gesture-handler/GestureComponents.js | ||
+++ b/node_modules/react-native-gesture-handler/GestureComponents.js | ||
@@ -55,4 +55,17 @@ module.exports = { | ||
} | ||
return MEMOIZED.FlatList; | ||
}, | ||
+ get SectionList() { | ||
+ if (!MEMOIZED.SectionList) { | ||
+ const ScrollView = this.ScrollView; | ||
+ MEMOIZED.SectionList = React.forwardRef((props, ref) => ( | ||
+ <ReactNative.SectionList | ||
+ ref={ref} | ||
+ {...props} | ||
+ renderScrollComponent={scrollProps => <ScrollView {...scrollProps} />} | ||
+ /> | ||
+ )); | ||
+ } | ||
+ return MEMOIZED.SectionList; | ||
+ }, | ||
}; |
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,16 @@ | ||
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'; | ||
|
||
export const client = new ApolloClient({ | ||
cache: new InMemoryCache(), | ||
link: new HttpLink({ | ||
uri: 'https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2', | ||
}), | ||
uri: 'https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2', | ||
}); | ||
|
||
export const uniswapClient = new ApolloClient({ | ||
cache: new InMemoryCache(), | ||
link: new HttpLink({ | ||
uri: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswapbackup', | ||
}), | ||
}); |
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,110 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export const COMPOUND_MARKET_QUERY = gql` | ||
query markets { | ||
markets(first: 7) { | ||
blockTimestamp | ||
id | ||
exchangeRate | ||
interestRateModelAddress | ||
name | ||
supplyRate | ||
underlyingAddress | ||
underlyingDecimals | ||
underlyingPriceUSD | ||
underlyingPrice | ||
} | ||
} | ||
`; | ||
|
||
export const COMPOUND_DAI_ACCOUNT_TOKEN_QUERY = gql` | ||
query accountCToken($addr: String!) { | ||
accountCToken(where: { id: $addr }) { | ||
cTokenBalance | ||
id | ||
lifetimeSupplyInterestAccrued | ||
market { | ||
blockTimestamp | ||
id | ||
exchangeRate | ||
interestRateModelAddress | ||
name | ||
supplyRate | ||
underlyingAddress | ||
underlyingDecimals | ||
underlyingPriceUSD | ||
underlyingPrice | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export const COMPOUND_USDC_ACCOUNT_TOKEN_QUERY = gql` | ||
query accountCToken { | ||
accountCToken( | ||
id: "0x39aa39c021dfbae8fac545936693ac917d5e7563-0xf0f21ab2012731542731df194cff6c77d29cb31a" | ||
) { | ||
cTokenBalance | ||
id | ||
lifetimeSupplyInterestAccrued | ||
market { | ||
blockTimestamp | ||
id | ||
exchangeRate | ||
interestRateModelAddress | ||
name | ||
supplyRate | ||
underlyingAddress | ||
underlyingDecimals | ||
underlyingPriceUSD | ||
underlyingPrice | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export const UNISWAP_PRICES_QUERY = gql` | ||
query exchanges($addresses: [String]!) { | ||
exchanges(where: { tokenAddress_in: $addresses, price_gt: 0 }) { | ||
id | ||
tokenAddress | ||
tokenSymbol | ||
price | ||
} | ||
} | ||
`; | ||
|
||
export const UNISWAP_24HOUR_PRICE_QUERY = gql` | ||
query exchangeHistoricalDatas($timestamp: Int!, $exchangeAddress: String!) { | ||
exchangeHistoricalDatas( | ||
where: { exchangeAddress: $exchangeAddress, timestamp_lt: $timestamp } | ||
first: 1 | ||
orderBy: tradeVolumeEth | ||
orderDirection: desc | ||
) { | ||
id | ||
timestamp | ||
exchangeAddress | ||
price | ||
} | ||
} | ||
`; | ||
|
||
export const DIRECTORY_QUERY = gql` | ||
query exchanges($excluded: [String]!, $first: Int!, $skip: Int!) { | ||
exchanges( | ||
first: $first | ||
skip: $skip | ||
orderBy: combinedBalanceInUSD | ||
orderDirection: desc | ||
where: { tokenAddress_not_in: $excluded } | ||
) { | ||
id | ||
tokenSymbol | ||
tokenName | ||
tokenDecimals | ||
tokenAddress | ||
ethBalance | ||
} | ||
} | ||
`; |
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
Oops, something went wrong.