From 36045b8ac9a30db4d1eb8b2ead4d3fbe729a732b Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 15 Jun 2025 03:38:23 +0200 Subject: [PATCH] Remove unused createInvoice mutation (#2227) --- api/resolvers/wallet.js | 19 ++----------------- api/typeDefs/wallet.js | 1 - 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 1417f890..1deb6ca7 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -5,16 +5,15 @@ import { import crypto, { timingSafeEqual } from 'crypto' import { decodeCursor, LIMIT, nextCursorEncoded } from '@/lib/cursor' import { SELECT, itemQueryWithMeta } from './item' -import { formatMsats, msatsToSats, msatsToSatsDecimal, satsToMsats } from '@/lib/format' +import { formatMsats, msatsToSats, msatsToSatsDecimal } from '@/lib/format' import { USER_ID, INVOICE_RETENTION_DAYS, - PAID_ACTION_PAYMENT_METHODS, WALLET_CREATE_INVOICE_TIMEOUT_MS, WALLET_RETRY_AFTER_MS, WALLET_RETRY_BEFORE_MS, WALLET_MAX_RETRIES } from '@/lib/constants' -import { amountSchema, validateSchema, withdrawlSchema, lnAddrSchema } from '@/lib/validate' +import { validateSchema, withdrawlSchema, lnAddrSchema } from '@/lib/validate' import assertGofacYourself from './ofac' import assertApiKeyNotPermitted from './apiKey' import { bolt11Tags } from '@/lib/bolt11' @@ -475,20 +474,6 @@ const resolvers = { __resolveType: invoiceOrDirect => invoiceOrDirect.__resolveType }, Mutation: { - createInvoice: async (parent, { amount }, { me, models, lnd, headers }) => { - await validateSchema(amountSchema, { amount }) - await assertGofacYourself({ models, headers }) - - const { invoice, paymentMethod } = await performPaidAction('RECEIVE', { - msats: satsToMsats(amount) - }, { models, lnd, me }) - - return { - ...invoice, - __resolveType: - paymentMethod === PAID_ACTION_PAYMENT_METHODS.DIRECT ? 'Direct' : 'Invoice' - } - }, createWithdrawl: createWithdrawal, sendToLnAddr, cancelInvoice: async (parent, { hash, hmac, userCancel }, { me, models, lnd, boss }) => { diff --git a/api/typeDefs/wallet.js b/api/typeDefs/wallet.js index fa8e6a6c..b003ba42 100644 --- a/api/typeDefs/wallet.js +++ b/api/typeDefs/wallet.js @@ -74,7 +74,6 @@ const typeDefs = ` } extend type Mutation { - createInvoice(amount: Int!): InvoiceOrDirect! createWithdrawl(invoice: String!, maxFee: Int!): Withdrawl! sendToLnAddr(addr: String!, amount: Int!, maxFee: Int!, comment: String, identifier: Boolean, name: String, email: String): Withdrawl! cancelInvoice(hash: String!, hmac: String, userCancel: Boolean): Invoice!