@sonarwatch/portfolio-plugins 0.11.148 → 0.11.150

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/CHANGELOG.md +1327 -1319
  2. package/README.md +3 -3
  3. package/package.json +2 -2
  4. package/src/index.js +0 -4
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/flexlend/depositsFetcher.js +63 -4
  8. package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
  9. package/src/plugins/flexlend/struct.d.ts +18 -0
  10. package/src/plugins/flexlend/struct.js +18 -0
  11. package/src/plugins/flexlend/struct.js.map +1 -0
  12. package/src/plugins/hawksight/positionsFetcher.js +31 -13
  13. package/src/plugins/hawksight/positionsFetcher.js.map +1 -1
  14. package/src/plugins/orca/getWhirlpoolPositions.d.ts +2 -3
  15. package/src/plugins/orca/getWhirlpoolPositions.js +2 -14
  16. package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
  17. package/src/plugins/orca/helpers.d.ts +2 -2
  18. package/src/plugins/orca/helpers.js +1 -1
  19. package/src/plugins/orca/helpers.js.map +1 -1
  20. package/src/plugins/raydium/getRaydiumCLMMPositions.d.ts +2 -3
  21. package/src/plugins/raydium/getRaydiumCLMMPositions.js +3 -3
  22. package/src/plugins/raydium/getRaydiumCLMMPositions.js.map +1 -1
  23. package/src/plugins/raydium/helpers.d.ts +2 -2
  24. package/src/plugins/raydium/helpers.js +6 -1
  25. package/src/plugins/raydium/helpers.js.map +1 -1
  26. package/src/plugins/realms/constants.d.ts +4 -2
  27. package/src/plugins/realms/constants.js +10 -3
  28. package/src/plugins/realms/constants.js.map +1 -1
  29. package/src/plugins/realms/helpers.d.ts +4 -5
  30. package/src/plugins/realms/helpers.js +20 -28
  31. package/src/plugins/realms/helpers.js.map +1 -1
  32. package/src/plugins/realms/index.js +5 -5
  33. package/src/plugins/realms/index.js.map +1 -1
  34. package/src/plugins/realms/{depositsFetcher.js → realmsDepositsFetcher.js} +1 -1
  35. package/src/plugins/realms/realmsDepositsFetcher.js.map +1 -0
  36. package/src/plugins/realms/{programsJob.js → realmsProgramsJob.js} +4 -4
  37. package/src/plugins/realms/realmsProgramsJob.js.map +1 -0
  38. package/src/plugins/realms/types.d.ts +1 -1
  39. package/src/plugins/solend/constants.d.ts +1 -0
  40. package/src/plugins/solend/constants.js +2 -1
  41. package/src/plugins/solend/constants.js.map +1 -1
  42. package/src/plugins/solend/helpers.d.ts +6 -0
  43. package/src/plugins/solend/helpers.js +132 -1
  44. package/src/plugins/solend/helpers.js.map +1 -1
  45. package/src/plugins/solend/marketsJob.js +6 -0
  46. package/src/plugins/solend/marketsJob.js.map +1 -1
  47. package/src/plugins/solend/obligationsFetcher.js +27 -156
  48. package/src/plugins/solend/obligationsFetcher.js.map +1 -1
  49. package/src/plugins/solend/reservesJob.js +15 -6
  50. package/src/plugins/solend/reservesJob.js.map +1 -1
  51. package/src/plugins/solend/types.d.ts +1 -1
  52. package/src/plugins/suilend/obligationsFetcher.js +2 -0
  53. package/src/plugins/suilend/obligationsFetcher.js.map +1 -1
  54. package/src/plugins/sushiswap/helpers.js +24 -24
  55. package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js +25 -14
  56. package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js.map +1 -1
  57. package/src/plugins/tokens/fetchers/solana.js +3 -1
  58. package/src/plugins/tokens/fetchers/solana.js.map +1 -1
  59. package/src/plugins/uniswap-v2/helpers.js +22 -22
  60. package/src/utils/sei/constants.js +8 -8
  61. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  62. package/src/utils/solana/das/getAssetsByOwnerDas.d.ts +2 -2
  63. package/src/utils/solana/das/getAssetsByOwnerDas.js +3 -9
  64. package/src/utils/solana/das/getAssetsByOwnerDas.js.map +1 -1
  65. package/src/utils/solana/das/getDisplayOptions.d.ts +2 -0
  66. package/src/utils/solana/das/getDisplayOptions.js +16 -0
  67. package/src/utils/solana/das/getDisplayOptions.js.map +1 -0
  68. package/src/utils/solana/das/types.d.ts +8 -0
  69. package/src/plugins/phoenix/constants.d.ts +0 -7
  70. package/src/plugins/phoenix/constants.js +0 -17
  71. package/src/plugins/phoenix/constants.js.map +0 -1
  72. package/src/plugins/phoenix/helpers.d.ts +0 -6
  73. package/src/plugins/phoenix/helpers.js +0 -46
  74. package/src/plugins/phoenix/helpers.js.map +0 -1
  75. package/src/plugins/phoenix/helpers2.d.ts +0 -0
  76. package/src/plugins/phoenix/helpers2.js +0 -179
  77. package/src/plugins/phoenix/helpers2.js.map +0 -1
  78. package/src/plugins/phoenix/index.d.ts +0 -6
  79. package/src/plugins/phoenix/index.js +0 -10
  80. package/src/plugins/phoenix/index.js.map +0 -1
  81. package/src/plugins/phoenix/marketsJob.js +0 -39
  82. package/src/plugins/phoenix/marketsJob.js.map +0 -1
  83. package/src/plugins/phoenix/positionsFetcher.js +0 -64
  84. package/src/plugins/phoenix/positionsFetcher.js.map +0 -1
  85. package/src/plugins/phoenix/structs.d.ts +0 -67
  86. package/src/plugins/phoenix/structs.js +0 -82
  87. package/src/plugins/phoenix/structs.js.map +0 -1
  88. package/src/plugins/phoenix/types.d.ts +0 -29
  89. package/src/plugins/phoenix/types.js +0 -3
  90. package/src/plugins/phoenix/types.js.map +0 -1
  91. package/src/plugins/realms/depositsFetcher.d.ts +0 -3
  92. package/src/plugins/realms/depositsFetcher.js.map +0 -1
  93. package/src/plugins/realms/programsJob.d.ts +0 -3
  94. package/src/plugins/realms/programsJob.js.map +0 -1
  95. /package/src/plugins/{phoenix/positionsFetcher.d.ts → realms/realmsDepositsFetcher.d.ts} +0 -0
  96. /package/src/plugins/{phoenix/marketsJob.d.ts → realms/realmsProgramsJob.d.ts} +0 -0
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
4
- exports.infoQueryMsg = JSON.parse(`{
5
- "info": {}
4
+ exports.infoQueryMsg = JSON.parse(`{
5
+ "info": {}
6
6
  }`);
7
- exports.tokenInfoQueryMsg = JSON.parse(`{
8
- "token_info": {}
7
+ exports.tokenInfoQueryMsg = JSON.parse(`{
8
+ "token_info": {}
9
9
  }`);
10
- exports.minterQueryMsg = JSON.parse(`{
11
- "minter": {}
10
+ exports.minterQueryMsg = JSON.parse(`{
11
+ "minter": {}
12
12
  }`);
13
- exports.poolQueryMsg = JSON.parse(`{
14
- "pool": {}
13
+ exports.poolQueryMsg = JSON.parse(`{
14
+ "pool": {}
15
15
  }`);
16
16
  //# sourceMappingURL=constants.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function getQueryBalanceByOwner(owner) {
4
- return JSON.parse(`{
5
- "balance": {
6
- "address": "${owner}"
7
- }
4
+ return JSON.parse(`{
5
+ "balance": {
6
+ "address": "${owner}"
7
+ }
8
8
  }`);
9
9
  }
10
10
  exports.default = getQueryBalanceByOwner;
@@ -1,3 +1,3 @@
1
1
  import { RpcEndpoint } from '@sonarwatch/portfolio-core';
2
- import { HeliusAsset } from './types';
3
- export declare function getAssetsByOwnerDas(dasEndpoint: RpcEndpoint, owner: string): Promise<HeliusAsset[]>;
2
+ import { DisplayOptions, HeliusAsset } from './types';
3
+ export declare function getAssetsByOwnerDas(dasEndpoint: RpcEndpoint, owner: string, displayOptions?: DisplayOptions): Promise<HeliusAsset[]>;
@@ -15,9 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getAssetsByOwnerDas = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  const getBasicAuthHeaders_1 = require("../../misc/getBasicAuthHeaders");
18
+ const getDisplayOptions_1 = require("./getDisplayOptions");
18
19
  const limit = 1000;
19
20
  const maxPage = 10;
20
- function getAssetsByOwnerDas(dasEndpoint, owner) {
21
+ function getAssetsByOwnerDas(dasEndpoint, owner, displayOptions) {
21
22
  return __awaiter(this, void 0, void 0, function* () {
22
23
  const httpHeaders = dasEndpoint.basicAuth
23
24
  ? (0, getBasicAuthHeaders_1.getBasicAuthHeaders)(dasEndpoint.basicAuth.username, dasEndpoint.basicAuth.password)
@@ -38,14 +39,7 @@ function getAssetsByOwnerDas(dasEndpoint, owner) {
38
39
  sortBy: 'id',
39
40
  sortDirection: 'asc',
40
41
  },
41
- displayOptions: {
42
- showNativeBalance: false,
43
- showFungible: true,
44
- showInscription: true,
45
- showUnverifiedCollections: true,
46
- showCollectionMetadata: true,
47
- showGrandTotal: true,
48
- },
42
+ displayOptions: (0, getDisplayOptions_1.getDisplayOptions)(displayOptions),
49
43
  },
50
44
  }, {
51
45
  headers: Object.assign({ 'Content-Type': 'application/json' }, httpHeaders),
@@ -1 +1 @@
1
- {"version":3,"file":"getAssetsByOwnerDas.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/getAssetsByOwnerDas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA6C;AAE7C,wEAAqE;AAErE,MAAM,KAAK,GAAG,IAAI,CAAC;AACnB,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,SAAsB,mBAAmB,CACvC,WAAwB,EACxB,KAAa;;QAEb,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS;YACvC,CAAC,CAAC,IAAA,yCAAmB,EACjB,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9B,WAAW,CAAC,SAAS,CAAC,QAAQ,CAC/B;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,KAAK,GAAkB,EAAE,CAAC;QAChC,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,OAAO,IAAI,GAAG,OAAO,EAAE,CAAC;YACtB,IAAI,IAAI,CAAC,CAAC;YACV,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,IAAI,CAK1B,WAAW,CAAC,GAAG,EACf;gBACE,OAAO,EAAE,KAAK;gBACd,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;gBAC5B,MAAM,EAAE,kBAAkB;gBAC1B,MAAM,EAAE;oBACN,YAAY,EAAE,KAAK;oBACnB,IAAI;oBACJ,KAAK;oBACL,MAAM,EAAE;wBACN,MAAM,EAAE,IAAI;wBACZ,aAAa,EAAE,KAAK;qBACrB;oBACD,cAAc,EAAE;wBACd,iBAAiB,EAAE,KAAK;wBACxB,YAAY,EAAE,IAAI;wBAClB,eAAe,EAAE,IAAI;wBACrB,yBAAyB,EAAE,IAAI;wBAC/B,sBAAsB,EAAE,IAAI;wBAC5B,cAAc,EAAE,IAAI;qBACrB;iBACF;aACF,EACD;gBACE,OAAO,kBACL,cAAc,EAAE,kBAAkB,IAC/B,WAAW,CACf;aACF,CACF,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK;gBAAE,MAAM;QAC7C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAtDD,kDAsDC"}
1
+ {"version":3,"file":"getAssetsByOwnerDas.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/getAssetsByOwnerDas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA6C;AAE7C,wEAAqE;AACrE,2DAAwD;AAExD,MAAM,KAAK,GAAG,IAAI,CAAC;AACnB,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,SAAsB,mBAAmB,CACvC,WAAwB,EACxB,KAAa,EACb,cAA+B;;QAE/B,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS;YACvC,CAAC,CAAC,IAAA,yCAAmB,EACjB,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9B,WAAW,CAAC,SAAS,CAAC,QAAQ,CAC/B;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,KAAK,GAAkB,EAAE,CAAC;QAChC,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,OAAO,IAAI,GAAG,OAAO,EAAE,CAAC;YACtB,IAAI,IAAI,CAAC,CAAC;YACV,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,IAAI,CAK1B,WAAW,CAAC,GAAG,EACf;gBACE,OAAO,EAAE,KAAK;gBACd,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;gBAC5B,MAAM,EAAE,kBAAkB;gBAC1B,MAAM,EAAE;oBACN,YAAY,EAAE,KAAK;oBACnB,IAAI;oBACJ,KAAK;oBACL,MAAM,EAAE;wBACN,MAAM,EAAE,IAAI;wBACZ,aAAa,EAAE,KAAK;qBACrB;oBACD,cAAc,EAAE,IAAA,qCAAiB,EAAC,cAAc,CAAC;iBAClD;aACF,EACD;gBACE,OAAO,kBACL,cAAc,EAAE,kBAAkB,IAC/B,WAAW,CACf;aACF,CACF,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK;gBAAE,MAAM;QAC7C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAhDD,kDAgDC"}
@@ -0,0 +1,2 @@
1
+ import { DisplayOptions } from './types';
2
+ export declare function getDisplayOptions(displayOptions?: DisplayOptions): Required<DisplayOptions>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDisplayOptions = void 0;
4
+ function getDisplayOptions(displayOptions) {
5
+ var _a, _b, _c, _d, _e, _f;
6
+ return {
7
+ showCollectionMetadata: (_a = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showCollectionMetadata) !== null && _a !== void 0 ? _a : true,
8
+ showFungible: (_b = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showFungible) !== null && _b !== void 0 ? _b : true,
9
+ showGrandTotal: (_c = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showGrandTotal) !== null && _c !== void 0 ? _c : true,
10
+ showInscription: (_d = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showInscription) !== null && _d !== void 0 ? _d : true,
11
+ showNativeBalance: (_e = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showNativeBalance) !== null && _e !== void 0 ? _e : true,
12
+ showUnverifiedCollections: (_f = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showUnverifiedCollections) !== null && _f !== void 0 ? _f : true,
13
+ };
14
+ }
15
+ exports.getDisplayOptions = getDisplayOptions;
16
+ //# sourceMappingURL=getDisplayOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDisplayOptions.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/getDisplayOptions.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAC/B,cAA+B;;IAE/B,OAAO;QACL,sBAAsB,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,sBAAsB,mCAAI,IAAI;QACtE,YAAY,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,YAAY,mCAAI,IAAI;QAClD,cAAc,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,cAAc,mCAAI,IAAI;QACtD,eAAe,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,eAAe,mCAAI,IAAI;QACxD,iBAAiB,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,iBAAiB,mCAAI,IAAI;QAC5D,yBAAyB,EACvB,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,yBAAyB,mCAAI,IAAI;KACpD,CAAC;AACJ,CAAC;AAZD,8CAYC"}
@@ -1,3 +1,11 @@
1
+ export type DisplayOptions = {
2
+ showNativeBalance?: boolean;
3
+ showFungible?: boolean;
4
+ showInscription?: boolean;
5
+ showUnverifiedCollections?: boolean;
6
+ showCollectionMetadata?: boolean;
7
+ showGrandTotal?: boolean;
8
+ };
1
9
  export type GetAssetsByOwnerOutput = {
2
10
  jsonrpc: string;
3
11
  result: HeliusAssetList;
@@ -1,7 +0,0 @@
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;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- 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
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
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"}
@@ -1,6 +0,0 @@
1
- import { PublicKey } from '@solana/web3.js';
2
- import { MarketHeaderAccount } from './structs';
3
- import { MarketHeader } from './types';
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;
@@ -1,46 +0,0 @@
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=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG5C,2CAAgE;AAEhE,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,CAAC,QAAQ,EAAE;QACvD,WAAW,EAAE;YACX,QAAQ,EAAE,mBAAmB,CAAC,WAAW,CAAC,QAAQ;YAClD,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,SAAS;YACpD,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC3D,QAAQ,EAAE,mBAAmB,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE;SAC9D;QACD,YAAY,EAAE,mBAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE;QACzD,+BAA+B,EAC7B,mBAAmB,CAAC,+BAA+B,CAAC,QAAQ,EAAE;QAChE,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC,QAAQ,EAAE;QACnD,YAAY,EAAE,mBAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE;QACzD,oBAAoB,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,QAAQ,EAAE;QACzE,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC,QAAQ,EAAE;QACnD,uBAAuB,EAAE,mBAAmB,CAAC,uBAAuB;KACrE,CAAC;AACJ,CAAC;AAjCD,8EAiCC;AAED,SAAgB,qBAAqB,CAAC,MAAiB;IACrD,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EACnB,iCAAqB,CACtB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AALD,sDAKC;AAED,SAAgB,cAAc,CAC5B,MAAiB,EACjB,MAAiB;IAEjB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,EAC3D,sBAAU,CACX,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AARD,wCAQC"}
File without changes
@@ -1,179 +0,0 @@
1
- "use strict";
2
- // import { BeetArgsStruct } from '@metaplex-foundation/beet';
3
- // import { TraderState, marketHeaderStruct, orderIdBeet } from './structs';
4
- // export function deserializeRedBlackTree<Key, Value>(
5
- // data: Buffer,
6
- // keyDeserializer: BeetArgsStruct<Key>,
7
- // valueDeserializer: BeetArgsStruct<Value>
8
- // ): Map<Key, Value> {
9
- // const tree = new Map<Key, Value>();
10
- // const treeNodes = deserializeRedBlackTreeNodes(
11
- // data,
12
- // keyDeserializer,
13
- // valueDeserializer
14
- // );
15
- // const nodes = treeNodes[0];
16
- // const freeNodes = treeNodes[1];
17
- // for (const [index, [key, value]] of nodes.entries()) {
18
- // if (!freeNodes.has(index)) {
19
- // tree.set(key, value);
20
- // }
21
- // }
22
- // return tree;
23
- // }
24
- // function deserializeRedBlackTreeNodes<Key, Value>(
25
- // data: Buffer,
26
- // keyDeserializer: BeetArgsStruct<Key>,
27
- // valueDeserializer: BeetArgsStruct<Value>
28
- // ): [Array<[Key, Value]>, Set<number>] {
29
- // let offset = 0;
30
- // const keySize = keyDeserializer.byteSize;
31
- // const valueSize = valueDeserializer.byteSize;
32
- // const nodes = new Array<[Key, Value]>();
33
- // // Skip RBTree header
34
- // offset += 16;
35
- // // Skip node allocator size
36
- // offset += 8;
37
- // const bumpIndex = data.readInt32LE(offset);
38
- // offset += 4;
39
- // let freeListHead = data.readInt32LE(offset);
40
- // offset += 4;
41
- // const freeListPointers = new Array<[number, number]>();
42
- // for (let index = 0; offset < data.length && index < bumpIndex - 1; index++) {
43
- // const registers = new Array<number>();
44
- // for (let i = 0; i < 4; i++) {
45
- // registers.push(data.readInt32LE(offset)); // skip padding
46
- // offset += 4;
47
- // }
48
- // const [key] = keyDeserializer.deserialize(
49
- // data.subarray(offset, offset + keySize)
50
- // );
51
- // offset += keySize;
52
- // const [value] = valueDeserializer.deserialize(
53
- // data.subarray(offset, offset + valueSize)
54
- // );
55
- // offset += valueSize;
56
- // nodes.push([key, value]);
57
- // freeListPointers.push([index, registers[0]]);
58
- // }
59
- // const freeNodes = new Set<number>();
60
- // let indexToRemove = freeListHead - 1;
61
- // let counter = 0;
62
- // // If there's an infinite loop here, that means that the state is corrupted
63
- // while (freeListHead < bumpIndex) {
64
- // // We need to subtract 1 because the node allocator is 1-indexed
65
- // const next = freeListPointers[freeListHead - 1];
66
- // [indexToRemove, freeListHead] = next;
67
- // freeNodes.add(indexToRemove);
68
- // counter += 1;
69
- // if (counter > bumpIndex) {
70
- // throw new Error('Infinite loop detected');
71
- // }
72
- // }
73
- // return [nodes, freeNodes];
74
- // }
75
- // export function deserializeMarketData(data: Buffer) {
76
- // // Deserialize the market header
77
- // let offset = marketHeaderStruct.byteSize;
78
- // const [header] = marketHeaderStruct.deserialize(data.subarray(0, offset));
79
- // // Parse market data
80
- // const paddingLen = 8 * 32;
81
- // let remaining = data.subarray(offset + paddingLen);
82
- // offset = 0;
83
- // const baseLotsPerBaseUnit = Number(remaining.readBigUInt64LE(offset));
84
- // offset += 8;
85
- // const quoteLotsPerBaseUnitPerTick = Number(remaining.readBigUInt64LE(offset));
86
- // offset += 8;
87
- // const sequenceNumber = Number(remaining.readBigUInt64LE(offset));
88
- // offset += 8;
89
- // const takerFeeBps = Number(remaining.readBigUInt64LE(offset));
90
- // offset += 8;
91
- // const collectedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
92
- // offset += 8;
93
- // const unclaimedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
94
- // offset += 8;
95
- // remaining = remaining.subarray(offset);
96
- // // Parse bids, asks and traders
97
- // const numBids = header.marketSizeParams.bidsSize.toNumber();
98
- // const numAsks = header.marketSizeParams.asksSize.toNumber();
99
- // const numTraders = header.marketSizeParams.numSeats.toNumber();
100
- // const bidsSize =
101
- // 16 + 16 + (16 + orderIdBeet.byteSize + restingOrderBeet.byteSize) * numBids;
102
- // const asksSize =
103
- // 16 + 16 + (16 + orderIdBeet.byteSize + restingOrderBeet.byteSize) * numAsks;
104
- // const tradersSize =
105
- // 16 + 16 + (16 + 32 + traderStateBeet.byteSize) * numTraders;
106
- // offset = 0;
107
- // const bidBuffer = remaining.subarray(offset, offset + bidsSize);
108
- // offset += bidsSize;
109
- // const askBuffer = remaining.subarray(offset, offset + asksSize);
110
- // offset += asksSize;
111
- // const traderBuffer = remaining.subarray(offset, offset + tradersSize);
112
- // const bidsUnsorted = deserializeRedBlackTree(
113
- // bidBuffer,
114
- // orderIdBeet,
115
- // restingOrderBeet
116
- // );
117
- // const asksUnsorted = deserializeRedBlackTree(
118
- // askBuffer,
119
- // orderIdBeet,
120
- // restingOrderBeet
121
- // );
122
- // // Sort bids in descending order of price, and ascending order of sequence number
123
- // const bids = [...bidsUnsorted].sort((a, b) => {
124
- // const priceComparison = sign(
125
- // toBN(b[0].priceInTicks).sub(toBN(a[0].priceInTicks))
126
- // );
127
- // if (priceComparison !== 0) {
128
- // return priceComparison;
129
- // }
130
- // return sign(
131
- // getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0]))
132
- // );
133
- // });
134
- // // Sort asks in ascending order of price, and ascending order of sequence number
135
- // const asks = [...asksUnsorted].sort((a, b) => {
136
- // const priceComparison = sign(
137
- // toBN(a[0].priceInTicks).sub(toBN(b[0].priceInTicks))
138
- // );
139
- // if (priceComparison !== 0) {
140
- // return priceComparison;
141
- // }
142
- // return sign(
143
- // getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0]))
144
- // );
145
- // });
146
- // const traders = new Map<string, TraderState>();
147
- // for (const [k, traderState] of deserializeRedBlackTree(
148
- // traderBuffer,
149
- // publicKeyBeet,
150
- // traderStateBeet
151
- // )) {
152
- // traders.set(k.publicKey.toString(), traderState);
153
- // }
154
- // const traderPubkeyToTraderIndex = new Map<string, number>();
155
- // const traderIndexToTraderPubkey = new Map<number, string>();
156
- // for (const [k, index] of getNodeIndices(
157
- // traderBuffer,
158
- // publicKeyBeet,
159
- // traderStateBeet
160
- // )) {
161
- // traderPubkeyToTraderIndex.set(k.publicKey.toString(), index);
162
- // traderIndexToTraderPubkey.set(index, k.publicKey.toString());
163
- // }
164
- // return {
165
- // header,
166
- // baseLotsPerBaseUnit,
167
- // quoteLotsPerBaseUnitPerTick,
168
- // orderSequenceNumber: sequenceNumber,
169
- // takerFeeBps,
170
- // collectedQuoteLotFees,
171
- // unclaimedQuoteLotFees,
172
- // bids,
173
- // asks,
174
- // traders,
175
- // traderPubkeyToTraderIndex,
176
- // traderIndexToTraderPubkey,
177
- // };
178
- // }
179
- //# sourceMappingURL=helpers2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers2.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/helpers2.ts"],"names":[],"mappings":"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"}
@@ -1,6 +0,0 @@
1
- import { Platform } from '@sonarwatch/portfolio-core';
2
- import { Fetcher } 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[];
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchers = exports.jobs = exports.platforms = void 0;
4
- // export const platforms: Platform[] = [platform];
5
- // export const jobs: Job[] = [marketsJob];
6
- // export const fetchers: Fetcher[] = [positionsFetcher];
7
- exports.platforms = [];
8
- exports.jobs = [];
9
- exports.fetchers = [];
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/index.ts"],"names":[],"mappings":";;;AAOA,mDAAmD;AACnD,2CAA2C;AAC3C,yDAAyD;AAE5C,QAAA,SAAS,GAAe,EAAE,CAAC;AAC3B,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
@@ -1,39 +0,0 @@
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 constants_1 = require("./constants");
14
- const structs_1 = require("./structs");
15
- const solana_1 = require("../../utils/solana");
16
- const helpers_1 = require("./helpers");
17
- const clients_1 = require("../../utils/clients");
18
- const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
19
- const connection = (0, clients_1.getClientSolana)();
20
- const marketsHeadersAccounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.marketHeaderStruct, constants_1.phoenixPid, [
21
- {
22
- dataSize: 445536,
23
- },
24
- ]);
25
- yield cache.setItems(marketsHeadersAccounts.map((mha) => ({
26
- key: mha.pubkey.toString(),
27
- value: (0, helpers_1.marketHeaderAccountToMarketHeader)(mha),
28
- })), {
29
- prefix: constants_1.marketsCachePrefix,
30
- networkId: portfolio_core_1.NetworkId.solana,
31
- });
32
- });
33
- const job = {
34
- id: `${constants_1.platformId}-markets`,
35
- executor,
36
- label: 'normal',
37
- };
38
- exports.default = job;
39
- //# sourceMappingURL=marketsJob.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAAyE;AACzE,uCAA+C;AAC/C,+CAA8D;AAC9D,uCAA8D;AAC9D,iDAAsD;AAEtD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,sBAAsB,GAAG,MAAM,IAAA,iCAAwB,EAC3D,UAAU,EACV,4BAAkB,EAClB,sBAAU,EACV;QACE;YACE,QAAQ,EAAE,MAAM;SACjB;KACF,CACF,CAAC;IAEF,MAAM,KAAK,CAAC,QAAQ,CAClB,sBAAsB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACnC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC1B,KAAK,EAAE,IAAA,2CAAiC,EAAC,GAAG,CAAC;KAC9C,CAAC,CAAC,EACH;QACE,MAAM,EAAE,8BAAkB;QAC1B,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CACF,CAAC;AACJ,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -1,64 +0,0 @@
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 constants_1 = require("./constants");
14
- const clients_1 = require("../../utils/clients");
15
- const solana_1 = require("../../utils/solana");
16
- const structs_1 = require("./structs");
17
- const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
18
- const connection = (0, clients_1.getClientSolana)();
19
- const accounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.seatStruct, constants_1.phoenixPid, [
20
- {
21
- dataSize: structs_1.seatStruct.byteSize,
22
- },
23
- {
24
- memcmp: {
25
- bytes: owner,
26
- offset: 40,
27
- },
28
- },
29
- ]);
30
- console.log('accounts:', accounts);
31
- if (accounts.length === 0)
32
- return [];
33
- const markets = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.marketHeaderStruct, constants_1.phoenixPid, [
34
- {
35
- dataSize: 445536,
36
- },
37
- ]);
38
- console.log('marketHeaderStruct.byteSize:', structs_1.marketHeaderStruct.byteSize);
39
- console.log('markets:', markets);
40
- console.log('markets:', markets.length);
41
- const solTokenPrice = yield cache.getTokenPrice(portfolio_core_1.solanaNativeAddress, portfolio_core_1.NetworkId.solana);
42
- const assets = [];
43
- accounts.forEach((acc) => { });
44
- if (assets.length === 0)
45
- return [];
46
- const element = {
47
- networkId: portfolio_core_1.NetworkId.solana,
48
- label: 'Deposit',
49
- platformId: constants_1.platformId,
50
- type: portfolio_core_1.PortfolioElementType.multiple,
51
- value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
52
- data: {
53
- assets,
54
- },
55
- };
56
- return [element];
57
- });
58
- const fetcher = {
59
- id: `${constants_1.platformId}-positions`,
60
- networkId: portfolio_core_1.NetworkId.solana,
61
- executor,
62
- };
63
- exports.default = fetcher;
64
- //# sourceMappingURL=positionsFetcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAQoC;AAGpC,2CAA4E;AAE5E,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA2D;AAG3D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,UAAU,EACV,oBAAU,EACV,sBAAU,EACV;QACE;YACE,QAAQ,EAAE,oBAAU,CAAC,QAAQ;SAC9B;QACD;YACE,MAAM,EAAE;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,EAAE;aACX;SACF;KACF,CACF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACnC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAwB,EAC5C,UAAU,EACV,4BAAkB,EAClB,sBAAU,EACV;QACE;YACE,QAAQ,EAAE,MAAM;SACjB;KACF,CACF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,4BAAkB,CAAC,QAAQ,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAC7C,oCAAmB,EACnB,0BAAS,CAAC,MAAM,CACjB,CAAC;IACF,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,MAAM,OAAO,GAA6B;QACxC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,SAAS;QAChB,UAAU,EAAV,sBAAU;QACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;QACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,EAAE;YACJ,MAAM;SACP;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,67 +0,0 @@
1
- import { BeetArgsStruct, BeetStruct, COption, FixableBeetStruct } from '@metaplex-foundation/beet';
2
- import { PublicKey } from '@solana/web3.js';
3
- import BigNumber from 'bignumber.js';
4
- export type Seat = {
5
- discriminant: BigNumber;
6
- market: PublicKey;
7
- trader: PublicKey;
8
- approvalStatus: BigNumber;
9
- padding: BigNumber[];
10
- };
11
- export declare const seatStruct: BeetStruct<Seat, Partial<Seat>>;
12
- export type TokenParams = {
13
- decimals: number;
14
- vaultBump: number;
15
- mintKey: PublicKey;
16
- vaultKey: PublicKey;
17
- };
18
- export declare const tokenParamsStruct: BeetStruct<TokenParams, Partial<TokenParams>>;
19
- export type MarketSizeParams = {
20
- bidsSize: BigNumber;
21
- asksSize: BigNumber;
22
- numSeats: BigNumber;
23
- };
24
- export declare const marketSizeParamsBeet: BeetStruct<MarketSizeParams, Partial<MarketSizeParams>>;
25
- export type MarketHeaderAccount = {
26
- discriminant: BigNumber;
27
- status: BigNumber;
28
- marketSizeParams: MarketSizeParams;
29
- baseParams: TokenParams;
30
- baseLotSize: BigNumber;
31
- quoteParams: TokenParams;
32
- quoteLotSize: BigNumber;
33
- tickSizeInQuoteAtomsPerBaseUnit: BigNumber;
34
- authority: PublicKey;
35
- feeRecipient: PublicKey;
36
- marketSequenceNumber: BigNumber;
37
- successor: PublicKey;
38
- rawBaseUnitsPerBaseUnit: number;
39
- padding1: number;
40
- padding2: BigNumber[];
41
- };
42
- export declare const marketHeaderStruct: BeetStruct<MarketHeaderAccount, Partial<MarketHeaderAccount>>;
43
- export type CondensedOrder = {
44
- priceInTicks: BigNumber;
45
- sizeInBaseLots: BigNumber;
46
- lastValidSlot: COption<BigNumber>;
47
- lastValidUnixTimestampInSeconds: COption<BigNumber>;
48
- };
49
- export declare const condensedOrderBeet: FixableBeetStruct<CondensedOrder, Partial<CondensedOrder>>;
50
- export declare enum FailedMultipleLimitOrderBehavior {
51
- FailOnInsufficientFundsAndAmendOnCross = 0,
52
- FailOnInsufficientFundsAndFailOnCross = 1,
53
- SkipOnInsufficientFundsAndAmendOnCross = 2,
54
- SkipOnInsufficientFundsAndFailOnCross = 3
55
- }
56
- export type MultipleOrderPacket = {
57
- bids: CondensedOrder[];
58
- asks: CondensedOrder[];
59
- clientOrderId: COption<BigNumber>;
60
- failedMultipleLimitOrderBehavior: FailedMultipleLimitOrderBehavior;
61
- };
62
- export declare const multipleOrderPacketStruct: FixableBeetStruct<MultipleOrderPacket, Partial<MultipleOrderPacket>>;
63
- export type OrderId = {
64
- priceInTicks: BigNumber;
65
- orderSequenceNumber: BigNumber;
66
- };
67
- export declare const orderIdBeet: BeetArgsStruct<OrderId>;