From cb272477247582355d38bc6c47b1795801689a55 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 1 Oct 2022 15:28:35 -0700 Subject: send lightning endpoint --- src/lib/parse.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/lib') diff --git a/src/lib/parse.js b/src/lib/parse.js index e503a723..95d0a8b6 100644 --- a/src/lib/parse.js +++ b/src/lib/parse.js @@ -5,27 +5,25 @@ import { get } from '$lib/utils'; import { goto } from '$app/navigation'; let debounce; -export default async (text) => { - if (!text) return; +export default async (t) => { + if (!t) return; console.log('parsing'); // lightning - if (text.startsWith('ln')) { - try { - console.log('lightning'); - } catch (e) {} + if (t.startsWith('ln')) { + goto(`/send/lightning/${t}`); } // bitcoin - if (validate(text)) { + if (validate(t)) { console.log('bitcoin'); - goto(`/send/bitcoin/${text}`); + goto(`/send/bitcoin/${t}`); } // ln address - if (text.includes('@') && text.includes('.')) { + if (t.includes('@') && t.includes('.')) { console.log('ln address'); - let [name, domain] = text.split('@'); + let [name, domain] = t.split('@'); try { clearTimeout(debounce); await new Promise((r) => (debounce = setTimeout(r, 1500))); -- cgit v1.2.3