Skip to content

Instantly share code, notes, and snippets.

View rollendxavier's full-sized avatar

Rollend Xavier rollendxavier

View GitHub Profile
@rollendxavier
rollendxavier / Function.cs
Last active January 2, 2025 04:36
Leveraging CoinGecko API with Azure Functions for Serverless Crypto Solutions
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using System.Net;
using System.Net.Mail;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
@rollendxavier
rollendxavier / Index.js
Created November 13, 2024 11:16
Node.js program integrating Web3.js, the CoinGecko API
const https = require('https');
const Web3 = require('web3');
const axios = require('axios');
require('dotenv').config();
const fs = require('fs');
const express = require('express');
// Load environment variables
const COINGECKO_API_KEY = process.env.COINGECKO_API_KEY;
@rollendxavier
rollendxavier / MyToken.sol
Created November 13, 2024 11:14
Solidity Contract File
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MyToken {
    string public name = "MyToken";
    string public symbol = "MTK";
    uint8 public decimals = 18;
    uint256 public totalSupply = 1000000 * 10 ** uint256(decimals);
    mapping(address => uint256) public balanceOf;
@rollendxavier
rollendxavier / truffle-config.js
Created November 13, 2024 11:09
Configuring Truffle for Deployment
const HDWalletProvider = require("@truffle/hdwallet-provider");
const infuraKey = "YOUR_INFURA_KEY";
const mnemonic = "your 12-word mnemonic";
module.exports = {
networks: {
rinkeby: {
provider: () => new HDWalletProvider(mnemonic, `https://rinkeby.infura.io/v3/${infuraKey}`),
network_id: 4, // Rinkeby ID
gas: 5500000,
@rollendxavier
rollendxavier / route.ts
Last active May 10, 2024 07:47
Trending pools code
import { FrameRequest, getFrameMessage, getFrameHtmlResponse } from '@coinbase/onchainkit';
import { NextRequest, NextResponse } from 'next/server';
import { NEXT_PUBLIC_URL } from '../../config';
import { getChartOptions } from '../lib/getChartOptions';
import { throwErr } from '../lib/throwErr';
async function getResponse(req: NextRequest): Promise<NextResponse> {
let text: string | undefined = '';
let pool: any | undefined = {};
let chain: string = '';
@rollendxavier
rollendxavier / page.tsx
Last active May 8, 2024 23:04
Page code for Farcaster
import { getFrameMetadata } from '@coinbase/onchainkit';
import type { Metadata } from 'next';
import { NEXT_PUBLIC_URL } from './config';
const frameMetadata = getFrameMetadata({
buttons: [
{
label: 'Trending Crypto Pools',
},
{
@rollendxavier
rollendxavier / index.html
Created April 8, 2024 15:20
Price Prediction UI
<!DOCTYPE html>
<html>
<head>
<title>Crypto Predictor</title>
</head>
<body>
<h1>Crypto Predictor</h1>
<form method="POST">
<label for="coin_id">Coin ID:</label><br>
<select id="coin_id" name="coin_id">
@rollendxavier
rollendxavier / predictor.py
Created April 8, 2024 15:17
Predicting Cryptocurrency Prices with Machine Learning and the CoinGecko API
from flask import Flask, jsonify, render_template, request
import requests
import json
import numpy as np
from sklearn.linear_model import LinearRegression
import time
from sklearn.preprocessing import MinMaxScaler
from datetime import datetime, timedelta
app = Flask(__name__)
@rollendxavier
rollendxavier / bot.py
Created April 8, 2024 14:44
Building a Comprehensive Telegram Crypto Bot with Python
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
import requests
import json
# Define your CoinGecko API key
api_key = 'YOUR_COINGECKO_API_KEY'
# Function to fetch cryptocurrency data from CoinGecko
def get_crypto_data(crypto):
@rollendxavier
rollendxavier / express.js
Last active March 11, 2024 03:27
Price Tracker - express.js
const express = require('express');
const axios = require('axios');
const app = express();
app.get('/api/v3/coins/:id/history', (req, res) => {
  const url = `https://api.coingecko.com/api/v3/coins/${req.params.id}/history`;
  axios.get(url, {
    params: req.query,
    headers: {