@ape.swap/bonds-sdk 4.5.4-test.1 → 4.5.4-test.2

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.
@@ -1,4 +1,4 @@
1
- import { i as isAddress, I as InvalidAddressError, s as slice, t as toFunctionSelector, f as formatAbiItem, A as AbiFunctionSignatureNotFoundError, d as decodeAbiParameters, g as getAbiItem, a as AbiErrorNotFoundError, b as AbiErrorInputsNotFoundError, e as encodeAbiParameters, c as concatHex, h as AbiFunctionNotFoundError, j as AbiFunctionOutputsNotFoundError, k as InvalidArrayError, l as batchGatewayAbi, m as solidityError, B as BaseError, n as getUrl, o as stringify, p as decodeErrorResult, q as call, r as concat, H as HttpRequestError, u as isHex } from './main-B5Z7fuXw.js';
1
+ import { i as isAddress, I as InvalidAddressError, s as slice, t as toFunctionSelector, f as formatAbiItem, A as AbiFunctionSignatureNotFoundError, d as decodeAbiParameters, g as getAbiItem, a as AbiErrorNotFoundError, b as AbiErrorInputsNotFoundError, e as encodeAbiParameters, c as concatHex, h as AbiFunctionNotFoundError, j as AbiFunctionOutputsNotFoundError, k as InvalidArrayError, l as batchGatewayAbi, m as solidityError, B as BaseError, n as getUrl, o as stringify, p as decodeErrorResult, q as call, r as concat, H as HttpRequestError, u as isHex } from './main-DoVlruAO.js';
2
2
  import 'react';
3
3
  import '@tanstack/react-query';
4
4
  import 'wagmi';
@@ -63568,14 +63568,12 @@ const getSafetyAvailable = (bond, allowLowValueBonds) => {
63568
63568
  return safeAvailable;
63569
63569
  };
63570
63570
  const getSafetyPurchaseLimit = (bond, allowLowValueBonds) => {
63571
- var _a, _b, _c, _d, _e, _f;
63571
+ var _a, _b, _c, _d, _e;
63572
63572
  const threshold = allowLowValueBonds ? 0 : SAFETY_THRESHOLD;
63573
63573
  const payoutTokenPrice = new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : 0);
63574
63574
  const thresholdToShow = payoutTokenPrice.gt(0) ? new BigNumber$1(threshold).div(payoutTokenPrice) : new BigNumber$1(0);
63575
- const feeInPayoutAdjuster = (100 - ((_b = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _b !== void 0 ? _b : 0)) / 100;
63576
- return new BigNumber$1((_c = bond === null || bond === void 0 ? void 0 : bond.maxPayout) !== null && _c !== void 0 ? _c : 0)
63577
- .div(new BigNumber$1(10).pow((_f = (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.decimals) === null || _e === void 0 ? void 0 : _e[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _f !== void 0 ? _f : 18))
63578
- .times(feeInPayoutAdjuster)
63575
+ return new BigNumber$1((_b = bond === null || bond === void 0 ? void 0 : bond.maxPayout) !== null && _b !== void 0 ? _b : 0)
63576
+ .div(new BigNumber$1(10).pow((_e = (_d = (_c = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _c === void 0 ? void 0 : _c.decimals) === null || _d === void 0 ? void 0 : _d[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _e !== void 0 ? _e : 18))
63579
63577
  .minus(thresholdToShow);
63580
63578
  };
63581
63579
  const getMaxBuy = (bond, allowLowValueBonds) => {
@@ -63670,9 +63668,10 @@ const getPrincipalAmount = (bond, targetPayoutAmount, userPoints) => {
63670
63668
  return bigValue.div(new BigNumber$1(10).pow(18));
63671
63669
  };
63672
63670
  const getRemainingTokensString = (bond, allowLowValueBonds) => {
63673
- var _a;
63674
- const remainingTokens = getSafetyAvailable(bond, allowLowValueBonds).toNumber();
63675
- const remainingTokensUsd = remainingTokens * parseFloat((_a = bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
63671
+ var _a, _b;
63672
+ // const remainingTokens = getSafetyAvailable(bond, allowLowValueBonds).toNumber()
63673
+ const remainingTokens = parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0');
63674
+ const remainingTokensUsd = remainingTokens * parseFloat((_b = bond.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
63676
63675
  return `${formatNumberSI(remainingTokens, 0)} ${bond.earnToken.symbol} ($${formatNumberSI(remainingTokensUsd, 0)})`;
63677
63676
  };
63678
63677
  const remainingPercentage = (bond) => {
@@ -86037,7 +86036,7 @@ async function call(client, args) {
86037
86036
  catch (err) {
86038
86037
  const data = getRevertErrorData(err);
86039
86038
  // Check for CCIP-Read offchain lookup signature.
86040
- const { offchainLookup, offchainLookupSignature } = await import('./ccip-DOs2Dd5_.js');
86039
+ const { offchainLookup, offchainLookupSignature } = await import('./ccip-BJIJlp6h.js');
86041
86040
  if (client.ccipRead !== false &&
86042
86041
  data?.slice(0, 10) === offchainLookupSignature &&
86043
86042
  to)
@@ -87896,7 +87895,7 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
87896
87895
  $${formatUSDNumber((parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0)).toString())}`;
87897
87896
  // Validations
87898
87897
  const zapEnabled = supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId);
87899
- const exceedsRealMaxBuy = getMaxBuy(bondData, true).lte(getPayoutAmount(bondData, depositAmount, userPoints));
87898
+ const exceedsRealMaxBuy = false;
87900
87899
  const exceedsSafeMaxBuy = getMaxBuy(bondData, false)
87901
87900
  .times(isZap ? 0.995 : 0.9995)
87902
87901
  .lte(getPayoutAmount(bondData, depositAmount, userPoints));
@@ -88179,9 +88178,7 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
88179
88178
  (isZap && !zapData) ||
88180
88179
  SDKConfig.blockSales, onClick: handleOpenModal, sx: { fontSize: ['14px', '14px', '14px', '16px'] }, children: SDKConfig.blockSales
88181
88180
  ? 'Complete KYC to Buy'
88182
- : exceedsRealMaxBuy
88183
- ? 'Exceeds Max Buy. Reduce amount'
88184
- : exceedsBalance
88181
+ : exceedsBalance
88185
88182
  ? 'Exceeds balance'
88186
88183
  : zapError
88187
88184
  ? 'something went wrong'
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
- import { y as main } from './main-B5Z7fuXw.js';
2
- export { E as BLOCK_EXPLORER, v as Bonds, w as BuyBondModal, F as FullBondsView, P as ProjectView, S as SingleBond, T as TokenImage, Y as YourBonds, x as generateImageFromTemplate, J as useApproval, C as useBondsData, G as useCurrencyBalance, D as useSDKConfig, z as useTokenPrices } from './main-B5Z7fuXw.js';
1
+ import { y as main } from './main-DoVlruAO.js';
2
+ export { E as BLOCK_EXPLORER, v as Bonds, w as BuyBondModal, F as FullBondsView, P as ProjectView, S as SingleBond, T as TokenImage, Y as YourBonds, x as generateImageFromTemplate, J as useApproval, C as useBondsData, G as useCurrencyBalance, D as useSDKConfig, z as useTokenPrices } from './main-DoVlruAO.js';
3
3
  import 'react';
4
4
  import '@tanstack/react-query';
5
5
  import 'wagmi';
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": "4.5.4-test.1",
6
+ "version": "4.5.4-test.2",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",