@sonarwatch/portfolio-plugins 0.5.43 → 0.5.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +77 -73
  2. package/package.json +2 -2
  3. package/src/index.js +3 -0
  4. package/src/index.js.map +1 -1
  5. package/src/platforms.d.ts +3 -0
  6. package/src/platforms.js +16 -1
  7. package/src/platforms.js.map +1 -1
  8. package/src/plugins/orders/clobs-solana/MarketJobExecutorGenerator.d.ts +3 -0
  9. package/src/plugins/orders/clobs-solana/MarketJobExecutorGenerator.js +52 -0
  10. package/src/plugins/orders/clobs-solana/MarketJobExecutorGenerator.js.map +1 -0
  11. package/src/plugins/orders/clobs-solana/constants.d.ts +7 -0
  12. package/src/plugins/orders/clobs-solana/constants.js +43 -0
  13. package/src/plugins/orders/clobs-solana/constants.js.map +1 -0
  14. package/src/plugins/orders/clobs-solana/filters.d.ts +5 -0
  15. package/src/plugins/orders/clobs-solana/filters.js +22 -0
  16. package/src/plugins/orders/clobs-solana/filters.js.map +1 -0
  17. package/src/plugins/orders/clobs-solana/openbookFetcher.d.ts +3 -0
  18. package/src/plugins/orders/clobs-solana/openbookFetcher.js +102 -0
  19. package/src/plugins/orders/clobs-solana/openbookFetcher.js.map +1 -0
  20. package/src/plugins/orders/clobs-solana/serumFetcherExecutorGenerator.d.ts +3 -0
  21. package/src/plugins/orders/clobs-solana/serumFetcherExecutorGenerator.js +156 -0
  22. package/src/plugins/orders/clobs-solana/serumFetcherExecutorGenerator.js.map +1 -0
  23. package/src/plugins/orders/clobs-solana/structs.d.ts +208 -0
  24. package/src/plugins/orders/clobs-solana/structs.js +199 -0
  25. package/src/plugins/orders/clobs-solana/structs.js.map +1 -0
  26. package/src/plugins/orders/clobs-solana/types.d.ts +18 -0
  27. package/src/plugins/orders/clobs-solana/types.js +3 -0
  28. package/src/plugins/orders/clobs-solana/types.js.map +1 -0
  29. package/src/plugins/orders/constants.d.ts +3 -0
  30. package/src/plugins/orders/constants.js +7 -0
  31. package/src/plugins/orders/constants.js.map +1 -0
  32. package/src/plugins/orders/index.d.ts +4 -0
  33. package/src/plugins/orders/index.js +52 -0
  34. package/src/plugins/orders/index.js.map +1 -0
  35. package/src/plugins/orders/jupiter/filters.d.ts +2 -0
  36. package/src/plugins/orders/jupiter/filters.js +25 -0
  37. package/src/plugins/orders/jupiter/filters.js.map +1 -0
  38. package/src/plugins/orders/jupiter/limitFetcher.d.ts +3 -0
  39. package/src/plugins/orders/jupiter/limitFetcher.js +80 -0
  40. package/src/plugins/orders/jupiter/limitFetcher.js.map +1 -0
  41. package/src/plugins/orders/jupiter/struct.d.ts +22 -0
  42. package/src/plugins/orders/jupiter/struct.js +24 -0
  43. package/src/plugins/orders/jupiter/struct.js.map +1 -0
  44. package/src/plugins/top-tokens/forcedAddresses.js +14 -1
  45. package/src/plugins/top-tokens/forcedAddresses.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -2,82 +2,86 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.5.43](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.42...plugins-0.5.43) (2023-08-16)
6
-
7
-
8
-
9
- ## [0.5.42](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.41...plugins-0.5.42) (2023-08-14)
10
-
11
-
12
-
13
- ## [0.5.41](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.40...plugins-0.5.41) (2023-08-14)
14
-
15
-
16
-
17
- ## [0.5.40](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.39...plugins-0.5.40) (2023-08-14)
18
-
19
-
20
-
21
- ## [0.5.39](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.38...plugins-0.5.39) (2023-08-14)
22
-
23
-
24
-
25
- ## [0.5.38](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.37...plugins-0.5.38) (2023-08-14)
26
-
27
-
28
-
29
- ## [0.5.37](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.36...plugins-0.5.37) (2023-08-14)
30
-
31
-
32
-
33
- ## [0.5.36](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.35...plugins-0.5.36) (2023-08-14)
34
-
35
-
36
-
37
- ## [0.5.35](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.34...plugins-0.5.35) (2023-08-14)
38
-
39
-
40
-
41
- ## [0.5.34](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.33...plugins-0.5.34) (2023-08-14)
42
-
43
-
44
-
45
- ## [0.5.33](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.32...plugins-0.5.33) (2023-08-14)
46
-
47
-
48
-
49
- ## [0.5.32](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.31...plugins-0.5.32) (2023-08-14)
50
-
51
-
52
-
53
- ## [0.5.31](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.30...plugins-0.5.31) (2023-08-14)
54
-
55
-
56
-
57
- ## [0.5.30](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.29...plugins-0.5.30) (2023-08-12)
58
-
59
-
60
-
61
- ## [0.5.29](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.28...plugins-0.5.29) (2023-08-11)
62
-
63
-
64
-
65
- ## [0.5.28](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.27...plugins-0.5.28) (2023-08-11)
66
-
67
-
68
-
69
- ## [0.5.27](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.26...plugins-0.5.27) (2023-08-11)
70
-
71
-
72
-
73
- ## [0.5.26](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.25...plugins-0.5.26) (2023-08-10)
74
-
75
-
76
-
77
- ## [0.5.25](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.24...plugins-0.5.25) (2023-08-10)
5
+ ## [0.5.44](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.43...plugins-0.5.44) (2023-08-16)
78
6
 
79
7
 
80
8
 
9
+ ## [0.5.43](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.42...plugins-0.5.43) (2023-08-16)
10
+
11
+
12
+
13
+ ## [0.5.42](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.41...plugins-0.5.42) (2023-08-14)
14
+
15
+
16
+
17
+ ## [0.5.41](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.40...plugins-0.5.41) (2023-08-14)
18
+
19
+
20
+
21
+ ## [0.5.40](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.39...plugins-0.5.40) (2023-08-14)
22
+
23
+
24
+
25
+ ## [0.5.39](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.38...plugins-0.5.39) (2023-08-14)
26
+
27
+
28
+
29
+ ## [0.5.38](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.37...plugins-0.5.38) (2023-08-14)
30
+
31
+
32
+
33
+ ## [0.5.37](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.36...plugins-0.5.37) (2023-08-14)
34
+
35
+
36
+
37
+ ## [0.5.36](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.35...plugins-0.5.36) (2023-08-14)
38
+
39
+
40
+
41
+ ## [0.5.35](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.34...plugins-0.5.35) (2023-08-14)
42
+
43
+
44
+
45
+ ## [0.5.34](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.33...plugins-0.5.34) (2023-08-14)
46
+
47
+
48
+
49
+ ## [0.5.33](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.32...plugins-0.5.33) (2023-08-14)
50
+
51
+
52
+
53
+ ## [0.5.32](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.31...plugins-0.5.32) (2023-08-14)
54
+
55
+
56
+
57
+ ## [0.5.31](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.30...plugins-0.5.31) (2023-08-14)
58
+
59
+
60
+
61
+ ## [0.5.30](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.29...plugins-0.5.30) (2023-08-12)
62
+
63
+
64
+
65
+ ## [0.5.29](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.28...plugins-0.5.29) (2023-08-11)
66
+
67
+
68
+
69
+ ## [0.5.28](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.27...plugins-0.5.28) (2023-08-11)
70
+
71
+
72
+
73
+ ## [0.5.27](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.26...plugins-0.5.27) (2023-08-11)
74
+
75
+
76
+
77
+ ## [0.5.26](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.25...plugins-0.5.26) (2023-08-10)
78
+
79
+
80
+
81
+ ## [0.5.25](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.24...plugins-0.5.25) (2023-08-10)
82
+
83
+
84
+
81
85
  ## [0.5.24](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.23...plugins-0.5.24) (2023-08-10)
82
86
 
83
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.5.43",
3
+ "version": "0.5.44",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -30,7 +30,7 @@
30
30
  "web3-v1": "npm:web3@^1.5.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@sonarwatch/portfolio-core": "0.5.43"
33
+ "@sonarwatch/portfolio-core": "0.5.44"
34
34
  },
35
35
  "main": "./src/index.js",
36
36
  "types": "./src/index.d.ts"
package/src/index.js CHANGED
@@ -41,6 +41,7 @@ const cetus_1 = require("./plugins/cetus");
41
41
  const turbos_1 = require("./plugins/turbos");
42
42
  const thala_1 = require("./plugins/thala");
43
43
  const tensor_1 = require("./plugins/tensor");
44
+ const orders_1 = require("./plugins/orders");
44
45
  const aave_1 = require("./plugins/aave");
45
46
  const staking_aptos_1 = require("./plugins/staking-aptos");
46
47
  const morpho_1 = require("./plugins/morpho");
@@ -75,6 +76,7 @@ exports.jobs = [
75
76
  ...auxexchange_1.jobs,
76
77
  ...saber_1.jobs,
77
78
  ...aave_1.jobs,
79
+ ...orders_1.jobs,
78
80
  ...morpho_1.jobs,
79
81
  ];
80
82
  exports.fetchers = [
@@ -93,6 +95,7 @@ exports.fetchers = [
93
95
  ...turbos_1.fetchers,
94
96
  ...staking_aptos_1.fetchers,
95
97
  ...aave_1.fetchers,
98
+ ...orders_1.fetchers,
96
99
  ...morpho_1.fetchers,
97
100
  ];
98
101
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,0DAA4C;AAC5C,6CAG0B;AAC1B,yDAGgC;AAChC,iDAAkE;AAClE,iDAG4B;AAC5B,2CAAoD;AACpD,6CAG0B;AAC1B,+CAG2B;AAC3B,yCAA4E;AAC5E,+CAAwD;AACxD,2CAA+E;AAC/E,6CAG0B;AAC1B,2CAA+E;AAC/E,6CAA8D;AAC9D,yCAA4E;AAC5E,2DAA2E;AAC3E,6CAG0B;AAC1B,2CAA+E;AAC/E,2CAA+E;AAC/E,qDAA6D;AAC7D,uDAAgE;AAChE,qDAA8D;AAC9D,uDAAgE;AAChE,wFAAqF;AAErF,0CAAwB;AACxB,4CAA0B;AAC1B,wCAAsB;AAEtB,8CAA4B;AACf,QAAA,SAAS,GAAe,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAEpD,QAAA,IAAI,GAAU;IACzB,GAAG,aAAU;IACb,GAAG,mBAAe;IAClB,GAAG,YAAS;IACZ,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,aAAU;IACb,GAAG,cAAW;IACd,GAAG,WAAQ;IACX,GAAG,YAAS;IACZ,GAAG,YAAS;IACZ,GAAG,YAAS;IACZ,GAAG,aAAU;IACb,GA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AAG,YAAS;IACZ,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,aAAU;IACb,GAAG,cAAW;IACd,GAAG,WAAQ;IACX,GAAG,YAAS;IACZ,GAAG,YAAS;IACZ,GAAG,YAAS;IACZ,GAAG,aAAU;IACb,GAAG,iBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,iBAAc;IACjB,GAAG,kBAAe;IAClB,GAAG,YAAS;IACZ,GAAG,WAAQ;IACX,GAAG,aAAU;IACb,GAAG,aAAU;CACd,CAAC;AAEW,QAAA,QAAQ,GAAc;IACjC,GAAG,iBAAc;IACjB,GAAG,uBAAmB;IACtB,GAAG,iBAAc;IACjB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,wBAAoB;IACvB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,iBAAc;CAClB,CAAC;AAEW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
@@ -23,4 +23,7 @@ export declare const turbosPlatform: Platform;
23
23
  export declare const meeiroPlatform: Platform;
24
24
  export declare const nativeStakePlatform: Platform;
25
25
  export declare const saberPlatform: Platform;
26
+ export declare const jupiterPlatform: Platform;
27
+ export declare const serumPlatform: Platform;
28
+ export declare const openbookPlatform: Platform;
26
29
  export declare const morphoPlatform: Platform;
package/src/platforms.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.morphoPlatform = exports.saberPlatform = exports.nativeStakePlatform = exports.meeiroPlatform = exports.turbosPlatform = exports.cetusPlatform = exports.mangoPlatform = exports.driftPlatform = exports.meteoraPlatform = exports.orcaPlatform = exports.solendPlatform = exports.raydiumPlatform = exports.animeswapPlatform = exports.dittoPlatform = exports.liquidswapPlatform = exports.pancakeswapPlatform = exports.auxExchangePlatform = exports.tortugaPlatform = exports.thalaPlatform = exports.tensorPlatform = exports.marginfiPlatform = exports.aavePlatform = exports.marinadePlatform = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
3
+ exports.morphoPlatform = exports.openbookPlatform = exports.serumPlatform = exports.jupiterPlatform = exports.saberPlatform = exports.nativeStakePlatform = exports.meeiroPlatform = exports.turbosPlatform = exports.cetusPlatform = exports.mangoPlatform = exports.driftPlatform = exports.meteoraPlatform = exports.orcaPlatform = exports.solendPlatform = exports.raydiumPlatform = exports.animeswapPlatform = exports.dittoPlatform = exports.liquidswapPlatform = exports.pancakeswapPlatform = exports.auxExchangePlatform = exports.tortugaPlatform = exports.thalaPlatform = exports.tensorPlatform = exports.marginfiPlatform = exports.aavePlatform = exports.marinadePlatform = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
4
4
  exports.walletTokensPlatform = {
5
5
  id: 'wallet-tokens',
6
6
  name: 'Tokens',
@@ -121,6 +121,21 @@ exports.saberPlatform = {
121
121
  name: 'Saber',
122
122
  image: 'https://alpha.sonar.watch/img/platforms/saber.png',
123
123
  };
124
+ exports.jupiterPlatform = {
125
+ id: 'jupiter',
126
+ name: 'Jupiter',
127
+ image: 'https://alpha.sonar.watch/img/platforms/jupiter.png',
128
+ };
129
+ exports.serumPlatform = {
130
+ id: 'serum',
131
+ name: 'Serum',
132
+ image: 'https://alpha.sonar.watch/img/platforms/serum.png',
133
+ };
134
+ exports.openbookPlatform = {
135
+ id: 'openbook',
136
+ name: 'OpenBook',
137
+ image: 'https://alpha.sonar.watch/img/platforms/openbook.png',
138
+ };
124
139
  exports.morphoPlatform = {
125
140
  id: 'morpho',
126
141
  name: 'Morpho',
@@ -1 +1 @@
1
- {"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/platforms.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAo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E,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,0DAA0D;CAClE,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC"}
1
+ {"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/platforms.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAa;IAC5C,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,2DAA2D;CACnE,CAAC;AACW,QAAA,kBAAkB,GAAa;IAC1C,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,yDAAyD;CACjE,CAAC;AACW,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,sDAAsD;CAC9D,CAAC;AACW,QAAA,YAAY,GAAa;IACpC,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,kDAAkD;CAC1D,CAAC;AACW,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,sDAAsD;CAC9D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,iBAAiB;IACvB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AmD;CAC3D,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,mBAAmB,GAAa;IAC3C,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,0DAA0D;CAClE,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,qDAAqD;CAC7D,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,sDAAsD;CAC9D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { JobExecutor } from '../../../Job';
2
+ import { CLOBVersion } from './types';
3
+ export default function getMarketJobExecutor(clobProgramInfo: CLOBVersion): JobExecutor;
@@ -0,0 +1,52 @@
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
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
+ const web3_js_1 = require("@solana/web3.js");
14
+ const clients_1 = require("../../../utils/clients");
15
+ const solana_1 = require("../../../utils/solana");
16
+ const filters_1 = require("./filters");
17
+ const networkId = portfolio_core_1.NetworkId.solana;
18
+ function getMarketJobExecutor(clobProgramInfo) {
19
+ return (cache) => __awaiter(this, void 0, void 0, function* () {
20
+ const client = (0, clients_1.getClientSolana)();
21
+ const marketsAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, clobProgramInfo.struct, new web3_js_1.PublicKey(clobProgramInfo.programId), (0, filters_1.dataSizeStructFilter)(clobProgramInfo.struct));
22
+ yield addMarketsToCache(cache, clobProgramInfo, marketsAccounts);
23
+ });
24
+ }
25
+ exports.default = getMarketJobExecutor;
26
+ function addMarketsToCache(cache, clobProgramInfo, marketsAccounts) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ for (let i = 0; i < marketsAccounts.length; i++) {
29
+ const marketAccount = marketsAccounts[i];
30
+ const marketData = getCLOBMarket(marketAccount, clobProgramInfo.programId.toString());
31
+ if (!marketData)
32
+ continue;
33
+ yield cache.setItem(marketAccount.ownAddress.toString(), marketData, {
34
+ prefix: clobProgramInfo.prefix,
35
+ networkId,
36
+ });
37
+ }
38
+ });
39
+ }
40
+ function getCLOBMarket(account, programId) {
41
+ if (account.baseDepositsTotal.isZero() && account.baseDepositsTotal.isZero())
42
+ return undefined;
43
+ return {
44
+ address: account.ownAddress.toString(),
45
+ baseMint: account.baseMint.toString(),
46
+ baseDepositsTotal: account.baseDepositsTotal,
47
+ quoteMint: account.quoteMint.toString(),
48
+ quoteDepositsTotal: account.quoteDepositsTotal,
49
+ programId,
50
+ };
51
+ }
52
+ //# sourceMappingURL=MarketJobExecutorGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarketJobExecutorGenerator.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orders/clobs-solana/MarketJobExecutorGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAG5C,oDAAyD;AACzD,kDAAiE;AAEjE,uCAAiD;AAIjD,MAAM,SAAS,GAAG,0BAAS,CAAC,MAAM,CAAC;AAEnC,SAAwB,oBAAoB,CAC1C,eAA4B;IAE5B,OAAO,CAAO,KAAY,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAwB,EACpD,MAAM,EACN,eAAe,CAAC,MAAM,EACtB,IAAI,mBAAS,CAAC,eAAe,CAAC,SAAS,CAAC,EACxC,IAAA,8BAAoB,EAAC,eAAe,CAAC,MAAM,CAAC,CAC7C,CAAC;QAEF,MAAM,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;IACnE,CAAC,CAAA,CAAC;AACJ,CAAC;AAdD,uCAcC;AAED,SAAe,iBAAiB,CAC9B,KAAY,EACZ,eAA4B,EAC5B,eAAoC;;QAEpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YACzC,MAAM,UAAU,GAAG,aAAa,CAC9B,aAAa,EACb,eAAe,CAAC,SAAS,CAAC,QAAQ,EAAE,CACrC,CAAC;YACF,IAAI,CAAC,UAAU;gBAAE,SAAS;YAE1B,MAAM,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE;gBACnE,MAAM,EAAE,eAAe,CAAC,MAAM;gBAC9B,SAAS;aACV,CAAC,CAAC;SACJ;IACH,CAAC;CAAA;AAED,SAAS,aAAa,CACpB,OAA0B,EAC1B,SAAiB;IAEjB,IAAI,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE;QAC1E,OAAO,SAAS,CAAC;IAEnB,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE;QACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE;QACrC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE;QACvC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { CLOBVersion } from './types';
2
+ export declare const clobVersions: {
3
+ serumV1: CLOBVersion;
4
+ serumV2: CLOBVersion;
5
+ serumV3: CLOBVersion;
6
+ openbookV1: CLOBVersion;
7
+ };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clobVersions = void 0;
4
+ const platforms_1 = require("../../../platforms");
5
+ const structs_1 = require("./structs");
6
+ const openOrders_1 = require("../../raydium/structs/openOrders");
7
+ exports.clobVersions = {
8
+ serumV1: {
9
+ name: 'Serum V1',
10
+ programId: '4ckmDgGdxQoPDLUkDT3vHgSAkzA3QRdNq5ywwY4sUSJn',
11
+ struct: structs_1.serumMarketV1Struct,
12
+ orderStruct: openOrders_1.openOrdersV1Struct,
13
+ prefix: `${platforms_1.serumPlatform.id}-marketsV1`,
14
+ },
15
+ serumV2: {
16
+ name: 'Serum V2',
17
+ programId: 'EUqojwWA2rd19FZrzeBncJsm38Jm1hEhE3zsmX3bRc2o',
18
+ struct: structs_1.serumMarketV2Struct,
19
+ orderStruct: structs_1.openOrdersV2Struct,
20
+ prefix: `${platforms_1.serumPlatform.id}-marketsV2`,
21
+ },
22
+ serumV3: {
23
+ name: 'Serum V3',
24
+ programId: '9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin',
25
+ struct: structs_1.serumMarketV3Struct,
26
+ orderStruct: structs_1.openOrdersV2Struct,
27
+ prefix: `${platforms_1.serumPlatform.id}-marketsV3`,
28
+ },
29
+ openbookV1: {
30
+ name: 'OpenBook V1',
31
+ programId: 'srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX',
32
+ struct: structs_1.serumMarketV2Struct,
33
+ orderStruct: structs_1.openOrdersV2Struct,
34
+ prefix: `${platforms_1.openbookPlatform.id}-markets`,
35
+ },
36
+ // openbookV2: {
37
+ // programId: 'opnbkNkqux64GppQhwbyEVc3axhssFhVYuwar8rDHCu',
38
+ // struct: openbookMarketV1Struct,
39
+ // orderStruct: openOrdersV3Struct,
40
+ // prefix: openbookMarketsPrefix,
41
+ // } as CLOBProgramInfo,
42
+ };
43
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orders/clobs-solana/constants.ts"],"names":[],"mappings":";;;AAAA,kDAAqE;AACrE,uCAKmB;AAEnB,iEAAsE;AAEzD,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE;QACP,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,8CAA8C;QACzD,MAAM,EAAE,6BAAmB;QAC3B,WAAW,EAAE,+BAAkB;QAC/B,MAAM,EAAE,GAAG,yBAAa,CAAC,EAAE,YAAY;KACzB;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,8CAA8C;QACzD,MAAM,EAAE,6BAAmB;QAC3B,WAAW,EAAE,4BAAkB;QAC/B,MAAM,EAAE,GAAG,yBAAa,CAAC,EAAE,YAAY;KACzB;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,8CAA8C;QACzD,MAAM,EAAE,6BAAmB;QAC3B,WAAW,EAAE,4BAAkB;QAC/B,MAAM,EAAE,GAAG,yBAAa,CAAC,EAAE,YAAY;KACzB;IAChB,UAAU,EAAE;QACV,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,6CAA6C;QACxD,MAAM,EAAE,6BAAmB;QAC3B,WAAW,EAAE,4BAAkB;QAC/B,MAAM,EAAE,GAAG,4BAAgB,CAAC,EAAE,UAAU;KAC1B;IAChB,gBAAgB;IAChB,8DAA8D;IAC9D,oCAAoC;IACpC,qCAAqC;IACrC,mCAAmC;IACnC,wBAAwB;CACzB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { GetProgramAccountsFilter } from '@solana/web3.js';
2
+ import { BeetStruct } from '@metaplex-foundation/beet';
3
+ import { CLOBMarketAccount, CLOBOrderStruct } from './structs';
4
+ export declare const serumOrdersFilter: (owner: string, struct: BeetStruct<CLOBOrderStruct>) => GetProgramAccountsFilter[];
5
+ export declare const dataSizeStructFilter: (struct: BeetStruct<CLOBMarketAccount>) => GetProgramAccountsFilter[];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataSizeStructFilter = exports.serumOrdersFilter = void 0;
4
+ const serumOrdersFilter = (owner, struct) => [
5
+ {
6
+ memcmp: {
7
+ offset: 45,
8
+ bytes: owner,
9
+ },
10
+ },
11
+ {
12
+ dataSize: struct.byteSize,
13
+ },
14
+ ];
15
+ exports.serumOrdersFilter = serumOrdersFilter;
16
+ const dataSizeStructFilter = (struct) => [
17
+ {
18
+ dataSize: struct.byteSize,
19
+ },
20
+ ];
21
+ exports.dataSizeStructFilter = dataSizeStructFilter;
22
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orders/clobs-solana/filters.ts"],"names":[],"mappings":";;;AAIO,MAAM,iBAAiB,GAAG,CAC/B,KAAa,EACb,MAAmC,EACP,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B;CACF,CAAC;AAbW,QAAA,iBAAiB,qBAa5B;AAEK,MAAM,oBAAoB,GAAG,CAClC,MAAqC,EACT,EAAE,CAAC;IAC/B;QACE,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B;CACF,CAAC;AANW,QAAA,oBAAoB,wBAM/B"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const web3_js_1 = require("@solana/web3.js");
17
+ const constants_1 = require("../constants");
18
+ const clients_1 = require("../../../utils/clients");
19
+ const solana_1 = require("../../../utils/solana");
20
+ const openOrders_1 = require("../../raydium/structs/openOrders");
21
+ const runInBatch_1 = __importDefault(require("../../../utils/misc/runInBatch"));
22
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../../utils/misc/tokenPriceToAssetToken"));
23
+ const platforms_1 = require("../../../platforms");
24
+ const constants_2 = require("./constants");
25
+ const filters_1 = require("./filters");
26
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
27
+ const client = (0, clients_1.getClientSolana)();
28
+ const ordersAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, openOrders_1.openOrdersV2Struct, new web3_js_1.PublicKey(constants_2.clobVersions.openbookV1.programId), (0, filters_1.serumOrdersFilter)(owner, openOrders_1.openOrdersV2Struct));
29
+ if (ordersAccounts.length === 0)
30
+ return [];
31
+ const marketsAddresses = new Set();
32
+ for (let i = 0; i < ordersAccounts.length; i++) {
33
+ marketsAddresses.add(ordersAccounts[i].market.toString());
34
+ }
35
+ const markets = yield cache.getItems(Array.from(marketsAddresses), {
36
+ prefix: constants_2.clobVersions.openbookV1.prefix,
37
+ networkId: portfolio_core_1.NetworkId.solana,
38
+ });
39
+ if (!markets)
40
+ return [];
41
+ const marketsByAddress = new Map();
42
+ const tokensMints = new Set();
43
+ for (let i = 0; i < markets.length; i++) {
44
+ const market = markets[i];
45
+ if (!market)
46
+ continue;
47
+ marketsByAddress.set(market.address, market);
48
+ tokensMints.add(market.quoteMint.toString());
49
+ }
50
+ const tokenPriceResults = yield (0, runInBatch_1.default)([...Array.from(tokensMints)].map((mint) => () => cache.getTokenPrice(mint, portfolio_core_1.NetworkId.solana)));
51
+ const tokenPrices = new Map();
52
+ tokenPriceResults.forEach((r) => {
53
+ if (r.status === 'rejected')
54
+ return;
55
+ if (!r.value)
56
+ return;
57
+ tokenPrices.set(r.value.address, r.value);
58
+ });
59
+ const rawAmountByMint = new Map();
60
+ for (let i = 0; i < ordersAccounts.length; i += 1) {
61
+ const openOrder = ordersAccounts[i];
62
+ const market = marketsByAddress.get(openOrder.market.toString());
63
+ if (!market)
64
+ continue;
65
+ const quoteMint = market.quoteMint.toString();
66
+ const amountLeftToFill = openOrder.quoteTokenTotal;
67
+ const totalAmount = rawAmountByMint.get(quoteMint);
68
+ rawAmountByMint.set(quoteMint, amountLeftToFill.plus(totalAmount || 0));
69
+ }
70
+ let value = 0;
71
+ const assets = [];
72
+ for (const [mint, rawAmount] of rawAmountByMint) {
73
+ const tokenPrice = tokenPrices.get(mint);
74
+ if (!tokenPrice)
75
+ continue;
76
+ const amount = rawAmount.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber();
77
+ if (amount === 0)
78
+ continue;
79
+ const asset = (0, tokenPriceToAssetToken_1.default)(mint, amount, portfolio_core_1.NetworkId.solana, tokenPrice);
80
+ assets.push(asset);
81
+ value += asset.value ? asset.value : 0;
82
+ }
83
+ if (assets.length === 0)
84
+ return [];
85
+ const openBookElement = {
86
+ type: 'multiple',
87
+ networkId: portfolio_core_1.NetworkId.solana,
88
+ platformId: platforms_1.openbookPlatform.id,
89
+ value,
90
+ label: 'Deposit',
91
+ tags: ['Limit Orders'],
92
+ data: { assets },
93
+ };
94
+ return [openBookElement];
95
+ });
96
+ const fetcher = {
97
+ id: `${constants_1.platformId}-${platforms_1.openbookPlatform.id}`,
98
+ networkId: portfolio_core_1.NetworkId.solana,
99
+ executor,
100
+ };
101
+ exports.default = fetcher;
102
+ //# sourceMappingURL=openbookFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openbookFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orders/clobs-solana/openbookFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAEpC,6CAA4C;AAG5C,4CAA0C;AAC1C,oDAAyD;AACzD,kDAAiE;AACjE,iEAAsE;AACtE,gFAAwD;AACxD,wGAAgF;AAChF,kDAAsD;AACtD,2CAA2C;AAC3C,uCAA8C;AAG9C,MAAM,QAAQ,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AAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FetcherExecutor } from '../../../Fetcher';
2
+ import { CLOBVersion } from './types';
3
+ export default function getSerumFetcherExecutor(serumVersion: CLOBVersion): FetcherExecutor;