@defillama/sdk 4.0.76 → 4.0.78
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/ChainApi.d.ts +1 -0
- package/build/ChainApi.js +30 -0
- package/build/abi/abi2.js +4 -0
- package/build/computeTVL/blocks.d.ts +1 -19
- package/build/computeTVL/blocks.js +7 -187
- package/build/generalUtil.js +16 -6
- package/build/providers.json +1 -1
- package/build/util/blocks.d.ts +33 -0
- package/build/util/blocks.js +423 -0
- package/build/util/blockscout.d.ts +6 -0
- package/build/util/blockscout.js +71 -0
- package/build/util/cache.d.ts +5 -0
- package/build/util/cache.js +50 -2
- package/build/util/cosmos.d.ts +11 -0
- package/build/util/cosmos.js +124 -0
- package/build/util/index.d.ts +1 -13
- package/build/util/index.js +22 -281
- package/package.json +1 -1
package/build/ChainApi.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare class ChainApi {
|
|
|
36
36
|
getBalances(): BalancesV1;
|
|
37
37
|
getChainId(): number | undefined;
|
|
38
38
|
removeTokenBalance(token: string): void;
|
|
39
|
+
erc4626Sum({ calls, tokenAbi, balanceAbi, balanceCalls, permitFailure }: any): Promise<void>;
|
|
39
40
|
sumTokens({ tokens, owners, owner, tokensAndOwners, tokensAndOwners2, blacklistedTokens, blacklistedOwners, ownerTokens, }: {
|
|
40
41
|
tokens?: string[];
|
|
41
42
|
owner?: string;
|
package/build/ChainApi.js
CHANGED
|
@@ -146,6 +146,36 @@ var ChainApi = /** @class */ (function () {
|
|
|
146
146
|
ChainApi.prototype.removeTokenBalance = function (token) {
|
|
147
147
|
this._balances.removeTokenBalance(token);
|
|
148
148
|
};
|
|
149
|
+
ChainApi.prototype.erc4626Sum = function (_a) {
|
|
150
|
+
var calls = _a.calls, _b = _a.tokenAbi, tokenAbi = _b === void 0 ? 'address:token' : _b, _c = _a.balanceAbi, balanceAbi = _c === void 0 ? 'uint256:balance' : _c, balanceCalls = _a.balanceCalls, _d = _a.permitFailure, permitFailure = _d === void 0 ? false : _d;
|
|
151
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
+
var tokens, balances;
|
|
153
|
+
var _this = this;
|
|
154
|
+
return __generator(this, function (_e) {
|
|
155
|
+
switch (_e.label) {
|
|
156
|
+
case 0:
|
|
157
|
+
if (typeof tokenAbi === 'string' && (!tokenAbi.includes(':') && !tokenAbi.includes('(')))
|
|
158
|
+
tokenAbi = "address:".concat(tokenAbi);
|
|
159
|
+
if (typeof balanceAbi === 'string' && (!balanceAbi.includes(':') && !balanceAbi.includes('(')))
|
|
160
|
+
balanceAbi = "uint256:".concat(balanceAbi);
|
|
161
|
+
return [4 /*yield*/, this.multiCall({ calls: calls, abi: tokenAbi, permitFailure: permitFailure })];
|
|
162
|
+
case 1:
|
|
163
|
+
tokens = _e.sent();
|
|
164
|
+
return [4 /*yield*/, this.multiCall({ calls: calls !== null && calls !== void 0 ? calls : balanceCalls, abi: balanceAbi, permitFailure: permitFailure })];
|
|
165
|
+
case 2:
|
|
166
|
+
balances = _e.sent();
|
|
167
|
+
if (!permitFailure)
|
|
168
|
+
this.addTokens(tokens, balances);
|
|
169
|
+
else
|
|
170
|
+
tokens.forEach(function (i, j) {
|
|
171
|
+
if (i && balances[j])
|
|
172
|
+
_this.addToken(i, balances[j]);
|
|
173
|
+
});
|
|
174
|
+
return [2 /*return*/];
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
};
|
|
149
179
|
ChainApi.prototype.sumTokens = function (_a) {
|
|
150
180
|
var _b = _a.tokens, tokens = _b === void 0 ? [] : _b, _c = _a.owners, owners = _c === void 0 ? [] : _c, owner = _a.owner, _d = _a.tokensAndOwners, tokensAndOwners = _d === void 0 ? [] : _d, _e = _a.tokensAndOwners2, tokensAndOwners2 = _e === void 0 ? [] : _e, _f = _a.blacklistedTokens, blacklistedTokens = _f === void 0 ? [] : _f, _g = _a.blacklistedOwners, blacklistedOwners = _g === void 0 ? [] : _g, _h = _a.ownerTokens, ownerTokens = _h === void 0 ? [] : _h;
|
|
151
181
|
return __awaiter(this, void 0, void 0, function () {
|
package/build/abi/abi2.js
CHANGED
|
@@ -134,6 +134,10 @@ function fetchList(params) {
|
|
|
134
134
|
switch (_c.label) {
|
|
135
135
|
case 0:
|
|
136
136
|
_a = params.startFrom, startFrom = _a === void 0 ? 0 : _a, lengthAbi = params.lengthAbi, itemAbi = params.itemAbi, withMetadata = params.withMetadata, _b = params.startFromOne, startFromOne = _b === void 0 ? false : _b, itemCount = params.itemCount, commonParams = __rest(params, ["startFrom", "lengthAbi", "itemAbi", "withMetadata", "startFromOne", "itemCount"]);
|
|
137
|
+
if (typeof lengthAbi === 'string' && (!lengthAbi.includes(':') && !lengthAbi.includes('(')))
|
|
138
|
+
lengthAbi = "uint256:".concat(lengthAbi);
|
|
139
|
+
if (typeof itemAbi === 'string' && (!itemAbi.includes(':') && !itemAbi.includes('(')))
|
|
140
|
+
itemAbi = "function ".concat(itemAbi, "(uint256) view returns (address)");
|
|
137
141
|
if (!itemCount) return [3 /*break*/, 1];
|
|
138
142
|
itemLength = itemCount;
|
|
139
143
|
return [3 /*break*/, 3];
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const chainsForBlocks: string[];
|
|
3
|
-
export declare function getChainBlocks(timestamp: number, chains?: Chain[]): Promise<{
|
|
4
|
-
[chain: string]: number;
|
|
5
|
-
}>;
|
|
6
|
-
export declare function getBlocks(timestamp: number, chains?: Chain[] | undefined): Promise<{
|
|
7
|
-
ethereumBlock: any;
|
|
8
|
-
chainBlocks: {
|
|
9
|
-
[chain: string]: number;
|
|
10
|
-
};
|
|
11
|
-
}>;
|
|
12
|
-
export declare function getCurrentBlocks(chains?: Chain[] | undefined): Promise<{
|
|
13
|
-
timestamp: number;
|
|
14
|
-
ethereumBlock: number;
|
|
15
|
-
chainBlocks: {
|
|
16
|
-
[chain: string]: number;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
19
|
-
export declare function getBlock(chain: Chain, timestamp?: number | undefined): Promise<any>;
|
|
1
|
+
export { getChainBlocks, getBlocks, getBlock, getCurrentBlocks, chainsForBlocks, } from "../util/blocks";
|
|
@@ -1,189 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
exports
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var chainBlocks, setBlock;
|
|
48
|
-
var _this = this;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0:
|
|
52
|
-
chainBlocks = {};
|
|
53
|
-
setBlock = function (chain) { return __awaiter(_this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) {
|
|
54
|
-
switch (_c.label) {
|
|
55
|
-
case 0:
|
|
56
|
-
_a = chainBlocks;
|
|
57
|
-
_b = chain;
|
|
58
|
-
return [4 /*yield*/, getBlock(chain, timestamp)];
|
|
59
|
-
case 1: return [2 /*return*/, _a[_b] = (_c.sent()).block];
|
|
60
|
-
}
|
|
61
|
-
}); }); };
|
|
62
|
-
return [4 /*yield*/, Promise.all(chains.map(setBlock))];
|
|
63
|
-
case 1:
|
|
64
|
-
_a.sent();
|
|
65
|
-
return [2 /*return*/, chainBlocks];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
exports.getChainBlocks = getChainBlocks;
|
|
71
|
-
function getBlocks(timestamp, chains) {
|
|
72
|
-
if (chains === void 0) { chains = undefined; }
|
|
73
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var _a, ethBlock, chainBlocks;
|
|
75
|
-
return __generator(this, function (_b) {
|
|
76
|
-
switch (_b.label) {
|
|
77
|
-
case 0:
|
|
78
|
-
chains = chains === null || chains === void 0 ? void 0 : chains.filter(function (i) { return i !== 'ethereum'; });
|
|
79
|
-
return [4 /*yield*/, Promise.all([getBlock('ethereum', timestamp), getChainBlocks(timestamp, chains)])];
|
|
80
|
-
case 1:
|
|
81
|
-
_a = _b.sent(), ethBlock = _a[0], chainBlocks = _a[1];
|
|
82
|
-
chainBlocks['ethereum'] = ethBlock.block;
|
|
83
|
-
return [2 /*return*/, {
|
|
84
|
-
ethereumBlock: ethBlock.block,
|
|
85
|
-
chainBlocks: chainBlocks,
|
|
86
|
-
}];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
exports.getBlocks = getBlocks;
|
|
92
|
-
function getCurrentBlocks(chains) {
|
|
93
|
-
if (chains === void 0) { chains = undefined; }
|
|
94
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
-
var block, chainBlocks;
|
|
96
|
-
return __generator(this, function (_a) {
|
|
97
|
-
switch (_a.label) {
|
|
98
|
-
case 0:
|
|
99
|
-
if (chains)
|
|
100
|
-
chains = chains.filter(function (i) { return i !== "ethereum"; });
|
|
101
|
-
return [4 /*yield*/, getBlock('ethereum')];
|
|
102
|
-
case 1:
|
|
103
|
-
block = _a.sent();
|
|
104
|
-
return [4 /*yield*/, getChainBlocks(block.timestamp, chains)];
|
|
105
|
-
case 2:
|
|
106
|
-
chainBlocks = _a.sent();
|
|
107
|
-
chainBlocks['ethereum'] = block.number;
|
|
108
|
-
return [2 /*return*/, {
|
|
109
|
-
timestamp: block.timestamp,
|
|
110
|
-
ethereumBlock: block.number,
|
|
111
|
-
chainBlocks: chainBlocks,
|
|
112
|
-
}];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
exports.getCurrentBlocks = getCurrentBlocks;
|
|
118
|
-
var blockCache = {
|
|
119
|
-
current: {}
|
|
120
|
-
};
|
|
121
|
-
function getBlock(chain, timestamp) {
|
|
122
|
-
if (timestamp === void 0) { timestamp = undefined; }
|
|
123
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
-
function getCurrentEthBlock() {
|
|
125
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
-
var provider, lastBlockNumber;
|
|
127
|
-
return __generator(this, function (_a) {
|
|
128
|
-
switch (_a.label) {
|
|
129
|
-
case 0:
|
|
130
|
-
provider = (0, general_1.getProvider)("ethereum");
|
|
131
|
-
return [4 /*yield*/, provider.getBlockNumber()];
|
|
132
|
-
case 1:
|
|
133
|
-
lastBlockNumber = _a.sent();
|
|
134
|
-
return [2 /*return*/, provider.getBlock(lastBlockNumber - 5)]; // To allow indexers to catch up
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function _getBlock() {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
-
var i, block, e_1;
|
|
142
|
-
return __generator(this, function (_a) {
|
|
143
|
-
switch (_a.label) {
|
|
144
|
-
case 0:
|
|
145
|
-
i = 0;
|
|
146
|
-
_a.label = 1;
|
|
147
|
-
case 1:
|
|
148
|
-
if (!(i < blockRetries)) return [3 /*break*/, 6];
|
|
149
|
-
_a.label = 2;
|
|
150
|
-
case 2:
|
|
151
|
-
_a.trys.push([2, 4, , 5]);
|
|
152
|
-
return [4 /*yield*/, (0, index_1.lookupBlock)(timestamp, { chain: chain, })];
|
|
153
|
-
case 3:
|
|
154
|
-
block = _a.sent();
|
|
155
|
-
return [2 /*return*/, block];
|
|
156
|
-
case 4:
|
|
157
|
-
e_1 = _a.sent();
|
|
158
|
-
if (i === blockRetries - 1) {
|
|
159
|
-
throw e_1;
|
|
160
|
-
}
|
|
161
|
-
return [3 /*break*/, 5];
|
|
162
|
-
case 5:
|
|
163
|
-
i++;
|
|
164
|
-
return [3 /*break*/, 1];
|
|
165
|
-
case 6: return [2 /*return*/];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return __generator(this, function (_a) {
|
|
171
|
-
if (!timestamp) {
|
|
172
|
-
if (chain !== 'ethereum')
|
|
173
|
-
throw new Error('Timestamp is missing!!!');
|
|
174
|
-
if (!blockCache.current)
|
|
175
|
-
blockCache.current = {};
|
|
176
|
-
if (!blockCache.current.ethereum) {
|
|
177
|
-
blockCache.current.ethereum = getCurrentEthBlock();
|
|
178
|
-
}
|
|
179
|
-
return [2 /*return*/, blockCache.current.ethereum];
|
|
180
|
-
}
|
|
181
|
-
if (!blockCache[timestamp])
|
|
182
|
-
blockCache[timestamp] = {};
|
|
183
|
-
if (!blockCache[timestamp][chain])
|
|
184
|
-
blockCache[timestamp][chain] = _getBlock();
|
|
185
|
-
return [2 /*return*/, blockCache[timestamp][chain]];
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
exports.getBlock = getBlock;
|
|
3
|
+
exports.chainsForBlocks = exports.getCurrentBlocks = exports.getBlock = exports.getBlocks = exports.getChainBlocks = void 0;
|
|
4
|
+
var blocks_1 = require("../util/blocks");
|
|
5
|
+
Object.defineProperty(exports, "getChainBlocks", { enumerable: true, get: function () { return blocks_1.getChainBlocks; } });
|
|
6
|
+
Object.defineProperty(exports, "getBlocks", { enumerable: true, get: function () { return blocks_1.getBlocks; } });
|
|
7
|
+
Object.defineProperty(exports, "getBlock", { enumerable: true, get: function () { return blocks_1.getBlock; } });
|
|
8
|
+
Object.defineProperty(exports, "getCurrentBlocks", { enumerable: true, get: function () { return blocks_1.getCurrentBlocks; } });
|
|
9
|
+
Object.defineProperty(exports, "chainsForBlocks", { enumerable: true, get: function () { return blocks_1.chainsForBlocks; } });
|
package/build/generalUtil.js
CHANGED
|
@@ -178,7 +178,7 @@ function getUniqueAddresses(addresses, chain) {
|
|
|
178
178
|
}
|
|
179
179
|
exports.getUniqueAddresses = getUniqueAddresses;
|
|
180
180
|
function formErrorString(e, errorParams) {
|
|
181
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
181
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
182
182
|
if (errorParams === void 0) { errorParams = {}; }
|
|
183
183
|
if (!e) {
|
|
184
184
|
if (errorParams.promisePoolErrors) {
|
|
@@ -204,32 +204,40 @@ function formErrorString(e, errorParams) {
|
|
|
204
204
|
return errorString;
|
|
205
205
|
if ((e.reason || e.method) && e.code) { // ethers.js error
|
|
206
206
|
var method = e.method;
|
|
207
|
+
if (e.body) {
|
|
208
|
+
try {
|
|
209
|
+
e.body = JSON.parse(e.body);
|
|
210
|
+
}
|
|
211
|
+
catch (e) { }
|
|
212
|
+
if ((_e = (_d = e.body) === null || _d === void 0 ? void 0 : _d.error) === null || _e === void 0 ? void 0 : _e.message)
|
|
213
|
+
return e.body.error.message;
|
|
214
|
+
}
|
|
207
215
|
if (!method && e.requestBody) {
|
|
208
216
|
try {
|
|
209
217
|
e.requestBody = JSON.parse(e.requestBody);
|
|
210
218
|
}
|
|
211
219
|
catch (e) { }
|
|
212
|
-
method = (
|
|
220
|
+
method = (_f = e.requestBody) === null || _f === void 0 ? void 0 : _f.method;
|
|
213
221
|
}
|
|
214
222
|
if (!e.provider && errorParams.provider)
|
|
215
223
|
e.provider = errorParams.provider;
|
|
216
|
-
var providerUrl = (
|
|
224
|
+
var providerUrl = (_g = e === null || e === void 0 ? void 0 : e.url) !== null && _g !== void 0 ? _g : (_m = (_l = (_k = ((_j = (_h = e.provider) === null || _h === void 0 ? void 0 : _h.providerConfigs) !== null && _j !== void 0 ? _j : [])[0]) === null || _k === void 0 ? void 0 : _k.provider) === null || _l === void 0 ? void 0 : _l.connection) === null || _m === void 0 ? void 0 : _m.url;
|
|
217
225
|
if (!providerUrl) // in case of historical queries against archive nodes
|
|
218
|
-
providerUrl = (
|
|
226
|
+
providerUrl = (_p = (_o = e.provider) === null || _o === void 0 ? void 0 : _o.connection) === null || _p === void 0 ? void 0 : _p.url;
|
|
219
227
|
if (e.serverError)
|
|
220
228
|
return "host: ".concat(providerUrl, " ").concat(e.serverError.toString());
|
|
221
229
|
if (e.results) {
|
|
222
230
|
var errors = e.results.filter(function (i) { return i.error; }).map(function (i) { return i.error; });
|
|
223
231
|
if (errors.length) {
|
|
224
232
|
var eStrings = errors.map(function (i) { return formError(i); });
|
|
225
|
-
return "Failed to call ".concat(method, "
|
|
233
|
+
return "Failed to call method: ".concat(method, " provider: ").concat(providerUrl, "\n ").concat(eStrings.join('\n'));
|
|
226
234
|
}
|
|
227
235
|
}
|
|
228
236
|
else if (e.code === 'CALL_EXCEPTION' && errorParams.isCallError) {
|
|
229
237
|
var extraInfo = 'target: ' + errorParams.target;
|
|
230
238
|
if (errorParams.params && errorParams.params.length)
|
|
231
239
|
extraInfo += shortenString(' params: ' + errorParams.params.join(', '));
|
|
232
|
-
return "Failed to call ".concat(method, " ").concat(extraInfo, " on chain: [").concat(errorParams.chain, "] rpc: ").concat(providerUrl, " call reverted ").concat((
|
|
240
|
+
return "Failed to call ".concat(method, " ").concat(extraInfo, " on chain: [").concat(errorParams.chain, "] rpc: ").concat(providerUrl, " call reverted ").concat((_q = e.errorName) !== null && _q !== void 0 ? _q : '', " ").concat((_r = e.errorArgs) !== null && _r !== void 0 ? _r : '');
|
|
233
241
|
}
|
|
234
242
|
if (method === 'eth_blockNumber')
|
|
235
243
|
return "host: ".concat(providerUrl, " reason: ").concat(e.reason, " code: ").concat(e.code);
|
|
@@ -247,6 +255,8 @@ function shortenString(str, length) {
|
|
|
247
255
|
function formError(e, errorParams) {
|
|
248
256
|
var _a;
|
|
249
257
|
if (errorParams === void 0) { errorParams = {}; }
|
|
258
|
+
if ((e === null || e === void 0 ? void 0 : e._isCustomError) || (!Object.keys(errorParams).length && typeof e === 'object' && !Object.keys(e).length))
|
|
259
|
+
return e; // already formatted or vannila error
|
|
250
260
|
var error = new Error(formErrorString(e, errorParams));
|
|
251
261
|
try {
|
|
252
262
|
if (errorParams.isMultiCallError)
|