@sonarwatch/portfolio-plugins 0.14.6 → 0.14.7
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1616 -1612
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/debridge/dlmmVaultsFetcher.js.map +1 -1
- package/src/plugins/raydium/ammV2ApiJob.d.ts +3 -0
- package/src/plugins/raydium/ammV2ApiJob.js +122 -0
- package/src/plugins/raydium/ammV2ApiJob.js.map +1 -0
- package/src/plugins/raydium/constants.d.ts +1 -0
- package/src/plugins/raydium/constants.js +2 -1
- package/src/plugins/raydium/constants.js.map +1 -1
- package/src/plugins/raydium/index.js +2 -6
- package/src/plugins/raydium/index.js.map +1 -1
- package/src/plugins/raydium/lpTokensJob.js +35 -47
- package/src/plugins/raydium/lpTokensJob.js.map +1 -1
- package/src/plugins/raydium/types.d.ts +57 -0
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/zeta/airdropFetcher.js +14 -14
- 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
@@ -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;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dlmmVaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/debridge/dlmmVaultsFetcher.ts"],"names":[],"mappings":";AAAA,2BAA2B;AAC3B,mBAAmB;;;;;;;;;;;;;;AAEnB,+DAKoC;
|
1
|
+
{"version":3,"file":"dlmmVaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/debridge/dlmmVaultsFetcher.ts"],"names":[],"mappings":";AAAA,2BAA2B;AAC3B,mBAAmB;;;;;;;;;;;;;;AAEnB,+DAKoC;AAGpC,iDAAsD;AACtD,2CAA0E;AAC1E,+CAA8D;AAC9D,qGAA6E;AAC7E,8CAAiD;AAEjD,oDAAqD;AAErD,MAAM,OAAO,GAAG,KAAK,CAAC;AACtB,IAAI,IAAI,GAAkB,IAAI,CAAC;AAC/B,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/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AK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SAClD;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,122 @@
|
|
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 axios_1 = __importDefault(require("axios"));
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const getLpTokenSource_1 = require("../../utils/misc/getLpTokenSource");
|
20
|
+
const computeAndStoreLpPrice_1 = require("../../utils/misc/computeAndStoreLpPrice");
|
21
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
let apiRes;
|
23
|
+
let page = 1;
|
24
|
+
let subPools;
|
25
|
+
let tokenPriceById;
|
26
|
+
let lastLiquidity;
|
27
|
+
do {
|
28
|
+
apiRes = yield axios_1.default
|
29
|
+
.get(`${constants_1.apiV3}pools/info/list`, {
|
30
|
+
params: {
|
31
|
+
poolType: 'standard',
|
32
|
+
poolSortField: 'liquidity',
|
33
|
+
sortType: 'desc',
|
34
|
+
pageSize: 300,
|
35
|
+
page,
|
36
|
+
},
|
37
|
+
})
|
38
|
+
.catch((er) => {
|
39
|
+
throw new Error(`[Raydium AMM V2 Job] Unable to get pools info from APi. \n Error : ${er}`);
|
40
|
+
});
|
41
|
+
if (apiRes.data.data.count === 0)
|
42
|
+
return;
|
43
|
+
subPools = apiRes.data.data;
|
44
|
+
lastLiquidity = subPools.data[subPools.count - 1].tvl;
|
45
|
+
tokenPriceById = yield cache.getTokenPricesAsMap(subPools.data
|
46
|
+
.map((pool) => [pool.mintA.address, pool.mintB.address])
|
47
|
+
.flat(), portfolio_core_1.NetworkId.solana);
|
48
|
+
let poolInfo;
|
49
|
+
let lpSupply;
|
50
|
+
let mintA;
|
51
|
+
let mintB;
|
52
|
+
let lpMint;
|
53
|
+
let decimalsA;
|
54
|
+
let decimalsB;
|
55
|
+
let lpDecimals;
|
56
|
+
let tokenAmountA;
|
57
|
+
let tokenAmountB;
|
58
|
+
let tokenPriceA;
|
59
|
+
let tokenPriceB;
|
60
|
+
const tokenPriceSources = [];
|
61
|
+
for (let id = 0; id < subPools.data.length; id++) {
|
62
|
+
poolInfo = subPools.data[id];
|
63
|
+
lpSupply = new bignumber_js_1.default(poolInfo.lpAmount);
|
64
|
+
if (lpSupply.isZero())
|
65
|
+
continue;
|
66
|
+
if ((0, bignumber_js_1.default)(poolInfo.tvl).isLessThan(computeAndStoreLpPrice_1.minimumLiquidity))
|
67
|
+
continue;
|
68
|
+
mintA = poolInfo.mintA.address;
|
69
|
+
mintB = poolInfo.mintB.address;
|
70
|
+
lpMint = poolInfo.lpMint.address;
|
71
|
+
[decimalsA, decimalsB, lpDecimals] = [
|
72
|
+
poolInfo.mintA.decimals,
|
73
|
+
poolInfo.mintB.decimals,
|
74
|
+
poolInfo.lpMint.decimals,
|
75
|
+
];
|
76
|
+
if (!decimalsA || !decimalsB || !lpDecimals)
|
77
|
+
continue;
|
78
|
+
tokenAmountA = poolInfo.mintAmountA;
|
79
|
+
tokenAmountB = poolInfo.mintAmountB;
|
80
|
+
[tokenPriceA, tokenPriceB] = [
|
81
|
+
tokenPriceById.get(mintA),
|
82
|
+
tokenPriceById.get(mintB),
|
83
|
+
];
|
84
|
+
tokenPriceSources.push(...(0, getLpTokenSource_1.getLpTokenSource)({
|
85
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
86
|
+
sourceId: lpMint.toString(),
|
87
|
+
platformId: constants_1.platformId,
|
88
|
+
priceUnderlyings: true,
|
89
|
+
lpDetails: {
|
90
|
+
address: lpMint.toString(),
|
91
|
+
decimals: lpDecimals,
|
92
|
+
supply: lpSupply.toNumber(),
|
93
|
+
},
|
94
|
+
poolUnderlyings: [
|
95
|
+
{
|
96
|
+
address: mintA,
|
97
|
+
decimals: decimalsA,
|
98
|
+
reserveAmount: tokenAmountA,
|
99
|
+
tokenPrice: tokenPriceA,
|
100
|
+
weight: 0.5,
|
101
|
+
},
|
102
|
+
{
|
103
|
+
address: mintB,
|
104
|
+
decimals: decimalsB,
|
105
|
+
reserveAmount: tokenAmountB,
|
106
|
+
tokenPrice: tokenPriceB,
|
107
|
+
weight: 0.5,
|
108
|
+
},
|
109
|
+
],
|
110
|
+
}));
|
111
|
+
}
|
112
|
+
yield cache.setTokenPriceSources(tokenPriceSources);
|
113
|
+
page += 1;
|
114
|
+
} while (subPools.hasNextPage && computeAndStoreLpPrice_1.minimumLiquidity.isLessThan(lastLiquidity));
|
115
|
+
});
|
116
|
+
const job = {
|
117
|
+
id: `${constants_1.platformId}-lp-tokens-api`,
|
118
|
+
executor,
|
119
|
+
label: 'normal',
|
120
|
+
};
|
121
|
+
exports.default = job;
|
122
|
+
//# sourceMappingURL=amm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AG,CAAC"}
|
@@ -2,6 +2,7 @@ import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { Platform } from '@sonarwatch/portfolio-core';
|
3
3
|
export declare const platformId = "raydium";
|
4
4
|
export declare const platform: Platform;
|
5
|
+
export declare const apiV3 = "https://api-v3.raydium.io/";
|
5
6
|
export declare const AMM_PROGRAM_ID_V3: PublicKey;
|
6
7
|
export declare const AMM_PROGRAM_ID_V4: PublicKey;
|
7
8
|
export declare const AMM_PROGRAM_ID_V5: PublicKey;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.rayDecimals = exports.rayMint = exports.positionsIdentifier = exports.cpmmProgramId = exports.raydiumProgram = exports.AMM_PROGRAM_ID_V5 = exports.AMM_PROGRAM_ID_V4 = exports.AMM_PROGRAM_ID_V3 = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.rayDecimals = exports.rayMint = exports.positionsIdentifier = exports.cpmmProgramId = exports.raydiumProgram = exports.AMM_PROGRAM_ID_V5 = exports.AMM_PROGRAM_ID_V4 = exports.AMM_PROGRAM_ID_V3 = exports.apiV3 = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'raydium';
|
6
6
|
exports.platform = {
|
@@ -10,6 +10,7 @@ exports.platform = {
|
|
10
10
|
defiLlamaId: 'raydium',
|
11
11
|
website: 'https://raydium.io/',
|
12
12
|
};
|
13
|
+
exports.apiV3 = 'https://api-v3.raydium.io/';
|
13
14
|
exports.AMM_PROGRAM_ID_V3 = new web3_js_1.PublicKey('EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q');
|
14
15
|
exports.AMM_PROGRAM_ID_V4 = new web3_js_1.PublicKey('675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8');
|
15
16
|
exports.AMM_PROGRAM_ID_V5 = new web3_js_1.PublicKey('5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/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,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/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,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEW,QAAA,KAAK,GAAG,4BAA4B,CAAC;AAErC,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AACW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,mBAAmB,GAAG,gCAAgC,CAAC;AAEvD,QAAA,OAAO,GAAG,8CAA8C,CAAC;AACzD,QAAA,WAAW,GAAG,CAAC,CAAC"}
|
@@ -5,17 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
// import lpTokensJob from './lpTokensJob';
|
8
|
+
const ammV2ApiJob_1 = __importDefault(require("./ammV2ApiJob"));
|
8
9
|
const clmmJob_1 = __importDefault(require("./clmmJob"));
|
9
10
|
const cpmmJob_1 = __importDefault(require("./cpmmJob"));
|
10
11
|
const farmsJob_1 = __importDefault(require("./farmsJob"));
|
11
12
|
const constants_1 = require("./constants");
|
12
13
|
const farmsFetcher_1 = __importDefault(require("./farmsFetcher"));
|
13
14
|
exports.platforms = [constants_1.platform];
|
14
|
-
exports.jobs = [
|
15
|
-
// lpTokensJob,
|
16
|
-
farmsJob_1.default,
|
17
|
-
clmmJob_1.default,
|
18
|
-
cpmmJob_1.default,
|
19
|
-
];
|
15
|
+
exports.jobs = [ammV2ApiJob_1.default, farmsJob_1.default, clmmJob_1.default, cpmmJob_1.default];
|
20
16
|
exports.fetchers = [farmsFetcher_1.default];
|
21
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAA2C;AAC3C,wDAAgC;AAChC,wDAAgC;AAChC,0DAAkC;AAClC,2CAAuC;AACvC,kEAA0C;AAE7B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAA2C;AAC3C,gEAA2C;AAC3C,wDAAgC;AAChC,wDAAgC;AAChC,0DAAkC;AAClC,2CAAuC;AACvC,kEAA0C;AAE7B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,qBAAc,EAAE,kBAAQ,EAAE,iBAAO,EAAE,iBAAO,CAAC,CAAC;AAC3D,QAAA,QAAQ,GAAc,CAAC,sBAAY,CAAC,CAAC"}
|
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
13
|
const clients_1 = require("../../utils/clients");
|
@@ -20,9 +17,8 @@ const solana_1 = require("../../utils/solana");
|
|
20
17
|
const filters_1 = require("./filters");
|
21
18
|
const types_1 = require("./types");
|
22
19
|
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
23
|
-
const getLpUnderlyingTokenSourceOld_1 = __importDefault(require("../../utils/misc/getLpUnderlyingTokenSourceOld"));
|
24
|
-
const getLpTokenSourceRawOld_1 = __importDefault(require("../../utils/misc/getLpTokenSourceRawOld"));
|
25
20
|
const constants_2 = require("../orders/clobs-solana/constants");
|
21
|
+
const getLpTokenSourceRaw_1 = require("../../utils/misc/getLpTokenSourceRaw");
|
26
22
|
const ammsDetails = [
|
27
23
|
{
|
28
24
|
versionId: 4,
|
@@ -31,13 +27,13 @@ const ammsDetails = [
|
|
31
27
|
filters: filters_1.ammV4Filter,
|
32
28
|
name: 'Pools V4',
|
33
29
|
},
|
34
|
-
{
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
30
|
+
// {
|
31
|
+
// versionId: 5,
|
32
|
+
// struct: ammInfoV5Struct,
|
33
|
+
// programId: AMM_PROGRAM_ID_V5,
|
34
|
+
// filters: ammV5Filter,
|
35
|
+
// name: 'Pools V5',
|
36
|
+
// },
|
41
37
|
];
|
42
38
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
43
39
|
const client = (0, clients_1.getClientSolana)();
|
@@ -133,24 +129,6 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
129
|
tokenPrices.get(mintB),
|
134
130
|
];
|
135
131
|
const lpMint = amm.lpMintAddress;
|
136
|
-
const underlyingSource = (0, getLpUnderlyingTokenSourceOld_1.default)(lpMint.toString(), portfolio_core_1.NetworkId.solana, {
|
137
|
-
address: mintA,
|
138
|
-
decimals: decimalsA,
|
139
|
-
reserveAmountRaw: tokenAmountA,
|
140
|
-
tokenPrice: tokenPriceA,
|
141
|
-
weight: 0.5,
|
142
|
-
}, {
|
143
|
-
address: mintB,
|
144
|
-
decimals: decimalsB,
|
145
|
-
reserveAmountRaw: tokenAmountB,
|
146
|
-
tokenPrice: tokenPriceB,
|
147
|
-
weight: 0.5,
|
148
|
-
});
|
149
|
-
if (underlyingSource) {
|
150
|
-
yield cache.setTokenPriceSource(underlyingSource);
|
151
|
-
}
|
152
|
-
if (!tokenPriceB || !tokenPriceA)
|
153
|
-
continue;
|
154
132
|
const lpMintAccount = mintAccountsMap.get(lpMint.toString());
|
155
133
|
if (!lpMintAccount)
|
156
134
|
continue;
|
@@ -158,24 +136,34 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
158
136
|
const lpSupply = amm.lpAmount;
|
159
137
|
if (lpSupply.isZero())
|
160
138
|
continue;
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
{
|
167
|
-
address:
|
168
|
-
decimals:
|
169
|
-
|
170
|
-
reserveAmountRaw: tokenAmountA,
|
171
|
-
},
|
172
|
-
{
|
173
|
-
address: tokenPriceB.address,
|
174
|
-
decimals: tokenPriceB.decimals,
|
175
|
-
price: tokenPriceB.price,
|
176
|
-
reserveAmountRaw: tokenAmountB,
|
139
|
+
const tokenSources = (0, getLpTokenSourceRaw_1.getLpTokenSourceRaw)({
|
140
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
141
|
+
sourceId: lpMint.toString(),
|
142
|
+
platformId: constants_1.platformId,
|
143
|
+
priceUnderlyings: true,
|
144
|
+
lpDetails: {
|
145
|
+
address: lpMint.toString(),
|
146
|
+
decimals: lpDecimals,
|
147
|
+
supplyRaw: lpSupply,
|
177
148
|
},
|
178
|
-
|
149
|
+
poolUnderlyingsRaw: [
|
150
|
+
{
|
151
|
+
address: mintA,
|
152
|
+
decimals: decimalsA,
|
153
|
+
reserveAmountRaw: tokenAmountA,
|
154
|
+
tokenPrice: tokenPriceA,
|
155
|
+
weight: 0.5,
|
156
|
+
},
|
157
|
+
{
|
158
|
+
address: mintB,
|
159
|
+
decimals: decimalsB,
|
160
|
+
reserveAmountRaw: tokenAmountB,
|
161
|
+
tokenPrice: tokenPriceB,
|
162
|
+
weight: 0.5,
|
163
|
+
},
|
164
|
+
],
|
165
|
+
});
|
166
|
+
tokenPriceSources.push(...tokenSources);
|
179
167
|
}
|
180
168
|
}
|
181
169
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lpTokensJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/lpTokensJob.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"lpTokensJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/lpTokensJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAIvD,iDAAsD;AACtD,2CAA+E;AAC/E,yCAAkE;AAClE,+CAK4B;AAC5B,uCAAqD;AACrD,mCAA8C;AAC9C,gGAA6F;AAE7F,gEAA0E;AAC1E,8EAA2E;AAE3E,MAAM,WAAW,G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AAY,GAAG,IAAA,yCAAmB,EAAC;oBACvC,SAAS,EAAE,0BAAS,CAAC,MAAM;oBAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;oBAC3B,UAAU,EAAV,sBAAU;oBACV,gBAAgB,EAAE,IAAI;oBACtB,SAAS,EAAE;wBACT,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE;wBAC1B,QAAQ,EAAE,UAAU;wBACpB,SAAS,EAAE,QAAQ;qBACpB;oBACD,kBAAkB,EAAE;wBAClB;4BACE,OAAO,EAAE,KAAK;4BACd,QAAQ,EAAE,SAAS;4BACnB,gBAAgB,EAAE,YAAY;4BAC9B,UAAU,EAAE,WAAW;4BACvB,MAAM,EAAE,GAAG;yBACZ;wBACD;4BACE,OAAO,EAAE,KAAK;4BACd,QAAQ,EAAE,SAAS;4BACnB,gBAAgB,EAAE,YAAY;4BAC9B,UAAU,EAAE,WAAW;4BACvB,MAAM,EAAE,GAAG;yBACZ;qBACF;iBACF,CAAC,CAAC;gBAEH,iBAAiB,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AACtD,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -178,3 +178,60 @@ export type Tick = {
|
|
178
178
|
feeGrowthOutsideX64B: BN;
|
179
179
|
rewardGrowthsOutsideX64: BN[];
|
180
180
|
};
|
181
|
+
export type ApiV3Response = {
|
182
|
+
id: string;
|
183
|
+
success: boolean;
|
184
|
+
data: {
|
185
|
+
count: number;
|
186
|
+
data: PoolInfo[];
|
187
|
+
hasNextPage: boolean;
|
188
|
+
};
|
189
|
+
};
|
190
|
+
export type PoolInfo = {
|
191
|
+
type: string;
|
192
|
+
programId: string;
|
193
|
+
id: string;
|
194
|
+
mintA: LpMint;
|
195
|
+
mintB: LpMint;
|
196
|
+
price: number;
|
197
|
+
mintAmountA: number;
|
198
|
+
mintAmountB: number;
|
199
|
+
feeRate: number;
|
200
|
+
openTime: string;
|
201
|
+
tvl: number;
|
202
|
+
day: Day;
|
203
|
+
week: Day;
|
204
|
+
month: Day;
|
205
|
+
pooltype: string[];
|
206
|
+
rewardDefaultInfos: number[];
|
207
|
+
farmUpcomingCount: number;
|
208
|
+
farmOngoingCount: number;
|
209
|
+
farmFinishedCount: number;
|
210
|
+
marketId: string;
|
211
|
+
lpMint: LpMint;
|
212
|
+
lpPrice: number;
|
213
|
+
lpAmount: number;
|
214
|
+
burnPercent: number;
|
215
|
+
};
|
216
|
+
export type Day = {
|
217
|
+
volume: number;
|
218
|
+
volumeQuote: number;
|
219
|
+
volumeFee: number;
|
220
|
+
apr: number;
|
221
|
+
feeApr: number;
|
222
|
+
priceMin: number;
|
223
|
+
priceMax: number;
|
224
|
+
rewardApr: number[];
|
225
|
+
};
|
226
|
+
export type LpMint = {
|
227
|
+
chainId: number;
|
228
|
+
address: string;
|
229
|
+
programId: string;
|
230
|
+
logoURI: string;
|
231
|
+
symbol: string;
|
232
|
+
name: string;
|
233
|
+
decimals: number;
|
234
|
+
tags: string[];
|
235
|
+
extensions: Extensions;
|
236
|
+
};
|
237
|
+
export type Extensions = object;
|
@@ -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;
|
@@ -42,20 +42,20 @@ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/token
|
|
42
42
|
const clients_1 = require("../../utils/clients");
|
43
43
|
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
44
44
|
const helpers_1 = require("./helpers");
|
45
|
-
const query = (0, graphql_request_1.gql) `
|
46
|
-
query GetAirdropFinalFrontend($authority: String!) {
|
47
|
-
getAirdropFinalFrontend(authority: $authority) {
|
48
|
-
authority
|
49
|
-
community_allocation
|
50
|
-
eligibility
|
51
|
-
main_allocation
|
52
|
-
og_allocation
|
53
|
-
s1_allocation
|
54
|
-
s2_allocation
|
55
|
-
total_allocation
|
56
|
-
__typename
|
57
|
-
}
|
58
|
-
}
|
45
|
+
const query = (0, graphql_request_1.gql) `
|
46
|
+
query GetAirdropFinalFrontend($authority: String!) {
|
47
|
+
getAirdropFinalFrontend(authority: $authority) {
|
48
|
+
authority
|
49
|
+
community_allocation
|
50
|
+
eligibility
|
51
|
+
main_allocation
|
52
|
+
og_allocation
|
53
|
+
s1_allocation
|
54
|
+
s2_allocation
|
55
|
+
total_allocation
|
56
|
+
__typename
|
57
|
+
}
|
58
|
+
}
|
59
59
|
`;
|
60
60
|
const networkId = portfolio_core_1.NetworkId.solana;
|
61
61
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|