@ape.swap/bonds-sdk 3.0.35 → 3.0.37

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.
package/dist/main.js CHANGED
@@ -22356,7 +22356,7 @@ const PRICE_GETTER_ADDRESSES = {
22356
22356
  [types.ChainId.AVAX]: '0x01dadaa586D30d93Ac92C79A5Cb02a8F276a8B4F', // Price getter V3
22357
22357
  [types.ChainId.CROSSFI]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4', // Price getter V3
22358
22358
  [types.ChainId.SONIC]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4', // Price getter V3
22359
- [types.ChainId.MONAD_TESTNET]: '0x0187D959A28B0D3B490c2D898fA1CcD054cCC3cd',
22359
+ [types.ChainId.MONAD_TESTNET]: '0x0187D959A28B0D3B490c2D898fA1CcD054cCC3cd', // Price getter V3
22360
22360
  };
22361
22361
  const MULTICALL_V2 = {
22362
22362
  [types.ChainId.BSC]: '0x38ce767d81de3940CFa5020B55af1A400ED4F657',
@@ -69612,12 +69612,10 @@ const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, f
69612
69612
  chain: chainId,
69613
69613
  });
69614
69614
  return response.data.map((token) => {
69615
- var _a;
69616
69615
  return {
69617
69616
  symbol: token.symbol,
69618
69617
  address: token.tokenAddress,
69619
69618
  price: parseFloat(token.price),
69620
- decimals: (_a = tokens.find((t) => t.address.toLowerCase() === token.tokenAddress.toLowerCase())) === null || _a === void 0 ? void 0 : _a.decimals,
69621
69619
  chainId,
69622
69620
  };
69623
69621
  });
@@ -70995,13 +70993,7 @@ const getBondsList = (apeswapListsURL) => __awaiter$9(void 0, void 0, void 0, fu
70995
70993
  /* MODIFIED FUNCTION FROM FRONTEND SPECIFICALLY FOR THE SDK */
70996
70994
  const fetchUserOwnedBillsDataAsync = (chainId, account, bondData, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
70997
70995
  try {
70998
- const bonds = bondData.filter((bond) => {
70999
- var _a;
71000
- return bond.billVersion !== types.BillVersion.FixedPrice &&
71001
- (bond === null || bond === void 0 ? void 0 : bond.chainId) === chainId &&
71002
- bond.billType !== 'migration' &&
71003
- ((_a = bond.contractAddress[bond.chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== ACF_TO_ABOND.toLowerCase();
71004
- });
70996
+ const bonds = bondData;
71005
70997
  // Fetch and set user owned bill data without NFT Data
71006
70998
  const userOwnedBills = yield fetchUserOwnedBills(chainId, account, bonds, tokenPrices);
71007
70999
  const mapUserOwnedBills = bonds.map((bill) => userOwnedBills.filter((b) => { var _a; return b.address.toLowerCase() === ((_a = bill.contractAddress[bill.chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()); }));
@@ -71115,7 +71107,24 @@ function useUserBonds() {
71115
71107
  }
71116
71108
  const getUserBonds = (account, bondList, chains, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
71117
71109
  try {
71118
- const results = yield Promise.allSettled(chains.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondList, tokenPrices)));
71110
+ const bondsByChain = bondList.reduce((acc, bond) => {
71111
+ var _a;
71112
+ // Exclude ACF to ABOND bonds, fixed price bonds and migration bonds
71113
+ // this is done here to avoid filtering again in the fetchUserOwnedBillsDataAsync
71114
+ if (((_a = bond.contractAddress[bond.chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ACF_TO_ABOND.toLowerCase() ||
71115
+ bond.billVersion === types.BillVersion.FixedPrice ||
71116
+ bond.billType === 'migration') {
71117
+ return acc;
71118
+ }
71119
+ if (!acc[bond.chainId] && chains.includes(bond.chainId)) {
71120
+ acc[bond.chainId] = [bond];
71121
+ }
71122
+ else {
71123
+ acc[bond.chainId].push(bond);
71124
+ }
71125
+ return acc;
71126
+ }, {});
71127
+ const results = yield Promise.allSettled(chains.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondsByChain[chain], tokenPrices)));
71119
71128
  // Filter out only fulfilled promises
71120
71129
  const fulfilledResults = results
71121
71130
  .filter((result) => result.status === 'fulfilled')
@@ -77241,9 +77250,13 @@ const HotBondCards = () => {
77241
77250
  const BANNER_INFO = {
77242
77251
  [types.ChainId.MONAD_TESTNET]: {
77243
77252
  title: 'Test and Play on Monad Testnet',
77244
- subtitle: 'Explore Monad for free, earn points and qualify for potential airdrops.',
77253
+ subtitle: 'Explore Bonds on the Monad Testnet for free.',
77245
77254
  buttons: [
77246
77255
  { label: 'GET MON TOKENS', href: 'https://testnet.monad.xyz' },
77256
+ {
77257
+ label: 'LEARN MORE',
77258
+ href: 'https://apebond.medium.com/apebond-integrates-testnet-bonds-paving-the-way-for-exciting-new-chains-3f62e2204746?source=social.tw',
77259
+ },
77247
77260
  ],
77248
77261
  background: 'https://res.cloudinary.com/dswmrqgwy/image/upload/v1/banner_jpkg38.png',
77249
77262
  backgroundMobile: 'https://res.cloudinary.com/dswmrqgwy/image/upload/v1/banner-mobile_y6xveu.png',
@@ -4,7 +4,6 @@ export interface TokenPrices {
4
4
  symbol: string | undefined;
5
5
  address: string | undefined;
6
6
  price: number | undefined;
7
- decimals: number | undefined;
8
7
  chainId: ChainId | undefined;
9
8
  }
10
9
  export default function useTokenPrices(): UseQueryResult<TokenPrices[]>;
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": "3.0.35",
6
+ "version": "3.0.37",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",