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

Add functionality to specify pre-deployed addresses in contract deployment and interaction tabs #189

Closed
wants to merge 9 commits into from

Conversation

sweep-ai[bot]
Copy link

@sweep-ai sweep-ai bot commented Oct 31, 2023

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

Description

This PR adds functionality to the Starknet Remix Plugin that allows users to specify pre-deployed addresses in the contract deployment tab and the contract interaction tab. Users can now enter a class hash or contract address in a modal dialog that opens when clicking on the plus symbol button in the respective tabs. The entered value is then used to fetch the corresponding contract class or contract address from the Starknet network using the provided RPC endpoints. The fetched contract class is added to the selection drop-down in the contract deployment tab and the contract interaction tab.

Summary of Changes

  • Added a plus symbol button to the contract deployment tab and the contract interaction tab.
  • Implemented a modal dialog that opens when the plus symbol button is clicked, allowing users to enter a class hash or contract address.
  • Added functions to fetch contract classes and addresses from the Starknet network using the provided RPC endpoints.
  • Imported the fetchClass and fetchAddress functions in the contract deployment component.
  • Updated the event handler for the input box to call the appropriate fetch function based on the entered value (class hash or contract address).
  • Added the fetched contract class to the selection drop-down in the contract deployment tab and the contract interaction tab.

Fixes #188.


🎉 Latest improvements to Sweep:

  • Sweep can now passively improve your repository! Check out Rules to learn more.

💡 To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

Copy link
Author

sweep-ai bot commented Oct 31, 2023

Sandbox Executions

  • Check plugin/src/features/Deployment/index.tsx
Sandbox logs for https://github.com/NethermindEth/starknet-remix-plugin/commit/ce389f22f1d99ba747ab334639c8293a1d1b07f8
trunk fmt plugin/src/features/Deployment/index.tsx || exit 0 1/2 ✓
 ✔ Formatted plugin/src/features/Deployment/index.tsx
Re-checking autofixed files...


Checked 1 file
✔ No issues
trunk check --fix --print-failures plugin/src/features/Deployment/index.tsx 2/2 ✓
Checked 1 file
✔ No issues
  • Check plugin/src/utils/fetchContract.ts
Sandbox logs for https://github.com/NethermindEth/starknet-remix-plugin/commit/87c34dd74be36b45ba8281efbe6e2c38e3f3987a
trunk fmt plugin/src/utils/fetchContract.ts || exit 0 1/2 ✓
 ✔ Formatted plugin/src/utils/fetchContract.ts
Re-checking autofixed files...


Checked 1 file
✔ No issues
trunk check --fix --print-failures plugin/src/utils/fetchContract.ts 2/2 ✓
Checked 1 file
✔ No issues
  • Check plugin/src/features/Deployment/index.tsx
Sandbox logs for
trunk fmt plugin/src/features/Deployment/index.tsx || exit 0 1/2 ✓
  FAILURES  
 prettier  plugin/src/features/Deployment/index.tsx  .trunk/out/iV2TW.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk check --fix --print-failures plugin/src/features/Deployment/index.tsx 2/2 ❌ (`1`)
  FAILURES  
 prettier  plugin/src/features/Deployment/index.tsx  .trunk/out/UNrGs.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 1 file
✖ No issues, 1 failure
# .trunk/out/UNrGs.yaml
trunk_cli_version: 1.17.1
title: prettier exited with exit_code=2
report:
  - prettier exited with exit_code=2
  - linter:
      command: |
        /root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin/prettier -w plugin/src/features/Deployment/index.tsx
      stdin_path: (none)
      run_from: /tmp/trunk-0/X0JnDi/OYk5M1
      timeout: 10m
      rerun: (cd /tmp/trunk-0/X0JnDi/OYk5M1; env -i PATH=/root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin:/root/.cache/trunk/tools/node/18.12.1-00ae74f39ac4de3ff3c7e3686016ebf3/bin:/root/.cache/trunk/tools/node/18.12.1-00ae74f39ac4de3ff3c7e3686016ebf3:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root NODE_PATH=/root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules /root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin/prettier -w plugin/src/features/Deployment/index.tsx)
      affects_cache:
        []
      direct_configs:
        []
      exit_status: exited
      exit_code: 2
      stdout: (none)
      stderr: |
        [error] plugin/src/features/Deployment/index.tsx: SyntaxError: Declaration or statement expected. (116:11)
        [error]   114 |             'toast',
        [error]   115 |             `ℹ️ Contract with classHash: ${selectedContract.sierraClassHash} already has been declared, proceeding to deployment...`
        [error] > 116 |           )
        [error]       |           ^
        [error]   117 |         } catch (error) {
        [error]   118 |           const declareResponse = await account.declare({
        [error]   119 |             contract: selectedContract.sierra,
    parser: |
      (none)
  • Check plugin/src/features/Deployment/index.tsx
Sandbox logs for
trunk fmt plugin/src/features/Deployment/index.tsx || exit 0 1/2 ✓
  FAILURES  
 prettier  plugin/src/features/Deployment/index.tsx  .trunk/out/46Gn8.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk check --fix --print-failures plugin/src/features/Deployment/index.tsx 2/2 ❌ (`1`)
  FAILURES  
 prettier  plugin/src/features/Deployment/index.tsx  .trunk/out/BHY7L.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 1 file
✖ No issues, 1 failure
# .trunk/out/BHY7L.yaml
trunk_cli_version: 1.17.1
title: prettier exited with exit_code=2
report:
  - prettier exited with exit_code=2
  - linter:
      command: |
        /root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin/prettier -w plugin/src/features/Deployment/index.tsx
      stdin_path: (none)
      run_from: /tmp/trunk-0/9LP8cV/tcj8tA
      timeout: 10m
      rerun: (cd /tmp/trunk-0/9LP8cV/tcj8tA; env -i PATH=/root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin:/root/.cache/trunk/tools/node/18.12.1-00ae74f39ac4de3ff3c7e3686016ebf3/bin:/root/.cache/trunk/tools/node/18.12.1-00ae74f39ac4de3ff3c7e3686016ebf3:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NODE_PATH=/root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules HOME=/root /root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin/prettier -w plugin/src/features/Deployment/index.tsx)
      affects_cache:
        []
      direct_configs:
        []
      exit_status: exited
      exit_code: 2
      stdout: (none)
      stderr: |
        [error] plugin/src/features/Deployment/index.tsx: SyntaxError: Declaration or statement expected. (116:11)
        [error]   114 |             'toast',
        [error]   115 |             `ℹ️ Contract with classHash: ${selectedContract.sierraClassHash} already has been declared, proceeding to deployment...`
        [error] > 116 |           )
        [error]       |           ^
        [error]   117 |         } catch (error) {
        [error]   118 |           const declareResponse = await account.declare({
        [error]   119 |             contract: selectedContract.sierra,
    parser: |
      (none)
  • Check plugin/src/features/Deployment/index.tsx
Sandbox logs for
trunk fmt plugin/src/features/Deployment/index.tsx || exit 0 1/2 ✓
  FAILURES  
 prettier  plugin/src/features/Deployment/index.tsx  .trunk/out/iV2TW.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 0 files
✖ No issues, 1 failure
trunk check --fix --print-failures plugin/src/features/Deployment/index.tsx 2/2 ❌ (`1`)
  FAILURES  
 prettier  plugin/src/features/Deployment/index.tsx  .trunk/out/UNrGs.yaml
  NOTICES  
 A tool failed to run. You can open the details yaml file for more information.
Checked 1 file
✖ No issues, 1 failure
# .trunk/out/UNrGs.yaml
trunk_cli_version: 1.17.1
title: prettier exited with exit_code=2
report:
  - prettier exited with exit_code=2
  - linter:
      command: |
        /root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin/prettier -w plugin/src/features/Deployment/index.tsx
      stdin_path: (none)
      run_from: /tmp/trunk-0/X0JnDi/OYk5M1
      timeout: 10m
      rerun: (cd /tmp/trunk-0/X0JnDi/OYk5M1; env -i PATH=/root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin:/root/.cache/trunk/tools/node/18.12.1-00ae74f39ac4de3ff3c7e3686016ebf3/bin:/root/.cache/trunk/tools/node/18.12.1-00ae74f39ac4de3ff3c7e3686016ebf3:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root NODE_PATH=/root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules /root/.cache/trunk/tools/prettier/3.0.3-f40a31f1cf22ae011727ab1e40e55171/node_modules/.bin/prettier -w plugin/src/features/Deployment/index.tsx)
      affects_cache:
        []
      direct_configs:
        []
      exit_status: exited
      exit_code: 2
      stdout: (none)
      stderr: |
        [error] plugin/src/features/Deployment/index.tsx: SyntaxError: Declaration or statement expected. (116:11)
        [error]   114 |             'toast',
        [error]   115 |             `ℹ️ Contract with classHash: ${selectedContract.sierraClassHash} already has been declared, proceeding to deployment...`
        [error] > 116 |           )
        [error]       |           ^
        [error]   117 |         } catch (error) {
        [error]   118 |           const declareResponse = await account.declare({
        [error]   119 |             contract: selectedContract.sierra,
    parser: |
      (none)

Copy link
Author

sweep-ai bot commented Oct 31, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

Copy link

vercel bot commented Oct 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
starknet-remix-plugin ❌ Failed (Inspect) Nov 2, 2023 6:03am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant