-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unlock DAO failed with light client #316
Comments
The RPC https://github.com/nervosnetwork/ckb/tree/develop/rpc#method-calculate_dao_maximum_withdraw will be removed in the future, so the amount should be calculated offline. Ref: https://github.com/Magickbase/neuron-internal/issues/1380 |
Maybe we can migrate to this method public calculateDaoMaximumWithdraw = async (
depositOutPoint: OutPoint,
withdrawBlockHash: string
): Promise<bigint> => {
const currentNetwork = NetworksService.getInstance().getCurrent()
const ckb = new CKBRPC(currentNetwork.remote)
- const result = await ckb.calculateDaoMaximumWithdraw(depositOutPoint.toSDK(), withdrawBlockHash)
+ const depositHeader = await ckb.getHeader(depositBlockHash)
+ const withdrawHeader = await ckb.getHeader(withdrawBlockHash)
+ const withdrawCell = await ckb.getLiveCell(depositOutPoint.txHash)
+ return calculateMaximumWithdrawCompatible(withdrawCell, depositHeader.dao, withdrawHeader.dao)
} |
I found the method |
The light client does not have the RPC named |
Why not reuse the logic implemented at https://github.com/ckb-js/ckb-sdk-js/blob/develop/packages/ckb-sdk-core/src/index.ts#L423-L452 |
you're right, we should use the piece of the logic below, by using
|
Now it should be simple to fix because code snippets and test cases are ready, can we prioritize this fix in lumos so |
I've tried to fix the issue but I am struggling to verify it with the light client. It currently functions properly with the full node, but I'm unsure why the light client with devnet is unable to work with Neuron. Screen.Recording.2023-11-17.at.17.01.39.mov |
RPC method
calculateDaoMaximumWithdraw
was not in the light client. After replacingckb-sdk-js
withlumos
, it throws an error thatmethod not found
. ThecalculateDaoMaximumWithdraw
method inckb-sdk-js
is not the same as thelumos
.calculateDaoMaximumWithdraw
inckb-sdk-js
https://github.com/ckb-js/ckb-sdk-js/blob/develop/packages/ckb-sdk-core/src/index.ts#L423-L452
calculateDaoMaximumWithdraw
inlumos
https://github.com/ckb-js/lumos/blob/develop/packages/rpc/src/Base/experimental.ts#L10-L13
The text was updated successfully, but these errors were encountered: