Skip to content

Instantly share code, notes, and snippets.

View jongan69's full-sized avatar
🎯
WEB3D

Jonathan Gan jongan69

🎯
WEB3D
View GitHub Profile
import os
import schedule
import time
import tweepy
import textwrap
from dotenv import load_dotenv
from random import randint
from openai import OpenAI
@jongan69
jongan69 / .env
Created July 8, 2024 05:27
/lock_in buy bot
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
PRIVATE_KEY=your-wallet-private-key
SOLANA_RPC_ENDPOINT=https://api.mainnet-beta.solana.com
FIXED_AMOUNT=1 # Replace with the fixed amount you want to buy every time
@jongan69
jongan69 / SOL_TO_SPL.rs
Created June 29, 2024 18:32
hOW MUCH LOCKIN IS ONE SOL WORTH
// SOL to SPL token price
use anyhow::{format_err, Result};
use reqwest::Client;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
use std::error::Error as StdError;
use std::time::{SystemTime, UNIX_EPOCH};
// Constants
@jongan69
jongan69 / get_address_from_txid.rs
Created June 29, 2024 18:28
Bc I needed to filter kraken transactions by who deposited
// get_address_from_txid.rs
use bdk::bitcoin::{Txid, Network};
use bdk::bitcoin::util::address::Address;
use bdk::electrum_client::Client as ElectrumClient;
use bdk::bitcoin::consensus::encode::deserialize;
use bdk::bitcoin::Transaction as BitcoinTransaction;
use bdk::electrum_client::ElectrumApi;
use bdk::bitcoin::psbt::serialize::Serialize;
use std::str::FromStr;
@jongan69
jongan69 / Cargo.toml
Created June 29, 2024 18:21
lockmaxxing
[package]
name = "juptest"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = { version = "1", features = ["full"] }
solana-sdk = "1.16"
jupiter-swap-api-client = "0.1.0"
reqwest = "0.11.10" # Use a compatible version of reqwest
@jongan69
jongan69 / Cargo.toml
Created June 29, 2024 15:45
Get the USD price of lockin
[package]
name = "raytest"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0"
reqwest = { version = "0.11", features = ["blocking", "json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
@jongan69
jongan69 / wallet.rs
Created June 29, 2024 07:49
Solana Wallet generation and base58 string output
use solana_sdk::{signature::Keypair, signer::Signer};
use bs58;
fn main() {
let wallet = Keypair::new();
let public_key_base58 = bs58::encode(wallet.pubkey().to_bytes()).into_string();
let secret_key_base58 = bs58::encode(wallet.to_bytes()).into_string();
println!("Public Key (Base58): {}\nSecret Key (Base58): {}\n", public_key_base58, secret_key_base58);
}
@jongan69
jongan69 / load_env.sh
Created June 26, 2024 03:42
To use this script: Make the script executable: bash Copy code chmod +x load_env.sh Run the script: bash Copy code source ./load_env.sh This script will read the .env file, export each variable to the current shell environment, and keep the shell open if running interactively. The source command is used to run the script in the current shell ses…
#!/bin/bash
# Function to export variables from .env file
export_env_vars() {
local env_file=$1
if [ ! -f "$env_file" ]; then
echo "The file $env_file does not exist."
return 1
fi
@jongan69
jongan69 / server.js
Last active June 14, 2024 08:12
Version 2 of the buy wallet tracker , still testing for memechan
// A server that receives POST data that is printed to the console for debugging purposes
const http = require('http');
const server = http.createServer((req, res) => {
if (req.method === 'POST') {
let data = '';
req.on('data', (chunk) => {
data += chunk;
});
@jongan69
jongan69 / worker.js
Last active June 11, 2024 04:40
Telegram Wallet Interaction Bot with some memechan integration
const TELEGRAM_BOT_TOKEN = BOT_TOKEN;
const TELEGRAM_CHAT_ID = CHAT_ID;
const HELIUS_API_KEY = API_KEY;
const HELIUS_RPC_URL = `https://mainnet.helius-rpc.com/?api-key=${HELIUS_API_KEY}`;
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {