Skip to content

Commit

Permalink
fix deposit bug (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev Kalra authored Dec 7, 2023
1 parent 8d299ea commit f07385b
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions frontend/components/panels/StakePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,19 @@ export function StakePanel({ mainStakeAccount }: StakePanelProps) {

const [amount, setAmount] = useState<string>('')

const deposit = useCallback(
(amount: string) =>
// we are disabling actions when mainStakeAccount is undefined
// or stakeConnection is undefined
depositMutation.mutate({
amount,
// If mainStakeAccount is undefined this action is disabled
// undefined means that the mainStakeAccount is loading.
// If we execute this action, this will work. But it will create a
// new stake account for the user.
mainStakeAccount: mainStakeAccount as StakeAccount | 'NA',
// action is disabled below if these is undefined
stakeConnection: stakeConnection!,
}),
[]
)

const deposit = (amount: string) =>
// we are disabling actions when mainStakeAccount is undefined
// or stakeConnection is undefined
depositMutation.mutate({
amount,
// If mainStakeAccount is undefined this action is disabled
// undefined means that the mainStakeAccount is loading.
// If we execute this action, this will work. But it will create a
// new stake account for the user.
mainStakeAccount: mainStakeAccount as StakeAccount | 'NA',
// action is disabled below if these is undefined
stakeConnection: stakeConnection!,
})
const isSufficientBalance = isSufficientBalanceFn(amount, pythBalance)

// set amount when input changes
Expand Down

2 comments on commit f07385b

@vercel
Copy link

@vercel vercel bot commented on f07385b Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on f07385b Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

staking-devnet – ./

staking-devnet-pyth-web.vercel.app
staking-devnet-git-main-pyth-web.vercel.app
governance-nu.vercel.app

Please sign in to comment.