@defillama/sdk 4.0.47 → 4.0.49
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/index.js +5 -5
- package/build/abi/tron.js +11 -6
- package/build/index.d.ts +1 -0
- package/build/index.js +2 -1
- package/build/providers.json +1 -1
- package/build/util/cache.d.ts +12 -11
- package/build/util/cache.js +208 -59
- package/build/util/internal-cache.d.ts +11 -0
- package/build/util/internal-cache.js +68 -0
- package/build/util/r2.d.ts +3 -0
- package/build/util/r2.js +113 -0
- package/package.json +3 -1
package/build/abi/index.js
CHANGED
|
@@ -89,7 +89,7 @@ var general_1 = require("../general");
|
|
|
89
89
|
var multicall3_1 = __importDefault(require("./multicall3"));
|
|
90
90
|
var convertResults_1 = __importDefault(require("./convertResults"));
|
|
91
91
|
var debugLog_1 = require("../util/debugLog");
|
|
92
|
-
var
|
|
92
|
+
var internal_cache_1 = require("../util/internal-cache");
|
|
93
93
|
var util_1 = require("../util");
|
|
94
94
|
var Tron = __importStar(require("./tron"));
|
|
95
95
|
var nullAddress = '0x0000000000000000000000000000000000000000';
|
|
@@ -307,7 +307,7 @@ function cachedCall(params) {
|
|
|
307
307
|
chain: params.chain,
|
|
308
308
|
address: params.target,
|
|
309
309
|
};
|
|
310
|
-
cachedValue = (0,
|
|
310
|
+
cachedValue = (0, internal_cache_1.getCache)(cacheObject);
|
|
311
311
|
if (cachedValue)
|
|
312
312
|
return [2 /*return*/, {
|
|
313
313
|
output: cachedValue
|
|
@@ -317,7 +317,7 @@ function cachedCall(params) {
|
|
|
317
317
|
value = _a.sent();
|
|
318
318
|
if (value) {
|
|
319
319
|
cacheObject.value = value.output;
|
|
320
|
-
(0,
|
|
320
|
+
(0, internal_cache_1.setCache)(cacheObject);
|
|
321
321
|
}
|
|
322
322
|
return [2 /*return*/, value];
|
|
323
323
|
}
|
|
@@ -351,7 +351,7 @@ function cachedMultiCall(params) {
|
|
|
351
351
|
chain: params.chain,
|
|
352
352
|
address: value.contract,
|
|
353
353
|
};
|
|
354
|
-
var cachedValue = (0,
|
|
354
|
+
var cachedValue = (0, internal_cache_1.getCache)(cacheObject);
|
|
355
355
|
if (cachedValue) {
|
|
356
356
|
response[i] = {
|
|
357
357
|
input: { target: value.contract, params: value.params, },
|
|
@@ -378,7 +378,7 @@ function cachedMultiCall(params) {
|
|
|
378
378
|
address: value.input.target,
|
|
379
379
|
value: value.output
|
|
380
380
|
};
|
|
381
|
-
(0,
|
|
381
|
+
(0, internal_cache_1.setCache)(cacheObject);
|
|
382
382
|
}
|
|
383
383
|
response[missingIndices[i]] = value;
|
|
384
384
|
});
|
package/build/abi/tron.js
CHANGED
|
@@ -293,14 +293,19 @@ function post(body, endpoint) {
|
|
|
293
293
|
if (body === void 0) { body = {}; }
|
|
294
294
|
if (endpoint === void 0) { endpoint = '/wallet/triggerconstantcontract'; }
|
|
295
295
|
return __awaiter(this, void 0, void 0, function () {
|
|
296
|
-
var response;
|
|
296
|
+
var host, headers, response;
|
|
297
297
|
return __generator(this, function (_a) {
|
|
298
298
|
switch (_a.label) {
|
|
299
|
-
case 0:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
case 0:
|
|
300
|
+
host = getEndpoint();
|
|
301
|
+
headers = { 'Content-Type': 'application/json' };
|
|
302
|
+
if (process.env.TRON_PRO_API_KEY)
|
|
303
|
+
headers['TRON-PRO-API-KEY'] = process.env.TRON_PRO_API_KEY;
|
|
304
|
+
return [4 /*yield*/, (0, node_fetch_1.default)(host + endpoint, {
|
|
305
|
+
method: 'post',
|
|
306
|
+
body: JSON.stringify(body),
|
|
307
|
+
headers: headers,
|
|
308
|
+
})];
|
|
304
309
|
case 1:
|
|
305
310
|
response = _a.sent();
|
|
306
311
|
return [2 /*return*/, response.json()];
|
package/build/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { ChainApi } from './ChainApi';
|
|
|
3
3
|
export { getProvider, setProvider } from './general';
|
|
4
4
|
export * as util from "./generalUtil";
|
|
5
5
|
export * as cache from "./util/cache";
|
|
6
|
+
export * as sdkCache from "./util/internal-cache";
|
|
6
7
|
export * as api from "./api";
|
|
7
8
|
export * as api2 from "./api2";
|
|
8
9
|
export * as blocks from "./computeTVL/blocks";
|
package/build/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.humanizeNumber = exports.logTable = exports.log = exports.blocks = exports.api2 = exports.api = exports.cache = exports.util = exports.setProvider = exports.getProvider = exports.ChainApi = void 0;
|
|
26
|
+
exports.humanizeNumber = exports.logTable = exports.log = exports.blocks = exports.api2 = exports.api = exports.sdkCache = exports.cache = exports.util = exports.setProvider = exports.getProvider = exports.ChainApi = void 0;
|
|
27
27
|
var debugLog_1 = require("./util/debugLog");
|
|
28
28
|
var ChainApi_1 = require("./ChainApi");
|
|
29
29
|
Object.defineProperty(exports, "ChainApi", { enumerable: true, get: function () { return ChainApi_1.ChainApi; } });
|
|
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "getProvider", { enumerable: true, get: function
|
|
|
32
32
|
Object.defineProperty(exports, "setProvider", { enumerable: true, get: function () { return general_1.setProvider; } });
|
|
33
33
|
exports.util = __importStar(require("./generalUtil"));
|
|
34
34
|
exports.cache = __importStar(require("./util/cache"));
|
|
35
|
+
exports.sdkCache = __importStar(require("./util/internal-cache"));
|
|
35
36
|
exports.api = __importStar(require("./api"));
|
|
36
37
|
exports.api2 = __importStar(require("./api2"));
|
|
37
38
|
exports.blocks = __importStar(require("./computeTVL/blocks"));
|