File tree Expand file tree Collapse file tree 6 files changed +279
-243
lines changed
Expand file tree Collapse file tree 6 files changed +279
-243
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import { SwapTransaction } from './swapTransaction';
4040import { QaccPointsHistory } from './qaccPointsHistory' ;
4141import { UserRankMaterializedView } from './userRanksMaterialized' ;
4242import { VestingData } from './vestingData' ;
43+ import { TokenPriceHistory } from './tokenPriceHistory' ;
4344
4445export const getEntities = ( ) : DataSourceOptions [ 'entities' ] => {
4546 return [
@@ -93,5 +94,6 @@ export const getEntities = (): DataSourceOptions['entities'] => {
9394 SwapTransaction ,
9495 UserRankMaterializedView ,
9596 VestingData ,
97+ TokenPriceHistory ,
9698 ] ;
9799} ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { OnboardingFormResolver } from './onboardingFormResolver';
1717import { RoundsResolver } from './roundsResolver' ;
1818import { QAccResolver } from './qAccResolver' ;
1919import { QaccPointsHistoryResolver } from './qaccPointsHistoryResolver' ;
20+ import { TokenPriceResolver } from './tokenPriceResolver' ;
2021
2122// eslint-disable-next-line @typescript-eslint/ban-types
2223export const getResolvers = ( ) : Function [ ] => {
@@ -44,5 +45,6 @@ export const getResolvers = (): Function[] => {
4445
4546 QAccResolver ,
4647 QaccPointsHistoryResolver ,
48+ TokenPriceResolver ,
4749 ] ;
4850} ;
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ import { ChainType } from '../types/network';
6767import { runSyncDataWithInverter } from '../services/cronJobs/syncDataWithInverter' ;
6868import { runSyncWithAnkrTransfers } from '../services/cronJobs/syncWithAnkrTransfers' ;
6969import { runCheckPendingSwapsCronJob } from '../services/cronJobs/syncSwapTransactions' ;
70+ import { startTokenPriceCron } from '../services/cronJobs/tokenPriceCron' ;
7071
7172Resource . validate = validate ;
7273
@@ -164,6 +165,8 @@ export async function bootstrap() {
164165
165166 // runUpdateUserRanksCronJob();
166167
168+ startTokenPriceCron ( ) ;
169+
167170 if ( process . env . ENABLE_IMPORT_LOST_DONATIONS === 'true' ) {
168171 runSyncLostDonations ( ) ;
169172 }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { NonEmptyArray } from 'type-graphql';
55import { userCheck } from '../auth/userCheck' ;
66import { getResolvers } from '../resolvers/resolvers' ;
77import config from '../config' ;
8+ import { DateTimeScalar } from '../scalars/dateTime' ;
89
910const createSchema = async ( ) : Promise < GraphQLSchema > => {
1011 // James: removing for safety. We shouldn't need to do this again except on a local dev machine
@@ -25,6 +26,7 @@ const createSchema = async (): Promise<GraphQLSchema> => {
2526 forbidUnknownValues : false ,
2627 enableDebugMessages : environment !== 'production' ,
2728 } ,
29+ scalarsMap : [ { type : Date , scalar : DateTimeScalar } ] ,
2830 } ) ;
2931 return schema ;
3032} ;
Original file line number Diff line number Diff line change @@ -2288,3 +2288,29 @@ query donationsByQfRoundId($qfRoundId: Int!) {
22882288 }
22892289}
22902290` ;
2291+
2292+ export const getTokenPriceHistoryQuery = `
2293+ query GetTokenPriceHistory($tokenAddress: String!, $startTime: DateTime, $endTime: DateTime) {
2294+ getTokenPriceHistory(tokenAddress: $tokenAddress, startTime: $startTime, endTime: $endTime) {
2295+ token
2296+ tokenAddress
2297+ price
2298+ priceUSD
2299+ marketCap
2300+ timestamp
2301+ }
2302+ }
2303+ ` ;
2304+
2305+ export const getTokenMarketCapChanges24hQuery = `
2306+ query GetTokenMarketCapChanges24h($tokenAddress: String!) {
2307+ getTokenMarketCapChanges24h(tokenAddress: $tokenAddress) {
2308+ token
2309+ tokenAddress
2310+ price
2311+ priceUSD
2312+ marketCap
2313+ timestamp
2314+ }
2315+ }
2316+ ` ;
You can’t perform that action at this time.
0 commit comments