11import type { ApiPromise } from '@polkadot/api'
2- import { hexToString } from '@polkadot/util'
2+ import { hexToBigInt , hexToString } from '@polkadot/util'
33import { Card , Spin , Table , Tag , Typography , message } from 'antd'
44import type { ColumnsType } from 'antd/es/table'
55import React , { useState , useEffect , useCallback } from 'react'
@@ -12,6 +12,7 @@ interface CollatorRow {
1212 paraId : number
1313 isInvulnerable : boolean
1414 isStaking : boolean
15+ stake : bigint
1516}
1617
1718export interface CollatorTableProps {
@@ -71,7 +72,7 @@ const CollatorTable: React.FC<CollatorTableProps> = ({ api, onRefreshReady }) =>
7172 // Extract containerChains
7273 const activeChains : Record < string , string [ ] > = collatorData . containerChains || { }
7374 const invSet = new Set ( invulnerables )
74- const stakeSet = new Set ( stakingCandidates )
75+ const stakeMap = new Map ( stakingCandidates . map ( ( x ) => [ x . candidate , hexToBigInt ( x . stake ) ] ) )
7576
7677 // Build rows
7778 const dataRows : CollatorRow [ ] = [ ]
@@ -86,7 +87,8 @@ const CollatorTable: React.FC<CollatorTableProps> = ({ api, onRefreshReady }) =>
8687 alias : '' ,
8788 authorityKey : addressToAuthKey [ address ] || '' ,
8889 isInvulnerable : invSet . has ( address ) ,
89- isStaking : stakeSet . has ( address ) ,
90+ isStaking : stakeMap . has ( address ) ,
91+ stake : stakeMap . get ( address ) ,
9092 } )
9193 }
9294 }
@@ -175,6 +177,7 @@ const CollatorTable: React.FC<CollatorTableProps> = ({ api, onRefreshReady }) =>
175177 ] ,
176178 onFilter : ( val , rec ) => rec . isStaking === val ,
177179 } ,
180+ { title : 'Stake' , dataIndex : 'stake' , key : 'stake' , render : ( v ) => v ?. toString ( ) } ,
178181 ]
179182
180183 return (
0 commit comments