Commit Graph

52 Commits

Author SHA1 Message Date
rleed c1c1240eab
Add a setting for Default Withdrawal max fee (#552)
* add setting for default withdrawal max fee

* Update pages/settings.js

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>

* remove extraneous fallback of 21

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
2023-10-20 19:09:41 -05:00
keyan 8f034f0e0a fix corner cases in lightning address autosuggestions 2023-10-12 15:29:22 -05:00
Satoshi Nakamoto e907b40845 * Hide suggestions if the user is typing a ln addr that is not on stacker.news
* Don't select suggestion with tab in this particular instance of InputUseSuggest
2023-10-10 19:15:10 -04:00
Satoshi Nakamoto 6d3482a288 Add auto-complete support when withdrawing to ln addr
adds auto-complete support for other stacker.news users when withdrawing
to a lightning address

implemented via adding an optional `transformUser` prop to the `UserSuggest` and `InputUserSuggest`
components, which allows you to transform fetched user results before displaying in the suggestion
dropdown

this is used to transform a user nym to nym@stacker.news, the corresponding
lightning address

by default, `transformUser` is an identity fn aka no transformation

this change also clears suggestions when the surrounding input field is blurred, which
is a better UX IMO
2023-10-10 11:15:59 -04:00
keyan 8ca8bb985e reuse debounce hook more places 2023-10-06 15:01:51 -05:00
keyan 0a35bca650 memoize debounced function 2023-10-05 21:14:57 -05:00
keyan d1a7dca46b use and make a debounce callback hook 2023-10-05 20:33:14 -05:00
Satoshi Nakamoto e9c0c06779 Various LUD-18 fixes
* Debounce the `onAddrChange` event handler when sending to a LN Address,
so we more accurately display the input form for LUD-12 and LUD-18 options

* Remove explicit URI encoding of Payer Data when sending to a LN Addr, since we're getting encoding for free via URLSearchParams

* Append `@stacker.news` to identifier values sent in payer data

* Don't do extra decoding when receiving LUD-18 data
2023-10-05 10:27:01 -04:00
SatsAllDay 362f95add9
LUD-18 Wallet implementation (#531)
* LUD-18 Wallet implementation

Query the lightning address provider client-side to learn of capabilities

Conditionally render LUD-12 and LUD-18 fields based on what the remote
server says is supported

Allow identifier, name, and email to be sent from the SN side during the withdrawal flow. Auth seems too complicated for our use case, and idk about pubkey?

* Clear inputs if the new ln addr provier doesn't support those fields

* various ux improvements

* dynamic client-side validation for required payer data

* don't re-init form state on error

* correct min and max amount values

* only send applicable data to graphql api based on payerdata schema

* input type for numeric values (amount, max fee)

* update step for amount and max fee

* Fix identifier optional and field blur

* reuse more code

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-03 18:22:56 -05:00
SatsAllDay d60a589bc0
Implementing LUD-12 comments on payRequest in LNURLP Lightning Address flow (sending and receiving) (#498)
* Prototype implementing LUD-12 comments on payRequest in LNURLP Lightning Address flow

* Support sending comment when withdrawing to ln addr (LUD-12)

* Prevent `initialError` from being toasted informs multiple times

* delete the old create_invoice function

* improve lightning addr withdrawal styling

* allow lnaddr comment to show up in notifications

* enhance satistics

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-23 20:14:49 -05:00
keyan fb3837ea0a use number formatting more places 2023-09-18 18:09:08 -05:00
ekzyis 6df654b208
Hide wallet balance (#481)
* Hide wallet balance on long press

* Use setting to hide wallet balance

* Fix layout shift on hover

* Fix SSR warning about useLayoutEffect

See https://reactjs.org/link/uselayouteffect-ssr

* Also hide balance in wallet

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-09-12 12:19:26 -05:00
keyan 7bbcc86270 redirect to login on pages that require auth (#269) 2023-08-28 12:52:15 -05:00
rleed 052bf4803c
Make withdrawal options more visible (issue167a) (#423)
Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-19 19:42:50 -05:00
ekzyis b9461b7eb3
Allow zapping, posting and commenting without funds or an account (#336)
* Add anon zaps

* Add anon comments and posts (link, discussion, poll)

* Use payment hash instead of invoice id as proof of payment

Our invoice IDs can be enumerated.
So there is a - even though very rare - chance that an attacker could find a paid invoice which is not used yet and use it for himself.
Random payment hashes prevent this.

Also, since we delete invoices after use, using database IDs as proof of payments are not suitable.
If a user tells us an invoice ID after we deleted it, we can no longer tell if the invoice was paid or not since the LN node only knows about payment hashes but nothing about the database IDs.

* Allow pay per invoice for stackers

The modal which pops up if the stacker does not have enough sats now has two options: "fund wallet" and "pay invoice"

* Fix onSuccess called twice

For some reason, when calling `showModal`, `useMemo` in modal.js and the code for the modal component (here: <Invoice>) is called twice.

This leads to the `onSuccess` callback being called twice and one failing since the first one deletes the invoice.

* Keep invoice modal open if focus is lost

* Skip anon user during trust calculation

* Add error handling

* Skip 'invoice not found' errors

* Remove duplicate insufficient funds handling

* Fix insufficient funds error detection

* Fix invoice amount for comments

* Allow pay per invoice for bounty and job posts

* Also strike on payment after short press

* Fix unexpected token 'export'

* Fix eslint

* Remove unused id param

* Fix comment copy-paste error

* Rename to useInvoiceable

* Fix unexpected token 'export'

* Fix onConfirmation called at every render

* Add invoice HMAC

This prevents entities which know the invoice hash (like all LN nodes on the payment path) from using the invoice hash on SN.

Only the user which created the invoice knows the HMAC and thus can use the invoice hash.

* make anon posting less hidden, add anon info button explainer

* Fix anon users can't zap other anon users

* Always show repeat and contacts on action error

* Keep track of modal stack

* give anon an icon

* add generic date pivot helper

* make anon user's invoices expire in 5 minutes

* fix forgotten find and replace

* use datePivot more places

* add sat amounts to invoices

* reduce anon invoice expiration to 3 minutes

* don't abbreviate

* Fix [object Object] as error message

Any errors thrown here are already objects of shape { message: string }

* Fix empty invoice creation attempts

I stumbled across this while checking if anons can edit their items.

I monkey patched the code to make it possible (so they can see the 'edit' button) and tried to edit an item but I got this error:

  Variable "$amount" of required type "Int!" was not provided.

I fixed this even though this function should never be called without an amount anyway. It will return a sane error in that case now.

* anon func mods, e.g. inv limits

* anon tips should be denormalized

* remove redundant meTotalSats

* correct overlay zap text for anon

* exclude anon from trust graph before algo runs

* remove balance limit on anon

* give anon a bio and remove cowboy hat/top stackers;

* make anon hat appear on profile

* concat hash and hmac and call it a token

* Fix localStorage cleared because error were swallowed

* fix qr layout shift

* restyle fund error modal

* Catch invoice errors in fund error modal

* invoice check backoff

* anon info typo

* make invoice expiration times have saner defaults

* add comma to anon info

* use builtin copy input label

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-11 18:50:57 -05:00
SatsAllDay 6e05cd38f9
Singular/Plural "Sats" labels (#380)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-08 16:04:06 -05:00
keyan e1c51075a2 fix conditional nextFetchPolicy overriding cache-only on SSR and suppress time hydration warnings 2023-07-31 14:54:30 -05:00
keyan ab2046ab0b fix issues with new linting 2023-07-25 09:14:45 -05:00
keyan 6407455def upgrade react-bootstrap 2023-07-24 13:53:53 -05:00
keyan 59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed.
2023-07-23 10:08:43 -05:00
keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c.
2023-07-23 09:16:12 -05:00
keyan d0314ab73c shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades 2023-07-21 17:33:11 -05:00
keyan 6d8780373a form enhancements 2023-05-11 14:34:42 -05:00
keyan 4cae1ae230 reuse validation on server 2023-02-08 13:39:53 -06:00
keyan 9644a9f867 slashtags auth 2023-01-18 12:49:20 -06:00
keyan 525cab2573 upgrade deps 2022-11-06 11:28:58 -06:00
keyan 52de4a253e max amount for alby 2022-09-06 09:37:53 -05:00
keyan c061f4a6f0 limit pending invoices 2022-05-31 17:17:48 -05:00
keyan 188230c37c add notification settings 2022-04-21 17:50:02 -05:00
secondl1ght d056a4c120
Update wallet.js 2022-03-17 12:04:53 -06:00
keyan 9490b3dc5f max fee needs to be a number 2022-02-02 16:01:48 -06:00
keyan e37475f927 send to lightning address 2022-01-24 11:25:15 -06:00
keyan 54c1c8c41b wallet history link on wallet pages 2021-12-16 14:17:50 -06:00
keyan b8080137a8 lnurl-withdrawal support 2021-10-28 14:59:53 -05:00
keyan 07b9da353b smarter use of SSR and caching 2021-10-26 15:49:37 -05:00
keyan edf9584391 remove ln adder alert debugging 2021-10-08 07:40:35 -07:00
keyan d3c3657a92 add alert for lightning address 2021-10-08 07:35:57 -07:00
keyan ca1a95094c ssr everything 2021-09-30 10:46:58 -05:00
keyan 3f8b5894cb small clean up 2021-09-09 14:10:15 -05:00
keyan 968892b661 clean up console messages 2021-09-07 13:04:56 -05:00
keyan 7ffb3fd18a support webln fund and withdrawal 2021-09-07 12:52:59 -05:00
keyan 18f1a9f335 center wallet balance text 2021-09-02 12:22:48 -05:00
keyan 79cb2d5c27 withdrawl => withdrawal/withdraw 2021-08-19 16:42:21 -05:00
keyan 3fa42caa4e add wallet balance to all wallet pages 2021-07-15 11:42:02 -05:00
keyan 2e26e421e7 lnurl-auth 2021-06-26 22:09:39 -05:00
keyan 01922e4b88 notifications done 2021-06-24 18:56:01 -05:00
keyan 157488ea5d make withdrawls mostly work 2021-05-13 16:19:51 -05:00
keyan ce55fdfe9c withdrawl page 2021-05-13 08:28:38 -05:00
keyan 7a8afd56c3 partial withdrawl 2021-05-12 20:51:37 -05:00
keyan d92fc12187 half done with wallets 2021-05-12 18:04:19 -05:00