Skip to content

Commit da33c4a

Browse files
fix usage of chains
1 parent f09c643 commit da33c4a

File tree

1 file changed

+9
-9
lines changed
  • packages/payment-detection/src/thegraph

1 file changed

+9
-9
lines changed

packages/payment-detection/src/thegraph/client.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,29 +138,29 @@ export const defaultGetTheGraphClientUrl = (
138138
network: CurrencyTypes.ChainName,
139139
options?: TheGraphClientOptions,
140140
) => {
141-
const filteredNetwork = network.replace('aurora', 'near');
142-
const theGraphExplorerSubgraphId = THE_GRAPH_EXPLORER_SUBGRAPH_ID[network];
141+
const chain = network.replace('aurora', 'near') as CurrencyTypes.ChainName;
142+
const theGraphExplorerSubgraphId = THE_GRAPH_EXPLORER_SUBGRAPH_ID[chain];
143143
const { theGraphExplorerApiKey } = options || {};
144144

145145
// build URLs
146-
const theGraphStudioUrl = THE_GRAPH_STUDIO_URL.replace('$NETWORK', filteredNetwork);
146+
const theGraphStudioUrl = THE_GRAPH_STUDIO_URL.replace('$NETWORK', chain);
147147
const theGraphExplorerUrl = THE_GRAPH_EXPLORER_URL.replace(
148148
'$API_KEY',
149149
theGraphExplorerApiKey || '',
150150
).replace('$SUBGRAPH_ID', theGraphExplorerSubgraphId || '');
151-
const theGraphAlchemyUrl = THE_GRAPH_ALCHEMY_URL.replace('$NETWORK', filteredNetwork);
151+
const theGraphAlchemyUrl = THE_GRAPH_ALCHEMY_URL.replace('$NETWORK', chain);
152152

153153
const shouldUseTheGraphExplorer = !!theGraphExplorerApiKey && !!theGraphExplorerSubgraphId;
154-
const shouldUseAlchemy = THE_GRAPH_ALCHEMY_CHAINS.includes(network);
154+
const shouldUseAlchemy = THE_GRAPH_ALCHEMY_CHAINS.includes(chain);
155155

156156
switch (true) {
157-
case network === 'private':
157+
case chain === 'private':
158158
return;
159-
case network === 'mantle':
159+
case chain === 'mantle':
160160
return THE_GRAPH_URL_MANTLE;
161-
case network === 'mantle-testnet':
161+
case chain === 'mantle-testnet':
162162
return THE_GRAPH_URL_MANTLE_TESTNET;
163-
case network === 'core':
163+
case chain === 'core':
164164
return THE_GRAPH_URL_CORE;
165165
default:
166166
return shouldUseTheGraphExplorer

0 commit comments

Comments
 (0)