keep-starknet-strange / vault

Empower Your Assets, Redefine Control.
https://vlt.finance
MIT License
23 stars 18 forks source link

Implement /generate_claim_link Endpoint #40

Closed 0xLucqs closed 4 months ago

0xLucqs commented 6 months ago

Description

We need to implement the /generate_claim_link endpoint in the Vault backend. This endpoint is responsible for generating a link that will allow anyone to claim a specific amount of USD.

Details

Request Body:

{
    "amount": 100,
    "address": "0x0123456789abcdefABCDEF0123456789abcdefABCDEF0123456789abcdefABCD"
}

Response:

"https://example.com/claim/1234567890"

Notes:

Example

// Import necessary modules
import fastify from 'fastify';

// Create Fastify instance
const app = fastify({ logger: true });

// Define the generate_claim_link endpoint
app.post('/generate_claim_link', async (request, reply) => {
    try {
        const { amount, address } = request.body;

        // Perform logic to generate claim link based on the provided amount and address
        const link = await generateClaimLink(amount, address);

        // Return the generated claim link
        return { link };
    } catch (error) {
        // Handle errors
        console.error('Error generating claim link:', error);
        return reply.status(500).send({ error: 'Internal Server Error' });
    }
});

// Start the server
app.listen(3000, '0.0.0.0', (err, address) => {
    if (err) throw err;
    console.log(`Server listening on ${address}`);
});

// Dummy function to generate claim link (replace with actual logic)
async function generateClaimLink(amount: number, address: string): Promise<string> {
    // Dummy implementation
    return "https://example.com/claim?token=abc123";
}

Tasks:

EjembiEmmanuel commented 5 months ago

@LucasLvy can I work on this?

MhdSadd commented 5 months ago

Good day @LucasLvy can I pick this up?

0xLucqs commented 5 months ago

Hey no i'll do this one should've assigned it to me sorry