@defillama/sdk 3.0.10 → 3.0.12

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.
@@ -58,13 +58,31 @@ var multicall_1 = __importDefault(require("./multicall"));
58
58
  var convertResults_1 = __importDefault(require("./convertResults"));
59
59
  var debugLog_1 = require("../util/debugLog");
60
60
  var util_1 = require("../util");
61
+ var knownTypes = ['string', 'uint8', 'uint256', 'address',];
61
62
  var defaultChunkSize = !!process.env.SDK_MULTICALL_CHUNK_SIZE ? +process.env.SDK_MULTICALL_CHUNK_SIZE : 500;
62
63
  function resolveABI(providedAbi) {
63
64
  var abi = providedAbi;
64
65
  if (typeof abi === "string") {
65
66
  abi = cachedABIs_1.default[abi];
66
67
  if (abi === undefined) {
67
- throw new Error("ABI method undefined");
68
+ var _a = providedAbi.split(':'), outputType = _a[0], name_1 = _a[1];
69
+ if (!knownTypes.includes(outputType) || !name_1)
70
+ throw new Error("ABI method undefined");
71
+ abi = {
72
+ constant: true,
73
+ inputs: [],
74
+ name: name_1,
75
+ outputs: [
76
+ {
77
+ internalType: outputType,
78
+ name: "",
79
+ type: outputType,
80
+ },
81
+ ],
82
+ payable: false,
83
+ stateMutability: "view",
84
+ type: "function",
85
+ };
68
86
  }
69
87
  }
70
88
  // If type is omitted DP's sdk processes it fine but we don't, so we need to add it
@@ -13,7 +13,7 @@ export declare function lookupBlock(timestamp: number, extraParams?: {
13
13
  chain?: Chain | "terra" | "kava" | "algorand";
14
14
  }): Promise<{
15
15
  timestamp: number;
16
- block: any;
16
+ block: number;
17
17
  }>;
18
18
  export declare function getLogs(params: {
19
19
  target: Address;
@@ -167,10 +167,9 @@ function lookupBlock(timestamp, extraParams) {
167
167
  return [4 /*yield*/, res.json()];
168
168
  case 2:
169
169
  data = _e.sent();
170
- console.log(data);
171
170
  return [2 /*return*/, {
172
171
  timestamp: timestamp,
173
- block: data.result.blockNumber
172
+ block: +data.result.blockNumber
174
173
  }];
175
174
  case 3:
176
175
  low = (_b = intialBlocks[chain]) !== null && _b !== void 0 ? _b : 100;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "3.0.10",
3
+ "version": "3.0.12",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {