import { ChangeEvent, useState } from 'react' import { Keypair } from '@solana/web3.js' import { Row, Col, Typography, Input, Button, Space } from 'antd' import IonIcon from '@sentre/antd-ionicon' import { useRootDispatch, RootDispatch } from 'store' import { connectWallet } from 'store/wallet.reducer' import { SecretKeyWallet } from '../../lib' const SecretKey = () => { const [secretKey, setSecretKey] = useState('') const dispatch = useRootDispatch() const connect = async () => { if (!secretKey) return window.notify({ type: 'warning', description: 'Please enter your secret key', }) const wallet = new SecretKeyWallet(secretKey) try { await dispatch(connectWallet(wallet)).unwrap() } catch (er: any) { return window.notify({ type: 'error', description: er.message }) } } const onGen = () => { const acc = new Keypair() const secretKey = Buffer.from(acc.secretKey).toString('hex') return setSecretKey(secretKey) } return ( Secret Key ) => setSecretKey(e.target.value || '') } value={secretKey} suffix={