diff --git a/src/refactor/base-provider.tsx b/src/refactor/base-provider.tsx index 92ddf628..ef7e611a 100644 --- a/src/refactor/base-provider.tsx +++ b/src/refactor/base-provider.tsx @@ -53,5 +53,6 @@ export const MasaBaseProvider = ({ ); }; -export const useConfig = (): MasaReactConfigBaseProvider => useContext(MasaBaseContext); +export const useConfig = (): MasaReactConfigBaseProvider => + useContext(MasaBaseContext); export default MasaBaseProvider; diff --git a/src/refactor/masanew.stories.tsx b/src/refactor/masanew.stories.tsx index 4b04a5b1..7fc35678 100644 --- a/src/refactor/masanew.stories.tsx +++ b/src/refactor/masanew.stories.tsx @@ -1,10 +1,13 @@ import type { Args, Meta } from '@storybook/react'; +import type { Chain } from 'wagmi'; import React from 'react'; import { Button } from './ui'; import './ui/styles.scss'; import { useConfig } from './base-provider'; import MasaProvider from './masa-provider'; -import { useWalletClient } from './wallet-client/wallet-client-provider'; +// import { useWalletClient } from './wallet-client/wallet-client-provider'; +import { useWallet } from './wallet-client/wallet/use-wallet'; +import { useNetwork } from './wallet-client/network/use-network'; const meta: Meta = { title: 'Refactor Test', @@ -20,44 +23,135 @@ const meta: Meta = { export default meta; -const Component = ({ name }: { name?: string }): JSX.Element => { - const { openConnectModal, address, connector, isConnected } = - useWalletClient(); - const config = useConfig(); +const NetworkInfo = () => { + const { + switchNetwork, + switchingToChain, + canProgramaticallySwitchNetwork, + activeChain, + isSwitchingChain, + chains, + isActiveChainUnsupported, + } = useNetwork(); return ( -
-

{name}

- + ); +}; - padding: '4px', - }} - > -
  • Address: {address}
  • -
  • Connector: {connector?.name}
  • -
  • isConnected?: {String(isConnected)}
  • - -