Skip to content

Commit

Permalink
removed deprecated configs (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters committed Sep 24, 2024
1 parent 906d189 commit 3ab288e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 35 deletions.
2 changes: 1 addition & 1 deletion wormhole-connect/src/components/DemoApp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function DemoApp() {
<div id="custom-config">
<textarea
onChange={updateCustomConfig}
placeholder={'{\n "env": "Mainnet"\n}'}
placeholder={'{\n "network": "Mainnet"\n}'}
onBlur={() => {
emitCustomConfig();
}}
Expand Down
5 changes: 0 additions & 5 deletions wormhole-connect/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export function buildConfig(
): InternalConfig<Network> {
const network = capitalize(
customConfig?.network ||
customConfig?.env || // TODO remove; deprecated
import.meta.env.REACT_APP_CONNECT_ENV?.toLowerCase() ||
'Mainnet',
) as Network;
Expand Down Expand Up @@ -162,10 +161,6 @@ export function buildConfig(
// UI details
ui: createUiConfig({ ...customConfig?.ui }),

// Route options
ethBridgeMaxAmount: customConfig?.ethBridgeMaxAmount ?? 5,
wstETHBridgeMaxAmount: customConfig?.wstETHBridgeMaxAmount ?? 5,

// Guardian Set
guardianSet: networkData.guardianSet,
};
Expand Down
16 changes: 0 additions & 16 deletions wormhole-connect/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
TokenAddress as TokenAddressV2,
} from '@wormhole-foundation/sdk';

import { WormholeConnectPartialTheme } from 'theme';
import { TransferDetails, WormholeConnectEventHandler } from 'telemetry/types';
import { SDKConverter } from './converter';

Expand Down Expand Up @@ -83,7 +82,6 @@ export type IsRouteSupportedHandler = (

// This is the integrator-provided config
export interface WormholeConnectConfig {
env?: Network; // TODO REMOVE; DEPRECATED
network?: Network; // New name for this, consistent with SDKv2

// External resources
Expand All @@ -103,23 +101,13 @@ export interface WormholeConnectConfig {
// Wormhole-wrapped token addresses
wrappedTokens?: TokenAddressesByChain;

// Legacy support: allow theme to be in this config object
// This should be removed in a future version after people have switched
// to providing the theme as a separate prop
customTheme?: WormholeConnectPartialTheme;
mode?: 'dark' | 'light';

// Callbacks
eventHandler?: WormholeConnectEventHandler;
validateTransferHandler?: ValidateTransferHandler;
isRouteSupportedHandler?: IsRouteSupportedHandler;

// UI details
ui?: UiConfig;

// Route settings
ethBridgeMaxAmount?: number;
wstETHBridgeMaxAmount?: number;
}

// This is the exported config value used throughout the code base
Expand Down Expand Up @@ -162,10 +150,6 @@ export interface InternalConfig<N extends Network> {
// UI configuration
ui: UiConfig;

// Route settings
ethBridgeMaxAmount: number;
wstETHBridgeMaxAmount: number;

guardianSet: GuardianSetData;
}

Expand Down
13 changes: 0 additions & 13 deletions wormhole-connect/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,6 @@ try {
if (configAttr) {
const parsedConfig = JSON.parse(configAttr);
config = { ...config, ...parsedConfig };

// Handle legacy method of including theme in config JSON
if (config?.customTheme) {
console.warn(
`Wormhole Connect: please provide your custom theme as a "data-theme" attribute. ` +
`Providing it in your "config" attribute won't be supported in future versions. ` +
`\n` +
`See the README for examples: ` +
`https://www.npmjs.com/package/@wormhole-foundation/wormhole-connect`,
);
theme = config.customTheme;
if (config?.mode) theme.mode = config.mode;
}
}

const themeAttr = container.getAttribute('data-theme');
Expand Down

0 comments on commit 3ab288e

Please sign in to comment.