lfglabs-dev / api.starknet.quest

starknet.quest rust backend
2 stars 17 forks source link

Implement parse_string #268

Open Marchand-Nicolas opened 6 days ago

Marchand-Nicolas commented 6 days ago

Description

264

265

263

Implement parse_string: this issue should be easy, but is only doable after the three issues above (I will assign someone to this issue when the ones above are merged). Implement the parse_string function (located in src\utils.rs) to the calldata and the regex for the verify_contract route and to the api_url and regex for the verify_custom_api route. The goal is to have a more modular task system, where we can use dynamic strings when configuring tasks.

Agbeleshe commented 3 days ago

Hello, i'm interested in fixing this issue. I would love to make it my first contribution. thank you :)

onlydustapp[bot] commented 3 days ago

Hi @Agbeleshe! Maintainers during the ODHack # 8.0 will be tracking applications via OnlyDust. Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

onlydustapp[bot] commented 2 days ago

Hi @vickiddev! Maintainers during the ODHack # 8.0 will be tracking applications via OnlyDust. Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

Gift-Naomi commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a web3/frontend developer

How I plan on tackling this issue

  1. Modular Parsing Setup: Implement the parse_string function in src/utils.rs to handle dynamic string parsing for the calldata and regex in the verify_contract route.

  2. API Route Integration: Extend the function to support parsing the api_url and regex for the verify_custom_api route, ensuring flexibility with configurable dynamic strings.

  3. Testing and Modularity: Ensure the function is modular and reusable across different task configurations. Add unit tests for both routes to verify correct parsing behavior.

augustin-v commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I started teaching myself programming since June,with Rust as my first programming language. Having no contributions yet, I would be very happy to make this my first one. I have experience with leet code and completed Node Guardians's thinking in Cairo so I know that I can do this. In hopes that you consider me, thank you very much.

How I plan on tackling this issue

I would write the function using the 'Option' to handle cases where parsing might not match, and return 'None' when no valid data is found. If I encounter any issue, I will make sure to communicate

jimenezz22 commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am an active member of the Dojo Coding community in Costa Rica, with experience in Cairo, having built onchain games like ByteBeasts and contributed to open-source projects such as CairoLint, where I implemented tests for Cairo lints. Additionally, I taught Cairo during the Starknet Bootcamp for Dojo Coding. I also have experience with TypeScript, contributing to Starknet Quest by developing components like ComboBoxes, among others.

How I plan on tackling this issue

Approach for the Issue:

Understand Dependencies:

Before starting, I will review the previously merged issues to ensure the foundation for parse_string is ready. This will help avoid conflicts and ensure that the necessary structures are already in place. Review parse_string Requirements:

The parse_string function in src/utils.rs will be responsible for parsing dynamic strings for specific tasks: Calldata and Regex: For the verify_contract route, I will ensure that the function correctly processes and validates the calldata using regex. API URL and Regex: Similarly, for the verify_custom_api route, I will ensure that parse_string processes and validates API URLs dynamically. Implement Modular Parsing Logic:

I will implement a modular approach to allow dynamic strings in task configuration. The parsing function will: Take a string input (from calldata or API URL). Apply the appropriate regex patterns based on the task route. Return structured data that can be used for further task processing. Test and Validate the Function:

I will write tests to validate the parse_string function, ensuring that it works with a variety of input strings and correctly applies the regex for both verify_contract and verify_custom_api. Integrate with Task System:

Finally, I will ensure the parse_string function integrates seamlessly into the task system, allowing dynamic strings to be configured and used across different tasks. Estimated Time to Completion: 1-2 days, depending on complexity and edge cases.

thesledge04 commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in Rust programming, including working with string manipulation and regular expressions. This will help ensure that the parse_string function is efficiently implemented. I understand how to work with API routes and the importance of modular code, allowing for dynamic configurations that enhance the system's flexibility. I possess strong analytical skills that enable me to identify edge cases and potential issues within the implementation, ensuring robustness in the solution. I am comfortable collaborating with team members, providing clear documentation and updates throughout the implementation process, which aids in smoother code reviews and integration.

How I plan on tackling this issue

Approach to Implementing the parse_string Function

Review the requirements and intended use of the parse_string function within the context of the project. This function is likely designed to handle dynamic string parsing for task configuration, enhancing modularity in the system. Examine the files and areas where parse_string will be implemented: src/utils.rs and the routes for verify_contract and verify_custom_api. Review Dependencies and Related Issues:

Ensure that the three issues you mentioned above are fully merged, as they might provide essential context or dependencies needed for the implementation of parse_string. Understand how these dependencies affect the parameters or behaviors expected in parse_string. Define the Function Signature:

Determine the appropriate function signature for parse_string. Consider what input parameters it needs and what output it should return. For instance: rust fn parse_string(input: &str) -> Result<String, ParseError> { // Implementation will go here } Decide whether it needs to return a Result type to handle potential errors during parsing. Implement the Parsing Logic:

Utilize Rust’s built-in string handling and regular expressions (using the regex crate) to develop the logic within parse_string. Consider: What kind of dynamic strings you expect to encounter. How to extract or transform parts of the string based on your requirements. Example of a basic parsing implementation:

rust

use regex::Regex;

fn parse_string(input: &str) -> Result<String, ParseError> { let re = Regex::new(r"your_regex_pattern").unwrap(); if let Some(captures) = re.captures(input) { // Process captures and return the desired output return Ok(processed_string); } Err(ParseError::new("Failed to parse input")) } Integrate with verify_contract and verify_custom_api Routes:

Locate the existing implementation for the verify_contract and verify_custom_api routes. Replace or modify the current handling of calldata and API URLs to use parse_string. This might involve changing how inputs are processed and ensuring that they are fed into parse_string. Ensure that the results from parse_string are appropriately handled (e.g., returning results or errors as necessary). Testing the Implementation:

Write unit tests for parse_string to cover a range of valid and invalid inputs. Ensure that the function behaves as expected in different scenarios. Test the entire flow through verify_contract and verify_custom_api to confirm that the new parsing logic integrates smoothly without introducing any bugs. Documentation:

Document the functionality of parse_string within the codebase, explaining its purpose and how to use it. Update any relevant API documentation if necessary to reflect changes in how routes handle dynamic strings. Create a Pull Request (PR):

Push your changes to a new branch and create a PR, describing the implementation and any tests added. Highlight that this functionality builds upon the previous issues that have been merged.

devcollinss commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

My name is Collins Ikechukwu. I'm a full stack blockchain developer developer.

How I plan on tackling this issue

Steps to Implement:

  1. Understand the Existing Context

    • Review the previous issues and merged code to understand the structure of the verify_contract and verify_custom_api routes.
    • Check how calldata and api_url are currently handled to ensure compatibility with dynamic string processing.
  2. Implement parse_string Function

    • In the src/utils.rs file, create a function named parse_string that accepts the relevant parameters (e.g., calldata, api_url).
    • Use regex to parse and process dynamic strings.
      • For verify_contract, the function should handle the calldata parsing with regex patterns to ensure it conforms to expected formats.
      • For verify_custom_api, the function will process the api_url dynamically, allowing task configurations to vary based on input.
    • Ensure the function is modular and reusable for other potential dynamic strings in the future.
  3. Testing and Validation

    • Once the function is implemented, ensure it is tested rigorously:
      • Create unit tests for parse_string to validate that it correctly handles various dynamic string inputs.
      • Test it within the context of the verify_contract and verify_custom_api routes to ensure it integrates smoothly and behaves as expected.
  4. Review and Documentation

    • After the implementation, document the function in the codebase, explaining how it works, the expected inputs, and outputs.
    • Ensure that other developers understand how and where to use parse_string when handling dynamic strings in the future.
ShantelPeters commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i am a blockchain developer , with vast knowlegde in html, css , react, javascript,typescript etc. i would love to be given an opportunity to contribute to this ecosystem

How I plan on tackling this issue

Once issues #264, #265, and #263 are merged, implement the parse_string function in src/utils.rs. This function should handle calldata and regex for the verify_contract route, and also manage the API URL and regex for the verify_custom_api route, enabling a more modular and dynamic task configuration system.

abdegenius commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a skilled fullstack developer with a wealth of experience in both frontend and backend JavaScript as well as my knowledge of Rustlang, With a solid foundation in testing,I have mastered frameworks like Mocha, Chai, and Jest to ensure robust, reliable code in every project. In addition to traditional web development, I have a strong background in blockchain technology, with hands-on experience in Solidity for Ethereum-based smart contracts. Moreover, I have delved into the emerging world of StarkNet, working with Cairo, a cutting-edge language tailored for STARKs, making them a versatile developer capable of bridging both traditional and decentralized web applications.

How I plan on tackling this issue

The procedure to achieve this task have been outlined in the description already.

aokiji233 commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi ! I'm a fullstack developer with 4 years of experience, living in france. I recently developed a strong interest in web3 and especially in starknet ecosystem I would love to leverage my knowledge with contributions to your exciting project !

How I plan on tackling this issue

I would create a utility that takes a string and a FieldElement address as inputs, replacing placeholders {addr_hex} and {addr_dec} in the string with the address's hexadecimal and decimal representations, respectively. Using Rust's string manipulation methods, I would replace these placeholders and ensure proper error handling and input validation. I will test it a lot to get it as robust as possible, let's gooooo

JoelVR17 commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

UI: Implement parse_string

Hello Starknet Quest team,

I am Joel Vargas, and I'm a member of Dojo Coding. I also come from OnlyDust.

I would like to request the assignment of the issue related to Implement parse_string. Below is my proposed approach for implementing this issue:

How I plan on tackling this issue

Implementation Plan

STEP 1: Understand the existing implementation of the parse_string function.
Description: I will review the current code in src/utils.rs to comprehend how the parse_string function is expected to work and how it integrates with the calldata and verify_contract route.

STEP 2: Implement the parse_string function.
Description: I will code the parse_string function to handle dynamic strings effectively. This will enhance the modularity of our task system, allowing for dynamic configurations.

STEP 3: Integrate the parse_string function with existing routes.
Description: I will connect the parse_string function with the regex for the verify_contract route, as well as the API URL and regex for the verify_custom_api route, ensuring that both routes utilize the newly implemented function.

STEP 4: Testing.
Description: I will write unit tests to ensure the correctness of the parse_string function and its integration with the existing system.

Goal

The goal is to have a more modular task system, allowing us to utilize dynamic strings when configuring tasks effectively.

I look forward to your feedback on my approach!

Rajubhub commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Here's a possible implementation of the parse_string function in Rust:

use regex::Regex;
use std::collections::HashMap;

pub fn parse_string(
    input: &str,
    regex_str: &str,
    data: HashMap<String, String>,
) -> Result<String, String> {
    // Compile the regular expression
    let regex = match Regex::new(regex_str) {
        Ok(r) => r,
        Err(e) => return Err(format!("Invalid regex: {}", e)),
    };

    // Replace placeholders with data
    let mut output = input.to_string();
    for cap in regex.captures_iter(input) {
        for (name, value) in data.iter() {
            if let Some(pos) = cap.name(name) {
                output = output.replace(&pos.as_str(), value);
            }
        }
    }

    Ok(output)
}

Example usage:

fn main() {
    let mut data = HashMap::new();
    data.insert("contract".to_string(), "my_contract".to_string());
    data.insert("api_url".to_string(), "https://api.example.com".to_string());

    // Verify contract route
    let input = "/verify/contract/{contract}";
    let regex = "\\{([a-zA-Z_]+)\\}";
    let parsed = parse_string(input, regex, data.clone()).unwrap();
    println!("{}", parsed); // Output: /verify/contract/my_contract

    // Verify custom

How I plan on tackling this issue

By the see the projects

PabloVillaplana commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Full Stack developer with 6 years of experience in the industry, I am super excited to be able to contribute to Web 3 projects, this to continue paving my way as an Open Source Contributor. I am from Dojo Coding Community

How I plan on tackling this issue

Hey Nicolas, could I take this issue, I would like to collaborate again on Starknet Quest. đź‘€

MatiasAchucarro commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a passionate and results-driven web developer, currently deepening my knowledge in web3 technologies, Cairo, and open-source development through Dojo Coding. My skill set includes expertise in JavaScript, React, HTML, CSS, C# with .NET Entity Framework, and more. I also have experience with tools like Git, GitHub, SQL Server, and Postman. My focus has been on building solid web applications, from task lists to full-fledged CRUD systems, with front-end, back-end, and database integration.

I have already made a contribution to the open-source ecosystem, and I am eager to engage in more projects, particularly those involving Cairo/Rust.

How I plan on tackling this issue

o implement parse_string, I would first review the previous issues to ensure proper integration. Then, I would design the function to handle dynamic strings using regex for both verify_contract and verify_custom_api. The goal is to modularize tasks and allow dynamic configurations. Finally, I would test its integration to ensure it works correctly within the relevant routes.

LazarusAA commented 1 day ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am Alvaro Lazarus a passionate blockchain developer, Ive recently worked quite a lot with Cairo and Rust and I think this Issue is perfect to put this abilities into practice, Ive worked with Starknet Quest before and I'm looking to contributing farther

How I plan on tackling this issue

I would work on implementing the parse_string function in src/utils.rs as soon as the #264 #265 #263 issues are resolved.

Would love to help on this issue Lazarus

suhas-sensei commented 13 hours ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Whew, looks like a ton of applications up there. Working as a Meme-Driven Dev back at Gobblchain, I'm left kind of feeling that i have the required go-to's that can fix the issue at stake on your end.

with my previous experiences in personal projects and hackathons, I can whip up some real solutions—probably with a one-liner or two and a laugh along the way. [it's my first ODHack :)]

How I plan on tackling this issue

consider it done officer

Luluameh commented 55 minutes ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience with Rust and implementing modular systems. I’ve worked with string parsing, regex, and dynamic task configuration, making me well-suited for this task.

How I plan on tackling this issue

I’d start by reviewing the codebase and issues #264, #265, and #263 for context. Then, I’d implement parse_string by integrating calldata and regex for verify_contract and verify_custom_api routes, ensuring the system remains modular and dynamic.