import * as lightningPayReq from "bolt11" ; export const getUsername = ( decoded ) : lightningPayReq . TagData => decoded . tags . find ( ( value ) => value . tagName === "username" ) ?. data ; export const getDescription = ( decoded ) : lightningPayReq . TagData => decoded . tags . find ( ( value ) => value . tagName === "description" ) ?. data ; export const getDestination = ( decoded ) : string => decoded . payeeNodeKey ; export const getHashFromInvoice = ( invoice ) : lightningPayReq . TagData => { const decoded = lightningPayReq . decode ( invoice ) ; return decoded . tags . find ( ( value ) => value . tagName === "payment_hash" ) ?. data ; } ;