@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
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function getQueryBalanceByOwner(owner) {
4
- return JSON.parse(`{
5
- "balance": {
6
- "address": "${owner}"
7
- }
4
+ return JSON.parse(`{
5
+ "balance": {
6
+ "address": "${owner}"
7
+ }
8
8
  }`);
9
9
  }
10
10
  exports.default = getQueryBalanceByOwner;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.heliusAssetToAssetCollectible = void 0;
4
4
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
5
5
  function heliusAssetToAssetCollectible(asset, props) {
6
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
7
7
  // Tags
8
8
  const tags = [];
9
9
  if (asset.compression.compressed)
@@ -71,7 +71,8 @@ function heliusAssetToAssetCollectible(asset, props) {
71
71
  collection,
72
72
  },
73
73
  networkId: portfolio_core_1.NetworkId.solana,
74
- value: (_p = (_o = props === null || props === void 0 ? void 0 : props.collection) === null || _o === void 0 ? void 0 : _o.floorPrice) !== null && _p !== void 0 ? _p : null,
74
+ imageUri: (_o = asset.content.links) === null || _o === void 0 ? void 0 : _o.image,
75
+ value: (_q = (_p = props === null || props === void 0 ? void 0 : props.collection) === null || _p === void 0 ? void 0 : _p.floorPrice) !== null && _q !== void 0 ? _q : null,
75
76
  };
76
77
  }
77
78
  exports.heliusAssetToAssetCollectible = heliusAssetToAssetCollectible;
@@ -1 +1 @@
1
- {"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;AAGpC,SAAgB,6BAA6B,CAC3C,KAAkB,EAClB,KAGC;;IAED,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEhD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,UAA6C,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,QAAQ,CAAC;IAC5C,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,OAAO,CAAC;IAC1C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE1D,SAAS;IACT,IAAI,OAAO,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,GAAG,OAAO,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,M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ACF,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;aAC3B,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAA;aAChB,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,CAAA;QACzB,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,MAAM;YACN,KAAK,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,UAAU,mCAAI,IAAI;YAC5C,IAAI,EACF,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;iBAC3B,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAA;iBAChB,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,CAAA;YACzB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YAC/B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;YACpC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU;YAC7C,UAAU;SACX;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,UAAU,mCAAI,IAAI;KAC7C,CAAC;AACJ,CAAC;AAjFD,sEAiFC"}
1
+ {"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;AAGpC,SAAgB,6BAA6B,CAC3C,KAAkB,EAClB,KAGC;;IAED,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC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,0CAAE,IAAI,CAAA;YACzB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YAC/B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;YACpC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU;YAC7C,UAAU;SACX;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;QACpC,KAAK,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,UAAU,mCAAI,IAAI;KAC7C,CAAC;AACJ,CAAC;AAlFD,sEAkFC"}
@@ -1,7 +0,0 @@
1
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
2
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
3
- import { GetProgramAccountsFilter } from '@solana/web3.js';
4
- export declare const poolFilter: (owner: string) => GetProgramAccountsFilter[];
5
- export declare const loanBorrowerFilter: (owner: string) => GetProgramAccountsFilter[];
6
- export declare const loanLenderFilter: (owner: string) => GetProgramAccountsFilter[];
7
- export declare const assetFilters: (owner: string) => GetProgramAccountsFilter[];
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assetFilters = exports.loanLenderFilter = exports.loanBorrowerFilter = exports.poolFilter = void 0;
4
- const loan_1 = require("./structs/loan");
5
- const poolFilter = (owner) => [
6
- {
7
- memcmp: {
8
- offset: 9,
9
- bytes: owner,
10
- },
11
- },
12
- {
13
- dataSize: 1331,
14
- },
15
- ];
16
- exports.poolFilter = poolFilter;
17
- const loanBorrowerFilter = (owner) => [
18
- {
19
- memcmp: {
20
- offset: 10,
21
- bytes: owner,
22
- },
23
- },
24
- {
25
- dataSize: 1080,
26
- },
27
- ];
28
- exports.loanBorrowerFilter = loanBorrowerFilter;
29
- const loanLenderFilter = (owner) => [
30
- {
31
- memcmp: {
32
- offset: 42,
33
- bytes: owner,
34
- },
35
- },
36
- {
37
- dataSize: 1080,
38
- },
39
- ];
40
- exports.loanLenderFilter = loanLenderFilter;
41
- const assetFilters = (owner) => [
42
- {
43
- memcmp: {
44
- offset: 16,
45
- bytes: owner,
46
- },
47
- },
48
- {
49
- dataSize: loan_1.assetStruct.byteSize,
50
- },
51
- ];
52
- exports.assetFilters = assetFilters;
53
- //# sourceMappingURL=filters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/filters.ts"],"names":[],"mappings":";;;AACA,yCAA6C;AAEtC,MAAM,UAAU,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACvE;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAVW,QAAA,UAAU,cAUrB;AAEK,MAAM,kBAAkB,GAAG,CAChC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAZW,QAAA,kBAAkB,sBAY7B;AAEK,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC7E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAVW,QAAA,gBAAgB,oBAU3B;AAEK,MAAM,YAAY,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACzE;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,kBAAW,CAAC,QAAQ;KAC/B;CACF,CAAC;AAVW,QAAA,YAAY,gBAUvB"}
@@ -1,9 +0,0 @@
1
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
2
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
3
- import { PublicKey } from '@solana/web3.js';
4
- import { Collection, Pool } from './types';
5
- export declare function getPool(pool: string): Promise<Pool | undefined>;
6
- export declare function getCollections(): Promise<Collection[]>;
7
- export declare function getPoolPda(owner: string): PublicKey;
8
- export declare function getLoans(owner: string): Promise<import("./types").Loan[]>;
9
- export declare function daysBetweenDates(start: Date, end: Date): number;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.daysBetweenDates = exports.getLoans = exports.getPoolPda = exports.getCollections = exports.getPool = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- const web3_js_1 = require("@solana/web3.js");
18
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
19
- const constants_1 = require("./constants");
20
- const oneDay = 1000 * 60 * 60 * 24;
21
- function getPool(pool) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const getPoolsRes = yield axios_1.default
24
- .get(`${constants_1.rainApi}/pools/pool?pubkey=${pool}`)
25
- .catch(() => null);
26
- if (!getPoolsRes || !getPoolsRes.data)
27
- return undefined;
28
- return getPoolsRes.data.pool;
29
- });
30
- }
31
- exports.getPool = getPool;
32
- function getCollections() {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const getCollectionsRes = yield axios_1.default.get(`${constants_1.rainApi}/collections`).catch(() => null);
35
- if (!getCollectionsRes || !getCollectionsRes.data)
36
- return [];
37
- return getCollectionsRes.data.collections;
38
- });
39
- }
40
- exports.getCollections = getCollections;
41
- function getPoolPda(owner) {
42
- return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('poolv2', 'utf-8'), new web3_js_1.PublicKey(owner).toBuffer()], constants_1.programId)[0];
43
- }
44
- exports.getPoolPda = getPoolPda;
45
- function getLoans(owner) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- const getLoansRes = yield axios_1.default
48
- .get(`${constants_1.rainApi}/loans/user?pubkey=${owner}&status=Ongoing`, {
49
- timeout: 1000,
50
- })
51
- .catch(() => null);
52
- if (!getLoansRes || getLoansRes.data.ongoingCount === 0)
53
- return [];
54
- return getLoansRes.data.loans;
55
- });
56
- }
57
- exports.getLoans = getLoans;
58
- function daysBetweenDates(start, end) {
59
- return new bignumber_js_1.default(end.getTime())
60
- .minus(start.getTime())
61
- .dividedBy(oneDay)
62
- .decimalPlaces(0, bignumber_js_1.default.ROUND_DOWN)
63
- .toNumber();
64
- }
65
- exports.daysBetweenDates = daysBetweenDates;
66
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,6CAA4C;AAC5C,gEAAqC;AACrC,2CAAiD;AASjD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEnC,SAAsB,OAAO,CAAC,IAAY;;QACxC,MAAM,WAAW,GAAuC,MAAM,eAAK;aAChE,GAAG,CAAC,GAAG,mBAAO,sBAAsB,IAAI,EAAE,CAAC;a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OAAO,IAAI,sBAAS,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SAChC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACtB,SAAS,CAAC,MAAM,CAAC;SACjB,aAAa,CAAC,CAAC,EAAE,sBAAS,CAAC,UAAU,CAAC;SACtC,QAAQ,EAAE,CAAC;AAChB,CAAC;AAND,4CAMC"}
@@ -1,139 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const web3_js_1 = require("@solana/web3.js");
17
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
- const constants_1 = require("./constants");
19
- const clients_1 = require("../../utils/clients");
20
- const solana_1 = require("../../utils/solana");
21
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
- const pool_1 = require("./structs/pool");
23
- const helpers_1 = require("./helpers");
24
- const getAssetBatchDas_1 = require("../../utils/solana/das/getAssetBatchDas");
25
- const getSolanaDasEndpoint_1 = __importDefault(require("../../utils/clients/getSolanaDasEndpoint"));
26
- const heliusAssetToAssetCollectible_1 = require("../../utils/solana/das/heliusAssetToAssetCollectible");
27
- const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
28
- const collectionMemo = new MemoizedCache_1.MemoizedCache(constants_1.collectionsKey, {
29
- prefix: constants_1.platformId,
30
- networkId: portfolio_core_1.NetworkId.solana,
31
- });
32
- const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
33
- const client = (0, clients_1.getClientSolana)();
34
- const dasUrl = (0, getSolanaDasEndpoint_1.default)();
35
- const loans = yield (0, helpers_1.getLoans)(owner);
36
- if (loans.length === 0)
37
- return [];
38
- const tokenMints = new Set();
39
- const nftMints = new Set();
40
- const pools = new Set();
41
- tokenMints.add(portfolio_core_1.solanaNativeAddress);
42
- loans.forEach((loan) => {
43
- pools.add(loan.pool.toString());
44
- tokenMints.add(loan.currency.toString());
45
- if (loan.isDefi)
46
- tokenMints.add(loan.mint.toString());
47
- else
48
- nftMints.add(loan.mint.toString());
49
- });
50
- const [tokenPriceById, heliusAssets, collections, poolsAccounts] = yield Promise.all([
51
- cache.getTokenPricesAsMap(Array.from(tokenMints), portfolio_core_1.NetworkId.solana),
52
- (0, getAssetBatchDas_1.getAssetBatchDasAsMap)(dasUrl, Array.from(nftMints)),
53
- collectionMemo.getItem(cache),
54
- (0, solana_1.getParsedMultipleAccountsInfo)(client, pool_1.poolStruct, Array.from(pools).map((pool) => new web3_js_1.PublicKey(pool))),
55
- ]);
56
- const poolById = new Map();
57
- poolsAccounts.forEach((account) => account ? poolById.set(account.pubkey.toString(), account) : undefined);
58
- const elements = [];
59
- for (const loan of loans) {
60
- if (new bignumber_js_1.default(loan.amount).isZero())
61
- continue;
62
- const collateralMint = loan.mint.toString();
63
- const borrowMint = loan.currency.toString();
64
- const borrowedAssets = [];
65
- const borrowedYields = [];
66
- const suppliedAssets = [];
67
- const suppliedYields = [];
68
- const rewardAssets = [];
69
- const daysRemaining = (0, helpers_1.daysBetweenDates)(new Date(), new Date(loan.expiredAt));
70
- const borrowTokenPrice = tokenPriceById.get(borrowMint);
71
- if (!borrowTokenPrice)
72
- continue;
73
- if (loan.isDefi) {
74
- // mint is a token
75
- const collatTokenPrice = tokenPriceById.get(collateralMint);
76
- if (!collatTokenPrice)
77
- continue;
78
- const amountDeposited = new bignumber_js_1.default(loan.collateralAmount).dividedBy(Math.pow(10, collatTokenPrice.decimals));
79
- if (!amountDeposited.isZero())
80
- suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(collatTokenPrice.address, amountDeposited.toNumber(), portfolio_core_1.NetworkId.solana, collatTokenPrice));
81
- }
82
- else {
83
- // mint is a nft
84
- const heliusAsset = heliusAssets.get(loan.mint);
85
- if (heliusAsset && collections) {
86
- const collection = collections.find((c) => c.collectionId === loan.collectionId);
87
- const solTokenPrice = tokenPriceById.get(portfolio_core_1.solanaNativeAddress);
88
- const assetValue = collection && solTokenPrice
89
- ? new bignumber_js_1.default(collection.floorPrice)
90
- .dividedBy(Math.pow(10, solTokenPrice.decimals))
91
- .multipliedBy(solTokenPrice.price)
92
- .toNumber()
93
- : undefined;
94
- const asset = (0, heliusAssetToAssetCollectible_1.heliusAssetToAssetCollectible)(heliusAsset, {
95
- tags: [portfolio_core_1.collectibleFreezedTag],
96
- collection: {
97
- name: collection === null || collection === void 0 ? void 0 : collection.name,
98
- floorPrice: assetValue,
99
- },
100
- });
101
- if (asset)
102
- suppliedAssets.push(asset);
103
- }
104
- }
105
- const amountBorrowed = new bignumber_js_1.default(loan.amount).dividedBy(Math.pow(10, borrowTokenPrice.decimals));
106
- if (!amountBorrowed.isZero())
107
- borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(borrowTokenPrice.address, amountBorrowed.toNumber(), portfolio_core_1.NetworkId.solana, borrowTokenPrice, undefined, { tags: [`Refund in ${daysRemaining} days`] }));
108
- if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
109
- continue;
110
- const { borrowedValue, healthRatio, suppliedValue, value, rewardValue } = (0, portfolio_core_1.getElementLendingValues)({ suppliedAssets, borrowedAssets, rewardAssets });
111
- elements.push({
112
- type: portfolio_core_1.PortfolioElementType.borrowlend,
113
- networkId: portfolio_core_1.NetworkId.solana,
114
- platformId: constants_1.platformId,
115
- label: 'Lending',
116
- value,
117
- data: {
118
- borrowedAssets,
119
- borrowedValue,
120
- borrowedYields,
121
- suppliedAssets,
122
- suppliedValue,
123
- suppliedYields,
124
- rewardAssets,
125
- healthRatio,
126
- rewardValue,
127
- value,
128
- },
129
- });
130
- }
131
- return elements;
132
- });
133
- const fetcher = {
134
- id: `${constants_1.platformId}-loans`,
135
- networkId: portfolio_core_1.NetworkId.solana,
136
- executor,
137
- };
138
- exports.default = fetcher;
139
- //# sourceMappingURL=loansFetcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAGrC,2CAAyD;AACzD,iDAAsD;AACtD,+CAG4B;AAC5B,qGAA6E;AAC7E,yCAAkD;AAClD,uCAAuD;AACvD,8EAAgF;AAChF,oGAA4E;AAC5E,wGAAqG;AAErG,kEAA+D;AAE/D,MAAM,cAAc,GAAG,IAAI,6BAAa,CAAqB,0BAAc,EAAE;IAC3E,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,MAAM,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAEtC,MAAM,KAAK,GAAG,MAAM,IAAA,kBAAQ,EAAC,KAAK,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAElC,MAAM,UAAU,GAAgB,IAAI,GAAG,EAAE,CAAC;IAC1C,MAAM,QAAQ,GAAgB,IAAI,GAAG,EAAE,CAAC;IACxC,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,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AgB,CAAC,OAAO,EACxB,cAAc,CAAC,QAAQ,EAAE,EACzB,0BAAS,CAAC,MAAM,EAChB,gBAAgB,EAChB,SAAS,EACT,EAAE,IAAI,EAAE,CAAC,aAAa,aAAa,OAAO,CAAC,EAAE,CAC9C,CACF,CAAC;QAEJ,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAEzE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EAAC,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAC;QAE5E,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,YAAY;gBACZ,WAAW;gBACX,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IACD,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,86 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
3
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
4
- import { BeetStruct } from '@metaplex-foundation/beet';
5
- import { PublicKey } from '@solana/web3.js';
6
- import BigNumber from 'bignumber.js';
7
- export declare enum LoanKind {
8
- Loan = 0,
9
- Mortgage = 1
10
- }
11
- export declare enum LoanStatus {
12
- Ongoing = 0,
13
- Repaid = 1,
14
- Liquidated = 2,
15
- Sold = 3
16
- }
17
- export declare enum Marketplace {
18
- None = 0,
19
- Auctionhouse = 1,
20
- Solanart = 2,
21
- Hyperspace = 3,
22
- Yaww = 4,
23
- Hadeswap = 5,
24
- Rain = 6,
25
- TensorswapOrder = 7,
26
- TensorswapListing = 8,
27
- MagicEden = 9
28
- }
29
- export type Sale = {
30
- isForSale: boolean;
31
- salePrice: BigNumber;
32
- currency: PublicKey;
33
- };
34
- export declare const saleStruct: BeetStruct<Sale, Partial<Sale>>;
35
- export type Listing = {
36
- isListed: boolean;
37
- price: BigNumber;
38
- };
39
- export declare const listingStruct: BeetStruct<Listing, Partial<Listing>>;
40
- export type Loan = {
41
- buffer: Buffer;
42
- kind: LoanKind;
43
- status: LoanStatus;
44
- borrower: PublicKey;
45
- lender: PublicKey;
46
- pool: PublicKey;
47
- mint: PublicKey;
48
- currency: PublicKey;
49
- isCustom: boolean;
50
- isFrozen: boolean;
51
- price: BigNumber;
52
- interest: BigNumber;
53
- amount: BigNumber;
54
- duration: BigNumber;
55
- collection: number;
56
- liquidation: number;
57
- marketplace: Marketplace;
58
- sale: Sale;
59
- createdAt: BigNumber;
60
- expiredAt: BigNumber;
61
- repaidAt: BigNumber;
62
- soldAt: BigNumber;
63
- liquidatedAt: BigNumber;
64
- listing: Listing;
65
- isCompressedLoan: boolean;
66
- isDefi: boolean;
67
- padding: BigNumber[];
68
- padding1: BigNumber;
69
- padding2: number;
70
- };
71
- export declare const loanStruct: BeetStruct<Loan, Partial<Loan>>;
72
- export type Asset = {
73
- buffer: Buffer;
74
- discriminator: BigNumber;
75
- borrower: PublicKey;
76
- nft: PublicKey;
77
- currencyIn: PublicKey;
78
- currencyOut: PublicKey;
79
- pythInFeed: PublicKey;
80
- pythOutFeed: PublicKey;
81
- amount: BigNumber;
82
- decimals: number;
83
- createdAt: BigNumber;
84
- padding: BigNumber[];
85
- };
86
- export declare const assetStruct: BeetStruct<Asset, Partial<Asset>>;
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assetStruct = exports.loanStruct = exports.listingStruct = exports.saleStruct = exports.Marketplace = exports.LoanStatus = exports.LoanKind = void 0;
4
- const beet_1 = require("@metaplex-foundation/beet");
5
- const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
- const solana_1 = require("../../../utils/solana");
7
- var LoanKind;
8
- (function (LoanKind) {
9
- LoanKind[LoanKind["Loan"] = 0] = "Loan";
10
- LoanKind[LoanKind["Mortgage"] = 1] = "Mortgage";
11
- })(LoanKind || (exports.LoanKind = LoanKind = {}));
12
- var LoanStatus;
13
- (function (LoanStatus) {
14
- LoanStatus[LoanStatus["Ongoing"] = 0] = "Ongoing";
15
- LoanStatus[LoanStatus["Repaid"] = 1] = "Repaid";
16
- LoanStatus[LoanStatus["Liquidated"] = 2] = "Liquidated";
17
- LoanStatus[LoanStatus["Sold"] = 3] = "Sold";
18
- })(LoanStatus || (exports.LoanStatus = LoanStatus = {}));
19
- var Marketplace;
20
- (function (Marketplace) {
21
- Marketplace[Marketplace["None"] = 0] = "None";
22
- Marketplace[Marketplace["Auctionhouse"] = 1] = "Auctionhouse";
23
- Marketplace[Marketplace["Solanart"] = 2] = "Solanart";
24
- Marketplace[Marketplace["Hyperspace"] = 3] = "Hyperspace";
25
- Marketplace[Marketplace["Yaww"] = 4] = "Yaww";
26
- Marketplace[Marketplace["Hadeswap"] = 5] = "Hadeswap";
27
- Marketplace[Marketplace["Rain"] = 6] = "Rain";
28
- Marketplace[Marketplace["TensorswapOrder"] = 7] = "TensorswapOrder";
29
- Marketplace[Marketplace["TensorswapListing"] = 8] = "TensorswapListing";
30
- Marketplace[Marketplace["MagicEden"] = 9] = "MagicEden";
31
- })(Marketplace || (exports.Marketplace = Marketplace = {}));
32
- exports.saleStruct = new beet_1.BeetStruct([
33
- ['isForSale', beet_1.bool],
34
- ['salePrice', solana_1.u64],
35
- ['currency', beet_solana_1.publicKey],
36
- ], (args) => args);
37
- exports.listingStruct = new beet_1.BeetStruct([
38
- ['isListed', beet_1.bool],
39
- ['price', solana_1.u64],
40
- ], (args) => args);
41
- exports.loanStruct = new beet_1.BeetStruct([
42
- ['buffer', (0, solana_1.blob)(8)],
43
- ['kind', beet_1.u8],
44
- ['status', beet_1.u8],
45
- ['borrower', beet_solana_1.publicKey],
46
- ['lender', beet_solana_1.publicKey],
47
- ['pool', beet_solana_1.publicKey],
48
- ['mint', beet_solana_1.publicKey],
49
- ['currency', beet_solana_1.publicKey],
50
- ['isCustom', beet_1.bool],
51
- ['isFrozen', beet_1.bool],
52
- ['price', solana_1.u64],
53
- ['interest', solana_1.u64],
54
- ['amount', solana_1.u64],
55
- ['duration', solana_1.u64],
56
- ['collection', beet_1.u32],
57
- ['liquidation', beet_1.u16],
58
- ['marketplace', beet_1.u8],
59
- ['sale', exports.saleStruct],
60
- ['createdAt', solana_1.u64],
61
- ['expiredAt', solana_1.u64],
62
- ['repaidAt', solana_1.u64],
63
- ['soldAt', solana_1.u64],
64
- ['liquidatedAt', solana_1.u64],
65
- ['listing', exports.listingStruct],
66
- ['isCompressedLoan', beet_1.bool],
67
- ['isDefi', beet_1.bool],
68
- ['padding', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 6)],
69
- ['padding1', beet_1.u32],
70
- ['padding2', beet_1.u8],
71
- ], (args) => args);
72
- exports.assetStruct = new beet_1.BeetStruct([
73
- ['buffer', (0, solana_1.blob)(8)],
74
- ['discriminator', solana_1.u64],
75
- ['borrower', beet_solana_1.publicKey],
76
- ['nft', beet_solana_1.publicKey],
77
- ['currencyIn', beet_solana_1.publicKey],
78
- ['currencyOut', beet_solana_1.publicKey],
79
- ['pythInFeed', beet_solana_1.publicKey],
80
- ['pythOutFeed', beet_solana_1.publicKey],
81
- ['amount', solana_1.u64],
82
- ['decimals', beet_1.u8],
83
- ['createdAt', solana_1.u64],
84
- ['padding', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 32)],
85
- ], (args) => args);
86
- //# sourceMappingURL=loan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loan.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/rain/structs/loan.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AACnC,kEAA6D;AAG7D,kDAAkD;AAElD,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uCAAI,CAAA;IACJ,+CAAQ,CAAA;AACV,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,iDAAO,CAAA;IACP,+CAAM,CAAA;IACN,uDAAU,CAAA;IACV,2CAAI,CAAA;AACN,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,IAAY,WAWX;AAXD,WAAY,WAAW;IACrB,6CAAI,CAAA;IACJ,6DAAY,CAAA;IACZ,qDAAQ,CAAA;IACR,yDAAU,CAAA;IACV,6CAAI,CAAA;IACJ,qDAAQ,CAAA;IACR,6CAAI,CAAA;IACJ,mEAAe,CAAA;IACf,uEAAiB,CAAA;IACjB,uDAAS,CAAA;AACX,CAAC,EAXW,WAAW,2BAAX,WAAW,QAWtB;AAMY,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,WAAW,EAAE,WAAI,CAAC;IACnB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,UAAU,EAAE,uBAAS,CAAC;CACxB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AAMW,QAAA,aAAa,GAAG,IAAI,iBAAU,CACzC;IACE,CAAC,UAAU,EAAE,WAAI,CAAC;IAClB,CAAC,OAAO,EAAE,YAAG,CAAC;CACf,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC;AAkCW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAA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AAC,CAAC;IACnB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,KAAK,EAAE,uBAAS,CAAC;IAClB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,UAAU,EAAE,SAAE,CAAC;IAChB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,YAAG,EAAE,EAAE,CAAC,CAAC;CAC5C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAa,CACxB,CAAC"}
@@ -1,79 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
3
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
4
- import { BeetStruct } from '@metaplex-foundation/beet';
5
- import { PublicKey } from '@solana/web3.js';
6
- import BigNumber from 'bignumber.js';
7
- export declare enum PoolStatus {
8
- Ready = 0,
9
- Disabled = 1
10
- }
11
- export type Curve = {
12
- baseInterest: number;
13
- interestRate: number;
14
- curveRate: number;
15
- curveRateDay: number;
16
- maxDuration: BigNumber;
17
- maxAmount: BigNumber;
18
- };
19
- export declare const curveStruct: BeetStruct<Curve, Partial<Curve>>;
20
- export type PoolCondition = {
21
- isEnabled: boolean;
22
- minAge: BigNumber;
23
- minLoan: BigNumber;
24
- minVolume: number;
25
- liquidationThreshold: number;
26
- padding1: number;
27
- padding2: number;
28
- padding3: number;
29
- };
30
- export declare const poolConditionStruct: BeetStruct<PoolCondition, Partial<PoolCondition>>;
31
- export type PoolLiquidation = {
32
- loanLiquidation: number;
33
- mortgageLiquidation: number;
34
- isAutoSellEnabled: boolean;
35
- percentageMaxLoss: number;
36
- };
37
- export declare const poolLiquidationStruct: BeetStruct<PoolLiquidation, Partial<PoolLiquidation>>;
38
- export type PoolCollection = {
39
- collection: number;
40
- collectionLtv: number;
41
- exposure: number;
42
- amountUsed: BigNumber;
43
- };
44
- export declare const poolCollectionStruct: BeetStruct<PoolCollection, Partial<PoolCollection>>;
45
- export type Pool = {
46
- buffer: Buffer;
47
- bump: number;
48
- owner: PublicKey;
49
- currency: PublicKey;
50
- oraclePoolUsd: PublicKey;
51
- oracleSolUsd: PublicKey;
52
- status: PoolStatus;
53
- isCompounded: boolean;
54
- isShared: boolean;
55
- totalAmount: BigNumber;
56
- borrowedAmount: BigNumber;
57
- availableAmount: BigNumber;
58
- usableAmount: BigNumber;
59
- loanCurve: Curve;
60
- mortgageCurve: Curve;
61
- isMortgageEnabled: boolean;
62
- nftLocked: BigNumber;
63
- totalLiquidations: BigNumber;
64
- totalLoans: BigNumber;
65
- totalMortgages: BigNumber;
66
- totalInterest: BigNumber;
67
- depositedAt: BigNumber;
68
- createdAt: BigNumber;
69
- updatedAt: BigNumber;
70
- collectionsUpdatedAt: BigNumber;
71
- lastLoanAt: BigNumber;
72
- lastMortgageAt: BigNumber;
73
- conditions: PoolCondition;
74
- liquidation: PoolLiquidation;
75
- whitelist: PublicKey;
76
- padding: BigNumber[];
77
- collections: PoolCollection[];
78
- };
79
- export declare const poolStruct: BeetStruct<Pool, Partial<Pool>>;