Skip to content

Commit 8cbb2d5

Browse files
committed
fix: userBalance wasn't always passed to queries from form
1 parent 83f0309 commit 8cbb2d5

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

apps/main/src/dex/entities/gauge/model/estimate-gas-options.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ import { gaugeKeys } from './query-keys'
1010
import { depositRewardAvailable, depositRewardIsApproved } from './query-options'
1111

1212
export const estimateGasDepositRewardApprove = queryFactory({
13-
queryKey: ({ rewardTokenId, amount, ...gaugeParams }: DepositRewardApproveParams) =>
13+
queryKey: ({ rewardTokenId, amount, userBalance, ...gaugeParams }: DepositRewardApproveParams) =>
1414
[
1515
...rootKeys.gauge({ ...gaugeParams }),
1616
...gaugeKeys.estimateGas(),
1717
'depositRewardApprove',
1818
{ rewardTokenId },
1919
{ amount },
20+
{ userBalance },
2021
] as const,
2122
queryFn: api.queryEstimateGasDepositRewardApprove,
2223
refetchInterval: '1m',
@@ -43,14 +44,15 @@ export const estimateGasAddRewardToken = queryFactory({
4344
})
4445

4546
export const estimateGasDepositReward = queryFactory({
46-
queryKey: ({ rewardTokenId, amount, epoch, ...gaugeParams }: DepositRewardParams) =>
47+
queryKey: ({ rewardTokenId, amount, epoch, userBalance, ...gaugeParams }: DepositRewardParams) =>
4748
[
4849
...rootKeys.gauge({ ...gaugeParams }),
4950
...gaugeKeys.estimateGas(),
5051
'depositReward',
5152
{ rewardTokenId },
5253
{ amount },
5354
{ epoch },
55+
{ userBalance },
5456
] as const,
5557
queryFn: api.queryEstimateGasDepositReward,
5658
refetchInterval: '1m',

apps/main/src/dex/features/deposit-gauge-reward/ui/ActionsStepper.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const DepositStepper = ({ chainId, poolId }: { chainId: ChainId; poolId:
3232
const amount = watch('amount')
3333
const rewardTokenId = watch('rewardTokenId')
3434
const step = watch('step')
35+
const userBalance = watch('userBalance')
3536

3637
const { mutate: depositRewardApprove, isPending: isPendingDepositRewardApprove } = useDepositRewardApprove({
3738
chainId,
@@ -59,6 +60,7 @@ export const DepositStepper = ({ chainId, poolId }: { chainId: ChainId; poolId:
5960
{
6061
rewardTokenId: getValues('rewardTokenId'),
6162
amount: getValues('amount'),
63+
userBalance: getValues('userBalance'),
6264
},
6365
{ onSuccess: onApproveSuccess, onError: onApproveError },
6466
)
@@ -70,6 +72,7 @@ export const DepositStepper = ({ chainId, poolId }: { chainId: ChainId; poolId:
7072
rewardTokenId: getValues('rewardTokenId'),
7173
amount: getValues('amount'),
7274
epoch: getValues('epoch'),
75+
userBalance: getValues('userBalance'),
7376
},
7477
{
7578
onSuccess: (data: string) => {
@@ -91,6 +94,7 @@ export const DepositStepper = ({ chainId, poolId }: { chainId: ChainId; poolId:
9194
poolId,
9295
rewardTokenId,
9396
amount,
97+
userBalance,
9498
})
9599

96100
useLayoutEffect(() => {

apps/main/src/dex/features/deposit-gauge-reward/ui/GasEstimation.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ export const GasEstimation = ({ chainId, poolId }: { chainId: ChainId; poolId: s
1414
const amount = watch('amount')
1515
const epoch = watch('epoch')
1616
const step = watch('step')
17+
const userBalance = watch('userBalance')
1718

1819
const {
1920
data: estimatedGasDepositRewardApprove,
2021
isLoading: isLoadingGasEstimateDepositRewardApprove,
2122
isFetching: isFetchingGasEstimateDepositRewardApprove,
2223
} = useEstimateGasDepositRewardApprove(
23-
{ chainId, poolId, rewardTokenId, amount },
24+
{ chainId, poolId, rewardTokenId, amount, userBalance },
2425
step === DepositRewardStep.APPROVAL && isValid,
2526
)
2627

@@ -35,6 +36,7 @@ export const GasEstimation = ({ chainId, poolId }: { chainId: ChainId; poolId: s
3536
rewardTokenId,
3637
amount,
3738
epoch,
39+
userBalance,
3840
},
3941
step === DepositRewardStep.DEPOSIT && isValid,
4042
)

0 commit comments

Comments
 (0)