@sonarwatch/portfolio-plugins 0.14.152 → 0.14.154

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 (77) hide show
  1. package/CHANGELOG.md +2236 -2228
  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/defituna/lendingPoolsJob.js +33 -0
  6. package/src/plugins/defituna/lendingPoolsJob.js.map +1 -1
  7. package/src/plugins/drift/spotMarketsJob.js +0 -1
  8. package/src/plugins/drift/spotMarketsJob.js.map +1 -1
  9. package/src/plugins/ensofi/index.js +2 -1
  10. package/src/plugins/ensofi/index.js.map +1 -1
  11. package/src/plugins/ensofi/solanaLoansJob.d.ts +3 -0
  12. package/src/plugins/ensofi/solanaLoansJob.js +63 -0
  13. package/src/plugins/ensofi/solanaLoansJob.js.map +1 -0
  14. package/src/plugins/ensofi/structs.js +2 -2
  15. package/src/plugins/ensofi/structs.js.map +1 -1
  16. package/src/plugins/kamino/reservesJob.js +35 -0
  17. package/src/plugins/kamino/reservesJob.js.map +1 -1
  18. package/src/plugins/loopscale/constants.d.ts +2 -3
  19. package/src/plugins/loopscale/constants.js +3 -4
  20. package/src/plugins/loopscale/constants.js.map +1 -1
  21. package/src/plugins/loopscale/helpers.d.ts +6 -33
  22. package/src/plugins/loopscale/helpers.js +39 -142
  23. package/src/plugins/loopscale/helpers.js.map +1 -1
  24. package/src/plugins/loopscale/index.js +10 -3
  25. package/src/plugins/loopscale/index.js.map +1 -1
  26. package/src/plugins/loopscale/lendFetcher.js +57 -0
  27. package/src/plugins/loopscale/lendFetcher.js.map +1 -0
  28. package/src/plugins/loopscale/lendVaultsFetcher.d.ts +6 -0
  29. package/src/plugins/loopscale/lendVaultsFetcher.js +68 -0
  30. package/src/plugins/loopscale/lendVaultsFetcher.js.map +1 -0
  31. package/src/plugins/loopscale/loansFetcher.d.ts +3 -0
  32. package/src/plugins/loopscale/loansFetcher.js +79 -0
  33. package/src/plugins/loopscale/loansFetcher.js.map +1 -0
  34. package/src/plugins/loopscale/structs.d.ts +116 -86
  35. package/src/plugins/loopscale/structs.js +101 -79
  36. package/src/plugins/loopscale/structs.js.map +1 -1
  37. package/src/plugins/loopscale/types.d.ts +6 -0
  38. package/src/plugins/loopscale/types.js +3 -0
  39. package/src/plugins/loopscale/types.js.map +1 -0
  40. package/src/plugins/loopscale/vaultsJob.d.ts +3 -0
  41. package/src/plugins/loopscale/vaultsJob.js +121 -0
  42. package/src/plugins/loopscale/vaultsJob.js.map +1 -0
  43. package/src/plugins/lulo/depositsFetcher.js +9 -29
  44. package/src/plugins/lulo/depositsFetcher.js.map +1 -1
  45. package/src/plugins/marginfi/banksJob.js +6 -2
  46. package/src/plugins/marginfi/banksJob.js.map +1 -1
  47. package/src/plugins/marginfi/constants.d.ts +5 -3
  48. package/src/plugins/marginfi/constants.js +8 -7
  49. package/src/plugins/marginfi/constants.js.map +1 -1
  50. package/src/plugins/marginfi/depositsFetcher.js +50 -27
  51. package/src/plugins/marginfi/depositsFetcher.js.map +1 -1
  52. package/src/plugins/marginfi/getMarginFiAccounts.d.ts +6 -0
  53. package/src/plugins/marginfi/getMarginFiAccounts.js +44 -0
  54. package/src/plugins/marginfi/getMarginFiAccounts.js.map +1 -0
  55. package/src/plugins/marginfi/helpers.d.ts +0 -5
  56. package/src/plugins/marginfi/helpers.js +1 -81
  57. package/src/plugins/marginfi/helpers.js.map +1 -1
  58. package/src/plugins/marginfi/structs/MarginfiAccount.d.ts +5 -0
  59. package/src/plugins/marginfi/structs/MarginfiAccount.js.map +1 -1
  60. package/src/plugins/suilend/helpers.js +2 -0
  61. package/src/plugins/suilend/helpers.js.map +1 -1
  62. package/src/plugins/sushiswap/helpers.js +24 -24
  63. package/src/plugins/uniswap-v2/helpers.js +22 -22
  64. package/src/utils/misc/getLendingMarketAprs.d.ts +3 -1
  65. package/src/utils/misc/getLendingMarketAprs.js +24 -1
  66. package/src/utils/misc/getLendingMarketAprs.js.map +1 -1
  67. package/src/utils/sei/constants.js +8 -8
  68. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  69. package/src/plugins/loopscale/filters.d.ts +0 -9
  70. package/src/plugins/loopscale/filters.js +0 -62
  71. package/src/plugins/loopscale/filters.js.map +0 -1
  72. package/src/plugins/loopscale/positionsFetcher.js +0 -119
  73. package/src/plugins/loopscale/positionsFetcher.js.map +0 -1
  74. package/src/plugins/marginfi/filters.d.ts +0 -5
  75. package/src/plugins/marginfi/filters.js +0 -45
  76. package/src/plugins/marginfi/filters.js.map +0 -1
  77. /package/src/plugins/loopscale/{positionsFetcher.d.ts → lendFetcher.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAwD;AACxD,+CAI4B;AAC5B,2CAAoE;AACpE,uCAYmB;AACnB,uCAMmB;AACnB,oGAA4E;AAC5E,oFAAiF;AACjF,wFAAqF;AAE9E,MAAM,YAAY,GAAG,CAC1B,UAAsB,EACtB,KAAa,EACS,EAAE;IACxB,MAAM,KAAK,GAAG,MAAM,IAAA,iCAAwB,EAC1C,UAAU,EACV,2BAAiB,EACjB,+BAAmB,EACnB,IAAA,qBAAW,EAAC,KAAK,CAAC,CACnB,CAAC;IAEF,OAAO,KAAK;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;SAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC,CAAA,CAAC;AAdW,QAAA,YAAY,gBAcvB;AAEK,MAAM,UAAU,GAAG,CACxB,UAAsB,EACtB,SAAsB,EACmB,EAAE;IAC3C,OAAA,CACE,MAAM,OAAO,CAAC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AC1C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,cAAc,CAAC;IACxB,CAAC;CAAA;AAxBD,8DAwBC"}
@@ -5,8 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchers = exports.jobs = exports.platforms = void 0;
7
7
  const constants_1 = require("./constants");
8
- const positionsFetcher_1 = __importDefault(require("./positionsFetcher"));
8
+ const lendVaultsFetcher_1 = __importDefault(require("./lendVaultsFetcher"));
9
+ const vaultsJob_1 = __importDefault(require("./vaultsJob"));
10
+ const lendFetcher_1 = __importDefault(require("./lendFetcher"));
11
+ const loansFetcher_1 = __importDefault(require("./loansFetcher"));
9
12
  exports.platforms = [constants_1.platform];
10
- exports.jobs = [];
11
- exports.fetchers = [positionsFetcher_1.default];
13
+ exports.jobs = [vaultsJob_1.default];
14
+ exports.fetchers = [
15
+ lendVaultsFetcher_1.default,
16
+ lendFetcher_1.default,
17
+ loansFetcher_1.default,
18
+ ];
12
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0EAAkD;AAErC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,0BAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,4EAAoD;AACpD,4DAAoC;AACpC,gEAAwC;AACxC,kEAA0C;AAE7B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,mBAAS,CAAC,CAAC;AAC1B,QAAA,QAAQ,GAAc;IACjC,2BAAiB;IACjB,qBAAW;IACX,sBAAY;CACb,CAAC"}
@@ -0,0 +1,57 @@
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 bn_js_1 = __importDefault(require("bn.js"));
18
+ const constants_1 = require("./constants");
19
+ const clients_1 = require("../../utils/clients");
20
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
21
+ const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
22
+ const structs_1 = require("./structs");
23
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
24
+ const connection = (0, clients_1.getClientSolana)();
25
+ const strategys = yield ParsedGpa_1.ParsedGpa.build(connection, structs_1.strategyStruct, constants_1.loopscaleProgramId)
26
+ .addFilter('accountDiscriminator', [174, 110, 39, 119, 82, 106, 169, 102])
27
+ .addFilter('lender', new web3_js_1.PublicKey(owner))
28
+ .run();
29
+ if (!strategys.length)
30
+ return [];
31
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
32
+ strategys.forEach((strategy) => {
33
+ const amount = new bn_js_1.default(strategy.external_yield_amount.array.reverse()).toNumber() +
34
+ new bn_js_1.default(strategy.current_deployed_amount.array.reverse()).toNumber() +
35
+ new bn_js_1.default(strategy.token_balance.array.reverse()).toNumber();
36
+ if (strategy.principal_mint === web3_js_1.PublicKey.default) {
37
+ return;
38
+ }
39
+ const element = elementRegistry.addElementBorrowlend({
40
+ label: 'Lending',
41
+ ref: strategy.pubkey,
42
+ link: 'https://app.loopscale.com/lend',
43
+ });
44
+ element.addSuppliedAsset({
45
+ address: strategy.principal_mint,
46
+ amount,
47
+ });
48
+ });
49
+ return elementRegistry.getElements(cache);
50
+ });
51
+ const fetcher = {
52
+ id: `${constants_1.platformId}-lend`,
53
+ networkId: portfolio_core_1.NetworkId.solana,
54
+ executor,
55
+ };
56
+ exports.default = fetcher;
57
+ //# sourceMappingURL=lendFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lendFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/lendFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAC5C,kDAAuB;AAEvB,2CAA6D;AAE7D,iDAAsD;AACtD,gFAA6E;AAC7E,kEAA+D;AAC/D,uCAA2C;AAE3C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,SAAS,GAAG,MAAM,qBAAS,CAAC,KAAK,CACrC,UAAU,EACV,wBAAc,EACd,8BAAkB,CACnB;SACE,SAAS,CAAC,sBAAsB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;SACzE,SAAS,CAAC,QAAQ,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC;SACzC,GAAG,EAAE,CAAC;IAET,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEjC,MAAM,eAAe,GAAG,IAAI,iCAAe,CAAC,0BAAS,CAAC,MAAM,EAAE,sBAAU,CAAC,CAAC;IAE1E,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,MAAM,MAAM,GACV,IAAI,eAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;YACjE,IAAI,eAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;YACnE,IAAI,eAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC5D,IAAI,QAAQ,CAAC,cAAc,KAAK,mBAAS,CAAC,OAAO,EAAE,CAAC;YAClD,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,eAAe,CAAC,oBAAoB,CAAC;YACnD,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,QAAQ,CAAC,MAAM;YACpB,IAAI,EAAE,gCAAgC;SACvC,CAAC,CAAC;QACH,OAAO,CAAC,gBAAgB,CAAC;YACvB,OAAO,EAAE,QAAQ,CAAC,cAAc;YAChC,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ import { MemoizedCache } from '../../utils/misc/MemoizedCache';
3
+ import { CachedVault } from './types';
4
+ export declare const vaultsMemo: MemoizedCache<CachedVault[], Map<string, CachedVault>>;
5
+ declare const fetcher: Fetcher;
6
+ export default fetcher;
@@ -0,0 +1,68 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.vaultsMemo = void 0;
13
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
14
+ const web3_js_1 = require("@solana/web3.js");
15
+ const constants_1 = require("./constants");
16
+ const clients_1 = require("../../utils/clients");
17
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
18
+ const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
19
+ const structs_1 = require("./structs");
20
+ const helpers_1 = require("./helpers");
21
+ const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
22
+ const arrayToMap_1 = require("../../utils/misc/arrayToMap");
23
+ exports.vaultsMemo = new MemoizedCache_1.MemoizedCache(constants_1.vaultsCacheKey, {
24
+ prefix: constants_1.platformId,
25
+ networkId: portfolio_core_1.NetworkId.solana,
26
+ }, (arr) => (0, arrayToMap_1.arrayToMap)(arr || [], 'pubkey'));
27
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
28
+ const connection = (0, clients_1.getClientSolana)();
29
+ const userVaultStakes = yield ParsedGpa_1.ParsedGpa.build(connection, structs_1.vaultStakeStruct, constants_1.loopscaleProgramId)
30
+ .addFilter('accountDiscriminator', [225, 34, 128, 53, 167, 239, 182, 107])
31
+ .addFilter('user', new web3_js_1.PublicKey(owner))
32
+ .run();
33
+ if (!userVaultStakes.length)
34
+ return [];
35
+ const vaults = yield exports.vaultsMemo.getItem(cache);
36
+ if (!vaults.size)
37
+ throw new Error('Vaults not cached');
38
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
39
+ userVaultStakes.forEach((stakeAccount) => {
40
+ const vault = vaults.get(stakeAccount.vault.toString());
41
+ if (!vault)
42
+ return;
43
+ const amount = (0, helpers_1.bytesToNumberLE)(new Uint8Array(stakeAccount.amount.array));
44
+ const element = elementRegistry.addElementMultiple({
45
+ label: 'Deposit',
46
+ ref: stakeAccount.pubkey,
47
+ sourceRefs: [
48
+ {
49
+ name: 'Vault',
50
+ address: vault.pubkey.toString(),
51
+ },
52
+ ],
53
+ link: `https://app.loopscale.com/vault/AXanCP4dJHtWd7zY4X7nwxN5t5Gysfy2uG3XTxSmXdaB${vault.pubkey}`,
54
+ });
55
+ element.addAsset({
56
+ address: vault.lp_mint,
57
+ amount,
58
+ });
59
+ });
60
+ return elementRegistry.getElements(cache);
61
+ });
62
+ const fetcher = {
63
+ id: `${constants_1.platformId}-lend-vaults`,
64
+ networkId: portfolio_core_1.NetworkId.solana,
65
+ executor,
66
+ };
67
+ exports.default = fetcher;
68
+ //# sourceMappingURL=lendVaultsFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lendVaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/lendVaultsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAE5C,2CAA6E;AAE7E,iDAAsD;AACtD,gFAA6E;AAC7E,kEAA+D;AAC/D,uCAA6C;AAC7C,uCAA4C;AAC5C,kEAA+D;AAE/D,4DAAyD;AAG5C,QAAA,UAAU,GAAG,IAAI,6BAAa,CAIzC,0BAAc,EACd;IACE,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,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K,EAAE,SAAS;YAChB,GAAG,EAAE,YAAY,CAAC,MAAM;YACxB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,OAAO;oBACb,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;iBACjC;aACF;YACD,IAAI,EAAE,+EAA+E,KAAK,CAAC,MAAM,EAAE;SACpG,CAAC,CAAC;QACH,OAAO,CAAC,QAAQ,CAAC;YACf,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,79 @@
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 bn_js_1 = __importDefault(require("bn.js"));
18
+ const constants_1 = require("./constants");
19
+ const clients_1 = require("../../utils/clients");
20
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
21
+ const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
22
+ const structs_1 = require("./structs");
23
+ const helpers_1 = require("./helpers");
24
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const connection = (0, clients_1.getClientSolana)();
26
+ const accounts = yield ParsedGpa_1.ParsedGpa.build(connection, structs_1.loanStruct, constants_1.loopscaleProgramId)
27
+ .addFilter('accountDiscriminator', [20, 195, 70, 117, 165, 227, 182, 1])
28
+ .addFilter('borrower', new web3_js_1.PublicKey(owner))
29
+ .run();
30
+ if (!accounts.length)
31
+ return [];
32
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
33
+ accounts.forEach((account) => {
34
+ const element = elementRegistry.addElementBorrowlend({
35
+ label: 'Lending',
36
+ ref: account.pubkey,
37
+ link: `https://app.loopscale.com/loan/${account.pubkey}`,
38
+ });
39
+ account.collateral.forEach((collateralData, i) => {
40
+ if (collateralData.asset_identifier.toString() ===
41
+ web3_js_1.PublicKey.default.toString()) {
42
+ return;
43
+ }
44
+ element.addSuppliedAsset({
45
+ address: collateralData.asset_identifier,
46
+ amount: new bn_js_1.default(collateralData.amount.array.reverse()).toNumber(),
47
+ });
48
+ element.addSuppliedLtv((0, helpers_1.bytesToNumberLE)(new Uint8Array(account.ltv_matrix[i][0].array)));
49
+ });
50
+ account.ledgers.forEach((ledger, i) => {
51
+ if (ledger.principal_mint.toString() === web3_js_1.PublicKey.default.toString()) {
52
+ return;
53
+ }
54
+ element.addBorrowedAsset({
55
+ address: ledger.principal_mint,
56
+ amount: new bn_js_1.default(ledger.principal_due.array.reverse()).toNumber() -
57
+ new bn_js_1.default(ledger.principal_repaid.array.reverse()).toNumber() +
58
+ new bn_js_1.default(ledger.interest_due.array.reverse()).toNumber() -
59
+ new bn_js_1.default(ledger.interest_repaid.array.reverse()).toNumber(),
60
+ });
61
+ element.addBorrowedWeight((0, helpers_1.bytesToNumberLE)(new Uint8Array(account.weight_matrix[i][0].array)));
62
+ const apy = (0, helpers_1.bytesToNumberLE)(new Uint8Array(ledger.apy.array)) / 1000000;
63
+ element.addBorrowedYield([
64
+ {
65
+ apy,
66
+ apr: (0, portfolio_core_1.apyToApr)(apy),
67
+ },
68
+ ]);
69
+ });
70
+ });
71
+ return elementRegistry.getElements(cache);
72
+ });
73
+ const fetcher = {
74
+ id: `${constants_1.platformId}-loans`,
75
+ networkId: portfolio_core_1.NetworkId.solana,
76
+ executor,
77
+ };
78
+ exports.default = fetcher;
79
+ //# sourceMappingURL=loansFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAiE;AACjE,6CAA4C;AAC5C,kDAAuB;AAEvB,2CAA6D;AAE7D,iDAAsD;AACtD,gFAA6E;AAC7E,kEAA+D;AAC/D,uCAAuC;AACvC,uCAA4C;AAE5C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,qBAAS,CAAC,KAAK,CACpC,UAAU,EACV,oBAAU,EACV,8BAAkB,CACnB;SACE,SAAS,CAAC,sBAAsB,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACvE,SAAS,CAAC,UAAU,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC;SAC3C,GAAG,EAAE,CAAC;IAET,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO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AAI,eAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;oBACvD,IAAI,eAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;oBAC1D,IAAI,eAAE,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;oBACtD,IAAI,eAAE,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;aAC5D,CAAC,CAAC;YAEH,OAAO,CAAC,iBAAiB,CACvB,IAAA,yBAAe,EAAC,IAAI,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CACnE,CAAC;YAEF,MAAM,GAAG,GAAG,IAAA,yBAAe,EAAC,IAAI,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC;YACxE,OAAO,CAAC,gBAAgB,CAAC;gBACvB;oBACE,GAAG;oBACH,GAAG,EAAE,IAAA,yBAAQ,EAAC,GAAG,CAAC;iBACnB;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,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,102 +1,132 @@
1
- /// <reference types="node" />
2
1
  /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
3
2
  /// <reference types="jito-ts/node_modules/@solana/web3.js" />
4
3
  import { PublicKey } from '@solana/web3.js';
5
4
  import BigNumber from 'bignumber.js';
6
- import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
7
- export type RoleAccount = {
8
- buffer: Buffer;
9
- user: PublicKey;
10
- organization: PublicKey;
11
- type: number;
5
+ import { BeetStruct } from '@metaplex-foundation/beet';
6
+ export type PodU32 = {
7
+ array: number[];
12
8
  };
13
- export declare const roleAccountStruct: BeetStruct<RoleAccount, Partial<RoleAccount>>;
14
- export type LoanVault = {
15
- buffer: Buffer;
16
- order: PublicKey;
17
- lender: PublicKey;
18
- borrower: PublicKey;
19
- collateral: PublicKey;
20
- debt_note: PublicKey;
21
- credit_note: PublicKey;
22
- credit_claimed: boolean;
23
- debt_claimed: boolean;
24
- loan_start_time: BigNumber;
25
- num_fees_outstanding: BigNumber;
26
- fees_received: BigNumber;
9
+ export declare const podU32Struct: BeetStruct<PodU32, Partial<PodU32>>;
10
+ export type Duration = {
11
+ duration: PodU32;
12
+ duration_type: number;
27
13
  };
28
- export declare const loanVaultStruct: BeetStruct<LoanVault, Partial<LoanVault>>;
29
- export type EscrowAccount = {
30
- buffer: Buffer;
31
- organization_identifier: PublicKey;
32
- num_escrowed: BigNumber;
33
- nonce: PublicKey;
34
- origination_cap: BigNumber;
35
- cumulative_amount_originated: BigNumber;
36
- external_yield_source: number;
14
+ export declare const durationStruct: BeetStruct<Duration, Partial<Duration>>;
15
+ export type PodDecimal = {
16
+ array: number[];
37
17
  };
38
- export declare const escrowAccountStruct: BeetStruct<EscrowAccount, Partial<EscrowAccount>>;
39
- export type Order = {
40
- buffer: Buffer;
41
- version: number;
18
+ export declare const podDecimalStruct: BeetStruct<PodDecimal, Partial<PodDecimal>>;
19
+ export type PodU128 = {
20
+ array: number[];
21
+ };
22
+ export declare const podU128Struct: BeetStruct<PodU128, Partial<PodU128>>;
23
+ export type PodU32CBPS = {
24
+ array: number[];
25
+ };
26
+ export declare const podU32CBPSStruct: BeetStruct<PodU32CBPS, Partial<PodU32CBPS>>;
27
+ export type PodU64 = {
28
+ array: number[];
29
+ };
30
+ export declare const podU64Struct: BeetStruct<PodU64, Partial<PodU64>>;
31
+ export type PodU64CBPS = {
32
+ array: number[];
33
+ };
34
+ export declare const podU64CBPSStruct: BeetStruct<PodU64CBPS, Partial<PodU64CBPS>>;
35
+ export type PodBool = {
36
+ value: number;
37
+ };
38
+ export declare const podBoolStruct: BeetStruct<PodBool, Partial<PodBool>>;
39
+ export type Vault = {
40
+ accountDiscriminator: number[];
41
+ manager: PublicKey;
42
42
  nonce: PublicKey;
43
- maker: PublicKey;
44
- designated_taker: PublicKey;
43
+ bump: number;
44
+ lp_supply: PodU64;
45
+ lp_mint: PublicKey;
45
46
  principal_mint: PublicKey;
46
- principal_amount: BigNumber;
47
- collateral_mint: PublicKey;
48
- collateral_amount: BigNumber;
49
- maker_role: number;
50
- last_updated_slot: BigNumber;
51
- max_outstanding_payments: BigNumber;
52
- last_payment_id: BigNumber;
53
- final_payment_id: BigNumber;
54
- final_payment_time_offset: BigNumber;
55
- status: number;
56
- default_type: number;
57
- created_at: BigNumber;
58
- funding_type: number;
59
- allow_early_repayments: boolean;
60
- origination_fee: BigNumber;
61
- liquidation_manager: PublicKey;
62
- market_manager: PublicKey;
63
- liquidation_threshold: BigNumber;
64
- refinance_enabled: boolean;
65
- max_refinance_apy: BigNumber;
66
- refinance_duration: BigNumber;
67
- refinance_duration_type: number;
47
+ cumulative_principal_deposited: PodU64;
48
+ deposits_enabled: PodBool;
49
+ max_early_unstake_fee: PodU64CBPS;
68
50
  };
69
- export declare const orderStruct: BeetStruct<Order, Partial<Order>>;
51
+ export declare const vaultStruct: BeetStruct<Vault, Partial<Vault>>;
52
+ export type VaultStake = {
53
+ accountDiscriminator: number[];
54
+ vault: PublicKey;
55
+ nonce: PublicKey;
56
+ bump: number;
57
+ user: PublicKey;
58
+ amount: PodU64;
59
+ duration: Duration;
60
+ start_time: PodU64;
61
+ end_time: PodU64;
62
+ unstake_time: PodU64;
63
+ unstake_fee_applied: PodU64;
64
+ };
65
+ export declare const vaultStakeStruct: BeetStruct<VaultStake, Partial<VaultStake>>;
70
66
  export type Ledger = {
71
- ledger_id: BigNumber;
72
- principal_due: BigNumber;
73
- principal_repaid: BigNumber;
74
- interest_due: BigNumber;
75
- interest_repaid: BigNumber;
76
- due_time_offset: BigNumber;
77
- paid_time: BigNumber;
78
- payment_type: number;
79
- is_filled: boolean;
80
- grace_period: BigNumber;
81
- late_payment_fee: BigNumber;
82
- early_payment_fee: BigNumber;
83
- payment_window: BigNumber;
84
- reserve: number[];
67
+ status: number;
68
+ strategy: PublicKey;
69
+ principal_mint: PublicKey;
70
+ market_information: PublicKey;
71
+ principal_due: PodU64;
72
+ principal_repaid: PodU64;
73
+ interest_due: PodU64;
74
+ interest_repaid: PodU64;
75
+ duration: Duration;
76
+ interest_per_second: PodDecimal;
77
+ start_time: PodU64;
78
+ end_time: PodU64;
79
+ apy: PodU64CBPS;
85
80
  };
86
81
  export declare const ledgerStruct: BeetStruct<Ledger, Partial<Ledger>>;
87
- export type OrderLedger = {
88
- buffer: Buffer;
82
+ export type Strategy = {
83
+ accountDiscriminator: number[];
89
84
  version: number;
90
- order: PublicKey;
91
- ledgers: Ledger[];
92
- };
93
- export declare const orderLedgerStruct: FixableBeetStruct<OrderLedger, Partial<OrderLedger>>;
94
- export type Lockbox = {
95
- buffer: Buffer;
96
85
  nonce: PublicKey;
97
- name: Buffer;
98
- initialization_time: BigNumber;
99
- nft_mint: PublicKey;
100
- state: number;
86
+ bump: number;
87
+ principal_mint: PublicKey;
88
+ lender: PublicKey;
89
+ originations_enabled: PodBool;
90
+ external_yield_source: number;
91
+ interest_per_second: PodDecimal;
92
+ last_accrued_timestamp: PodU64;
93
+ liquidity_buffer: PodU64CBPS;
94
+ token_balance: PodU64;
95
+ interest_fee: PodU64CBPS;
96
+ principal_fee: PodU64CBPS;
97
+ origination_fee: PodU64CBPS;
98
+ origination_cap: PodU64;
99
+ external_yield_amount: PodU64;
100
+ current_deployed_amount: PodU64;
101
+ outstanding_interest_amount: PodU64;
102
+ fee_claimable: PodU64;
103
+ cumulative_principal_originated: PodU128;
104
+ cumulative_interest_accrued: PodU128;
105
+ cumulative_loan_count: PodU64;
106
+ active_loan_count: PodU64;
107
+ market_information: PublicKey;
108
+ collateral_map: PodU64[][];
109
+ };
110
+ export declare const strategyStruct: BeetStruct<Strategy, Partial<Strategy>>;
111
+ export type CollateralData = {
112
+ asset_mint: PublicKey;
113
+ amount: PodU64;
114
+ asset_type: number;
115
+ asset_identifier: PublicKey;
116
+ };
117
+ export declare const collateralDataStruct: BeetStruct<CollateralData, Partial<CollateralData>>;
118
+ export type Loan = {
119
+ accountDiscriminator: number[];
120
+ version: number;
121
+ bump: number;
122
+ loan_type: number;
123
+ borrower: PublicKey;
124
+ nonce: BigNumber;
125
+ start_time: PodU64;
126
+ ledgers: Ledger[];
127
+ collateral: CollateralData[];
128
+ weight_matrix: PodU32CBPS[][];
129
+ ltv_matrix: PodU32CBPS[][];
130
+ lqt_matrix: PodU32CBPS[][];
101
131
  };
102
- export declare const lockboxStruct: FixableBeetStruct<Lockbox, Partial<Lockbox>>;
132
+ export declare const loanStruct: BeetStruct<Loan, Partial<Loan>>;