@ape.swap/bonds-sdk 1.0.512 → 1.0.515
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.
|
@@ -187,28 +187,30 @@ var BondModal = function (_a) {
|
|
|
187
187
|
}
|
|
188
188
|
}, [isActive, account, bondData]);
|
|
189
189
|
var getTokenBalance = function (chainId, tokenAddress, walletAddress) { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
-
var provider;
|
|
190
|
+
var provider, contract, balance, balanceInEther, error_3;
|
|
191
191
|
return __generator(this, function (_a) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
192
|
+
switch (_a.label) {
|
|
193
|
+
case 0:
|
|
194
|
+
_a.trys.push([0, 2, , 3]);
|
|
195
|
+
provider = new ethers.providers.JsonRpcProvider("https://bsc-dataseed.binance.org/");
|
|
196
|
+
// const provider = getProvider(56, true)
|
|
197
|
+
// const provider = RPC_PROVIDERS[chainId];
|
|
198
|
+
if (!provider) {
|
|
199
|
+
throw new Error("No provider found for chainId: ".concat(chainId));
|
|
200
|
+
}
|
|
201
|
+
contract = new ethers.Contract(tokenAddress, ERC_20_ABI, provider);
|
|
202
|
+
return [4 /*yield*/, contract.balanceOf(walletAddress)];
|
|
203
|
+
case 1:
|
|
204
|
+
balance = _a.sent();
|
|
205
|
+
balanceInEther = ethers.utils.formatUnits(balance, 18);
|
|
206
|
+
console.log("Token Balance: ".concat(balanceInEther));
|
|
207
|
+
return [2 /*return*/, balanceInEther];
|
|
208
|
+
case 2:
|
|
209
|
+
error_3 = _a.sent();
|
|
210
|
+
console.error('Error fetching token balance', error_3);
|
|
211
|
+
return [2 /*return*/, 'Error fetching token balance'];
|
|
212
|
+
case 3: return [2 /*return*/];
|
|
210
213
|
}
|
|
211
|
-
return [2 /*return*/];
|
|
212
214
|
});
|
|
213
215
|
}); };
|
|
214
216
|
return (_jsx(ThemeUIProvider, { theme: defaultTheme, children: bondData.map(function (bond) {
|