diff options
Diffstat (limited to 'lib/utils.js')
| -rw-r--r-- | lib/utils.js | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/lib/utils.js b/lib/utils.js index 559f8531..b556c46a 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,7 +1,6 @@ import store from "$lib/store"; import { g } from "$lib/redis"; import config from "$config"; -import ln from "$lib/ln"; export const nada = () => {}; @@ -18,15 +17,6 @@ export const requirePin = async ({ body, user }) => { throw new Error("Invalid pin"); }; -export const getUser = async (uuid) => { - let user = g(`user:${uuid}`); - if (!user) throw new Error("user not found"); - - user.haspin = !!user.pin; - - return user; -}; - export const prod = process.env.NODE_ENV === "production"; export const fail = msg => { throw new Error(msg); @@ -35,14 +25,5 @@ export const fail = msg => { export const SATS = 100000000; export const toSats = n => Math.round(n * SATS); -export const derivePayRequest = async ({ amount, memo, tip }) => { - if (!tip) tip = 0; - let value = amount + tip; - - if (!memo) memo = "coinos"; - return ( - await ln.invoice(value ? `${value}sat` : "any", new Date(), memo, 360) - ).bolt11; -}; - export const uniq = (a, k) => [...new Map(a.map(x => [k(x), x])).values()]; +export const pick = (O, K) => K.reduce((o, k) => ((o[k] = O[k]), o), {}); |
