@sonarwatch/portfolio-plugins 0.12.178 → 0.12.180

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/CHANGELOG.md +1514 -1506
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/src/index.js +12 -0
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/joule/constants.d.ts +6 -0
  8. package/src/plugins/joule/constants.js +16 -0
  9. package/src/plugins/joule/constants.js.map +1 -0
  10. package/src/plugins/joule/depositFetcher.d.ts +3 -0
  11. package/src/plugins/joule/depositFetcher.js +71 -0
  12. package/src/plugins/joule/depositFetcher.js.map +1 -0
  13. package/src/plugins/joule/index.d.ts +6 -0
  14. package/src/plugins/joule/index.js +13 -0
  15. package/src/plugins/joule/index.js.map +1 -0
  16. package/src/plugins/{loopscale → joule}/marketsJob.js +10 -3
  17. package/src/plugins/joule/marketsJob.js.map +1 -0
  18. package/src/plugins/joule/structs.d.ts +19 -0
  19. package/src/plugins/joule/structs.js +22 -0
  20. package/src/plugins/joule/structs.js.map +1 -0
  21. package/src/plugins/joule/types.d.ts +50 -0
  22. package/src/plugins/joule/types.js +3 -0
  23. package/src/plugins/joule/types.js.map +1 -0
  24. package/src/plugins/loopscale/constants.d.ts +3 -1
  25. package/src/plugins/loopscale/constants.js +4 -4
  26. package/src/plugins/loopscale/constants.js.map +1 -1
  27. package/src/plugins/loopscale/filters.d.ts +7 -0
  28. package/src/plugins/loopscale/filters.js +62 -0
  29. package/src/plugins/loopscale/filters.js.map +1 -0
  30. package/src/plugins/loopscale/helpers.d.ts +33 -0
  31. package/src/plugins/loopscale/helpers.js +162 -0
  32. package/src/plugins/loopscale/helpers.js.map +1 -0
  33. package/src/plugins/loopscale/index.js +1 -2
  34. package/src/plugins/loopscale/index.js.map +1 -1
  35. package/src/plugins/loopscale/positionsFetcher.js +89 -40
  36. package/src/plugins/loopscale/positionsFetcher.js.map +1 -1
  37. package/src/plugins/loopscale/structs.d.ts +95 -14
  38. package/src/plugins/loopscale/structs.js +87 -13
  39. package/src/plugins/loopscale/structs.js.map +1 -1
  40. package/src/plugins/meso/constants.d.ts +7 -0
  41. package/src/plugins/meso/constants.js +17 -0
  42. package/src/plugins/meso/constants.js.map +1 -0
  43. package/src/plugins/meso/depositFetcher.d.ts +3 -0
  44. package/src/plugins/meso/depositFetcher.js +93 -0
  45. package/src/plugins/meso/depositFetcher.js.map +1 -0
  46. package/src/plugins/meso/index.d.ts +6 -0
  47. package/src/plugins/meso/index.js +13 -0
  48. package/src/plugins/meso/index.js.map +1 -0
  49. package/src/plugins/meso/marketsJob.d.ts +3 -0
  50. package/src/plugins/meso/marketsJob.js +37 -0
  51. package/src/plugins/meso/marketsJob.js.map +1 -0
  52. package/src/plugins/meso/structs.d.ts +19 -0
  53. package/src/plugins/meso/structs.js +22 -0
  54. package/src/plugins/meso/structs.js.map +1 -0
  55. package/src/plugins/meso/types.d.ts +100 -0
  56. package/src/plugins/meso/types.js +9 -0
  57. package/src/plugins/meso/types.js.map +1 -0
  58. package/src/plugins/orca/getWhirlpoolPositions.js +4 -0
  59. package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
  60. package/src/plugins/sushiswap/helpers.js +24 -24
  61. package/src/plugins/uniswap-v2/helpers.js +22 -22
  62. package/src/plugins/zeta/airdropFetcher.js +14 -14
  63. package/src/utils/sei/constants.js +8 -8
  64. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  65. package/src/plugins/loopscale/marketsJob.js.map +0 -1
  66. /package/src/plugins/{loopscale → joule}/marketsJob.d.ts +0 -0
@@ -0,0 +1,162 @@
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.getTokensBalance = exports.getBorrowerCollateralValues = exports.getBorrowerOrderValues = exports.getLenderOrderValues = exports.getOrdersForLoans = exports.getLoanVaults = exports.getEscrows = exports.getAdminOrgs = void 0;
16
+ const web3_js_1 = require("@solana/web3.js");
17
+ const solana_1 = require("../../utils/solana");
18
+ const constants_1 = require("./constants");
19
+ const structs_1 = require("./structs");
20
+ const filters_1 = require("./filters");
21
+ const getSolanaDasEndpoint_1 = __importDefault(require("../../utils/clients/getSolanaDasEndpoint"));
22
+ const getAssetsByOwnerDas_1 = require("../../utils/solana/das/getAssetsByOwnerDas");
23
+ const isHeliusFungibleAsset_1 = require("../../utils/solana/das/isHeliusFungibleAsset");
24
+ const getAdminOrgs = (connection, owner) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const roles = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.roleAccountStruct, constants_1.creditbookProgramId, (0, filters_1.roleFilters)(owner));
26
+ return roles
27
+ .filter((r) => r.type === 4 || r.type === 5)
28
+ .map((r) => r.organization);
29
+ });
30
+ exports.getAdminOrgs = getAdminOrgs;
31
+ const getEscrows = (connection, adminOrgs) => __awaiter(void 0, void 0, void 0, function* () {
32
+ return (yield Promise.all(adminOrgs.map((organizationIdentifier) => (0, solana_1.getParsedProgramAccounts)(connection, structs_1.escrowAccountStruct, constants_1.creditbookProgramId, (0, filters_1.escrowFilters)(organizationIdentifier.toString()))))).flat();
33
+ });
34
+ exports.getEscrows = getEscrows;
35
+ const getLoanVaults = (connection, escrowAccounts) => __awaiter(void 0, void 0, void 0, function* () {
36
+ const [loansBorrowed, loansLent] = yield Promise.all([
37
+ yield Promise.all(escrowAccounts.map((escrowAccount) => (0, solana_1.getParsedProgramAccounts)(connection, structs_1.loanVaultStruct, constants_1.creditbookProgramId, (0, filters_1.loanVaultBorrowedFilters)(escrowAccount.pubkey.toString())))),
38
+ yield Promise.all(escrowAccounts.map((escrowAccount) => (0, solana_1.getParsedProgramAccounts)(connection, structs_1.loanVaultStruct, constants_1.creditbookProgramId, (0, filters_1.loanVaultLentFilters)(escrowAccount.pubkey.toString())))),
39
+ ]);
40
+ return {
41
+ loansLent,
42
+ loansBorrowed,
43
+ };
44
+ });
45
+ exports.getLoanVaults = getLoanVaults;
46
+ const getOrdersForLoans = (connection, loans) => __awaiter(void 0, void 0, void 0, function* () {
47
+ const orderAddresses = loans.map((l) => l.order);
48
+ const orders = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.orderStruct, orderAddresses);
49
+ const orderLedgerAddresses = orderAddresses.map((o) => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('order_ledgers'), o.toBytes()], constants_1.creditbookProgramId)[0]);
50
+ const orderLedgers = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.orderLedgerStruct, orderLedgerAddresses);
51
+ const orderData = [];
52
+ for (let i = 0; i < orderAddresses.length; i++) {
53
+ const order = orders[i];
54
+ const orderLedger = orderLedgers[i];
55
+ if (!orderLedger)
56
+ continue;
57
+ const { ledgers } = orderLedger;
58
+ const orderAddress = orderAddresses[i];
59
+ orderData.push({ order, ledgers, orderAddress });
60
+ }
61
+ return orderData;
62
+ });
63
+ exports.getOrdersForLoans = getOrdersForLoans;
64
+ const getLenderOrderValues = (orders) => {
65
+ const loanValues = {};
66
+ for (let i = 0; i < orders.length; i++) {
67
+ const order = orders[i];
68
+ if (!order.order || !order.order.principal_mint)
69
+ continue;
70
+ const principal = order.order.principal_mint.toString();
71
+ const totalOwed = getOrderDueAmount(order.ledgers);
72
+ if (!Object.keys(loanValues).includes(principal)) {
73
+ loanValues[principal] = totalOwed;
74
+ }
75
+ else {
76
+ loanValues[principal] += totalOwed;
77
+ }
78
+ }
79
+ return loanValues;
80
+ };
81
+ exports.getLenderOrderValues = getLenderOrderValues;
82
+ const getBorrowerOrderValues = (orders) => {
83
+ const loanValues = {};
84
+ for (let i = 0; i < orders.length; i++) {
85
+ const order = orders[i];
86
+ if (!order.order || !order.order.principal_mint)
87
+ continue;
88
+ const principal = order.order.principal_mint.toString();
89
+ const totalDue = getOrderDueAmount(order.ledgers);
90
+ if (!Object.keys(loanValues).includes(principal)) {
91
+ loanValues[principal] = totalDue;
92
+ }
93
+ else {
94
+ loanValues[principal] += totalDue;
95
+ }
96
+ }
97
+ return loanValues;
98
+ };
99
+ exports.getBorrowerOrderValues = getBorrowerOrderValues;
100
+ function getOrderDueAmount(ledgers) {
101
+ return ledgers.reduce((prev, curr) => prev +
102
+ (curr.principal_due.toNumber() - curr.principal_repaid.toNumber()) +
103
+ (curr.interest_due.toNumber() - curr.interest_repaid.toNumber()), 0);
104
+ }
105
+ const getBorrowerCollateralValues = (connection, orders) => __awaiter(void 0, void 0, void 0, function* () {
106
+ const lbNfts = orders.map((o) => { var _a; return (_a = o.order) === null || _a === void 0 ? void 0 : _a.collateral_mint; });
107
+ const lockboxes = yield fetchLockboxesFromNFTs(connection, lbNfts.filter((p) => p !== null));
108
+ const balances = yield Promise.all(lockboxes.map((lockbox) => (0, exports.getTokensBalance)(lockbox.toString())));
109
+ return mergeBalances(balances);
110
+ });
111
+ exports.getBorrowerCollateralValues = getBorrowerCollateralValues;
112
+ const fetchLockboxesFromNFTs = (connection, nfts) => __awaiter(void 0, void 0, void 0, function* () {
113
+ const lbs = [];
114
+ for (let i = 0; i < nfts.length; i++) {
115
+ const lb = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.lockboxStruct, constants_1.lockboxProgramId, (0, filters_1.lockboxFilters)(nfts[i].toString()));
116
+ if (lb.length > 0)
117
+ lbs.push(lb[0].pubkey);
118
+ }
119
+ return lbs;
120
+ });
121
+ const getTokensBalance = (owner) => __awaiter(void 0, void 0, void 0, function* () {
122
+ const dasEndpoint = (0, getSolanaDasEndpoint_1.default)();
123
+ const items = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner, {
124
+ showNativeBalance: false,
125
+ showGrandTotal: false,
126
+ showInscription: false,
127
+ });
128
+ const escrowValues = {};
129
+ items.filter(isHeliusFungibleAsset_1.isHeliusFungibleAsset).forEach((asset) => {
130
+ var _a;
131
+ if (!((_a = asset.token_info) === null || _a === void 0 ? void 0 : _a.balance))
132
+ return;
133
+ if (!Object.keys(escrowValues).includes(asset.id)) {
134
+ escrowValues[asset.id] = asset.token_info.balance;
135
+ }
136
+ else {
137
+ escrowValues[asset.id] += asset.token_info.balance;
138
+ }
139
+ });
140
+ return escrowValues;
141
+ });
142
+ exports.getTokensBalance = getTokensBalance;
143
+ const mergeBalances = (balances) => {
144
+ if (!balances.length)
145
+ return {};
146
+ if (balances.length === 1)
147
+ return balances[0];
148
+ const mainBalance = balances[0];
149
+ for (let i = 1; i < balances.length; i++) {
150
+ Object.keys(balances[i]).forEach((mint) => {
151
+ const amount = balances[i][mint];
152
+ if (!Object.keys(mainBalance).includes(mint)) {
153
+ mainBalance[mint] = amount;
154
+ }
155
+ else {
156
+ mainBalance[mint] += amount;
157
+ }
158
+ });
159
+ }
160
+ return mainBalance;
161
+ };
162
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +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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;IACL,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
@@ -5,9 +5,8 @@ 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 marketsJob_1 = __importDefault(require("./marketsJob"));
9
8
  const positionsFetcher_1 = __importDefault(require("./positionsFetcher"));
10
9
  exports.platforms = [constants_1.platform];
11
- exports.jobs = [marketsJob_1.default];
10
+ exports.jobs = [];
12
11
  exports.fetchers = [positionsFetcher_1.default];
13
12
  //# 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,8DAAsC;AACtC,0EAAkD;AAErC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,CAAC,CAAC;AAC3B,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,0EAAkD;AAErC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,0BAAgB,CAAC,CAAC"}
@@ -13,54 +13,103 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const web3_js_1 = require("@solana/web3.js");
17
16
  const constants_1 = require("./constants");
18
17
  const clients_1 = require("../../utils/clients");
19
- const solana_1 = require("../../utils/solana");
20
- const structs_1 = require("./structs");
21
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
18
+ const helpers_1 = require("./helpers");
19
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
20
+ const depositsFetcher_1 = __importDefault(require("../marginfi/depositsFetcher"));
22
21
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
22
  const connection = (0, clients_1.getClientSolana)();
24
- const accounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.liquidityStruct, new web3_js_1.PublicKey('pid'), [
25
- {
26
- dataSize: structs_1.liquidityStruct.byteSize,
27
- },
28
- {
29
- memcmp: {
30
- bytes: owner,
31
- offset: 40,
32
- },
33
- },
34
- ]);
35
- if (accounts.length === 0)
23
+ const adminOrgs = yield (0, helpers_1.getAdminOrgs)(connection, owner);
24
+ if (!adminOrgs.length)
36
25
  return [];
37
- const solTokenPrice = yield cache.getTokenPrice(portfolio_core_1.solanaNativeAddress, portfolio_core_1.NetworkId.solana);
38
- const assets = [];
39
- accounts.forEach((acc) => {
40
- if (acc.amountDeposited.isZero())
41
- return;
42
- const amount = acc.amountDeposited
43
- .div(Math.pow(10, portfolio_core_1.solanaNativeDecimals))
44
- .toNumber();
45
- const asset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.solanaNativeAddress, amount, portfolio_core_1.NetworkId.solana, solTokenPrice);
46
- assets.push(asset);
47
- });
48
- if (assets.length === 0)
26
+ const escrowAccounts = yield (0, helpers_1.getEscrows)(connection, adminOrgs);
27
+ if (!escrowAccounts.length)
49
28
  return [];
50
- const element = {
51
- networkId: portfolio_core_1.NetworkId.solana,
52
- label: 'Deposit',
53
- platformId: constants_1.platformId,
54
- type: portfolio_core_1.PortfolioElementType.multiple,
55
- value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
56
- data: {
57
- assets,
58
- },
59
- };
60
- return [element];
29
+ const { loansLent, loansBorrowed } = yield (0, helpers_1.getLoanVaults)(connection, escrowAccounts);
30
+ const lenderLoanValues = [];
31
+ const borrowerLoanValues = [];
32
+ const borrowerCollateralValues = [];
33
+ for (const escrowAccount of escrowAccounts) {
34
+ const e = escrowAccounts.indexOf(escrowAccount);
35
+ const data = yield (0, helpers_1.getOrdersForLoans)(connection, [
36
+ ...loansLent[e],
37
+ ...loansBorrowed[e],
38
+ ]);
39
+ const lenderOrders = [];
40
+ for (let i = 0; i < loansLent[e].length; i++) {
41
+ const loan = loansLent[e][i];
42
+ const order = data.find((o) => o.orderAddress.toString() === loan.order.toString());
43
+ if (order !== undefined &&
44
+ order.order &&
45
+ (order.order.status === 1 || order.order.status === 2))
46
+ lenderOrders.push(order);
47
+ }
48
+ const borrowerOrders = [];
49
+ for (let i = 0; i < loansBorrowed[e].length; i++) {
50
+ const loan = loansBorrowed[e][i];
51
+ const order = data.find((o) => o.orderAddress.toString() === loan.order.toString());
52
+ if (order !== undefined &&
53
+ order.order &&
54
+ (order.order.status === 1 || order.order.status === 2))
55
+ borrowerOrders.push(order);
56
+ }
57
+ lenderLoanValues.push((0, helpers_1.getLenderOrderValues)(lenderOrders));
58
+ borrowerLoanValues.push((0, helpers_1.getBorrowerOrderValues)(borrowerOrders));
59
+ borrowerCollateralValues.push(yield (0, helpers_1.getBorrowerCollateralValues)(connection, borrowerOrders));
60
+ }
61
+ const [escrowValues, escrowMarginfiElements] = yield Promise.all([
62
+ Promise.all(escrowAccounts.map((escrowAccount) => (0, helpers_1.getTokensBalance)(escrowAccount.pubkey.toString()))),
63
+ Promise.all(escrowAccounts.map((escrowAccount) => depositsFetcher_1.default.executor(escrowAccount.pubkey.toString(), cache))),
64
+ ]);
65
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
66
+ escrowAccounts.forEach((escrowAccount, i) => {
67
+ const element = elementRegistry.addElementBorrowlend({
68
+ label: 'Lending',
69
+ name: Object.keys(borrowerLoanValues[i]).length > 0 ? 'Borrow' : 'Lend',
70
+ });
71
+ escrowMarginfiElements[i].forEach((marginfiElement) => {
72
+ if (marginfiElement.type === portfolio_core_1.PortfolioElementType.borrowlend) {
73
+ marginfiElement.data.suppliedAssets.forEach((asset) => {
74
+ if (asset.data.address && asset.data.amount) {
75
+ element.addSuppliedAsset({
76
+ address: asset.data.address,
77
+ amount: asset.data.amount,
78
+ alreadyShifted: true,
79
+ });
80
+ }
81
+ });
82
+ }
83
+ });
84
+ Object.keys(escrowValues[i]).forEach((address) => {
85
+ element.addSuppliedAsset({
86
+ address,
87
+ amount: escrowValues[i][address],
88
+ });
89
+ });
90
+ Object.keys(lenderLoanValues[i]).forEach((address) => {
91
+ element.addSuppliedAsset({
92
+ address,
93
+ amount: lenderLoanValues[i][address],
94
+ });
95
+ });
96
+ Object.keys(borrowerLoanValues[i]).forEach((address) => {
97
+ element.addBorrowedAsset({
98
+ address,
99
+ amount: borrowerLoanValues[i][address],
100
+ });
101
+ });
102
+ Object.keys(borrowerCollateralValues[i]).forEach((address) => {
103
+ element.addSuppliedAsset({
104
+ address,
105
+ amount: borrowerCollateralValues[i][address],
106
+ });
107
+ });
108
+ });
109
+ return elementRegistry.getElements(cache);
61
110
  });
62
111
  const fetcher = {
63
- id: `${constants_1.platformId}-solana`,
112
+ id: `${constants_1.platformId}-positions`,
64
113
  networkId: portfolio_core_1.NetworkId.solana,
65
114
  executor,
66
115
  };
@@ -1 +1 @@
1
- {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,6CAA4C;AAE5C,2CAAyC;AAEzC,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA4C;AAC5C,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,IAA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AC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAE7E,2CAAyC;AAEzC,iDAAsD;AACtD,uCASmB;AACnB,gFAA6E;AAC7E,kFAA0D;AAE1D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAY,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAExD,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEjC,MAAM,cAAc,GAAG,MAAM,IAAA,oBAAU,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAE/D,IAAI,CAAC,cAAc,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEtC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM,IAAA,uBAAa,EACtD,UAAU,EACV,cAAc,CACf,CAAC;IAEF,MAAM,gBAAgB,GAA8B,EAAE,CAAC;IACvD,MAAM,kBAAkB,GAA8B,EAAE,CAAC;IACzD,MAAM,wBAAwB,GAA8B,EAAE,CAAC;IAC/D,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAAC,UAAU,EAAE;YAC/C,GAAG,SA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AC;aACvC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3D,OAAO,CAAC,gBAAgB,CAAC;gBACvB,OAAO;gBACP,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;aAC7C,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,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,19 +1,100 @@
1
1
  /// <reference types="node" />
2
- import { BeetStruct } from '@metaplex-foundation/beet';
3
2
  import { PublicKey } from '@solana/web3.js';
4
3
  import BigNumber from 'bignumber.js';
5
- export declare enum State {
6
- Uninitialized = 0,
7
- StakePool = 1,
8
- InactiveStakePool = 2,
9
- StakeAccount = 3
10
- }
11
- export type Liquidity = {
4
+ import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
5
+ export type RoleAccount = {
12
6
  buffer: Buffer;
13
- state: State;
14
- mint: PublicKey;
15
- owner: PublicKey;
16
- amountDeposited: BigNumber;
17
- space: number[];
7
+ user: PublicKey;
8
+ organization: PublicKey;
9
+ type: number;
18
10
  };
19
- export declare const liquidityStruct: BeetStruct<Liquidity, Partial<Liquidity>>;
11
+ export declare const roleAccountStruct: BeetStruct<RoleAccount, Partial<RoleAccount>>;
12
+ export type LoanVault = {
13
+ buffer: Buffer;
14
+ order: PublicKey;
15
+ lender: PublicKey;
16
+ borrower: PublicKey;
17
+ collateral: PublicKey;
18
+ debt_note: PublicKey;
19
+ credit_note: PublicKey;
20
+ credit_claimed: boolean;
21
+ debt_claimed: boolean;
22
+ loan_start_time: BigNumber;
23
+ num_fees_outstanding: BigNumber;
24
+ fees_received: BigNumber;
25
+ };
26
+ export declare const loanVaultStruct: BeetStruct<LoanVault, Partial<LoanVault>>;
27
+ export type EscrowAccount = {
28
+ buffer: Buffer;
29
+ organization_identifier: PublicKey;
30
+ num_escrowed: BigNumber;
31
+ nonce: PublicKey;
32
+ origination_cap: BigNumber;
33
+ cumulative_amount_originated: BigNumber;
34
+ external_yield_source: number;
35
+ };
36
+ export declare const escrowAccountStruct: BeetStruct<EscrowAccount, Partial<EscrowAccount>>;
37
+ export type Order = {
38
+ buffer: Buffer;
39
+ version: number;
40
+ nonce: PublicKey;
41
+ maker: PublicKey;
42
+ designated_taker: PublicKey;
43
+ principal_mint: PublicKey;
44
+ principal_amount: BigNumber;
45
+ collateral_mint: PublicKey;
46
+ collateral_amount: BigNumber;
47
+ maker_role: number;
48
+ last_updated_slot: BigNumber;
49
+ max_outstanding_payments: BigNumber;
50
+ last_payment_id: BigNumber;
51
+ final_payment_id: BigNumber;
52
+ final_payment_time_offset: BigNumber;
53
+ status: number;
54
+ default_type: number;
55
+ created_at: BigNumber;
56
+ funding_type: number;
57
+ allow_early_repayments: boolean;
58
+ origination_fee: BigNumber;
59
+ liquidation_manager: PublicKey;
60
+ market_manager: PublicKey;
61
+ liquidation_threshold: BigNumber;
62
+ refinance_enabled: boolean;
63
+ max_refinance_apy: BigNumber;
64
+ refinance_duration: BigNumber;
65
+ refinance_duration_type: number;
66
+ };
67
+ export declare const orderStruct: BeetStruct<Order, Partial<Order>>;
68
+ export type Ledger = {
69
+ ledger_id: BigNumber;
70
+ principal_due: BigNumber;
71
+ principal_repaid: BigNumber;
72
+ interest_due: BigNumber;
73
+ interest_repaid: BigNumber;
74
+ due_time_offset: BigNumber;
75
+ paid_time: BigNumber;
76
+ payment_type: number;
77
+ is_filled: boolean;
78
+ grace_period: BigNumber;
79
+ late_payment_fee: BigNumber;
80
+ early_payment_fee: BigNumber;
81
+ payment_window: BigNumber;
82
+ reserve: number[];
83
+ };
84
+ export declare const ledgerStruct: BeetStruct<Ledger, Partial<Ledger>>;
85
+ export type OrderLedger = {
86
+ buffer: Buffer;
87
+ version: number;
88
+ order: PublicKey;
89
+ ledgers: Ledger[];
90
+ };
91
+ export declare const orderLedgerStruct: FixableBeetStruct<OrderLedger, Partial<OrderLedger>>;
92
+ export type Lockbox = {
93
+ buffer: Buffer;
94
+ nonce: PublicKey;
95
+ name: Buffer;
96
+ initialization_time: BigNumber;
97
+ nft_mint: PublicKey;
98
+ state: number;
99
+ };
100
+ export declare const lockboxStruct: FixableBeetStruct<Lockbox, Partial<Lockbox>>;
@@ -1,22 +1,96 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.liquidityStruct = exports.State = void 0;
3
+ exports.lockboxStruct = exports.orderLedgerStruct = exports.ledgerStruct = exports.orderStruct = exports.escrowAccountStruct = exports.loanVaultStruct = exports.roleAccountStruct = void 0;
4
4
  const beet_1 = require("@metaplex-foundation/beet");
5
5
  const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
6
  const solana_1 = require("../../utils/solana");
7
- var State;
8
- (function (State) {
9
- State[State["Uninitialized"] = 0] = "Uninitialized";
10
- State[State["StakePool"] = 1] = "StakePool";
11
- State[State["InactiveStakePool"] = 2] = "InactiveStakePool";
12
- State[State["StakeAccount"] = 3] = "StakeAccount";
13
- })(State || (exports.State = State = {}));
14
- exports.liquidityStruct = new beet_1.BeetStruct([
7
+ exports.roleAccountStruct = new beet_1.BeetStruct([
15
8
  ['buffer', (0, solana_1.blob)(8)],
9
+ ['user', beet_solana_1.publicKey],
10
+ ['organization', beet_solana_1.publicKey],
11
+ ['type', beet_1.u32],
12
+ ], (args) => args);
13
+ exports.loanVaultStruct = new beet_1.BeetStruct([
14
+ ['buffer', (0, solana_1.blob)(8)],
15
+ ['order', beet_solana_1.publicKey],
16
+ ['lender', beet_solana_1.publicKey],
17
+ ['borrower', beet_solana_1.publicKey],
18
+ ['collateral', beet_solana_1.publicKey],
19
+ ['debt_note', beet_solana_1.publicKey],
20
+ ['credit_note', beet_solana_1.publicKey],
21
+ ['credit_claimed', beet_1.bool],
22
+ ['debt_claimed', beet_1.bool],
23
+ ['loan_start_time', solana_1.i64],
24
+ ['num_fees_outstanding', solana_1.u64],
25
+ ['fees_received', solana_1.u64],
26
+ ], (args) => args);
27
+ exports.escrowAccountStruct = new beet_1.BeetStruct([
28
+ ['buffer', (0, solana_1.blob)(8)],
29
+ ['organization_identifier', beet_solana_1.publicKey],
30
+ ['num_escrowed', solana_1.u64],
31
+ ['nonce', beet_solana_1.publicKey],
32
+ ['origination_cap', solana_1.u64],
33
+ ['cumulative_amount_originated', solana_1.u64],
34
+ ['external_yield_source', beet_1.u8],
35
+ ], (args) => args);
36
+ exports.orderStruct = new beet_1.BeetStruct([
37
+ ['buffer', (0, solana_1.blob)(8)],
38
+ ['version', beet_1.u8],
39
+ ['nonce', beet_solana_1.publicKey],
40
+ ['maker', beet_solana_1.publicKey],
41
+ ['designated_taker', beet_solana_1.publicKey],
42
+ ['principal_mint', beet_solana_1.publicKey],
43
+ ['principal_amount', solana_1.u64],
44
+ ['collateral_mint', beet_solana_1.publicKey],
45
+ ['collateral_amount', solana_1.u64],
46
+ ['maker_role', beet_1.u8],
47
+ ['last_updated_slot', solana_1.u64],
48
+ ['max_outstanding_payments', solana_1.u64],
49
+ ['last_payment_id', solana_1.u64],
50
+ ['final_payment_id', solana_1.u64],
51
+ ['final_payment_time_offset', solana_1.i64],
52
+ ['status', beet_1.u8],
53
+ ['default_type', beet_1.u8],
54
+ ['created_at', solana_1.i64],
55
+ ['funding_type', beet_1.u8],
56
+ ['allow_early_repayments', beet_1.bool],
57
+ ['origination_fee', solana_1.u64],
58
+ ['liquidation_manager', beet_solana_1.publicKey],
59
+ ['market_manager', beet_solana_1.publicKey],
60
+ ['liquidation_threshold', solana_1.u64],
61
+ ['refinance_enabled', beet_1.bool],
62
+ ['max_refinance_apy', solana_1.u64],
63
+ ['refinance_duration', solana_1.i64],
64
+ ['refinance_duration_type', beet_1.u8],
65
+ ], (args) => args);
66
+ exports.ledgerStruct = new beet_1.BeetStruct([
67
+ ['ledger_id', solana_1.u64],
68
+ ['principal_due', solana_1.u64],
69
+ ['principal_repaid', solana_1.u64],
70
+ ['interest_due', solana_1.u64],
71
+ ['interest_repaid', solana_1.u64],
72
+ ['due_time_offset', solana_1.i64],
73
+ ['paid_time', solana_1.i64],
74
+ ['payment_type', beet_1.u8],
75
+ ['is_filled', beet_1.bool],
76
+ ['grace_period', solana_1.i64],
77
+ ['late_payment_fee', solana_1.u64],
78
+ ['early_payment_fee', solana_1.u64],
79
+ ['payment_window', solana_1.i64],
80
+ ['reserve', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 32)],
81
+ ], (args) => args);
82
+ exports.orderLedgerStruct = new beet_1.FixableBeetStruct([
83
+ ['buffer', (0, solana_1.blob)(8)],
84
+ ['version', beet_1.u8],
85
+ ['order', beet_solana_1.publicKey],
86
+ ['ledgers', (0, beet_1.array)(exports.ledgerStruct)],
87
+ ], (args) => args);
88
+ exports.lockboxStruct = new beet_1.FixableBeetStruct([
89
+ ['buffer', (0, solana_1.blob)(8)],
90
+ ['nonce', beet_solana_1.publicKey],
91
+ ['name', (0, solana_1.blob)(24)],
92
+ ['initialization_time', solana_1.i64],
93
+ ['nft_mint', beet_solana_1.publicKey],
16
94
  ['state', beet_1.u8],
17
- ['mint', beet_solana_1.publicKey],
18
- ['owner', beet_solana_1.publicKey],
19
- ['amountDeposited', solana_1.u64],
20
- ['space', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 128)],
21
95
  ], (args) => args);
22
96
  //# sourceMappingURL=structs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/structs.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,+CAA+C;AAE/C,IAAY,KAKX;AALD,WAAY,KAAK;IACf,mDAAa,CAAA;IACb,2CAAS,CAAA;IACT,2DAAiB,CAAA;IACjB,iDAAY,CAAA;AACd,CAAC,EALW,KAAK,qBAAL,KAAK,QAKhB;AAWY,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,SAAE,CAAC;IACb,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,OAAO,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,GAAG,CAAC,CAAC;CAC1C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/structs.ts"],"names":[],"mappings":";;;AAEA,oDAQmC;AACnC,kEAA6D;AAC7D,+CAAoD;AASvC,QAAA,iBAAiB,GAAG,IAAI,iBAAU,CAC7C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,cAAc,EAAE,uBAAS,CAAC;IAC3B,CAAC,MAAM,EAAE,UAAG,CAAC;CACd,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC;AAiBW,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,YAAY,EAAE,uBAA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ACvB,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,EAAE,CAAC,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAc,CACzB,CAAC;AASW,QAAA,iBAAiB,GAAG,IAAI,wBAAiB,CACpD;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,SAAS,EAAE,SAAE,CAAC;IACf,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,SAAS,EAAE,IAAA,YAAK,EAAC,oBAAY,CAAC,CAAC;CACjC,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC;AAUW,QAAA,aAAa,GAAG,IAAI,wBAAiB,CAChD;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,MAAM,EAAE,IAAA,aAAI,EAAC,EAAE,CAAC,CAAC;IAClB,CAAC,qBAAqB,EAAE,YAAG,CAAC;IAC5B,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,OAAO,EAAE,SAAE,CAAC;CACd,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ export declare const platformId = "meso";
3
+ export declare const platform: Platform;
4
+ export declare const marketsCacheKey = "markets";
5
+ export declare const userPositionType = "0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::lending_pool::UserPosition";
6
+ export declare const lendingPoolType = "0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::lending_pool::LendingPool";
7
+ export declare const poolsApi = "https://api.meso.finance/api/v1/pool?page=1&limit=1000";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.poolsApi = exports.lendingPoolType = exports.userPositionType = exports.marketsCacheKey = exports.platform = exports.platformId = void 0;
4
+ exports.platformId = 'meso';
5
+ exports.platform = {
6
+ id: exports.platformId,
7
+ name: 'Meso',
8
+ image: 'https://sonar.watch/img/platforms/meso.webp',
9
+ website: 'https://app.meso.finance/',
10
+ twitter: 'https://x.com/Meso_Finance',
11
+ defiLlamaId: 'meso-finance', // from https://defillama.com/docs/api
12
+ };
13
+ exports.marketsCacheKey = `markets`;
14
+ exports.userPositionType = '0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::lending_pool::UserPosition';
15
+ exports.lendingPoolType = '0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::lending_pool::LendingPool';
16
+ exports.poolsApi = 'https://api.meso.finance/api/v1/pool?page=1&limit=1000';
17
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meso/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,4BAA4B;IACrC,WAAW,EAAE,cAAc,EAAE,sCAAsC;CACpE,CAAC;AAEW,QAAA,eAAe,GAAG,SAAS,CAAC;AAC5B,QAAA,gBAAgB,GAC3B,gGAAgG,CAAC;AACtF,QAAA,eAAe,GAC1B,+FAA+F,CAAC;AACrF,QAAA,QAAQ,GACnB,wDAAwD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;