@defillama/sdk 4.0.22 → 4.0.24

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/tron.js +27 -15
  2. package/package.json +1 -1
package/build/abi/tron.js CHANGED
@@ -101,12 +101,12 @@ function call(options) {
101
101
  decodedResult = __spreadArray([], decodedResult, true);
102
102
  decodedResult.forEach(function (v, i) {
103
103
  if (outputTypes[i] === 'address' && v.startsWith('0x')) {
104
- var newValue = (0, tron_format_address_1.fromHex)(v);
105
- decodedResult[i] = newValue;
106
- var outputName = abi.outputs[i].name;
107
- if (outputName && outputName.length)
108
- decodedResult[outputName] = newValue;
104
+ v = (0, tron_format_address_1.fromHex)(v);
105
+ decodedResult[i] = v;
109
106
  }
107
+ var outputName = abi.outputs[i].name;
108
+ if (outputName && outputName.length)
109
+ decodedResult[outputName] = v;
110
110
  });
111
111
  return [2 /*return*/, {
112
112
  output: (0, convertResults_1.default)(decodedResult),
@@ -117,13 +117,25 @@ function call(options) {
117
117
  }
118
118
  exports.call = call;
119
119
  function multiCall(functionABI, calls) {
120
+ var _a;
120
121
  return __awaiter(this, void 0, void 0, function () {
121
- var returnValues;
122
- return __generator(this, function (_a) {
123
- switch (_a.label) {
124
- case 0: return [4 /*yield*/, executeCalls(functionABI, calls)];
122
+ var inputs_1, returnValues;
123
+ return __generator(this, function (_b) {
124
+ switch (_b.label) {
125
+ case 0:
126
+ if ((_a = functionABI.inputs) === null || _a === void 0 ? void 0 : _a.length) {
127
+ inputs_1 = functionABI.inputs;
128
+ calls.forEach(function (call) {
129
+ var _a;
130
+ (_a = call.params) === null || _a === void 0 ? void 0 : _a.forEach(function (v, i) {
131
+ if (inputs_1[i].type === 'address')
132
+ call.params[i] = hexifyTarget(v);
133
+ });
134
+ });
135
+ }
136
+ return [4 /*yield*/, executeCalls(functionABI, calls)];
125
137
  case 1:
126
- returnValues = _a.sent();
138
+ returnValues = _b.sent();
127
139
  return [2 /*return*/, returnValues.map(function (output, index) {
128
140
  return {
129
141
  input: {
@@ -203,12 +215,12 @@ function executeCalls(functionABI, calls) {
203
215
  var output = __spreadArray([], decodedResult, true);
204
216
  output.forEach(function (v, i) {
205
217
  if (outputTypes[i] === 'address' && v.startsWith('0x')) {
206
- var newValue = (0, tron_format_address_1.fromHex)(v);
207
- output[i] = newValue;
208
- var outputName = functionABI.outputs[i].name;
209
- if (outputName && outputName.length)
210
- output[outputName] = newValue;
218
+ v = (0, tron_format_address_1.fromHex)(v);
219
+ output[i] = v;
211
220
  }
221
+ var outputName = functionABI.outputs[i].name;
222
+ if (outputName && outputName.length)
223
+ output[outputName] = v;
212
224
  });
213
225
  if (output.length === 1)
214
226
  output = output[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "4.0.22",
3
+ "version": "4.0.24",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {