If you're looking to get the lightning address of a given npub you can query nostr relays for "kind 0" events for that pubkey. kind 0 events contain the profile metadata for a given pubkey including their username, avatar, etc. It may also have a "lud16" field with their lightning address, but it's an optional field.