@sonarwatch/portfolio-plugins 0.14.131 → 0.14.133

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +2136 -2128
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/src/plugins/balancer/helpers/pools.js +21 -21
  5. package/src/plugins/citrus/loansFetcher.js +34 -68
  6. package/src/plugins/citrus/loansFetcher.js.map +1 -1
  7. package/src/plugins/debridge/dlmmVaultsFetcher.js +1 -0
  8. package/src/plugins/debridge/dlmmVaultsFetcher.js.map +1 -1
  9. package/src/plugins/jupiter/exchange/helpersPerps.d.ts +2 -0
  10. package/src/plugins/jupiter/exchange/helpersPerps.js +3 -1
  11. package/src/plugins/jupiter/exchange/helpersPerps.js.map +1 -1
  12. package/src/plugins/jupiter/exchange/perpetualFetcher.js +27 -1
  13. package/src/plugins/jupiter/exchange/perpetualFetcher.js.map +1 -1
  14. package/src/plugins/jupiter/exchange/structs.d.ts +35 -1
  15. package/src/plugins/jupiter/exchange/structs.js +36 -1
  16. package/src/plugins/jupiter/exchange/structs.js.map +1 -1
  17. package/src/plugins/jupiter/exchange/valueAverageFetcher.js +1 -1
  18. package/src/plugins/jupiter/exchange/valueAverageFetcher.js.map +1 -1
  19. package/src/plugins/jupiter/filters.d.ts +1 -0
  20. package/src/plugins/jupiter/filters.js +11 -1
  21. package/src/plugins/jupiter/filters.js.map +1 -1
  22. package/src/plugins/rain/banksFetcher.js +47 -0
  23. package/src/plugins/rain/banksFetcher.js.map +1 -0
  24. package/src/plugins/rain/collectionsJob.js +9 -7
  25. package/src/plugins/rain/collectionsJob.js.map +1 -1
  26. package/src/plugins/rain/constants.d.ts +7 -2
  27. package/src/plugins/rain/constants.js +11 -3
  28. package/src/plugins/rain/constants.js.map +1 -1
  29. package/src/plugins/rain/defiBorrowsFetcher.d.ts +3 -0
  30. package/src/plugins/rain/defiBorrowsFetcher.js +52 -0
  31. package/src/plugins/rain/defiBorrowsFetcher.js.map +1 -0
  32. package/src/plugins/rain/index.js +10 -3
  33. package/src/plugins/rain/index.js.map +1 -1
  34. package/src/plugins/rain/nftBorrowsFetcher.d.ts +3 -0
  35. package/src/plugins/rain/nftBorrowsFetcher.js +76 -0
  36. package/src/plugins/rain/nftBorrowsFetcher.js.map +1 -0
  37. package/src/plugins/rain/poolsFetcher.js +79 -42
  38. package/src/plugins/rain/poolsFetcher.js.map +1 -1
  39. package/src/plugins/rain/structs.d.ts +455 -0
  40. package/src/plugins/rain/structs.js +425 -0
  41. package/src/plugins/rain/structs.js.map +1 -0
  42. package/src/plugins/rain/types.d.ts +18 -144
  43. package/src/plugins/sharky/loansFetcher.js +38 -73
  44. package/src/plugins/sharky/loansFetcher.js.map +1 -1
  45. package/src/plugins/sushiswap/helpers.js +24 -24
  46. package/src/plugins/uniswap-v2/helpers.js +22 -22
  47. package/src/plugins/zeta/airdropFetcher.js +14 -14
  48. package/src/utils/elementbuilder/AssetCollectibleBuilder.d.ts +10 -0
  49. package/src/utils/elementbuilder/AssetCollectibleBuilder.js +53 -0
  50. package/src/utils/elementbuilder/AssetCollectibleBuilder.js.map +1 -0
  51. package/src/utils/elementbuilder/ElementBorrowlendBuilder.d.ts +9 -1
  52. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +41 -3
  53. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -1
  54. package/src/utils/elementbuilder/ElementRegistry.js +9 -1
  55. package/src/utils/elementbuilder/ElementRegistry.js.map +1 -1
  56. package/src/utils/elementbuilder/Params.d.ts +14 -0
  57. package/src/utils/sei/constants.js +8 -8
  58. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  59. package/src/utils/solana/das/heliusAssetToAssetCollectible.js +3 -2
  60. package/src/utils/solana/das/heliusAssetToAssetCollectible.js.map +1 -1
  61. package/src/plugins/rain/filters.d.ts +0 -7
  62. package/src/plugins/rain/filters.js +0 -53
  63. package/src/plugins/rain/filters.js.map +0 -1
  64. package/src/plugins/rain/helpers.d.ts +0 -9
  65. package/src/plugins/rain/helpers.js +0 -66
  66. package/src/plugins/rain/helpers.js.map +0 -1
  67. package/src/plugins/rain/loansFetcher.js +0 -139
  68. package/src/plugins/rain/loansFetcher.js.map +0 -1
  69. package/src/plugins/rain/structs/loan.d.ts +0 -86
  70. package/src/plugins/rain/structs/loan.js +0 -86
  71. package/src/plugins/rain/structs/loan.js.map +0 -1
  72. package/src/plugins/rain/structs/pool.d.ts +0 -79
  73. package/src/plugins/rain/structs/pool.js +0 -76
  74. package/src/plugins/rain/structs/pool.js.map +0 -1
  75. /package/src/plugins/rain/{loansFetcher.d.ts → banksFetcher.d.ts} +0 -0
@@ -17,19 +17,15 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
17
  const constants_1 = require("./constants");
18
18
  const clients_1 = require("../../utils/clients");
19
19
  const solana_1 = require("../../utils/solana");
20
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
21
- const getAssetBatchDas_1 = require("../../utils/solana/das/getAssetBatchDas");
22
- const getSolanaDasEndpoint_1 = __importDefault(require("../../utils/clients/getSolanaDasEndpoint"));
23
- const heliusAssetToAssetCollectible_1 = require("../../utils/solana/das/heliusAssetToAssetCollectible");
24
20
  const filters_1 = require("./filters");
25
21
  const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
26
22
  const arrayToMap_1 = require("../../utils/misc/arrayToMap");
23
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
27
24
  const collectionsMemo = new MemoizedCache_1.MemoizedCache(constants_1.collectionsCacheKey, {
28
25
  prefix: constants_1.cachePrefix,
29
26
  networkId: portfolio_core_1.NetworkId.solana,
30
27
  }, (arr) => (0, arrayToMap_1.arrayToMap)(arr || [], 'orderBook'));
31
28
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
32
- const dasUrl = (0, getSolanaDasEndpoint_1.default)();
33
29
  const connection = (0, clients_1.getClientSolana)();
34
30
  const [filterA, filterB, filterC] = (0, filters_1.getLoanFilters)(owner);
35
31
  const accounts = (yield Promise.all([
@@ -39,104 +35,73 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
39
35
  ])).flat();
40
36
  if (accounts.length === 0)
41
37
  return [];
42
- const [solTokenPrice, heliusAssets, collections] = yield Promise.all([
38
+ const [solTokenPrice, collections] = yield Promise.all([
43
39
  cache.getTokenPrice(portfolio_core_1.solanaNativeAddress, portfolio_core_1.NetworkId.solana),
44
- (0, getAssetBatchDas_1.getAssetBatchDasAsMap)(dasUrl, accounts
45
- .map((acc) => { var _a; return (_a = acc.loanState.taken) === null || _a === void 0 ? void 0 : _a.taken.nftCollateralMint; })
46
- .filter((mint) => mint)),
47
40
  collectionsMemo.getItem(cache),
48
41
  ]);
49
- if (!solTokenPrice || !collections)
50
- return [];
51
- const elements = [];
42
+ if (!collections)
43
+ throw new Error('Collections not cached');
44
+ if (!solTokenPrice)
45
+ throw new Error('Sol price not cached');
46
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
52
47
  accounts.forEach((acc) => {
53
48
  var _a;
54
49
  const collection = collections.get(acc.orderBook);
55
50
  if (!collection)
56
51
  return;
57
- const borrowedAssets = [];
58
- const suppliedAssets = [];
52
+ const element = elementRegistry.addElementBorrowlend({
53
+ label: 'Lending',
54
+ });
59
55
  let mintAsset = null;
60
56
  if ((_a = acc.loanState.taken) === null || _a === void 0 ? void 0 : _a.taken.nftCollateralMint) {
61
- const heliusAsset = heliusAssets.get(acc.loanState.taken.taken.nftCollateralMint);
62
- if (heliusAsset) {
63
- const assetValue = new bignumber_js_1.default(collection.floor)
64
- .multipliedBy(solTokenPrice.price)
65
- .toNumber();
66
- mintAsset = (0, heliusAssetToAssetCollectible_1.heliusAssetToAssetCollectible)(heliusAsset, {
67
- tags: [portfolio_core_1.collectibleFreezedTag],
68
- collection: {
69
- name: collection.name,
70
- floorPrice: assetValue,
71
- },
72
- });
73
- }
57
+ mintAsset = {
58
+ address: acc.loanState.taken.taken.nftCollateralMint,
59
+ collection: {
60
+ name: collection.name,
61
+ floorPrice: new bignumber_js_1.default(collection.floor).multipliedBy(solTokenPrice.price),
62
+ },
63
+ attributes: { tags: [portfolio_core_1.collectibleFreezedTag] },
64
+ };
74
65
  }
75
- const solAsset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.solanaNativeAddress, new bignumber_js_1.default(acc.principalLamports)
76
- .dividedBy(Math.pow(10, portfolio_core_1.solanaNativeDecimals))
77
- .toNumber(), portfolio_core_1.NetworkId.solana, solTokenPrice);
66
+ const solAsset = {
67
+ address: portfolio_core_1.solanaNativeAddress,
68
+ amount: acc.principalLamports,
69
+ };
78
70
  let name;
79
71
  if (acc.loanState.offer) {
80
72
  // LENDER
81
- suppliedAssets.push(solAsset);
73
+ element.addSuppliedAsset(solAsset);
82
74
  name = `Lend Offer on ${collection.name}`;
83
75
  }
84
76
  else if (acc.loanState.taken) {
85
77
  if (acc.loanState.taken.taken.lenderNoteMint === owner.toString()) {
86
78
  // LENDER
87
- suppliedAssets.push(solAsset);
79
+ element.addSuppliedAsset(solAsset);
88
80
  if (mintAsset)
89
- borrowedAssets.push(mintAsset);
81
+ element.addBorrowedCollectibleAsset(mintAsset);
90
82
  name = `Active Loan`;
91
83
  }
92
84
  else {
93
85
  // BORROWER
94
86
  if (mintAsset) {
95
- suppliedAssets.push(mintAsset);
87
+ element.addSuppliedCollectibleAsset(mintAsset);
96
88
  }
97
- borrowedAssets.push(solAsset);
89
+ element.addBorrowedAsset(solAsset);
98
90
  name = `Active Loan`;
99
91
  }
100
92
  }
101
- if (suppliedAssets.length === 0)
102
- return;
103
- const { borrowedValue, suppliedValue, rewardValue, value } = (0, portfolio_core_1.getElementNFTLendingValues)({
104
- suppliedAssets,
105
- borrowedAssets,
106
- rewardAssets: [],
107
- lender: acc.loanState.offer !== undefined ||
108
- (acc.loanState.taken
109
- ? acc.loanState.taken.taken.lenderNoteMint === owner.toString()
110
- : false),
111
- });
112
- elements.push({
113
- networkId: portfolio_core_1.NetworkId.solana,
114
- label: 'Lending',
115
- platformId: constants_1.platformId,
116
- type: portfolio_core_1.PortfolioElementType.borrowlend,
117
- value,
118
- name,
119
- data: {
120
- borrowedAssets,
121
- borrowedValue,
122
- borrowedYields: [],
123
- suppliedAssets,
124
- suppliedValue,
125
- suppliedYields: [],
126
- rewardAssets: [],
127
- rewardValue,
128
- healthRatio: null,
129
- value,
130
- ref: acc.pubkey.toString(),
131
- expireOn: acc.loanState.taken
132
- ? (Number(acc.loanState.taken.taken.terms.time.start) +
133
- Number(acc.loanState.taken.taken.terms.time.duration)) *
134
- 1000
135
- : undefined,
136
- },
137
- });
93
+ if (name)
94
+ element.setName(name);
95
+ element.setFixedTerms(acc.loanState.offer !== undefined ||
96
+ (acc.loanState.taken
97
+ ? acc.loanState.taken.taken.lenderNoteMint === owner.toString()
98
+ : false), acc.loanState.taken
99
+ ? (Number(acc.loanState.taken.taken.terms.time.start) +
100
+ Number(acc.loanState.taken.taken.terms.time.duration)) *
101
+ 1000
102
+ : undefined);
138
103
  });
139
- return elements;
104
+ return elementRegistry.getElements(cache);
140
105
  });
141
106
  const fetcher = {
142
107
  id: `${constants_1.platformId}-loans`,
@@ -1 +1 @@
1
- {"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sharky/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gEAAqC;AAErC,2CAKqB;AAErB,iDAAsD;AACtD,+CAG4B;AAE5B,qGAA6E;AAC7E,8EAAgF;AAChF,oGAA4E;AAC5E,wGAAqG;AACrG,uCAA2C;AAC3C,kEAA+D;AAC/D,4DAAyD;AAEzD,MAAM,eAAe,GAAG,IAAI,6BAAa,CAIvC,+BAAmB,EACnB;IACE,MAAM,EAAE,uBAAW;IACnB,SAAS,EAAE,0BAAS,CAAC,MAA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,MAAM;YAC3B,KAAK,EAAE,SAAS;YAChB,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,KAAK;YACL,IAAI;YACJ,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc,EAAE,EAAE;gBAClB,cAAc;gBACd,aAAa;gBACb,cAAc,EAAE,EAAE;gBAClB,YAAY,EAAE,EAAE;gBAChB,WAAW;gBACX,WAAW,EAAE,IAAI;gBACjB,KAAK;gBACL,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC1B,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK;oBAC3B,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;wBACjD,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACxD,IAAI;oBACN,CAAC,CAAC,SAAS;aACd;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sharky/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAErC,2CAKqB;AAErB,iDAAsD;AACtD,+CAG4B;AAE5B,uCAA2C;AAC3C,kEAA+D;AAC/D,4DAAyD;AACzD,gFAA6E;AAG7E,MAAM,eAAe,GAAG,IAAI,6BAAa,CAIvC,+BAA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AAO,CAAC"}
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
54
54
  }
55
55
  function getV3PairsAddresses(url, length = 300) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- const query = (0, graphql_request_1.gql) `
58
- {
59
- pools(
60
- orderBy: totalValueLockedUSD
61
- first: ${length}
62
- orderDirection: desc
63
- where: { volumeUSD_not: "0", liquidity_not: "0" }
64
- ) {
65
- id
66
- token0Price
67
- token1Price
68
- liquidity
69
- token0 {
70
- id
71
- totalSupply
72
- decimals
73
- }
74
- token1 {
75
- id
76
- totalSupply
77
- decimals
78
- }
79
- }
80
- }
57
+ const query = (0, graphql_request_1.gql) `
58
+ {
59
+ pools(
60
+ orderBy: totalValueLockedUSD
61
+ first: ${length}
62
+ orderDirection: desc
63
+ where: { volumeUSD_not: "0", liquidity_not: "0" }
64
+ ) {
65
+ id
66
+ token0Price
67
+ token1Price
68
+ liquidity
69
+ token0 {
70
+ id
71
+ totalSupply
72
+ decimals
73
+ }
74
+ token1 {
75
+ id
76
+ totalSupply
77
+ decimals
78
+ }
79
+ }
80
+ }
81
81
  `;
82
82
  const res = yield (0, graphql_request_1.default)(url, query);
83
83
  const pools = res.pools;
@@ -40,28 +40,28 @@ function getPairKey(version) {
40
40
  exports.getPairKey = getPairKey;
41
41
  function getPairsV2FromTheGraph(url, length = 300) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- const query = (0, graphql_request_1.gql) `
44
- {
45
- pairs(
46
- orderBy: reserveUSD
47
- first: ${length}
48
- orderDirection: desc
49
- where: { trackedReserveETH_not: "0" }
50
- ) {
51
- id
52
- reserve0
53
- reserve1
54
- totalSupply
55
- token0 {
56
- id
57
- decimals
58
- }
59
- token1 {
60
- id
61
- decimals
62
- }
63
- }
64
- }
43
+ const query = (0, graphql_request_1.gql) `
44
+ {
45
+ pairs(
46
+ orderBy: reserveUSD
47
+ first: ${length}
48
+ orderDirection: desc
49
+ where: { trackedReserveETH_not: "0" }
50
+ ) {
51
+ id
52
+ reserve0
53
+ reserve1
54
+ totalSupply
55
+ token0 {
56
+ id
57
+ decimals
58
+ }
59
+ token1 {
60
+ id
61
+ decimals
62
+ }
63
+ }
64
+ }
65
65
  `;
66
66
  const res = yield (0, graphql_request_1.default)(url, query);
67
67
  const pairs = res.pairs;
@@ -40,20 +40,20 @@ const clients_1 = require("../../utils/clients");
40
40
  const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
41
41
  const helpers_1 = require("./helpers");
42
42
  const AirdropFetcher_1 = require("../../AirdropFetcher");
43
- const query = (0, graphql_request_1.gql) `
44
- query GetAirdropFinalFrontend($authority: String!) {
45
- getAirdropFinalFrontend(authority: $authority) {
46
- authority
47
- community_allocation
48
- eligibility
49
- main_allocation
50
- og_allocation
51
- s1_allocation
52
- s2_allocation
53
- total_allocation
54
- __typename
55
- }
56
- }
43
+ const query = (0, graphql_request_1.gql) `
44
+ query GetAirdropFinalFrontend($authority: String!) {
45
+ getAirdropFinalFrontend(authority: $authority) {
46
+ authority
47
+ community_allocation
48
+ eligibility
49
+ main_allocation
50
+ og_allocation
51
+ s1_allocation
52
+ s2_allocation
53
+ total_allocation
54
+ __typename
55
+ }
56
+ }
57
57
  `;
58
58
  const networkId = portfolio_core_1.NetworkId.solana;
59
59
  const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
@@ -0,0 +1,10 @@
1
+ import { NetworkIdType, PortfolioAssetCollectible } from '@sonarwatch/portfolio-core';
2
+ import { TokenPriceMap } from '../../TokenPriceMap';
3
+ import { AssetBuilder } from './AssetBuilder';
4
+ import { PortfolioAssetCollectibleParams } from './Params';
5
+ export declare class AssetCollectibleBuilder extends AssetBuilder {
6
+ params: PortfolioAssetCollectibleParams;
7
+ constructor(params: PortfolioAssetCollectibleParams);
8
+ tokenAddresses(): string[];
9
+ get(networkId: NetworkIdType, tokenPrices: TokenPriceMap): PortfolioAssetCollectible | null;
10
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AssetCollectibleBuilder = void 0;
7
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
+ const AssetBuilder_1 = require("./AssetBuilder");
10
+ class AssetCollectibleBuilder extends AssetBuilder_1.AssetBuilder {
11
+ constructor(params) {
12
+ super();
13
+ this.params = params;
14
+ }
15
+ // eslint-disable-next-line class-methods-use-this
16
+ tokenAddresses() {
17
+ return [];
18
+ }
19
+ get(networkId,
20
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
+ tokenPrices) {
22
+ var _a;
23
+ return {
24
+ type: portfolio_core_1.PortfolioAssetType.collectible,
25
+ networkId,
26
+ value: new bignumber_js_1.default(this.params.collection.floorPrice)
27
+ .multipliedBy(new bignumber_js_1.default(this.params.amount || 1))
28
+ .toNumber(),
29
+ name: this.params.name || this.params.collection.name,
30
+ data: {
31
+ address: this.params.address.toString(),
32
+ amount: new bignumber_js_1.default(this.params.amount || 1).toNumber(),
33
+ price: new bignumber_js_1.default(this.params.collection.floorPrice).toNumber(),
34
+ name: this.params.name || this.params.collection.name,
35
+ imageUri: this.params.collection.imageUri,
36
+ /* dataUri: asset.content.json_uri,
37
+ attributes: asset.content.metadata.attributes, */
38
+ collection: {
39
+ name: this.params.collection.name,
40
+ floorPrice: new bignumber_js_1.default(this.params.collection.floorPrice).toNumber(),
41
+ },
42
+ },
43
+ imageUri: this.params.collection.imageUri,
44
+ attributes: this.params.attributes || {},
45
+ link: this.params.link ||
46
+ `https://www.tensor.trade/item/${this.params.address}`,
47
+ sourceRefs: this.params.sourceRefs,
48
+ ref: (_a = this.params.ref) === null || _a === void 0 ? void 0 : _a.toString(),
49
+ };
50
+ }
51
+ }
52
+ exports.AssetCollectibleBuilder = AssetCollectibleBuilder;
53
+ //# sourceMappingURL=AssetCollectibleBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetCollectibleBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/AssetCollectibleBuilder.ts"],"names":[],"mappings":";;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAErC,iDAA8C;AAG9C,MAAa,uBAAwB,SAAQ,2BAAY;IAGvD,YAAY,MAAuC;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,kDAAkD;IAClD,cAAc;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,GAAG,CACD,SAAwB;IACxB,6DAA6D;IAC7D,WAA0B;;QAE1B,OAAO;YACL,IAAI,EAAE,mCAAkB,CAAC,WAAW;YACpC,SAAS;YACT,KAAK,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;iBACpD,YAAY,CAAC,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;iBACpD,QAAQ,EAAE;YACb,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI;YACrD,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACvC,MAAM,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE;gBACzD,KAAK,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;gBAClE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI;gBACrD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ;gBACzC;iEACiD;gBACjD,UAAU,EAAE;oBACV,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI;oBACjC,UAAU,EAAE,IAAI,sBAAS,CACvB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAClC,CAAC,QAAQ,EAAE;iBACb;aACF;YACD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ;YACzC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE;YACxC,IAAI,EACF,IAAI,CAAC,MAAM,CAAC,IAAI;gBAChB,iCAAiC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACxD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;YAClC,GAAG,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,GAAG,0CAAE,QAAQ,EAAE;SACjC,CAAC;IACJ,CAAC;CACF;AAjDD,0DAiDC"}
@@ -1,6 +1,7 @@
1
1
  import { NetworkIdType, PortfolioElementBorrowLend, Yield } from '@sonarwatch/portfolio-core';
2
+ import BigNumber from 'bignumber.js';
2
3
  import { ElementBuilder } from './ElementBuilder';
3
- import { Params, PortfolioAssetGenericParams, PortfolioAssetTokenParams } from './Params';
4
+ import { Params, PortfolioAssetCollectibleParams, PortfolioAssetGenericParams, PortfolioAssetTokenParams } from './Params';
4
5
  import { TokenPriceMap } from '../../TokenPriceMap';
5
6
  import { AssetBuilder } from './AssetBuilder';
6
7
  import { AssetGenericBuilder } from './AssetGenericBuilder';
@@ -13,11 +14,17 @@ export declare class ElementBorrowlendBuilder extends ElementBuilder {
13
14
  suppliedYields: Yield[][];
14
15
  suppliedLtvs: number[];
15
16
  borrowedWeights: number[];
17
+ fixedTerms?: {
18
+ expireOn?: number;
19
+ isLender: boolean;
20
+ };
16
21
  constructor(params: Params);
17
22
  addBorrowedAsset(params: PortfolioAssetTokenParams): void;
18
23
  addBorrowedGenericAsset(params: PortfolioAssetGenericParams): void;
24
+ addBorrowedCollectibleAsset(params: PortfolioAssetCollectibleParams): void;
19
25
  addSuppliedAsset(params: PortfolioAssetTokenParams): void;
20
26
  addSuppliedGenericAsset(params: PortfolioAssetGenericParams): void;
27
+ addSuppliedCollectibleAsset(params: PortfolioAssetCollectibleParams): void;
21
28
  addRewardAsset(params: PortfolioAssetTokenParams): void;
22
29
  addRewardGenericAsset(params: PortfolioAssetGenericParams): void;
23
30
  addUnsettledGenericAsset(params: PortfolioAssetGenericParams): void;
@@ -25,6 +32,7 @@ export declare class ElementBorrowlendBuilder extends ElementBuilder {
25
32
  addSuppliedYield(ayield: Yield[]): void;
26
33
  addSuppliedLtv(ltv: number): void;
27
34
  addBorrowedWeight(borrowedWeight: number): void;
35
+ setFixedTerms(isLender: boolean, expireOn?: number | BigNumber): void;
28
36
  tokenAddresses(): string[];
29
37
  get(networkId: NetworkIdType, platformId: string, tokenPrices: TokenPriceMap): PortfolioElementBorrowLend | null;
30
38
  }
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.ElementBorrowlendBuilder = void 0;
4
7
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
5
9
  const ElementBuilder_1 = require("./ElementBuilder");
6
10
  const AssetTokenBuilder_1 = require("./AssetTokenBuilder");
7
11
  const AssetGenericBuilder_1 = require("./AssetGenericBuilder");
12
+ const AssetCollectibleBuilder_1 = require("./AssetCollectibleBuilder");
8
13
  class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
9
14
  constructor(params) {
10
15
  super(params);
@@ -23,12 +28,18 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
23
28
  addBorrowedGenericAsset(params) {
24
29
  this.borrowedAssets.push(new AssetGenericBuilder_1.AssetGenericBuilder(params));
25
30
  }
31
+ addBorrowedCollectibleAsset(params) {
32
+ this.borrowedAssets.push(new AssetCollectibleBuilder_1.AssetCollectibleBuilder(params));
33
+ }
26
34
  addSuppliedAsset(params) {
27
35
  this.suppliedAssets.push(new AssetTokenBuilder_1.AssetTokenBuilder(params));
28
36
  }
29
37
  addSuppliedGenericAsset(params) {
30
38
  this.suppliedAssets.push(new AssetGenericBuilder_1.AssetGenericBuilder(params));
31
39
  }
40
+ addSuppliedCollectibleAsset(params) {
41
+ this.suppliedAssets.push(new AssetCollectibleBuilder_1.AssetCollectibleBuilder(params));
42
+ }
32
43
  addRewardAsset(params) {
33
44
  this.rewardAssets.push(new AssetTokenBuilder_1.AssetTokenBuilder(params));
34
45
  }
@@ -50,6 +61,12 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
50
61
  addBorrowedWeight(borrowedWeight) {
51
62
  this.borrowedWeights.push(borrowedWeight);
52
63
  }
64
+ setFixedTerms(isLender, expireOn) {
65
+ this.fixedTerms = {
66
+ expireOn: expireOn ? new bignumber_js_1.default(expireOn).toNumber() : undefined,
67
+ isLender,
68
+ };
69
+ }
53
70
  tokenAddresses() {
54
71
  return [
55
72
  ...this.borrowedAssets.map((a) => a.tokenAddresses()),
@@ -59,7 +76,7 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
59
76
  ].flat();
60
77
  }
61
78
  get(networkId, platformId, tokenPrices) {
62
- var _a;
79
+ var _a, _b;
63
80
  const suppliedAssets = this.suppliedAssets
64
81
  .map((sAB, i) => {
65
82
  const sA = sAB.get(networkId, tokenPrices);
@@ -102,6 +119,26 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
102
119
  : undefined,
103
120
  unsettledAssets,
104
121
  });
122
+ let fixedTermsValue = 0;
123
+ if (this.fixedTerms) {
124
+ // Total value
125
+ if (borrowedValue === null || borrowedValue === 0) {
126
+ // it's an offer
127
+ fixedTermsValue = suppliedValue;
128
+ }
129
+ else if (suppliedValue !== null && suppliedValue !== 0) {
130
+ if (this.fixedTerms.isLender) {
131
+ // supplied sol, nft as collat
132
+ fixedTermsValue = Math.min(suppliedValue, borrowedValue);
133
+ }
134
+ else {
135
+ // supplied nft as collat, borrow sol
136
+ fixedTermsValue = Math.max(suppliedValue - borrowedValue, 0);
137
+ }
138
+ }
139
+ if (rewardValue !== null && value !== null)
140
+ fixedTermsValue = (fixedTermsValue || 0) + rewardValue;
141
+ }
105
142
  if (!suppliedValue && !borrowedValue && !rewardValue)
106
143
  return null;
107
144
  return {
@@ -123,12 +160,13 @@ class ElementBorrowlendBuilder extends ElementBuilder_1.ElementBuilder {
123
160
  assets: unsettledAssets,
124
161
  value: unsettledValue,
125
162
  },
126
- value,
163
+ value: this.fixedTerms ? fixedTermsValue : value,
127
164
  ref: (_a = this.ref) === null || _a === void 0 ? void 0 : _a.toString(),
128
165
  sourceRefs: this.sourceRefs,
129
166
  link: this.link,
167
+ expireOn: (_b = this.fixedTerms) === null || _b === void 0 ? void 0 : _b.expireOn,
130
168
  },
131
- value,
169
+ value: this.fixedTerms ? fixedTermsValue : value,
132
170
  name: this.name,
133
171
  tags: this.tags,
134
172
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ElementBorrowlendBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementBorrowlendBuilder.ts"],"names":[],"mappings":";;;AAAA,+DAQoC;AACpC,qDAAkD;AAQlD,2DAAwD;AACxD,+DAA4D;AAE5D,MAAa,wBAAyB,SAAQ,+BAAc;IAU1D,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,EA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AW,EACX,WAAW,EACX,cAAc,EACd,KAAK,GACN,GAAG,IAAA,wCAAuB,EAAC;YAC1B,cAAc;YACd,cAAc;YACd,YAAY;YACZ,YAAY,EACV,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM;gBAChD,CAAC,CAAC,IAAI,CAAC,YAAY;gBACnB,CAAC,CAAC,SAAS;YACf,eAAe,EACb,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM;gBACnD,CAAC,CAAC,IAAI,CAAC,eAAe;gBACtB,CAAC,CAAC,SAAS;YACf,eAAe;SAChB,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAElE,OAAO;YACL,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS;YACT,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,UAAU;YACzC,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,cAAc;gBACd,aAAa;gBACb,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,YAAY;gBACZ,WAAW;gBACX,WAAW;gBACX,SAAS,EAAE;oBACT,MAAM,EAAE,eAAe;oBACvB,KAAK,EAAE,cAAc;iBACtB;gBACD,KAAK;gBACL,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,0CAAE,QAAQ,EAAE;gBACzB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB;YACD,KAAK;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AA1KD,4DA0KC"}
1
+ {"version":3,"file":"ElementBorrowlendBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src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,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK;gBAChD,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,0CAAE,QAAQ,EAAE;gBACzB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,QAAQ;aACpC;YACD,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK;YAChD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AAjND,4DAiNC"}
@@ -59,7 +59,15 @@ class ElementRegistry {
59
59
  const tokenPrices = yield cache.getTokenPricesAsMap(mints, this.networkId);
60
60
  return this.elements
61
61
  .map((e) => e.get(this.networkId, this.platformId, tokenPrices))
62
- .filter((e) => e !== null && e.value && e.value > 0);
62
+ .filter((e) => e !== null)
63
+ .filter((e) => {
64
+ if (e &&
65
+ e.type === portfolio_core_1.PortfolioElementType.borrowlend &&
66
+ e.data.expireOn) {
67
+ return true;
68
+ }
69
+ return e && e.value && e.value > 0;
70
+ });
63
71
  });
64
72
  }
65
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ElementRegistry.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementRegistry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAKoC;AAIpC,qEAAkE;AAClE,uEAAoE;AACpE,yEAAsE;AACtE,qEAAkE;AAClE,+FAA4F;AAC5F,+DAA4D;AAE5D,MAAa,eAAe;IAK1B,YAAY,SAAwB,EAAE,UAAkB;QACtD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,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oB,CAAC,QAAQ,IACnC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,eAAe,CAAC,MAA4B;QAC1C,MAAM,cAAc,GAAG,IAAI,yCAAmB,iCACzC,MAAM,KACT,IAAI,EAAE,qCAAoB,CAAC,KAAK,IAChC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IAEK,WAAW,CAAC,KAAY;;YAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAClE,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAE3E,OAAO,IAAI,CAAC,QAAQ;iBACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;iBAC/D,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CACtB,CAAC;QAC5B,CAAC;KAAA;CACF;AAjFD,0CAiFC"}
1
+ {"version":3,"file":"ElementRegistry.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/ElementRegistry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAKoC;AAIpC,qEAAkE;AAClE,uEAAoE;AACpE,yEAAsE;AACtE,qEAAkE;AAClE,+FAA4F;AAC5F,+DAA4D;AAE5D,MAAa,eAAe;IAK1B,YAAY,SAAwB,E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AK,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;YACrC,CAAC,CAAuB,CAAC;QAC7B,CAAC;KAAA;CACF;AAzFD,0CAyFC"}
@@ -47,6 +47,20 @@ export type PortfolioAssetGenericParams = {
47
47
  ref?: string | PublicKey;
48
48
  link?: string;
49
49
  };
50
+ export type PortfolioAssetCollectibleParams = {
51
+ address: string | PublicKey;
52
+ amount?: number | BigNumber | string;
53
+ collection: {
54
+ name: string;
55
+ floorPrice: number | BigNumber | string;
56
+ imageUri?: string;
57
+ };
58
+ attributes?: PortfolioAssetAttributes;
59
+ name?: string;
60
+ sourceRefs?: SourceRef[];
61
+ ref?: string | PublicKey;
62
+ link?: string;
63
+ };
50
64
  export type PortfolioAssetTokenParams = {
51
65
  address: string | PublicKey;
52
66
  amount: number | BigNumber | string;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
4
- exports.infoQueryMsg = JSON.parse(`{
5
- "info": {}
4
+ exports.infoQueryMsg = JSON.parse(`{
5
+ "info": {}
6
6
  }`);
7
- exports.tokenInfoQueryMsg = JSON.parse(`{
8
- "token_info": {}
7
+ exports.tokenInfoQueryMsg = JSON.parse(`{
8
+ "token_info": {}
9
9
  }`);
10
- exports.minterQueryMsg = JSON.parse(`{
11
- "minter": {}
10
+ exports.minterQueryMsg = JSON.parse(`{
11
+ "minter": {}
12
12
  }`);
13
- exports.poolQueryMsg = JSON.parse(`{
14
- "pool": {}
13
+ exports.poolQueryMsg = JSON.parse(`{
14
+ "pool": {}
15
15
  }`);
16
16
  //# sourceMappingURL=constants.js.map