
Product
Announcing Socket Certified Patches: One-Click Fixes for Vulnerable Dependencies
A safer, faster way to eliminate vulnerabilities without updating dependencies
@dexpal-analytics/pair-screener-apollo
Advanced tools
Apollo Client data-fetching layer for @dexpal-analytics/pair-screener
{{ ... }}
Apollo Client data-fetching layer for @dexpal-analytics/pair-screener. Provides a complete plug-and-play solution with GraphQL queries, context providers, real-time price updates, and query-level filtering for restricted pairs and assets.
useDexpal and useAssetPricesnpm install @dexpal-analytics/pair-screener-apollo @dexpal-analytics/pair-screener @dexpal-analytics/ui
{{ ... }}
# or
yarn add @dexpal-analytics/pair-screener-apollo @dexpal-analytics/pair-screener @dexpal-analytics/ui
{
"react": "^18.0.0",
"react-dom": "^18.0.0",
"@apollo/client": "^3.13.0",
"graphql": "^16.10.0",
"graphql-tag": "^2.12.0"
}
import { PairScreener } from '@dexpal-analytics/pair-screener';
import { DexpalProvider, useDexpal } from '@dexpal-analytics/pair-screener-apollo';
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
// 1. Create Apollo Client with default endpoint
const client = new ApolloClient({
uri: process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || 'https://gql.dexpal.ai/v1/graphql',
cache: new InMemoryCache(),
});
// 2. Wrap with providers
const restrictedPairs = ['BTC', 'ETH/USDT']; // Pairs to exclude from query
const restrictedAssets = ['Bitcoin', 'BTC', 'USDT']; // Assets to exclude from query
function App() {
return (
<ApolloProvider client={client}>
<DexpalProvider restrictedPairs={restrictedPairs} restrictedAssets={restrictedAssets}>
<PairScreenerPage />
</DexpalProvider>
</ApolloProvider>
);
}
// 3. Use the PairScreener with context
function PairScreenerPage() {
return <PairScreener useDexpalContext={useDexpal} />;
}
Provides DEX and trading pair data to child components.
import { DexpalProvider } from '@dexpal-analytics/pair-screener-apollo';
<DexpalProvider>
<YourApp />
</DexpalProvider>;
<DexpalProvider graphqlEndpoint="https://gql.dexpal.ai/v1/graphql">
<YourApp />
</DexpalProvider>
Access DEX and pair data from the context.
import { useDexpal } from '@dexpal-analytics/pair-screener-apollo';
function MyComponent() {
const {
dexList, // Array of DEX data
loadingDexList, // Loading state for DEXes
dexListError, // Error state for DEXes
dexPairs, // Array of trading pairs
loadingDexPairs, // Loading state for pairs
dexPairsError, // Error state for pairs
lastUpdated, // Timestamp of last data refresh
refreshData, // Manual refresh function
} = useDexpal();
return <div>{loadingDexPairs ? 'Loading...' : `${dexPairs.length} pairs`}</div>;
}
Real-time asset price polling.
import { useAssetPrices } from '@dexpal-analytics/pair-screener-apollo';
function PriceDisplay({ assetIds }: { assetIds: string[] }) {
const {
assetPrices, // Map<string, AssetPrice>
getAssetPrice, // (assetId: string) => AssetPrice | undefined
loading,
error,
refetchPrices,
} = useAssetPrices({
assetIds,
enabled: true,
pollingInterval: 6000, // 6 seconds
});
const price = getAssetPrice(assetIds[0]);
return <div>${price?.market_price}</div>;
}
Fetches all DEX information.
query GetDexes {
dexes(order_by: { name: asc }) {
id
name
logo
description
# ... more fields
}
}
Fetches all trading pairs with historical data.
query GetPairs($startTime: timestamptz!, $endTime: timestamptz!) {
pair_stats(order_by: { trading_volume_24h: desc_nulls_last }) {
id
base
target
asset { ... }
dex { ... }
# ... more fields
}
}
Set your GraphQL endpoint (optional - will use default if not provided):
NEXT_PUBLIC_GRAPHQL_ENDPOINT=https://gql.dexpal.ai/v1/graphql
<DexpalProvider pollingInterval={10000}>
<YourApp />
</DexpalProvider>
function RefreshButton() {
const { refreshData, loadingDexPairs } = useDexpal();
return (
<button onClick={refreshData} disabled={loadingDexPairs}>
Refresh Data
</button>
);
}
const { assetPrices } = useAssetPrices({
assetIds: selectedAssetIds,
enabled: isVisible && !isPaused, // Only poll when needed
pollingInterval: 5000,
});
All types are re-exported from @dexpal-analytics/pair-screener:
import type { DexPair, Dex, Asset } from '@dexpal-analytics/pair-screener';
function MyComponent() {
const { dexPairs, dexPairsError, loadingDexPairs } = useDexpal();
if (dexPairsError) {
return <div>Error loading pairs: {dexPairsError.message}</div>;
}
if (loadingDexPairs) {
return <div>Loading...</div>;
}
return <PairScreener data={dexPairs} />;
}
FAQs
Apollo Client data-fetching layer for @dexpal-analytics/pair-screener
We found that @dexpal-analytics/pair-screener-apollo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.