lfglabs-dev / api.starknet.quest

starknet.quest rust backend
7 stars 28 forks source link

Parse string utils function #264

Closed Marchand-Nicolas closed 1 month ago

Marchand-Nicolas commented 1 month ago

Description

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

petersdt commented 1 month ago

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

onlydustapp[bot] commented 1 month ago

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.

onlydustapp[bot] commented 1 month 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.

martinvibes commented 1 month ago

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

onlydustapp[bot] commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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:

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 commented 1 month ago

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 commented 1 month 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

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.

MatiasAchucarro commented 1 month 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, 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 commented 1 month ago

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

Marchand-Nicolas commented 1 month ago

Done here: https://github.com/lfglabs-dev/api.starknet.quest/pull/271