Commit Graph

2455 Commits

Author SHA1 Message Date
k00b c4a96af5d3 fix crossposting toast 2024-08-21 14:59:28 -05:00
Keyan df62cfb28c
paid action limits (#1323) 2024-08-21 14:45:51 -05:00
ekzyis 67d71ef0c8
Rename LNbits primary key column from 'int' to 'id' (#1321)
* Rename LNbits primary key column from 'int' to 'id'

* fix migration

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-08-21 10:49:48 -05:00
ekzyis 789d7626f7
Support receiving with NWC (#1310)
* Add NWC receives

* Refactor sendPayment+createInvoice with nwcCall function

* Update badge

* Add method support checks

* Add timeout to NWC test invoice

* Fix NWC isConfigured state

All NWC fields are marked as optional but NWC should only be considered configured if one of them is set.

* Fix relay.fetch() throws 'crypto is not defined' in node

nip04.encrypt() was failing in worker because 'crypto is not defined'. Updating to nostr-tools v2.7.2 fixed that.

However, now crypto.randomUUID() in relay.fetch() was throwing 'crypto is not defined'. Importing crypto from 'crypto' fixed that.

However, with the import, randomUUID() does not work so I switched to randomBytes().

Running relay.fetch() now works in browser and node.

* recv must not support pay_invoice

* Fix Relay connection check

* this.url was undefined
* error was an object

* Fix additional isConfigured check runs always

It was meant to only catch false positives, not turn negatives into false positives.

* Rename testConnectServer to testCreateInvoice

* Rename testConnectClient to testSendPayment

* Only run testSendPayment if send is configured

The return value of testSendPayment was used before but it only returned something for LNC.

And for LNC, we only wanted to save the transformation during validation, so it was not needed.

* Always use withTimeout in NWC test functions

* Fix fragment name

* Use get_info command exclusively

* Check permissions more efficiently

* Log NWC request-response flow

* Fix variable name

* Call ws.send after listener is added

* Fix websocket not closed after timeout

* Also check that pay_keysend etc. are not supported

* fix lnc session key save

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-08-21 10:13:27 -05:00
Keyan bc94ec7d28
disable freebies setting (#1320)
* disable freebies setting

* await in disableFreebie resolver + better info modal
2024-08-21 09:37:25 -05:00
k00b 555601c7de no bios in random 2024-08-20 21:12:39 -05:00
k00b 85e91ede47 show only active items with comments on random 2024-08-20 21:09:52 -05:00
k00b accf5212b2 fix ~jobs 2024-08-20 20:50:04 -05:00
Keyan eca7e8df0d
Update awards.csv 2024-08-20 17:06:45 -05:00
Tom 4fd23a3694
Add Random link and basic query (#1306)
* Add Random link and basic query

* Use random

* refine random sort query

* make vote threshold higher

---------

Co-authored-by: k00b <k00b@stacker.news>
2024-08-20 16:50:55 -05:00
ekzyis 17199e8f91
Fix missing fragment name update (#1319) 2024-08-19 17:41:52 -05:00
ekzyis 6801b775c1
Fix inconsistency between walletTypeToResolveType and generateTypeDefName (#1318) 2024-08-19 17:36:07 -05:00
k00b a495c421ce select first status=null on withdrawal check 2024-08-19 10:10:34 -05:00
k00b 2ff839f3a5 check invoice after transitioning to cancel 2024-08-18 18:03:01 -05:00
Keyan 3264601dc6
add priority:low to readme 2024-08-18 17:30:25 -05:00
ekzyis 06b661625c
Use custom relay API (#1302)
* Use custom relay API

Relay from nostr-tools was cumbersome to use. This custom abstraction over window.WebSocket makes interacting with nostr relays easier.

* Use variables for nostr message parts

* Fix NWC save

* Use try/finally

* Refactor crossposting code

* use custom replay API
* simplify callWithTimeout

* Use isomorphic-ws for nip57 zap receipts

* Use async map

* Reject with timeout error

* Move time functions into lib/time

* Remove outdated comment regarding relay.close()
2024-08-18 17:28:39 -05:00
ekzyis ccbc28322e
Add wasm-unsafe-eval to CSP for LNC (#1313) 2024-08-18 17:20:46 -05:00
k00b df7baf4d7c don't filter freebies/outlaws on profiles + fix ~sub/recent/all 2024-08-18 16:43:19 -05:00
k00b 3608d133d7 remove redundant info help text from wallets 2024-08-18 15:20:31 -05:00
k00b 506bb364d1 fix walletTypeToResolveType 2024-08-18 14:57:50 -05:00
k00b 9932a782b2 improve autowithdraw recent failure check 2024-08-18 14:06:17 -05:00
Keyan 11ddbe3983
Update awards.csv 2024-08-18 11:45:39 -05:00
Riccardo Balbo 2d139bed85
Blink wallet sending attachment (#1293)
* blink attachment

* support staging

* add staging dashboard link

* Revert "add staging dashboard link"

This reverts commit a43fa2204f03d74e733063aedd6862c6d71e4a46.

* Revert "support staging"

This reverts commit 93c15aa5083e60b1dafc77c30e999fb90fef8589.

* handle pending payments, code cleanup and comments

* stable sats -> stablesats

* catch HTTP errors

* print wallet currency in debug

* disable autocomplete

* schema without test()

* Fix save since default is not applied for empty strings

Formik validation must see 'currency' as undefined and apply the default but the validation before save sees an empty string.

* Save transformed config

* Remove unnecessary defaults

* Prefix HTTP error with text

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-08-18 11:36:55 -05:00
ekzyis 3d8ae4a7a3
Generate more server wallet code (#1309)
* Generate more code from wallet defs

* generate "type WalletLND { ... }"
* generate "union WalletDetails = WalletLND | ..."
* hardcode function for __resolveType
* add comments where updates are needed if another server wallet is added

* Fix type for LN addresses

* Generate __resolveType from wallet.type column
2024-08-18 11:32:25 -05:00
k00b d2d04ce141 lnbits doesn't support msats either 2024-08-17 18:43:39 -05:00
Keyan ffc156df2b
Msats to sats floor (#1307)
* make wallet invoice creation tests make full sat invoice

* handle rounded/floored msats for receiving wallets

* msats flooring to sats function
2024-08-16 19:33:17 -05:00
ekzyis ab80873a57
Fix all wallets deleted on logout (#1308)
Every wallet returned by the useWallet hook has sendPayment set even if it doesn't support payments since wallet.sendPayment is wrapped with a useCallback hook.
2024-08-16 15:50:11 -05:00
ekzyis 3cd9991aa9
Hide wallet name in logs for only a single wallet (#1305) 2024-08-16 09:02:09 -05:00
k00b ec2383b998 bug is only in wildwestmode 2024-08-14 15:43:07 -05:00
k00b 5a65eaae18 try to fix satsFilter clause 2024-08-14 15:36:21 -05:00
ekzyis 8e18fa0760
Remove TODO about errors in createInvoice (#1300) 2024-08-14 14:56:02 -05:00
ekzyis 4000522773
Fix WebLN checkbox unclickable (#1299)
Checkbox was unclickable because wallet.isConfigured is false if wallet.config was null.
2024-08-14 14:29:24 -05:00
k00b ddb32e0bb7 fix null initial values for wallet forms 2024-08-14 13:22:17 -05:00
k00b 11ac605cd9 fix clicking on p2p in satistics 2024-08-14 12:59:27 -05:00
k00b 71b639be5d reduce p2p max 2024-08-14 12:11:08 -05:00
ekzyis 56d55027ab
Fix freebie comment edits like a post (#1298) 2024-08-14 09:31:52 -05:00
k00b cb2efb0a7f fix sats filter for notifications 2024-08-13 16:27:22 -05:00
k00b 4d7e0a8296 fix settings mutation after greeterMode removal 2024-08-13 16:11:54 -05:00
k00b cfd63f4efb fix relative path env in sndev 2024-08-13 15:48:22 -05:00
k00b ac87322ac8 fix user/item popover 2024-08-13 15:30:43 -05:00
ekzyis 53465e3f46
Remove unnecessary me from addWalletLog params (#1296) 2024-08-13 09:53:44 -05:00
Keyan cc289089cf
not-custodial zap beta (#1178)
* not-custodial zap scaffolding

* invoice forward state machine

* small refinements to state machine

* make wrap invoice work

* get state machine working end to end

* untested logic layout for paidAction invoice wraps

* perform pessimisitic actions before outgoing payment

* working end to end

* remove unneeded params from wallets/server/createInvoice

* fix cltv relative/absolute confusion + cancelling forwards

* small refinements

* add p2p wrap info to paidAction docs

* fallback to SN invoice when wrap fails

* fix paidAction retry description

* consistent naming scheme for state machine

* refinements

* have sn pay bounded outbound fee

* remove debug logging

* reenable lnc permissions checks

* don't p2p zap on item forward splits

* make createInvoice params json encodeable

* direct -> p2p badge on notifications

* allow no tls in dev for core lightning

* fix autowithdraw to create invoice with msats

* fix autowithdraw msats/sats inconsitency

* label p2p zaps properly in satistics

* add fees to autowithdrawal notifications

* add RETRYING as terminal paid action state

* Update api/paidAction/README.md

Co-authored-by: ekzyis <ek@stacker.news>

* Update api/paidAction/README.md

Co-authored-by: ekzyis <ek@stacker.news>

* Update api/lnd/index.js

Co-authored-by: ekzyis <ek@stacker.news>

* ek suggestions

* add bugetable to nwc card

* get paranoid with numbers

* better finalize retries and better max timeout height

* refine forward failure transitions

* more accurate satistics p2p status

* make sure paidaction cancel in state machine only

* dont drop bolt11s unless status is not null

* only allow PENDING_HELD to transition to FORWARDING

* add mermaid state machine diagrams to paid action doc

* fix cancel transition name

* cleanup readme

* move forwarding outside of transition

* refine testServerConnect and make sure ensureB64 transforms

* remove unused params from testServerConnect

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: k00b <k00b@stacker.news>
2024-08-13 09:48:30 -05:00
ekzyis 454ad26bd7
Add migration to fix missing item bio marker (#1295) 2024-08-12 19:19:18 -05:00
k00b ce7d2b888d add back greeterMode for backwards compat 2024-08-12 17:49:01 -05:00
ekzyis ae73b0c19f
Support receiving via LNbits (#1278)
* Support receiving with LNbits

* Remove hardcoded LNbits url on server

* Fix saveConfig ignoring save errors

* saveConfig was meant to only ignore validation errors, not save errors
* on server save errors, we redirected as if save was successful
* this is now fixed with a promise chain
* logging payments vs receivals was also moved to correct place

* Fix enabled falsely disabled on SSR

If a wallet was configured for payments but not for receivals and you refreshed the configuration form, enabled was disabled even though payments were enabled.

This was the case since we don't know during SSR if it's enabled since this information is stored on the client.

* Fix missing 'receivals disabled' log message

* Move 'wallet detached for payments' log message

* Fix stale walletId during detach

If page was reloaded, walletId in clearConfig was stale since callback dependency was missing.

* Add missing callback dependencies for saveConfig

* Verify that invoiceKey != adminKey

* Verify LNbits keys are hex-encoded

* Fix local config polluted with server data

* Fix creation of duplicate wallets

* Remove unused dependency

* Fix missing error message in logs

* Fix setPriority

* Rename: localConfig -> clientConfig

* Add description to LNbits autowithdrawals

* Rename: receivals -> receives

* Use try/catch instead of promise chain in saveConfig

* add connect label to lnbits for no url found for lnbits

* Fix adminKey not saved

* Remove hardcoded LNbits url on server again

* Add LNbits ATTACH.md

* Delete old docs to attach LNbits with polar

* Add missing callback dependencies

* Set editable: false

* Only set readOnly if field is configured

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-08-12 17:23:39 -05:00
Keyan 68758b3443
Update awards.csv 2024-08-12 16:58:49 -05:00
Keyan c5f043c625
replace greeter mode with investment filter (#1291)
* replace greeter mode with investment filter

* change name to satsFilter

* drop freebie column

---------

Co-authored-by: k00b <k00b@stacker.news>
2024-08-11 18:47:03 -05:00
Keyan e897a2d1dc
Update awards.csv 2024-08-11 16:31:44 -05:00
Anis Khalfallah ed6ef2f82f
fix: constrain less important services in docker compose (#1289)
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-08-11 16:29:46 -05:00
ekzyis bcae5e6d2e
Fix callback set to NextJS data URL (#1292) 2024-08-10 14:38:35 -05:00