mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 22:43:12 +08:00
pass ton key
This commit is contained in:
@@ -70,6 +70,7 @@ const ENV_KEYS = [
|
||||
'SMARDEX_SUBGRAPH_API_KEY',
|
||||
'PROXY_AUTH',
|
||||
'ALLIUM_API_KEY',
|
||||
'TON_API_KEY',
|
||||
]
|
||||
|
||||
Object.keys(DEFAULTS).forEach(i => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user