Skip to content

Commit 9b1c0ed

Browse files
committed
fix: fix withdraw dao bug
1 parent 2756a15 commit 9b1c0ed

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

packages/neuron-wallet/src/services/wallets.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ export default class WalletService {
638638
finalFee = TransactionGenerator.txFee(txSize, feeRateInt)
639639
}
640640

641-
const cellStatus = await core.rpc.getLiveCell(withdrawingOutPoint, true)
641+
const sdkWithdrawingOutPoint = ConvertTo.toSdkOutPoint(withdrawingOutPoint)
642+
const cellStatus = await core.rpc.getLiveCell(sdkWithdrawingOutPoint, true)
642643
if (cellStatus.status !== 'live') {
643644
throw new CellIsNotYetLive()
644645
}
@@ -689,9 +690,12 @@ export default class WalletService {
689690

690691
const outputs: Cell[] = [output]
691692

693+
const previousOutput = TypeConvert.toOutput(cellStatus.cell.output)
692694
const input: Input = {
693695
previousOutput: withdrawingOutPoint,
694696
since: minimalSince.toString(),
697+
lock: previousOutput.lock,
698+
lockHash: LockUtils.computeScriptHash(previousOutput.lock)
695699
}
696700

697701
return {
@@ -715,7 +719,7 @@ export default class WalletService {
715719
outputsData: outputs.map(o => o.data || '0x'),
716720
witnesses: [],
717721
witnessArgs: [{
718-
lock: '',
722+
lock: undefined,
719723
inputType: '0x0000000000000000',
720724
outputType: undefined,
721725
}]
@@ -786,7 +790,7 @@ export default class WalletService {
786790
}
787791

788792
public signWitness = (
789-
lock: string,
793+
lock: string | undefined,
790794
privateKey: string,
791795
txHash: string,
792796
inputType: string | undefined = undefined,
@@ -797,10 +801,12 @@ export default class WalletService {
797801
inputType,
798802
outputType,
799803
}
800-
return core.signWitnesses(privateKey)({
804+
const result = core.signWitnesses(privateKey)({
801805
transactionHash: txHash,
802806
witnesses: [witnessArg]
803-
})[0] as string
807+
})
808+
809+
return result[0] as string
804810
}
805811

806812
// Derivate all child private keys for specified BIP44 paths.

packages/neuron-wallet/src/types/cell-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface CellDep {
3535
}
3636

3737
export interface WitnessArgs {
38-
lock: string
38+
lock: string | undefined
3939
inputType: string | undefined
4040
outputType: string | undefined
4141
}

0 commit comments

Comments
 (0)