This commit is contained in:
Dobromir Popov 2024-06-10 00:37:17 +03:00
commit e121f9fbee
11 changed files with 146 additions and 7 deletions

4
.env
View File

@ -1,6 +1,6 @@
TTS_BACKEND_URL=https://api.tts.d-popov.com/
TTS_BACKEND_URL=http://192.168.0.10:9009/asr #TTS_BACKEND_URL=http://192.168.0.10:9009/asr
#TTS_BACKEND_URL=http://localhost:9001/asr #gpu 9002-cpu #TTS_BACKEND_URL=http://localhost:9001/asr #gpu 9002-cpu
TTS_BACKEND_URL2=http://localhost:9002/asr TTS_BACKEND_URL2=http://localhost:9002/asr
TTS_BACKEND_URL3=http://192.168.0.10:9008/asr #gpu TTS_BACKEND_URL3=http://192.168.0.10:9008/asr #gpu

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
create a python app that will watch for new pairs on https://www.dextools.io/app/en/pairs (we need to crawl that with JS enabled to pull the actual content) and provide option to execute a HTTP request to an API to inform about the new pair

View File

@ -4,6 +4,12 @@ conda activate devika
which python which python
/config/miniconda3/envs/devika/bin/python -m pip install -r requirements.txt /config/miniconda3/envs/devika/bin/python -m pip install -r requirements.txt
fix browser issue
#apt --fix-broken install
#sudo apt-get update
#sudo apt-get install libnss3
/ui#>? /ui#>?
playwright install --with-deps playwright install --with-deps
npm install npm install

View File

@ -9,12 +9,36 @@
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
# import schedule # # import schedule
import time import time
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager from webdriver_manager.chrome import ChromeDriverManager
import time import time
# pip install requests beautifulsoup4 schedule
# Initialize WebDriver
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)
def check_pairs_sel():
try:
# Open the page
driver.get("https://www.dextools.io/app/en/bnb/pool-explorer")
time.sleep(10) # Wait for JavaScript to execute
# Extract the page source
html = driver.page_source
soup = BeautifulSoup(html, 'html.parser')
# Assuming the pairs are listed in <div> tags with a class that includes the word 'pair'
pairs = soup.find_all('div', class_=lambda x: x and 'pair' in x)
print("Pairs found:", [pair.text for pair in pairs])
finally:
driver.quit()
# Initialize WebDriver # Initialize WebDriver

View File

@ -1 +1,12 @@
https://github.com/ccxt/ccxt/tree/master/examples/py/ https://github.com/ccxt/ccxt/tree/master/examples/py/
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
Browser logs:
<launching> /config/.cache/ms-playwright/chromium-1105/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-kMyQDr --remote-debugging-pipe --no-startup-window
<launched> pid=1019347
[pid=1019347][err] /config/.cache/ms-playwright/chromium-1105/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
[pid=1019347] <process did exit: exitCode=127, signal=null>
[pid=1019347] starting temporary directories cleanup

25
crypto/sol/app.py Normal file
View File

@ -0,0 +1,25 @@
from flask import Flask, render_template, request, jsonify
from solana.rpc.api import Client
app = Flask(__name__)
solana_client = Client("https://api.mainnet-beta.solana.com")
@app.route('/')
def index():
return render_template('index.html')
@app.route('/tokens', methods=['GET'])
def get_tokens():
# Here you would add logic to fetch new tokens or token data
return jsonify(['SOL', 'USDC']) # Example token list
@app.route('/swap', methods=['POST'])
def swap_tokens():
data = request.json
token_name = data['token_name']
amount = data['amount']
# Here you would add logic to perform the token swap
return jsonify({'status': 'success', 'message': f'Swapped {amount} of {token_name}'})
if __name__ == '__main__':
app.run(debug=True)

4
crypto/sol/r.txt Normal file
View File

@ -0,0 +1,4 @@
flask
solana
idna
httpx

28
crypto/sol/static/app.js Normal file
View File

@ -0,0 +1,28 @@
document.getElementById('connectWallet').addEventListener('click', async () => {
try {
const { solana } is window;
if (solana && solana.isPhantom) {
const response = await solana.connect({ onlyIfTrusted: true });
console.log('Connected with Public Key:', response.publicKey.toString());
} else {
alert('Phantom wallet not found. Please install it.');
}
} catch (error) {
console.error(error);
alert('Connection to Phantom Wallet failed');
}
});
document.getElementById('swapToken').addEventListener('click', () => {
const tokenName = document.getElementById('tokenName').value;
const amount = document.getElementById('amount').value;
fetch('/swap', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({token_name: tokenName, amount: amount})
})
.then(response => response.json())
.then(data => alert(data.message));
});

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Token Swapper</title>
</head>
<body>
<h1>Token Swapper</h1>
<div>
<button id="connectWallet">Connect Phantom Wallet</button>
</div>
<div>
<input type="text" id="tokenName" placeholder="Enter Token Name">
<input type="number" id="amount" placeholder="Enter Amount">
<button id="swapToken">Swap Token</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/@solana/web3.js"></script>
<script src="app.js"></script>
</body>
</html>

View File

@ -8,9 +8,9 @@ const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: process.env.SERVER_PORT_WS }); const wss = new WebSocket.Server({ port: process.env.SERVER_PORT_WS });
console.log(process.env) // console.log("ENV="+process.env)
console.log(process.env.TTS_BACKEND_URL) console.log("TTS_BACKEND_URL="+process.env.TTS_BACKEND_URL)
console.log(process.env.WS_URL) console.log("WS_URL="+process.env.WS_URL)
let language = "en"; let language = "en";
let storeRecordings = false; let storeRecordings = false;