on df0c310 help sign in
bridge/src/views/Release/useWithdrawStars.ts
19 lines 669 B history raw
1import useEthereumTransaction from 'lib/useEthereumTransaction';
2import { useCallback } from 'react';
3import { usePointCache } from 'store/pointCache';
4import { useStarReleaseCache } from 'store/starRelease';
6export function useWithdrawStars() {
7 const { syncControlledPoints }: any = usePointCache();
9 const { syncStarReleaseDetails, withdraw }: any = useStarReleaseCache();
10 return useEthereumTransaction(
11 useCallback((to: string, amount: number) => withdraw(amount, to), [
12 withdraw,
13 ]),
14 useCallback(
15 () => Promise.all([syncControlledPoints(), syncStarReleaseDetails()]),
16 [syncStarReleaseDetails, syncControlledPoints]
17 )
18 );