Commit fdbf1dec authored by Max Alekseenko's avatar Max Alekseenko

replace chain id at init

parent 0f84e8dc
import type { Feature } from './types';
import type { GasRefuelProviderConfig } from 'types/client/gasRefuelProviderConfig';
import chain from '../chain';
import { getEnvValue, parseEnvJson } from '../utils';
import marketplace from './marketplace';
......@@ -11,7 +12,7 @@ const title = 'Get gas button';
const config: Feature<{
name: string;
logoUrl?: string;
urlTemplate: string;
url: string;
dappId?: string;
usdThreshold: number;
}> = (() => {
......@@ -21,7 +22,7 @@ const config: Feature<{
isEnabled: true,
name: value.name,
logoUrl: value.logo,
urlTemplate: value.url_template,
url: value.url_template.replace('{chainId}', chain.id || ''),
dappId: marketplace.isEnabled ? value.dapp_id : undefined,
usdThreshold: value.usd_threshold || 1,
});
......
......@@ -21,8 +21,6 @@ import LinkInternal from 'ui/shared/links/LinkInternal';
import NativeTokenIcon from 'ui/shared/NativeTokenIcon';
import TextSeparator from 'ui/shared/TextSeparator';
const TEMPLATE_CHAIN_ID = '{chainId}';
const getGasFeature = config.features.getGasButton;
interface Props {
......@@ -109,8 +107,7 @@ const AddressBalance = ({ data, isLoading }: Props) => {
};
try {
const getGasUrlString = getGasFeature.urlTemplate.replace(TEMPLATE_CHAIN_ID, config.chain.id || '');
const getGasUrl = new URL(getGasUrlString);
const getGasUrl = new URL(getGasFeature.url);
getGasUrl.searchParams.append('utm_source', 'blockscout');
getGasUrl.searchParams.append('utm_medium', 'address');
const dappId = getGasFeature.dappId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment