@defillama/sdk 3.0.5 → 3.0.7
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 -1
- package/build/general.js +1 -1
- package/build/generalUtil.js +6 -3
- package/package.json +1 -1
package/build/abi/index.js
CHANGED
|
@@ -58,6 +58,7 @@ var multicall_1 = __importDefault(require("./multicall"));
|
|
|
58
58
|
var convertResults_1 = __importDefault(require("./convertResults"));
|
|
59
59
|
var promise_pool_1 = require("@supercharge/promise-pool");
|
|
60
60
|
var debugLog_1 = require("../util/debugLog");
|
|
61
|
+
var defaultChunkSize = !!process.env.SDK_MULTICALL_CHUNK_SIZE ? +process.env.SDK_MULTICALL_CHUNK_SIZE : 250;
|
|
61
62
|
function resolveABI(providedAbi) {
|
|
62
63
|
var abi = providedAbi;
|
|
63
64
|
if (typeof abi === "string") {
|
|
@@ -131,7 +132,10 @@ function multiCall(params) {
|
|
|
131
132
|
contract: (_a = call.target) !== null && _a !== void 0 ? _a : params.target,
|
|
132
133
|
};
|
|
133
134
|
});
|
|
134
|
-
chunkSize =
|
|
135
|
+
chunkSize = defaultChunkSize;
|
|
136
|
+
if (['dogechain'].includes(params.chain)) {
|
|
137
|
+
chunkSize = 100;
|
|
138
|
+
}
|
|
135
139
|
contractChunks = [];
|
|
136
140
|
for (i = 0; i < contractCalls.length; i += chunkSize)
|
|
137
141
|
contractChunks.push(contractCalls.slice(i, i + chunkSize));
|
package/build/general.js
CHANGED
|
@@ -120,7 +120,7 @@ exports.providers = {
|
|
|
120
120
|
bitkub: createProvider("bitkub", "https://rpc.bitkubchain.io/", 96),
|
|
121
121
|
bitgert: createProvider("bitgert", "https://rpc.icecreamswap.com,https://nodes.vefinetwork.org/bitgert", 32520),
|
|
122
122
|
canto: createProvider("canto", "https://jsonrpc.canto.nodestake.top,https://canto.evm.chandrastation.com/", 7700),
|
|
123
|
-
dogechain: createProvider("dogechain", "https://dogechain.ankr.com,https://rpc.dogechain.dog,https://rpc01-sg.dogechain.dog,https://rpc02-sg.dogechain.dog,https://rpc03-sg.dogechain.dog", 2000),
|
|
123
|
+
dogechain: createProvider("dogechain", "https://dogechain-sj.ankr.com,https://dogechain.ankr.com,https://rpc.dogechain.dog,https://rpc01-sg.dogechain.dog,https://rpc02-sg.dogechain.dog,https://rpc03-sg.dogechain.dog", 2000),
|
|
124
124
|
posi: createProvider("posi", "https://api.posichain.org,https://api.s0.posichain.org", 900000),
|
|
125
125
|
arbitrum_nova: createProvider("posi", "https://nova.arbitrum.io/rpc", 42170),
|
|
126
126
|
ultron: createProvider("ultron", "https://ultron-rpc.net", 1231),
|
package/build/generalUtil.js
CHANGED
|
@@ -89,6 +89,9 @@ function sumMultiBalanceOf(balances, results, allCallsMustBeSuccessful, transfor
|
|
|
89
89
|
}
|
|
90
90
|
exports.sumMultiBalanceOf = sumMultiBalanceOf;
|
|
91
91
|
function sumSingleBalance(balances, token, balance, chain) {
|
|
92
|
+
isValidNumber(balance);
|
|
93
|
+
if (+balance === 0)
|
|
94
|
+
return;
|
|
92
95
|
if (chain)
|
|
93
96
|
token = "".concat(chain, ":").concat(token);
|
|
94
97
|
if (typeof balance === 'object') {
|
|
@@ -97,11 +100,11 @@ function sumSingleBalance(balances, token, balance, chain) {
|
|
|
97
100
|
else
|
|
98
101
|
throw new Error('Invalid balance value:' + balance);
|
|
99
102
|
}
|
|
100
|
-
if (typeof balance === 'number') {
|
|
103
|
+
if (typeof balance === 'number' || (balances[token] && typeof balances[token] === 'number')) {
|
|
101
104
|
var prevBalance = +(balances.hasOwnProperty(token) ? balances[token] : 0);
|
|
102
105
|
if (typeof prevBalance !== 'number' || isNaN(prevBalance))
|
|
103
106
|
throw new Error("Trying to merge token balance and coingecko amount for ".concat(token, " current balance: ").concat(balance, " previous balance: ").concat(balances[token]));
|
|
104
|
-
var value = prevBalance + balance;
|
|
107
|
+
var value = prevBalance + +balance;
|
|
105
108
|
isValidNumber(value);
|
|
106
109
|
balances[token] = value;
|
|
107
110
|
}
|
|
@@ -112,7 +115,7 @@ function sumSingleBalance(balances, token, balance, chain) {
|
|
|
112
115
|
balances[token] = value;
|
|
113
116
|
}
|
|
114
117
|
function isValidNumber(value) {
|
|
115
|
-
if (isNaN(value))
|
|
118
|
+
if ([null, undefined].includes(value) || isNaN(+value))
|
|
116
119
|
throw new Error("Invalid balance: ".concat(balance));
|
|
117
120
|
}
|
|
118
121
|
}
|