@defillama/sdk 5.0.77 → 5.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/multicall3.js +3 -3
- package/build/abi/tron.d.ts +2 -0
- package/build/abi/tron.js +3 -1
- package/build/providers.json +1 -1
- package/build/util/LlamaProvider.js +3 -2
- package/build/util/env.js +2 -2
- package/build/util/logs.js +3 -0
- package/package.json +1 -1
|
@@ -168,11 +168,12 @@ function setProvider(chain, provider) {
|
|
|
168
168
|
exports.setProvider = setProvider;
|
|
169
169
|
function getProvider(chain = "ethereum", _getArchivalNode = false) {
|
|
170
170
|
var _a, _b;
|
|
171
|
+
const rpcKey = chain === 'tron' ? 'tron_evm' : chain;
|
|
171
172
|
if (exports.providers[chain])
|
|
172
173
|
return exports.providers[chain];
|
|
173
174
|
// use RPC from env variable if set else use RPC from providers.json
|
|
174
|
-
let rpcList = (0, env_1.getChainRPCs)(
|
|
175
|
-
let archivalRPCList = (0, env_1.getArchivalRPCs)(
|
|
175
|
+
let rpcList = (0, env_1.getChainRPCs)(rpcKey, (_a = providers_json_1.default[chain]) === null || _a === void 0 ? void 0 : _a.rpc);
|
|
176
|
+
let archivalRPCList = (0, env_1.getArchivalRPCs)(rpcKey);
|
|
176
177
|
if (!rpcList) {
|
|
177
178
|
// @ts-ignore (throwing error here would alter function behavior and have side effects)
|
|
178
179
|
return null;
|
package/build/util/env.js
CHANGED
|
@@ -12,6 +12,7 @@ const defaultEnvValues = {
|
|
|
12
12
|
INTERNAL_SDK_CACHE_FILE: './cache.json',
|
|
13
13
|
TRON_RPC_CONCURRENCY_LIMIT: '5',
|
|
14
14
|
TRON_RPC: 'https://api.trongrid.io',
|
|
15
|
+
TRON_EVM_RPC: 'https://rpc.ankr.com/tron_jsonrpc',
|
|
15
16
|
NAKA_RPC: 'https://node.nakachain.xyz',
|
|
16
17
|
ETHF_RPC: 'https://rpc.dischain.xyz/',
|
|
17
18
|
CORE_RPC: "https://rpc.coredao.org,https://rpc.ankr.com/core,https://1rpc.io/core,https://rpc-core.icecreamswap.com",
|
|
@@ -101,8 +102,7 @@ function getArchivalRPCs(chain) {
|
|
|
101
102
|
}
|
|
102
103
|
exports.getArchivalRPCs = getArchivalRPCs;
|
|
103
104
|
function getChainRPCs(chain, defaultList = []) {
|
|
104
|
-
const
|
|
105
|
-
const envValue = getEnvValue(key);
|
|
105
|
+
const envValue = getEnvRPC(chain);
|
|
106
106
|
if (defaultList.length) {
|
|
107
107
|
const listString = defaultList.join(',');
|
|
108
108
|
if (envValue)
|
package/build/util/logs.js
CHANGED
|
@@ -6,6 +6,7 @@ const ethers_1 = require("ethers");
|
|
|
6
6
|
const blocks_1 = require("./blocks");
|
|
7
7
|
const cache_1 = require("./cache");
|
|
8
8
|
const debugLog_1 = require("./debugLog");
|
|
9
|
+
const tron_1 = require("../abi/tron");
|
|
9
10
|
const currentVersion = 'v3';
|
|
10
11
|
async function getLogs(options) {
|
|
11
12
|
let { target, chain = 'ethereum', fromBlock, toBlock, fromTimestamp, toTimestamp, eventAbi, topic, topics, extraTopics, // can be passed as input as extra filter arguments
|
|
@@ -30,6 +31,8 @@ async function getLogs(options) {
|
|
|
30
31
|
return res.flat();
|
|
31
32
|
return res;
|
|
32
33
|
}
|
|
34
|
+
if (chain === 'tron')
|
|
35
|
+
target = (0, tron_1.hexifyTarget)(target);
|
|
33
36
|
let iface;
|
|
34
37
|
if (eventAbi)
|
|
35
38
|
iface = new ethers_1.Interface([eventAbi]);
|