@sonarwatch/portfolio-plugins 0.11.80 → 0.11.82
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +13 -5
- package/package.json +2 -2
- package/src/plugins/jupiter/index.js +1 -2
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/parcl/constants.d.ts +2 -0
- package/src/plugins/parcl/constants.js +3 -1
- package/src/plugins/parcl/constants.js.map +1 -1
- package/src/plugins/parcl/depositsFetcher.js +9 -19
- package/src/plugins/parcl/depositsFetcher.js.map +1 -1
- package/src/plugins/parcl/filters.d.ts +1 -0
- package/src/plugins/parcl/filters.js +13 -1
- package/src/plugins/parcl/filters.js.map +1 -1
- package/src/plugins/parcl/helpers.js +0 -1
- package/src/plugins/parcl/helpers.js.map +1 -1
- package/src/plugins/parcl/index.js +2 -1
- package/src/plugins/parcl/index.js.map +1 -1
- package/src/plugins/parcl/marginFetcher.d.ts +3 -0
- package/src/plugins/parcl/marginFetcher.js +53 -0
- package/src/plugins/parcl/marginFetcher.js.map +1 -0
- package/src/plugins/parcl/structs.d.ts +21 -0
- package/src/plugins/parcl/structs.js +21 -1
- package/src/plugins/parcl/structs.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,14 +2,22 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.11.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
## [0.11.79](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.78...plugins-0.11.79) (2024-02-19)
|
5
|
+
## [0.11.82](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.81...plugins-0.11.82) (2024-02-20)
|
10
6
|
|
11
7
|
|
12
8
|
|
9
|
+
## [0.11.81](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.80...plugins-0.11.81) (2024-02-19)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [0.11.80](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.79...plugins-0.11.80) (2024-02-19)
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## [0.11.79](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.78...plugins-0.11.79) (2024-02-19)
|
18
|
+
|
19
|
+
|
20
|
+
|
13
21
|
## [0.11.78](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.77...plugins-0.11.78) (2024-02-14)
|
14
22
|
|
15
23
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.82",
|
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.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.82"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
@@ -4,10 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.fetchers = exports.jobs = void 0;
|
7
|
-
const poolJob_1 = __importDefault(require("./poolJob"));
|
8
7
|
const perpetualFetcher_1 = __importDefault(require("./perpetualFetcher"));
|
9
8
|
const custodiesJob_1 = __importDefault(require("./custodiesJob"));
|
10
9
|
const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
11
|
-
exports.jobs = [
|
10
|
+
exports.jobs = [custodiesJob_1.default];
|
12
11
|
exports.fetchers = [perpetualFetcher_1.default, airdropFetcher_1.default];
|
13
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAEA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,IAAI,GAAU,CAAC,sBAAY,CAAC,CAAC;AAC7B,QAAA,QAAQ,GAAc,CAAC,0BAAgB,EAAE,wBAAc,CAAC,CAAC"}
|
@@ -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,7 +20,6 @@ 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");
|
24
23
|
const thirtyDays = 30 * 1000 * 60 * 60 * 24;
|
25
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
25
|
const client = (0, clients_1.getClientSolana)();
|
@@ -34,24 +33,15 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
34
33
|
lpPositions.push(...parsedAccount);
|
35
34
|
id += 10;
|
36
35
|
} while (parsedAccount[parsedAccount.length]);
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
+
id = 0;
|
37
|
+
const settlementRequests = [];
|
38
|
+
let requestsParsedAccounts;
|
39
|
+
do {
|
40
|
+
const accountPubKeys = (0, helpers_1.getSettlementRequestsPdas)(owner, id, id + 10);
|
41
|
+
requestsParsedAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.settlementRequestStruct, accountPubKeys);
|
42
|
+
settlementRequests.push(...requestsParsedAccounts);
|
43
|
+
id += 10;
|
44
|
+
} while (requestsParsedAccounts[requestsParsedAccounts.length]);
|
55
45
|
const usdcTokenPrice = yield cache.getTokenPrice(solana_1.usdcSolanaMint, portfolio_core_1.NetworkId.solana);
|
56
46
|
const elements = [];
|
57
47
|
const assets = [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,+CAG4B;AAC5B,uCA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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"}
|
@@ -2,3 +2,4 @@ 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
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.settlementRequestFilter = 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
|
{
|
@@ -38,4 +38,16 @@ const settlementRequestFilter = (owner) => [
|
|
38
38
|
},
|
39
39
|
];
|
40
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;
|
41
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,
|
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"}
|
@@ -30,7 +30,6 @@ function getSettlementRequestsPdas(owner, start, end) {
|
|
30
30
|
for (let i = start; i < end; i++) {
|
31
31
|
keys.push(web3_js_1.PublicKey.findProgramAddressSync([
|
32
32
|
Buffer.from('settlement_request', 'utf-8'),
|
33
|
-
new web3_js_1.PublicKey('82dGS7Jt4Km8ZgwZVRsJ2V6vPXEhVdgDaMP7cqPGG1TW').toBuffer(),
|
34
33
|
new web3_js_1.PublicKey(owner).toBuffer(),
|
35
34
|
new bn_js_1.BN(i).toArrayLike(Buffer, 'le', 8),
|
36
35
|
], constants_1.programId)[0]);
|
@@ -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,CAAC,aAAa,EAAE,OAAO,CAAC;YACnC,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,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,
|
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,CAAC,aAAa,EAAE,OAAO,CAAC;YACnC,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,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,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;AAnBD,8DAmBC"}
|
@@ -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,
|
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,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.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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,SAAS;IAC1B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -38,3 +38,24 @@ export type SettlementRequest = {
|
|
38
38
|
bump: Buffer;
|
39
39
|
};
|
40
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.settlementRequestStruct = 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");
|
@@ -37,4 +37,24 @@ exports.settlementRequestStruct = new beet_1.BeetStruct([
|
|
37
37
|
['ownerTokenAccount', beet_solana_1.publicKey],
|
38
38
|
['bump', (0, solana_1.blob)(8)],
|
39
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);
|
40
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,
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/structs.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAG7D,+CAA2D;AAc9C,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;I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