@ape.swap/bonds-sdk 4.0.1-test.6 → 4.0.2-test.1

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
@@ -63664,7 +63664,7 @@ const isBondSoldOut = (bill, showLowValueBonds) => {
63664
63664
  var _a, _b, _c, _d;
63665
63665
  if (bill.soldOut)
63666
63666
  return true;
63667
- if (bill.inactive)
63667
+ if (bill.hide)
63668
63668
  return true;
63669
63669
  if (bill.billType === 'fcfs') {
63670
63670
  const now = new Date().getTime();
@@ -67213,6 +67213,23 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
67213
67213
  const results = [];
67214
67214
  const userBase58 = new PublicKey(user).toBase58();
67215
67215
  const connection = new Connection(getRPC(types$1.ChainId.SOL), 'confirmed');
67216
+ const collections = bondData.map((bond) => bond.billNnftAddress[types$1.ChainId.SOL]);
67217
+ const allOptions = {
67218
+ method: 'POST',
67219
+ headers: { 'Content-Type': 'application/json' },
67220
+ body: JSON.stringify({
67221
+ jsonrpc: '2.0',
67222
+ id: '1',
67223
+ method: 'searchAssets',
67224
+ params: {
67225
+ ownerAddress: userBase58,
67226
+ collections,
67227
+ },
67228
+ }),
67229
+ };
67230
+ const allResponse = yield fetch(HELIUS_SOL_RPC, allOptions);
67231
+ const allData = yield allResponse.json();
67232
+ const allUserAssets = allData.result.items;
67216
67233
  for (const bond of bondData) {
67217
67234
  if (bond.chainId !== types$1.ChainId.SOL || !bond.contractAddress[types$1.ChainId.SOL])
67218
67235
  continue;
@@ -67220,21 +67237,9 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
67220
67237
  const userBills = [];
67221
67238
  const collection = bond.billNnftAddress[types$1.ChainId.SOL];
67222
67239
  const payoutTokenPrice = (_d = (_c = (_b = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices.find) === null || _a === void 0 ? void 0 : _a.call(tokenPrices, (t) => { var _a, _b, _c, _d; return ((_a = t === null || t === void 0 ? void 0 : t.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[types$1.ChainId.SOL]) === null || _d === void 0 ? void 0 : _d.toLowerCase()); })) === null || _b === void 0 ? void 0 : _b.price) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : '69';
67223
- const options = {
67224
- method: 'POST',
67225
- headers: { 'Content-Type': 'application/json' },
67226
- body: JSON.stringify({
67227
- jsonrpc: '2.0',
67228
- id: '1',
67229
- method: 'getAssetsByGroup',
67230
- params: { groupKey: 'collection', groupValue: collection },
67231
- }),
67232
- };
67233
- const response = yield fetch(HELIUS_SOL_RPC, options);
67234
- const data = yield response.json();
67235
- const userOwnedAssets = data.result.items;
67236
- const userAssets = userOwnedAssets.filter((asset) => {
67237
- return asset.ownership.owner === userBase58;
67240
+ const userAssets = allUserAssets.filter((asset) => {
67241
+ var _a;
67242
+ return asset.authorities[0].address.toLowerCase() === ((_a = bond.contractAddress[types$1.ChainId.SOL]) === null || _a === void 0 ? void 0 : _a.toLowerCase());
67238
67243
  });
67239
67244
  for (const asset of userAssets) {
67240
67245
  const nftMint = new PublicKey(asset.id);
@@ -12,7 +12,7 @@ export interface BondRecommendation {
12
12
  billNftAddress: string;
13
13
  initTime: number;
14
14
  soldOut: boolean;
15
- inactive: boolean;
15
+ hide: boolean;
16
16
  maxTotalPayout: number;
17
17
  totalPayoutGiven: number;
18
18
  tokensRemaining: number;
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.0.1-test.6",
6
+ "version": "4.0.2-test.1",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",
@@ -77,7 +77,7 @@
77
77
  "yalc": "^1.0.0-pre.53"
78
78
  },
79
79
  "dependencies": {
80
- "@ape.swap/apeswap-lists": "4.3.30",
80
+ "@ape.swap/apeswap-lists": "4.4.0",
81
81
  "@emotion/react": "11.14.0",
82
82
  "bignumber.js": "^9.1.2",
83
83
  "buffer": "^6.0.3",