@ape.swap/bonds-sdk 1.0.701 → 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 balanceInEther = _a.balanceInEther, decimals = _a.decimals;
158
- setTokenBalance(balanceInEther);
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
- return [2 /*return*/, { balanceInEther: balanceInEther, decimals: decimals }];
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*/, { balanceInEther: '0', decimals: 0 }];
189
+ return [2 /*return*/, { roundedBalanceInEther: '0', decimals: 0 }];
189
190
  case 4: return [2 /*return*/];
190
191
  }
191
192
  });
@@ -238,10 +239,10 @@ var BondModal = function (_a) {
238
239
  !!v.currentTarget.value && isNumber(v.currentTarget.value) && parseFloat(v.currentTarget.value) >= 0
239
240
  ? v.currentTarget.value
240
241
  : v.currentTarget.value.slice(0, v.currentTarget.value.length - 1);
241
- } }) }), _jsxs(Flex, { className: "input-container token", children: [_jsx(Flex, { className: "input-container bondicon", children: _jsxs("div", { className: "icon-container-small", children: [_jsx(Svg, { width: 12, height: 12, icon: (_m = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond.chainId]) !== null && _m !== void 0 ? _m : 'question' }), _jsx(TokenImage, { symbol: (_o = bond.lpToken.symbol) !== null && _o !== void 0 ? _o : bond.earnToken.symbol, size: 30 })] }) }), _jsx(Flex, { className: "title-container tokenname-small", children: bond === null || bond === void 0 ? void 0 : bond.lpToken.symbol })] })] }), isActive && account && (_jsxs(Flex, { className: "input-container balancerow", children: [_jsxs(Flex, { className: "balancerow text", children: ["Balance: ", tokenBalance] }), _jsx(Flex, { className: "balancerow max", children: _jsx(Button, { className: "max max-button", onClick: function () { setInputValue(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0'); }, children: "Max" }) })] }))] }), _jsxs(Flex, { className: "modaltable-container button-container", children: [_jsx(Flex, { className: "button-container get", children: _jsxs(Button, { className: "action-button", onClick: function () { window.open('https://ape.bond/swap', '_blank'); }, children: ["Get ", bond === null || bond === void 0 ? void 0 : bond.lpToken.symbol] }) }), _jsx(Flex, { className: "button-container buy", children: approveTx != null && isConfirmed ?
242
- _jsx(Button, { className: "action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut), onClick: handleBuy, children: isConfirming ? 'Confirming...' : "Buy ".concat(bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName) })
242
+ } }) }), _jsxs(Flex, { className: "input-container token", children: [_jsx(Flex, { className: "input-container bondicon", children: _jsxs("div", { className: "icon-container-small", children: [_jsx(Svg, { width: 12, height: 12, icon: (_m = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond.chainId]) !== null && _m !== void 0 ? _m : 'question' }), _jsx(TokenImage, { symbol: (_o = bond.lpToken.symbol) !== null && _o !== void 0 ? _o : bond.earnToken.symbol, size: 30 })] }) }), _jsx(Flex, { className: "title-container tokenname-small", children: bond === null || bond === void 0 ? void 0 : bond.lpToken.symbol })] })] }), isActive && account && (_jsxs(Flex, { className: "input-container balancerow", children: [_jsxs(Flex, { className: "balancerow text", children: ["Balance: ", tokenBalance] }), _jsx(Flex, { className: "balancerow max", children: _jsx(Button, { className: "max max-button", onClick: function () { setInputValue(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0'); }, children: "Max" }) })] }))] }), _jsxs(Flex, { className: "modaltable-container button-container", children: [_jsx(Flex, { className: "button-container get", children: _jsxs(Button, { className: "get action-button", onClick: function () { window.open('https://ape.bond/swap', '_blank'); }, children: ["Get ", bond === null || bond === void 0 ? void 0 : bond.lpToken.symbol] }) }), _jsx(Flex, { className: "button-container buy", children: approveTx != null && isConfirmed ?
243
+ _jsx(Button, { className: "buy action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut), onClick: handleBuy, children: isConfirming ? 'Confirming...' : "Buy ".concat(bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName) })
243
244
  :
244
- _jsx(Button, { className: "action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut), onClick: handleApprove, children: isConfirming ? 'Confirming...' : 'Approve' }) })] })] })] }) }) }, bond.billAddress));
245
+ _jsx(Button, { className: "buy action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut), onClick: handleApprove, children: isConfirming ? 'Confirming...' : 'Approve' }) })] })] })] }) }) }, bond.billAddress));
245
246
  }) }));
246
247
  };
247
248
  export default BondModal;
@@ -357,19 +357,19 @@
357
357
  justify-content: center;
358
358
  align-items: center;
359
359
  cursor: pointer;
360
+ }
360
361
 
361
- Button {
362
- width: 275px;
363
- }
362
+ .get.action-button {
363
+ width: 275px;
364
364
  }
365
365
 
366
366
  .button-container.buy {
367
367
  justify-content: center;
368
368
  align-items: center;
369
+ }
369
370
 
370
- Button {
371
- width: 375px;
372
- }
371
+ .buy.action-button {
372
+ width: 375px;
373
373
  }
374
374
 
375
375
  .toast {
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.701",
6
+ "version": "1.0.703",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",