keep-starknet-strange / vault

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

Implement /get_historical_balance Endpoint #39

Closed LucasLvy closed 1 month ago

LucasLvy commented 2 months ago

Issue: Implement /get_historical_balance Endpoint

Description

We need to implement the /get_historical_balance endpoint in the Vault backend. This endpoint is responsible for retrieving the historical balance of an account.

Details

Request Parameters:

Response:

[
  {
    "date": "2024-03-29",
    "balance": "0x1234567890abcdef"
  },
  {
    "date": "2024-03-28",
    "balance": "0x234567890abcdef123"
  },
  ...
]

Notes:

The historical balance is represented as an array of objects, each containing a date and the corresponding balance in hexadecimal format.

Example

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

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

// Define the get_historical_balance endpoint
app.get('/get_historical_balance', async (request, reply) => {
    try {
        // Logic to retrieve historical balance goes here

        // Return the historical balance
        return [
            {
                "date": "2024-03-29",
                "balance": "0x1234567890abcdef"
            },
            {
                "date": "2024-03-28",
                "balance": "0x234567890abcdef123"
            },
            ...
        ];
    } catch (error) {
        // Handle errors
        console.error('Error while retrieving historical balance:', error);
        return reply.status(500).send({ error: 'Internal Server Error' });
    }
});

Tasks:

EjembiEmmanuel commented 2 months ago

@LucasLvy can I work on this?

LucasLvy commented 2 months ago

Hey yes i'll assign this to you. I see you commented multiple issues, let's do one by one and don't forget the tests! also can you please either give me your telegram handle or send me a message ? mine is lucasLvy

EjembiEmmanuel commented 2 months ago

Great! I'm excited to contribute to your project. I'll leave you a message on Telegram.