@sonarwatch/portfolio-plugins 0.12.155 → 0.12.157
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1426 -1418
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/kamino/constants.d.ts +1 -0
- package/src/plugins/kamino/constants.js +2 -1
- package/src/plugins/kamino/constants.js.map +1 -1
- package/src/plugins/kamino/helpers/common.d.ts +4 -1
- package/src/plugins/kamino/helpers/common.js +16 -1
- package/src/plugins/kamino/helpers/common.js.map +1 -1
- package/src/plugins/kamino/lendsFetcher.js +26 -6
- package/src/plugins/kamino/lendsFetcher.js.map +1 -1
- package/src/plugins/kamino/marketsJob.js +7 -0
- package/src/plugins/kamino/marketsJob.js.map +1 -1
- package/src/plugins/kamino/reservesJob.js +3 -1
- package/src/plugins/kamino/reservesJob.js.map +1 -1
- package/src/plugins/kamino/types.d.ts +2 -0
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/tradeport/constants.d.ts +5 -0
- package/src/plugins/tradeport/constants.js +15 -0
- package/src/plugins/tradeport/constants.js.map +1 -0
- package/src/plugins/tradeport/helpers.d.ts +2 -0
- package/src/plugins/tradeport/helpers.js +24 -0
- package/src/plugins/tradeport/helpers.js.map +1 -0
- package/src/plugins/tradeport/index.d.ts +6 -0
- package/src/plugins/tradeport/index.js +13 -0
- package/src/plugins/tradeport/index.js.map +1 -0
- package/src/plugins/tradeport/locksJob.d.ts +3 -0
- package/src/plugins/tradeport/locksJob.js +32 -0
- package/src/plugins/tradeport/locksJob.js.map +1 -0
- package/src/plugins/tradeport/positionsFetcher.d.ts +3 -0
- package/src/plugins/tradeport/positionsFetcher.js +76 -0
- package/src/plugins/tradeport/positionsFetcher.js.map +1 -0
- package/src/plugins/tradeport/types.d.ts +28 -0
- package/src/plugins/tradeport/types.js +3 -0
- package/src/plugins/tradeport/types.js.map +1 -0
- 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
@@ -0,0 +1,76 @@
|
|
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 MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
19
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
20
|
+
const helpers_1 = require("./helpers");
|
21
|
+
const locksMemo = new MemoizedCache_1.MemoizedCache(constants_1.locksCacheKey, {
|
22
|
+
prefix: constants_1.platformId,
|
23
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
24
|
+
});
|
25
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
+
const allLocks = yield locksMemo.getItem(cache);
|
27
|
+
if (!allLocks)
|
28
|
+
return [];
|
29
|
+
const locks = allLocks.filter((lock) => lock.fields.maker === owner);
|
30
|
+
if (!locks)
|
31
|
+
return [];
|
32
|
+
const suiTokenPrice = yield cache.getTokenPrice(portfolio_core_1.suiNetwork.native.address, portfolio_core_1.NetworkId.sui);
|
33
|
+
if (!suiTokenPrice)
|
34
|
+
return [];
|
35
|
+
const assets = [];
|
36
|
+
locks.forEach((lock) => {
|
37
|
+
var _a, _b;
|
38
|
+
const attributes = {
|
39
|
+
tags: [],
|
40
|
+
};
|
41
|
+
if (lock.fields.expire_at) {
|
42
|
+
attributes.lockedUntil = Number(lock.fields.expire_at);
|
43
|
+
}
|
44
|
+
const statusLabel = (0, helpers_1.getStatusLabel)(lock.fields.state);
|
45
|
+
if (statusLabel) {
|
46
|
+
(_a = attributes.tags) === null || _a === void 0 ? void 0 : _a.push(statusLabel);
|
47
|
+
}
|
48
|
+
const typeLabel = (0, helpers_1.getTypeLabel)(lock.fields.lock_type);
|
49
|
+
if (typeLabel) {
|
50
|
+
(_b = attributes.tags) === null || _b === void 0 ? void 0 : _b.push(typeLabel);
|
51
|
+
}
|
52
|
+
assets.push((0, tokenPriceToAssetToken_1.default)(suiTokenPrice.address, new bignumber_js_1.default(lock.fields.maker_price)
|
53
|
+
.dividedBy(Math.pow(10, suiTokenPrice.decimals))
|
54
|
+
.toNumber(), portfolio_core_1.NetworkId.sui, suiTokenPrice, undefined, attributes));
|
55
|
+
});
|
56
|
+
if (assets.length === 0)
|
57
|
+
return [];
|
58
|
+
return [
|
59
|
+
{
|
60
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
61
|
+
platformId: constants_1.platformId,
|
62
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
63
|
+
label: 'Deposit',
|
64
|
+
name: 'Locks',
|
65
|
+
data: { assets },
|
66
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
67
|
+
},
|
68
|
+
];
|
69
|
+
});
|
70
|
+
const fetcher = {
|
71
|
+
id: `${constants_1.platformId}-positions`,
|
72
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
73
|
+
executor,
|
74
|
+
};
|
75
|
+
exports.default = fetcher;
|
76
|
+
//# sourceMappingURL=positionsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,gEAAqC;AAErC,2CAAwD;AAExD,kEAA+D;AAE/D,qGAA6E;AAC7E,uCAAyD;AAEzD,MAAM,SAAS,GAAG,IAAI,6BAAa,CAAS,yBAAa,EAAE;IACzD,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;CACzB,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAEhD,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAErE,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAC7C,2BAAU,CAAC,MAAM,CAAC,OAAO,EACzB,0BAAS,CAAC,GAAG,CACd,CAAC;IACF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9B,MAAM,MAAM,GAAqB,EAAE,CAAC;IAEpC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;;QACrB,MAAM,UAAU,GAA6B;YAC3C,IAAI,EAAE,EAAE;SACT,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC1B,UAAU,CAAC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ACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
type ID = {
|
2
|
+
id: string;
|
3
|
+
};
|
4
|
+
export type Lock = {
|
5
|
+
fields: {
|
6
|
+
expire_at: string;
|
7
|
+
expire_in: string;
|
8
|
+
id: ID;
|
9
|
+
lock_type: string;
|
10
|
+
maker: string;
|
11
|
+
maker_price: string;
|
12
|
+
marketplace_fee: string;
|
13
|
+
nft_id: string;
|
14
|
+
premium: string;
|
15
|
+
premium_fee: string;
|
16
|
+
royalty: string;
|
17
|
+
state: string;
|
18
|
+
taker: string;
|
19
|
+
taker_price: string;
|
20
|
+
};
|
21
|
+
type: string;
|
22
|
+
};
|
23
|
+
export type LockObject = {
|
24
|
+
id: ID;
|
25
|
+
name: number[];
|
26
|
+
value: Lock;
|
27
|
+
};
|
28
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tradeport/types.ts"],"names":[],"mappings":""}
|
@@ -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* () {
|
@@ -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;
|