@sonarwatch/portfolio-plugins 0.11.79 → 0.11.81

Sign up to get free protection for your applications and to get access to all the features.
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.79",
3
+ "version": "0.11.81",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.79"
44
+ "@sonarwatch/portfolio-core": "0.11.81"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -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;
@@ -3,3 +3,5 @@ import { Platform } from '@sonarwatch/portfolio-core';
3
3
  export declare const platformId = "parcl";
4
4
  export declare const platform: Platform;
5
5
  export declare const programId: PublicKey;
6
+ export declare const usdcMint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
7
+ export declare const usdcDecimals = 6;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.programId = exports.platform = exports.platformId = void 0;
3
+ exports.usdcDecimals = exports.usdcMint = exports.programId = exports.platform = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'parcl';
6
6
  exports.platform = {
@@ -12,4 +12,6 @@ exports.platform = {
12
12
  twitter: 'https://twitter.com/Parcl',
13
13
  };
14
14
  exports.programId = new web3_js_1.PublicKey('3parcLrT7WnXAcyPfkCz49oofuuf2guUKkjuFkAhZW8Y');
15
+ exports.usdcMint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
16
+ exports.usdcDecimals = 6;
15
17
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,cAAc,EAAE,sCAAsC;IACnE,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,8CAA8C,CAC/C,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,cAAc,EAAE,sCAAsC;IACnE,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC"}
@@ -20,6 +20,7 @@ const structs_1 = require("./structs");
20
20
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
21
21
  const helpers_1 = require("./helpers");
22
22
  const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
23
+ const filters_1 = require("./filters");
23
24
  const thirtyDays = 30 * 1000 * 60 * 60 * 24;
24
25
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
25
26
  const client = (0, clients_1.getClientSolana)();
@@ -33,8 +34,27 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
33
34
  lpPositions.push(...parsedAccount);
34
35
  id += 10;
35
36
  } while (parsedAccount[parsedAccount.length]);
37
+ // id = 0;
38
+ // const settlementRequests = [];
39
+ // let requestsParsedAccounts;
40
+ // do {
41
+ // const accountPubKeys = getSettlementRequestsPdas(owner, id, id + 10);
42
+ // requestsParsedAccounts = await getParsedMultipleAccountsInfo(
43
+ // client,
44
+ // settlementRequestStruct,
45
+ // accountPubKeys
46
+ // );
47
+ // settlementRequests.push(...requestsParsedAccounts);
48
+ // id += 10;
49
+ // } while (requestsParsedAccounts[requestsParsedAccounts.length]);
50
+ // console.log(
51
+ // 'constexecutor:FetcherExecutor= ~ settlementRequests:',
52
+ // settlementRequests
53
+ // );
54
+ const settlementRequests = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.settlementRequestStruct, constants_1.programId, (0, filters_1.settlementRequestFilter)(owner));
36
55
  const usdcTokenPrice = yield cache.getTokenPrice(solana_1.usdcSolanaMint, portfolio_core_1.NetworkId.solana);
37
56
  const elements = [];
57
+ const assets = [];
38
58
  if (oldLpAccount && !oldLpAccount.liquidity.isZero()) {
39
59
  const unlockStartedAt = new Date(oldLpAccount.lastAddLiquidityTimestamp.times(1000).toNumber());
40
60
  const unlockingAt = new Date(unlockStartedAt.getTime() + thirtyDays);
@@ -52,23 +72,38 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
52
72
  });
53
73
  }
54
74
  for (const lpPosition of lpPositions) {
55
- if (lpPosition && !lpPosition.liquidity.isZero()) {
56
- const unlockStartedAt = new Date(lpPosition.maturity.times(1000).toNumber());
57
- const unlockingAt = new Date(unlockStartedAt.getTime() + thirtyDays);
58
- const asset = Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, lpPosition.liquidity.dividedBy(Math.pow(10, 6)).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: {
59
- lockedUntil: unlockingAt.getTime(),
60
- } });
61
- elements.push({
62
- type: portfolio_core_1.PortfolioElementType.multiple,
63
- label: 'Deposit',
64
- networkId: portfolio_core_1.NetworkId.solana,
65
- platformId: constants_1.platformId,
66
- data: { assets: [asset] },
67
- value: asset.value,
68
- });
69
- }
75
+ if (!lpPosition || lpPosition.liquidity.isZero())
76
+ continue;
77
+ const unlockingAt = new Date(lpPosition.maturity.times(1000).toNumber());
78
+ const asset = Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, lpPosition.liquidity.dividedBy(Math.pow(10, 6)).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: {
79
+ lockedUntil: unlockingAt.getTime(),
80
+ } });
81
+ assets.push(asset);
82
+ }
83
+ for (const settlementRequest of settlementRequests) {
84
+ if (!settlementRequest || settlementRequest.amount.isZero())
85
+ continue;
86
+ const unlockingAt = new Date(settlementRequest.maturity.times(1000).toNumber());
87
+ if (unlockingAt.getTime() < Date.now())
88
+ continue;
89
+ const asset = Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, settlementRequest.amount.dividedBy(Math.pow(10, 6)).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: {
90
+ lockedUntil: unlockingAt.getTime(),
91
+ tags: ['Pending Withdraw'],
92
+ } });
93
+ assets.push(asset);
70
94
  }
71
- return elements;
95
+ if (assets.length === 0)
96
+ return [];
97
+ return [
98
+ {
99
+ type: portfolio_core_1.PortfolioElementType.multiple,
100
+ label: 'Deposit',
101
+ networkId: portfolio_core_1.NetworkId.solana,
102
+ platformId: constants_1.platformId,
103
+ data: { assets },
104
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
105
+ },
106
+ ];
72
107
  });
73
108
  const fetcher = {
74
109
  id: `${constants_1.platformId}-deposits`,
@@ -1 +1 @@
1
- {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,+CAG4B;AAC5B,uCAA8D;AAC9D,qGAA6E;AAC7E,uCAAmE;AACnE,kFAA+E;AAE/E,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE5C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,MAAM,IAAA,2CAAoB,EAC7C,MAAM,EACN,yBAAe,EACf,IAAA,4BAAkB,EAAC,KAAK,C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,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAoD;AACpD,iDAAsD;AACtD,+CAI4B;AAC5B,uCAImB;AACnB,qGAA6E;AAC7E,uCAAmE;AACnE,kFAA+E;AAC/E,uCAAoD;AAEpD,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE5C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,MAAM,IAAA,2CAAoB,EAC7C,MAAM,EACN,yBAAe,EACf,IAAA,4BAAkB,EAAC,KAAK,CAAC,CAC1B,CAAC;IAEF,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAI,aAAa,CAAC;IAClB,GAAG,CAAC;QACF,MAAM,cAAc,GAAG,IAAA,4BAAkB,EAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9D,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACjD,MAAM,EACN,0BAAgB,EAChB,cAAc,CACf,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QACnC,EAAE,IAAI,EAAE,CAAC;IACX,CAAC,QAAQ,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;IAE9C,UAAU;IACV,iCAAiC;IACjC,8BAA8B;IAC9B,OAAO;IACP,0EAA0E;IAC1E,kEAAkE;IAClE,cAAc;IACd,+BA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,OAAO,EAAE;gBAClC,IAAI,EAAE,CAAC,kBAAkB,CAAC;aAC3B,GACF,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,EAAE,MAAM,EAAE;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,3 +1,5 @@
1
1
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
2
  export declare const lpAccountFilter: (owner: string) => GetProgramAccountsFilter[];
3
3
  export declare const lpPositionFilter: (owner: string) => GetProgramAccountsFilter[];
4
+ export declare const settlementRequestFilter: (owner: string) => GetProgramAccountsFilter[];
5
+ export declare const marginAccountFilter: (owner: string) => GetProgramAccountsFilter[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lpPositionFilter = exports.lpAccountFilter = void 0;
3
+ exports.marginAccountFilter = exports.settlementRequestFilter = exports.lpPositionFilter = exports.lpAccountFilter = void 0;
4
4
  const structs_1 = require("./structs");
5
5
  const lpAccountFilter = (owner) => [
6
6
  {
@@ -26,4 +26,28 @@ const lpPositionFilter = (owner) => [
26
26
  },
27
27
  ];
28
28
  exports.lpPositionFilter = lpPositionFilter;
29
+ const settlementRequestFilter = (owner) => [
30
+ {
31
+ memcmp: {
32
+ offset: 72,
33
+ bytes: owner,
34
+ },
35
+ },
36
+ {
37
+ dataSize: structs_1.settlementRequestStruct.byteSize,
38
+ },
39
+ ];
40
+ exports.settlementRequestFilter = settlementRequestFilter;
41
+ const marginAccountFilter = (owner) => [
42
+ {
43
+ memcmp: {
44
+ offset: 828,
45
+ bytes: owner,
46
+ },
47
+ },
48
+ {
49
+ dataSize: structs_1.marginAccountStruct.byteSize,
50
+ },
51
+ ];
52
+ exports.marginAccountFilter = marginAccountFilter;
29
53
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/filters.ts"],"names":[],"mappings":";;;AACA,uCAA8D;AAEvD,MAAM,eAAe,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC5E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,yBAAe,CAAC,QAAQ;KACnC;CACF,CAAC;AAVW,QAAA,eAAe,mBAU1B;AAEK,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC7E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,0BAAgB,CAAC,QAAQ;KACpC;CACF,CAAC;AAVW,QAAA,gBAAgB,oBAU3B"}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/filters.ts"],"names":[],"mappings":";;;AACA,uCAKmB;AAEZ,MAAM,eAAe,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC5E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,yBAAe,CAAC,QAAQ;KACnC;CACF,CAAC;AAVW,QAAA,eAAe,mBAU1B;AAEK,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC7E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,0BAAgB,CAAC,QAAQ;KACpC;CACF,CAAC;AAVW,QAAA,gBAAgB,oBAU3B;AAEK,MAAM,uBAAuB,GAAG,CACrC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,iCAAuB,CAAC,QAAQ;KAC3C;CACF,CAAC;AAZW,QAAA,uBAAuB,2BAYlC;AAEK,MAAM,mBAAmB,GAAG,CACjC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,6BAAmB,CAAC,QAAQ;KACvC;CACF,CAAC;AAZW,QAAA,mBAAmB,uBAY9B"}
@@ -1,3 +1,4 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  export declare function getOldLpAccountPda(owner: string): PublicKey;
3
3
  export declare function getLpPositionsPdas(owner: string, start: number, end: number): PublicKey[];
4
+ export declare function getSettlementRequestsPdas(owner: string, start: number, end: number): PublicKey[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLpPositionsPdas = exports.getOldLpAccountPda = void 0;
3
+ exports.getSettlementRequestsPdas = exports.getLpPositionsPdas = exports.getOldLpAccountPda = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  const bn_js_1 = require("bn.js");
6
6
  const constants_1 = require("./constants");
@@ -25,4 +25,17 @@ function getLpPositionsPdas(owner, start, end) {
25
25
  return keys;
26
26
  }
27
27
  exports.getLpPositionsPdas = getLpPositionsPdas;
28
+ function getSettlementRequestsPdas(owner, start, end) {
29
+ const keys = [];
30
+ for (let i = start; i < end; i++) {
31
+ keys.push(web3_js_1.PublicKey.findProgramAddressSync([
32
+ Buffer.from('settlement_request', 'utf-8'),
33
+ new web3_js_1.PublicKey('82dGS7Jt4Km8ZgwZVRsJ2V6vPXEhVdgDaMP7cqPGG1TW').toBuffer(),
34
+ new web3_js_1.PublicKey(owner).toBuffer(),
35
+ new bn_js_1.BN(i).toArrayLike(Buffer, 'le', 8),
36
+ ], constants_1.programId)[0]);
37
+ }
38
+ return keys;
39
+ }
40
+ exports.getSettlementRequestsPdas = getSettlementRequestsPdas;
28
41
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,iCAA2B;AAC3B,2CAAwC;AAExC,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;QAClC,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC,QAAQ,EAAE;QACxE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;KAChC,EACD,qBAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,gDASC;AAED,SAAgB,kBAAkB,CAChC,KAAa,EACb,KAAa,EACb,GAAW;IAEX,MAAM,IAAI,GAAgB,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CACP,mBAAS,CAAC,sBAAsB,CAC9B;YACE,MAAM,CAAC,IAAI,CAA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,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACvC,EACD,qBAAS,CACV,CAAC,CAAC,CAAC,CACL,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAtBD,gDAsBC;AAED,SAAgB,yBAAyB,CACvC,KAAa,EACb,KAAa,EACb,GAAW;IAEX,MAAM,IAAI,GAAgB,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CACP,mBAAS,CAAC,sBAAsB,CAC9B;YACE,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;YAC1C,IAAI,mBAAS,CACX,8CAA8C,CAC/C,CAAC,QAAQ,EAAE;YACZ,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;YAC/B,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACvC,EACD,qBAAS,CACV,CAAC,CAAC,CAAC,CACL,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAtBD,8DAsBC"}
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchers = exports.jobs = exports.platforms = void 0;
7
7
  const constants_1 = require("./constants");
8
8
  const depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
9
+ const marginFetcher_1 = __importDefault(require("./marginFetcher"));
9
10
  exports.platforms = [constants_1.platform];
10
11
  exports.jobs = [];
11
- exports.fetchers = [depositsFetcher_1.default];
12
+ exports.fetchers = [depositsFetcher_1.default, marginFetcher_1.default];
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAA+C;AAElC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,yBAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,oEAA4C;AAE/B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,yBAAe,EAAE,uBAAa,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const constants_1 = require("./constants");
17
+ const clients_1 = require("../../utils/clients");
18
+ const solana_1 = require("../../utils/solana");
19
+ const structs_1 = require("./structs");
20
+ const filters_1 = require("./filters");
21
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const client = (0, clients_1.getClientSolana)();
24
+ const accounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.marginAccountStruct, constants_1.programId, (0, filters_1.marginAccountFilter)(owner));
25
+ if (accounts.length === 0)
26
+ return [];
27
+ const usdcTokenPrice = yield cache.getTokenPrice(constants_1.usdcMint, portfolio_core_1.NetworkId.solana);
28
+ const assets = [];
29
+ for (const account of accounts) {
30
+ if (account.margin.isZero())
31
+ continue;
32
+ assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.usdcMint, account.margin.dividedBy(Math.pow(10, constants_1.usdcDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: {} }));
33
+ }
34
+ if (assets.length === 0)
35
+ return [];
36
+ return [
37
+ {
38
+ type: portfolio_core_1.PortfolioElementType.multiple,
39
+ label: 'Margin',
40
+ networkId: portfolio_core_1.NetworkId.solana,
41
+ platformId: constants_1.platformId,
42
+ data: { assets },
43
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
44
+ },
45
+ ];
46
+ });
47
+ const fetcher = {
48
+ id: `${constants_1.platformId}-margin`,
49
+ networkId: portfolio_core_1.NetworkId.solana,
50
+ executor,
51
+ };
52
+ exports.default = fetcher;
53
+ //# sourceMappingURL=marginFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marginFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/marginFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAEpC,2CAA4E;AAE5E,iDAAsD;AACtD,+CAA8D;AAC9D,uCAAgD;AAChD,uCAAgD;AAChD,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBA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CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -26,3 +26,36 @@ export type LpPosition = {
26
26
  padding: number[];
27
27
  };
28
28
  export declare const lpPositionStruct: BeetStruct<LpPosition, Partial<LpPosition>>;
29
+ export type SettlementRequest = {
30
+ buffer: Buffer;
31
+ id: BigNumber;
32
+ maturity: BigNumber;
33
+ amount: BigNumber;
34
+ keeperTip: BigNumber;
35
+ exchange: PublicKey;
36
+ owner: PublicKey;
37
+ ownerTokenAccount: PublicKey;
38
+ bump: Buffer;
39
+ };
40
+ export declare const settlementRequestStruct: BeetStruct<SettlementRequest, Partial<SettlementRequest>>;
41
+ export type Position = {
42
+ size: BigNumber;
43
+ lastInteractionPrice: BigNumber;
44
+ lastInteractionFundingPerUnit: BigNumber;
45
+ marketId: number;
46
+ _padding: number[];
47
+ };
48
+ export declare const positionStruct: BeetStruct<Position, Partial<Position>>;
49
+ export type MarginAccount = {
50
+ buffer: Buffer;
51
+ margin: BigNumber;
52
+ maxLiquidationFee: BigNumber;
53
+ id: number;
54
+ exchange: PublicKey;
55
+ owner: PublicKey;
56
+ delegate: PublicKey;
57
+ inLiquidation: number;
58
+ bump: number;
59
+ _padding: number[];
60
+ };
61
+ export declare const marginAccountStruct: BeetStruct<MarginAccount, Partial<MarginAccount>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lpPositionStruct = exports.lpAccountStruct = void 0;
3
+ exports.marginAccountStruct = exports.positionStruct = exports.settlementRequestStruct = exports.lpPositionStruct = exports.lpAccountStruct = void 0;
4
4
  const beet_1 = require("@metaplex-foundation/beet");
5
5
  const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
6
  const solana_1 = require("../../utils/solana");
@@ -26,4 +26,35 @@ exports.lpPositionStruct = new beet_1.BeetStruct([
26
26
  ['bump', beet_1.u8],
27
27
  ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
28
28
  ], (args) => args);
29
+ exports.settlementRequestStruct = new beet_1.BeetStruct([
30
+ ['buffer', (0, solana_1.blob)(8)],
31
+ ['id', solana_1.u64],
32
+ ['maturity', solana_1.u64],
33
+ ['amount', solana_1.u64],
34
+ ['keeperTip', solana_1.u64],
35
+ ['exchange', beet_solana_1.publicKey],
36
+ ['owner', beet_solana_1.publicKey],
37
+ ['ownerTokenAccount', beet_solana_1.publicKey],
38
+ ['bump', (0, solana_1.blob)(8)],
39
+ ], (args) => args);
40
+ exports.positionStruct = new beet_1.BeetStruct([
41
+ ['size', solana_1.i128],
42
+ ['lastInteractionPrice', solana_1.u128],
43
+ ['lastInteractionFundingPerUnit', solana_1.u64],
44
+ ['marketId', beet_1.u32],
45
+ ['_padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 4)],
46
+ ], (args) => args);
47
+ exports.marginAccountStruct = new beet_1.BeetStruct([
48
+ ['buffer', (0, solana_1.blob)(776)],
49
+ // ['positions', uniformFixedSizeArray(positionStruct, 12)],
50
+ ['margin', solana_1.u64],
51
+ ['maxLiquidationFee', solana_1.u64],
52
+ ['id', beet_1.u32],
53
+ ['exchange', beet_solana_1.publicKey],
54
+ ['owner', beet_solana_1.publicKey],
55
+ ['delegate', beet_solana_1.publicKey],
56
+ ['inLiquidation', beet_1.u8],
57
+ ['bump', beet_1.u8],
58
+ ['_padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 10)],
59
+ ], (args) => args);
29
60
  //# sourceMappingURL=structs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/structs.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,+CAA+C;AAclC,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,QAAQ,EAAE,YA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AAc,GAAG,IAAI,iBAAU,CAC1C;IACE,CAAC,MAAM,EAAE,aAAI,CAAC;IACd,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,+BAA+B,EAAE,YAAG,CAAC;IACtC,CAAC,UAAU,EAAE,UAAG,CAAC;IACjB,CAAC,UAAU,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAgB,CAC3B,CAAC;AAgBW,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,GAAG,CAAC,CAAC;IACrB,4DAA4D;IAC5D,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,mBAAmB,EAAE,YAAG,CAAC;IAC1B,CAAC,IAAI,EAAE,UAAG,CAAC;IACX,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,eAAe,EAAE,SAAE,CAAC;IACrB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,UAAU,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,EAAE,CAAC,CAAC;CAC5C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAqB,CAChC,CAAC"}
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
54
54
  }
55
55
  function getV3PairsAddresses(url, length = 300) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- const query = (0, graphql_request_1.gql) `
58
- {
59
- pools(
60
- orderBy: totalValueLockedUSD
61
- first: ${length}
62
- orderDirection: desc
63
- where: { volumeUSD_not: "0", liquidity_not: "0" }
64
- ) {
65
- id
66
- token0Price
67
- token1Price
68
- liquidity
69
- token0 {
70
- id
71
- totalSupply
72
- decimals
73
- }
74
- token1 {
75
- id
76
- totalSupply
77
- decimals
78
- }
79
- }
80
- }
57
+ const query = (0, graphql_request_1.gql) `
58
+ {
59
+ pools(
60
+ orderBy: totalValueLockedUSD
61
+ first: ${length}
62
+ orderDirection: desc
63
+ where: { volumeUSD_not: "0", liquidity_not: "0" }
64
+ ) {
65
+ id
66
+ token0Price
67
+ token1Price
68
+ liquidity
69
+ token0 {
70
+ id
71
+ totalSupply
72
+ decimals
73
+ }
74
+ token1 {
75
+ id
76
+ totalSupply
77
+ decimals
78
+ }
79
+ }
80
+ }
81
81
  `;
82
82
  const res = yield (0, graphql_request_1.default)(url, query);
83
83
  const pools = res.pools;
@@ -40,28 +40,28 @@ function getPairKey(version) {
40
40
  exports.getPairKey = getPairKey;
41
41
  function getPairsV2FromTheGraph(url, length = 300) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- const query = (0, graphql_request_1.gql) `
44
- {
45
- pairs(
46
- orderBy: reserveUSD
47
- first: ${length}
48
- orderDirection: desc
49
- where: { trackedReserveETH_not: "0" }
50
- ) {
51
- id
52
- reserve0
53
- reserve1
54
- totalSupply
55
- token0 {
56
- id
57
- decimals
58
- }
59
- token1 {
60
- id
61
- decimals
62
- }
63
- }
64
- }
43
+ const query = (0, graphql_request_1.gql) `
44
+ {
45
+ pairs(
46
+ orderBy: reserveUSD
47
+ first: ${length}
48
+ orderDirection: desc
49
+ where: { trackedReserveETH_not: "0" }
50
+ ) {
51
+ id
52
+ reserve0
53
+ reserve1
54
+ totalSupply
55
+ token0 {
56
+ id
57
+ decimals
58
+ }
59
+ token1 {
60
+ id
61
+ decimals
62
+ }
63
+ }
64
+ }
65
65
  `;
66
66
  const res = yield (0, graphql_request_1.default)(url, query);
67
67
  const pairs = res.pairs;
@@ -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;