import { ComponentType , FC } from 'react' ; import { WALLET_STEPS } from '@components' ; import { useNetworks } from '@services/Store' ; import { ISignComponentProps , ISignedTx , IStepComponentProps , ITxReceipt , WalletId } from '@types' ; type Props = Pick < IStepComponentProps , 'txConfig' | 'onComplete' > & { protectTxButton ? ( ) : JSX . Element ; } ; const SignTransaction = ( { txConfig , onComplete , protectTxButton } ) => { const { networkId , senderAccount : { wallet : walletName } } = txConfig ; const { getNetworkById } = useNetworks ( ) ; const network = getNetworkById ( networkId ) ; const getWalletComponent = ( walletType ) => { return WALLET_STEPS [ walletType ] ; } ; const WalletComponent = getWalletComponent ( walletName ) ! ; return ( < > < WalletComponent network = { network } senderAccount = { txConfig . senderAccount } rawTransaction = { txConfig . rawTransaction } onSuccess = { ( payload ) => onComplete ( payload ) } /> { protectTxButton && protectTxButton ( ) } < />); } ; export default SignTransaction ;