@@ -3,6 +3,7 @@ import { useSnackbar } from 'notistack'
33import { ReactElement , useContext , useEffect , useState } from 'react'
44import { Check , X } from 'react-feather'
55import { useNavigate } from 'react-router'
6+ import { Wallet } from 'ethers'
67import ExpandableListItem from '../../components/ExpandableListItem'
78import ExpandableListItemActions from '../../components/ExpandableListItemActions'
89import ExpandableListItemKey from '../../components/ExpandableListItemKey'
@@ -12,11 +13,10 @@ import { SwarmButton } from '../../components/SwarmButton'
1213import { Context as BeeContext } from '../../providers/Bee'
1314import { Context as TopUpContext } from '../../providers/TopUp'
1415import { createGiftWallet } from '../../utils/desktop'
15- import { generateWallet } from '../../utils/identity'
1616import { ResolvedWallet } from '../../utils/wallet'
1717
1818export default function Index ( ) : ReactElement {
19- const { giftWallets, addGiftWallet } = useContext ( TopUpContext )
19+ const { giftWallets, addGiftWallet, provider } = useContext ( TopUpContext )
2020 const { balance } = useContext ( BeeContext )
2121
2222 const [ loading , setLoading ] = useState ( false )
@@ -26,13 +26,13 @@ export default function Index(): ReactElement {
2626 async function mapGiftWallets ( ) {
2727 const results = [ ]
2828 for ( const giftWallet of giftWallets ) {
29- results . push ( await ResolvedWallet . make ( giftWallet ) )
29+ results . push ( await ResolvedWallet . make ( giftWallet , provider ) )
3030 }
3131 setBalances ( results )
3232 }
3333
3434 mapGiftWallets ( )
35- } , [ giftWallets ] )
35+ } , [ giftWallets , provider ] )
3636
3737 const { enqueueSnackbar } = useSnackbar ( )
3838 const navigate = useNavigate ( )
@@ -41,9 +41,9 @@ export default function Index(): ReactElement {
4141 enqueueSnackbar ( 'Sending funds to gift wallet...' )
4242 setLoading ( true )
4343 try {
44- const wallet = generateWallet ( )
44+ const wallet = Wallet . createRandom ( )
4545 addGiftWallet ( wallet )
46- await createGiftWallet ( wallet . getAddressString ( ) )
46+ await createGiftWallet ( wallet . address )
4747 enqueueSnackbar ( 'Succesfully funded gift wallet' , { variant : 'success' } )
4848 } catch ( error ) {
4949 enqueueSnackbar ( `Failed to fund gift wallet: ${ error } ` , { variant : 'error' } )
0 commit comments