@sonarwatch/portfolio-plugins 0.11.152 → 0.11.154

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/CHANGELOG.md +1331 -1323
  2. package/README.md +3 -3
  3. package/package.json +3 -3
  4. package/src/index.js +4 -0
  5. package/src/index.js.map +1 -1
  6. package/src/orphanPlatorms.js +9 -1
  7. package/src/orphanPlatorms.js.map +1 -1
  8. package/src/plugins/balancer/helpers/pools.js +21 -21
  9. package/src/plugins/phoenix/constants.d.ts +8 -0
  10. package/src/plugins/phoenix/constants.js +18 -0
  11. package/src/plugins/phoenix/constants.js.map +1 -0
  12. package/src/plugins/phoenix/helpers/deserializeMarketData.d.ts +5 -0
  13. package/src/plugins/phoenix/helpers/deserializeMarketData.js +213 -0
  14. package/src/plugins/phoenix/helpers/deserializeMarketData.js.map +1 -0
  15. package/src/plugins/phoenix/helpers/misc.d.ts +6 -0
  16. package/src/plugins/phoenix/helpers/misc.js +46 -0
  17. package/src/plugins/phoenix/helpers/misc.js.map +1 -0
  18. package/src/plugins/phoenix/index.d.ts +6 -0
  19. package/src/plugins/phoenix/index.js +12 -0
  20. package/src/plugins/phoenix/index.js.map +1 -0
  21. package/src/plugins/phoenix/positionsFetcher.d.ts +3 -0
  22. package/src/plugins/phoenix/positionsFetcher.js +118 -0
  23. package/src/plugins/phoenix/positionsFetcher.js.map +1 -0
  24. package/src/plugins/phoenix/structs/marketHeader.d.ts +40 -0
  25. package/src/plugins/phoenix/structs/marketHeader.js +39 -0
  26. package/src/plugins/phoenix/structs/marketHeader.js.map +1 -0
  27. package/src/plugins/phoenix/structs/misc.d.ts +47 -0
  28. package/src/plugins/phoenix/structs/misc.js +44 -0
  29. package/src/plugins/phoenix/structs/misc.js.map +1 -0
  30. package/src/plugins/phoenix/structs/seat.d.ts +11 -0
  31. package/src/plugins/phoenix/structs/seat.js +14 -0
  32. package/src/plugins/phoenix/structs/seat.js.map +1 -0
  33. package/src/plugins/phoenix/types.d.ts +45 -0
  34. package/src/plugins/phoenix/types.js +3 -0
  35. package/src/plugins/phoenix/types.js.map +1 -0
  36. package/src/plugins/sushiswap/helpers.js +24 -24
  37. package/src/plugins/uniswap-v2/helpers.js +22 -22
  38. package/src/utils/sei/constants.js +8 -8
  39. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  40. package/src/utils/solana/getParsedProgramAccounts.js +2 -2
  41. package/src/utils/solana/getParsedProgramAccounts.js.map +1 -1
  42. package/src/utils/solana/getProgramAccounts.d.ts +2 -0
  43. package/src/utils/solana/{getProgramAccountsSafe.js → getProgramAccounts.js} +5 -5
  44. package/src/utils/solana/getProgramAccounts.js.map +1 -0
  45. package/src/utils/solana/index.d.ts +1 -1
  46. package/src/utils/solana/index.js +1 -1
  47. package/src/utils/solana/index.js.map +1 -1
  48. package/src/utils/solana/getProgramAccountsSafe.d.ts +0 -2
  49. package/src/utils/solana/getProgramAccountsSafe.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.11.152",
3
+ "version": "0.11.154",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -23,7 +23,7 @@
23
23
  "@onsol/tldparser": "^0.6.1",
24
24
  "@sei-js/core": "^3.0.1",
25
25
  "@sei-js/proto": "^3.0.1",
26
- "@solana/web3.js": "^1.89.1",
26
+ "@solana/web3.js": "^1.91.2",
27
27
  "axios": "^1.4.0",
28
28
  "bignumber.js": "^9.1.1",
29
29
  "bitcoin-address-validation": "^2.2.1",
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.152"
44
+ "@sonarwatch/portfolio-core": "0.11.154"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
package/src/index.js CHANGED
@@ -96,6 +96,7 @@ const kai_1 = require("./plugins/kai");
96
96
  const suilend_1 = require("./plugins/suilend");
97
97
  const symmetry_1 = require("./plugins/symmetry");
98
98
  const staratlas_1 = require("./plugins/staratlas");
99
+ const phoenix_1 = require("./plugins/phoenix");
99
100
  var constants_1 = require("./plugins/tokens/constants");
100
101
  Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
101
102
  Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
@@ -185,6 +186,7 @@ exports.platforms = [
185
186
  ...suilend_1.platforms,
186
187
  ...symmetry_1.platforms,
187
188
  ...staratlas_1.platforms,
189
+ ...phoenix_1.platforms,
188
190
  ];
189
191
  // JOBS //
190
192
  exports.jobs = [
@@ -257,6 +259,7 @@ exports.jobs = [
257
259
  ...suilend_1.jobs,
258
260
  ...symmetry_1.jobs,
259
261
  ...staratlas_1.jobs,
262
+ ...phoenix_1.jobs,
260
263
  ];
261
264
  // FETCHERS //
262
265
  exports.fetchers = [
@@ -331,6 +334,7 @@ exports.fetchers = [
331
334
  ...suilend_1.fetchers,
332
335
  ...symmetry_1.fetchers,
333
336
  ...staratlas_1.fetchers,
337
+ ...phoenix_1.fetchers,
334
338
  ];
335
339
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
336
340
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB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kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,cAAe;IAClB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,kBAAe;IAClB,GAAG,qBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,kBAAe;IAClB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,sBAAmB;IACtB,GAAG,yBAAsB;IACzB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,yBAAkB;IACrB,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;CACrB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAI0B;AAC1B,6CAG0B;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AY;IACf,GAAG,kBAAe;IAClB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,sBAAmB;IACtB,GAAG,yBAAsB;IACzB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,yBAAkB;IACrB,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,kBAAe;CACnB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
@@ -66,12 +66,20 @@ const otphanPlatforms = [
66
66
  },
67
67
  {
68
68
  id: 'cloneprotocol',
69
- defiLlamaId: 'clone-protocol', // from https://defillama.com/docs/api
69
+ defiLlamaId: 'clone-protocol',
70
70
  name: 'Clone Protocol',
71
71
  image: 'https://sonar.watch/img/platforms/cloneprotocol.webp',
72
72
  website: 'https://clone.so/',
73
73
  twitter: 'https://twitter.com/CloneProtocol',
74
74
  },
75
+ {
76
+ id: 'sanctum',
77
+ defiLlamaId: 'parent#sanctum', // from https://defillama.com/docs/api
78
+ name: 'Sanctum',
79
+ image: 'https://sonar.watch/img/platforms/sanctum.webp',
80
+ website: 'https://www.sanctum.so/',
81
+ twitter: 'https://twitter.com/sanctumso',
82
+ },
75
83
  ];
76
84
  exports.default = otphanPlatforms;
77
85
  //# sourceMappingURL=orphanPlatorms.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"orphanPlatorms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/orphanPlatorms.ts"],"names":[],"mappings":";;AAEA,MAAM,eAAe,GAAe;IAClC;QACE,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,SAAS,EAAE,sCAAsC;QAC9D,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,+CAA+C;QACtD,OAAO,EAAE,8BAA8B;KACxC;IACD;QACE,EAAE,E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mB;QAC5B,OAAO,EAAE,mCAAmC;KAC7C;CACF,CAAC;AACF,kBAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"orphanPlatorms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/orphanPlatorms.ts"],"names":[],"mappings":";;AAEA,MAAM,eAAe,GAAe;IAClC;QACE,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,SAAS,EAAE,sCAAsC;QAC9D,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,+CAA+C;QACtD,OAAO,EAAE,8BAA8B;KACxC;IACD;QACE,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,6CAA6C;QACpD,OAAO,EAAE,gCAAgC;KAC1C;IACD;QACE,EAAE,EAAE,kBAAkB;QACtB,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,wDAAwD;QAC/D,OAAO,EAAE,kCAAkC;KAC5C;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,8CAA8C;QACrD,OAAO,EAAE,0BAA0B;KACpC;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,yDAAyD;QAChE,OAAO,EAAE,4DAA4D;KACtE;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,4CAA4C;QACnD,OAAO,EAAE,uBAAuB;KACjC;IACD;QACE,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,6CAA6C;QACpD,OAAO,EAAE,6BAA6B;KACvC;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,4CAA4C;QACnD,OAAO,EAAE,uBAAuB;KACjC;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,iDAAiD;QACxD,OAAO,EAAE,uBAAuB;KACjC;IACD;QACE,EAAE,EAAE,eAAe;QACnB,WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,sDAAsD;QAC7D,OAAO,EAAE,mBAAmB;QAC5B,OAAO,EAAE,mCAAmC;KAC7C;IACD;QACE,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,gBAAgB,EAAE,sCAAsC;QACrE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,gDAAgD;QACvD,OAAO,EAAE,yBAAyB;QAClC,OAAO,EAAE,+BAA+B;KACzC;CACF,CAAC;AACF,kBAAe,eAAe,CAAC"}
@@ -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,8 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { Platform } from '@sonarwatch/portfolio-core';
3
+ export declare const platformId = "phoenix";
4
+ export declare const platform: Platform;
5
+ export declare const marketsCachePrefix = "phoenix-markets";
6
+ export declare const phoenixPid: PublicKey;
7
+ export declare const phoenixSeatManagerPid: PublicKey;
8
+ export declare const marketAccountSize = 445536;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.marketAccountSize = exports.phoenixSeatManagerPid = exports.phoenixPid = exports.marketsCachePrefix = exports.platform = exports.platformId = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ exports.platformId = 'phoenix';
6
+ exports.platform = {
7
+ id: exports.platformId,
8
+ name: 'Phoenix',
9
+ image: 'https://sonar.watch/img/platforms/phoenix.webp',
10
+ website: 'https://www.phoenix.trade/',
11
+ twitter: 'https://twitter.com/PhoenixTrade',
12
+ defiLlamaId: 'phoenix', // from https://defillama.com/docs/api
13
+ };
14
+ exports.marketsCachePrefix = `${exports.platformId}-markets`;
15
+ exports.phoenixPid = new web3_js_1.PublicKey('PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY');
16
+ exports.phoenixSeatManagerPid = new web3_js_1.PublicKey('PSMxQbAoDWDbvd9ezQJgARyq6R9L5kJAasaLDVcZwf1');
17
+ exports.marketAccountSize = 445536;
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,kCAAkC;IAC3C,WAAW,EAAE,SAAS,EAAE,sCAAsC;CAC/D,CAAC;AACW,QAAA,kBAAkB,GAAG,GAAG,kBAAU,UAAU,CAAC;AAC7C,QAAA,UAAU,GAAG,IAAI,mBAAS,CACrC,6CAA6C,CAC9C,CAAC;AACW,QAAA,qBAAqB,GAAG,IAAI,mBAAS,CAChD,6CAA6C,CAC9C,CAAC;AACW,QAAA,iBAAiB,GAAG,MAAM,CAAC"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { TraderState } from '../structs/misc';
3
+ import { Market } from '../types';
4
+ export declare function deserializeMarketData(data: Buffer): Market;
5
+ export declare function getTraderState(data: Buffer, trader: string): TraderState | null;
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getTraderState = exports.deserializeMarketData = void 0;
7
+ const bn_js_1 = __importDefault(require("bn.js"));
8
+ const web3_js_1 = require("@solana/web3.js");
9
+ const misc_1 = require("../structs/misc");
10
+ const marketHeader_1 = require("../structs/marketHeader");
11
+ function getNodeIndices(data, keyDeserializer, valueDeserializer) {
12
+ const indexMap = new Map();
13
+ const treeNodes = deserializeRedBlackTreeNodes(data, keyDeserializer, valueDeserializer);
14
+ const nodes = treeNodes[0];
15
+ const freeNodes = treeNodes[1];
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
+ for (const [index, [key]] of nodes.entries()) {
18
+ if (!freeNodes.has(index)) {
19
+ indexMap.set(key, index + 1);
20
+ }
21
+ }
22
+ return indexMap;
23
+ }
24
+ function getUiOrderSequenceNumber(orderId) {
25
+ const twosComplement = toBN(orderId.orderSequenceNumber).fromTwos(64);
26
+ return twosComplement.isNeg()
27
+ ? twosComplement.neg().sub(new bn_js_1.default(1))
28
+ : twosComplement;
29
+ }
30
+ function toBN(n) {
31
+ if (typeof n === 'number') {
32
+ return new bn_js_1.default(n);
33
+ }
34
+ return new bn_js_1.default(n.toString());
35
+ }
36
+ function sign(n) {
37
+ if (n.lt(new bn_js_1.default(0))) {
38
+ return -1;
39
+ }
40
+ if (n.gt(new bn_js_1.default(0))) {
41
+ return 1;
42
+ }
43
+ return 0;
44
+ }
45
+ function deserializeRedBlackTree(data, keyDeserializer, valueDeserializer) {
46
+ const tree = new Map();
47
+ const treeNodes = deserializeRedBlackTreeNodes(data, keyDeserializer, valueDeserializer);
48
+ const nodes = treeNodes[0];
49
+ const freeNodes = treeNodes[1];
50
+ for (const [index, [key, value]] of nodes.entries()) {
51
+ if (!freeNodes.has(index)) {
52
+ tree.set(key, value);
53
+ }
54
+ }
55
+ return tree;
56
+ }
57
+ function deserializeRedBlackTreeNodes(data, keyDeserializer, valueDeserializer) {
58
+ let offset = 0;
59
+ const keySize = keyDeserializer.byteSize;
60
+ const valueSize = valueDeserializer.byteSize;
61
+ const nodes = new Array();
62
+ // Skip RBTree header
63
+ offset += 16;
64
+ // Skip node allocator size
65
+ offset += 8;
66
+ const bumpIndex = data.readInt32LE(offset);
67
+ offset += 4;
68
+ let freeListHead = data.readInt32LE(offset);
69
+ offset += 4;
70
+ const freeListPointers = new Array();
71
+ for (let index = 0; offset < data.length && index < bumpIndex - 1; index++) {
72
+ const registers = new Array();
73
+ for (let i = 0; i < 4; i++) {
74
+ registers.push(data.readInt32LE(offset)); // skip padding
75
+ offset += 4;
76
+ }
77
+ const [key] = keyDeserializer.deserialize(data.subarray(offset, offset + keySize));
78
+ offset += keySize;
79
+ const [value] = valueDeserializer.deserialize(data.subarray(offset, offset + valueSize));
80
+ offset += valueSize;
81
+ nodes.push([key, value]);
82
+ freeListPointers.push([index, registers[0]]);
83
+ }
84
+ const freeNodes = new Set();
85
+ let indexToRemove = freeListHead - 1;
86
+ let counter = 0;
87
+ // If there's an infinite loop here, that means that the state is corrupted
88
+ while (freeListHead < bumpIndex) {
89
+ // We need to subtract 1 because the node allocator is 1-indexed
90
+ const next = freeListPointers[freeListHead - 1];
91
+ [indexToRemove, freeListHead] = next;
92
+ freeNodes.add(indexToRemove);
93
+ counter += 1;
94
+ if (counter > bumpIndex) {
95
+ throw new Error('Infinite loop detected');
96
+ }
97
+ }
98
+ return [nodes, freeNodes];
99
+ }
100
+ function getValueFromRedBlackTreeNodes(data, key, valueDeserializer) {
101
+ const keySize = key.byteLength;
102
+ const valueSize = valueDeserializer.byteSize;
103
+ let offset = 24;
104
+ const bumpIndex = data.readInt32LE(offset);
105
+ offset += 8;
106
+ for (let index = 0; offset < data.length && index < bumpIndex - 1; index++) {
107
+ const registers = new Array();
108
+ for (let i = 0; i < 4; i++) {
109
+ registers.push(data.readInt32LE(offset)); // skip padding
110
+ offset += 4;
111
+ }
112
+ const cKey = data.subarray(offset, offset + keySize);
113
+ offset += keySize;
114
+ if (cKey.equals(key)) {
115
+ return valueDeserializer.deserialize(data.subarray(offset, offset + valueSize))[0];
116
+ }
117
+ offset += valueSize;
118
+ }
119
+ return null;
120
+ }
121
+ function deserializeMarketData(data) {
122
+ // Deserialize the market header
123
+ let offset = marketHeader_1.marketHeaderStruct.byteSize;
124
+ const [header] = marketHeader_1.marketHeaderStruct.deserialize(data.subarray(0, offset));
125
+ // Parse market data
126
+ const paddingLen = 8 * 32;
127
+ let remaining = data.subarray(offset + paddingLen);
128
+ offset = 0;
129
+ const baseLotsPerBaseUnit = Number(remaining.readBigUInt64LE(offset));
130
+ offset += 8;
131
+ const quoteLotsPerBaseUnitPerTick = Number(remaining.readBigUInt64LE(offset));
132
+ offset += 8;
133
+ const sequenceNumber = Number(remaining.readBigUInt64LE(offset));
134
+ offset += 8;
135
+ const takerFeeBps = Number(remaining.readBigUInt64LE(offset));
136
+ offset += 8;
137
+ const collectedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
138
+ offset += 8;
139
+ const unclaimedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
140
+ offset += 8;
141
+ remaining = remaining.subarray(offset);
142
+ // Parse bids, asks and traders
143
+ const numBids = header.marketSizeParams.bidsSize.toNumber();
144
+ const numAsks = header.marketSizeParams.asksSize.toNumber();
145
+ const numTraders = header.marketSizeParams.numSeats.toNumber();
146
+ const bidsSize = 16 + 16 + (16 + misc_1.orderIdBeet.byteSize + misc_1.restingOrderBeet.byteSize) * numBids;
147
+ const asksSize = 16 + 16 + (16 + misc_1.orderIdBeet.byteSize + misc_1.restingOrderBeet.byteSize) * numAsks;
148
+ const tradersSize = 16 + 16 + (16 + 32 + misc_1.traderStateBeet.byteSize) * numTraders;
149
+ offset = 0;
150
+ const bidBuffer = remaining.subarray(offset, offset + bidsSize);
151
+ offset += bidsSize;
152
+ const askBuffer = remaining.subarray(offset, offset + asksSize);
153
+ offset += asksSize;
154
+ const traderBuffer = remaining.subarray(offset, offset + tradersSize);
155
+ const bidsUnsorted = deserializeRedBlackTree(bidBuffer, misc_1.orderIdBeet, misc_1.restingOrderBeet);
156
+ const asksUnsorted = deserializeRedBlackTree(askBuffer, misc_1.orderIdBeet, misc_1.restingOrderBeet);
157
+ // Sort bids in descending order of price, and ascending order of sequence number
158
+ const bids = [...bidsUnsorted].sort((a, b) => {
159
+ const priceComparison = sign(toBN(b[0].priceInTicks).sub(toBN(a[0].priceInTicks)));
160
+ if (priceComparison !== 0) {
161
+ return priceComparison;
162
+ }
163
+ return sign(getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0])));
164
+ });
165
+ // Sort asks in ascending order of price, and ascending order of sequence number
166
+ const asks = [...asksUnsorted].sort((a, b) => {
167
+ const priceComparison = sign(toBN(a[0].priceInTicks).sub(toBN(b[0].priceInTicks)));
168
+ if (priceComparison !== 0) {
169
+ return priceComparison;
170
+ }
171
+ return sign(getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0])));
172
+ });
173
+ const traders = new Map();
174
+ for (const [k, traderState] of deserializeRedBlackTree(traderBuffer, misc_1.publicKeyBeet, misc_1.traderStateBeet)) {
175
+ traders.set(k.publicKey.toString(), traderState);
176
+ }
177
+ const traderPubkeyToTraderIndex = new Map();
178
+ const traderIndexToTraderPubkey = new Map();
179
+ for (const [k, index] of getNodeIndices(traderBuffer, misc_1.publicKeyBeet, misc_1.traderStateBeet)) {
180
+ traderPubkeyToTraderIndex.set(k.publicKey.toString(), index);
181
+ traderIndexToTraderPubkey.set(index, k.publicKey.toString());
182
+ }
183
+ return {
184
+ header,
185
+ baseLotsPerBaseUnit,
186
+ quoteLotsPerBaseUnitPerTick,
187
+ orderSequenceNumber: sequenceNumber,
188
+ takerFeeBps,
189
+ collectedQuoteLotFees,
190
+ unclaimedQuoteLotFees,
191
+ bids,
192
+ asks,
193
+ traders,
194
+ traderPubkeyToTraderIndex,
195
+ traderIndexToTraderPubkey,
196
+ };
197
+ }
198
+ exports.deserializeMarketData = deserializeMarketData;
199
+ function getTraderState(data, trader) {
200
+ // Deserialize the market header
201
+ const [partialHeader] = marketHeader_1.partialMarketHeaderStruct.deserialize(data);
202
+ const numBids = partialHeader.marketSizeParams.bidsSize.toNumber();
203
+ const numAsks = partialHeader.marketSizeParams.asksSize.toNumber();
204
+ const numTraders = partialHeader.marketSizeParams.numSeats.toNumber();
205
+ const bidsSize = 32 + (16 + misc_1.orderIdBeet.byteSize + misc_1.restingOrderBeet.byteSize) * numBids;
206
+ const asksSize = 32 + (16 + misc_1.orderIdBeet.byteSize + misc_1.restingOrderBeet.byteSize) * numAsks;
207
+ const tradersSize = 32 + (48 + misc_1.traderStateBeet.byteSize) * numTraders;
208
+ const offset = marketHeader_1.marketHeaderStruct.byteSize + 304 + bidsSize + asksSize;
209
+ const traderBuffer = data.subarray(offset, offset + tradersSize);
210
+ return getValueFromRedBlackTreeNodes(traderBuffer, new web3_js_1.PublicKey(trader).toBuffer(), misc_1.traderStateBeet);
211
+ }
212
+ exports.getTraderState = getTraderState;
213
+ //# sourceMappingURL=deserializeMarketData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deserializeMarketData.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/phoenix/helpers/deserializeMarketData.ts"],"names":[],"mappings":";;;;;;AACA,kDAAuB;AAEvB,6CAA4C;AAC5C,0CAOyB;AACzB,0DAGiC;AAGjC,SAAS,cAAc,CACrB,IAAY,EACZ,eAAoC,EACpC,iBAAwC;IAExC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;IACxC,MAAM,SAAS,GAAG,4BAA4B,CAC5C,IAAI,EACJ,eAAe,EACf,iBAAiB,CAClB,CAAC;IAEF,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAE/B,6DAA6D;IAC7D,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAgB;IAChD,MAAM,cAAc,GAAI,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC9E,OAAO,cAAc,CAAC,KAAK,EAAE;QAC3B,CAAC,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,eAAE,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,cAAc,CAAC;AACrB,CAAC;AAED,SAAS,IAAI,CAAC,CAA8B;IAC1C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,IAAI,eAAE,CAAC,CAAC,CAAC,CAA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AAM,CAAC,aAAa,CAAC,GAAG,wCAAyB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,aAAa,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACnE,MAAM,OAAO,GAAG,aAAa,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACnE,MAAM,UAAU,GAAG,aAAa,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACtE,MAAM,QAAQ,GACZ,EAAE,GAAG,CAAC,EAAE,GAAG,kBAAW,CAAC,QAAQ,GAAG,uBAAgB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;IACzE,MAAM,QAAQ,GACZ,EAAE,GAAG,CAAC,EAAE,GAAG,kBAAW,CAAC,QAAQ,GAAG,uBAAgB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;IACzE,MAAM,WAAW,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,sBAAe,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;IACtE,MAAM,MAAM,GAAG,iCAAkB,CAAC,QAAQ,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvE,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;IAEjE,OAAO,6BAA6B,CAClC,YAAY,EACZ,IAAI,mBAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAChC,sBAAe,CAChB,CAAC;AACJ,CAAC;AAtBD,wCAsBC"}
@@ -0,0 +1,6 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import { MarketHeader } from '../types';
3
+ import { MarketHeaderAccount } from '../structs/marketHeader';
4
+ export declare function marketHeaderAccountToMarketHeader(marketHeaderAccount: MarketHeaderAccount): MarketHeader;
5
+ export declare function getSeatManagerAddress(market: PublicKey): PublicKey;
6
+ export declare function getSeatAddress(market: PublicKey, trader: PublicKey): PublicKey;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSeatAddress = exports.getSeatManagerAddress = exports.marketHeaderAccountToMarketHeader = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ const constants_1 = require("../constants");
6
+ function marketHeaderAccountToMarketHeader(marketHeaderAccount) {
7
+ return {
8
+ discriminant: marketHeaderAccount.discriminant.toString(),
9
+ status: marketHeaderAccount.status.toString(),
10
+ marketSizeParams: {
11
+ bidsSize: marketHeaderAccount.marketSizeParams.bidsSize.toString(),
12
+ asksSize: marketHeaderAccount.marketSizeParams.asksSize.toString(),
13
+ numSeats: marketHeaderAccount.marketSizeParams.numSeats.toString(),
14
+ },
15
+ baseParams: {
16
+ decimals: marketHeaderAccount.baseParams.decimals,
17
+ vaultBump: marketHeaderAccount.baseParams.vaultBump,
18
+ mintKey: marketHeaderAccount.baseParams.mintKey.toString(),
19
+ vaultKey: marketHeaderAccount.baseParams.vaultKey.toString(),
20
+ },
21
+ baseLotSize: marketHeaderAccount.baseLotSize.toString(),
22
+ quoteParams: {
23
+ decimals: marketHeaderAccount.quoteParams.decimals,
24
+ vaultBump: marketHeaderAccount.quoteParams.vaultBump,
25
+ mintKey: marketHeaderAccount.quoteParams.mintKey.toString(),
26
+ vaultKey: marketHeaderAccount.quoteParams.vaultKey.toString(),
27
+ },
28
+ quoteLotSize: marketHeaderAccount.quoteLotSize.toString(),
29
+ tickSizeInQuoteAtomsPerBaseUnit: marketHeaderAccount.tickSizeInQuoteAtomsPerBaseUnit.toString(),
30
+ authority: marketHeaderAccount.authority.toString(),
31
+ feeRecipient: marketHeaderAccount.feeRecipient.toString(),
32
+ marketSequenceNumber: marketHeaderAccount.marketSequenceNumber.toString(),
33
+ successor: marketHeaderAccount.successor.toString(),
34
+ rawBaseUnitsPerBaseUnit: marketHeaderAccount.rawBaseUnitsPerBaseUnit,
35
+ };
36
+ }
37
+ exports.marketHeaderAccountToMarketHeader = marketHeaderAccountToMarketHeader;
38
+ function getSeatManagerAddress(market) {
39
+ return web3_js_1.PublicKey.findProgramAddressSync([market.toBuffer()], constants_1.phoenixSeatManagerPid)[0];
40
+ }
41
+ exports.getSeatManagerAddress = getSeatManagerAddress;
42
+ function getSeatAddress(market, trader) {
43
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('seat'), market.toBuffer(), trader.toBuffer()], constants_1.phoenixPid)[0];
44
+ }
45
+ exports.getSeatAddress = getSeatAddress;
46
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/phoenix/helpers/misc.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG5C,4CAAiE;AAEjE,SAAgB,iCAAiC,CAC/C,mBAAwC;IAExC,OAAO;QACL,YAAY,EAAE,mBAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE;QACzD,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC7C,gBAAgB,EAAE;YAChB,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClE,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClE,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;SACnE;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,QAAQ;YACjD,SAAS,EAAE,mBAAmB,CAAC,UAAU,CAAC,SAAS;YACnD,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC1D,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;SAC7D;QACD,WAAW,EAAE,mBAAmB,CAAC,WAAW,CAA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etcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ export declare const platforms: Platform[];
5
+ export declare const jobs: Job[];
6
+ export declare const fetchers: Fetcher[];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchers = exports.jobs = exports.platforms = void 0;
7
+ const constants_1 = require("./constants");
8
+ const positionsFetcher_1 = __importDefault(require("./positionsFetcher"));
9
+ exports.platforms = [constants_1.platform];
10
+ exports.jobs = [];
11
+ exports.fetchers = [positionsFetcher_1.default];
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0EAAkD;AAErC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,0BAAgB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;