-
Notifications
You must be signed in to change notification settings - Fork 21
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
Build UI for claiming unbonding tokens #659
Conversation
4729534
to
8f90a65
Compare
09def59
to
0661d14
Compare
package.json
Outdated
"@buf/penumbra-zone_penumbra.bufbuild_es": "1.7.2-20240304191729-7e25957407d1.1", | ||
"@buf/penumbra-zone_penumbra.connectrpc_es": "1.4.0-20240304191729-7e25957407d1.1", |
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.
Updating to the version that includes undelegation claims in TransactionPlannerRequest
{unbondingTokens?.tokens.map(token => ( | ||
<ValueViewComponent key={getDisplayDenomFromView(token)} view={token} /> | ||
))} | ||
<TooltipProvider> |
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.
All I did here was make the entire unbonding amount ValueViewComponent
the tooltip trigger, rather than having the little (i) icon as the trigger
'cannot claim unbonding tokens before the end epoch', | ||
'undelegation was prepared for next epoch', |
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.
Unrelated to this PR, see penumbra-zone/penumbra#3961.
These messages are actually in the core repo — not Tendermint itself. Thus, they can (and probably should) be changed to include a machine-readable error code, rather than us having to parse human-readable text.
0e494ae
to
03d9871
Compare
* </ActionDetails> | ||
* ``` | ||
*/ | ||
export const ActionDetails = ({ children }: { children: ReactNode }) => { |
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.
@@ -13,7 +13,7 @@ export const ViewBox = ({ label, visibleContent }: ViewBoxProps) => { | |||
return ( | |||
<div | |||
className={cn( | |||
'bg-background px-4 pt-3 pb-4 rounded-lg border flex flex-col gap-1 break-all', | |||
'bg-background px-4 pt-3 pb-4 rounded-lg border flex flex-col gap-1 break-all overflow-hidden', |
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.
Fixes an issue where the view box would stretch beyond its parents bounds if its children were too big.
penumbra-stake = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.68.2", package = "penumbra-stake", default-features = false } | ||
penumbra-tct = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.68.2", package = "penumbra-tct" } | ||
penumbra-transaction = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.68.2", package = "penumbra-transaction", default-features = false } | ||
penumbra-asset = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.68.3", package = "penumbra-asset" } |
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.
Updated to get the latest version of TransactionPlannerRequest
, which now includes undelegation claims
024cbbb
to
b0c1e3e
Compare
@@ -59,6 +59,6 @@ export const buildActionParallel = async ( | |||
const loadProvingKey = async (actionType: ActionType) => { | |||
const keyType = provingKeys[actionType]; | |||
if (!keyType) return; | |||
const keyBin = (await fetch(`bin/${actionType}_pk.bin`)).arrayBuffer(); | |||
const keyBin = (await fetch(`bin/${keyType}_pk.bin`)).arrayBuffer(); |
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.
Fixes a bug where the proving key wasn't being fetched correctly. We didn't notice this earlier because actionType
and keyType
are the same for the more common actions, but I noticed it while working on undelegation claims because the undelegateClaim
action uses a convert
key.
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.
oh! Good catch.
@@ -279,6 +284,50 @@ export const createStakingSlice = (): SliceCreator<StakingSlice> => (set, get) = | |||
}); | |||
} | |||
}, | |||
undelegateClaim: async () => { |
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.
These state methods that build and submit a transaction, as well as manage toasts, are quite repetitive. I want to DRY them up, but this PR is already pretty huge (sorry), so I'll do that in a future PR.
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 create an issue for that 🙏 ?
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 job!
At the moment, there's no RPC method to detect which unbonding tokens are eligible for claiming and which aren't
Can you create an issue for this and add it to the staking tracking issue?
@@ -279,6 +284,50 @@ export const createStakingSlice = (): SliceCreator<StakingSlice> => (set, get) = | |||
}); | |||
} | |||
}, | |||
undelegateClaim: async () => { |
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 create an issue for that 🙏 ?
@@ -59,6 +59,6 @@ export const buildActionParallel = async ( | |||
const loadProvingKey = async (actionType: ActionType) => { | |||
const keyType = provingKeys[actionType]; | |||
if (!keyType) return; | |||
const keyBin = (await fetch(`bin/${actionType}_pk.bin`)).arrayBuffer(); | |||
const keyBin = (await fetch(`bin/${keyType}_pk.bin`)).arrayBuffer(); |
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.
oh! Good catch.
This reverts commit bb27e46.
2ce6a77
to
4552ea7
Compare
I believe @erwanor was already working on this... @erwanor , is there a ticket for this RPC method? |
@grod220 Nevermind — just created the ticket after discussing with @erwanor . penumbra-zone/penumbra#4006 |
Initial UI for claiming unbonding tokens.
undelegate-claim.mov
🚨 This will automatically attempt to claim all unbonding tokens that the current address holds, even if some of them are not yet eligible for claiming. In that case, an error will show up, saying that we're not yet in the right epoch for claiming unbonding tokens. At the moment, there's no RPC method to detect which unbonding tokens are eligible for claiming and which aren't . When there is, we can automatically select just the eligible tokens and claim those. Until then, we'll just cross our fingers :D
In this PR
undelegateClaim
action in the Staking slice, as well as in the WASM planner.ValidatorPenalty
method ofStakingService
, which is required for an undelegation claim.Closes #655