@defillama/sdk 3.0.11 → 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.
Files changed (2) hide show
  1. package/build/abi/index.js +19 -1
  2. package/package.json +1 -1
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {