-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add undelegate, redelegate and claim rewards #95
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff!
<> | ||
<li> | ||
<label>Amount:</label> | ||
<div>{printableCoin(props.tx.msgs[0].value.amount, state.chain)}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same issue for the whole file, but we can do
<div>{printableCoin(props.tx.msgs[0].value.amount, state.chain)}</div> | |
<div>{printableCoin(msg.value.amount, state.chain)}</div> |
since we loop over messages already. This makes the code future proof for multi message transactions (which we soon need to withdraw rewards from multiple validators).
) : msg.typeUrl === "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward" ? ( | ||
<> | ||
<li> | ||
<label>Amount:</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message has no amount, just those two fields: https://github.com/cosmos/cosmos-sdk/blob/v0.47.0/proto/cosmos/distribution/v1beta1/tx.proto#L66-L77
components/forms/RewardsForm.tsx
Outdated
import StackableContainer from "../layout/StackableContainer"; | ||
|
||
interface Props { | ||
address: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to make explicit which address this is. For this component we can say delegatorAddress
which is then set to the multisig address that signs the transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this prop should not be null
able because otherwise we don't create the transaction correctly.
import StackableContainer from "../layout/StackableContainer"; | ||
|
||
interface Props { | ||
address: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delegatorAddress
as above.
Also this prop should not be null
able.
onChange={(e: React.ChangeEvent<HTMLInputElement>) => | ||
setValidatorDstAddress(e.target.value) | ||
} | ||
error={addressError} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need separate error props, one for each field?
pages/multi/[address]/index.tsx
Outdated
!showDelegateTxForm && | ||
!showUnDelegateTxForm && | ||
!showRewardsTxForm && | ||
!showReDelegateTxForm && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make a separate prop for that (something like anyTxFormVisible
) that is automatically updated from those inputs?
pages/multi/[address]/index.tsx
Outdated
import Button from "../../../components/inputs/Button"; | ||
import Page from "../../../components/layout/Page"; | ||
import StackableContainer from "../../../components/layout/StackableContainer"; | ||
import { useAppContext } from "../../../context/AppContext"; | ||
import { getMultisigAccount } from "../../../lib/multisigHelpers"; | ||
|
||
type TxView = "select" | "send" | "delegate" | "undelegate" | "redelegate" | "claimRewards"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice solution! What about chaning "select"
to null
to make it clear that this is a special case that works differently than the others?
Part of #52.
Closes #74.