-
Notifications
You must be signed in to change notification settings - Fork 17
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
1043 minifront cannot claim unbonding tokens #1066
1043 minifront cannot claim unbonding tokens #1066
Conversation
import { servicesCtx } from '../ctx/prax'; | ||
import { Code, ConnectError } from '@connectrpc/connect'; | ||
|
||
export const getValidatorInfo: Impl['getValidatorInfo'] = async (req, ctx) => { |
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 added the getValidatorInfo
implementation because it would not be optimal to iterate through the list of all validators for each unbonding balance
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 great 👍
const mockBalancesResponse4 = new BalancesResponse({ | ||
balanceView: { | ||
valueView: { | ||
case: 'unknownAssetId', | ||
value: { | ||
amount: { hi: 0n, lo: 3n }, | ||
}, | ||
}, | ||
}, | ||
}); |
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.
added to make sure that having balances with unknownAssetId does not break anything
const withValidatorInfo = getBalanceView(new BalancesResponse(balancesResponse)).clone(); | ||
if (withValidatorInfo.valueView.case !== 'knownAssetId') | ||
throw new Error(`Unexpected ValueView case: ${withValidatorInfo.valueView.case}`); | ||
|
||
withValidatorInfo.valueView.value.extendedMetadata = extendedMetadata; |
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.
Same way as for delegation tokens
const withValidatorInfo = delegation.balanceView.clone(); | |
if (withValidatorInfo.valueView.case !== 'knownAssetId') | |
throw new Error(`Unexpected ValueView case: ${withValidatorInfo.valueView.case}`); | |
withValidatorInfo.valueView.value.extendedMetadata = extendedMetadata; | |
yield new DelegationsByAddressIndexResponse({ valueView: withValidatorInfo }); |
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.
LGTM
export const stakingImpl: Pick<Impl, 'getValidatorInfo' | 'validatorInfo' | 'validatorPenalty'> = { | ||
getValidatorInfo, |
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.
Would kinda be nice if this was an Omit<Impl, ...>
, so that it was kinda in our face what we have not implemented yet
value: validatorInfo.toBinary(), | ||
}); | ||
|
||
const withValidatorInfo = getBalanceView(new BalancesResponse(balancesResponse)).clone(); |
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.
Why do we need to clone()?
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.
Indeed, it's unnecessary
1e7591b
to
6fda723
Compare
Now extended_metadata fills in for unbonding tokens as well
close #1043