Skip to content

refactor: replace ckbCore with lumos CKBRPC - #3145

Merged
Keith-CY merged 1 commit into
nervosnetwork:developfrom
twhy:replace-ckbCore-with-lumos-CKBRPC
May 9, 2024
Merged

refactor: replace ckbCore with lumos CKBRPC#3145
Keith-CY merged 1 commit into
nervosnetwork:developfrom
twhy:replace-ckbCore-with-lumos-CKBRPC

Conversation

@twhy

@twhy twhy commented May 9, 2024

Copy link
Copy Markdown
Contributor
  1. 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()

  1. 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.

  1. @nervosnetwork/ckb-sdk-core is removed from dependencies of neurons-ui .

@Keith-CY
Keith-CY added this pull request to the merge queue May 9, 2024
Merged via the queue into nervosnetwork:develop with commit 53c02ba May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants