Skip to content

Commit

Permalink
fix: Don't fetch allowances twice
Browse files Browse the repository at this point in the history
  • Loading branch information
garethfuller committed Jun 30, 2023
1 parent fa8c219 commit 0bac4fd
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/composables/approvals/useTokenApprovalActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,8 @@ export default function useTokenApprovalActions() {
/**
* COMPOSABLES
*/
const {
refetchAllowances,
approvalsRequired,
approvalRequired,
getToken,
injectSpenders,
} = useTokens();
const { approvalsRequired, approvalRequired, getToken, injectSpenders } =
useTokens();
const { t } = useI18n();
const { getSigner } = useWeb3();
const { addTransaction } = useTransactions();
Expand Down Expand Up @@ -95,7 +90,7 @@ export default function useTokenApprovalActions() {
spender: string
): Promise<AmountToApprove[]> {
await injectSpenders([spender]);
await refetchAllowances();

return approvalsRequired(amountsToApprove, spender);
}

Expand All @@ -104,7 +99,7 @@ export default function useTokenApprovalActions() {
spender: string
): Promise<boolean> {
await injectSpenders([spender]);
await refetchAllowances();

return !approvalRequired(
amountToApprove.address,
amountToApprove.amount,
Expand Down

0 comments on commit 0bac4fd

Please sign in to comment.