@ape.swap/bonds-sdk 1.0.511 → 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.
@@ -56,7 +56,6 @@ import { NETWORK_ICONS } from '../../../config/constants/chains';
56
56
  import { formatUSDNumber, getPremiumColor, premium, youGet, youGetUSD, youSpend, youSpendUSD } from './helper';
57
57
  import '../../../scss/BondModal.scss';
58
58
  import { useWriteContract } from "wagmi";
59
- import { getProvider } from '../../../config/constants/providers';
60
59
  var BondModal = function (_a) {
61
60
  var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive, isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
62
61
  if (!isOpen)
@@ -188,27 +187,30 @@ var BondModal = function (_a) {
188
187
  }
189
188
  }, [isActive, account, bondData]);
190
189
  var getTokenBalance = function (chainId, tokenAddress, walletAddress) { return __awaiter(void 0, void 0, void 0, function () {
191
- var provider;
190
+ var provider, contract, balance, balanceInEther, error_3;
192
191
  return __generator(this, function (_a) {
193
- try {
194
- return [2 /*return*/, "4"];
195
- provider = getProvider(56, true);
196
- //
197
- // // const provider = RPC_PROVIDERS[chainId];
198
- // if (!provider) {
199
- // throw new Error(`No provider found for chainId: ${chainId}`);
200
- // }
201
- // const contract = new ethers.Contract(tokenAddress, ERC_20_ABI, provider);
202
- // const balance = await contract.balanceOf(walletAddress);
203
- // const balanceInEther = ethers.utils.formatUnits(balance, 18); // Assuming the token has 18 decimals
204
- // console.log(`Token Balance: ${balanceInEther}`);
205
- // return balanceInEther;
206
- }
207
- catch (error) {
208
- console.error('Error fetching token balance', error);
209
- return [2 /*return*/, 'Error fetching token balance'];
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) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "1.0.511",
6
+ "version": "1.0.515",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",