Skip to content

Revert "Merge pull request #482 from LIT-Protocol/feature/lit-3139-id… #492

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

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ describe('Lit Action', () => {
url: 'https://cayenne.litgateway.com:7371/web/execute',
data,
};
const res = await savedParams.litNodeClient._sendCommandToNode(reqBody);
const res = await savedParams.litNodeClient.sendCommandToNode(reqBody);
expect(res).to.have.property('success', true);
});

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useNx": true,
"useWorkspaces": true,
"version": "6.0.0"
"version": "6.0.1"
}
4 changes: 2 additions & 2 deletions packages/access-control-conditions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"tags": [
"universal"
],
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/auth-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"tags": [
"browser"
],
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/auth-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"crypto": false,
"stream": false
},
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/bls-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"buildOptions": {
"genReact": false
},
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"tags": [
"universal"
],
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
2 changes: 1 addition & 1 deletion packages/constants/src/lib/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '6.0.0';
export const version = '6.0.1';
4 changes: 2 additions & 2 deletions packages/contracts-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"tags": [
"universal"
],
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lit-protocol/core",
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"type": "commonjs",
"license": "MIT",
"homepage": "https://github.com/Lit-Protocol/js-sdk",
Expand All @@ -27,4 +27,4 @@
],
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
45 changes: 21 additions & 24 deletions packages/core/src/lib/lit-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
import {
bootstrapLogManager,
executeWithRetry,
getIpAddress,
isBrowser,
isNode,
log,
Expand Down Expand Up @@ -175,7 +176,7 @@ export class LitCore {
}

// -- set bootstrapUrls to match the network litNetwork unless it's set to custom
this.#setCustomBootstrapUrls();
this.setCustomBootstrapUrls();

// -- set global variables
globalThis.litConfig = this.config;
Expand Down Expand Up @@ -439,9 +440,9 @@ export class LitCore {
* that the client's configuration is always in sync with the current state of the
* staking contract.
*
* @returns { void }
* @returns {Promise<void>} A promise that resolves when the listener is successfully set up.
*/
#listenForNewEpoch(): void {
private _listenForNewEpoch() {
// Check if we've already set up the listener to avoid duplicates
if (this._stakingContractListener) {
// Already listening, do nothing
Expand Down Expand Up @@ -475,14 +476,13 @@ export class LitCore {
if (globalThis.litConfig) delete globalThis.litConfig;
}

protected _stopNetworkPolling() {
_stopNetworkPolling() {
if (this._networkSyncInterval) {
clearInterval(this._networkSyncInterval);
this._networkSyncInterval = null;
}
}

protected _stopListeningForNewEpoch() {
_stopListeningForNewEpoch() {
if (this._stakingContract && this._stakingContractListener) {
this._stakingContract.off('StateChanged', this._stakingContractListener);
this._stakingContractListener = null;
Expand All @@ -496,7 +496,7 @@ export class LitCore {
* @returns { void }
*
*/
#setCustomBootstrapUrls = (): void => {
setCustomBootstrapUrls = (): void => {
// -- validate
if (this.config.litNetwork === 'custom') return;

Expand Down Expand Up @@ -585,8 +585,8 @@ export class LitCore {
await this._runHandshakeWithBootstrapUrls();
Object.assign(this, { ...coreNodeConfig, connectedNodes, serverKeys });

this.#scheduleNetworkSync();
this.#listenForNewEpoch();
this._scheduleNetworkSync();
this._listenForNewEpoch();

// FIXME: don't create global singleton; multiple instances of `core` should not all write to global
// @ts-expect-error typeof globalThis is not defined. We're going to get rid of the global soon.
Expand Down Expand Up @@ -617,7 +617,7 @@ export class LitCore {
}): Promise<JsonHandshakeResponse> {
const challenge = this.getRandomHexString(64);

const handshakeResult = await this.#handshakeWithNode(
const handshakeResult = await this.handshakeWithNode(
{ url, challenge },
requestId
);
Expand Down Expand Up @@ -707,7 +707,7 @@ export class LitCore {
coreNodeConfig: CoreNodeConfig;
}> {
// -- handshake with each node
const requestId: string = this.#getRequestId();
const requestId: string = this.getRequestId();

// track connectedNodes for the new handshake operation
const connectedNodes = new Set<string>();
Expand Down Expand Up @@ -858,7 +858,7 @@ export class LitCore {
* We can remove this network sync code entirely if we refactor our code to fetch latest blockhash on-demand.
* @private
*/
#scheduleNetworkSync() {
private _scheduleNetworkSync() {
if (this._networkSyncInterval) {
clearInterval(this._networkSyncInterval);
}
Expand All @@ -880,7 +880,7 @@ export class LitCore {
* @returns { string }
*
*/
#getRequestId(): string {
getRequestId() {
return Math.random().toString(16).slice(2);
}

Expand All @@ -891,7 +891,7 @@ export class LitCore {
* @returns { string }
*/

getRandomHexString(size: number): string {
getRandomHexString(size: number) {
return [...Array(size)]
.map(() => Math.floor(Math.random() * 16).toString(16))
.join('');
Expand All @@ -905,7 +905,7 @@ export class LitCore {
* @returns { Promise<NodeCommandServerKeysResponse> }
*
*/
#handshakeWithNode = async (
handshakeWithNode = async (
params: HandshakeWithNode,
requestId: string
): Promise<NodeCommandServerKeysResponse> => {
Expand All @@ -927,7 +927,7 @@ export class LitCore {
challenge: params.challenge,
};

return await this._sendCommandToNode({
return await this.sendCommandToNode({
url: urlWithPath,
data,
requestId,
Expand Down Expand Up @@ -985,7 +985,7 @@ export class LitCore {
* @returns { Promise<any> }
*
*/
protected _sendCommandToNode = async ({
sendCommandToNode = async ({
url,
data,
requestId,
Expand Down Expand Up @@ -1023,7 +1023,7 @@ export class LitCore {
* @returns { Array<Promise<any>> }
*
*/
protected _getNodePromises = (
getNodePromises = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
callback: (url: string) => Promise<any>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -1048,7 +1048,7 @@ export class LitCore {
* @returns The session signature for the given URL.
* @throws An error if sessionSigs is not provided or if the session signature for the URL is not found.
*/
protected _getSessionSigByUrl = ({
getSessionSigByUrl = ({
sessionSigs,
url,
}: {
Expand Down Expand Up @@ -1154,7 +1154,7 @@ export class LitCore {
* @param { number } minNodeCount number of nodes we need valid results from in order to resolve
* @returns { Promise<SuccessNodePromises<T> | RejectedNodePromises> }
*/
protected _handleNodePromises = async <T>(
handleNodePromises = async <T>(
nodePromises: Promise<T>[],
requestId: string,
minNodeCount: number
Expand Down Expand Up @@ -1237,10 +1237,7 @@ export class LitCore {
* @returns { void }
*
*/
protected _throwNodeError = (
res: RejectedNodePromises,
requestId: string
): void => {
_throwNodeError = (res: RejectedNodePromises, requestId: string): void => {
if (res.error) {
if (
((res.error.errorCode &&
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"tags": [
"universal"
],
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/ecdsa-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"tags": [
"universal"
],
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/encryption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"crypto": false,
"stream": false
},
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/lit-auth-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lit-protocol/lit-auth-client",
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"type": "commonjs",
"license": "MIT",
"homepage": "https://github.com/Lit-Protocol/js-sdk",
Expand Down Expand Up @@ -32,4 +32,4 @@
},
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}
4 changes: 2 additions & 2 deletions packages/lit-node-client-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"tags": [
"nodejs"
],
"version": "6.0.0",
"version": "6.0.0-tslib-test",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
}

This file was deleted.

This file was deleted.

Loading