-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update Polkadot priority pool id * style: truncate pool name * feat: usePoolCommission hook * feat: display commission on staking side sheet * feat: added tooltip to Comssion fee * feat: added commission fee to pool selector * fix: pagination indicator gap * chore: updated tooltip text
- Loading branch information
Showing
8 changed files
with
108 additions
and
23 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
27 changes: 27 additions & 0 deletions
27
apps/portal/src/domains/staking/substrate/nominationPools/hooks/usePoolCommission.ts
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useRecommendedPoolsState } from '../recoils' | ||
import type { AnyJson } from '@w3ux/types' | ||
import { useRecoilValue } from 'recoil' | ||
|
||
export type BondedPool = { | ||
commission?: { | ||
current?: AnyJson | null | ||
max?: AnyJson | null | ||
changeRate: { | ||
maxIncrease: AnyJson | ||
minDelay: AnyJson | ||
} | null | ||
throttleFrom?: AnyJson | null | ||
} | ||
} | ||
|
||
export const usePoolCommission = () => { | ||
const pools = useRecoilValue(useRecommendedPoolsState()) | ||
|
||
const getCurrentCommission = (poolId: number) => { | ||
const pool: BondedPool | undefined = pools.find(pool => pool.poolId === poolId)?.bondedPool.toHuman() | ||
|
||
return Number(pool?.commission?.current?.[0]?.slice(0, -1) || 0) | ||
} | ||
|
||
return { getCurrentCommission } | ||
} |
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