Skip to content
View 87300120Aood's full-sized avatar
🌴
Adminbox.net❤️[internet.interface.def.ins]
🌴
Adminbox.net❤️[internet.interface.def.ins]

Block or report 87300120Aood

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
87300120Aood/README.md

-import requests import time

base_url = "https://api.1inch.dev/token" headers = { "Authorization": "Bearer [YOUR_API_KEY]", "accept": "application/json" }

def search_tokens(query, chain_id, limit=10, ignore_listed="false"): endpoint = f"/v1.2/{chain_id}/search" params = { "query": query, "limit": limit, "ignore_listed": ignore_listed } response = requests.get(base_url + endpoint, headers=headers, params=params) if response.status_code == 200: return response.json() else: print(f"Failed to search tokens. Status code: {response.status_code}") return None

def get_tokens_info(chain_id, addresses): endpoint = f"/v1.2/{chain_id}/custom/{','.join(addresses)}" response = requests.get(base_url + endpoint, headers=headers ) if response.status_code == 200: return response.json() else: print(f"Failed to get tokens info. Status code: {response.status_code}") return None

def get_all_tokens_info(chain_id, cf_ipcountry=None, provider="1inch", country=None): endpoint = f"/v1.2/{chain_id}" params = { "cf-ipcountry": cf_ipcountry, "provider": provider, "country": country } response = requests.get(base_url + endpoint, headers=headers, params=params) if response.status_code == 200: return response.json() else: print(f"Failed to get all tokens info. Status code: {response.status_code}") return None

def get_1inch_token_list(chain_id, cf_ipcountry=None, provider="1inch", country=None): endpoint = f"/v1.2/{chain_id}/token-list" params = { "cf-ipcountry": cf_ipcountry, "provider": provider, "country": country } response = requests.get(base_url + endpoint, headers=headers, params=params) if response.status_code == 200: return response.json() else: print(f"Failed to get 1inch token list. Status code: {response.status_code}") return None

if name == "main": # Step 3: Search for tokens search_query = "1inch" chain_id = 1 # Replace with the chain ID you want to search on search_results = search_tokens(search_query, chain_id) print("Search Results:") print(search_results) # sleep one second because of RPS limit time.sleep(1)

# Step 4: Get detailed information about specific tokens
token_addresses = ["0x111111111117dc0aa78b770fa6a738034120c302"]  # Replace with token addresses you want to query
tokens_info = get_tokens_info(chain_id, token_addresses)
print("Tokens Info:")
print(tokens_info)
# sleep one second because of RPS limit
time.sleep(1)

# Step 5: Get information about all tokens supported by 1inch
all_tokens_info = get_all_tokens_info(chain_id)
print("All Tokens Info:")
print(all_tokens_info)
# sleep one second because of RPS limit
time.sleep(1)

# Step 6: Get 1inch token list
token_list = get_1inch_token_list(chain_id)
print("1inch Token List:")
print(token_list)

chat.html -x.com

Pinned Loading

  1. Family-organizer-since-2024 Family-organizer-since-2024 Public