diff --git a/widget/embedded/src/components/StatefulConnectModal/index.ts b/widget/embedded/src/components/StatefulConnectModal/index.ts index 28e8f8341f..c3c860a712 100644 --- a/widget/embedded/src/components/StatefulConnectModal/index.ts +++ b/widget/embedded/src/components/StatefulConnectModal/index.ts @@ -1 +1,2 @@ export { StatefulConnectModal } from './StatefulConnectModal'; +export { isOnNamespace, isOnDerivationPath } from './helpers'; diff --git a/widget/embedded/src/hooks/useStatefulConnect/useStatefulConnect.state.ts b/widget/embedded/src/hooks/useStatefulConnect/useStatefulConnect.state.ts index 695d464edc..7ba6d0bdea 100644 --- a/widget/embedded/src/hooks/useStatefulConnect/useStatefulConnect.state.ts +++ b/widget/embedded/src/hooks/useStatefulConnect/useStatefulConnect.state.ts @@ -34,11 +34,14 @@ export function reducer(state: State, action: Actions): State { case 'reset': return initState; case 'resetDerivation': - return { - ...state, - derivationPath: null, - status: 'namespace', - }; + if (state.namespace) { + return { + ...state, + derivationPath: null, + status: 'namespace', + }; + } + return initState; default: throw new Error(`Action hasn't been defined.`); } diff --git a/widget/embedded/src/index.ts b/widget/embedded/src/index.ts index a7823cefa9..bcdb5ac656 100644 --- a/widget/embedded/src/index.ts +++ b/widget/embedded/src/index.ts @@ -57,6 +57,11 @@ import { useWallets, Events as WalletEvents } from '@rango-dev/wallets-react'; import { Networks, WalletTypes } from '@rango-dev/wallets-shared'; import { PendingSwapNetworkStatus } from 'rango-types'; +import { + isOnDerivationPath, + isOnNamespace, +} from './components/StatefulConnectModal'; +import { DerivationPath, Namespaces } from './components/WalletStatefulConnect'; import { WIDGET_UI_ID as UI_ID } from './constants'; import { SUPPORTED_FONTS } from './constants/fonts'; import { WidgetWallets } from './containers/Wallets'; @@ -76,6 +81,13 @@ import { } from './types'; import { customizedThemeTokens } from './utils/ui'; +export const StatefulConnect = { + DerivationPath, + Namespaces, + isOnDerivationPath, + isOnNamespace, +}; + export type { WidgetConfig, WalletType,