@defillama/sdk 5.0.129 → 5.0.131

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.
@@ -106,12 +106,12 @@ class LlamaProvider extends ethers_1.FallbackProvider {
106
106
  runners.splice(1, 0, primaryRunner);
107
107
  }
108
108
  runners = runners.slice(0, attempts);
109
- if (this.chainName === 'rsk' && method === 'getLogs') {
110
- const hostString = (0, env_1.getEnvValue)('RSK_ARCHIVAL_RPC');
111
- if (!hostString)
112
- throw new Error('RSK public nodes dont support getLogs. need to set RSK_ARCHIVAL_RPC');
113
- runners = hostString.split(',').map(host => ({ url: host }));
114
- }
109
+ // if (this.chainName === 'rsk' && method === 'getLogs') {
110
+ // const hostString = getEnvValue('RSK_ARCHIVAL_RPC')
111
+ // if (!hostString)
112
+ // throw new Error('RSK public nodes dont support getLogs. need to set RSK_ARCHIVAL_RPC');
113
+ // (runners as any) = hostString.split(',').map(host => ({ url: host }))
114
+ // }
115
115
  for (const runner of runners) {
116
116
  try {
117
117
  const result = await httpRPC[method](runner.url, params);
@@ -10,7 +10,6 @@ const generalUtil_1 = require("../generalUtil");
10
10
  const debugLog_1 = require("./debugLog");
11
11
  const cosmos_1 = require("./cosmos");
12
12
  const cache_1 = require("./cache");
13
- const blockscout_1 = require("./blockscout");
14
13
  const p_limit_1 = __importDefault(require("p-limit"));
15
14
  const env_1 = require("./env");
16
15
  const defaultChains = ["avax", "bsc", "polygon", "arbitrum"];
@@ -159,16 +158,6 @@ async function _lookupBlock(timestamp, extraParams) {
159
158
  var _a, _b;
160
159
  const { allowedTimeRange = 5 * 60, acceptableBlockImprecision = 10 } = extraParams !== null && extraParams !== void 0 ? extraParams : {};
161
160
  const chain = (_a = extraParams === null || extraParams === void 0 ? void 0 : extraParams.chain) !== null && _a !== void 0 ? _a : "ethereum";
162
- if (blockscout_1.blockscoutEndpoints[chain]) {
163
- try {
164
- const block = await (0, blockscout_1.getBlockscoutBlock)(timestamp, chain);
165
- addBlockToCache(block);
166
- return block;
167
- }
168
- catch (e) { // fallback to usual way of fetching logs
169
- (0, debugLog_1.debugLog)('error fetching block from blockscout', e, chain);
170
- }
171
- }
172
161
  if (chain === 'waves') {
173
162
  const api = `https://nodes.wavesnodes.com/blocks/heightByTimestamp/${timestamp}`;
174
163
  const { data } = await (0, axios_1.default)(api);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "5.0.129",
3
+ "version": "5.0.131",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -1,6 +0,0 @@
1
- export declare const blockscoutEndpoints: any;
2
- export declare function getBlockscoutBlock(timestamp: number, chain: string): Promise<{
3
- timestamp: number;
4
- block: number;
5
- number: number;
6
- }>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBlockscoutBlock = exports.blockscoutEndpoints = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- exports.blockscoutEndpoints = {
9
- // celo: 'https://celo.blockscout.com',
10
- onus: 'https://explorer.onuschain.io',
11
- base: 'https://base.blockscout.com',
12
- // scroll: 'https://blockscout.scroll.io',
13
- canto: 'https://explorer.plexnode.wtf',
14
- };
15
- async function getBlockscoutBlock(timestamp, chain) {
16
- const api = `${exports.blockscoutEndpoints[chain]}/api?module=block&action=getblocknobytime&timestamp=${timestamp}&closest=before`;
17
- const { data } = await (0, axios_1.default)(api);
18
- if (data.status !== '1')
19
- throw new Error('Issue fetching block from blockscout: ' + api);
20
- return {
21
- timestamp,
22
- block: +data.result.blockNumber,
23
- number: +data.result.blockNumber,
24
- };
25
- }
26
- exports.getBlockscoutBlock = getBlockscoutBlock;