Skip to content

Commit

Permalink
chore: Move add tokens config into common widgets lib (#2488)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimi-imtbl authored Jan 8, 2025
1 parent 35afa08 commit 92dea03
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 24 deletions.
14 changes: 14 additions & 0 deletions packages/checkout/widgets-lib/src/lib/squid/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
export const SQUID_SDK_BASE_URL = 'https://apiplus.squidrouter.com';

export const SQUID_NATIVE_TOKEN = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';

export const APPROVE_TXN_ANIMATION = '/access_coins.riv';

export const EXECUTE_TXN_ANIMATION = '/swapping_coins.riv';

export const BLOCK_TXN_ANIMATION = '/blocked.riv';

export const ERROR_TXN_ANIMATION = '/error.riv';

export const TOOLKIT_SQUID_URL = 'https://toolkit.immutable.com/squid-bridge/';

export const FIXED_HANDOVER_DURATION = 2000;

export const TOKEN_PRIORITY_ORDER = ['IMX', 'USDC', 'ETH'];
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { AddTokensErrorTypes } from '../../../widgets/add-tokens/types';
import { useHandover } from '../../hooks/useHandover';
import { HandoverTarget } from '../../../context/handover-context/HandoverContext';
import { getRemoteRive } from '../../utils';
import { APPROVE_TXN_ANIMATION } from '../../../widgets/add-tokens/utils/config';
import { HandoverContent } from '../../../components/Handover/HandoverContent';
import { sendAddTokensCloseEvent } from '../../../widgets/add-tokens/AddTokensWidgetEvents';
import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
Expand All @@ -19,6 +18,7 @@ import {
UserJourney,
} from '../../../context/analytics-provider/SegmentAnalyticsProvider';
import { RiveStateMachineInput } from '../../../types/HandoverTypes';
import { APPROVE_TXN_ANIMATION } from '../config';

interface ErrorConfig {
headingText: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import {
import { getL2ChainId } from '../../../lib';
import { AddTokensErrorTypes } from '../types';
import { TokenImage } from '../../../components/TokenImage/TokenImage';
import { TOKEN_PRIORITY_ORDER } from '../utils/config';
import { PULSE_SHADOW } from '../utils/animation';
import { TOKEN_PRIORITY_ORDER } from '../../../lib/squid/config';

export interface TokenDrawerMenuProps {
checkout: Checkout;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ import { SquidFooter } from '../../../lib/squid/components/SquidFooter';
import { TokenDrawerMenu } from '../components/TokenDrawerMenu';
import { PULSE_SHADOW } from '../utils/animation';
import { RouteData } from '../../../lib/squid/types';
import { SQUID_NATIVE_TOKEN } from '../../../lib/squid/config';
import { SQUID_NATIVE_TOKEN, TOOLKIT_SQUID_URL } from '../../../lib/squid/config';
import { identifyUser } from '../../../lib/analytics/identifyUser';
import { NotEnoughGasDrawer } from '../../../components/NotEnoughGasDrawer/NotEnoughGasDrawer';
import { TOOLKIT_SQUID_URL } from '../utils/config';
import { SelectedWallet } from '../../../components/SelectedWallet/SelectedWallet';
import { RouteOptionsDrawer } from '../../../components/RouteOptionsDrawer/RouteOptionsDrawer';
import { SelectedRouteOption } from '../../../components/SelectedRouteOption/SelectedRouteOption';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ import { useHandover } from '../../../lib/hooks/useHandover';
import { HandoverTarget } from '../../../context/handover-context/HandoverContext';
import { HandoverContent } from '../../../components/Handover/HandoverContent';
import { getRemoteRive } from '../../../lib/utils';
import {
APPROVE_TXN_ANIMATION,
EXECUTE_TXN_ANIMATION,
FIXED_HANDOVER_DURATION,
TOOLKIT_SQUID_URL,
} from '../utils/config';

import {
useAnalytics,
UserJourney,
Expand All @@ -70,7 +65,9 @@ import {
import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
import { convertToNetworkChangeableProvider } from '../../../functions/convertToNetworkChangeableProvider';
import { AmountData } from '../../../lib/squid/types';
import { SQUID_NATIVE_TOKEN } from '../../../lib/squid/config';
import {
APPROVE_TXN_ANIMATION, EXECUTE_TXN_ANIMATION, FIXED_HANDOVER_DURATION, SQUID_NATIVE_TOKEN, TOOLKIT_SQUID_URL,
} from '../../../lib/squid/config';
import { AddressMissmatchDrawer } from '../../../components/AddressMismatchDrawer/AddressMissmatchDrawer';
import { RouteFees } from '../../../components/RouteFees/RouteFees';
import { getDurationFormatted } from '../../../functions/getDurationFormatted';
Expand Down

0 comments on commit 92dea03

Please sign in to comment.