Skip to content

Commit 16b2233

Browse files
committed
fix(neuron-ui): fix the free and locked value of nervos dao
1 parent 3d7953a commit 16b2233

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

  • packages/neuron-ui/src/components/NervosDAO

packages/neuron-ui/src/components/NervosDAO/index.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,8 @@ const NervosDAO = ({
234234
)
235235
}, [records, withdrawList, t, onActionClick, tipBlockNumber, epoch])
236236

237-
let free = BigInt(0)
238-
let locked = BigInt(0)
239-
records.forEach(r => {
240-
if (!r.depositOutPoint) {
241-
locked += BigInt(r.capacity)
242-
} else {
243-
free += BigInt(r.capacity)
244-
}
245-
})
237+
const free = BigInt(wallet.balance)
238+
const locked = withdrawList.reduce((acc, w) => acc + BigInt(w || 0), BigInt(0))
246239

247240
const EpochInfo = useMemo(() => {
248241
if (!epoch) {

0 commit comments

Comments
 (0)