From 75051f1c5603bfd7f985b847113e0e7852c1ced2 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Tue, 1 Oct 2024 03:53:24 +0200 Subject: [PATCH 01/24] LNbits updates for local dev * persistent lnbits db with lnbits superuser * map localhost:5001 -> lnbits:5000 in local dev for LNbits receives * updated ATTACH.md --- .gitignore | 3 ++ docker-compose.yml | 4 ++- docker/lnbits/Dockerfile | 5 +++ docker/lnbits/data/.super_user | 1 + docker/lnbits/data/database.sqlite3 | Bin 0 -> 98304 bytes wallets/lnbits/ATTACH.md | 51 +++++++++++++--------------- wallets/lnbits/server.js | 7 +++- 7 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 docker/lnbits/Dockerfile create mode 100644 docker/lnbits/data/.super_user create mode 100644 docker/lnbits/data/database.sqlite3 diff --git a/.gitignore b/.gitignore index b0e257afc..ceb04b515 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ docker-compose.*.yml # nostr wallet connect scripts/nwc-keys.json + +# lnbits +docker/lnbits/data \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b3f3a9b56..baae9a408 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -586,7 +586,8 @@ services: - 'keys-file.json' cpu_shares: "${CPU_SHARES_LOW}" lnbits: - image: lnbits/lnbits:0.12.5 + build: + context: ./docker/lnbits container_name: lnbits profiles: - wallets @@ -596,6 +597,7 @@ services: depends_on: - stacker_lnd environment: + - LNBITS_ADMIN_UI=true - LNBITS_BACKEND_WALLET_CLASS=LndWallet - LND_GRPC_ENDPOINT=stacker_lnd - LND_GRPC_PORT=10009 diff --git a/docker/lnbits/Dockerfile b/docker/lnbits/Dockerfile new file mode 100644 index 000000000..099d7b829 --- /dev/null +++ b/docker/lnbits/Dockerfile @@ -0,0 +1,5 @@ +FROM lnbits/lnbits:0.12.5 + + +COPY ["./data/database.sqlite3", "/app/data/database.sqlite3"] +COPY ["./data/.super_user", "/app/data/.super_user"] \ No newline at end of file diff --git a/docker/lnbits/data/.super_user b/docker/lnbits/data/.super_user new file mode 100644 index 000000000..1d7c4f33b --- /dev/null +++ b/docker/lnbits/data/.super_user @@ -0,0 +1 @@ +e46288268b67457399a5fca81809573e \ No newline at end of file diff --git a/docker/lnbits/data/database.sqlite3 b/docker/lnbits/data/database.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..a8463c7f0d0b51fa623c01e4c3b2fbf93de63506 GIT binary patch literal 98304 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 literal 0 HcmV?d00001 diff --git a/wallets/lnbits/ATTACH.md b/wallets/lnbits/ATTACH.md index b34a213b1..baafa1bf4 100644 --- a/wallets/lnbits/ATTACH.md +++ b/wallets/lnbits/ATTACH.md @@ -1,27 +1,24 @@ -For testing LNbits, you need to create a LNbits account first via the web interface. - -By default, you can access it at `localhost:5001` (see `LNBITS_WEB_PORT` in .env.development). - -After you created a wallet, you should find the invoice and admin key under `Node URL, API keys and API docs`. - -> [!IMPORTANT] -> -> Since your browser is running on your host machine but the server is running inside a docker container, the server will not be able to reach LNbits with `localhost:5001` to create invoices. This makes it hard to test send+receive at the same time. -> -> For now, you need to patch the `_createInvoice` function in wallets/lnbits/server.js to always use `lnbits:5000` as the URL: -> -> ```diff -> diff --git a/wallets/lnbits/server.js b/wallets/lnbits/server.js -> index 39949775..e3605c45 100644 -> --- a/wallets/lnbits/server.js -> +++ b/wallets/lnbits/server.js -> @@ -11,6 +11,7 @@ async function _createInvoice ({ url, invoiceKey, amount, expiry }, { me }) { -> const memo = me.hideInvoiceDesc ? undefined : 'autowithdraw to LNbits from SN' -> const body = JSON.stringify({ amount, unit: 'sat', expiry, memo, out: false }) -> -> + url = 'http://lnbits:5000' -> const res = await fetch(url + path, { method: 'POST', headers, body }) -> if (!res.ok) { -> const errBody = await res.json() -> ``` -> +LNbits' database is seeded with a superuser (see https://docs.lnbits.org/guide/admin_ui.html). + +The following credentials were used: + +- username: `stackernews` +- password: `stackernews` + +To get access to the superuser, you need to visit the admin UI: + +http://localhost:5001/wallet?usr=e46288268b67457399a5fca81809573e + +After that, the cookies will be set to access this wallet: + +http://localhost:5001/wallet?&wal=15ffe06c74cc4082a91f528d016d9028 + +Or simply copy the keys from here: + +* admin key: `640cc7b031eb427c891eeaa4d9c34180` + +* invoice key: `5deed7cd634e4306bb5e696f4a03cdac` + +( These keys can be found under `Node URL, API keys and API docs`. ) + +To use the same URL to connect to LNbits in the browser and server during local development, `localhost:` is mapped to `lnbits:5000` on the server. diff --git a/wallets/lnbits/server.js b/wallets/lnbits/server.js index 23c8ba88c..768990db8 100644 --- a/wallets/lnbits/server.js +++ b/wallets/lnbits/server.js @@ -28,9 +28,14 @@ export async function createInvoice ( out: false }) - const hostname = url.replace(/^https?:\/\//, '') + let hostname = url.replace(/^https?:\/\//, '') const agent = getAgent({ hostname }) + if (process.env.NODE_ENV !== 'production' && hostname.startsWith('localhost:')) { + // to make it possible to attach LNbits for receives during local dev + hostname = 'lnbits:5000' + } + const res = await fetch(`${agent.protocol}//${hostname}${path}`, { method: 'POST', headers, From d91c5c90def087609e041cb9648d46619f40f8f1 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 17 Oct 2024 21:14:04 +0200 Subject: [PATCH 02/24] Fix infinite loop of loading wallet logs --- components/wallet-logger.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/wallet-logger.js b/components/wallet-logger.js index 94eda6567..9414166be 100644 --- a/components/wallet-logger.js +++ b/components/wallet-logger.js @@ -12,10 +12,7 @@ import useIndexedDB from './use-indexeddb' import { SSR } from '@/lib/constants' export function WalletLogs ({ wallet, embedded }) { - const { logs, setLogs, hasMore, loadMore, loadLogs, loading } = useWalletLogs(wallet) - useEffect(() => { - loadLogs() - }, [loadLogs]) + const { logs, setLogs, hasMore, loadMore, loading } = useWalletLogs(wallet) const showModal = useShowModal() @@ -247,5 +244,9 @@ export function useWalletLogs (wallet, initialPage = 1, logsPerPage = 10) { setLoading(false) }, [wallet, loadLogsPage]) + useEffect(() => { + loadLogs() + }, [wallet]) + return { logs, hasMore, total, loadMore, loadLogs, setLogs, loading } } From 70858b97f7303003646708cb3fb8950ca3d4abdc Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 17 Oct 2024 21:22:45 +0200 Subject: [PATCH 03/24] Center more button --- components/wallet-logger.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/wallet-logger.js b/components/wallet-logger.js index 9414166be..6f07cea8a 100644 --- a/components/wallet-logger.js +++ b/components/wallet-logger.js @@ -43,7 +43,7 @@ export function WalletLogs ({ wallet, embedded }) { ?
loading...
: logs.length === 0 &&
empty
} {hasMore - ? + ?
:
------ start of logs ------
} From ab1104e115125abd56edc82eae37c87debb729ce Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 18 Oct 2024 14:19:40 +0200 Subject: [PATCH 04/24] Fix lnaddr withdrawals --- api/lnd/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/lnd/index.js b/api/lnd/index.js index 94264daf2..3e49ce74a 100644 --- a/api/lnd/index.js +++ b/api/lnd/index.js @@ -131,7 +131,7 @@ export const getBlockHeight = cachedFetcher(async function fetchBlockHeight ({ l export const getOurPubkey = cachedFetcher(async function fetchOurPubkey ({ lnd, ...args }) { try { - const { identity } = await getIdentity({ lnd, ...args }) + const identity = await getIdentity({ lnd, ...args }) return identity.public_key } catch (err) { throw new Error(`Unable to fetch identity: ${err.message}`) From 49ddace73f29dab53d1262a7068ab990b3d9e19f Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 18 Oct 2024 15:10:27 +0200 Subject: [PATCH 05/24] Fix first page of wallet logs loaded twice --- components/wallet-logger.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/wallet-logger.js b/components/wallet-logger.js index 6f07cea8a..8855badb4 100644 --- a/components/wallet-logger.js +++ b/components/wallet-logger.js @@ -225,7 +225,7 @@ export function useWalletLogs (wallet, initialPage = 1, logsPerPage = 10) { const loadMore = useCallback(async () => { if (hasMore) { setLoading(true) - const result = await loadLogsPage(page, logsPerPage, wallet) + const result = await loadLogsPage(page + 1, logsPerPage, wallet) setLogs(prevLogs => [...prevLogs, ...result.data]) setHasMore(result.hasMore) setTotal(result.total) From 6cc49e937b89fb3ea5f8d1c76e2cf68b9c662c6b Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 18 Oct 2024 18:57:39 +0200 Subject: [PATCH 06/24] Fix missing autowithdraw settings validation --- lib/validate.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/validate.js b/lib/validate.js index 00215d1ac..9c53047f5 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -726,7 +726,8 @@ export const lnbitsSchema = object().shape({ test: invoiceKey => adminKey !== invoiceKey, message: 'invoice key cannot be the same as admin key' }) - }) + }), + ...autowithdrawSchemaMembers // need to set order to avoid cyclic dependencies in Yup schema // see https://github.com/jquense/yup/issues/176#issuecomment-367352042 }, ['adminKey', 'invoiceKey']) @@ -745,7 +746,8 @@ export const nwcSchema = object().shape({ test: nwcUrlRecv => nwcUrlRecv !== nwcUrl, message: 'connection for receiving cannot be the same as for sending' }) - }) + }), + ...autowithdrawSchemaMembers }, ['nwcUrl', 'nwcUrlRecv']) export const blinkSchema = object({ @@ -796,7 +798,8 @@ export const phoenixdSchema = object().shape({ test: secondary => primary !== secondary, message: 'secondary password cannot be the same as primary password' }) - }) + }), + ...autowithdrawSchemaMembers }, ['primaryPassword', 'secondaryPassword']) export const bioSchema = object({ From bcd8adae4551bee636c3390dc9de94a6577b2b86 Mon Sep 17 00:00:00 2001 From: k00b Date: Fri, 18 Oct 2024 20:20:45 -0500 Subject: [PATCH 07/24] fix interval in sql template --- api/resolvers/wallet.js | 2 +- worker/wallet.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 03945feca..e73da9987 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -482,7 +482,7 @@ const resolvers = { FROM "Withdrawl" WHERE "userId" = ${me.id} AND id = ${Number(id)} - AND now() > created_at + interval '${retention}' + AND now() > created_at + ${retention}::INTERVAL AND hash IS NOT NULL AND status IS NOT NULL ), updated_rows AS ( diff --git a/worker/wallet.js b/worker/wallet.js index 33f6d1a7a..329058e73 100644 --- a/worker/wallet.js +++ b/worker/wallet.js @@ -346,7 +346,7 @@ export async function autoDropBolt11s ({ models, lnd }) { SELECT id, hash, bolt11 FROM "Withdrawl" WHERE "userId" IN (SELECT id FROM users WHERE "autoDropBolt11s") - AND now() > created_at + interval '${retention}' + AND now() > created_at + ${retention}::INTERVAL AND hash IS NOT NULL AND status IS NOT NULL ), updated_rows AS ( From 01580d9ee812f0cb5a1424b62982dad2227c6208 Mon Sep 17 00:00:00 2001 From: k00b Date: Sat, 19 Oct 2024 09:51:24 -0500 Subject: [PATCH 08/24] delete primage when invoice is deleted --- api/resolvers/wallet.js | 4 ++-- worker/wallet.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index e73da9987..daa41ab8f 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -487,7 +487,7 @@ const resolvers = { AND status IS NOT NULL ), updated_rows AS ( UPDATE "Withdrawl" - SET hash = NULL, bolt11 = NULL + SET hash = NULL, bolt11 = NULL, preimage = NULL FROM to_be_updated WHERE "Withdrawl".id = to_be_updated.id) SELECT * FROM to_be_updated;` @@ -499,7 +499,7 @@ const resolvers = { console.error(error) await models.withdrawl.update({ where: { id: invoice.id }, - data: { hash: invoice.hash, bolt11: invoice.bolt11 } + data: { hash: invoice.hash, bolt11: invoice.bolt11, preimage: invoice.preimage } }) throw new GqlInputError('failed to drop bolt11 from lnd') } diff --git a/worker/wallet.js b/worker/wallet.js index 329058e73..57156b9da 100644 --- a/worker/wallet.js +++ b/worker/wallet.js @@ -351,7 +351,7 @@ export async function autoDropBolt11s ({ models, lnd }) { AND status IS NOT NULL ), updated_rows AS ( UPDATE "Withdrawl" - SET hash = NULL, bolt11 = NULL + SET hash = NULL, bolt11 = NULL, preimage = NULL FROM to_be_updated WHERE "Withdrawl".id = to_be_updated.id) SELECT * FROM to_be_updated;` @@ -364,7 +364,7 @@ export async function autoDropBolt11s ({ models, lnd }) { console.error(`Error removing invoice with hash ${invoice.hash}:`, error) await models.withdrawl.update({ where: { id: invoice.id }, - data: { hash: invoice.hash, bolt11: invoice.bolt11 } + data: { hash: invoice.hash, bolt11: invoice.bolt11, preimage: invoice.preimage } }) } } From 69c80e3d5cb8441e071e78a13ea16b1b60e6596e Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 19 Oct 2024 22:33:37 +0200 Subject: [PATCH 09/24] Fix wallet client validation --- wallets/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wallets/index.js b/wallets/index.js index a1349a85e..243a59dd9 100644 --- a/wallets/index.js +++ b/wallets/index.js @@ -125,7 +125,7 @@ function extractConfig (fields, config, client) { const field = fields.find(({ name }) => name === key) // filter server config which isn't specified as wallet fields - if (client && (key.startsWith('autoWithdraw') || key === 'id')) return acc + if (client && key === 'id') return acc // field might not exist because config.enabled doesn't map to a wallet field if (!field || (client ? isClientField(field) : isServerField(field))) { @@ -198,6 +198,9 @@ function useConfig (wallet) { if (transformedConfig) { newClientConfig = Object.assign(newClientConfig, transformedConfig) } + + delete newClientConfig.autoWithdrawMaxFeePercent + delete newClientConfig.autoWithdrawMaxFeeTotal } catch { valid = false } From 1f9ab08228349760cb0715320e7a2e8e8c6ee92d Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 19 Oct 2024 22:36:26 +0200 Subject: [PATCH 10/24] Add comments --- wallets/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wallets/index.js b/wallets/index.js index 243a59dd9..fee177034 100644 --- a/wallets/index.js +++ b/wallets/index.js @@ -125,6 +125,7 @@ function extractConfig (fields, config, client) { const field = fields.find(({ name }) => name === key) // filter server config which isn't specified as wallet fields + // (we allow autowithdraw members to pass validation) if (client && key === 'id') return acc // field might not exist because config.enabled doesn't map to a wallet field @@ -198,7 +199,7 @@ function useConfig (wallet) { if (transformedConfig) { newClientConfig = Object.assign(newClientConfig, transformedConfig) } - + // these are stored on the server delete newClientConfig.autoWithdrawMaxFeePercent delete newClientConfig.autoWithdrawMaxFeeTotal } catch { From 50e153df7cf2699c9107c8134935e3a09a3ef972 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 20 Oct 2024 01:25:25 +0200 Subject: [PATCH 11/24] Fix territory unarchive schema validation --- api/resolvers/sub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/resolvers/sub.js b/api/resolvers/sub.js index 1f49e3536..092798698 100644 --- a/api/resolvers/sub.js +++ b/api/resolvers/sub.js @@ -260,7 +260,7 @@ export default { const { name } = data - await ssValidate(territorySchema, data, { models, me, sub: { name } }) + await ssValidate(territorySchema, data, { models, me }) const oldSub = await models.sub.findUnique({ where: { name } }) if (!oldSub) { From 596d67fc68363ccea233f39016271e908f47d97d Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 18 Oct 2024 18:15:53 +0200 Subject: [PATCH 12/24] Add max base fee setting --- api/resolvers/wallet.js | 11 +++++++-- api/typeDefs/user.js | 1 + api/typeDefs/wallet.js | 1 + components/autowithdraw-shared.js | 23 +++++++++++++++++-- fragments/users.js | 1 + lib/validate.js | 3 ++- .../20241018160708_max_base_fee/migration.sql | 8 +++++++ prisma/schema.prisma | 1 + wallets/index.js | 2 ++ worker/autowithdraw.js | 10 ++++++-- 10 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 prisma/migrations/20241018160708_max_base_fee/migration.sql diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index daa41ab8f..296516a9d 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -647,14 +647,21 @@ async function upsertWallet ( } const { id, ...walletData } = data - const { autoWithdrawThreshold, autoWithdrawMaxFeePercent, enabled, priority } = settings + const { + autoWithdrawThreshold, + autoWithdrawMaxFeePercent, + autoWithdrawMaxBaseFee, + enabled, + priority + } = settings const txs = [ models.user.update({ where: { id: me.id }, data: { autoWithdrawMaxFeePercent, - autoWithdrawThreshold + autoWithdrawThreshold, + autoWithdrawMaxBaseFee } }) ] diff --git a/api/typeDefs/user.js b/api/typeDefs/user.js index 0f208951a..39f417a86 100644 --- a/api/typeDefs/user.js +++ b/api/typeDefs/user.js @@ -182,6 +182,7 @@ export default gql` withdrawMaxFeeDefault: Int! autoWithdrawThreshold: Int autoWithdrawMaxFeePercent: Float + autoWithdrawMaxBaseFee: Int } type UserOptional { diff --git a/api/typeDefs/wallet.js b/api/typeDefs/wallet.js index d87af0e06..12e5e4be9 100644 --- a/api/typeDefs/wallet.js +++ b/api/typeDefs/wallet.js @@ -91,6 +91,7 @@ const typeDefs = ` input AutowithdrawSettings { autoWithdrawThreshold: Int! autoWithdrawMaxFeePercent: Float! + autoWithdrawMaxBaseFee: Int! priority: Int enabled: Boolean } diff --git a/components/autowithdraw-shared.js b/components/autowithdraw-shared.js index de8323f74..cc02b4b14 100644 --- a/components/autowithdraw-shared.js +++ b/components/autowithdraw-shared.js @@ -4,6 +4,7 @@ import { useMe } from './me' import { useEffect, useState } from 'react' import { isNumber } from '@/lib/validate' import { useIsClient } from './use-client' +import Link from 'next/link' function autoWithdrawThreshold ({ me }) { return isNumber(me?.privates?.autoWithdrawThreshold) ? me?.privates?.autoWithdrawThreshold : 10000 @@ -12,7 +13,8 @@ function autoWithdrawThreshold ({ me }) { export function autowithdrawInitial ({ me }) { return { autoWithdrawThreshold: autoWithdrawThreshold({ me }), - autoWithdrawMaxFeePercent: isNumber(me?.privates?.autoWithdrawMaxFeePercent) ? me?.privates?.autoWithdrawMaxFeePercent : 1 + autoWithdrawMaxFeePercent: isNumber(me?.privates?.autoWithdrawMaxFeePercent) ? me?.privates?.autoWithdrawMaxFeePercent : 1, + autoWithdrawMaxBaseFee: isNumber(me?.privates?.autoWithdrawMaxBaseFee) ? me?.privates?.autoWithdrawMaxBaseFee : 1 } } @@ -51,13 +53,30 @@ export function AutowithdrawSettings ({ wallet }) { append={sats} required /> +

network fees

+
+ the setting that allows a higher max fee will be used during{' '} + pathfinding + +
%} required /> + sats} + required + /> diff --git a/fragments/users.js b/fragments/users.js index 26d92144e..11d592d83 100644 --- a/fragments/users.js +++ b/fragments/users.js @@ -27,6 +27,7 @@ ${STREAK_FIELDS} noReferralLinks fiatCurrency autoWithdrawMaxFeePercent + autoWithdrawMaxBaseFee autoWithdrawThreshold withdrawMaxFeeDefault satsFilter diff --git a/lib/validate.js b/lib/validate.js index 9c53047f5..02705088b 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -366,7 +366,8 @@ export function advSchema (args) { export const autowithdrawSchemaMembers = { enabled: boolean(), autoWithdrawThreshold: intValidator.required('required').min(0, 'must be at least 0').max(msatsToSats(BALANCE_LIMIT_MSATS), `must be at most ${abbrNum(msatsToSats(BALANCE_LIMIT_MSATS))}`), - autoWithdrawMaxFeePercent: floatValidator.required('required').min(0, 'must be at least 0').max(50, 'must not exceed 50') + autoWithdrawMaxFeePercent: floatValidator.required('required').min(0, 'must be at least 0').max(50, 'must not exceed 50'), + autoWithdrawMaxBaseFee: intValidator.required('required').min(0, 'must be at least 0').max(1_000, 'must not exceed 1000') } export const lnAddrAutowithdrawSchema = object({ diff --git a/prisma/migrations/20241018160708_max_base_fee/migration.sql b/prisma/migrations/20241018160708_max_base_fee/migration.sql new file mode 100644 index 000000000..233811260 --- /dev/null +++ b/prisma/migrations/20241018160708_max_base_fee/migration.sql @@ -0,0 +1,8 @@ +-- AlterTable +ALTER TABLE "users" ADD COLUMN "autoWithdrawMaxBaseFee" INTEGER; + +-- set max_base_fee for users with autowithdrawals enabled to not interfere with them. +-- we set it to 0 instead of 1 because that preserves old behavior. +UPDATE "users" +SET "autoWithdrawMaxBaseFee" = 0 +WHERE "autoWithdrawMaxFeePercent" IS NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 7a629e444..cb3162e2c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -118,6 +118,7 @@ model User { lnAddr String? autoWithdrawMaxFeePercent Float? autoWithdrawThreshold Int? + autoWithdrawMaxBaseFee Int? muters Mute[] @relation("muter") muteds Mute[] @relation("muted") ArcOut Arc[] @relation("fromUser") diff --git a/wallets/index.js b/wallets/index.js index fee177034..0333becd5 100644 --- a/wallets/index.js +++ b/wallets/index.js @@ -296,6 +296,7 @@ function useServerConfig (wallet) { const saveConfig = useCallback(async ({ autoWithdrawThreshold, autoWithdrawMaxFeePercent, + autoWithdrawMaxBaseFee, priority, enabled, ...config @@ -310,6 +311,7 @@ function useServerConfig (wallet) { settings: { autoWithdrawThreshold: Number(autoWithdrawThreshold), autoWithdrawMaxFeePercent: Number(autoWithdrawMaxFeePercent), + autoWithdrawMaxBaseFee: Number(autoWithdrawMaxBaseFee), priority, enabled }, diff --git a/worker/autowithdraw.js b/worker/autowithdraw.js index ef8d49e35..0589159ae 100644 --- a/worker/autowithdraw.js +++ b/worker/autowithdraw.js @@ -4,7 +4,10 @@ import { createInvoice } from 'wallets/server' export async function autoWithdraw ({ data: { id }, models, lnd }) { const user = await models.user.findUnique({ where: { id } }) - if (user.autoWithdrawThreshold === null || user.autoWithdrawMaxFeePercent === null) return + if ( + user.autoWithdrawThreshold === null || + user.autoWithdrawMaxFeePercent === null || + user.autoWithdrawMaxBaseFee === null) return const threshold = satsToMsats(user.autoWithdrawThreshold) const excess = Number(user.msats - threshold) @@ -13,7 +16,10 @@ export async function autoWithdraw ({ data: { id }, models, lnd }) { if (excess < Number(threshold) * 0.1) return // floor fee to nearest sat but still denominated in msats - const maxFeeMsats = msatsSatsFloor(Math.ceil(excess * (user.autoWithdrawMaxFeePercent / 100.0))) + const maxFeeMsats = msatsSatsFloor(Math.max( + Math.ceil(excess * (user.autoWithdrawMaxFeePercent / 100.0)), + Number(satsToMsats(user.autoWithdrawMaxBaseFee)) + )) // msats will be floored by createInvoice if it needs to be const msats = BigInt(excess) - maxFeeMsats From d06f89d7078160dd2c07041f19398da6da466c06 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 19 Oct 2024 16:20:12 +0200 Subject: [PATCH 13/24] Change text --- components/autowithdraw-shared.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/autowithdraw-shared.js b/components/autowithdraw-shared.js index cc02b4b14..62c62bcde 100644 --- a/components/autowithdraw-shared.js +++ b/components/autowithdraw-shared.js @@ -55,7 +55,7 @@ export function AutowithdrawSettings ({ wallet }) { />

network fees

- the setting that allows a higher max fee will be used during{' '} + we'll use whichever setting is higher during{' '} sats} From c97ce2627b93c77095b91430a3649f515c359bef Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 19 Oct 2024 16:21:50 +0200 Subject: [PATCH 14/24] Rename to autoWithdrawMaxFeeTotal --- api/resolvers/wallet.js | 4 ++-- api/typeDefs/user.js | 2 +- api/typeDefs/wallet.js | 2 +- components/autowithdraw-shared.js | 4 ++-- fragments/users.js | 2 +- lib/validate.js | 2 +- .../migrations/20241018160708_max_base_fee/migration.sql | 8 -------- .../migrations/20241018160708_max_fee_total/migration.sql | 8 ++++++++ prisma/schema.prisma | 2 +- wallets/index.js | 4 ++-- worker/autowithdraw.js | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 prisma/migrations/20241018160708_max_base_fee/migration.sql create mode 100644 prisma/migrations/20241018160708_max_fee_total/migration.sql diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 296516a9d..ee1677aa5 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -650,7 +650,7 @@ async function upsertWallet ( const { autoWithdrawThreshold, autoWithdrawMaxFeePercent, - autoWithdrawMaxBaseFee, + autoWithdrawMaxFeeTotal, enabled, priority } = settings @@ -661,7 +661,7 @@ async function upsertWallet ( data: { autoWithdrawMaxFeePercent, autoWithdrawThreshold, - autoWithdrawMaxBaseFee + autoWithdrawMaxFeeTotal } }) ] diff --git a/api/typeDefs/user.js b/api/typeDefs/user.js index 39f417a86..4f987cd54 100644 --- a/api/typeDefs/user.js +++ b/api/typeDefs/user.js @@ -182,7 +182,7 @@ export default gql` withdrawMaxFeeDefault: Int! autoWithdrawThreshold: Int autoWithdrawMaxFeePercent: Float - autoWithdrawMaxBaseFee: Int + autoWithdrawMaxFeeTotal: Int } type UserOptional { diff --git a/api/typeDefs/wallet.js b/api/typeDefs/wallet.js index 12e5e4be9..cdd47a3c7 100644 --- a/api/typeDefs/wallet.js +++ b/api/typeDefs/wallet.js @@ -91,7 +91,7 @@ const typeDefs = ` input AutowithdrawSettings { autoWithdrawThreshold: Int! autoWithdrawMaxFeePercent: Float! - autoWithdrawMaxBaseFee: Int! + autoWithdrawMaxFeeTotal: Int! priority: Int enabled: Boolean } diff --git a/components/autowithdraw-shared.js b/components/autowithdraw-shared.js index 62c62bcde..27917ed91 100644 --- a/components/autowithdraw-shared.js +++ b/components/autowithdraw-shared.js @@ -14,7 +14,7 @@ export function autowithdrawInitial ({ me }) { return { autoWithdrawThreshold: autoWithdrawThreshold({ me }), autoWithdrawMaxFeePercent: isNumber(me?.privates?.autoWithdrawMaxFeePercent) ? me?.privates?.autoWithdrawMaxFeePercent : 1, - autoWithdrawMaxBaseFee: isNumber(me?.privates?.autoWithdrawMaxBaseFee) ? me?.privates?.autoWithdrawMaxBaseFee : 1 + autoWithdrawMaxFeeTotal: isNumber(me?.privates?.autoWithdrawMaxFeeTotal) ? me?.privates?.autoWithdrawMaxFeeTotal : 1 } } @@ -72,7 +72,7 @@ export function AutowithdrawSettings ({ wallet }) { /> sats} required diff --git a/fragments/users.js b/fragments/users.js index 11d592d83..16a703ce8 100644 --- a/fragments/users.js +++ b/fragments/users.js @@ -27,7 +27,7 @@ ${STREAK_FIELDS} noReferralLinks fiatCurrency autoWithdrawMaxFeePercent - autoWithdrawMaxBaseFee + autoWithdrawMaxFeeTotal autoWithdrawThreshold withdrawMaxFeeDefault satsFilter diff --git a/lib/validate.js b/lib/validate.js index 02705088b..f8fd24d97 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -367,7 +367,7 @@ export const autowithdrawSchemaMembers = { enabled: boolean(), autoWithdrawThreshold: intValidator.required('required').min(0, 'must be at least 0').max(msatsToSats(BALANCE_LIMIT_MSATS), `must be at most ${abbrNum(msatsToSats(BALANCE_LIMIT_MSATS))}`), autoWithdrawMaxFeePercent: floatValidator.required('required').min(0, 'must be at least 0').max(50, 'must not exceed 50'), - autoWithdrawMaxBaseFee: intValidator.required('required').min(0, 'must be at least 0').max(1_000, 'must not exceed 1000') + autoWithdrawMaxFeeTotal: intValidator.required('required').min(0, 'must be at least 0').max(1_000, 'must not exceed 1000') } export const lnAddrAutowithdrawSchema = object({ diff --git a/prisma/migrations/20241018160708_max_base_fee/migration.sql b/prisma/migrations/20241018160708_max_base_fee/migration.sql deleted file mode 100644 index 233811260..000000000 --- a/prisma/migrations/20241018160708_max_base_fee/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- AlterTable -ALTER TABLE "users" ADD COLUMN "autoWithdrawMaxBaseFee" INTEGER; - --- set max_base_fee for users with autowithdrawals enabled to not interfere with them. --- we set it to 0 instead of 1 because that preserves old behavior. -UPDATE "users" -SET "autoWithdrawMaxBaseFee" = 0 -WHERE "autoWithdrawMaxFeePercent" IS NOT NULL; diff --git a/prisma/migrations/20241018160708_max_fee_total/migration.sql b/prisma/migrations/20241018160708_max_fee_total/migration.sql new file mode 100644 index 000000000..0533ff9bd --- /dev/null +++ b/prisma/migrations/20241018160708_max_fee_total/migration.sql @@ -0,0 +1,8 @@ +-- AlterTable +ALTER TABLE "users" ADD COLUMN "autoWithdrawMaxFeeTotal" INTEGER; + +-- set max total fee for users with autowithdrawals enabled to not interfere with them. +-- we set it to 0 instead of 1 because that preserves old behavior. +UPDATE "users" +SET "autoWithdrawMaxFeeTotal" = 0 +WHERE "autoWithdrawMaxFeePercent" IS NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index cb3162e2c..ee6e18049 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -118,7 +118,7 @@ model User { lnAddr String? autoWithdrawMaxFeePercent Float? autoWithdrawThreshold Int? - autoWithdrawMaxBaseFee Int? + autoWithdrawMaxFeeTotal Int? muters Mute[] @relation("muter") muteds Mute[] @relation("muted") ArcOut Arc[] @relation("fromUser") diff --git a/wallets/index.js b/wallets/index.js index 0333becd5..c403677f9 100644 --- a/wallets/index.js +++ b/wallets/index.js @@ -296,7 +296,7 @@ function useServerConfig (wallet) { const saveConfig = useCallback(async ({ autoWithdrawThreshold, autoWithdrawMaxFeePercent, - autoWithdrawMaxBaseFee, + autoWithdrawMaxFeeTotal, priority, enabled, ...config @@ -311,7 +311,7 @@ function useServerConfig (wallet) { settings: { autoWithdrawThreshold: Number(autoWithdrawThreshold), autoWithdrawMaxFeePercent: Number(autoWithdrawMaxFeePercent), - autoWithdrawMaxBaseFee: Number(autoWithdrawMaxBaseFee), + autoWithdrawMaxFeeTotal: Number(autoWithdrawMaxFeeTotal), priority, enabled }, diff --git a/worker/autowithdraw.js b/worker/autowithdraw.js index 0589159ae..046115994 100644 --- a/worker/autowithdraw.js +++ b/worker/autowithdraw.js @@ -7,7 +7,7 @@ export async function autoWithdraw ({ data: { id }, models, lnd }) { if ( user.autoWithdrawThreshold === null || user.autoWithdrawMaxFeePercent === null || - user.autoWithdrawMaxBaseFee === null) return + user.autoWithdrawMaxFeeTotal === null) return const threshold = satsToMsats(user.autoWithdrawThreshold) const excess = Number(user.msats - threshold) @@ -18,7 +18,7 @@ export async function autoWithdraw ({ data: { id }, models, lnd }) { // floor fee to nearest sat but still denominated in msats const maxFeeMsats = msatsSatsFloor(Math.max( Math.ceil(excess * (user.autoWithdrawMaxFeePercent / 100.0)), - Number(satsToMsats(user.autoWithdrawMaxBaseFee)) + Number(satsToMsats(user.autoWithdrawMaxFeeTotal)) )) // msats will be floored by createInvoice if it needs to be const msats = BigInt(excess) - maxFeeMsats From 88fa3bdca6ebcdbf6944b357a017be17afe99fca Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 20 Oct 2024 15:19:53 +0200 Subject: [PATCH 15/24] Fix autoWithdrawThreshold saved in send config --- wallets/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/wallets/index.js b/wallets/index.js index c403677f9..459b04b2d 100644 --- a/wallets/index.js +++ b/wallets/index.js @@ -201,6 +201,7 @@ function useConfig (wallet) { } // these are stored on the server delete newClientConfig.autoWithdrawMaxFeePercent + delete newClientConfig.autoWithdrawThreshold delete newClientConfig.autoWithdrawMaxFeeTotal } catch { valid = false From fd9b087c99b73bb0ad75333f49830fb9feec9c66 Mon Sep 17 00:00:00 2001 From: Keyan <34140557+huumn@users.noreply.github.com> Date: Sun, 20 Oct 2024 18:06:28 -0500 Subject: [PATCH 16/24] Update awards.csv --- awards.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/awards.csv b/awards.csv index 4a95691e7..93170b3ef 100644 --- a/awards.csv +++ b/awards.csv @@ -135,3 +135,5 @@ toyota-corolla0,pr,#1449,,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2 toyota-corolla0,pr,#1455,#1437,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2024-10-02 SouthKoreaLN,issue,#1436,,easy,,,,10k,south_korea_ln@stacker.news,2024-10-02 TonyGiorgio,issue,#1462,,easy,urgent,,,30k,TonyGiorgio@stacker.news,2024-10-07 +hkarani,issue,#1369,#1458,good-first-issue,,,,2k,???,??? +toyota-corolla0,pr,#1369,#1458,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2024-10-20 From 31d3b2fd76344f23acc14b723f1eeb11ae2571fe Mon Sep 17 00:00:00 2001 From: Keyan <34140557+huumn@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:26:03 -0500 Subject: [PATCH 17/24] Update awards.csv --- awards.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awards.csv b/awards.csv index 93170b3ef..31b493430 100644 --- a/awards.csv +++ b/awards.csv @@ -135,5 +135,5 @@ toyota-corolla0,pr,#1449,,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2 toyota-corolla0,pr,#1455,#1437,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2024-10-02 SouthKoreaLN,issue,#1436,,easy,,,,10k,south_korea_ln@stacker.news,2024-10-02 TonyGiorgio,issue,#1462,,easy,urgent,,,30k,TonyGiorgio@stacker.news,2024-10-07 -hkarani,issue,#1369,#1458,good-first-issue,,,,2k,???,??? +hkarani,issue,#1369,#1458,good-first-issue,,,,2k,asterisk32@stacker.news,2024-10-21 toyota-corolla0,pr,#1369,#1458,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2024-10-20 From 820ea90267d742f8459f899de007cf21100a8aaf Mon Sep 17 00:00:00 2001 From: k00b Date: Mon, 21 Oct 2024 14:52:33 -0500 Subject: [PATCH 18/24] bump secp256k1 --- package-lock.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33f661966..9d391222e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7057,9 +7057,9 @@ } }, "node_modules/bitcore-lib": { - "version": "8.25.40", - "resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.40.tgz", - "integrity": "sha512-mb6kvfhoiIdoyFsDlhIFVst3HpeGjGYBf0XDxTdZ+H07EC4JuiViA3bnQ5uZbZjHFngEl0GTPaoK1Zaolutw4A==", + "version": "8.25.47", + "resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.47.tgz", + "integrity": "sha512-qDZr42HuP4P02I8kMGZUx/vvwuDsz8X3rQxXLfM0BtKzlQBcbSM7ycDkDN99Xc5jzpd4fxNQyyFXOmc6owUsrQ==", "dependencies": { "bech32": "=2.0.0", "bip-schnorr": "=0.6.4", @@ -15626,9 +15626,9 @@ "integrity": "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==" }, "node_modules/node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" }, "node_modules/node-fetch": { "version": "2.7.0", @@ -18038,17 +18038,17 @@ "integrity": "sha512-d7wDPgDV3DDiqulJjKiV2865wKsJ34YI+NDREbm+FySq6WuKOikwyNQcm+doLAZ1O6ltdO0SeKle2xMpN3Brgw==" }, "node_modules/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.4.tgz", + "integrity": "sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw==", "hasInstallScript": true, "dependencies": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", + "elliptic": "^6.5.7", + "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=18.0.0" } }, "node_modules/secure-json-parse": { From 9987921692efb138e2f59069326a672e8dfd3258 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 24 Oct 2024 22:21:30 +0200 Subject: [PATCH 19/24] Use Github form templates for issues --- .github/ISSUE_TEMPLATE/bug_report.md | 35 ------------ .github/ISSUE_TEMPLATE/bug_report.yml | 65 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 ++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ------- .github/ISSUE_TEMPLATE/feature_request.yml | 32 +++++++++++ 5 files changed, 102 insertions(+), 55 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index d7c4f8be3..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Bug report -about: Report a problem -title: '' -labels: bug -assignees: '' - ---- - -*Note: this template is meant to help you report the bug so that we can fix it faster, ie not all of these sections are required* - -**Description** -A clear and concise description of what the bug is. - -**Steps to Reproduce** -A clear and concise way we might be able to reproduce the bug. - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Logs** -If applicable, add your browsers console logs. - -**Environment:** -If you only experience the issue on certain devices or browsers, provide that info. - - Device: [e.g. iPhone6] - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..49b43c194 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,65 @@ +name: 🐞 Bug report +description: Create a bug report to help us fix it +title: "" +labels: [bug] +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. Include images if relevant. + placeholder: I accidentally deleted the internet. Here's my story ... + validations: + required: true + - type: textarea + attributes: + label: Screenshots + description: | + Add screenshots to help explain your problem. You can also add a video here. + + Tip: You can attach images or video files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the bug. + placeholder: | + 1. Go to '...' + 2. Click on '...' + 3. Scroll to '...' + 4. See error + validations: + required: true + - type: textarea + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen + validations: + required: true + - type: textarea + attributes: + label: Logs + description: If applicable, add your browser's console logs here + - type: textarea + attributes: + label: Device information + placeholder: | + - OS: [e.g. Windows] + - Browser: [e.g. chrome, safari, firefox] + - Browser Version: [e.g. 22] + validations: + required: false + - type: textarea + attributes: + label: Additional context + description: | + Do you have links to discussions about this on SN or other references? + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..075e285ba --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Questions + url: https://stacker.news/~meta + about: If you simply have a question, you can ask it in ~meta or the saloon. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index ba14c6103..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest a feature -title: '' -labels: feature -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..6626f9069 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,32 @@ +name: ✨ Feature request +description: Request a feature you'd like to see in SN! +title: "" +labels: [feature] +body: + - type: markdown + attributes: + value: | + We're always looking for suggestions on how we could improve SN! + - type: textarea + attributes: + label: 'Describe the problem you're trying to solve' + description: | + Is your feature request related to a problem? Add a clear and concise description of what the problem is. + validations: + required: true + - type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: | + A clear and concise description of any alternative solutions or features you have considered. + - type: textarea + attributes: + label: Additional context + description: | + Add any other additional context or screenshots about the feature request here. From 3fa4037197d58a230de70f753196f9c0856fc649 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 24 Oct 2024 22:28:51 +0200 Subject: [PATCH 20/24] More concise pull request template --- .github/pull_request_template.md | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 309e2e772..e46d30f1a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,45 +1,22 @@ ## Description - +_A clear and concise description of what you changed and why._ ## Screenshots - - ## Additional Context - +_Was anything unclear during your work on this PR? Anything we should definitely take a closer look at?_ ## Checklist **Are your changes backwards compatible? Please answer below:** - - **On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:** - **For frontend changes: Tested on mobile? Please answer below:** - **Did you introduce any new environment variables? If so, call them out explicitly here:** - - From 687b9c343c08096c3f1afbf4c596910144809bcd Mon Sep 17 00:00:00 2001 From: Keyan <34140557+huumn@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:38:30 -0500 Subject: [PATCH 21/24] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 49b43c194..d05bbe6fc 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,6 @@ name: 🐞 Bug report description: Create a bug report to help us fix it -title: "" +title: "bug report" labels: [bug] body: - type: checkboxes From be6bcd77369d097cbae8f7890d58e646741abe8d Mon Sep 17 00:00:00 2001 From: Keyan <34140557+huumn@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:39:12 -0500 Subject: [PATCH 22/24] Update feature_request.yml --- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 6626f9069..73831daee 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,6 +1,6 @@ name: ✨ Feature request description: Request a feature you'd like to see in SN! -title: "" +title: "feature request" labels: [feature] body: - type: markdown From 6c16b5eff31d526b3f97653caa3e7d1785677879 Mon Sep 17 00:00:00 2001 From: Keyan <34140557+huumn@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:39:54 -0500 Subject: [PATCH 23/24] Update feature_request.yml --- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 73831daee..0c4c5a531 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -9,7 +9,7 @@ body: We're always looking for suggestions on how we could improve SN! - type: textarea attributes: - label: 'Describe the problem you're trying to solve' + label: Describe the problem you're trying to solve description: | Is your feature request related to a problem? Add a clear and concise description of what the problem is. validations: From 6fa747b234363090fdfe33dbd8ec81824764d416 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 25 Oct 2024 14:10:41 +0200 Subject: [PATCH 24/24] Fix missing fragmentName --- pages/invites/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/invites/index.js b/pages/invites/index.js index b00c03d73..37c71b136 100644 --- a/pages/invites/index.js +++ b/pages/invites/index.js @@ -27,6 +27,7 @@ function InviteForm () { fields: { invites (existingInviteRefs = []) { const newInviteRef = cache.writeFragment({ + fragmentName: 'InviteFields', data: createInvite, fragment: INVITE_FIELDS })