@sonarwatch/portfolio-plugins 0.12.108 → 0.12.110

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/CHANGELOG.md +2152 -2144
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/src/plugins/balancer/helpers/pools.js +21 -21
  5. package/src/plugins/raydium/farmsFetcher.d.ts +3 -0
  6. package/src/plugins/raydium/farmsFetcher.js +113 -0
  7. package/src/plugins/raydium/farmsFetcher.js.map +1 -0
  8. package/src/plugins/raydium/farmsJob.d.ts +11 -0
  9. package/src/plugins/raydium/farmsJob.js +165 -0
  10. package/src/plugins/raydium/farmsJob.js.map +1 -0
  11. package/src/plugins/raydium/filters.d.ts +18 -0
  12. package/src/plugins/raydium/filters.js +74 -1
  13. package/src/plugins/raydium/filters.js.map +1 -1
  14. package/src/plugins/raydium/helpers.d.ts +3 -1
  15. package/src/plugins/raydium/helpers.js +25 -1
  16. package/src/plugins/raydium/helpers.js.map +1 -1
  17. package/src/plugins/raydium/index.js +4 -2
  18. package/src/plugins/raydium/index.js.map +1 -1
  19. package/src/plugins/raydium/structs/farms.d.ts +123 -0
  20. package/src/plugins/raydium/structs/farms.js +111 -0
  21. package/src/plugins/raydium/structs/farms.js.map +1 -0
  22. package/src/plugins/raydium/types.d.ts +34 -0
  23. package/src/plugins/raydium/types.js.map +1 -1
  24. package/src/plugins/sushiswap/helpers.js +24 -24
  25. package/src/plugins/uniswap-v2/helpers.js +22 -22
  26. package/src/plugins/zeta/airdropFetcher.js +2 -2
  27. package/src/plugins/zeta/airdropFetcher.js.map +1 -1
  28. package/src/plugins/zeta/helpers.d.ts +2 -0
  29. package/src/plugins/zeta/helpers.js +13 -1
  30. package/src/plugins/zeta/helpers.js.map +1 -1
  31. package/src/utils/clients/index.d.ts +0 -1
  32. package/src/utils/clients/index.js +1 -3
  33. package/src/utils/clients/index.js.map +1 -1
  34. package/src/utils/sei/constants.js +8 -8
  35. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  36. package/src/utils/clients/getEsploraEndpoint.d.ts +0 -2
  37. package/src/utils/clients/getEsploraEndpoint.js +0 -13
  38. package/src/utils/clients/getEsploraEndpoint.js.map +0 -1
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @sonarwatch/portfolio-plugins
2
-
3
- This library is @sonarwatch/portfolio-plugins
1
+ # @sonarwatch/portfolio-plugins
2
+
3
+ This library is @sonarwatch/portfolio-plugins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.12.108",
3
+ "version": "0.12.110",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
@@ -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,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const constants_1 = require("./constants");
17
+ const clients_1 = require("../../utils/clients");
18
+ const helpers_1 = require("./helpers");
19
+ const solana_1 = require("../../utils/solana");
20
+ const farmsJob_1 = require("./farmsJob");
21
+ const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const client = (0, clients_1.getClientSolana)();
24
+ const userFarmAccountsPromises = farmsJob_1.userFarmConfigs.map((userFarmConfig) => (0, solana_1.getParsedProgramAccounts)(client, userFarmConfig.struct, userFarmConfig.programId, userFarmConfig.filters(owner)));
25
+ const userFarmAccounts = (yield Promise.allSettled(userFarmAccountsPromises))
26
+ .flat(1)
27
+ .map((result) => {
28
+ if (result.status === 'fulfilled') {
29
+ return result.value;
30
+ }
31
+ return [];
32
+ })
33
+ .flat();
34
+ if (userFarmAccounts.length === 0)
35
+ return [];
36
+ const farmsInfo = yield cache.getItems(userFarmAccounts.map((acc) => acc.poolId.toString()), { prefix: `${constants_1.platformId}/farm`, networkId: portfolio_core_1.NetworkId.solana });
37
+ const farmsInfoMap = new Map();
38
+ farmsInfo.forEach((farmInfo) => farmInfo
39
+ ? farmsInfoMap.set(farmInfo.account.pubkey.toString(), farmInfo)
40
+ : undefined);
41
+ const liquidities = [];
42
+ for (let i = 0; i < userFarmAccounts.length; i += 1) {
43
+ const rewardAssets = [];
44
+ const assets = [];
45
+ const userFarmAccount = userFarmAccounts[i];
46
+ const farmInfo = farmsInfoMap.get(userFarmAccount.poolId.toString());
47
+ if (!farmInfo)
48
+ continue;
49
+ const lpTokenPrice = farmInfo.lpToken;
50
+ if (!lpTokenPrice)
51
+ continue;
52
+ const farmAccount = farmInfo.account;
53
+ // LP staked on Farm
54
+ const amount = userFarmAccount.depositBalance
55
+ .div(Math.pow(10, farmInfo.lpToken.decimals))
56
+ .toNumber();
57
+ if (amount > 0) {
58
+ const underlyingAssets = (0, tokenPriceToAssetTokens_1.default)(lpTokenPrice.address, amount, portfolio_core_1.NetworkId.solana, lpTokenPrice);
59
+ assets.push(...underlyingAssets);
60
+ }
61
+ // Farm pending reward A
62
+ if (farmInfo.rewardTokenA) {
63
+ const assetTokenA = (0, helpers_1.getPendingAssetToken)(userFarmAccount.depositBalance, userFarmAccount.rewardDebt, farmAccount.perShare, farmInfo.rewardTokenA, farmInfo.d);
64
+ if (assetTokenA.data.amount > 0) {
65
+ rewardAssets.push(assetTokenA);
66
+ }
67
+ }
68
+ // Farm pending reward B
69
+ if (farmInfo.rewardTokenB &&
70
+ farmAccount.perShareB &&
71
+ userFarmAccount.rewardDebtB) {
72
+ const assetTokenB = (0, helpers_1.getPendingAssetToken)(userFarmAccount.depositBalance, userFarmAccount.rewardDebtB, farmAccount.perShareB, farmInfo.rewardTokenB, farmInfo.d);
73
+ if (assetTokenB.data.amount > 0) {
74
+ rewardAssets.push(assetTokenB);
75
+ }
76
+ }
77
+ const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
78
+ const rewardAssetsValue = (0, portfolio_core_1.getUsdValueSum)(rewardAssets.map((r) => r.value));
79
+ const value = (0, portfolio_core_1.getUsdValueSum)([assetsValue, rewardAssetsValue]);
80
+ if (value === 0)
81
+ continue;
82
+ const liquidity = {
83
+ value,
84
+ assets,
85
+ assetsValue,
86
+ rewardAssets,
87
+ rewardAssetsValue,
88
+ yields: [],
89
+ };
90
+ liquidities.push(liquidity);
91
+ }
92
+ if (liquidities.length === 0)
93
+ return [];
94
+ return [
95
+ {
96
+ networkId: portfolio_core_1.NetworkId.solana,
97
+ platformId: constants_1.platformId,
98
+ type: portfolio_core_1.PortfolioElementType.liquidity,
99
+ label: 'Farming',
100
+ value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((l) => l.value)),
101
+ data: {
102
+ liquidities,
103
+ },
104
+ },
105
+ ];
106
+ });
107
+ const fetcher = {
108
+ id: `${constants_1.platformId}-farms`,
109
+ networkId: portfolio_core_1.NetworkId.solana,
110
+ executor,
111
+ };
112
+ exports.default = fetcher;
113
+ //# sourceMappingURL=farmsFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,uCAAiD;AACjD,+CAA6E;AAC7E,yCAA6C;AAE7C,uGAA+E;AAG/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,wBAAwB,GAAG,0BAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CACtE,IAAA,iCAAwB,EACtB,MAAM,EACN,cAAc,CAAC,MAAM,EACrB,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAC9B,CACF,CAAC;IACF,MAAM,gBAAgB,GAAG,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;SAC1E,IAAI,CAAC,CAAC,CAAC;SACP,G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ey } from '@solana/web3.js';
2
+ import { Job } from '../../Job';
3
+ import { FarmConfig, UserFarmConfig } from './types';
4
+ export declare const farmProgramIdV3: PublicKey;
5
+ export declare const farmProgramIdV4: PublicKey;
6
+ export declare const farmProgramIdV5: PublicKey;
7
+ export declare const farmProgramIdV6: PublicKey;
8
+ export declare const userFarmConfigs: UserFarmConfig[];
9
+ export declare const farmConfigs: FarmConfig[];
10
+ declare const job: Job;
11
+ export default job;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.farmConfigs = exports.userFarmConfigs = exports.farmProgramIdV6 = exports.farmProgramIdV5 = exports.farmProgramIdV4 = exports.farmProgramIdV3 = void 0;
13
+ const web3_js_1 = require("@solana/web3.js");
14
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
15
+ const clients_1 = require("../../utils/clients");
16
+ const constants_1 = require("./constants");
17
+ const solana_1 = require("../../utils/solana");
18
+ const filters_1 = require("./filters");
19
+ const farms_1 = require("./structs/farms");
20
+ const helpers_1 = require("./helpers");
21
+ exports.farmProgramIdV3 = new web3_js_1.PublicKey('EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q');
22
+ exports.farmProgramIdV4 = new web3_js_1.PublicKey('CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T');
23
+ exports.farmProgramIdV5 = new web3_js_1.PublicKey('9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z');
24
+ exports.farmProgramIdV6 = new web3_js_1.PublicKey('FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG');
25
+ exports.userFarmConfigs = [
26
+ {
27
+ programId: exports.farmProgramIdV3,
28
+ filters: filters_1.userFarmAccountV3Filters,
29
+ struct: farms_1.userFarmAccountV3Struct,
30
+ version: 'v3',
31
+ },
32
+ {
33
+ programId: exports.farmProgramIdV4,
34
+ filters: filters_1.userFarmAccountV4Filters,
35
+ struct: farms_1.userFarmAccountV4Struct,
36
+ version: 'v4',
37
+ },
38
+ {
39
+ programId: exports.farmProgramIdV5,
40
+ filters: filters_1.userFarmAccountV5Filters,
41
+ struct: farms_1.userFarmAccountV5Struct,
42
+ version: 'v5',
43
+ },
44
+ {
45
+ programId: exports.farmProgramIdV5,
46
+ filters: filters_1.userFarmAccountV51Filters,
47
+ struct: farms_1.userFarmAccountV4Struct,
48
+ version: 'v5_1', // Version 5_1, struct from V4 but pid from V5
49
+ },
50
+ {
51
+ programId: exports.farmProgramIdV3,
52
+ filters: filters_1.userFarmAccountV31Filters,
53
+ struct: farms_1.userFarmAccountV31Struct,
54
+ version: 'v3_1',
55
+ },
56
+ ];
57
+ exports.farmConfigs = [
58
+ {
59
+ programId: exports.farmProgramIdV3,
60
+ filters: filters_1.farmAccountV3Filters,
61
+ struct: farms_1.farmAccountV3Struct,
62
+ version: 'v3',
63
+ d: 1e9,
64
+ },
65
+ {
66
+ programId: exports.farmProgramIdV4,
67
+ filters: filters_1.farmAccountV4Filters,
68
+ struct: farms_1.farmAccountV4Struct,
69
+ version: 'v4',
70
+ d: 1e9,
71
+ },
72
+ {
73
+ programId: exports.farmProgramIdV5,
74
+ filters: filters_1.farmAccountV5Filters,
75
+ struct: farms_1.farmAccountV5Struct,
76
+ version: 'v5',
77
+ d: 1e15,
78
+ },
79
+ ];
80
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
81
+ const client = (0, clients_1.getClientSolana)();
82
+ const farmAccountsPromises = exports.farmConfigs.map((farmConfig) => (0, solana_1.getParsedProgramAccounts)(client, farmConfig.struct, farmConfig.programId, farmConfig.filters));
83
+ const farmAccounts = (yield Promise.all(farmAccountsPromises))
84
+ .map((farmAccountsArray, i) => farmAccountsArray.map((fa) => (Object.assign(Object.assign({}, fa), { d: exports.farmConfigs[i].d }))))
85
+ .flat(1);
86
+ const tokenAccountsToFetch = [];
87
+ farmAccounts.forEach((farmAccount) => {
88
+ if (farmAccount.poolLpTokenAccount.toString() ===
89
+ '11111111111111111111111111111111')
90
+ return;
91
+ tokenAccountsToFetch.push(farmAccount.poolLpTokenAccount, farmAccount.poolRewardTokenAccount);
92
+ if (farmAccount.poolRewardTokenAccountB)
93
+ tokenAccountsToFetch.push(farmAccount.poolRewardTokenAccountB);
94
+ });
95
+ const parsedTokenAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.tokenAccountStruct, tokenAccountsToFetch);
96
+ const tokenAccountsMap = new Map();
97
+ parsedTokenAccounts.forEach((parsedTokenAccount) => {
98
+ if (!parsedTokenAccount)
99
+ return;
100
+ tokenAccountsMap.set(parsedTokenAccount.pubkey.toString(), parsedTokenAccount);
101
+ });
102
+ const tokenPriceById = yield cache.getTokenPricesAsMap(parsedTokenAccounts
103
+ .map((account) => {
104
+ if (account)
105
+ return account.mint.toString();
106
+ return [];
107
+ })
108
+ .flat(), portfolio_core_1.NetworkId.solana);
109
+ const promises = [];
110
+ for (let i = 0; i < farmAccounts.length; i += 1) {
111
+ const farmAccount = farmAccounts[i];
112
+ const poolLpTokenAccount = tokenAccountsMap.get(farmAccount.poolLpTokenAccount.toString());
113
+ if (!poolLpTokenAccount)
114
+ continue;
115
+ const lpToken = tokenPriceById.get(poolLpTokenAccount.mint.toString());
116
+ if (!lpToken)
117
+ continue;
118
+ const tvl = poolLpTokenAccount.amount
119
+ .div(Math.pow(10, lpToken.decimals))
120
+ .times(lpToken.price)
121
+ .toNumber();
122
+ let rewardTokenA;
123
+ let rewardTokenB;
124
+ const yields = [];
125
+ // Yield A
126
+ if (tvl > 0 && !farmAccount.perBlock.isZero()) {
127
+ const poolRewardTokenAccount = tokenAccountsMap.get(farmAccount.poolRewardTokenAccount.toString());
128
+ if (poolRewardTokenAccount)
129
+ rewardTokenA = tokenPriceById.get(poolRewardTokenAccount.mint.toString());
130
+ if (rewardTokenA)
131
+ yields.push((0, helpers_1.getFarmYield)(rewardTokenA, farmAccount.perBlock, tvl));
132
+ }
133
+ // Yield B
134
+ if (tvl > 0 &&
135
+ farmAccount.poolRewardTokenAccountB &&
136
+ farmAccount.perBlockB &&
137
+ !farmAccount.perBlockB.isZero()) {
138
+ const poolRewardTokenAccountB = tokenAccountsMap.get(farmAccount.poolRewardTokenAccountB.toString());
139
+ if (poolRewardTokenAccountB)
140
+ rewardTokenB = tokenPriceById.get(poolRewardTokenAccountB.mint.toString());
141
+ if (rewardTokenB)
142
+ yields.push((0, helpers_1.getFarmYield)(rewardTokenB, farmAccount.perBlockB, tvl));
143
+ }
144
+ const farmInfo = {
145
+ account: farmAccount,
146
+ lpToken,
147
+ yields,
148
+ rewardTokenA,
149
+ rewardTokenB,
150
+ d: farmAccount.d,
151
+ };
152
+ promises.push(cache.setItem(farmAccount.pubkey.toString(), farmInfo, {
153
+ prefix: `${constants_1.platformId}/farm`,
154
+ networkId: portfolio_core_1.NetworkId.solana,
155
+ }));
156
+ }
157
+ yield Promise.allSettled(promises);
158
+ });
159
+ const job = {
160
+ id: `${constants_1.platformId}-farms`,
161
+ executor,
162
+ label: 'normal',
163
+ };
164
+ exports.default = job;
165
+ //# sourceMappingURL=farmsJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"farmsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/farmsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,+DAAmE;AAGnE,iDAAsD;AACtD,2CAAyC;A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,CACX,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;YACrD,MAAM,EAAE,GAAG,sBAAU,OAAO;YAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACrC,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,3 +4,21 @@ export declare const ammV5Filter: GetProgramAccountsFilter[];
4
4
  export declare const clmmPoolsStateFilter: GetProgramAccountsFilter[];
5
5
  export declare const cpmmPoolsStateFilter: GetProgramAccountsFilter[];
6
6
  export declare const stakingFilters: (owner: string) => GetProgramAccountsFilter[];
7
+ export declare const userFarmAccountV3Filters: (address: string) => GetProgramAccountsFilter[];
8
+ export declare const userFarmAccountV4Filters: (address: string) => GetProgramAccountsFilter[];
9
+ export declare const userFarmAccountV5Filters: (address: string) => GetProgramAccountsFilter[];
10
+ export declare const userFarmAccountV51Filters: (address: string) => GetProgramAccountsFilter[];
11
+ export declare const userFarmAccountV31Filters: (address: string) => GetProgramAccountsFilter[];
12
+ export declare const userFarmAccountV61Filters: (address: string) => GetProgramAccountsFilter[];
13
+ export declare const farmAccountV3Filters: {
14
+ dataSize: number;
15
+ }[];
16
+ export declare const farmAccountV4Filters: {
17
+ dataSize: number;
18
+ }[];
19
+ export declare const farmAccountV5Filters: {
20
+ dataSize: number;
21
+ }[];
22
+ export declare const farmAccountV6Filters: {
23
+ dataSize: number;
24
+ }[];
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stakingFilters = exports.cpmmPoolsStateFilter = exports.clmmPoolsStateFilter = exports.ammV5Filter = exports.ammV4Filter = void 0;
3
+ exports.farmAccountV6Filters = exports.farmAccountV5Filters = exports.farmAccountV4Filters = exports.farmAccountV3Filters = exports.userFarmAccountV61Filters = exports.userFarmAccountV31Filters = exports.userFarmAccountV51Filters = exports.userFarmAccountV5Filters = exports.userFarmAccountV4Filters = exports.userFarmAccountV3Filters = exports.stakingFilters = exports.cpmmPoolsStateFilter = exports.clmmPoolsStateFilter = exports.ammV5Filter = exports.ammV4Filter = void 0;
4
4
  const amms_1 = require("./structs/amms");
5
+ const farms_1 = require("./structs/farms");
5
6
  exports.ammV4Filter = [
6
7
  { dataSize: amms_1.ammInfoV4Struct.byteSize },
7
8
  ];
@@ -24,4 +25,76 @@ const stakingFilters = (owner) => [
24
25
  { dataSize: 232 },
25
26
  ];
26
27
  exports.stakingFilters = stakingFilters;
28
+ const userFarmAccountV3Filters = (address) => [
29
+ { dataSize: farms_1.userFarmAccountV3Struct.byteSize },
30
+ {
31
+ memcmp: {
32
+ offset: 40,
33
+ bytes: address,
34
+ },
35
+ },
36
+ ];
37
+ exports.userFarmAccountV3Filters = userFarmAccountV3Filters;
38
+ const userFarmAccountV4Filters = (address) => [
39
+ { dataSize: farms_1.userFarmAccountV4Struct.byteSize },
40
+ {
41
+ memcmp: {
42
+ offset: 40,
43
+ bytes: address,
44
+ },
45
+ },
46
+ ];
47
+ exports.userFarmAccountV4Filters = userFarmAccountV4Filters;
48
+ const userFarmAccountV5Filters = (address) => [
49
+ { dataSize: farms_1.userFarmAccountV5Struct.byteSize },
50
+ {
51
+ memcmp: {
52
+ offset: 40,
53
+ bytes: address,
54
+ },
55
+ },
56
+ ];
57
+ exports.userFarmAccountV5Filters = userFarmAccountV5Filters;
58
+ const userFarmAccountV51Filters = (address) => [
59
+ { dataSize: farms_1.userFarmAccountV4Struct.byteSize },
60
+ {
61
+ memcmp: {
62
+ offset: 40,
63
+ bytes: address,
64
+ },
65
+ },
66
+ ];
67
+ exports.userFarmAccountV51Filters = userFarmAccountV51Filters;
68
+ const userFarmAccountV31Filters = (address) => [
69
+ { dataSize: farms_1.userFarmAccountV31Struct.byteSize },
70
+ {
71
+ memcmp: {
72
+ offset: 40,
73
+ bytes: address,
74
+ },
75
+ },
76
+ ];
77
+ exports.userFarmAccountV31Filters = userFarmAccountV31Filters;
78
+ const userFarmAccountV61Filters = (address) => [
79
+ { dataSize: farms_1.userFarmAccountV61Struct.byteSize },
80
+ {
81
+ memcmp: {
82
+ offset: 48,
83
+ bytes: address,
84
+ },
85
+ },
86
+ ];
87
+ exports.userFarmAccountV61Filters = userFarmAccountV61Filters;
88
+ exports.farmAccountV3Filters = [
89
+ { dataSize: farms_1.farmAccountV3Struct.byteSize },
90
+ ];
91
+ exports.farmAccountV4Filters = [
92
+ { dataSize: farms_1.farmAccountV4Struct.byteSize },
93
+ ];
94
+ exports.farmAccountV5Filters = [
95
+ { dataSize: farms_1.farmAccountV5Struct.byteSize },
96
+ ];
97
+ exports.farmAccountV6Filters = [
98
+ { dataSize: farms_1.farmAccountV6Struct.byteSize },
99
+ ];
27
100
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/filters.ts"],"names":[],"mappings":";;;AACA,yCAAkE;AAErD,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,oBAAoB,GAA+B;IAC9D,EAAE,QAAQ,EAAE,IAAI,EAAE;CACnB,CAAC;AAEW,QAAA,oBAAoB,GAA+B;IAC9D,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AARW,QAAA,cAAc,kBAQzB"}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/filters.ts"],"names":[],"mappings":";;;AACA,yCAAkE;AAClE,2CAUyB;AAEZ,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,oBAAoB,GAA+B;IAC9D,EAAE,QAAQ,EAAE,IAAI,EAAE;CACnB,CAAC;AAEW,QAAA,oBAAoB,GAA+B;IAC9D,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEK,MAAM,wBAAwB,GAAG,CACtC,OAAe,EACa,EAAE,CAAC;IAC/B,EAAE,QAAQ,EAAE,+BAAuB,CAAC,QAAQ,EAAE;IAC9C;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,OAAO;SACf;KACF;CACF,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEK,MAAM,wBAAwB,GAAG,CACtC,OAAe,EACa,EAAE,CAAC;IAC/B,EAAE,QAAQ,EAAE,+BAAuB,CAAC,QAAQ,EAAE;IAC9C;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,OAAO;SACf;KACF;CACF,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEK,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E,2BAAmB,CAAC,QAAQ,EAAE;CAC3C,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import BN from 'bn.js';
3
- import { PortfolioAssetCollectible } from '@sonarwatch/portfolio-core';
3
+ import { PortfolioAssetCollectible, PortfolioAssetToken, TokenPrice, Yield } from '@sonarwatch/portfolio-core';
4
4
  import { PublicKey } from '@solana/web3.js';
5
5
  export declare function isARaydiumPosition(nft: PortfolioAssetCollectible): boolean;
6
6
  export declare function raydiumTickToPriceX64(tick: number): BN;
@@ -9,3 +9,5 @@ export declare function getRaydiumTokenAmountsFromLiquidity(sqrtPriceCurrentX64:
9
9
  tokenAmountB: BigNumber;
10
10
  };
11
11
  export declare function getStakePubKey(owner: string): PublicKey;
12
+ export declare function getFarmYield(rewardToken: TokenPrice, rewardPerBlock: BigNumber, tvl: number, slotsPerSec?: number): Yield;
13
+ export declare function getPendingAssetToken(depositBalance: BigNumber, rewardDebt: BigNumber, perShare: BigNumber, rewardToken: TokenPrice, multiplier: number | BigNumber): PortfolioAssetToken;
@@ -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.getStakePubKey = exports.getRaydiumTokenAmountsFromLiquidity = exports.raydiumTickToPriceX64 = exports.isARaydiumPosition = void 0;
6
+ exports.getPendingAssetToken = exports.getFarmYield = exports.getStakePubKey = exports.getRaydiumTokenAmountsFromLiquidity = exports.raydiumTickToPriceX64 = exports.isARaydiumPosition = void 0;
7
7
  /* eslint-disable eqeqeq */
8
8
  /* eslint-disable @typescript-eslint/naming-convention */
9
9
  /* eslint-disable no-underscore-dangle */
@@ -11,8 +11,10 @@ exports.getStakePubKey = exports.getRaydiumTokenAmountsFromLiquidity = exports.r
11
11
  /* eslint-disable no-bitwise */
12
12
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
13
13
  const bn_js_1 = __importDefault(require("bn.js"));
14
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
14
15
  const web3_js_1 = require("@solana/web3.js");
15
16
  const constants_1 = require("./constants");
17
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
16
18
  function isARaydiumPosition(nft) {
17
19
  return nft.data.name === constants_1.positionsIdentifier;
18
20
  }
@@ -177,4 +179,26 @@ function getStakePubKey(owner) {
177
179
  ], constants_1.AMM_PROGRAM_ID_V3)[0];
178
180
  }
179
181
  exports.getStakePubKey = getStakePubKey;
182
+ function getFarmYield(rewardToken, rewardPerBlock, tvl, slotsPerSec = 2) {
183
+ const apr = rewardPerBlock
184
+ .div(Math.pow(10, rewardToken.decimals))
185
+ .times(slotsPerSec * 60 * 60 * 24 * 365 * rewardToken.price)
186
+ .div(tvl)
187
+ .toNumber();
188
+ return {
189
+ apr,
190
+ apy: (0, portfolio_core_1.aprToApy)(apr),
191
+ };
192
+ }
193
+ exports.getFarmYield = getFarmYield;
194
+ function getPendingAssetToken(depositBalance, rewardDebt, perShare, rewardToken, multiplier) {
195
+ const amount = depositBalance
196
+ .times(perShare)
197
+ .div(multiplier)
198
+ .minus(rewardDebt)
199
+ .div(Math.pow(10, rewardToken.decimals))
200
+ .toNumber();
201
+ return (0, tokenPriceToAssetToken_1.default)(rewardToken.address, amount, portfolio_core_1.NetworkId.solana, rewardToken);
202
+ }
203
+ exports.getPendingAssetToken = getPendingAssetToken;
180
204
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,yDAAyD;AACzD,yCAAyC;AACzC,sCAAsC;AACtC,+BAA+B;AAC/B,gEAAqC;AACrC,kDAAuB;AAEvB,6CAA4C;AAC5C,2CAAqE;AAErE,SAAgB,kBAAkB,CAAC,GAA8B;IAC/D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,IAAI,eAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,EAC5B,OAAO,CACR,CAAC,QAAQ,EAAE,CACb;KACF,CAAC;AACJ,CAAC;AAtDD,kFAsDC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC,QAAQ,EAAE;QACxE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC;KACvD,EACD,6BAAiB,CAClB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,wCASC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,yDAAyD;AACzD,yCAAyC;AACzC,sCAAsC;AACtC,+BAA+B;AAC/B,gEAAqC;AACrC,kDAAuB;AACvB,+DAOoC;AACpC,6CAA4C;AAC5C,2CAAqE;AACrE,qGAA6E;AAE7E,SAAgB,kBAAkB,CAAC,GAA8B;IAC/D,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,+BAAmB,CAAC;AAC/C,CAAC;AAFD,gDAEC;AAED,MAAM,IAAI,GAAG,IAAI,eAAE,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,GAAG,GAAG,IAAI,eAAE,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,IAAI,eAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,IAAI,eAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CA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cAAyB,EACzB,GAAW,EACX,WAAW,GAAG,CAAC;IAEf,MAAM,GAAG,GAAG,cAAc;SACvB,GAAG,CAAC,SAAA,EAAE,EAAI,WAAW,CAAC,QAAQ,CAAA,CAAC;SAC/B,KAAK,CAAC,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC;SAC3D,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE,CAAC;IACd,OAAO;QACL,GAAG;QACH,GAAG,EAAE,IAAA,yBAAQ,EAAC,GAAG,CAAC;KACnB,CAAC;AACJ,CAAC;AAfD,oCAeC;AAED,SAAgB,oBAAoB,CAClC,cAAyB,EACzB,UAAqB,EACrB,QAAmB,EACnB,WAAuB,EACvB,UAA8B;IAE9B,MAAM,MAAM,GAAG,cAAc;SAC1B,KAAK,CAAC,QAAQ,CAAC;SACf,GAAG,CAAC,UAAU,CAAC;SACf,KAAK,CAAC,UAAU,CAAC;SACjB,GAAG,CAAC,SAAA,EAAE,EAAI,WAAW,CAAC,QAAQ,CAAA,CAAC;SAC/B,QAAQ,EAAE,CAAC;IACd,OAAO,IAAA,gCAAsB,EAC3B,WAAW,CAAC,OAAO,EACnB,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,WAAW,CACZ,CAAC;AACJ,CAAC;AAnBD,oDAmBC"}
@@ -7,9 +7,11 @@ exports.fetchers = exports.jobs = exports.platforms = void 0;
7
7
  const lpTokensJob_1 = __importDefault(require("./lpTokensJob"));
8
8
  const clmmJob_1 = __importDefault(require("./clmmJob"));
9
9
  const cpmmJob_1 = __importDefault(require("./cpmmJob"));
10
+ const farmsJob_1 = __importDefault(require("./farmsJob"));
10
11
  const constants_1 = require("./constants");
11
12
  const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
13
+ const farmsFetcher_1 = __importDefault(require("./farmsFetcher"));
12
14
  exports.platforms = [constants_1.platform];
13
- exports.jobs = [lpTokensJob_1.default, clmmJob_1.default, cpmmJob_1.default];
14
- exports.fetchers = [stakingFetcher_1.default];
15
+ exports.jobs = [lpTokensJob_1.default, farmsJob_1.default, clmmJob_1.default, cpmmJob_1.default];
16
+ exports.fetchers = [stakingFetcher_1.default, farmsFetcher_1.default];
15
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,wDAAgC;AAChC,wDAAgC;AAChC,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,qBAAW,EAAE,iBAAO,EAAE,iBAAO,CAAC,CAAC;AAC9C,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,wDAAgC;AAChC,wDAAgC;AAChC,0DAAkC;AAClC,2CAAuC;AACvC,sEAA8C;AAC9C,kEAA0C;AAE7B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,qBAAW,EAAE,kBAAQ,EAAE,iBAAO,EAAE,iBAAO,CAAC,CAAC;AACxD,QAAA,QAAQ,GAAc,CAAC,wBAAc,EAAE,sBAAY,CAAC,CAAC"}