-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: Manage Nervos DAO with multisig address #3298
base: develop
Are you sure you want to change the base?
Conversation
generateMultisigDaoClaimTx({ | ||
withdrawingOutPoint: record.outPoint, | ||
depositOutPoint: record.depositOutPoint, | ||
feeRate: `${MEDIUM_FEE_RATE}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no sugested fee rate here?
feeRate: string = '0', | ||
lockClass = { | ||
lockArgs: [''], | ||
codeHash: SystemScriptInfo.SECP_CODE_HASH, | ||
hashType: ScriptHashType.Type, | ||
}, | ||
multisigConfig?: MultisigConfigModel | ||
): Promise<Transaction> => { | ||
const secpCellDep = await SystemScriptInfo.getInstance().getSecpCellDep() | ||
let cellDep: CellDep | ||
if (lockClass.codeHash === SystemScriptInfo.MULTI_SIGN_CODE_HASH) { | ||
cellDep = await SystemScriptInfo.getInstance().getMultiSignCellDep() | ||
} else { | ||
cellDep = await SystemScriptInfo.getInstance().getSecpCellDep() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lockClass
is unnecessary here because multisigConfig
includes a blake160s
property, which serves the same purpose as lockArgs
in lockClass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lockClass
is still needed in subsequent processing
export const useOnWithdrawDialogSubmit = ({ | ||
activeRecord, | ||
setActiveRecord, | ||
clearGeneratedTx, | ||
walletID, | ||
dispatch, | ||
suggestFeeRate, | ||
multisigConfig, | ||
}: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to rename useOnWithdrawDialogSubmit
to useGenerateDaoWithdrawTx
and rename clearGeneratedTx
to onGenerateFailed
for clearer
multisigConfig.n | ||
) | ||
|
||
const multiSignBlake160 = script.args.slice(0, 42) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The args has been sliced at https://github.com/nervosnetwork/neuron/blob/develop/packages/neuron-wallet/src/models/multisig.ts#L29
|
||
const multiSignBlake160 = script.args.slice(0, 42) | ||
|
||
logger.info('getMultisigDaoCells---multiSignBlake160----', multiSignBlake160) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a debug log, remove it. Or print it in a better format.
@@ -285,6 +286,75 @@ export default class CellsService { | |||
return cells | |||
} | |||
|
|||
public static async getMultisigDaoCells(multisigConfig: MultisigConfigModel): Promise<Cell[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we refactor this function https://github.com/nervosnetwork/neuron/blob/develop/packages/neuron-wallet/src/services/cells.ts#L226 to get the DaoCells
with lock args?
@@ -815,6 +894,121 @@ export default class TransactionSender { | |||
return tx | |||
} | |||
|
|||
public withdrawFromMultisigDao = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many duplicated code with https://github.com/nervosnetwork/neuron/blob/develop/packages/neuron-wallet/src/services/transaction-sender.ts#L707
? Script.fromSDK( | ||
Multisig.getMultisigScript(multisigConfig.blake160s, multisigConfig.r, multisigConfig.m, multisigConfig.n) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between Multisig.getMultisigScript
's return type and Script.fromSDK
's return type?
type: AppActions.RequestPassword, | ||
payload: { | ||
walletID: wallet.id, | ||
actionType: multisigConfig.m === 1 ? 'send-from-multisig-need-one' : 'send-from-multisig', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be verified using the getMultisigSignStatus
result named canBroadcastAfterSign
.
Magickbase/neuron-public-issues#425
Screen-2025-01-16-050516.mp4