@sonarwatch/portfolio-plugins 0.12.176 → 0.12.178

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) 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 +8 -0
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/adrena/constants.d.ts +8 -0
  7. package/src/plugins/adrena/constants.js +18 -0
  8. package/src/plugins/adrena/constants.js.map +1 -0
  9. package/src/plugins/adrena/custodiesJob.d.ts +3 -0
  10. package/src/plugins/adrena/custodiesJob.js +34 -0
  11. package/src/plugins/adrena/custodiesJob.js.map +1 -0
  12. package/src/plugins/adrena/filters.d.ts +3 -0
  13. package/src/plugins/adrena/filters.js +21 -0
  14. package/src/plugins/adrena/filters.js.map +1 -0
  15. package/src/plugins/adrena/helpers.d.ts +5 -0
  16. package/src/plugins/adrena/helpers.js +22 -0
  17. package/src/plugins/adrena/helpers.js.map +1 -0
  18. package/src/plugins/adrena/index.d.ts +6 -0
  19. package/src/plugins/adrena/index.js +14 -0
  20. package/src/plugins/adrena/index.js.map +1 -0
  21. package/src/plugins/adrena/positionsFetcher.d.ts +3 -0
  22. package/src/plugins/adrena/positionsFetcher.js +49 -0
  23. package/src/plugins/adrena/positionsFetcher.js.map +1 -0
  24. package/src/plugins/adrena/stakingFetcher.d.ts +3 -0
  25. package/src/plugins/adrena/stakingFetcher.js +69 -0
  26. package/src/plugins/adrena/stakingFetcher.js.map +1 -0
  27. package/src/plugins/adrena/structs.d.ts +187 -0
  28. package/src/plugins/adrena/structs.js +175 -0
  29. package/src/plugins/adrena/structs.js.map +1 -0
  30. package/src/plugins/adrena/types.d.ts +9 -0
  31. package/src/plugins/adrena/types.js +3 -0
  32. package/src/plugins/adrena/types.js.map +1 -0
  33. package/src/plugins/balancer/helpers/pools.js +21 -21
  34. package/src/plugins/elemental/constants.d.ts +6 -0
  35. package/src/plugins/elemental/constants.js +20 -0
  36. package/src/plugins/elemental/constants.js.map +1 -0
  37. package/src/plugins/elemental/depositFetcher.d.ts +5 -0
  38. package/src/plugins/elemental/depositFetcher.js +88 -0
  39. package/src/plugins/elemental/depositFetcher.js.map +1 -0
  40. package/src/plugins/elemental/elementalVaultIDL.d.ts +67 -0
  41. package/src/plugins/elemental/elementalVaultIDL.js +342 -0
  42. package/src/plugins/elemental/elementalVaultIDL.js.map +1 -0
  43. package/src/plugins/elemental/filters.d.ts +3 -0
  44. package/src/plugins/elemental/filters.js +21 -0
  45. package/src/plugins/elemental/filters.js.map +1 -0
  46. package/src/plugins/elemental/helpers.d.ts +5 -0
  47. package/src/plugins/elemental/helpers.js +29 -0
  48. package/src/plugins/elemental/helpers.js.map +1 -0
  49. package/src/plugins/elemental/index.d.ts +6 -0
  50. package/src/plugins/elemental/index.js +13 -0
  51. package/src/plugins/elemental/index.js.map +1 -0
  52. package/src/plugins/elemental/poolsJob.d.ts +3 -0
  53. package/src/plugins/elemental/poolsJob.js +35 -0
  54. package/src/plugins/elemental/poolsJob.js.map +1 -0
  55. package/src/plugins/elemental/structs.d.ts +48 -0
  56. package/src/plugins/elemental/structs.js +50 -0
  57. package/src/plugins/elemental/structs.js.map +1 -0
  58. package/src/plugins/elemental/types.d.ts +37 -0
  59. package/src/plugins/elemental/types.js +3 -0
  60. package/src/plugins/elemental/types.js.map +1 -0
  61. package/src/plugins/flash/helpers.js +16 -1
  62. package/src/plugins/flash/helpers.js.map +1 -1
  63. package/src/plugins/flash/types.d.ts +5 -0
  64. package/src/plugins/hawksight/positionsFetcher.js +4 -0
  65. package/src/plugins/hawksight/positionsFetcher.js.map +1 -1
  66. package/src/plugins/jupiter/exchange/constants.d.ts +1 -0
  67. package/src/plugins/jupiter/exchange/constants.js +2 -1
  68. package/src/plugins/jupiter/exchange/constants.js.map +1 -1
  69. package/src/plugins/jupiter/exchange/filters.d.ts +1 -0
  70. package/src/plugins/jupiter/exchange/filters.js +11 -1
  71. package/src/plugins/jupiter/exchange/filters.js.map +1 -1
  72. package/src/plugins/jupiter/exchange/lockFetcher.d.ts +3 -0
  73. package/src/plugins/jupiter/exchange/lockFetcher.js +47 -0
  74. package/src/plugins/jupiter/exchange/lockFetcher.js.map +1 -0
  75. package/src/plugins/jupiter/exchange/structs.d.ts +19 -0
  76. package/src/plugins/jupiter/exchange/structs.js +19 -1
  77. package/src/plugins/jupiter/exchange/structs.js.map +1 -1
  78. package/src/plugins/jupiter/index.js +2 -0
  79. package/src/plugins/jupiter/index.js.map +1 -1
  80. package/src/plugins/navi/collateralFetcher.js +42 -81
  81. package/src/plugins/navi/collateralFetcher.js.map +1 -1
  82. package/src/plugins/sushiswap/helpers.js +24 -24
  83. package/src/plugins/uniswap-v2/helpers.js +22 -22
  84. package/src/plugins/zeta/airdropFetcher.js +14 -14
  85. package/src/utils/elementbuilder/AssetBuilder.d.ts +2 -1
  86. package/src/utils/elementbuilder/AssetBuilder.js +2 -1
  87. package/src/utils/elementbuilder/AssetBuilder.js.map +1 -1
  88. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +1 -1
  89. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -1
  90. package/src/utils/elementbuilder/PortfolioAssetParams.d.ts +2 -0
  91. package/src/utils/sei/constants.js +8 -8
  92. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.userStakingStruct = exports.liquidStakeStruct = exports.lockedStakeStruct = exports.positionStruct = exports.custodyStruct = exports.borrowRateStateStruct = exports.positionsAccountingStruct = exports.StableLockedAmountStatStruct = exports.u128SplitStruct = exports.tradeStatsStruct = exports.volumeStatsStruct = exports.assetsStruct = exports.feesStatsStruct = exports.borrowRateParamsStruct = exports.feesStruct = exports.pricingParamsStruct = 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
+ exports.pricingParamsStruct = new beet_1.BeetStruct([
8
+ ['maxInitialLeverage', beet_1.u32],
9
+ ['maxLeverage', beet_1.u32],
10
+ ['maxPositionLockedUsd', solana_1.u64],
11
+ ['maxCumulativeShortPositionSizeUsd', solana_1.u64],
12
+ ], (args) => args);
13
+ exports.feesStruct = new beet_1.BeetStruct([
14
+ ['swapIn', beet_1.u16],
15
+ ['swapOut', beet_1.u16],
16
+ ['stableSwapIn', beet_1.u16],
17
+ ['stableSwapOut', beet_1.u16],
18
+ ['addLiquidity', beet_1.u16],
19
+ ['removeLiquidity', beet_1.u16],
20
+ ['closePosition', beet_1.u16],
21
+ ['liquidation', beet_1.u16],
22
+ ['feeMax', beet_1.u16],
23
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 6)],
24
+ ['padding2', solana_1.u64],
25
+ ], (args) => args);
26
+ exports.borrowRateParamsStruct = new beet_1.BeetStruct([['maxHourlyBorrowInterestRate', solana_1.u64]], (args) => args);
27
+ exports.feesStatsStruct = new beet_1.BeetStruct([
28
+ ['swapUsd', solana_1.u64],
29
+ ['addLiquidityUsd', solana_1.u64],
30
+ ['removeLiquidityUsd', solana_1.u64],
31
+ ['closePositionUsd', solana_1.u64],
32
+ ['liquidationUsd', solana_1.u64],
33
+ ['borrowUsd', solana_1.u64],
34
+ ], (args) => args);
35
+ exports.assetsStruct = new beet_1.BeetStruct([
36
+ ['collateral', solana_1.u64],
37
+ ['owned', solana_1.u64],
38
+ ['locked', solana_1.u64],
39
+ ], (args) => args);
40
+ exports.volumeStatsStruct = new beet_1.BeetStruct([
41
+ ['swapUsd', solana_1.u64],
42
+ ['addLiquidityUsd', solana_1.u64],
43
+ ['removeLiquidityUsd', solana_1.u64],
44
+ ['openPositionUsd', solana_1.u64],
45
+ ['closePositionUsd', solana_1.u64],
46
+ ['liquidationUsd', solana_1.u64],
47
+ ], (args) => args);
48
+ exports.tradeStatsStruct = new beet_1.BeetStruct([
49
+ ['profitUsd', solana_1.u64],
50
+ ['lossUsd', solana_1.u64],
51
+ ['oiLongUsd', solana_1.u64],
52
+ ['oiShortUsd', solana_1.u64],
53
+ ], (args) => args);
54
+ exports.u128SplitStruct = new beet_1.BeetStruct([
55
+ ['high', solana_1.u64],
56
+ ['low', solana_1.u64],
57
+ ], (args) => args);
58
+ exports.StableLockedAmountStatStruct = new beet_1.BeetStruct([
59
+ ['custody', beet_solana_1.publicKey],
60
+ ['lockedAmount', solana_1.u64],
61
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
62
+ ], (args) => args);
63
+ exports.positionsAccountingStruct = new beet_1.FixableBeetStruct([
64
+ ['openPositions', solana_1.u64],
65
+ ['sizeUsd', solana_1.u64],
66
+ ['borrowSizeUsd', solana_1.u64],
67
+ ['lockedAmount', solana_1.u64],
68
+ ['weightedPrice', exports.u128SplitStruct],
69
+ ['totalQuantity', exports.u128SplitStruct],
70
+ ['cumulativeInterestUsd', solana_1.u64],
71
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
72
+ ['cumulativeInterestSnapshot', exports.u128SplitStruct],
73
+ ['exitFeeUsd', solana_1.u64],
74
+ [
75
+ 'stableLockedAmount',
76
+ (0, beet_1.uniformFixedSizeArray)(exports.StableLockedAmountStatStruct, 2),
77
+ ],
78
+ ], (args) => args);
79
+ exports.borrowRateStateStruct = new beet_1.BeetStruct([
80
+ ['currentRate', solana_1.u64],
81
+ ['lastUpdate', solana_1.i64],
82
+ ['cumulativeInterest', exports.u128SplitStruct],
83
+ ], (args) => args);
84
+ exports.custodyStruct = new beet_1.FixableBeetStruct([
85
+ ['buffer', (0, solana_1.blob)(8)],
86
+ ['bump', beet_1.u8],
87
+ ['tokenAccountBump', beet_1.u8],
88
+ ['allowTrade', beet_1.u8],
89
+ ['allowSwap', beet_1.u8],
90
+ ['decimals', beet_1.u8],
91
+ ['isStable', beet_1.u8],
92
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 2)],
93
+ ['pool', beet_solana_1.publicKey],
94
+ ['mint', beet_solana_1.publicKey],
95
+ ['tokenAccount', beet_solana_1.publicKey],
96
+ ['oracle', beet_solana_1.publicKey],
97
+ ['tradeOracle', beet_solana_1.publicKey],
98
+ ['pricing', exports.pricingParamsStruct],
99
+ ['fees', exports.feesStruct],
100
+ ['borrowRate', exports.borrowRateParamsStruct],
101
+ ['collectedFees', exports.feesStatsStruct],
102
+ ['volumeStats', exports.volumeStatsStruct],
103
+ ['tradeStats', exports.tradeStatsStruct],
104
+ ['assets', exports.assetsStruct],
105
+ ['longPositions', exports.positionsAccountingStruct],
106
+ ['shortPositions', exports.positionsAccountingStruct],
107
+ ['borrowRateState', exports.borrowRateStateStruct],
108
+ ], (args) => args);
109
+ exports.positionStruct = new beet_1.BeetStruct([
110
+ ['buffer', (0, solana_1.blob)(8)],
111
+ ['bump', beet_1.u8],
112
+ ['side', beet_1.u8],
113
+ ['takeProfitThreadIsSet', beet_1.u8],
114
+ ['stopLossThreadIsSet', beet_1.u8],
115
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 4)],
116
+ ['owner', beet_solana_1.publicKey],
117
+ ['pool', beet_solana_1.publicKey],
118
+ ['custody', beet_solana_1.publicKey],
119
+ ['collateralCustody', beet_solana_1.publicKey],
120
+ ['openTime', solana_1.i64],
121
+ ['updateTime', solana_1.i64],
122
+ ['price', solana_1.u64],
123
+ ['sizeUsd', solana_1.u64],
124
+ ['borrowSizeUsd', solana_1.u64],
125
+ ['collateralUsd', solana_1.u64],
126
+ ['unrealizedLossUsd', solana_1.u64],
127
+ ['cumulativeInterestSnapshot', exports.u128SplitStruct],
128
+ ['lockedAmount', solana_1.u64],
129
+ ['collateralAmount', solana_1.u64],
130
+ ['exitFeeUsd', solana_1.u64],
131
+ ['liquidationFeeUsd', solana_1.u64],
132
+ ['takeProfitThreadId', solana_1.u64],
133
+ ['takeProfitLimitPrice', solana_1.u64],
134
+ ['stopLossThreadId', solana_1.u64],
135
+ ['stopLossLimitPrice', solana_1.u64],
136
+ ['stopLossClosePositionPrice', solana_1.u64],
137
+ ], (args) => args);
138
+ exports.lockedStakeStruct = new beet_1.BeetStruct([
139
+ ['amount', solana_1.u64],
140
+ ['stakeTime', solana_1.i64],
141
+ ['claimTime', solana_1.i64],
142
+ ['endTime', solana_1.i64],
143
+ ['lockDuration', solana_1.u64],
144
+ ['rewardMultiplier', beet_1.u32],
145
+ ['lmRewardMultiplier', beet_1.u32],
146
+ ['voteMultiplier', beet_1.u32],
147
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 4)],
148
+ ['amountWithRewardMultiplier', solana_1.u64],
149
+ ['amountWithLmRewardMultiplier', solana_1.u64],
150
+ ['resolved', beet_1.u8],
151
+ ['padding2', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
152
+ ['stakeResolutionThreadId', solana_1.u64],
153
+ ['earlyExit', beet_1.u8],
154
+ ['padding3', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
155
+ ['earlyExitFee', solana_1.u64],
156
+ ['isGenesis', beet_1.u8],
157
+ ['padding4', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
158
+ ['genesisClaimTime', solana_1.i64],
159
+ ], (args) => args);
160
+ exports.liquidStakeStruct = new beet_1.BeetStruct([
161
+ ['amount', solana_1.u64],
162
+ ['stakeTime', solana_1.i64],
163
+ ['claimTime', solana_1.i64],
164
+ ['overlapTime', solana_1.i64],
165
+ ['overlapAmount', solana_1.u64],
166
+ ], (args) => args);
167
+ exports.userStakingStruct = new beet_1.FixableBeetStruct([
168
+ ['bump', beet_1.u8],
169
+ ['threadAuthorityBump', beet_1.u8],
170
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 6)],
171
+ ['stakesClaimCronThreadId', solana_1.u64],
172
+ ['liquidStake', exports.liquidStakeStruct],
173
+ ['lockedStakes', (0, beet_1.uniformFixedSizeArray)(exports.lockedStakeStruct, 32)],
174
+ ], (args) => args);
175
+ //# sourceMappingURL=structs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AACnC,kEAA6D;AAG7D,+CAAoD;AASvC,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,oBAAoB,EAAE,UAAG,CAAC;IAC3B,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,mCAAmC,EAAE,YAAG,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAqB,CAChC,CAAC;AAgBW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,UAAG,CAAC;IACf,CAAC,SAAS,EAAE,UAAG,CAAC;IAChB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,eAAe,EAAE,UAAG,CAAC;IACtB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,iBAAiB,EAAE,UAAG,CAAC;IACxB,CAAC,eAAe,EAAE,UAAG,CAAC;IACtB,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,QAAQ,EAAE,UAAG,CAAC;IACf,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,UAAU,EAAE,YAAG,CAAC;CAClB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AAMW,QAAA,sBAAsB,GAAG,IAAI,iBAAU,CAClD,CAAC,CAAC,6BAA6B,EAAE,YAAG,CAAC,CAAC,EACtC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAwB,CACnC,CAAC;AAWW,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,SAAS,EAAE,YAAG,CAAC;IAChB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,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CAC9B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ID } from '../../utils/sui/structs/id';
2
+ import { Custody } from './structs';
3
+ export type Receipt = {
4
+ id: ID;
5
+ amountDeposited: string;
6
+ };
7
+ export type CachedCustody = Custody & {
8
+ pubkey: string;
9
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/types.ts"],"names":[],"mappings":""}
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
36
36
  const graphql_request_1 = __importStar(require("graphql-request"));
37
37
  function getBalancerPoolsV2(url) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const query = (0, graphql_request_1.gql) `
40
- query pools {
41
- pools(
42
- first: 1000
43
- orderBy: totalLiquidity
44
- orderDirection: desc
45
- where: { totalLiquidity_gt: "500" }
46
- ) {
47
- id
48
- address
49
- symbol
50
- totalLiquidity
51
- totalShares
52
- tokens {
53
- balance
54
- decimals
55
- symbol
56
- address
57
- }
58
- }
59
- }
39
+ const query = (0, graphql_request_1.gql) `
40
+ query pools {
41
+ pools(
42
+ first: 1000
43
+ orderBy: totalLiquidity
44
+ orderDirection: desc
45
+ where: { totalLiquidity_gt: "500" }
46
+ ) {
47
+ id
48
+ address
49
+ symbol
50
+ totalLiquidity
51
+ totalShares
52
+ tokens {
53
+ balance
54
+ decimals
55
+ symbol
56
+ address
57
+ }
58
+ }
59
+ }
60
60
  `;
61
61
  const res = yield (0, graphql_request_1.default)(url, query);
62
62
  const pools = res.pools;
@@ -0,0 +1,6 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { IdlItem } from '@solanafm/explorer-kit-idls';
3
+ export declare const platformId = "elemental";
4
+ export declare const platform: Platform;
5
+ export declare const poolsCacheKey = "pools";
6
+ export declare const elementalIdlItem: IdlItem;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.elementalIdlItem = exports.poolsCacheKey = exports.platform = exports.platformId = void 0;
4
+ const elementalVaultIDL_1 = require("./elementalVaultIDL");
5
+ exports.platformId = 'elemental';
6
+ exports.platform = {
7
+ id: exports.platformId,
8
+ name: 'Elemental',
9
+ image: 'https://sonar.watch/img/platforms/elemental.webp',
10
+ website: 'https://elemental.fund/',
11
+ twitter: 'https://twitter.com/elementaldefi',
12
+ // defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
13
+ };
14
+ exports.poolsCacheKey = `pools`;
15
+ exports.elementalIdlItem = {
16
+ programId: elementalVaultIDL_1.elementalIDLs.address,
17
+ idl: elementalVaultIDL_1.elementalIDLs,
18
+ idlType: 'anchor',
19
+ };
20
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/elemental/constants.ts"],"names":[],"mappings":";;;AAEA,2DAAoD;AAEvC,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,kDAAkD;IACzD,OAAO,EAAE,yBAAyB;IAClC,OAAO,EAAE,mCAAmC;IAC5C,qEAAqE;CACtE,CAAC;AACW,QAAA,aAAa,GAAG,OAAO,CAAC;AAExB,QAAA,gBAAgB,GAAG;IAC9B,SAAS,EAAE,iCAAa,CAAC,OAAO;IAChC,GAAG,EAAE,iCAAa;IAClB,OAAO,EAAE,QAAQ;CACP,CAAC"}
@@ -0,0 +1,5 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { Fetcher } from '../../Fetcher';
3
+ export declare const FIXED_ONE: BigNumber;
4
+ declare const fetcher: Fetcher;
5
+ export default fetcher;
@@ -0,0 +1,88 @@
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.FIXED_ONE = void 0;
16
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
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 ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
22
+ const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
23
+ const structs_1 = require("./structs");
24
+ const helpers_1 = require("./helpers");
25
+ exports.FIXED_ONE = new bignumber_js_1.default(1000000000);
26
+ const poolsMemo = new MemoizedCache_1.MemoizedCache(constants_1.poolsCacheKey, {
27
+ prefix: constants_1.platformId,
28
+ networkId: portfolio_core_1.NetworkId.solana,
29
+ });
30
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
31
+ const connection = (0, clients_1.getClientSolana)();
32
+ const pools = yield poolsMemo.getItem(cache);
33
+ if (!pools)
34
+ return [];
35
+ const positionsKeys = pools.map((p) => (0, helpers_1.getPositionAddress)(p.pubkey, owner));
36
+ const positions = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.positionStruct, positionsKeys);
37
+ if (positions.length === 0)
38
+ return [];
39
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
40
+ for (const position of positions) {
41
+ if (!position)
42
+ continue;
43
+ const pool = pools.find((p) => p.pubkey === position.pool.toString());
44
+ if (!pool)
45
+ continue;
46
+ const element = elementRegistry.addElementMultiple({
47
+ label: 'Deposit',
48
+ });
49
+ element.addAsset({
50
+ address: pool.liquidity_mint,
51
+ amount: position.amount.dividedBy(pool.per_token_amount),
52
+ alreadyShifted: true,
53
+ attributes: { tags: [(0, helpers_1.getStatus)(position, pool)] },
54
+ });
55
+ const claimableAmount = position.amount
56
+ .times(pool.reward_per_token)
57
+ .div(exports.FIXED_ONE)
58
+ .minus(position.reward_before_deposit)
59
+ .plus(position.reward_earned)
60
+ .minus(position.reward_claimed);
61
+ element.addAsset({
62
+ address: pool.liquidity_mint,
63
+ amount: claimableAmount,
64
+ alreadyShifted: false,
65
+ attributes: { isClaimable: true },
66
+ });
67
+ element.addAsset({
68
+ address: pool.liquidity_mint,
69
+ amount: position.deactivating_amount.div(pool.per_token_amount),
70
+ alreadyShifted: true,
71
+ attributes: { tags: ['deactivating'] },
72
+ });
73
+ element.addAsset({
74
+ address: pool.liquidity_mint,
75
+ amount: position.claiming_amount.div(pool.per_token_amount),
76
+ alreadyShifted: true,
77
+ attributes: { tags: ['claiming'] },
78
+ });
79
+ }
80
+ return elementRegistry.getElements(cache);
81
+ });
82
+ const fetcher = {
83
+ id: `${constants_1.platformId}-deposits`,
84
+ networkId: portfolio_core_1.NetworkId.solana,
85
+ executor,
86
+ };
87
+ exports.default = fetcher;
88
+ //# sourceMappingURL=depositFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depositFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/elemental/depositFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAErC,2CAAwD;AAExD,iDAAsD;AACtD,+CAAmE;AACnE,gFAA6E;AAE7E,kEAA+D;AAC/D,uC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,CAAC;IAED,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,67 @@
1
+ export declare const elementalIDLs: {
2
+ address: string;
3
+ metadata: {
4
+ name: string;
5
+ version: string;
6
+ spec: string;
7
+ description: string;
8
+ };
9
+ accounts: {
10
+ name: string;
11
+ discriminator: number[];
12
+ }[];
13
+ events: {
14
+ name: string;
15
+ discriminator: number[];
16
+ }[];
17
+ errors: {
18
+ code: number;
19
+ name: string;
20
+ msg: string;
21
+ }[];
22
+ types: ({
23
+ name: string;
24
+ type: {
25
+ kind: string;
26
+ fields: ({
27
+ name: string;
28
+ type: string;
29
+ } | {
30
+ name: string;
31
+ type: {
32
+ option: string;
33
+ };
34
+ })[];
35
+ };
36
+ repr?: undefined;
37
+ } | {
38
+ name: string;
39
+ type: {
40
+ kind: string;
41
+ fields: ({
42
+ name: string;
43
+ type: string;
44
+ } | {
45
+ name: string;
46
+ type: {
47
+ defined: {
48
+ name: string;
49
+ };
50
+ };
51
+ })[];
52
+ };
53
+ repr?: undefined;
54
+ } | {
55
+ name: string;
56
+ repr: {
57
+ kind: string;
58
+ };
59
+ type: {
60
+ kind: string;
61
+ fields: {
62
+ name: string;
63
+ type: string;
64
+ }[];
65
+ };
66
+ })[];
67
+ };