@@ -398,6 +398,16 @@ class LND {
398398 return result ;
399399 }
400400
401+ /**
402+ * Starts the channel opening process for external channel funding.
403+ * fundingStateStep() needs to be used to progress the state.
404+ * @param fundingAmount
405+ * @param nodePubkey
406+ * @param closeAddress
407+ * @param onUpdate
408+ * @param onDone
409+ * @returns {Uint8Array }
410+ */
401411 openChannelStream (
402412 fundingAmount : number ,
403413 nodePubkey : string ,
@@ -441,47 +451,29 @@ class LND {
441451 return pendingChanId ;
442452 }
443453
454+ /**
455+ * Progress the state of a channel opening by providing a PSBT for
456+ * verification (containing funding input), for finalization (signed inputs) or
457+ * canceling a channel funding process.
458+ * @param pendingChanId
459+ * @param psbt
460+ * @param step
461+ * @returns {Promise<Ok<lnrpc.FundingStateStepResp, Error> | Err<unknown, any>> }
462+ */
444463 async fundingStateStep (
445464 pendingChanId : Uint8Array ,
446465 psbt : string ,
447- step : 'register' | ' verify' | 'finalize' | 'cancel'
466+ step : 'verify' | 'finalize' | 'cancel'
448467 ) : Promise < Result < lnrpc . FundingStateStepResp , Error > > {
449468 try {
450469 const message = lnrpc . FundingTransitionMsg . create ( ) ;
451470
452471 switch ( step ) {
453- case 'register' : {
454- message . shimRegister = lnrpc . FundingShim . create ( {
455- psbtShim : lnrpc . PsbtShim . create ( {
456- pendingChanId,
457- basePsbt : base64 . toByteArray ( psbt )
458- } )
459- } ) ;
460- break ;
461- }
462472 case 'verify' : {
463- // const b = Buffer.from(psbt, 'base64');
464- // const arr = new Uint8Array(
465- // b.buffer,
466- // b.byteOffset,
467- // b.byteLength / Uint8Array.BYTES_PER_ELEMENT
468- // );
469- // console.log('\n\n*************');
470- // console.log(base64.toByteArray(psbt));
471- // // console.log('****COVERT***');
472- // console.log(arr);
473- // // console.log(psbt);
474- // console.log('*************\n\n');
475-
476473 message . psbtVerify = lnrpc . FundingPsbtVerify . create ( {
477474 pendingChanId,
478475 fundedPsbt : base64 . toByteArray ( psbt )
479476 } ) ;
480-
481- // message.psbtVerify = lnrpc.PsbtShim.create({
482- // pendingChanId
483- // // basePsbt: base64.toByteArray(psbt)
484- // });
485477 break ;
486478 }
487479 case 'finalize' : {
0 commit comments