@@ -175,6 +175,7 @@ function DestinationShower(props: {
175175    description ?: string ; 
176176    address ?: string ; 
177177    invoice ?: MutinyInvoice ; 
178+     offer ?: string ; 
178179    nodePubkey ?: string ; 
179180    lnurl ?: string ; 
180181    clearAll : ( )  =>  void ; 
@@ -187,6 +188,9 @@ function DestinationShower(props: {
187188            < Match  when = { props . invoice  &&  props . source  ===  "lightning" } > 
188189                < StringShower  text = { props . invoice ?. bolt11  ||  "" }  /> 
189190            </ Match > 
191+             < Match  when = { props . offer  &&  props . source  ===  "lightning" } > 
192+                 < StringShower  text = { props . offer  ||  "" }  /> 
193+             </ Match > 
190194            < Match  when = { props . nodePubkey  &&  props . source  ===  "lightning" } > 
191195                < StringShower  text = { props . nodePubkey  ||  "" }  /> 
192196            </ Match > 
@@ -213,6 +217,7 @@ export default function Send() {
213217
214218    // These can only be derived from the "destination" signal 
215219    const  [ invoice ,  setInvoice ]  =  createSignal < MutinyInvoice > ( ) ; 
220+     const  [ offer ,  setOffer ]  =  createSignal < string > ( ) ; 
216221    const  [ nodePubkey ,  setNodePubkey ]  =  createSignal < string > ( ) ; 
217222    const  [ lnurlp ,  setLnurlp ]  =  createSignal < string > ( ) ; 
218223    const  [ address ,  setAddress ]  =  createSignal < string > ( ) ; 
@@ -236,6 +241,7 @@ export default function Send() {
236241        setIsAmtEditable ( true ) ; 
237242        setSource ( "lightning" ) ; 
238243        setInvoice ( undefined ) ; 
244+         setOffer ( undefined ) ; 
239245        setAddress ( undefined ) ; 
240246        setDescription ( undefined ) ; 
241247        setNodePubkey ( undefined ) ; 
@@ -346,6 +352,13 @@ export default function Send() {
346352                        setInvoice ( invoice ) ; 
347353                        setSource ( "lightning" ) ; 
348354                    } ) ; 
355+             }  else  if  ( source . offer )  { 
356+                 if  ( source . amount_sats )  { 
357+                     setAmountSats ( source . amount_sats ) 
358+                     setIsAmtEditable ( false ) ; 
359+                 } 
360+                 setOffer ( source . offer ) ; 
361+                 setSource ( "lightning" ) ; 
349362            }  else  if  ( source . node_pubkey )  { 
350363                setAmountSats ( source . amount_sats  ||  0n ) ; 
351364                setNodePubkey ( source . node_pubkey ) ; 
@@ -489,6 +502,24 @@ export default function Send() {
489502                    sentDetails . amount  =  amountSats ( ) ; 
490503                    sentDetails . fee_estimate  =  payment ?. fees_paid  ||  0 ; 
491504                } 
505+             }  else  if  ( source ( )  ===  "lightning"  &&  offer ( ) )  { 
506+                 const  nodes  =  await  state . mutiny_wallet ?. list_nodes ( ) ; 
507+                 const  firstNode  =  ( nodes [ 0 ]  as  string )  ||  "" ; 
508+                 const  payment  =  await  state . mutiny_wallet ?. pay_offer ( 
509+                     firstNode , 
510+                     offer ( ) ! , 
511+                     amountSats ( ) , 
512+                     undefined , 
513+                     undefined ,  // todo add optional payer message 
514+                     tags 
515+                 ) ; 
516+ 
517+                 if  ( ! payment ?. paid )  { 
518+                     throw  new  Error ( i18n . t ( "send.error_keysend" ) ) ; 
519+                 }  else  { 
520+                     sentDetails . amount  =  amountSats ( ) ; 
521+                     sentDetails . fee_estimate  =  payment ?. fees_paid  ||  0 ; 
522+                 } 
492523            }  else  if  ( source ( )  ===  "lightning"  &&  nodePubkey ( ) )  { 
493524                const  nodes  =  await  state . mutiny_wallet ?. list_nodes ( ) ; 
494525                const  firstNode  =  ( nodes [ 0 ]  as  string )  ||  "" ; 
@@ -576,7 +607,7 @@ export default function Send() {
576607                < DefaultMain > 
577608                    < Show 
578609                        when = { 
579-                             address ( )  ||  invoice ( )  ||  nodePubkey ( )  ||  lnurlp ( ) 
610+                             address ( )  ||  invoice ( )  ||  offer ( )   ||   nodePubkey ( )  ||  lnurlp ( ) 
580611                        } 
581612                        fallback = { < BackLink  /> } 
582613                    > 
@@ -657,6 +688,7 @@ export default function Send() {
657688                                when = { 
658689                                    address ( )  || 
659690                                    invoice ( )  || 
691+                                     offer ( )  || 
660692                                    nodePubkey ( )  || 
661693                                    lnurlp ( ) 
662694                                } 
@@ -672,6 +704,7 @@ export default function Send() {
672704                                            source = { source ( ) } 
673705                                            description = { description ( ) } 
674706                                            invoice = { invoice ( ) } 
707+                                             offer = { offer ( ) } 
675708                                            address = { address ( ) } 
676709                                            nodePubkey = { nodePubkey ( ) } 
677710                                            lnurl = { lnurlp ( ) } 
@@ -720,6 +753,7 @@ export default function Send() {
720753                            when = { 
721754                                address ( )  || 
722755                                invoice ( )  || 
756+                                 offer ( )  || 
723757                                nodePubkey ( )  || 
724758                                lnurlp ( ) 
725759                            } 
0 commit comments