neuron
neuron copied to clipboard
refactor: replace ckbCore with lumos CKBRPC
-
CKBRPC.createBatchRequest()in Lumos currently has limited typing info:any
createBatchRequest: <N extends keyof Base, P extends (string | number | object)[], R = any[]>(params?: any) => any;
So in this PR I manually added response types in then blocks for CKBRPC.createBatchRequest calls, e.g.
rpc
.createBatchRequest<'getTransaction', string[], CKBComponents.TransactionWithStatus[]>(
depositOutPointHashes.map(v => ['getTransaction', v])
)
.exec()
.then((txs: CKBComponents.TransactionWithStatus[]) => {
I'm working on another PR for Lumos to bring back the right types for CKBRPC.createBatchRequest()
- In
packages/neuron-ui/src/components/WithdrawDialog/index.tsx
calculateMaximumWithdraw(
tx.transaction.outputs[+record.outPoint.index] as CKBComponents.CellOutput,
tx.transaction.outputsData[+record.outPoint.index],
header.dao,
tipDao
)
as CKBComponents.CellOutput is added because
calculateMaximumWithdraw expects CKBComponents.CellOutput whose script.hashType is 'data' | 'type' | 'data1'
tx.transaction.outputs member has type Output whose script.hashType is "type" | "data" | "data1" | "data2"
as CKBComponents.CellOutput will be removed in next PR, which I will replace @nervosnetwork/ckb-sdk-utils methods with Lumos methods.
-
@nervosnetwork/ckb-sdk-coreis removed fromdependenciesofneurons-ui.