From 02472bb81fddbbe605366f2c013fbca1131a1306 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 8 Jul 2024 16:07:35 +0200 Subject: [PATCH 01/24] Fix missing stackedMsats update + wrong sybil fee (#1256) * Fix 'stackedMsats' not updated * Fix 1% fee instead of 10% --- api/paidAction/zap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/paidAction/zap.js b/api/paidAction/zap.js index f5c9c169..6dc3cc90 100644 --- a/api/paidAction/zap.js +++ b/api/paidAction/zap.js @@ -11,7 +11,7 @@ export async function getCost ({ sats }) { } export async function perform ({ invoiceId, sats, id: itemId, ...args }, { me, cost, tx }) { - const feeMsats = cost / BigInt(100) + const feeMsats = cost / BigInt(10) // 10% fee const zapMsats = cost - feeMsats itemId = parseInt(itemId) @@ -84,7 +84,9 @@ export async function onPaid ({ invoice, actIds }, { models, tx }) { WHERE users.id = forwardees."userId" ) UPDATE users - SET msats = msats + ${itemAct.msats}::BIGINT - (SELECT msats FROM total_forwarded)::BIGINT + SET + msats = msats + ${itemAct.msats}::BIGINT - (SELECT msats FROM total_forwarded)::BIGINT, + "stackedMsats" = "stackedMsats" + ${itemAct.msats}::BIGINT - (SELECT msats FROM total_forwarded)::BIGINT WHERE id = ${itemAct.item.userId}::INTEGER` // perform denomormalized aggregates: weighted votes, upvotes, msats, lastZapAt From 0312012089fb4417bfbf9ba11a6676c0a37c63b4 Mon Sep 17 00:00:00 2001 From: keyan Date: Mon, 8 Jul 2024 09:35:29 -0500 Subject: [PATCH 02/24] make sure stackedMsats is updated for forwardees --- api/paidAction/zap.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/paidAction/zap.js b/api/paidAction/zap.js index 6dc3cc90..40dce138 100644 --- a/api/paidAction/zap.js +++ b/api/paidAction/zap.js @@ -79,7 +79,9 @@ export async function onPaid ({ invoice, actIds }, { models, tx }) { FROM forwardees ), forward AS ( UPDATE users - SET msats = users.msats + forwardees.msats + SET + msats = users.msats + forwardees.msats, + "stackedMsats" = users."stackedMsats" + forwardees.msats FROM forwardees WHERE users.id = forwardees."userId" ) From e0f91ace41bc2077761bd6708e46ea344ef023ac Mon Sep 17 00:00:00 2001 From: keyan Date: Mon, 8 Jul 2024 16:10:19 -0500 Subject: [PATCH 03/24] prevent lnc-web's wasm loading side effects from breaking everything --- components/webln/lnc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/webln/lnc.js b/components/webln/lnc.js index 6d21415a..58aac5ab 100644 --- a/components/webln/lnc.js +++ b/components/webln/lnc.js @@ -1,6 +1,5 @@ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react' import { useWalletLogger } from '../logger' -import LNC from '@lightninglabs/lnc-web' import { Status, migrateLocalStorage } from '.' import { bolt11Tags } from '@/lib/bolt11' import useModal from '../modal' @@ -16,6 +15,7 @@ const mutex = new Mutex() async function getLNC ({ me }) { if (window.lnc) return window.lnc + const { default: LNC } = await import('@lightninglabs/lnc-web') // backwards compatibility: migrate to new storage key if (me) migrateLocalStorage('lnc-web:default', `lnc-web:stacker:${me.id}`) window.lnc = new LNC({ namespace: me?.id ? `stacker:${me.id}` : undefined }) From f05b6fab843c5c67141b7a5e8d3ca66ec8c5234a Mon Sep 17 00:00:00 2001 From: keyan Date: Tue, 9 Jul 2024 11:37:55 -0500 Subject: [PATCH 04/24] add wallets profile to allow exclusion on attached wallet containers --- README.md | 2 +- docker-compose.yml | 6 +++--- sndev | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6e29556e..079e3ca1 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ COMMANDS #### Running specific services -By default all services will be run. If you want to exclude specific services from running, set `COMPOSE_PROFILES` to use one or more of `minimal|images|search|payments|email|capture`. To only run mininal services without images, search, or payments: +By default all services will be run. If you want to exclude specific services from running, set `COMPOSE_PROFILES` to use one or more of `minimal|images|search|payments|wallets|email|capture`. To only run mininal services without images, search, email, wallets, or payments: ```sh $ COMPOSE_PROFILES=minimal ./sndev start diff --git a/docker-compose.yml b/docker-compose.yml index 72ac9865..5b0b4b89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -373,7 +373,7 @@ services: build: context: ./docker/litd profiles: - - payments + - wallets restart: unless-stopped healthcheck: <<: *healthcheck @@ -479,7 +479,7 @@ services: context: ./docker/nwc container_name: nwc profiles: - - payments + - wallets restart: unless-stopped depends_on: stacker_lnd: @@ -509,7 +509,7 @@ services: image: lnbits/lnbits:0.12.5 container_name: lnbits profiles: - - payments + - wallets restart: unless-stopped ports: - "${LNBITS_WEB_PORT}:5000" diff --git a/sndev b/sndev index 18af9202..3aee70f4 100755 --- a/sndev +++ b/sndev @@ -10,7 +10,7 @@ docker__compose() { fi if [ -z "$COMPOSE_PROFILES" ]; then - COMPOSE_PROFILES="images,search,payments,email,capture" + COMPOSE_PROFILES="images,search,payments,wallets,email,capture" fi ENV_LOCAL= From 94d9d9513c4be744ba3f7097a9dec4af694d8417 Mon Sep 17 00:00:00 2001 From: keyan Date: Tue, 9 Jul 2024 11:46:38 -0500 Subject: [PATCH 05/24] hide overflow of toasts --- components/toast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/toast.js b/components/toast.js index e7154830..e6b98545 100644 --- a/components/toast.js +++ b/components/toast.js @@ -139,7 +139,7 @@ export const ToastProvider = ({ children }) => { >
-
{toast.body}
+
{toast.body}