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

Deprecated networks file #1030

Merged
merged 3 commits into from
Feb 26, 2025
Merged

Deprecated networks file #1030

merged 3 commits into from
Feb 26, 2025

Conversation

mirooon
Copy link
Contributor

@mirooon mirooon commented Feb 25, 2025

Which Jira task belongs to this PR?

LF-10381

Why did I implement it this way?

Checklist before requesting a review

Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)

  • I have checked that any arbitrary calls to external contracts are validated and or restricted
  • I have checked that any privileged calls (i.e. storage modifications) are validated and or restricted
  • I have ensured that any new contracts have had AT A MINIMUM 1 preliminary audit conducted on by <company/auditor>

Copy link
Contributor

coderabbitai bot commented Feb 25, 2025

Walkthrough

This pull request updates several scripts by replacing the previous method of retrieving network data from plain text files with a structured JSON approach. In multiple scripts, commands that used cat to read network names have been replaced with jq calls on a JSON file defined by the NETWORKS_JSON_FILE_PATH variable. Variable declarations have been localized where appropriate, configuration file references have been updated, and legacy functions for reading network names have been removed.

Changes

Files Change Summary
archive/.../diamondMakeImmutable.sh, archive/.../removeUnusableFunctionsForImmutable.sh, script/.../deployFacetAndAddToDiamond.sh, script/.../scriptMaster.sh, script/tasks/{acceptOwnershipTransferPeriphery.sh, checkExecutorAndReceiver.sh, diamondEMERGENCYPause.sh, diamondSyncDEXs.sh, diamondSyncSigs.sh, diamondUpdatePeriphery.sh, diamondUpdateSgConfig.sh, updateFacetConfig.sh}, script/utils/diamondEMERGENCYPauseGitHub.sh Replaced plain text file reading (cat) with JSON-based network retrieval using jq, updated user prompts (via gum filter/choose), and introduced local scoping for the NETWORK variable where needed.
script/.../config.example.sh, script/.../helperFunctions.sh Updated configuration variables by replacing NETWORKS_FILE_PATH with NETWORKS_JSON_FILE_PATH and adjusting file paths and error messages accordingly.
script/utils/network.ts Removed the getAllNetworks, getMnemonic, and accounts functions that previously read network names from a plain text file.

Possibly related PRs

  • Update Cronos deployment #846: Involves modifications to how the NETWORK variable is populated, transitioning from reading a plain text file to using a JSON file for network data.
  • Deploy to Lisk #875: Related changes in updating how the NETWORK variable is populated, transitioning from reading a plain text file to using a JSON file specified by NETWORKS_JSON_FILE_PATH.
  • Deploy berachain #978: Focuses on modifying how the NETWORK variable is populated using jq to read from a JSON file, similar to the changes in this PR.

Suggested reviewers

  • ezynda3
  • 0xDEnYO
  • maxklenk

Tip

CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb56fd1 and dc5f1c9.

📒 Files selected for processing (1)
  • script/utils/network.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: audit-verification
  • GitHub Check: run-unit-tests
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: generate-tag
🔇 Additional comments (1)
script/utils/network.ts (1)

1-30:

❓ Verification inconclusive

This file appears to be partially deprecated, but still contains the node_url function.

Based on the PR objective to deprecate the networks file and the previous review comment asking if this file is used at all, it seems that this file was intended to be fully deprecated. However, only some functions were removed (getMnemonic, accounts, getAllNetworks) while the node_url function remains.

If the node_url function is still needed, consider documenting its continued use. If not, this file should be completely removed and any dependencies updated.


🏁 Script executed:

#!/bin/bash
# Check if this file is still imported or referenced anywhere in the codebase
echo "Checking for imports of network.ts..."
rg -l "import .* from ['\"].*network['\"]" --type ts

echo "Checking for direct references to the file..."
rg -l "network\.ts" --type ts

echo "Checking specific references to node_url function..."
rg -l "node_url" --type ts

Length of output: 1446


Action Required: Clarify the Status of node_url in script/utils/network.ts

After verification, we've confirmed that the node_url function is still imported and used in multiple demo scripts (e.g., in files like demoSynapseBridge.ts, demoPolygonBridge.ts, demoOptimismBridge.ts, among others). Since the original PR objective was to deprecate the networks file but the node_url function remains actively referenced, please take one of the following actions:

  • If node_url is still needed:
    Document its continued use clearly both within this file and in your project documentation, so its purpose and scope are well understood.

  • If node_url is not intended for long-term use:
    Remove the function from script/utils/network.ts and update all dependent demo scripts accordingly.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
script/tasks/acceptOwnershipTransferPeriphery.sh (1)

48-50: ⚠️ Potential issue

Correct Logging Variable in the For-Loop
Inside the loop over networks, the script echoes the selected network using the variable $NETWORK instead of the loop variable $CURRENT_NETWORK. This can lead to incorrect or confusing log messages. Update the echo statement to use $CURRENT_NETWORK to ensure clarity.
Example diff:

-    echo "[info] now executing transfer ownership script in network: $NETWORK"
+    echo "[info] now executing transfer ownership script in network: $CURRENT_NETWORK"
🧹 Nitpick comments (16)
script/tasks/diamondSyncSigs.sh (2)

23-24: Use of JSON-Based Network Selection
Transitioning to a jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" call—piped into gum filter—instead of a static file read greatly improves flexibility and data structure. Please confirm that the environment variable NETWORKS_JSON_FILE_PATH is correctly set, that the JSON file is valid, and consider adding an error check if no networks are returned.


127-131: Clarify Overall Exit Code Management
Inside the retry loop, the script conditionally sets a variable named RETURN on failure. Because this variable is used later in the function’s final exit check, its value might be overwritten across iterations. It would be more robust to initialize a status variable at the start of the function and accumulate errors from each network iteration. This would clarify the overall success state.

script/tasks/diamondEMERGENCYPause.sh (1)

25-27: Consistent Network Selection from JSON
Replacing the plain-text file read with a JSON-based extraction using jq and gum filter is a positive change. Ensure that NETWORKS_JSON_FILE_PATH points to a valid JSON file and consider error handling if the JSON is empty or malformed.

script/tasks/diamondUpdatePeriphery.sh (1)

21-24: Adoption of JSON-Based Network Selection
The new approach—using jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" piped to gum filter—effectively replaces the previous file read method for selecting networks. Just ensure that NETWORKS_JSON_FILE_PATH is defined and that its JSON structure matches the expected format.

script/tasks/updateFacetConfig.sh (1)

20-22: Improved Network Array Input Handling
Using

IFS=$'\n' read -r -d '' -a NETWORKS < <(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum choose --no-limit)

to capture the selected network names into an array is an effective update. (Note that using -d '' expects a null terminator. You might consider using mapfile for improved clarity and portability if the target shell supports it.)

script/tasks/diamondSyncDEXs.sh (1)

22-24: Consistent JSON-Based Network Selection for DEX Syncing
Switching to retrieve network keys using jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" with gum filter maintains a consistent approach across all scripts. As with the other changes, please verify that the JSON file is correctly formatted and that there is adequate error handling when no networks are selected.

script/deploy/deployFacetAndAddToDiamond.sh (1)

24-26: Refactor Local Variable Declaration for NETWORK
The command now reads the network from the JSON file using jq and pipes it to gum filter. However, ShellCheck (SC2155) warns about declaring and assigning the variable on the same line. Consider separating the declaration from assignment.
Example diff:

-    local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+    local NETWORK
+    NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 24-24: Declare and assign separately to avoid masking return values.

(SC2155)

script/utils/diamondEMERGENCYPauseGitHub.sh (1)

175-178: Adopt Structured JSON for Network Enumeration
The updated loop correctly reads network keys from the JSON file via jq and populates the NETWORKS array. This not only improves maintainability but also standardizes network data access across the scripts. Consider adding error handling in case the JSON file is missing or the jq command fails, to further harden this code segment.

archive/scripts/removeUnusableFunctionsForImmutable.sh (1)

20-21: Improve Declaration Style for Local NETWORK Variable
The function now uses jq to extract network keys from the JSON file. To satisfy ShellCheck recommendations and enhance readability, separate the declaration and assignment for NETWORK.
Example diff:

-  local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+  local NETWORK
+  NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 20-20: Declare and assign separately to avoid masking return values.

(SC2155)

script/tasks/acceptOwnershipTransferPeriphery.sh (1)

31-32: Separate Declaration from Assignment for NETWORK
Similar to other scripts, please split the declaration and assignment when reading the network from the JSON file to comply with best practices and address ShellCheck SC2155.
Example diff:

-    local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+    local NETWORK
+    NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 31-31: Declare and assign separately to avoid masking return values.

(SC2155)

archive/scripts/Tasks/diamondMakeImmutable.sh (1)

16-17: Enhance Local Variable Declaration for NETWORK
The updated network selection now uses jq to extract from the JSON file. To address ShellCheck (SC2155) concerns, separate the declaration and assignment of NETWORK as shown below:

-  local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+  local NETWORK
+  NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")

This adjustment improves clarity and prevents potential masking of return values.

🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 16-16: Declare and assign separately to avoid masking return values.

(SC2155)

script/tasks/checkExecutorAndReceiver.sh (1)

50-50: Declare and Assign NETWORK Separately to Avoid Masking Return Values

ShellCheck suggests separating the declaration of local variables from their assignment. This can help avoid inadvertently masking return values. Consider refactoring as follows:

-    local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+    local NETWORK
+    NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 50-50: Declare and assign separately to avoid masking return values.

(SC2155)

script/tasks/diamondUpdateSgConfig.sh (1)

30-30: Scope the NETWORK Variable Locally to Prevent Global Leakage

In this changed segment, the NETWORK variable is assigned without an explicit local declaration. To ensure that its scope is limited to the function and to follow best practices, consider declaring it locally and separating the assignment:

-	NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network...")
+	local NETWORK
+	NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network...")
script/scriptMaster.sh (3)

121-121: Separate Declaration and Assignment for NETWORK Variable

At line 121, the NETWORK variable is declared and assigned in one statement. To avoid masking return values as per ShellCheck’s recommendation, consider splitting the declaration and assignment:

-    local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+    local NETWORK
+    NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 121-121: Declare and assign separately to avoid masking return values.

(SC2155)


248-248: Refactor Variable Declaration in the New Network Use Case

Similarly, at line 248, the NETWORK variable is declared and assigned in a single line. Splitting these statements will help ensure that any potential return value from the command is not masked:

-    local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+    local NETWORK
+    NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 248-248: Declare and assign separately to avoid masking return values.

(SC2155)


503-503: Improve Variable Scoping for NETWORK in Diamond Log Update

At line 503, in the branch handling diamond log updates for a specific network, the same pattern is observed. Splitting the variable declaration from its assignment can enhance clarity and robustness:

-      local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
+      local NETWORK
+      NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 503-503: Declare and assign separately to avoid masking return values.

(SC2155)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40480a1 and b481869.

📒 Files selected for processing (16)
  • archive/scripts/Tasks/diamondMakeImmutable.sh (1 hunks)
  • archive/scripts/removeUnusableFunctionsForImmutable.sh (1 hunks)
  • script/config.example.sh (1 hunks)
  • script/deploy/deployFacetAndAddToDiamond.sh (1 hunks)
  • script/helperFunctions.sh (4 hunks)
  • script/scriptMaster.sh (3 hunks)
  • script/tasks/acceptOwnershipTransferPeriphery.sh (1 hunks)
  • script/tasks/checkExecutorAndReceiver.sh (1 hunks)
  • script/tasks/diamondEMERGENCYPause.sh (1 hunks)
  • script/tasks/diamondSyncDEXs.sh (1 hunks)
  • script/tasks/diamondSyncSigs.sh (1 hunks)
  • script/tasks/diamondUpdatePeriphery.sh (1 hunks)
  • script/tasks/diamondUpdateSgConfig.sh (1 hunks)
  • script/tasks/updateFacetConfig.sh (1 hunks)
  • script/utils/diamondEMERGENCYPauseGitHub.sh (1 hunks)
  • script/utils/network.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • script/utils/network.ts
🧰 Additional context used
🧠 Learnings (2)
script/tasks/diamondEMERGENCYPause.sh (1)
Learnt from: 0xDEnYO
PR: lifinance/contracts#715
File: script/utils/diamondEMERGENCYPauseGitHub.sh:127-127
Timestamp: 2024-11-12T09:43:10.543Z
Learning: In `script/utils/diamondEMERGENCYPauseGitHub.sh`, temporary hardcoded network lists may be included during testing in pull requests, with the plan to remove them before merging into the main branch.
script/utils/diamondEMERGENCYPauseGitHub.sh (1)
Learnt from: 0xDEnYO
PR: lifinance/contracts#715
File: script/utils/diamondEMERGENCYPauseGitHub.sh:127-127
Timestamp: 2024-11-12T09:43:10.543Z
Learning: In `script/utils/diamondEMERGENCYPauseGitHub.sh`, temporary hardcoded network lists may be included during testing in pull requests, with the plan to remove them before merging into the main branch.
🪛 Shellcheck (0.10.0)
archive/scripts/Tasks/diamondMakeImmutable.sh

[warning] 16-16: Declare and assign separately to avoid masking return values.

(SC2155)

archive/scripts/removeUnusableFunctionsForImmutable.sh

[warning] 20-20: Declare and assign separately to avoid masking return values.

(SC2155)

script/deploy/deployFacetAndAddToDiamond.sh

[warning] 24-24: Declare and assign separately to avoid masking return values.

(SC2155)

script/config.example.sh

[warning] 68-68: NETWORKS_JSON_FILE_PATH appears unused. Verify use (or export if used externally).

(SC2034)

script/tasks/checkExecutorAndReceiver.sh

[warning] 50-50: Declare and assign separately to avoid masking return values.

(SC2155)

script/tasks/acceptOwnershipTransferPeriphery.sh

[warning] 31-31: Declare and assign separately to avoid masking return values.

(SC2155)

script/scriptMaster.sh

[warning] 121-121: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 248-248: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 503-503: Declare and assign separately to avoid masking return values.

(SC2155)

script/helperFunctions.sh

[warning] 2020-2020: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 2152-2152: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 2857-2857: Declare and assign separately to avoid masking return values.

(SC2155)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: run-unit-tests
  • GitHub Check: generate-tag
🔇 Additional comments (7)
script/tasks/diamondEMERGENCYPause.sh (1)

162-167: Caution: Early Exit on Already Paused Diamond
Within the handleNetwork function, the script calls exit 0 when detecting that the diamond is already paused. This abrupt exit may bypass additional network processing if multiple networks were expected. Please verify that this behavior is intentional; if parallel processing is desired across networks, consider collecting and reporting statuses before exiting.

script/tasks/diamondUpdatePeriphery.sh (1)

77-81: Verify Deployment Address File Path Formation
The concatenation that creates deployment files (e.g.

ADDRS="deployments/$NETWORK.$FILE_SUFFIX""json"
```) may result in filenames such as `network.productionjson` if `FILE_SUFFIX` does not include a terminating dot. Verify that the `getFileSuffix` function returns the correct value or explicitly add a period before `json` if needed.

</details>
<details>
<summary>script/config.example.sh (1)</summary>

`67-69`: **Ensure Consistency and External Usage of the New JSON Network Variable**

The variable `NETWORKS_JSON_FILE_PATH` now clearly points to the JSON file containing network details. Please confirm that all dependent scripts reference this variable correctly. If this variable is meant to be used externally (for example, by sourced scripts), consider exporting it.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 Shellcheck (0.10.0)</summary>

[warning] 68-68: NETWORKS_JSON_FILE_PATH appears unused. Verify use (or export if used externally).

(SC2034)

</details>

</details>

</details>
<details>
<summary>script/helperFunctions.sh (4)</summary>

`1969-1977`: **Update to use structured JSON for network retrieval in `getAllNetworksArray`.**  
The function now sets  
```bash
local FILE="$NETWORKS_JSON_FILE_PATH"

ensuring that network names are read from the intended JSON file rather than from a plain text file. This aligns with the PR objective of standardizing the network configuration format.


2016-2028: Consistent JSON-based filtering in getIncludedNetworksArray.
The changes modify the variable assignment so that the function reads from

local FILE="$NETWORKS_JSON_FILE_PATH"

and later uses the output of

jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH"

to populate the array. This ensures that the inclusion/exclusion logic properly uses the new JSON configuration.

🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 2020-2020: Declare and assign separately to avoid masking return values.

(SC2155)


2152-2159: Modernized user network selection in getUserSelectedNetwork.
Instead of reading from a plain text file, the function now retrieves the network names from

jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network..."

This not only improves consistency with the rest of the scripts but also provides a better user experience by leveraging gum filter for interactive selection. Ensure that NETWORKS_JSON_FILE_PATH is correctly set in your environment.

🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 2152-2152: Declare and assign separately to avoid masking return values.

(SC2155)


2852-2862: Robust chain ID retrieval in getChainId using the JSON file.
The function now checks for the existence of the JSON file via

if [[ ! -f "$NETWORKS_JSON_FILE_PATH" ]]; then
  echo "Error: JSON file '$NETWORKS_JSON_FILE_PATH' not found." >&2
  return 1
fi

and then retrieves the chain ID with:

local CHAIN_ID=$(jq -r --arg network "$NETWORK" '.[$network].chainId // empty' "$NETWORKS_JSON_FILE_PATH")

This update solidifies the move to a structured JSON approach and helps prevent misconfiguration.

🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 2857-2857: Declare and assign separately to avoid masking return values.

(SC2155)

@mirooon mirooon marked this pull request as ready for review February 25, 2025 18:36
@0xDEnYO 0xDEnYO changed the title Depricated networks file Deprecated networks file Feb 26, 2025
0xDEnYO
0xDEnYO previously approved these changes Feb 26, 2025
@mirooon mirooon merged commit bfed9d2 into main Feb 26, 2025
23 of 24 checks passed
@mirooon mirooon deleted the lf-10381-depricate-networks-file branch February 26, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants