@sonarwatch/portfolio-plugins 0.11.128 → 0.11.130
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1239 -1231
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/abex/marketsJob.js +2 -2
- package/src/plugins/abex/marketsJob.js.map +1 -1
- package/src/plugins/aftermath/poolsJob.js +2 -2
- package/src/plugins/aftermath/poolsJob.js.map +1 -1
- package/src/plugins/atrix/poolsV1Job.js +1 -1
- package/src/plugins/atrix/poolsV1Job.js.map +1 -1
- package/src/plugins/auxexchange/aptosLpJob.js +2 -2
- package/src/plugins/auxexchange/aptosLpJob.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/bskt/vestingFetcher.js +1 -0
- package/src/plugins/bskt/vestingFetcher.js.map +1 -1
- package/src/plugins/flexlend/depositsFetcher.js +8 -4
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/fluxbeam/poolsJob.js +2 -2
- package/src/plugins/fluxbeam/poolsJob.js.map +1 -1
- package/src/plugins/jupiter/helpers.d.ts +1 -1
- package/src/plugins/jupiter/helpers.js +3 -3
- package/src/plugins/jupiter/helpers.js.map +1 -1
- package/src/plugins/jupiter/index.js +0 -2
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/kai/vaultsJob.js +2 -2
- package/src/plugins/kai/vaultsJob.js.map +1 -1
- package/src/plugins/lifinity/xLfntyJob.js +4 -4
- package/src/plugins/lifinity/xLfntyJob.js.map +1 -1
- package/src/plugins/liquiditypools-sei/job.js +2 -2
- package/src/plugins/liquiditypools-sei/job.js.map +1 -1
- package/src/plugins/liquidswap/aptosLpJob.js +2 -2
- package/src/plugins/liquidswap/aptosLpJob.js.map +1 -1
- package/src/plugins/meteora/poolsJob.js +2 -2
- package/src/plugins/meteora/poolsJob.js.map +1 -1
- package/src/plugins/orca/lpTokensJob.js +2 -2
- package/src/plugins/orca/lpTokensJob.js.map +1 -1
- package/src/plugins/pancakeswap/aptosLpJob.js +2 -2
- package/src/plugins/pancakeswap/aptosLpJob.js.map +1 -1
- package/src/plugins/raydium/lpTokensJob.js +2 -2
- package/src/plugins/raydium/lpTokensJob.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +1 -10
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/aptos/poolsJob.js +2 -2
- package/src/plugins/sushiswap/aptos/poolsJob.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/symmetry/basketsJob.js +16 -12
- package/src/plugins/symmetry/basketsJob.js.map +1 -1
- package/src/plugins/symmetry/helpers.d.ts +2 -0
- package/src/plugins/symmetry/helpers.js +9 -0
- package/src/plugins/symmetry/helpers.js.map +1 -0
- package/src/plugins/symmetry/structs.d.ts +5 -1
- package/src/plugins/symmetry/structs.js +7 -2
- package/src/plugins/symmetry/structs.js.map +1 -1
- package/src/plugins/tokens/fetchers/aptos.js +1 -0
- package/src/plugins/tokens/fetchers/aptos.js.map +1 -1
- package/src/plugins/tokens/fetchers/sui.js +1 -0
- package/src/plugins/tokens/fetchers/sui.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/misc/getLpTokenSource.d.ts +1 -1
- package/src/utils/misc/getLpTokenSource.js +2 -1
- package/src/utils/misc/getLpTokenSource.js.map +1 -1
- package/src/utils/misc/getLpTokenSourceRaw.d.ts +1 -1
- package/src/utils/misc/getLpTokenSourceRaw.js +3 -3
- package/src/utils/misc/getLpTokenSourceRaw.js.map +1 -1
- package/src/utils/misc/tokenPriceToLiquidity.js +1 -0
- package/src/utils/misc/tokenPriceToLiquidity.js.map +1 -1
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/solana/getDecimals.d.ts +3 -0
- package/src/utils/solana/getDecimals.js +26 -0
- package/src/utils/solana/getDecimals.js.map +1 -0
- package/src/utils/solana/getMultipleDecimals.d.ts +3 -0
- package/src/utils/solana/getMultipleDecimals.js +32 -0
- package/src/utils/solana/getMultipleDecimals.js.map +1 -0
- package/src/plugins/jupiter/testFetcher.d.ts +0 -3
- package/src/plugins/jupiter/testFetcher.js +0 -77
- package/src/plugins/jupiter/testFetcher.js.map +0 -1
@@ -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;
|
@@ -10,5 +10,5 @@ type LpDetails = {
|
|
10
10
|
decimals: number;
|
11
11
|
supply: number;
|
12
12
|
};
|
13
|
-
export default function getLpTokenSource(networkId: NetworkIdType, sourceId: string, platformId: string,
|
13
|
+
export default function getLpTokenSource(networkId: NetworkIdType, sourceId: string, platformId: string, lpDetails: LpDetails, poolUnderlyings: PoolUnderlying[], elementName?: string, liquidityName?: string): TokenPriceSource;
|
14
14
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
function getLpTokenSource(networkId, sourceId, platformId,
|
3
|
+
function getLpTokenSource(networkId, sourceId, platformId, lpDetails, poolUnderlyings, elementName, liquidityName) {
|
4
4
|
const price = poolUnderlyings.reduce((acc, u) => acc + u.reserveAmount * u.price, 0) /
|
5
5
|
lpDetails.supply;
|
6
6
|
return {
|
@@ -8,6 +8,7 @@ function getLpTokenSource(networkId, sourceId, platformId, elementName, lpDetail
|
|
8
8
|
platformId,
|
9
9
|
id: sourceId,
|
10
10
|
elementName,
|
11
|
+
liquidityName,
|
11
12
|
weight: 1,
|
12
13
|
address: lpDetails.address,
|
13
14
|
price,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSource.ts"],"names":[],"mappings":";;AAeA,SAAwB,gBAAgB,CACtC,SAAwB,EACxB,QAAgB,EAChB,UAAkB,EAClB,
|
1
|
+
{"version":3,"file":"getLpTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSource.ts"],"names":[],"mappings":";;AAeA,SAAwB,gBAAgB,CACtC,SAAwB,EACxB,QAAgB,EAChB,UAAkB,EAClB,SAAoB,EACpB,eAAiC,EACjC,WAAoB,EACpB,aAAsB;IAEtB,MAAM,KAAK,GACT,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACtE,SAAS,CAAC,MAAM,CAAC;IAEnB,OAAO;QACL,SAAS;QACT,UAAU;QACV,EAAE,EAAE,QAAQ;QACZ,WAAW;QACX,aAAa;QACb,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,KAAK;QACL,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,WAAW,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,SAAS;YACT,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,WAAW,EAAE,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC,MAAM;YAC/C,QAAQ,EAAE,CAAC,CAAC,QAAQ;SACrB,CAAC,CAAC;QACH,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC;AAhCD,mCAgCC"}
|
@@ -11,5 +11,5 @@ type LpDetailsRaw = {
|
|
11
11
|
decimals: number;
|
12
12
|
supplyRaw: BigNumber;
|
13
13
|
};
|
14
|
-
export default function getLpTokenSourceRaw(networkId: NetworkIdType, sourceId: string, platformId: string,
|
14
|
+
export default function getLpTokenSourceRaw(networkId: NetworkIdType, sourceId: string, platformId: string, lpDetailsRaw: LpDetailsRaw, poolUnderlyingsRaw: PoolUnderlyingRaw[], elementName?: string, liquidityName?: string): TokenPriceSource;
|
15
15
|
export {};
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const getLpTokenSource_1 = __importDefault(require("./getLpTokenSource"));
|
7
|
-
function getLpTokenSourceRaw(networkId, sourceId, platformId,
|
8
|
-
return (0, getLpTokenSource_1.default)(networkId, sourceId, platformId,
|
7
|
+
function getLpTokenSourceRaw(networkId, sourceId, platformId, lpDetailsRaw, poolUnderlyingsRaw, elementName, liquidityName) {
|
8
|
+
return (0, getLpTokenSource_1.default)(networkId, sourceId, platformId, Object.assign(Object.assign({}, lpDetailsRaw), { supply: lpDetailsRaw.supplyRaw
|
9
9
|
.div(Math.pow(10, lpDetailsRaw.decimals))
|
10
|
-
.toNumber() }), poolUnderlyingsRaw.map((u) => (Object.assign(Object.assign({}, u), { reserveAmount: u.reserveAmountRaw.div(Math.pow(10, u.decimals)).toNumber() }))));
|
10
|
+
.toNumber() }), poolUnderlyingsRaw.map((u) => (Object.assign(Object.assign({}, u), { reserveAmount: u.reserveAmountRaw.div(Math.pow(10, u.decimals)).toNumber() }))), elementName, liquidityName);
|
11
11
|
}
|
12
12
|
exports.default = getLpTokenSourceRaw;
|
13
13
|
//# sourceMappingURL=getLpTokenSourceRaw.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":";;;;;AAEA,0EAAkD;AAelD,SAAwB,mBAAmB,CACzC,SAAwB,EACxB,QAAgB,EAChB,UAAkB,EAClB,
|
1
|
+
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":";;;;;AAEA,0EAAkD;AAelD,SAAwB,mBAAmB,CACzC,SAAwB,EACxB,QAAgB,EAChB,UAAkB,EAClB,YAA0B,EAC1B,kBAAuC,EACvC,WAAoB,EACpB,aAAsB;IAEtB,OAAO,IAAA,0BAAgB,EACrB,SAAS,EACT,QAAQ,EACR,UAAU,kCAEL,YAAY,KACf,MAAM,EAAE,YAAY,CAAC,SAAS;aAC3B,GAAG,CAAC,SAAA,EAAE,EAAI,YAAY,CAAC,QAAQ,CAAA,CAAC;aAChC,QAAQ,EAAE,KAEf,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCACzB,CAAC,KACJ,aAAa,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAA,EAAE,EAAI,CAAC,CAAC,QAAQ,CAAA,CAAC,CAAC,QAAQ,EAAE,IAClE,CAAC,EACH,WAAW,EACX,aAAa,CACd,CAAC;AACJ,CAAC;AA1BD,sCA0BC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tokenPriceToLiquidity.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/tokenPriceToLiquidity.ts"],"names":[],"mappings":";;;;;AAAA,+DAKoC;AACpC,wFAAgE;AAEhE,SAAwB,qBAAqB,CAC3C,OAAe,EACf,MAAc,EACd,SAAwB,EACxB,UAAsB;IAEtB,MAAM,MAAM,GAAG,IAAA,iCAAuB,EACpC,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,CACX,CAAC;IACF,MAAM,SAAS,GAAuB;QACpC,MAAM;QACN,WAAW,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvD,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,CAAC;QACpB,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjD,MAAM,EAAE,EAAE;
|
1
|
+
{"version":3,"file":"tokenPriceToLiquidity.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/tokenPriceToLiquidity.ts"],"names":[],"mappings":";;;;;AAAA,+DAKoC;AACpC,wFAAgE;AAEhE,SAAwB,qBAAqB,CAC3C,OAAe,EACf,MAAc,EACd,SAAwB,EACxB,UAAsB;IAEtB,MAAM,MAAM,GAAG,IAAA,iCAAuB,EACpC,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,CACX,CAAC;IACF,MAAM,SAAS,GAAuB;QACpC,MAAM;QACN,WAAW,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvD,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,CAAC;QACpB,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,UAAU,CAAC,aAAa;KAC/B,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAtBD,wCAsBC"}
|
@@ -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;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.getDecimals = void 0;
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const getParsedAccountInfo_1 = require("./getParsedAccountInfo");
|
15
|
+
const structs_1 = require("./structs");
|
16
|
+
const solMints = [portfolio_core_1.solanaNativeAddress, portfolio_core_1.solanaNativeWrappedAddress];
|
17
|
+
function getDecimals(connection, mint) {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
if (solMints.includes(mint.toString()))
|
20
|
+
return portfolio_core_1.solanaNativeDecimals;
|
21
|
+
const mintAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(connection, structs_1.mintAccountStruct, mint);
|
22
|
+
return (mintAccount === null || mintAccount === void 0 ? void 0 : mintAccount.decimals) || null;
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.getDecimals = getDecimals;
|
26
|
+
//# sourceMappingURL=getDecimals.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getDecimals.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getDecimals.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+DAIoC;AAEpC,iEAA8D;AAC9D,uCAA8C;AAE9C,MAAM,QAAQ,GAAG,CAAC,oCAAmB,EAAE,2CAA0B,CAAC,CAAC;AAEnE,SAAsB,WAAW,CAC/B,UAAwB,EACxB,IAAe;;QAEf,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAAE,OAAO,qCAAoB,CAAC;QAEpE,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAoB,EAC5C,UAAU,EACV,2BAAiB,EACjB,IAAI,CACL,CAAC;QACF,OAAO,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,KAAI,IAAI,CAAC;IACvC,CAAC;CAAA;AAZD,kCAYC"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.getMultipleDecimals = void 0;
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const structs_1 = require("./structs");
|
15
|
+
const getParsedMultipleAccountsInfo_1 = require("./getParsedMultipleAccountsInfo");
|
16
|
+
const solMints = [portfolio_core_1.solanaNativeAddress, portfolio_core_1.solanaNativeWrappedAddress];
|
17
|
+
function getMultipleDecimals(connection, mints) {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
const mintAccounts = yield (0, getParsedMultipleAccountsInfo_1.getParsedMultipleAccountsInfo)(connection, structs_1.mintAccountStruct, mints.filter((m) => solMints.includes(m.toString())));
|
20
|
+
const decimalsMap = new Map();
|
21
|
+
decimalsMap.set(portfolio_core_1.solanaNativeAddress, portfolio_core_1.solanaNativeDecimals);
|
22
|
+
decimalsMap.set(portfolio_core_1.solanaNativeWrappedAddress, portfolio_core_1.solanaNativeDecimals);
|
23
|
+
mintAccounts.forEach((acc) => {
|
24
|
+
if (!acc)
|
25
|
+
return;
|
26
|
+
decimalsMap.set(acc.pubkey.toString(), acc.decimals);
|
27
|
+
});
|
28
|
+
return mints.map((m) => decimalsMap.get(m.toString()) || null);
|
29
|
+
});
|
30
|
+
}
|
31
|
+
exports.getMultipleDecimals = getMultipleDecimals;
|
32
|
+
//# sourceMappingURL=getMultipleDecimals.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getMultipleDecimals.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getMultipleDecimals.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+DAIoC;AAEpC,uCAA8C;AAC9C,mFAAgF;AAEhF,MAAM,QAAQ,GAAG,CAAC,oCAAmB,EAAE,2CAA0B,CAAC,CAAC;AAEnE,SAAsB,mBAAmB,CACvC,UAAwB,EACxB,KAAkB;;QAElB,MAAM,YAAY,GAAG,MAAM,IAAA,6DAA6B,EACtD,UAAU,EACV,2BAAiB,EACjB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CACrD,CAAC;QACF,MAAM,WAAW,GAAwB,IAAI,GAAG,EAAE,CAAC;QACnD,WAAW,CAAC,GAAG,CAAC,oCAAmB,EAAE,qCAAoB,CAAC,CAAC;QAC3D,WAAW,CAAC,GAAG,CAAC,2CAA0B,EAAE,qCAAoB,CAAC,CAAC;QAClE,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAC3B,IAAI,CAAC,GAAG;gBAAE,OAAO;YACjB,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;IACjE,CAAC;CAAA;AAjBD,kDAiBC"}
|
@@ -1,77 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
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 bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
-
const constants_1 = require("./constants");
|
18
|
-
const solana_1 = require("../../utils/solana");
|
19
|
-
const clients_1 = require("../../utils/clients");
|
20
|
-
const vote_1 = require("./structs/vote");
|
21
|
-
const filters_1 = require("../../utils/solana/filters");
|
22
|
-
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
-
const client = (0, clients_1.getClientSolana)();
|
24
|
-
const escrowAccount = yield (0, solana_1.getParsedProgramAccounts)(client, vote_1.escrowStruct, constants_1.voteProgramId, (0, filters_1.dataSizeFilter)(322));
|
25
|
-
if (!escrowAccount)
|
26
|
-
return [];
|
27
|
-
const jupTokenPrice = yield cache.getTokenPrice(constants_1.jupMint, portfolio_core_1.NetworkId.solana);
|
28
|
-
if (!jupTokenPrice)
|
29
|
-
return [];
|
30
|
-
const { decimals } = jupTokenPrice;
|
31
|
-
let lockedWithoutWithdraw = 0;
|
32
|
-
const unlockEachDay = [];
|
33
|
-
for (const account of escrowAccount) {
|
34
|
-
const amount = account.amount.dividedBy(Math.pow(10, decimals)).toNumber();
|
35
|
-
if (!account.escrowStartedAt.isZero()) {
|
36
|
-
const unlockingAt = new Date(account.escrowEndsAt.times(1000).toNumber());
|
37
|
-
const daysUntilUnlock = new bignumber_js_1.default(unlockingAt.getTime() - Date.now())
|
38
|
-
.dividedBy(1000 * 60 * 60 * 24)
|
39
|
-
.decimalPlaces(0, bignumber_js_1.default.ROUND_DOWN)
|
40
|
-
.toNumber();
|
41
|
-
if (unlockEachDay[daysUntilUnlock]) {
|
42
|
-
unlockEachDay[daysUntilUnlock] += amount;
|
43
|
-
}
|
44
|
-
else {
|
45
|
-
unlockEachDay[daysUntilUnlock] = amount;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
else {
|
49
|
-
lockedWithoutWithdraw += amount;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
const unlockingAmount = unlockEachDay.reduce((amount, sum) => amount + sum);
|
53
|
-
const total = unlockingAmount + lockedWithoutWithdraw;
|
54
|
-
console.log('Amount Total : ', total);
|
55
|
-
console.log(`Amount Locked : ${lockedWithoutWithdraw}(${(lockedWithoutWithdraw / total) * 100}%)`);
|
56
|
-
console.log(`Amount unlocking :${unlockingAmount}(${(unlockingAmount / total) * 100}%)`);
|
57
|
-
for (let i = 0; i < unlockEachDay.length; i++) {
|
58
|
-
const unlocking = unlockEachDay[i];
|
59
|
-
if (!unlocking)
|
60
|
-
continue;
|
61
|
-
const value = unlocking * jupTokenPrice.price;
|
62
|
-
const percent = new bignumber_js_1.default(unlocking / total)
|
63
|
-
.times(100)
|
64
|
-
.decimalPlaces(2, bignumber_js_1.default.ROUND_DOWN)
|
65
|
-
.toNumber();
|
66
|
-
console.log(`Unlock in ${i} days : ${percent}% (${unlocking} JUP/ ${value}$) `);
|
67
|
-
}
|
68
|
-
const elements = [];
|
69
|
-
return elements;
|
70
|
-
});
|
71
|
-
const fetcher = {
|
72
|
-
id: `${constants_1.platformId}-test`,
|
73
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
74
|
-
executor,
|
75
|
-
};
|
76
|
-
exports.default = fetcher;
|
77
|
-
//# sourceMappingURL=testFetcher.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"testFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/testFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AACzE,gEAAqC;AAGrC,2CAAiE;AACjE,+CAA8D;AAC9D,iDAAsD;AACtD,yCAA8C;AAC9C,wDAA4D;AAE5D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,aAAa,GAAG,MAAM,IAAA,iCAAwB,EAClD,MAAM,EACN,mBAAY,EACZ,yBAAa,EACb,IAAA,wBAAc,EAAC,GAAG,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9B,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,mBAAO,EAAE,0BAAS,CAAC,MAAM,CAAC,CA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