Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: simplify conditional balance display and bitcoin connect store #227

Merged
merged 5 commits into from
May 14, 2024

Conversation

rolznz
Copy link
Collaborator

@rolznz rolznz commented May 13, 2024

Addresses #226 (comment)

  • Improved naming
  • Less duplication for conditional balance display
  • Removed useless functions and set / get the bitcoin connect config directly

@rolznz rolznz requested a review from bumi May 13, 2024 13:26
Copy link

socket-security bot commented May 13, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@babel/[email protected] Transitive: environment +8 170 kB nicolo-ribaudo
npm/@babel/[email protected] None +3 94.1 kB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +18 3.01 MB nicolo-ribaudo
npm/@babel/[email protected] None 0 1.88 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +16 2.79 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +15 2.88 MB nicolo-ribaudo
npm/@babel/[email protected] None +1 272 kB nicolo-ribaudo
npm/@babel/[email protected] environment +3 2.48 MB nicolo-ribaudo
npm/@eslint-community/[email protected] None 0 429 kB eslint-community-bot
npm/@getalby/[email protected] Transitive: network +1 889 kB rolznz
npm/@getalby/[email protected] Transitive: environment, network +14 6.02 MB rolznz
npm/@getalby/[email protected] Transitive: environment, network +5 67.4 MB
npm/@getalby/[email protected] network 0 134 kB reneaaron
npm/@jridgewell/[email protected] None +1 219 kB jridgewell
npm/@types/[email protected] None 0 3.93 MB types
npm/@types/[email protected] None 0 33.1 kB types
npm/@types/[email protected] None 0 30.2 kB types
npm/@types/[email protected] None +3 1.6 MB types
npm/@types/[email protected] None 0 363 kB types
npm/@types/[email protected] None +3 1.63 MB types
npm/@typescript-eslint/[email protected] Transitive: filesystem +28 6.07 MB jameshenry
npm/@typescript-eslint/[email protected] Transitive: filesystem +21 2.18 MB jameshenry
npm/@vitejs/[email protected] environment, filesystem, unsafe Transitive: shell +11 390 MB vitebot
npm/@webbtc/[email protected] None 0 10.4 kB rolznz
npm/[email protected] None +7 2.19 MB ljharb
npm/[email protected] None +8 2.2 MB ljharb
npm/[email protected] None +8 2.2 MB ljharb
npm/[email protected] environment Transitive: filesystem +4 646 kB ai
npm/[email protected] environment, filesystem Transitive: shell +4 365 kB ai
npm/[email protected] None 0 21.1 kB ljharb
npm/[email protected] None 0 2.07 MB caniuse-lite
npm/[email protected] None 0 1.94 MB caniuse-lite
npm/[email protected] None +1 1.55 MB lahmatiy
npm/[email protected] None +1 39.8 kB ljharb
npm/[email protected] None +2 48.3 kB ljharb
npm/[email protected] None +1 23.4 kB ljharb
npm/[email protected] None +37 3.77 MB ljharb
npm/[email protected] None +9 2.34 MB ljharb
npm/[email protected] unsafe Transitive: environment, filesystem +38 11.8 MB vercel-release-bot
npm/[email protected] Transitive: environment +1 58.5 kB ljharb
npm/[email protected] None 0 36.4 kB ljharb
npm/[email protected] environment 0 118 kB gnoff
npm/[email protected] None 0 11.6 kB arnaud-barre
npm/[email protected] None 0 32.2 kB eslintbot
npm/[email protected] environment, filesystem Transitive: eval, shell, unsafe +70 8.7 MB eslintbot
npm/[email protected] environment, filesystem Transitive: unsafe +12 4.48 MB eslintbot
npm/[email protected] filesystem 0 96.7 kB mrmlnc
npm/[email protected] None 0 31.4 kB ljharb
npm/[email protected] None +7 2.19 MB ljharb
npm/[email protected] eval +1 50.7 kB ljharb
npm/[email protected] filesystem 0 55.9 kB isaacs
npm/[email protected] None +3 61.9 kB ljharb
npm/[email protected] None 0 11.9 kB ljharb
npm/[email protected] None +1 41.1 kB ljharb
npm/[email protected] None 0 17.6 kB ljharb
npm/[email protected] None +1 308 kB ljharb
npm/[email protected] Transitive: environment +5 2.73 MB lit-robot
npm/[email protected] None 0 24.4 kB ai
npm/[email protected] environment, filesystem, network, shell, unsafe +13 1.15 GB vercel-release-bot
npm/[email protected] None 0 97.2 kB ljharb
npm/[email protected] None +7 2.2 MB ljharb
npm/[email protected] None +7 2.18 MB ljharb
npm/[email protected] None +7 2.2 MB ljharb
npm/[email protected] environment +3 4.62 MB gnoff
npm/[email protected] None +2 1.51 MB timolins
npm/[email protected] environment +2 337 kB gnoff
npm/[email protected] None 0 38.5 kB ljharb
npm/[email protected] environment, filesystem +5 216 kB ljharb
npm/[email protected] None 0 84 kB typescript-bot
npm/[email protected] None 0 40.1 MB typescript-bot
npm/[email protected] environment, eval, filesystem, network, shell, unsafe +29 213 MB vitebot
npm/[email protected] None +4 79.5 kB ljharb

🚮 Removed packages: npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@jridgewell/[email protected], npm/@lit/[email protected], npm/@open-wc/[email protected], npm/@twind/[email protected], npm/@twind/[email protected], npm/@twind/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected], npm/@web/[email protected], npm/@web/[email protected], npm/@web/[email protected], npm/@web/[email protected], npm/@web/[email protected], npm/@webbtc/[email protected], npm/@webcomponents/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

Copy link

socket-security bot commented May 13, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSource
Install scripts npm/@swc/[email protected]
  • Install script: postinstall
  • Source: node postinstall.js
Telemetry npm/[email protected]
  • Note: Can be disabled by setting the environment variable NEXT_TELEMETRY_DISABLED=1 . See https://nextjs.org/telemetry for more information

View full report↗︎

Next steps

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

What is telemetry?

This package contains telemetry which tracks how it is used.

Most telemetry comes with settings to disable it. Consider disabling telemetry if you do not want to be tracked.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

Comment on lines 79 to 82
const supportsGetBalance =
!!info?.methods &&
info.methods.indexOf('getBalance') > -1 &&
!!provider?.getBalance;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to make this a function saying, something like?

supports(method) {
  return !!info?.methods &&
        info.methods.indexOf(method) > -1 &&
        !!provider?[method]
}

and maybe even something that we can put in the nwc-sdk?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that would be good and actually make the JS SDK even simpler to use. I created an issue here: getAlby/js-sdk#221

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the property to the suggested supports method in the store for now

@rolznz rolznz merged commit 8052687 into master May 14, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants