Skip to content

Feature/lit 3139 identify private methods in litnodeclient #482

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

Conversation

Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented May 29, 2024

Description

This PR aims to privatise, protect and remove unused methods from lit-node-client and lit-core, standardise to use #methodFoo over _methodFoo for privatised methods, and protected _methodBar over _methodBar for protected methods.

NOTE: Even though we are implementing these method visibility changes using # for private methods and protected _ for protected methods, it is important to note that these changes will only be fully effective with TypeScript and modern JavaScript (ES2022 and later). Core JavaScript prior to ES2022 does not natively support the # syntax for private methods, and JS does not have a native protected keyword; this is a TypeScript feature that allows for better control over method visibility.

Method Visibility Changes

Privatised Methods

The following methods have been changed to private (prefixed with #):

1.	setCustomBootstrapUrls -> #setCustomBootstrapUrls
2.	_listenForNewEpoch -> #listenForNewEpoch
3.	_scheduleNetworkSync -> #scheduleNetworkSync
4.	handshakeWithNode -> #handshakeWithNode
5.	sendCommandToNode -> #sendCommandToNode
6.	getRequestId -> #getRequestId
7.	overrideConfigsFromLocalStorage -> #overrideConfigsFromLocalStorage

Protected Methods

The following methods have been changed to protected (prefixed with _):

1.	getNodePromises -> _getNodePromises
2.	handleNodePromises -> _handleNodePromises
3.	getSessionSigByUrl -> _getSessionSigByUrl
4.	throwNodeError -> _throwNodeError
5.	stopNetworkPolling -> _stopNetworkPolling
6.	stopListeningForNewEpoch -> _stopListeningForNewEpoch

Removed Methods and Endpoints

1.	Removed getIpAddress method from packages/misc/src/lib/misc.ts and related test cases in packages/misc/src/lib/misc.spec.ts.
2.	Removed unused endpoints from packages/constants/src/lib/constants/endpoints.ts.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

NETWORK=localchain DEBUG=false yarn test:local

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Ansonhkg Ansonhkg marked this pull request as ready for review May 29, 2024 14:59
@Ansonhkg Ansonhkg requested a review from joshLong145 as a code owner May 29, 2024 14:59
@joshLong145 joshLong145 merged commit b8acf3d into staging/v6 Jun 3, 2024
@joshLong145 joshLong145 deleted the feature/lit-3139-identify-private-methods-in-litnodeclient branch June 3, 2024 12:57
@joshLong145 joshLong145 restored the feature/lit-3139-identify-private-methods-in-litnodeclient branch June 3, 2024 20:45
@joshLong145
Copy link

joshLong145 commented Jun 3, 2024

Reverting merge of this PR as it was found to cause runtime errors related to tslib bundling issues.

Screenshot 2024-06-03 at 3 56 55 PM

joshLong145 pushed a commit that referenced this pull request Jun 3, 2024
…entify-private-methods-in-litnodeclient"

This reverts commit b8acf3d, reversing
changes made to 72fc82a.
joshLong145 pushed a commit that referenced this pull request Jun 3, 2024
Revert "Merge pull request #482 from LIT-Protocol/feature/lit-3139-id…
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