Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Meyer committed Oct 5, 2023
1 parent 22b467a commit ecad467
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions use-defi/src/hooks/useExecutePosition/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useCallback, useMemo } from 'react';
import { useQuery } from 'wagmi';

import { queryRouteWithApprovals, QueryRouteWithApprovalsOptions } from '../../queries/route';
import { ApproveTransaction, TransferTransaction } from '../../types/api';
import { formatTransaction } from '../../utils/formatTransaction';
import { getTokenAddressFromPosition } from '../../utils/position';
import { useDeFiContext } from '../internal/useDeFiContext';
Expand Down Expand Up @@ -70,7 +71,8 @@ export const useExecutePosition = (args?: UseExecutePositionArgs): UseExecuteSho

const executeApprovalsOrTransfers = useCallback(() => {
const transactionFuncs = routeQueryResponse?.approvals?.map(
(approvalData) => walletClient?.sendTransaction(formatTransaction(approvalData.tx, walletClient.chain)),
(approvalData: ApproveTransaction) =>
walletClient?.sendTransaction(formatTransaction(approvalData.tx, walletClient.chain)),
);

if (!transactionFuncs) return;
Expand All @@ -85,14 +87,14 @@ export const useExecutePosition = (args?: UseExecutePositionArgs): UseExecuteSho
...routeQueryResponse.route,
execute: executeRoute,
},
approvals: routeQueryResponse.approvals?.map((approval) => ({
approvals: routeQueryResponse.approvals?.map((approval: ApproveTransaction) => ({
token: approval.token as `0x${string}`,
amount: approval.amount,
gas: approval.gas,
spender: approval.spender,
execute: async () => walletClient?.sendTransaction(formatTransaction(approval.tx, walletClient.chain)),
})),
transfers: routeQueryResponse.transfers?.map((transfer) => ({
transfers: routeQueryResponse.transfers?.map((transfer: TransferTransaction) => ({
token: transfer.token as `0x${string}`,
amount: transfer.amount,
gas: transfer.gas,
Expand Down

0 comments on commit ecad467

Please sign in to comment.