@@ -510,7 +510,9 @@ export default class WalletService {
510510 throw new WalletNotFound ( walletID )
511511 }
512512
513- const cellStatus = await core . rpc . getLiveCell ( outPoint , false )
513+ const sdkOutPoint = ConvertTo . toSdkOutPoint ( outPoint )
514+
515+ const cellStatus = await core . rpc . getLiveCell ( sdkOutPoint , false )
514516 if ( cellStatus . status !== 'live' ) {
515517 throw new CellIsNotYetLive ( )
516518 }
@@ -529,6 +531,7 @@ export default class WalletService {
529531 const feeRateInt = BigInt ( feeRate )
530532 const mode = new FeeMode ( feeRateInt )
531533
534+ // 4 + 44 + 89 is input of deposited dao and witness size
532535 const sizeWithoutInputs : number = TransactionGenerator . txSerializedSizeInBlockWithoutInputsForDeposit ( ) + ( 4 + 44 + 89 )
533536 const feeWithoutInputs : bigint = TransactionGenerator . txFee ( sizeWithoutInputs , feeRateInt )
534537
@@ -539,6 +542,7 @@ export default class WalletService {
539542 const buf = Buffer . alloc ( 8 )
540543 buf . writeBigUInt64LE ( BigInt ( depositBlockNumber ) )
541544 output . data = `0x${ buf . toString ( 'hex' ) } `
545+ output . daoData = output . data
542546
543547 const capacityInt = BigInt ( output . capacity )
544548 const outputs : Cell [ ] = [ output ]
@@ -559,16 +563,24 @@ export default class WalletService {
559563 const { codeHash, outPoint : secpOutPoint , hashType } = await LockUtils . systemScript ( )
560564 const daoScriptInfo = await DaoUtils . daoScript ( )
561565
566+ const input : Input = {
567+ previousOutput : outPoint ,
568+ since : '0' ,
569+ lock : output . lock ,
570+ lockHash : LockUtils . lockScriptToHash ( output . lock ) ,
571+ capacity : output . capacity ,
572+ }
573+
562574 // change
563575 if (
564576 mode . isFeeMode ( ) && BigInt ( capacities ) > capacityInt + feeInt ||
565577 mode . isFeeRateMode ( ) && BigInt ( capacities ) > capacityInt + feeWithoutInputs + needFeeInt
566578 ) {
567579 const changeAddress = await AddressesService . nextUnusedChangeAddress ( walletID )
568580 const changeBlake160 : string = LockUtils . addressToBlake160 ( changeAddress ! . address )
569- let changeCapacity = BigInt ( capacities ) - capacityInt - feeInt
581+ let changeCapacity = BigInt ( capacities ) - feeInt
570582 if ( mode . isFeeRateMode ( ) ) {
571- changeCapacity = BigInt ( capacities ) - capacityInt - totalFee
583+ changeCapacity = BigInt ( capacities ) - totalFee
572584 }
573585
574586 const changeOutput : Cell = {
@@ -596,8 +608,10 @@ export default class WalletService {
596608 depType : DepType . Code ,
597609 } ,
598610 ] ,
599- headerDeps : [ ] ,
600- inputs,
611+ headerDeps : [
612+ depositBlock . hash ,
613+ ] ,
614+ inputs : [ input ] . concat ( inputs ) ,
601615 outputs,
602616 outputsData : outputs . map ( o => o . data || '0x' ) ,
603617 witnesses : [ ] ,
0 commit comments