@sonarwatch/portfolio-plugins 0.11.125 → 0.11.127
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1235 -1227
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/jupiter/airdropFetcher.js +2 -2
- package/src/plugins/jupiter/airdropFetcher.js.map +1 -1
- package/src/plugins/jupiter/constants.d.ts +1 -0
- package/src/plugins/jupiter/constants.js +2 -1
- package/src/plugins/jupiter/constants.js.map +1 -1
- package/src/plugins/jupiter/filters.d.ts +1 -0
- package/src/plugins/jupiter/filters.js +11 -1
- package/src/plugins/jupiter/filters.js.map +1 -1
- package/src/plugins/jupiter/helpers.d.ts +2 -0
- package/src/plugins/jupiter/helpers.js +20 -1
- package/src/plugins/jupiter/helpers.js.map +1 -1
- package/src/plugins/jupiter/index.js +2 -0
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/jupiter/structs/aidrop.d.ts +14 -0
- package/src/plugins/jupiter/structs/aidrop.js +16 -0
- package/src/plugins/jupiter/structs/aidrop.js.map +1 -0
- package/src/plugins/jupiter/structs/valueAverage.d.ts +31 -0
- package/src/plugins/jupiter/structs/valueAverage.js +33 -0
- package/src/plugins/jupiter/structs/valueAverage.js.map +1 -0
- package/src/plugins/jupiter/structs/vote.d.ts +18 -0
- package/src/plugins/jupiter/structs/vote.js +20 -0
- package/src/plugins/jupiter/structs/vote.js.map +1 -0
- package/src/plugins/jupiter/structs.d.ts +0 -24
- package/src/plugins/jupiter/structs.js +1 -23
- package/src/plugins/jupiter/structs.js.map +1 -1
- package/src/plugins/jupiter/valueAverageFetcher.d.ts +3 -0
- package/src/plugins/jupiter/valueAverageFetcher.js +62 -0
- package/src/plugins/jupiter/valueAverageFetcher.js.map +1 -0
- package/src/plugins/jupiter/voteFetcher.js +2 -2
- package/src/plugins/jupiter/voteFetcher.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +2 -5
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
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.
|
3
|
+
"version": "0.11.127",
|
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.127"
|
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;
|
@@ -18,10 +18,10 @@ const web3_js_1 = require("@solana/web3.js");
|
|
18
18
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
19
19
|
const constants_1 = require("./constants");
|
20
20
|
const clients_1 = require("../../utils/clients");
|
21
|
-
const structs_1 = require("./structs");
|
22
21
|
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
23
22
|
const helpers_1 = require("./helpers");
|
24
23
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
24
|
+
const aidrop_1 = require("./structs/aidrop");
|
25
25
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
26
|
const client = (0, clients_1.getClientSolana)();
|
27
27
|
const claimProofRes = yield axios_1.default
|
@@ -30,7 +30,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
30
30
|
const jupTokenPrice = yield cache.getTokenPrice(constants_1.jupMint, portfolio_core_1.NetworkId.solana);
|
31
31
|
if (claimProofRes && claimProofRes.data) {
|
32
32
|
const claimStatus = (0, helpers_1.deriveClaimStatus)(new web3_js_1.PublicKey(owner), new web3_js_1.PublicKey(claimProofRes.data.merkle_tree), constants_1.merkleDistributorPid)[0];
|
33
|
-
const account = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client,
|
33
|
+
const account = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, aidrop_1.claimStatusStruct, claimStatus);
|
34
34
|
if (!account) {
|
35
35
|
const amount = new bignumber_js_1.default(claimProofRes.data.amount)
|
36
36
|
.dividedBy(Math.pow(10, constants_1.jupDecimals))
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAC7E,kDAA6C;AAC7C,6CAA4C;AAC5C,gEAAqC;AAGrC,2CAMqB;AACrB,iDAAsD;
|
1
|
+
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAC7E,kDAA6C;AAC7C,6CAA4C;AAC5C,gEAAqC;AAGrC,2CAMqB;AACrB,iDAAsD;AAEtD,kFAA+E;AAC/E,uCAA8C;AAC9C,qGAA6E;AAC7E,6CAAqD;AAErD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,aAAa,GAA6C,MAAM,eAAK;SACxE,GAAG,CAAC,qBAAS,GAAG,KAAK,CAAC;SACtB,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAErB,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,mBAAO,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAC3E,IAAI,aAAa,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,WAAW,GAAG,IAAA,2BAAiB,EACnC,IAAI,mBAAS,CAAC,KAAK,CAAC,EACpB,IAAI,mBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAC7C,gCAAoB,CACrB,CAAC,CAAC,CAAC,CAAC;QACL,MAAM,OAAO,GAAG,MAAM,IAAA,2CAAoB,EACxC,MAAM,EACN,0BAAiB,EACjB,WAAW,CACZ,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;iBACpD,SAAS,CAAC,SAAA,EAAE,EAAI,uBAAW,CAAA,CAAC;iBAC5B,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,mBAAO,EACP,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,aAAa,CACd,CAAC;YACF,OAAO;gBACL;oBACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;oBACnC,KAAK,EAAE,SAAS;oBAChB,SAAS,EAAE,0BAAS,CAAC,MAAM;oBAC3B,UAAU,EAAV,sBAAU;oBACV,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE;wBACJ,MAAM,EAAE,iCAAM,KAAK,KAAE,UAAU,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAG;qBAC1D;oBACD,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB;aACF,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -5,6 +5,7 @@ export declare const jupiterPlatform: Platform;
|
|
5
5
|
export declare const jlpPool: PublicKey;
|
6
6
|
export declare const jlpToken: PublicKey;
|
7
7
|
export declare const perpsProgramId: PublicKey;
|
8
|
+
export declare const valueAverageProgramId: PublicKey;
|
8
9
|
export declare const voteProgramId: PublicKey;
|
9
10
|
export declare const lockerPubkey: PublicKey;
|
10
11
|
export declare const merkleDistributorPid: PublicKey;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.custodiesKey = exports.merkleApi = exports.jupDecimals = exports.jupMint = exports.merkleDistributorPid = exports.lockerPubkey = exports.voteProgramId = exports.perpsProgramId = exports.jlpToken = exports.jlpPool = exports.jupiterPlatform = exports.platformId = void 0;
|
3
|
+
exports.custodiesKey = exports.merkleApi = exports.jupDecimals = exports.jupMint = exports.merkleDistributorPid = exports.lockerPubkey = exports.voteProgramId = exports.valueAverageProgramId = exports.perpsProgramId = exports.jlpToken = exports.jlpPool = exports.jupiterPlatform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'jupiter';
|
6
6
|
exports.jupiterPlatform = {
|
@@ -13,6 +13,7 @@ exports.jupiterPlatform = {
|
|
13
13
|
exports.jlpPool = new web3_js_1.PublicKey('5BUwFW4nRbftYTDMbgxykoFWqWHPzahFSNAaaaJtVKsq');
|
14
14
|
exports.jlpToken = new web3_js_1.PublicKey('27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4');
|
15
15
|
exports.perpsProgramId = new web3_js_1.PublicKey('PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu');
|
16
|
+
exports.valueAverageProgramId = new web3_js_1.PublicKey('JVAp1DSLnM4Qh8qM1QasQ8x56ccb9S3DhbyEckybTF9');
|
16
17
|
exports.voteProgramId = new web3_js_1.PublicKey('voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj');
|
17
18
|
exports.lockerPubkey = new web3_js_1.PublicKey('CVMdMd79no569tjc5Sq7kzz8isbfCcFyBS5TLGsrZ5dN');
|
18
19
|
exports.merkleDistributorPid = new web3_js_1.PublicKey('meRjbQXFNf5En86FXT2YPz1dQzLj4Yb3xK8u1MVgqpb');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,iBAAiB;CAC3B,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AACW,QAAA,QAAQ,GAAG,IAAI,mBAAS,CACnC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,6CAA6C,CAC9C,CAAC;AACW,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,oBAAoB,GAAG,IAAI,mBAAS,CAC/C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,OAAO,GAAG,6CAA6C,CAAC;AACxD,QAAA,WAAW,GAAG,CAAC,CAAC;AAEhB,QAAA,SAAS,GACpB,oFAAoF,CAAC;AAC1E,QAAA,YAAY,GAAG,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,iBAAiB;CAC3B,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AACW,QAAA,QAAQ,GAAG,IAAI,mBAAS,CACnC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAI,mBAAS,CAChD,6CAA6C,CAC9C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,6CAA6C,CAC9C,CAAC;AACW,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,oBAAoB,GAAG,IAAI,mBAAS,CAC/C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,OAAO,GAAG,6CAA6C,CAAC;AACxD,QAAA,WAAW,GAAG,CAAC,CAAC;AAEhB,QAAA,SAAS,GACpB,oFAAoF,CAAC;AAC1E,QAAA,YAAY,GAAG,WAAW,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { GetProgramAccountsFilter } from '@solana/web3.js';
|
2
2
|
export declare const perpetualsPositionsFilter: (owner: string) => GetProgramAccountsFilter[];
|
3
3
|
export declare const escrowFilter: (owner: string) => GetProgramAccountsFilter[];
|
4
|
+
export declare const valueAverageFilter: (owner: string) => GetProgramAccountsFilter[];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.escrowFilter = exports.perpetualsPositionsFilter = void 0;
|
3
|
+
exports.valueAverageFilter = exports.escrowFilter = exports.perpetualsPositionsFilter = void 0;
|
4
4
|
const perpetualsPositionsFilter = (owner) => [
|
5
5
|
{
|
6
6
|
memcmp: {
|
@@ -21,4 +21,14 @@ const escrowFilter = (owner) => [
|
|
21
21
|
{ dataSize: 322 },
|
22
22
|
];
|
23
23
|
exports.escrowFilter = escrowFilter;
|
24
|
+
const valueAverageFilter = (owner) => [
|
25
|
+
{
|
26
|
+
memcmp: {
|
27
|
+
offset: 25,
|
28
|
+
bytes: owner,
|
29
|
+
},
|
30
|
+
},
|
31
|
+
{ dataSize: 339 },
|
32
|
+
];
|
33
|
+
exports.valueAverageFilter = valueAverageFilter;
|
24
34
|
//# sourceMappingURL=filters.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/filters.ts"],"names":[],"mappings":";;;AAEO,MAAM,yBAAyB,GAAG,CACvC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AAVW,QAAA,yBAAyB,6BAUpC;AAEK,MAAM,YAAY,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACzE;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AARW,QAAA,YAAY,gBAQvB"}
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/filters.ts"],"names":[],"mappings":";;;AAEO,MAAM,yBAAyB,GAAG,CACvC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AAVW,QAAA,yBAAyB,6BAUpC;AAEK,MAAM,YAAY,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACzE;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AARW,QAAA,YAAY,gBAQvB;AAEK,MAAM,kBAAkB,GAAG,CAChC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AAVW,QAAA,kBAAkB,sBAU7B"}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
|
+
import { PortfolioAsset } from '@sonarwatch/portfolio-core';
|
2
3
|
export declare function deriveClaimStatus(claimant: PublicKey, distributor: PublicKey, programId: PublicKey): [PublicKey, number];
|
3
4
|
export declare function getVotePda(owner: string): PublicKey;
|
4
5
|
export declare function getPrices(mints: PublicKey[], vsMint: PublicKey): Promise<Map<string, number>>;
|
6
|
+
export declare function getMergedAssets(assets: PortfolioAsset[]): PortfolioAsset[];
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.getPrices = exports.getVotePda = exports.deriveClaimStatus = void 0;
|
15
|
+
exports.getMergedAssets = exports.getPrices = exports.getVotePda = exports.deriveClaimStatus = void 0;
|
16
16
|
const web3_js_1 = require("@solana/web3.js");
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
18
18
|
const constants_1 = require("./constants");
|
@@ -44,4 +44,23 @@ function getPrices(mints, vsMint) {
|
|
44
44
|
});
|
45
45
|
}
|
46
46
|
exports.getPrices = getPrices;
|
47
|
+
function getMergedAssets(assets) {
|
48
|
+
const assetByMint = new Map();
|
49
|
+
for (const asset of assets) {
|
50
|
+
if (asset.type !== 'token')
|
51
|
+
continue;
|
52
|
+
const { address } = asset.data;
|
53
|
+
const amountToAdd = asset.data.amount;
|
54
|
+
const existingAsset = assetByMint.get(address);
|
55
|
+
if (!existingAsset) {
|
56
|
+
assetByMint.set(address, asset);
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
existingAsset.data.amount += amountToAdd;
|
60
|
+
assetByMint.set(address, existingAsset);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
return Array.from(assetByMint.values());
|
64
|
+
}
|
65
|
+
exports.getMergedAssets = getMergedAssets;
|
47
66
|
//# sourceMappingURL=helpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAA6C;
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAA6C;AAE7C,2CAA0D;AAG1D,SAAgB,iBAAiB,CAC/B,QAAmB,EACnB,WAAsB,EACtB,SAAoB;IAEpB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,EACvE,SAAS,CACV,CAAC;AACJ,CAAC;AATD,8CASC;AAED,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QACrB,wBAAY,CAAC,OAAO,EAAE;QACtB,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;KAC/B,EACD,yBAAa,CACd,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,gCASC;AAED,SAAsB,SAAS,CAAC,KAAkB,EAAE,MAAiB;;QACnE,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CACzB,+BAA+B,EAC/B;YACE,MAAM,EAAE;gBACN,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AAjBD,0CAiBC"}
|
@@ -9,11 +9,13 @@ const custodiesJob_1 = __importDefault(require("./custodiesJob"));
|
|
9
9
|
const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
10
10
|
const voteFetcher_1 = __importDefault(require("./voteFetcher"));
|
11
11
|
const constants_1 = require("./constants");
|
12
|
+
const valueAverageFetcher_1 = __importDefault(require("./valueAverageFetcher"));
|
12
13
|
exports.platforms = [constants_1.jupiterPlatform];
|
13
14
|
exports.jobs = [custodiesJob_1.default];
|
14
15
|
exports.fetchers = [
|
15
16
|
perpetualFetcher_1.default,
|
16
17
|
airdropFetcher_1.default,
|
17
18
|
voteFetcher_1.default,
|
19
|
+
valueAverageFetcher_1.default,
|
18
20
|
];
|
19
21
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;AAC9C,gFAAwD;AAE3C,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC;AAC1C,QAAA,IAAI,GAAU,CAAC,sBAAY,CAAC,CAAC;AAC7B,QAAA,QAAQ,GAAc;IACjC,0BAAgB;IAChB,wBAAc;IACd,qBAAW;IACX,6BAAmB;CACpB,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@metaplex-foundation/js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export type ClaimStatus = {
|
6
|
+
buffer: Buffer;
|
7
|
+
claimant: PublicKey;
|
8
|
+
lockedAmount: BigNumber;
|
9
|
+
lockedAmountWithdrawn: BigNumber;
|
10
|
+
unlockedAmount: BigNumber;
|
11
|
+
closable: Buffer;
|
12
|
+
admin: PublicKey;
|
13
|
+
};
|
14
|
+
export declare const claimStatusStruct: BeetStruct<ClaimStatus, Partial<ClaimStatus>>;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.claimStatusStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../../utils/solana");
|
7
|
+
exports.claimStatusStruct = new beet_1.BeetStruct([
|
8
|
+
['buffer', (0, solana_1.blob)(8)],
|
9
|
+
['claimant', beet_solana_1.publicKey],
|
10
|
+
['lockedAmount', solana_1.u64],
|
11
|
+
['lockedAmountWithdrawn', solana_1.u64],
|
12
|
+
['unlockedAmount', solana_1.u64],
|
13
|
+
['closable', (0, solana_1.blob)(1)],
|
14
|
+
['admin', beet_solana_1.publicKey],
|
15
|
+
], (args) => args);
|
16
|
+
//# sourceMappingURL=aidrop.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"aidrop.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/structs/aidrop.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AAGvD,kEAA6D;AAC7D,kDAAkD;AAYrC,QAAA,iBAAiB,GAAG,IAAI,iBAAU,CAC7C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,uBAAuB,EAAE,YAAG,CAAC;IAC9B,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,UAAU,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACrB,CAAC,OAAO,EAAE,uBAAS,CAAC;CACrB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import BigNumber from 'bignumber.js';
|
4
|
+
import { PublicKey } from '@metaplex-foundation/js';
|
5
|
+
export type ValueAverage = {
|
6
|
+
buffer: Buffer;
|
7
|
+
isStale: boolean;
|
8
|
+
idx: BigNumber;
|
9
|
+
bump: number;
|
10
|
+
user: PublicKey;
|
11
|
+
inputMint: PublicKey;
|
12
|
+
outputMint: PublicKey;
|
13
|
+
incrementUsdcValue: BigNumber;
|
14
|
+
orderInterval: BigNumber;
|
15
|
+
inputVault: PublicKey;
|
16
|
+
outputVault: PublicKey;
|
17
|
+
autoWithdraw: boolean;
|
18
|
+
feeDataAccount: PublicKey;
|
19
|
+
referralFeeAccount: PublicKey;
|
20
|
+
createdAt: BigNumber;
|
21
|
+
inDeposited: BigNumber;
|
22
|
+
inLeft: BigNumber;
|
23
|
+
inUsed: BigNumber;
|
24
|
+
inWithdrawn: BigNumber;
|
25
|
+
outReceived: BigNumber;
|
26
|
+
outWithdrawn: BigNumber;
|
27
|
+
supposedUsdcValue: BigNumber;
|
28
|
+
nextOrderAt: BigNumber;
|
29
|
+
outBalanceBeforeSwap: BigNumber;
|
30
|
+
};
|
31
|
+
export declare const valueAverageStruct: BeetStruct<ValueAverage, Partial<ValueAverage>>;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.valueAverageStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../../utils/solana");
|
7
|
+
exports.valueAverageStruct = new beet_1.BeetStruct([
|
8
|
+
['buffer', (0, solana_1.blob)(8)],
|
9
|
+
['isStale', beet_1.bool],
|
10
|
+
['idx', solana_1.u64],
|
11
|
+
['bump', beet_1.u8],
|
12
|
+
['user', beet_solana_1.publicKey],
|
13
|
+
['inputMint', beet_solana_1.publicKey],
|
14
|
+
['outputMint', beet_solana_1.publicKey],
|
15
|
+
['incrementUsdcValue', solana_1.u64],
|
16
|
+
['orderInterval', solana_1.i64],
|
17
|
+
['inputVault', beet_solana_1.publicKey],
|
18
|
+
['outputVault', beet_solana_1.publicKey],
|
19
|
+
['autoWithdraw', beet_1.bool],
|
20
|
+
['feeDataAccount', beet_solana_1.publicKey],
|
21
|
+
['referralFeeAccount', beet_solana_1.publicKey],
|
22
|
+
['createdAt', solana_1.i64],
|
23
|
+
['inDeposited', solana_1.u64],
|
24
|
+
['inLeft', solana_1.u64],
|
25
|
+
['inUsed', solana_1.u64],
|
26
|
+
['inWithdrawn', solana_1.u64],
|
27
|
+
['outReceived', solana_1.u64],
|
28
|
+
['outWithdrawn', solana_1.u64],
|
29
|
+
['supposedUsdcValue', solana_1.u64],
|
30
|
+
['nextOrderAt', solana_1.i64],
|
31
|
+
['outBalanceBeforeSwap', solana_1.u64],
|
32
|
+
], (args) => args);
|
33
|
+
//# sourceMappingURL=valueAverage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"valueAverage.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/structs/valueAverage.ts"],"names":[],"mappings":";;;AAAA,oDAAiE;AACjE,kEAA6D;AAG7D,kDAAuD;AA6B1C,QAAA,kBAAkB,GAAG,IAAI,iBAAU,CAC9C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,SAAS,EAAE,WAAI,CAAC;IACjB,CAAC,KAAK,EAAE,YAAG,CAAC;IACZ,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,oBAAoB,EAAE,YAAG,CAAC;IAC3B,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,cAAc,EAAE,WAAI,CAAC;IACtB,CAAC,gBAAgB,EAAE,uBAAS,CAAC;IAC7B,CAAC,oBAAoB,EAAE,uBAAS,CAAC;IACjC,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,mBAAmB,EAAE,YAAG,CAAC;IAC1B,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,sBAAsB,EAAE,YAAG,CAAC;CAC9B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAoB,CAC/B,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@metaplex-foundation/js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export type Escrow = {
|
6
|
+
buffer: Buffer;
|
7
|
+
locker: PublicKey;
|
8
|
+
owner: PublicKey;
|
9
|
+
bump: number;
|
10
|
+
tokens: PublicKey;
|
11
|
+
amount: BigNumber;
|
12
|
+
escrowStartedAt: BigNumber;
|
13
|
+
escrowEndsAt: BigNumber;
|
14
|
+
voteDelegate: PublicKey;
|
15
|
+
isMaxLock: boolean;
|
16
|
+
buffers: BigNumber[];
|
17
|
+
};
|
18
|
+
export declare const escrowStruct: BeetStruct<Escrow, Partial<Escrow>>;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.escrowStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../../utils/solana");
|
7
|
+
exports.escrowStruct = new beet_1.BeetStruct([
|
8
|
+
['buffer', (0, solana_1.blob)(8)],
|
9
|
+
['locker', beet_solana_1.publicKey],
|
10
|
+
['owner', beet_solana_1.publicKey],
|
11
|
+
['bump', beet_1.u8],
|
12
|
+
['tokens', beet_solana_1.publicKey],
|
13
|
+
['amount', solana_1.u64],
|
14
|
+
['escrowStartedAt', solana_1.i64],
|
15
|
+
['escrowEndsAt', solana_1.i64],
|
16
|
+
['voteDelegate', beet_solana_1.publicKey],
|
17
|
+
['isMaxLock', beet_1.bool],
|
18
|
+
['buffers', (0, beet_1.uniformFixedSizeArray)(solana_1.u128, 10)],
|
19
|
+
], (args) => args);
|
20
|
+
//# sourceMappingURL=vote.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vote.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/structs/vote.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAG7D,kDAA6D;AAgBhD,QAAA,YAAY,GAAG,IAAI,iBAAU,CACxC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,cAAc,EAAE,uBAAS,CAAC;IAC3B,CAAC,WAAW,EAAE,WAAI,CAAC;IACnB,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,aAAI,EAAE,EAAE,CAAC,CAAC;CAC7C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAc,CACzB,CAAC"}
|
@@ -127,27 +127,3 @@ export type Position = {
|
|
127
127
|
bump: number;
|
128
128
|
};
|
129
129
|
export declare const positionStruct: BeetStruct<Position, Partial<Position>>;
|
130
|
-
export type ClaimStatus = {
|
131
|
-
buffer: Buffer;
|
132
|
-
claimant: PublicKey;
|
133
|
-
lockedAmount: BigNumber;
|
134
|
-
lockedAmountWithdrawn: BigNumber;
|
135
|
-
unlockedAmount: BigNumber;
|
136
|
-
closable: Buffer;
|
137
|
-
admin: PublicKey;
|
138
|
-
};
|
139
|
-
export declare const claimStatusStruct: BeetStruct<ClaimStatus, Partial<ClaimStatus>>;
|
140
|
-
export type Escrow = {
|
141
|
-
buffer: Buffer;
|
142
|
-
locker: PublicKey;
|
143
|
-
owner: PublicKey;
|
144
|
-
bump: number;
|
145
|
-
tokens: PublicKey;
|
146
|
-
amount: BigNumber;
|
147
|
-
escrowStartedAt: BigNumber;
|
148
|
-
escrowEndsAt: BigNumber;
|
149
|
-
voteDelegate: PublicKey;
|
150
|
-
isMaxLock: boolean;
|
151
|
-
buffers: BigNumber[];
|
152
|
-
};
|
153
|
-
export declare const escrowStruct: BeetStruct<Escrow, Partial<Escrow>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.positionStruct = exports.Side = exports.custodyStruct = exports.fundingRateStateStruct = exports.assetsStruct = exports.permissionsStruct = exports.pricingParamsStruct = exports.oracleParamsStruct = exports.OracleType = exports.perpetualPoolStruct = exports.feesStruct = exports.poolAprStruct = exports.limitStruct = 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");
|
@@ -120,26 +120,4 @@ exports.positionStruct = new beet_1.BeetStruct([
|
|
120
120
|
['lockedAmount', solana_1.u64],
|
121
121
|
['bump', beet_1.u8],
|
122
122
|
], (args) => args);
|
123
|
-
exports.claimStatusStruct = new beet_1.BeetStruct([
|
124
|
-
['buffer', (0, solana_1.blob)(8)],
|
125
|
-
['claimant', beet_solana_1.publicKey],
|
126
|
-
['lockedAmount', solana_1.u64],
|
127
|
-
['lockedAmountWithdrawn', solana_1.u64],
|
128
|
-
['unlockedAmount', solana_1.u64],
|
129
|
-
['closable', (0, solana_1.blob)(1)],
|
130
|
-
['admin', beet_solana_1.publicKey],
|
131
|
-
], (args) => args);
|
132
|
-
exports.escrowStruct = new beet_1.BeetStruct([
|
133
|
-
['buffer', (0, solana_1.blob)(8)],
|
134
|
-
['locker', beet_solana_1.publicKey],
|
135
|
-
['owner', beet_solana_1.publicKey],
|
136
|
-
['bump', beet_1.u8],
|
137
|
-
['tokens', beet_solana_1.publicKey],
|
138
|
-
['amount', solana_1.u64],
|
139
|
-
['escrowStartedAt', solana_1.i64],
|
140
|
-
['escrowEndsAt', solana_1.i64],
|
141
|
-
['voteDelegate', beet_solana_1.publicKey],
|
142
|
-
['isMaxLock', beet_1.bool],
|
143
|
-
['buffers', (0, beet_1.uniformFixedSizeArray)(solana_1.u128, 10)],
|
144
|
-
], (args) => args);
|
145
123
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AAGnC,kEAA6D;AAC7D,+CAA0D;AAQ7C,QAAA,WAAW,GAAG,IAAI,iBA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,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;CACrB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC;AAEF,IAAY,IAIX;AAJD,WAAY,IAAI;IACd,+BAAI,CAAA;IACJ,+BAAI,CAAA;IACJ,iCAAK,CAAA;AACP,CAAC,EAJW,IAAI,oBAAJ,IAAI,QAIf;AAoBY,QAAA,cAAc,GAAG,IAAI,iBAAU,CAC1C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,SAAS,EAAE,uBAAS,CAAC;IACtB,CAAC,mBAAmB,EAAE,uBAAS,CAAC;IAChC,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,OAAO,EAAE,YAAG,CAAC;IACd,CAAC,SAAS,EAAE,YAAG,CAAC;IAChB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,4BAA4B,EAAE,aAAI,CAAC;IACpC,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,MAAM,EAAE,SAAE,CAAC;CACb,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAgB,CAC3B,CAAC
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AAGnC,kEAA6D;AAC7D,+CAA0D;AAQ7C,QAAA,WAAW,GAAG,IAAI,iBAAU,CACvC;IACE,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,gBAAgB,EAAE,YAAG,CAA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,IAAY,IAIX;AAJD,WAAY,IAAI;IACd,+BAAI,CAAA;IACJ,+BAAI,CAAA;IACJ,iCAAK,CAAA;AACP,CAAC,EAJW,IAAI,oBAAJ,IAAI,QAIf;AAoBY,QAAA,cAAc,GAAG,IAAI,iBAAU,CAC1C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,SAAS,EAAE,uBAAS,CAAC;IACtB,CAAC,mBAAmB,EAAE,uBAAS,CAAC;IAChC,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,OAAO,EAAE,YAAG,CAAC;IACd,CAAC,SAAS,EAAE,YAAG,CAAC;IAChB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,4BAA4B,EAAE,aAAI,CAAC;IACpC,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,MAAM,EAAE,SAAE,CAAC;CACb,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAgB,CAC3B,CAAC"}
|
@@ -0,0 +1,62 @@
|
|
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 valueAverage_1 = require("./structs/valueAverage");
|
20
|
+
const filters_1 = require("./filters");
|
21
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
|
+
const helpers_1 = require("./helpers");
|
23
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
|
+
const client = (0, clients_1.getClientSolana)();
|
25
|
+
const valueAverageAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, valueAverage_1.valueAverageStruct, constants_1.valueAverageProgramId, (0, filters_1.valueAverageFilter)(owner));
|
26
|
+
if (valueAverageAccounts.length === 0)
|
27
|
+
return [];
|
28
|
+
const mints = new Set();
|
29
|
+
valueAverageAccounts.forEach((vA) => mints.add(vA.inputMint.toString()));
|
30
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.solana);
|
31
|
+
const tempAssets = [];
|
32
|
+
for (const account of valueAverageAccounts) {
|
33
|
+
const mint = account.inputMint.toString();
|
34
|
+
const tokenPrice = tokenPriceById.get(mint);
|
35
|
+
if (!tokenPrice || account.inLeft.isZero())
|
36
|
+
continue;
|
37
|
+
const amount = account.inLeft.dividedBy(Math.pow(10, tokenPrice.decimals));
|
38
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(mint, amount.toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice);
|
39
|
+
tempAssets.push(asset);
|
40
|
+
}
|
41
|
+
if (tempAssets.length === 0)
|
42
|
+
return [];
|
43
|
+
const assets = tempAssets.length > 20 ? (0, helpers_1.getMergedAssets)(tempAssets) : tempAssets;
|
44
|
+
return [
|
45
|
+
{
|
46
|
+
type: 'multiple',
|
47
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
48
|
+
platformId: constants_1.jupiterPlatform.id,
|
49
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
50
|
+
label: 'Deposit',
|
51
|
+
name: `VA Orders (${tempAssets.length})`,
|
52
|
+
data: { assets },
|
53
|
+
},
|
54
|
+
];
|
55
|
+
});
|
56
|
+
const fetcher = {
|
57
|
+
id: `${constants_1.platformId}-value-average`,
|
58
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
59
|
+
executor,
|
60
|
+
};
|
61
|
+
exports.default = fetcher;
|
62
|
+
//# sourceMappingURL=valueAverageFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"valueAverageFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/valueAverageFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAIqB;AACrB,iDAAsD;AACtD,+CAA8D;AAC9D,yDAA4D;AAC5D,uCAA+C;AAC/C,qGAA6E;AAC7E,uCAA4C;AAE5C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,oBAAoB,GAAG,MAAM,IAAA,iCAAwB,EACzD,MAAM,EACN,iCAAkB,EAClB,iCAAqB,EACrB,IAAA,4BAAkB,EAAC,KAAK,CAAC,CAC1B,CAAC;IACF,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjD,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,oBAAoB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,G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AAC,CAAC;YACzD,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,cAAc,UAAU,CAAC,MAAM,GAAG;YACxC,IAAI,EAAE,EAAE,MAAM,EAAE;SACjB;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,gBAAgB;IACjC,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -14,15 +14,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
16
|
const constants_1 = require("./constants");
|
17
|
-
const structs_1 = require("./structs");
|
18
17
|
const clients_1 = require("../../utils/clients");
|
19
18
|
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
20
19
|
const helpers_1 = require("./helpers");
|
21
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const vote_1 = require("./structs/vote");
|
22
22
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
23
|
const client = (0, clients_1.getClientSolana)();
|
24
24
|
const escrowPubkey = (0, helpers_1.getVotePda)(owner);
|
25
|
-
const escrowAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client,
|
25
|
+
const escrowAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, vote_1.escrowStruct, escrowPubkey);
|
26
26
|
if (!escrowAccount)
|
27
27
|
return [];
|
28
28
|
const jupTokenPrice = yield cache.getTokenPrice(constants_1.jupMint, portfolio_core_1.NetworkId.solana);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"voteFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/voteFetcher.ts"],"names":[],"mappings":";;;;;;;;;;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CAClD,CAAC;QACF,KAAK,CAAC,UAAU,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;IAC5D,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE;YACzB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -24,7 +24,6 @@ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/token
|
|
24
24
|
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
25
25
|
const constants_2 = require("../flexlend/constants");
|
26
26
|
const helpers_2 = require("../../utils/solana/pyth/helpers");
|
27
|
-
const helpers_3 = require("../flexlend/helpers");
|
28
27
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
29
28
|
const client = (0, clients_1.getClientSolana)();
|
30
29
|
const obligationAddresses = [];
|
@@ -52,11 +51,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
52
51
|
}
|
53
52
|
// Flexlend, only support the main pool on Solend
|
54
53
|
const marketSeed = constants_1.mainMarket.slice(0, 16);
|
55
|
-
const flexSeed = (0, helpers_3.getDerivedAccount)(owner).slice(0, 16);
|
56
54
|
const ownerSeed = owner.slice(0, 16);
|
57
|
-
const
|
58
|
-
const
|
59
|
-
const oldFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(constants_2.AUTOMATION_PUBLIC_KEY, oldObligationSeed, constants_1.pid);
|
55
|
+
const obligationSeed = ownerSeed + marketSeed;
|
56
|
+
const oldFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(constants_2.AUTOMATION_PUBLIC_KEY, obligationSeed, constants_1.pid);
|
60
57
|
const newFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), obligationSeed, constants_1.pid);
|
61
58
|
obligationAddresses.push(...[oldFlexlendObligAddress, newFlexlendObligAddress]);
|
62
59
|
const obligations = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.obligationStruct, obligationAddresses);
|