-
Notifications
You must be signed in to change notification settings - Fork 88
Feature/lit 3918 no globalthis variables anymore #663
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
FedericoAmura
merged 5 commits into
staging/v7
from
feature/lit-3918-no-globalthis-variables-anymore
Oct 7, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c2777b5
feat: remove vanilla js instructions and their necessary global scope…
FedericoAmura cf4ea12
feat: replace litWCProvider global scope variable with module scoped …
FedericoAmura 9a5abd3
feat: replace globalThis in misc used to retrieve litCore config with…
FedericoAmura e666ce3
Merge branch 'staging/v7' into feature/lit-3918-no-globalthis-variabl…
Ansonhkg 42ffd7c
fix: merge conflict resolution
FedericoAmura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import { LitNodeClientConfig } from '@lit-protocol/types'; | ||
joshLong145 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { Contract } from '@ethersproject/contracts'; | ||
| import { JsonRpcProvider } from '@ethersproject/providers'; | ||
| import Ajv, { JSONSchemaType } from 'ajv'; | ||
|
|
@@ -31,6 +32,13 @@ import { | |
| const logBuffer: any[][] = []; | ||
| const ajv = new Ajv(); | ||
|
|
||
| // Module scoped variable to store the LitNodeClientConfig passed to LitCore | ||
| let litConfig: LitNodeClientConfig | undefined; | ||
|
|
||
| export const setMiscLitConfig = (config: LitNodeClientConfig | undefined) => { | ||
| litConfig = config; | ||
| }; | ||
|
|
||
| /** | ||
| * | ||
| * Print error message based on Error interface | ||
|
|
@@ -95,7 +103,6 @@ export const findMostCommonResponse = (responses: object[]): object => { | |
| }; | ||
|
|
||
| declare global { | ||
| var litConfig: any; | ||
| var wasmExport: any; | ||
| var wasmECDSA: any; | ||
| var logger: any; | ||
|
|
@@ -148,7 +155,7 @@ export const log = (...args: any): void => { | |
| } | ||
|
|
||
| // check if config is loaded yet | ||
| if (!globalThis?.litConfig) { | ||
| if (!litConfig) { | ||
| // config isn't loaded yet, push into buffer | ||
| logBuffer.push(args); | ||
| return; | ||
|
|
@@ -171,7 +178,7 @@ export const logWithRequestId = (id: string, ...args: any) => { | |
| } | ||
|
|
||
| // check if config is loaded yet | ||
| if (!globalThis?.litConfig) { | ||
| if (!litConfig) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making a note to reevaluate this module of scoping of the |
||
| // config isn't loaded yet, push into buffer | ||
| logBuffer.push(args); | ||
| return; | ||
|
|
@@ -196,7 +203,7 @@ export const logErrorWithRequestId = (id: string, ...args: any) => { | |
| } | ||
|
|
||
| // check if config is loaded yet | ||
| if (!globalThis?.litConfig) { | ||
| if (!litConfig) { | ||
| // config isn't loaded yet, push into buffer | ||
| logBuffer.push(args); | ||
| return; | ||
|
|
@@ -221,7 +228,7 @@ export const logError = (...args: any) => { | |
| } | ||
|
|
||
| // check if config is loaded yet | ||
| if (!globalThis?.litConfig) { | ||
| if (!litConfig) { | ||
| // config isn't loaded yet, push into buffer | ||
| logBuffer.push(args); | ||
| return; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double checked that this variable is not used in other modules as it's now locally scoped instead of global