@ape.swap/bonds-sdk 1.0.702 → 1.0.703
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.
|
@@ -154,8 +154,8 @@ var BondModal = function (_a) {
|
|
|
154
154
|
useEffect(function () {
|
|
155
155
|
if (isActive && account && bondData.length > 0) {
|
|
156
156
|
getTokenBalance(bondData[0].chainId, bondData[0].lpToken.address[accountChainId], account).then(function (_a) {
|
|
157
|
-
var
|
|
158
|
-
setTokenBalance(
|
|
157
|
+
var roundedBalanceInEther = _a.roundedBalanceInEther, decimals = _a.decimals;
|
|
158
|
+
setTokenBalance(roundedBalanceInEther);
|
|
159
159
|
setTokenDecimals(decimals);
|
|
160
160
|
}).catch(function (error) {
|
|
161
161
|
console.error('Error fetching token balance', error);
|
|
@@ -163,7 +163,7 @@ var BondModal = function (_a) {
|
|
|
163
163
|
}
|
|
164
164
|
}, [isActive, account, bondData]);
|
|
165
165
|
var getTokenBalance = function (chainId, tokenAddress, walletAddress) { return __awaiter(void 0, void 0, void 0, function () {
|
|
166
|
-
var urls, provider, contract, decimals, balance, balanceInEther, error_3;
|
|
166
|
+
var urls, provider, contract, decimals, balance, balanceInEther, roundedBalanceInEther, error_3;
|
|
167
167
|
return __generator(this, function (_a) {
|
|
168
168
|
switch (_a.label) {
|
|
169
169
|
case 0:
|
|
@@ -181,11 +181,12 @@ var BondModal = function (_a) {
|
|
|
181
181
|
case 2:
|
|
182
182
|
balance = _a.sent();
|
|
183
183
|
balanceInEther = ethers.utils.formatUnits(balance, decimals);
|
|
184
|
-
|
|
184
|
+
roundedBalanceInEther = Number(balanceInEther).toFixed(4);
|
|
185
|
+
return [2 /*return*/, { roundedBalanceInEther: roundedBalanceInEther, decimals: decimals }];
|
|
185
186
|
case 3:
|
|
186
187
|
error_3 = _a.sent();
|
|
187
188
|
console.error('Error fetching token balance', error_3);
|
|
188
|
-
return [2 /*return*/, {
|
|
189
|
+
return [2 /*return*/, { roundedBalanceInEther: '0', decimals: 0 }];
|
|
189
190
|
case 4: return [2 /*return*/];
|
|
190
191
|
}
|
|
191
192
|
});
|