Skip to content

Commit 6eaafb0

Browse files
committed
Add stake to collator page
1 parent 06cd1b1 commit 6eaafb0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/CollatorTable.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ApiPromise } from '@polkadot/api'
2-
import { hexToString } from '@polkadot/util'
2+
import { hexToBigInt, hexToString } from '@polkadot/util'
33
import { Card, Spin, Table, Tag, Typography, message } from 'antd'
44
import type { ColumnsType } from 'antd/es/table'
55
import 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

1718
export 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

Comments
 (0)