File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ import request from "graphql-request"
2
+ import { FetchOptions , SimpleAdapter } from "../../adapters/types"
3
+ import { CHAIN } from "../../helpers/chains"
4
+
5
+ const url = 'https://api.mondrianswap.xyz/graphql'
6
+
7
+
8
+ interface IProtocolData {
9
+ swapVolume24h : number
10
+ swapFee24h : number
11
+ }
12
+ const fetchVolume = async ( options : FetchOptions ) => {
13
+ const querry = `
14
+ {
15
+ embrGetProtocolData{
16
+ swapVolume24h
17
+ swapFee24h
18
+
19
+ }
20
+ }`
21
+
22
+ const respose = ( await request ( url , querry ) ) . embrGetProtocolData as IProtocolData
23
+
24
+ const dailyVolume = options . createBalances ( ) ;
25
+ dailyVolume . addUSDValue ( Number ( respose . swapVolume24h ) )
26
+ const dailyFees = dailyVolume . clone ( ) ;
27
+ dailyFees . addUSDValue ( Number ( respose . swapFee24h ) )
28
+ return {
29
+ dailyVolume : dailyVolume ,
30
+ dailyFees : dailyFees ,
31
+ }
32
+ }
33
+
34
+ const adapters : SimpleAdapter = {
35
+ version : 2 ,
36
+ adapter : {
37
+ [ CHAIN . ABSTRACT ] : {
38
+ fetch : fetchVolume ,
39
+ runAtCurrTime : true
40
+ }
41
+ }
42
+ }
43
+
44
+ export default adapters
You can’t perform that action at this time.
0 commit comments