-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56b4899
commit e78a11f
Showing
16 changed files
with
148 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { ValueView } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb'; | ||
import { | ||
Metadata, | ||
ValueView, | ||
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb'; | ||
import { ValidatorInfoComponent } from './validator-info-component'; | ||
import { ValueViewComponent } from '@penumbra-zone/ui/components/ui/tx/view/value'; | ||
import { StakingActions } from './staking-actions'; | ||
|
@@ -10,6 +13,7 @@ import { | |
getValidatorInfoFromValueView, | ||
} from '@penumbra-zone/getters/src/value-view'; | ||
import { asValueView } from '@penumbra-zone/getters/src/equivalent-value'; | ||
import { useLoaderData } from 'react-router-dom'; | ||
|
||
/** | ||
* Renders a `ValueView` that contains a delegation token, along with the | ||
|
@@ -37,17 +41,19 @@ export const DelegationValueView = memo( | |
*/ | ||
unstakedTokens?: ValueView; | ||
}) => { | ||
const stakingTokenMetadata = useLoaderData() as Metadata; | ||
Check failure on line 44 in apps/minifront/src/components/staking/account/delegation-value-view/index.tsx GitHub Actions / testsrc/components/staking/account/delegation-value-view/index.test.tsx > <DelegationValueView /> > shows balance of the delegation token
Check failure on line 44 in apps/minifront/src/components/staking/account/delegation-value-view/index.tsx GitHub Actions / testsrc/components/staking/account/delegation-value-view/index.test.tsx > <DelegationValueView /> > shows the delegation token's equivalent value in terms of the staking token
|
||
const validatorInfo = getValidatorInfoFromValueView(valueView); | ||
const metadata = getMetadata(valueView); | ||
|
||
const equivalentValueOfStakingToken = useMemo(() => { | ||
const equivalentValue = getEquivalentValues(valueView).find( | ||
equivalentValue => equivalentValue.numeraire?.display === STAKING_TOKEN, | ||
equivalentValue => | ||
equivalentValue.numeraire?.penumbraAssetId === stakingTokenMetadata.penumbraAssetId, | ||
); | ||
|
||
if (equivalentValue) return asValueView(equivalentValue); | ||
return undefined; | ||
}, [valueView]); | ||
}, [valueView, stakingTokenMetadata.penumbraAssetId]); | ||
|
||
return ( | ||
<div className='flex flex-col gap-4 lg:flex-row lg:items-center lg:gap-8'> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.