-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update to use more competitive fees
- Loading branch information
1 parent
091f6de
commit d03f2a2
Showing
7 changed files
with
45 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
import { useCallback } from 'react'; | ||
import BigNumber from 'bignumber.js'; | ||
|
||
import { useFetchFeeRate } from './use-fetch-fee-rate'; | ||
|
||
const defaultFeeRate = 1; | ||
import { useFeeRate } from './use-fee-rate'; | ||
|
||
/** | ||
* Returns a function calculating how much of a fee should be set | ||
* based on the number of bytes of the transaction. | ||
*/ | ||
export function useCalculateFee() { | ||
const { feeRate } = useFetchFeeRate(); | ||
return useCallback( | ||
(bytes: number) => new BigNumber(feeRate ?? defaultFeeRate).multipliedBy(bytes), | ||
[feeRate] | ||
); | ||
const { feeRate } = useFeeRate(); | ||
return useCallback((bytes: number) => new BigNumber(feeRate).multipliedBy(bytes), [feeRate]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useMemo } from 'react'; | ||
import { FEE_RATE } from '@constants/index'; | ||
|
||
export function useFeeRate() { | ||
return useMemo(() => ({ feeRate: FEE_RATE }), []); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters