Add project nowswap

This commit is contained in:
jc.longxin
2021-06-28 23:08:03 -07:00
parent 6a7dfc8a91
commit 284747487e

25
projects/nowswap/index.js Normal file
View File

@@ -0,0 +1,25 @@
const retry = require('../helper/retry')
const axios = require("axios");
const { GraphQLClient, gql } = require('graphql-request')
async function fetch() {
var endpoint = 'https://api.thegraph.com/subgraphs/name/curiosthoth/nowswap'
var graphQLClient = new GraphQLClient(endpoint)
var query = gql`
{
nowswapFactories(first: 1) {
totalLiquidityUSD
totalLiquidityETH
}
}
`;
const results = await retry(async bail => await graphQLClient.request(query))
return parseFloat(results.nowswapFactories[0].totalLiquidityUSD)
}
module.exports = {
fetch
}