Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: update ens subgraph url #151

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.8.1] - 2024-06-28

- Added fine-tune to plug ENS graphql endpoints for use by the server with ISC. Previous endpoint act as fallback for dev/preview.
- API stats set to use Chainstack graphql instead of hosted-services.

## [3.8.0] - 2024-04-03

- Added support to the Sepolia testnet.
Expand Down Expand Up @@ -366,7 +371,8 @@ Staking Pools

- First release

[unreleased]: https://github.com/cartesi/explorer/compare/v3.8.0...HEAD
[unreleased]: https://github.com/cartesi/explorer/compare/v3.8.1...HEAD
[3.8.1]: https://github.com/cartesi/explorer/compare/v3.8.1...v3.8.0
[3.8.0]: https://github.com/cartesi/explorer/compare/v3.8.0...v3.7.1
[3.7.1]: https://github.com/cartesi/explorer/compare/v3.7.1...v3.7.0
[3.7.0]: https://github.com/cartesi/explorer/compare/v3.7.0...v3.6.2
Expand Down
4 changes: 3 additions & 1 deletion apps/staking/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ NEXT_PUBLIC_UNLEASH_PROXY_CLIENT_KEY=bc1b71da9932b90ccd788d75203fb598c3640cabed3
NEXT_PUBLIC_PROJECT_ID=YOUR_INFURA_PROJECT_ID
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=YOUR_WALLETCONNECT_PROJECT_ID
NEXT_PUBLIC_MAINNET_GRAPHQL_URL=YOUR_MAINNET_SUBGRAPH_GRAPHQL_ENDPOINT
NEXT_PUBLIC_SEPOLIA_GRAPHQL_URL=YOUR_SEPOLIA_SUBGRAPH_GRAPHQL_ENDPOINT
NEXT_PUBLIC_SEPOLIA_GRAPHQL_URL=YOUR_SEPOLIA_SUBGRAPH_GRAPHQL_ENDPOINT
# SERVER SIDE
ENS_GRAPHQL_URL=YOUR_SUBGRAPH_ENS_GRAPHQL_ENDPOINT
2 changes: 2 additions & 0 deletions apps/staking/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ NEXT_PUBLIC_PROJECT_ID=YOUR_INFURA_PROJECT_ID
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=YOUR_WALLETCONNECT_PROJECT_ID
NEXT_PUBLIC_MAINNET_GRAPHQL_URL=YOUR_MAINNET_SUBGRAPH_GRAPHQL_ENDPOINT
NEXT_PUBLIC_SEPOLIA_GRAPHQL_URL=YOUR_SEPOLIA_SUBGRAPH_GRAPHQL_ENDPOINT
# SERVER SIDE
ENS_GRAPHQL_ENDPOINT=YOUR_SUBGRAPH_ENS_GRAPHQL_ENDPOINT
5 changes: 5 additions & 0 deletions apps/staking/additional.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@ declare namespace NodeJS {
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: string;
NEXT_PUBLIC_MAINNET_GRAPHQL_URL: string;
NEXT_PUBLIC_SEPOLIA_GRAPHQL_URL: string;
/**
* Usually a subgraph ENS graphql URL with your own API/key.
* More info at {@link https://thegraph.com/explorer/subgraphs/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH?view=Query&chain=arbitrum-one}
*/
ENS_GRAPHQL_URL: string;
}
}
10 changes: 5 additions & 5 deletions apps/staking/src/pages/api/[chain]/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the GNU General Public License for more details.

import { NextApiRequest, NextApiResponse } from 'next';
import Cors from 'cors';
import axios from 'axios';
import { constants, FixedNumber } from 'ethers';
import Cors from 'cors';
import { FixedNumber, constants } from 'ethers';
import { NextApiRequest, NextApiResponse } from 'next';

import runMiddleware from '../../../utils/runMiddleware';
import { getEstimatedRewardRate, getRewardRate } from '../../../utils/reward';
import runMiddleware from '../../../utils/runMiddleware';
import { toCTSI } from '../../../utils/token';

import { createApollo } from '../../../services/apollo';
Expand Down Expand Up @@ -44,7 +44,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
)
) || 1;

const client = createApollo(chainId, false);
const client = createApollo(chainId, true);

const {
data: { summary },
Expand Down
9 changes: 7 additions & 2 deletions apps/staking/src/services/apolloENSClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@

import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';

// Mainnet
export const uri = 'https://api.thegraph.com/subgraphs/name/ensdomains/ens';
/**
* A default rate-limited sponsored by ENS DAO.
* Mostly for use on dev/preview environments.
*/
const rateLimitedURL =
'https://api.thegraph.com/subgraphs/name/ensdomains/ens' as const;

const createENSApollo = (): ApolloClient<any> => {
const ssrMode = typeof window === 'undefined';
const uri = process.env.ENS_GRAPHQL_URL || rateLimitedURL;

return new ApolloClient({
ssrMode,
Expand Down
Loading