From 86239a235d2abd49d3fdf89dd054bb47b53d7ba7 Mon Sep 17 00:00:00 2001 From: keyan Date: Fri, 11 Aug 2023 18:10:46 -0500 Subject: [PATCH] make invoice expiration times have saner defaults --- api/resolvers/wallet.js | 4 ++-- api/typeDefs/wallet.js | 2 +- components/invoice.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index e48b3b5e..e3b82d03 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -207,10 +207,10 @@ export default { }, Mutation: { - createInvoice: async (parent, { amount }, { me, models, lnd }) => { + createInvoice: async (parent, { amount, expireSecs = 3600 }, { me, models, lnd }) => { await ssValidate(amountSchema, { amount }) - let expirePivot = { hours: 3 } + let expirePivot = { seconds: expireSecs } let invLimit = INV_PENDING_LIMIT let balanceLimit = BALANCE_LIMIT_MSATS let id = me?.id diff --git a/api/typeDefs/wallet.js b/api/typeDefs/wallet.js index 3328bc90..6eefe999 100644 --- a/api/typeDefs/wallet.js +++ b/api/typeDefs/wallet.js @@ -9,7 +9,7 @@ export default gql` } extend type Mutation { - createInvoice(amount: Int!): Invoice! + createInvoice(amount: Int!, expireSecs: Int): Invoice! createWithdrawl(invoice: String!, maxFee: Int!): Withdrawl! sendToLnAddr(addr: String!, amount: Int!, maxFee: Int!): Withdrawl! } diff --git a/components/invoice.js b/components/invoice.js index bfd9095c..4dbcec1a 100644 --- a/components/invoice.js +++ b/components/invoice.js @@ -151,7 +151,7 @@ export const useInvoiceable = (fn, options = defaultOptions) => { const me = useMe() const [createInvoice, { data }] = useMutation(gql` mutation createInvoice($amount: Int!) { - createInvoice(amount: $amount) { + createInvoice(amount: $amount, expireSecs: 1800) { id hash hmac