This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import reportWebVitals from './reportWebVitals'; | |
import { QueryClient, QueryClientProvider } from "react-query"; | |
const client = new QueryClient(); | |
ReactDOM.render( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { useQuery } from "react-query"; | |
const endpoint = "https://graphql.bitquery.io/"; | |
const QUERY = ` | |
{ | |
bitcoin { | |
blocks(options: {limit: 2}){ | |
height | |
blockHash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function App() { | |
const { data, isLoading, error } = useQuery("bitcoin", () => { //launches | |
return fetch(endpoint, { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
"X-API-KEY": "YOUR API KEY" | |
}, | |
body: JSON.stringify({ query: QUERY }) // ({ QUERY }) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function App() { | |
const { data, isLoading, error } = useQuery("bitcoin", () => { //launches | |
return fetch(endpoint, { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
"X-API-KEY": "YOUR API KEY" | |
}, | |
body: JSON.stringify({ query: QUERY }) // ({ QUERY }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return ( | |
<div> | |
<h1>BitQuery & React</h1> | |
<ul> | |
{data.bitcoin.blocks.map((query) => ( | |
<li key={query.height}>{query.blockHash}</li> | |
))} | |
</ul> | |
</div> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import telebot | |
import requests | |
from decouple import config | |
KEY = config('YOUR TELEGRAM BOT API KEY') | |
API_KEY = config('YOUR BITQUERY.IO API KEY') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_query(query): | |
headers = {'X-API-KEY': YOUR API KEY} | |
request = requests.post('https://graphql.bitquery.io/', json={'query': query}, headers=headers) | |
if request.status_code == 200: | |
return request.json() | |
else: | |
raise Exception('Query failed and return code is {}. {}'.format(request.status_code, query)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The GraphQL query | |
query = """ | |
{ | |
ethereum(network: bsc) { | |
dexTrades( | |
baseCurrency: {is: "BASE ADDRESS TOKEN"} | |
quoteCurrency: {is: "QUOTE ADDRESS TOKEN"} | |
options: {desc: ["block.height", "transaction.index"], limit: 1} | |
) { | |
block { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Telegram Bot instance | |
bot = telebot.TeleBot(KEY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def greeting(message): | |
request = message.text.split() | |
if len(request) < 2 and request[0].lower() in "hello" or request[0].lower() in "hi" or request[0].lower() in "hey": | |
return True | |
else: | |
return False | |
def updated_price(message): | |
request = message.text.split() | |
if len(request) == 2 and request[0].lower() in "get" and request[1].lower() in "price": |
OlderNewer