@defillama/sdk 3.0.4 → 3.0.6
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/general.js +1 -1
- package/build/generalUtil.js +6 -3
- package/package.json +1 -1
package/build/general.js
CHANGED
|
@@ -118,7 +118,7 @@ exports.providers = {
|
|
|
118
118
|
ontology_evm: createProvider("ontology_evm", "https://dappnode1.ont.io:10339", 58),
|
|
119
119
|
jfin: createProvider("jfin", "https://rpc.jfinchain.com/", 3501),
|
|
120
120
|
bitkub: createProvider("bitkub", "https://rpc.bitkubchain.io/", 96),
|
|
121
|
-
bitgert: createProvider("bitgert", "https://
|
|
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
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),
|
|
124
124
|
posi: createProvider("posi", "https://api.posichain.org,https://api.s0.posichain.org", 900000),
|
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
|
}
|