pass ton key

This commit is contained in:
g1nt0ki
2025-11-03 22:37:33 +01:00
parent edd9c5f68d
commit 0b69408813
2 changed files with 7 additions and 1 deletions

View File

@@ -70,6 +70,7 @@ const ENV_KEYS = [
'SMARDEX_SUBGRAPH_API_KEY',
'PROXY_AUTH',
'ALLIUM_API_KEY',
'TON_API_KEY',
]
Object.keys(DEFAULTS).forEach(i => {

View File

@@ -24,8 +24,13 @@ async function getBlock(timestamp, chain, chainBlocks, undefinedOk = false) {
}
}
async function get(endpoint, options) {
async function get(endpoint, options = {}) {
const tonApiKey = getEnv('TON_API_KEY')
try {
if (tonApiKey && endpoint.includes('tonapi.io')) {
if (!options.headers) options.headers = {}
options.headers['Authorization'] = tonApiKey
}
const data = (await axios.get(endpoint, options)).data
return data
} catch (e) {