@sonarwatch/portfolio-plugins 0.11.61 → 0.11.63

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/package.json +2 -2
  3. package/src/plugins/jupiter/airdropFetcher.js +1 -1
  4. package/src/plugins/jupiter/airdropFetcher.js.map +1 -1
  5. package/src/plugins/kamino/helpers/vaults.d.ts +13 -2
  6. package/src/plugins/kamino/helpers/vaults.js +41 -15
  7. package/src/plugins/kamino/helpers/vaults.js.map +1 -1
  8. package/src/plugins/kamino/poolsJob.js +19 -10
  9. package/src/plugins/kamino/poolsJob.js.map +1 -1
  10. package/src/plugins/marinade/constants.d.ts +2 -1
  11. package/src/plugins/marinade/constants.js +3 -2
  12. package/src/plugins/marinade/constants.js.map +1 -1
  13. package/src/plugins/marinade/helpers.d.ts +2 -0
  14. package/src/plugins/marinade/helpers.js +14 -0
  15. package/src/plugins/marinade/helpers.js.map +1 -0
  16. package/src/plugins/marinade/rewardsFetcher.js +72 -30
  17. package/src/plugins/marinade/rewardsFetcher.js.map +1 -1
  18. package/src/plugins/marinade/types.d.ts +23 -1
  19. package/src/plugins/meteora/constants.d.ts +1 -0
  20. package/src/plugins/meteora/constants.js +2 -1
  21. package/src/plugins/meteora/constants.js.map +1 -1
  22. package/src/plugins/meteora/dlmmHelper.d.ts +28 -0
  23. package/src/plugins/meteora/dlmmHelper.js +283 -0
  24. package/src/plugins/meteora/dlmmHelper.js.map +1 -0
  25. package/src/plugins/meteora/dlmmPositionsFetcher.d.ts +3 -0
  26. package/src/plugins/meteora/dlmmPositionsFetcher.js +155 -0
  27. package/src/plugins/meteora/dlmmPositionsFetcher.js.map +1 -0
  28. package/src/plugins/meteora/filters.d.ts +2 -0
  29. package/src/plugins/meteora/filters.js +21 -1
  30. package/src/plugins/meteora/filters.js.map +1 -1
  31. package/src/plugins/meteora/index.js +2 -1
  32. package/src/plugins/meteora/index.js.map +1 -1
  33. package/src/plugins/meteora/struct.d.ts +120 -0
  34. package/src/plugins/meteora/struct.js +125 -1
  35. package/src/plugins/meteora/struct.js.map +1 -1
  36. package/src/plugins/meteora/types.d.ts +61 -0
  37. package/src/plugins/meteora/types.js +12 -0
  38. package/src/plugins/meteora/types.js.map +1 -1
  39. package/src/plugins/parcl/depositsFetcher.js +13 -15
  40. package/src/plugins/parcl/depositsFetcher.js.map +1 -1
  41. package/src/plugins/parcl/helpers.d.ts +2 -0
  42. package/src/plugins/parcl/helpers.js +14 -0
  43. package/src/plugins/parcl/helpers.js.map +1 -0
  44. package/src/plugins/realms/constants.d.ts +1 -0
  45. package/src/plugins/realms/constants.js +2 -1
  46. package/src/plugins/realms/constants.js.map +1 -1
  47. package/src/plugins/realms/depositsFetcher.js +26 -44
  48. package/src/plugins/realms/depositsFetcher.js.map +1 -1
  49. package/src/plugins/realms/filters.d.ts +3 -0
  50. package/src/plugins/realms/filters.js +4 -2
  51. package/src/plugins/realms/filters.js.map +1 -1
  52. package/src/plugins/realms/helpers.d.ts +2 -0
  53. package/src/plugins/realms/helpers.js +10 -1
  54. package/src/plugins/realms/helpers.js.map +1 -1
  55. package/src/plugins/realms/programsJob.js +28 -5
  56. package/src/plugins/realms/programsJob.js.map +1 -1
  57. package/src/plugins/realms/structs/realms.d.ts +2 -2
  58. package/src/plugins/realms/structs/realms.js +2 -2
  59. package/src/plugins/realms/structs/realms.js.map +1 -1
  60. package/src/plugins/realms/types.d.ts +9 -0
  61. package/src/plugins/tensor/filters.js.map +1 -1
  62. package/src/utils/clients/getClientSolana.js +22 -0
  63. package/src/utils/clients/getClientSolana.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -2,10 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.11.61](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.60...plugins-0.11.61) (2024-02-05)
5
+ ## [0.11.63](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.62...plugins-0.11.63) (2024-02-09)
6
6
 
7
7
 
8
8
 
9
+ ## [0.11.62](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.61...plugins-0.11.62) (2024-02-07)
10
+
11
+
12
+
13
+ ## [0.11.61](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.60...plugins-0.11.61) (2024-02-05)
14
+
15
+
16
+
9
17
  ## [0.11.60](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.59...plugins-0.11.60) (2024-02-02)
10
18
 
11
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.61",
3
+ "version": "0.11.63",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.61"
44
+ "@sonarwatch/portfolio-core": "0.11.63"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -28,7 +28,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
28
28
  .get(constants_1.merkleApi + owner)
29
29
  .catch(() => null);
30
30
  const jupTokenPrice = yield cache.getTokenPrice(constants_1.jupMint, portfolio_core_1.NetworkId.solana);
31
- if (claimProofRes) {
31
+ if (claimProofRes && claimProofRes.data) {
32
32
  const claimStatus = (0, helpers_1.deriveClaimStatus)(new web3_js_1.PublicKey(owner), new web3_js_1.PublicKey(claimProofRes.data.merkle_tree), constants_1.merkleDistributorPid)[0];
33
33
  const account = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimStatusStruct, claimStatus);
34
34
  if (!account) {
@@ -1 +1 @@
1
- {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAC7E,kDAA6C;AAC7C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SAAS;oBACf,IAAI,EAAE;wBACJ,MAAM,EAAE,iCAAM,KAAK,KAAE,UAAU,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAG;qBAC1D;oBACD,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB;aACF,CAAC;SACH;QACD,OAAO,EAAE,CAAC;KACX;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAC7E,kDAA6C;AAC7C,6CAA4C;AAC5C,gEAAqC;AAGrC,2CAMqB;AACrB,iDAAsD;AACtD,uCAA8C;AAE9C,kFAA+E;AAC/E,uCAA8C;AAC9C,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,aAAa,GAA6C,MAAM,eAAK;SACxE,GAAG,CAAC,qBAAS,GAAG,KAAK,CAAC;SACtB,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAErB,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,mBAAO,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAC3E,IAAI,aAAa,IAAI,aAAa,CAAC,IAAI,EAAE;QACvC,MAAM,WAAW,GAAG,IAAA,2BAAiB,EACnC,IAAI,mBAAS,CAAC,KAAK,CAAC,EACpB,IAAI,mBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAC7C,gCAAoB,CACrB,CAAC,CAAC,CAAC,CAAC;QACL,MAAM,OAAO,GAAG,MAAM,IAAA,2CAAoB,EACxC,MAAM,EACN,2BAAiB,EACjB,WAAW,CACZ,CAAC;QACF,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;iBACpD,SAAS,CAAC,SAAA,EAAE,EAAI,uBAAW,CAAA,CAAC;iBAC5B,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,mBAAO,EACP,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,aAAa,CACd,CAAC;YACF,OAAO;gBACL;oBACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;oBACnC,KAAK,EAAE,SAAS;oBAChB,SAAS,EAAE,0BAAS,CAAC,MAAM;oBAC3B,UAAU,EAAV,sBAAU;oBACV,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE;wBACJ,MAAM,EAAE,iCAAM,KAAK,KAAE,UAAU,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAG;qBAC1D;oBACD,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB;aACF,CAAC;SACH;QACD,OAAO,EAAE,CAAC;KACX;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,11 +1,22 @@
1
1
  import BigNumber from 'bignumber.js';
2
+ import { BeetStruct } from '@metaplex-foundation/beet';
2
3
  import { Position, Whirlpool } from '../../orca/structs/whirlpool';
3
4
  import { PersonalPositionState, PoolState } from '../../raydium/structs/clmms';
4
5
  import { WhirlpoolStrategy } from '../structs/vaults';
5
6
  import { ParsedAccount } from '../../../utils/solana';
6
- export declare function dexToNumber(dex: string): number;
7
- export declare function getTokenAmountsFromInfos(strategy: ParsedAccount<WhirlpoolStrategy>, pool: PoolState | Whirlpool, position: PersonalPositionState | Position): {
7
+ import { BinArray, DLMMPosition, LbPair } from '../../meteora/struct';
8
+ export declare enum DEXS {
9
+ ORCA = 0,
10
+ RAYDIUM = 1,
11
+ METEORA = 2
12
+ }
13
+ export declare function getTokenAmountsFromInfos(strategy: ParsedAccount<WhirlpoolStrategy>, pool: PoolState | Whirlpool | LbPair, position: PersonalPositionState | Position | DLMMPosition, binArrays?: BinArray[]): {
8
14
  tokenAmountA: BigNumber;
9
15
  tokenAmountB: BigNumber;
10
16
  };
11
17
  export declare function isActive(strategy: WhirlpoolStrategy): boolean;
18
+ type PoolStruct = BeetStruct<PoolState, Partial<PoolState>> | BeetStruct<Whirlpool, Partial<Whirlpool>> | BeetStruct<LbPair, Partial<LbPair>>;
19
+ export declare function getPoolStructFromDex(dexNumber: BigNumber): PoolStruct | undefined;
20
+ type PositionStruct = BeetStruct<PersonalPositionState, Partial<PersonalPositionState>> | BeetStruct<Position, Partial<Position>> | BeetStruct<DLMMPosition, Partial<DLMMPosition>>;
21
+ export declare function getPositionStructFromDex(dexNumber: BigNumber): PositionStruct | undefined;
22
+ export {};
@@ -3,31 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isActive = exports.getTokenAmountsFromInfos = exports.dexToNumber = void 0;
6
+ exports.getPositionStructFromDex = exports.getPoolStructFromDex = exports.isActive = exports.getTokenAmountsFromInfos = exports.DEXS = void 0;
7
7
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const whirlpool_1 = require("../../orca/structs/whirlpool");
9
+ const clmms_1 = require("../../raydium/structs/clmms");
8
10
  const tokenAmountFromLiquidity_1 = require("../../../utils/clmm/tokenAmountFromLiquidity");
9
- const dexes = ['ORCA', 'RAYDIUM', 'METEORA'];
10
- function dexToNumber(dex) {
11
- for (let i = 0; i < dexes.length; i += 1) {
12
- if (dexes[i] === dex) {
13
- return i;
14
- }
15
- }
16
- throw new Error(`Unknown Kamino DEX: ${dex}`);
17
- }
18
- exports.dexToNumber = dexToNumber;
19
- function getTokenAmountsFromInfos(strategy, pool, position) {
20
- if (strategy.strategyDex.toNumber() === dexToNumber('ORCA')) {
11
+ const struct_1 = require("../../meteora/struct");
12
+ const dlmmHelper_1 = require("../../meteora/dlmmHelper");
13
+ var DEXS;
14
+ (function (DEXS) {
15
+ DEXS[DEXS["ORCA"] = 0] = "ORCA";
16
+ DEXS[DEXS["RAYDIUM"] = 1] = "RAYDIUM";
17
+ DEXS[DEXS["METEORA"] = 2] = "METEORA";
18
+ })(DEXS || (exports.DEXS = DEXS = {}));
19
+ function getTokenAmountsFromInfos(strategy, pool, position, binArrays) {
20
+ if (strategy.strategyDex.toNumber() === DEXS.ORCA) {
21
21
  const orcaPool = pool;
22
22
  const orcaPosition = position;
23
23
  return (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(orcaPosition.liquidity, orcaPool.tickCurrentIndex, orcaPosition.tickLowerIndex, orcaPosition.tickUpperIndex, false);
24
24
  }
25
- if (strategy.strategyDex.toNumber() === dexToNumber('RAYDIUM')) {
25
+ if (strategy.strategyDex.toNumber() === DEXS.RAYDIUM) {
26
26
  const raydiumPool = pool;
27
27
  const raydiumPosition = position;
28
28
  return (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(raydiumPosition.liquidity, raydiumPool.tickCurrent, raydiumPosition.tickLowerIndex, raydiumPosition.tickUpperIndex, false);
29
29
  }
30
- console.log('Unsupported number of DEX : ', strategy.strategyDex.toNumber());
30
+ if (strategy.strategyDex.toNumber() === DEXS.METEORA) {
31
+ const meteoraPool = pool;
32
+ const meteoraPosition = position;
33
+ if (binArrays && binArrays.length === 2) {
34
+ return (0, dlmmHelper_1.getTokensAmountsFromLiquidity)(meteoraPosition, meteoraPool, binArrays === null || binArrays === void 0 ? void 0 : binArrays[0], binArrays === null || binArrays === void 0 ? void 0 : binArrays[1], strategy.tokenAMintDecimals.toNumber(), strategy.tokenBMintDecimals.toNumber());
35
+ }
36
+ }
31
37
  return { tokenAmountA: new bignumber_js_1.default(0), tokenAmountB: new bignumber_js_1.default(0) };
32
38
  }
33
39
  exports.getTokenAmountsFromInfos = getTokenAmountsFromInfos;
@@ -49,4 +55,24 @@ function isActive(strategy) {
49
55
  return true;
50
56
  }
51
57
  exports.isActive = isActive;
58
+ function getPoolStructFromDex(dexNumber) {
59
+ if (dexNumber.toNumber() === DEXS.ORCA)
60
+ return whirlpool_1.whirlpoolStruct;
61
+ if (dexNumber.toNumber() === DEXS.RAYDIUM)
62
+ return clmms_1.poolStateStruct;
63
+ if (dexNumber.toNumber() === DEXS.METEORA)
64
+ return struct_1.lbPairStruct;
65
+ return undefined;
66
+ }
67
+ exports.getPoolStructFromDex = getPoolStructFromDex;
68
+ function getPositionStructFromDex(dexNumber) {
69
+ if (dexNumber.toNumber() === DEXS.ORCA)
70
+ return whirlpool_1.positionStruct;
71
+ if (dexNumber.toNumber() === DEXS.RAYDIUM)
72
+ return clmms_1.personalPositionStateStruct;
73
+ if (dexNumber.toNumber() === DEXS.METEORA)
74
+ return struct_1.dlmmPositionV2Struct;
75
+ return undefined;
76
+ }
77
+ exports.getPositionStructFromDex = getPositionStructFromDex;
52
78
  //# sourceMappingURL=vaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vaults.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/kamino/helpers/vaults.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAKrC,2FAA4F;AAE5F,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAE7C,SAAgB,WAAW,CAAC,GAAW;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,M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,CAAC,QAA2B;IAClD,IAAI,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE;QAAE,OAAO,KAAK,CAAC;IACjD,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC/D,OAAO,IAAI,CAAC;AACd,CAAC;AAND,4BAMC;AAOD,SAAgB,oBAAoB,CAClC,SAAoB;IAEpB,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,IAAI;QAAE,OAAO,2BAAe,CAAC;IAC/D,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,OAAO;QAAE,OAAO,uBAAe,CAAC;IAClE,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,OAAO;QAAE,OAAO,qBAAY,CAAC;IAC/D,OAAO,SAAS,CAAC;AACnB,CAAC;AAPD,oDAOC;AAOD,SAAgB,wBAAwB,CACtC,SAAoB;IAEpB,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,IAAI;QAAE,OAAO,0BAAc,CAAC;IAC9D,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,OAAO;QAAE,OAAO,mCAA2B,CAAC;IAC9E,IAAI,SAAS,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,OAAO;QAAE,OAAO,6BAAoB,CAAC;IACvE,OAAO,SAAS,CAAC;AACnB,CAAC;AAPD,4DAOC"}
@@ -15,11 +15,11 @@ const constants_1 = require("./constants");
15
15
  const solana_1 = require("../../utils/solana");
16
16
  const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
17
17
  const vaults_1 = require("./helpers/vaults");
18
- const whirlpool_1 = require("../orca/structs/whirlpool");
19
- const clmms_1 = require("../raydium/structs/clmms");
20
18
  const vaults_2 = require("./structs/vaults");
21
19
  const filters_1 = require("../../utils/solana/filters");
20
+ const struct_1 = require("../meteora/struct");
22
21
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
22
+ var _a, _b;
23
23
  const client = (0, clients_1.getClientSolana)();
24
24
  const strategies = yield (0, solana_1.getParsedProgramAccounts)(client, vaults_2.whirlpoolStrategyStruct, constants_1.programId, (0, filters_1.dataStructSizeFilter)(vaults_2.whirlpoolStrategyStruct));
25
25
  const tokensMint = strategies
@@ -38,6 +38,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
38
38
  const strategy = strategies[i];
39
39
  if (!(0, vaults_1.isActive)(strategy))
40
40
  continue;
41
+ const { strategyDex } = strategy;
41
42
  // Here is a Kamino error.
42
43
  // They've tested a pool with 11111111111111111111111111111111 for whirlpool
43
44
  if (pools[i].toString() === '11111111111111111111111111111111')
@@ -49,22 +50,30 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
49
50
  const address = strategy.sharesMint;
50
51
  const decimals = strategy.sharesMintDecimals.toNumber();
51
52
  const supply = strategy.sharesIssued.dividedBy(Math.pow(10, decimals));
52
- const isOrca = strategy.strategyDex.toNumber() === (0, vaults_1.dexToNumber)('ORCA');
53
53
  const rawPool = positionAndWhirlpoolAccountsInfo[positionSizeIndex + i];
54
54
  if (!rawPool)
55
55
  continue;
56
56
  const rawPoolData = rawPool.data;
57
- const pool = isOrca
58
- ? whirlpool_1.whirlpoolStruct.deserialize(rawPoolData)[0]
59
- : clmms_1.poolStateStruct.deserialize(rawPoolData)[0];
57
+ const pool = (_a = (0, vaults_1.getPoolStructFromDex)(strategyDex)) === null || _a === void 0 ? void 0 : _a.deserialize(rawPoolData)[0];
58
+ if (!pool)
59
+ continue;
60
60
  const rawPosition = positionAndWhirlpoolAccountsInfo[i];
61
61
  if (!rawPosition)
62
62
  continue;
63
63
  const positionData = rawPosition.data;
64
- const position = isOrca
65
- ? whirlpool_1.positionStruct.deserialize(positionData)[0]
66
- : clmms_1.personalPositionStateStruct.deserialize(positionData)[0];
67
- const { tokenAmountA, tokenAmountB } = (0, vaults_1.getTokenAmountsFromInfos)(strategy, pool, position);
64
+ const position = (_b = (0, vaults_1.getPositionStructFromDex)(strategyDex)) === null || _b === void 0 ? void 0 : _b.deserialize(positionData)[0];
65
+ if (!position)
66
+ continue;
67
+ const isMeteroa = strategyDex.toNumber() === vaults_1.DEXS.METEORA;
68
+ const binArrays = isMeteroa
69
+ ? (yield (0, solana_1.getParsedMultipleAccountsInfo)(client, struct_1.binArrayStruct, [
70
+ strategy.tickArrayLower,
71
+ strategy.tickArrayUpper,
72
+ ]))
73
+ .map((account) => account || [])
74
+ .flat()
75
+ : undefined;
76
+ const { tokenAmountA, tokenAmountB } = (0, vaults_1.getTokenAmountsFromInfos)(strategy, pool, position, binArrays);
68
77
  if (tokenAmountA.isZero() && tokenAmountB.isZero())
69
78
  continue;
70
79
  const tokenAAmount = tokenAmountA
@@ -1 +1 @@
1
- {"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAIoC;AAGpC,iDAAsD;AACtD,2CAAoD;AACpD,+CAA8D;AAC9D,gGAA6F;AAC7F,6CAI0B;AAC1B,yDAA4E;AAC5E,oDAGkC;AAClC,6CAA2D;AAC3D,wDAAkE;AAElE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,IAAA,iCAAwB,EAC/C,MAAM,EACN,gCAAuB,EACvB,qBAAS,EACT,IAAA,8BAAoB,EAAC,gCAAuB,CAAC,CAC9C,CAAC;IAEF,MAAM,UAAU,GAAG,UAAU;SAC1B,GAAG,CAAC,CAAC,GAAG,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AAE;SAC1C,CACF,CAAC;QAEF,MAAM,KAAK,CAAC,mBAAmB,CAAC;YAC9B,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;YAC3B,QAAQ;YACR,EAAE,EAAE,sBAAU;YACd,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK;YACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,MAAM,EAAE,CAAC;YACT,WAAW,EAAE,OAAO;YACpB,WAAW;SACZ,CAAC,CAAC;KACJ;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -4,11 +4,12 @@ import BigNumber from 'bignumber.js';
4
4
  export declare const platformId = "marinade";
5
5
  export declare const marinadePlatform: Platform;
6
6
  export declare const cachePrefix = "marinade";
7
+ export declare const season2RewardsPrefix: string;
7
8
  export declare const marinadeTicketProgramId: PublicKey;
8
9
  export declare const claimProgram: PublicKey;
9
10
  export declare const mndeMint = "MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey";
10
11
  export declare const solFactor: BigNumber;
11
12
  export declare const baseRewardsUrl = "https://native-staking-referral.marinade.finance/v1/rewards/";
12
- export declare const season2Route = "staker/season-2?pubkey=";
13
+ export declare const season2Route = "all/season-2?pubkey=";
13
14
  export declare const stakerRoute = "staker?pubkey=";
14
15
  export declare const referrerRoute = "referrer?pubkey=";
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.referrerRoute = exports.stakerRoute = exports.season2Route = exports.baseRewardsUrl = exports.solFactor = exports.mndeMint = exports.claimProgram = exports.marinadeTicketProgramId = exports.cachePrefix = exports.marinadePlatform = exports.platformId = void 0;
6
+ exports.referrerRoute = exports.stakerRoute = exports.season2Route = exports.baseRewardsUrl = exports.solFactor = exports.mndeMint = exports.claimProgram = exports.marinadeTicketProgramId = exports.season2RewardsPrefix = exports.cachePrefix = exports.marinadePlatform = exports.platformId = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
9
9
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
@@ -16,12 +16,13 @@ exports.marinadePlatform = {
16
16
  website: 'https://marinade.finance/',
17
17
  };
18
18
  exports.cachePrefix = 'marinade';
19
+ exports.season2RewardsPrefix = `${exports.platformId}-s2Rewards`;
19
20
  exports.marinadeTicketProgramId = new web3_js_1.PublicKey('MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD');
20
21
  exports.claimProgram = new web3_js_1.PublicKey('indiXdKbsC4QSLQQnn6ngZvkqfywn6KgEeQbkGSpk1V');
21
22
  exports.mndeMint = 'MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey';
22
23
  exports.solFactor = new bignumber_js_1.default(Math.pow(10, portfolio_core_1.solanaNetwork.native.decimals));
23
24
  exports.baseRewardsUrl = 'https://native-staking-referral.marinade.finance/v1/rewards/';
24
- exports.season2Route = 'staker/season-2?pubkey=';
25
+ exports.season2Route = 'all/season-2?pubkey=';
25
26
  exports.stakerRoute = 'staker?pubkey=';
26
27
  exports.referrerRoute = 'referrer?pubkey=';
27
28
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,+DAAqE;AACrE,gEAAqC;AAExB,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,yBAAyB;IACtC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,WAAW,GAAG,UAAU,CAAC;AACzB,QAAA,uBAAuB,GAAG,IAAI,mBAAS,CAClD,6CAA6C,CAC9C,CAAC;AACW,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AACW,QAAA,QAAQ,GAAG,6CAA6C,CAAC;AACzD,QAAA,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,8BAAa,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAC;AAC/D,QAAA,cAAc,GACzB,8DAA8D,CAAC;AACpD,QAAA,YAAY,GAAG,yBAAyB,CAAC;AACzC,QAAA,WAAW,GAAG,gBAAgB,CAAC;AAC/B,QAAA,aAAa,GAAG,kBAAkB,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,+DAAqE;AACrE,gEAAqC;AAExB,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,yBAAyB;IACtC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,WAAW,GAAG,UAAU,CAAC;AACzB,QAAA,oBAAoB,GAAG,GAAG,kBAAU,YAAY,CAAC;AACjD,QAAA,uBAAuB,GAAG,IAAI,mBAAS,CAClD,6CAA6C,CAC9C,CAAC;AACW,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AACW,QAAA,QAAQ,GAAG,6CAA6C,CAAC;AACzD,QAAA,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,8BAAa,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAC;AAC/D,QAAA,cAAc,GACzB,8DAA8D,CAAC;AACpD,QAAA,YAAY,GAAG,sBAAsB,CAAC;AACtC,QAAA,WAAW,GAAG,gBAAgB,CAAC;AAC/B,QAAA,aAAa,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ export declare function getClaimPda(owner: string): PublicKey;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getClaimPda = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ const constants_1 = require("./constants");
6
+ function getClaimPda(owner) {
7
+ return web3_js_1.PublicKey.findProgramAddressSync([
8
+ Buffer.from('claim_record', 'utf-8'),
9
+ new web3_js_1.PublicKey('inTrQECqatDmvAt7ahYeWg82efX5PsxhiFXzQk9eKYG').toBuffer(),
10
+ new web3_js_1.PublicKey(owner).toBuffer(),
11
+ ], constants_1.claimProgram)[0];
12
+ }
13
+ exports.getClaimPda = getClaimPda;
14
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA2C;AAE3C,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;QACpC,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC,QAAQ,EAAE;QACvE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;KAChC,EACD,wBAAY,CACb,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,kCASC"}
@@ -18,9 +18,9 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
18
  const constants_1 = require("./constants");
19
19
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
20
  const clients_1 = require("../../utils/clients");
21
- const solana_1 = require("../../utils/solana");
22
21
  const structs_1 = require("./structs");
23
- const filters_1 = require("./filters");
22
+ const helpers_1 = require("./helpers");
23
+ const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
24
24
  const decimals = 9;
25
25
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  const mndeTokenPrice = yield cache.getTokenPrice(constants_1.mndeMint, portfolio_core_1.NetworkId.solana);
@@ -28,51 +28,93 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
28
28
  return [];
29
29
  const season1Unlock = new Date(1704067200000); // January 1 2024
30
30
  const season2Unlock = new Date(1711843200000); // March 31 2024
31
- const assets = [];
32
31
  const client = (0, clients_1.getClientSolana)();
33
- const claimRecords = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.claimRecordStruct, constants_1.claimProgram, (0, filters_1.claimRecordFilters)(owner));
34
- if (claimRecords.length === 1 && !claimRecords[0].nonClaimedAmount.isZero()) {
35
- assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, claimRecords[0].nonClaimedAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
32
+ const pda = (0, helpers_1.getClaimPda)(owner);
33
+ const claimRecord = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimRecordStruct, pda);
34
+ const getReferrerRewards = yield axios_1.default
35
+ .get(constants_1.baseRewardsUrl + constants_1.referrerRoute + owner)
36
+ .catch(() => null);
37
+ const season1Assets = [];
38
+ const elements = [];
39
+ if (claimRecord && !claimRecord.nonClaimedAmount.isZero()) {
40
+ season1Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, claimRecord.nonClaimedAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
36
41
  lockedUntil: season1Unlock.getTime(),
37
- tags: ['season 1'],
42
+ tags: ['Staking'],
38
43
  } }));
39
44
  }
40
- const getSeason2Rewards = yield axios_1.default
41
- .get(constants_1.baseRewardsUrl + constants_1.season2Route + owner)
42
- .catch(() => null);
43
- if (getSeason2Rewards) {
44
- const rewardAmount = new bignumber_js_1.default(getSeason2Rewards.data.mSOLRewards);
45
+ if (getReferrerRewards) {
46
+ const rewardAmount = new bignumber_js_1.default(getReferrerRewards.data.rewards);
45
47
  if (!rewardAmount.isZero()) {
46
- assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, rewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
48
+ season1Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, rewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
47
49
  lockedUntil: season2Unlock.getTime(),
48
- tags: ['season 2'],
50
+ tags: ['Referrer'],
49
51
  } }));
50
52
  }
51
53
  }
52
- const getReferrerRewards = yield axios_1.default
53
- .get(constants_1.baseRewardsUrl + constants_1.referrerRoute + owner)
54
- .catch(() => null);
55
- if (getReferrerRewards) {
56
- const rewardAmount = new bignumber_js_1.default(getReferrerRewards.data.rewards);
57
- if (!rewardAmount.isZero()) {
58
- assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, rewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
54
+ if (season1Assets.length > 0) {
55
+ elements.push({
56
+ type: portfolio_core_1.PortfolioElementType.multiple,
57
+ label: 'Rewards',
58
+ networkId: portfolio_core_1.NetworkId.solana,
59
+ platformId: constants_1.platformId,
60
+ name: 'Season 1',
61
+ data: { assets: season1Assets },
62
+ value: (0, portfolio_core_1.getUsdValueSum)(season1Assets.map((asset) => asset.value)),
63
+ });
64
+ }
65
+ const season2Assets = [];
66
+ let season2Rewards = yield cache.getItem(owner, {
67
+ prefix: constants_1.season2RewardsPrefix,
68
+ networkId: portfolio_core_1.NetworkId.solana,
69
+ });
70
+ if (!season2Rewards) {
71
+ const getSeason2Rewards = yield axios_1.default
72
+ .get(constants_1.baseRewardsUrl + constants_1.season2Route + owner)
73
+ .catch(() => null);
74
+ if (getSeason2Rewards) {
75
+ season2Rewards = getSeason2Rewards.data;
76
+ yield cache.setItem(owner, season2Rewards, {
77
+ prefix: constants_1.season2RewardsPrefix,
78
+ networkId: portfolio_core_1.NetworkId.solana,
79
+ ttl: 1000 * 60 * 60 * 5,
80
+ });
81
+ }
82
+ }
83
+ if (season2Rewards) {
84
+ const stakingRewardAmount = new bignumber_js_1.default(season2Rewards.staker.mSOLRewards);
85
+ if (!stakingRewardAmount.isZero()) {
86
+ season2Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, stakingRewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
87
+ lockedUntil: season2Unlock.getTime(),
88
+ tags: ['Staking'],
89
+ } }));
90
+ }
91
+ const governorRewardAmount = new bignumber_js_1.default(season2Rewards.governor.vemndeDelStratVotesRewards);
92
+ if (!governorRewardAmount.isZero()) {
93
+ season2Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, governorRewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
59
94
  lockedUntil: season2Unlock.getTime(),
60
- tags: ['referrer'],
95
+ tags: ['Governor'],
96
+ } }));
97
+ }
98
+ const validatorRewardAmount = new bignumber_js_1.default(season2Rewards.validator.algoScoreRewards);
99
+ if (!validatorRewardAmount.isZero()) {
100
+ season2Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, validatorRewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
101
+ lockedUntil: season2Unlock.getTime(),
102
+ tags: ['Validator'],
61
103
  } }));
62
104
  }
63
105
  }
64
- if (assets.length === 0)
65
- return [];
66
- return [
67
- {
106
+ if (season2Assets.length > 0) {
107
+ elements.push({
68
108
  type: portfolio_core_1.PortfolioElementType.multiple,
69
109
  label: 'Rewards',
70
110
  networkId: portfolio_core_1.NetworkId.solana,
71
111
  platformId: constants_1.platformId,
72
- data: { assets },
73
- value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
74
- },
75
- ];
112
+ name: 'Season 2',
113
+ data: { assets: season2Assets },
114
+ value: (0, portfolio_core_1.getUsdValueSum)(season2Assets.map((asset) => asset.value)),
115
+ });
116
+ }
117
+ return elements;
76
118
  });
77
119
  const fetcher = {
78
120
  id: `${constants_1.platformId}-rewards`,
@@ -1 +1 @@
1
- {"version":3,"file":"rewardsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/rewardsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAC7C,gEAAqC;AAGrC,2CAOqB;AAErB,qGAA6E;AAC7E,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA8C;AAC9C,uCAA+C;AAE/C,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,oBAAQ,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAC7E,IAAI,CAAC,cAAc;QAAE,OAAO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aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACjE,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -14,4 +14,26 @@ export type StakerResponse = {
14
14
  ratePerSecondPerSol: string;
15
15
  updatedAt: string;
16
16
  };
17
- export type Season2Response = StakerResponse;
17
+ export type Season2Response = {
18
+ pubkey: string;
19
+ ratePerSecondPerSol: string;
20
+ updatedAt: string;
21
+ staker: {
22
+ mSOLBalance: string;
23
+ mSOLRewards: string;
24
+ nativeStakeBalance: string;
25
+ nativeStakeRewards: string;
26
+ };
27
+ validator: {
28
+ algoScoreBalance: string;
29
+ algoScoreRewards: string;
30
+ };
31
+ governor: {
32
+ vemndeDelStratVotesBalance: string;
33
+ vemndeDelStratVotesRewards: string;
34
+ };
35
+ redelegator: {
36
+ stakeAccountRedelegationBalance: string;
37
+ stakeAccountRedelegationRewards: string;
38
+ };
39
+ };
@@ -7,3 +7,4 @@ export declare const farmsKey = "farms";
7
7
  export declare const vaultsProgramId: PublicKey;
8
8
  export declare const poolsProgramId: PublicKey;
9
9
  export declare const farmProgramId: PublicKey;
10
+ export declare const dlmmProgramId: PublicKey;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.farmProgramId = exports.poolsProgramId = exports.vaultsProgramId = exports.farmsKey = exports.prefixVaults = exports.meteoraPlatform = exports.platformId = void 0;
3
+ exports.dlmmProgramId = exports.farmProgramId = exports.poolsProgramId = exports.vaultsProgramId = exports.farmsKey = exports.prefixVaults = exports.meteoraPlatform = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'meteora';
6
6
  exports.meteoraPlatform = {
@@ -15,4 +15,5 @@ exports.farmsKey = 'farms';
15
15
  exports.vaultsProgramId = new web3_js_1.PublicKey('24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi');
16
16
  exports.poolsProgramId = new web3_js_1.PublicKey('Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB');
17
17
  exports.farmProgramId = new web3_js_1.PublicKey('FarmuwXPWXvefWUeqFAa5w6rifLkq5X6E8bimYvrhCB1');
18
+ exports.dlmmProgramId = new web3_js_1.PublicKey('LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo');
18
19
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEW,QAAA,YAAY,GAAG,GAAG,kBAAU,SAAS,CAAC;AACtC,QAAA,QAAQ,GAAG,OAAO,CAAC;AAEnB,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEW,QAAA,YAAY,GAAG,GAAG,kBAAU,SAAS,CAAC;AACtC,QAAA,QAAQ,GAAG,OAAO,CAAC;AAEnB,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,6CAA6C,CAC9C,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import BN from 'bn.js';
3
+ import BigNumber from 'bignumber.js';
4
+ import { BinLiquidity, LMRewards, PositionData, PositionVersion } from './types';
5
+ import { Bin, BinArray, DLMMPosition, LbPair } from './struct';
6
+ export declare const MAX_BIN_ARRAY_SIZE: BN;
7
+ export declare const SCALE_OFFSET = 64;
8
+ export declare const BASIS_POINT_MAX = 10000;
9
+ export declare function binIdToBinArrayIndex(binId: BigNumber): BN;
10
+ export declare function deriveBinArrayBitmapExtension(lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
11
+ export declare function deriveBinArray(lbPair: PublicKey, index: BN, programId: PublicKey): [PublicKey, number];
12
+ export declare function processPosition(program: PublicKey, version: PositionVersion, lbPair: LbPair, position: DLMMPosition, baseTokenDecimal: number, quoteTokenDecimal: number, lowerBinArray: BinArray, upperBinArray: BinArray): PositionData | null;
13
+ export declare function getBinsBetweenLowerAndUpperBound(lbPair: LbPair, lowerBinId: number, upperBinId: number, baseTokenDecimal: number, quoteTokenDecimal: number, lowerBinArrays: BinArray, upperBinArrays: BinArray): BinLiquidity[];
14
+ export declare function getClaimableLMReward(program: PublicKey, positionVersion: PositionVersion, lbPair: LbPair, onChainTimestamp: number, position: DLMMPosition, lowerBinArray?: BinArray, upperBinArray?: BinArray): Promise<LMRewards>;
15
+ export declare function getBinFromBinArray(binId: number, binArray: BinArray): Bin;
16
+ export declare function getBinArrayLowerUpperBinId(binArrayIndex: BigNumber): BigNumber[];
17
+ export declare enum Rounding {
18
+ Up = 0,
19
+ Down = 1
20
+ }
21
+ export declare function mulShr(x: BigNumber, y: BigNumber, offset: number, rounding: Rounding): BigNumber;
22
+ export declare function shlDiv(x: BigNumber, y: BigNumber, offset: number, rounding: Rounding): BigNumber;
23
+ export declare function mulDiv(x: BigNumber, y: BigNumber, denominator: BigNumber, rounding: Rounding): BigNumber;
24
+ export declare function getPriceOfBinByBinId(binStep: number, binId: number): string;
25
+ export declare function getTokensAmountsFromLiquidity(position: DLMMPosition, pool: LbPair, lowerBinArray: BinArray, upperBinArray: BinArray, baseTokenDecimal: number, quoteTokenDecimal: number): {
26
+ tokenAmountA: BigNumber;
27
+ tokenAmountB: BigNumber;
28
+ };