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

Parse string utils function #264

Closed
Marchand-Nicolas opened this issue Sep 21, 2024 · 13 comments
Closed

Parse string utils function #264

Marchand-Nicolas opened this issue Sep 21, 2024 · 13 comments
Assignees
Labels
Good first issue Good for newcomers 🍒 Nice to have Nice to have but not a priority OD Hack 8 Issue reserved for the OD Hack 8

Comments

@Marchand-Nicolas
Copy link
Collaborator

Marchand-Nicolas commented Sep 21, 2024

Description

  • Write a function in the utils section (src\utils.rs) called parse_string that takes as an argument: a string, and an address (FieldElement). It should replace any occurrence in the specified string of: {addr_hex} by the given address (in hex format), and {addr_dec) by the given address (in decimal format).

→ There are utils functions to work with FieldElements, e.g. to_hex in src\utils.rs

@Marchand-Nicolas Marchand-Nicolas added 🍒 Nice to have Nice to have but not a priority Good first issue Good for newcomers OD Hack 8 Issue reserved for the OD Hack 8 labels Sep 21, 2024
@petersdt
Copy link

hi @Marchand-Nicolas kindly assign me this task i would like to make it my first contribution to the starknet quest api project

Copy link

onlydustapp bot commented Sep 24, 2024

Hi @petersdt!
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.

Copy link

onlydustapp bot commented Sep 25, 2024

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.

@martinvibes
Copy link

hello @dmirgaleev i am a frontend dev and blockchain developer
please can i work on this issue :) and would love to be a contributor

Copy link

onlydustapp bot commented Sep 25, 2024

Hi @martinvibes!
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.

@PoulavBhowmick03
Copy link
Contributor

PoulavBhowmick03 commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Poulav Bhowmick, a software engineer at Invisible Studios with a robust background in TypeScript, Rust, Solidity Cairo, fullstack development and blockchain technology. My experience includes building robust applications, optimizing functionalities and blockchain integration. I have actively participated in events and open source contributions, enhancing my capability to tackle real-world tech challenges. My projects can be viewed on my GitHub Profile and OnlyDust Profile. Plus I´m active member of Starknet, Ethereum ecosystem.

How I plan on tackling this issue

I will implement the parse_string utility function as follows:

Define the Function:
I'll create a new function parse_string in src/utils.rs that takes two parameters: a String and an address of type FieldElement.

Convert FieldElement to Hex and Decimal:
Using existing utility functions like to_hex in src/utils.rs, I'll convert the FieldElement address into both hex and decimal string formats.

Replace Placeholders:
I'll use Rust's str::replace method to replace all occurrences of {addr_hex} with the hex representation of the address and {addr_dec} with the decimal representation within the input string.

Return the Result:
The final string with the replaced values will be returned as the result of the parse_string function.
I'll ensure the function is efficient, well-tested, and handles edge cases such as when {addr_hex} or {addr_dec} doesn't exist in the input string.

ETA - 3 days

@SoarinSkySagar
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

GM, I am Sagar Rana, a smart contract developer and full stack engineer. I have 3 years of experience building robust full stack applications and over a year of writing smart contracts. You can see my projects and contributions to some major repos on my GitHub profile. The tech stack I use mainly includes Solidity, Rust, JavaScript and Typescript. I am also contributing to the Starknet and Rust ecosystems and building on Cairo and Rust languages. I am interested in contributing to projects like this to learn more about these technologies and help make these projects better. Please assign me as I would be really glad to be a contributor in this project! :)

How I plan on tackling this issue

Hi @Marchand-Nicolas, I would approach this issue like this:

  • Create a function parse_string in src/utils.rs to replace {addr_hex} and {addr_dec} with the given address in hex and decimal formats:
use crate::utils::FieldElement;
use crate::utils::to_hex;

pub fn parse_string(input: &str, address: FieldElement) -> String {
    let hex_address = to_hex(address);
    let dec_address = address.to_string();

    input
        .replace("{addr_hex}", &hex_address)
        .replace("{addr_dec}", &dec_address)
}
  • Test this function to see it works as desired

Tasks:

  • Implement parse_string function

ETA: 1 Day

@thesledge04
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in Rust programming, particularly in developing utilities and functions for smart contracts. My background in implementing modular code can help streamline tasks like creating dynamic string parsing functions, enhancing the flexibility and functionality of the codebase.

How I plan on tackling this issue

Create parse_string function.
Convert address to hex and decimal.
Replace placeholders in the string.
Return the modified string.
Implement tests for validation.

@aokiji233
Copy link

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

To implement the parse_string function in utils.rs, 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. The function would be thoroughly tested to handle various input scenarios, ensuring robust performance and correctness.

@jsanchez556
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, I’m Jose Mario from Costa Rica. With over 15 years of experience in development, I am passionate about contributing to open-source projects and currently expanding my skill set with Rust, Cairo, and Solidity as part of my involvement with Dojo Coding.I am eager to apply my extensive experience and newly acquired skills to new challenges and innovative projects.

How I plan on tackling this issue

  1. Create parse_string function that takes a string (input) and a FieldElement address as parameters.
  2. Convert address to hexadecimal.
  3. Convert hexadecimal address to decimal
  4. Replaces addr_hex in the input string with the hexadecimal string and addr_dec with the decimal string
  5. Finally return string with replaced placeholders

@MatiasAchucarro
Copy link

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, and C# with .NET Entity Framework, among others. 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 Starknet Quest, and I am eager to take on more opportunities

How I plan on tackling this issue

To implement parse_string in src/utils.rs, I would define the function with a string and a FieldElement as parameters. I would use functions like to_hex to convert the address to both hexadecimal and decimal formats. Then, I would apply string manipulation methods to replace occurrences of {addr_hex} and {addr_dec} with their respective representations. Finally, I would return the modified string.

@jsanchez556
Copy link
Contributor

@Marchand-Nicolas Thank you for the incredible opportunity to collaborate on this amazing project!

jsanchez556 added a commit to jsanchez556/api.starknet.quest that referenced this issue Sep 27, 2024
Marchand-Nicolas added a commit that referenced this issue Sep 28, 2024
@Marchand-Nicolas
Copy link
Collaborator Author

Done here: #271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Good for newcomers 🍒 Nice to have Nice to have but not a priority OD Hack 8 Issue reserved for the OD Hack 8
Projects
None yet
Development

No branches or pull requests

10 participants