@sonarwatch/portfolio-plugins 0.8.101 → 0.8.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/package.json +2 -2
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/tokens/fetchers/solana-cnfts.js +10 -5
- package/src/plugins/tokens/fetchers/solana-cnfts.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/solana/{getAssetsByOwner.d.ts → getAssetsByOwnerDas.d.ts} +19 -1
- package/src/utils/solana/{getAssetsByOwner.js → getAssetsByOwnerDas.js} +9 -4
- package/src/utils/solana/getAssetsByOwnerDas.js.map +1 -0
- package/src/utils/solana/getAssetsByOwner.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -2,10 +2,14 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.8.
|
5
|
+
## [0.8.102](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.101...plugins-0.8.102) (2023-11-25)
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
## [0.8.101](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.100...plugins-0.8.101) (2023-11-24)
|
10
|
+
|
11
|
+
|
12
|
+
|
9
13
|
## [0.8.100](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.99...plugins-0.8.100) (2023-11-24)
|
10
14
|
|
11
15
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.102",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"web3-v1": "npm:web3@^1.5.0"
|
41
41
|
},
|
42
42
|
"peerDependencies": {
|
43
|
-
"@sonarwatch/portfolio-core": "0.8.
|
43
|
+
"@sonarwatch/portfolio-core": "0.8.102"
|
44
44
|
},
|
45
45
|
"main": "./src/index.js",
|
46
46
|
"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;
|
@@ -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;
|
@@ -10,16 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
-
const
|
13
|
+
const getAssetsByOwnerDas_1 = require("../../../utils/solana/getAssetsByOwnerDas");
|
14
14
|
const constants_1 = require("../constants");
|
15
15
|
const constants_2 = require("../../../utils/clients/constants");
|
16
16
|
const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
17
17
|
const rpcEndpoint = (0, constants_2.getRpcEndpoint)(portfolio_core_1.NetworkId.solana);
|
18
|
-
const list = yield (0,
|
19
|
-
const
|
20
|
-
const
|
18
|
+
const list = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(rpcEndpoint, owner);
|
19
|
+
const assets = [];
|
20
|
+
const items = list.items.filter((i) => {
|
21
|
+
const isCompressed = i.compression.compressed;
|
22
|
+
const isSplNft = i.spl20 === null && i.inscription !== null;
|
23
|
+
return isCompressed || isSplNft;
|
24
|
+
});
|
25
|
+
items.forEach((i) => {
|
21
26
|
var _a;
|
22
|
-
|
27
|
+
assets.push({
|
23
28
|
networkId: portfolio_core_1.NetworkId.solana,
|
24
29
|
type: portfolio_core_1.PortfolioAssetType.collectible,
|
25
30
|
value: null,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana-cnfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-cnfts.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAMoC;AAEpC,
|
1
|
+
{"version":3,"file":"solana-cnfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-cnfts.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAMoC;AAEpC,mFAAgF;AAChF,4CAAwE;AACxE,gEAAkE;AAElE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,EAAE;IACxD,MAAM,WAAW,GAAG,IAAA,0BAAc,EAAC,0BAAS,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,IAAA,yCAAmB,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;QAC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AC,EAAE,eAAe;IAC7C,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -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;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { RpcEndpoint } from '@sonarwatch/portfolio-core';
|
2
|
-
export declare function
|
2
|
+
export declare function getAssetsByOwnerDas(rpcEndpoint: RpcEndpoint, owner: string): Promise<HeliusAssetList>;
|
3
3
|
export type GetAssetsByOwnerOutput = {
|
4
4
|
jsonrpc: string;
|
5
5
|
result: HeliusAssetList;
|
@@ -24,6 +24,24 @@ export type HeliusAsset = {
|
|
24
24
|
supply: Supply | null;
|
25
25
|
mutable: boolean;
|
26
26
|
burnt: boolean;
|
27
|
+
inscription: Inscription | null;
|
28
|
+
spl20: Spl20 | null;
|
29
|
+
};
|
30
|
+
export type Inscription = {
|
31
|
+
order: number;
|
32
|
+
size: number;
|
33
|
+
contentType: string;
|
34
|
+
encoding: string;
|
35
|
+
validationHash: string;
|
36
|
+
inscriptionDataAccount: string;
|
37
|
+
};
|
38
|
+
export type Spl20 = {
|
39
|
+
p: string;
|
40
|
+
op: string;
|
41
|
+
tick: string;
|
42
|
+
max?: string;
|
43
|
+
lim?: string;
|
44
|
+
amt?: string;
|
27
45
|
};
|
28
46
|
export type Authority = {
|
29
47
|
address: string;
|
@@ -12,10 +12,10 @@ 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.
|
15
|
+
exports.getAssetsByOwnerDas = void 0;
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
17
17
|
const getBasicAuthHeaders_1 = require("../misc/getBasicAuthHeaders");
|
18
|
-
function
|
18
|
+
function getAssetsByOwnerDas(rpcEndpoint, owner) {
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
20
20
|
const httpHeaders = rpcEndpoint.basicAuth
|
21
21
|
? (0, getBasicAuthHeaders_1.getBasicAuthHeaders)(rpcEndpoint.basicAuth.username, rpcEndpoint.basicAuth.password)
|
@@ -33,6 +33,11 @@ function getAssetsByOwner(rpcEndpoint, owner) {
|
|
33
33
|
sortBy: 'created',
|
34
34
|
sortDirection: 'asc',
|
35
35
|
},
|
36
|
+
displayOptions: {
|
37
|
+
showFungible: false,
|
38
|
+
showNativeBalance: false,
|
39
|
+
showInscription: true,
|
40
|
+
},
|
36
41
|
},
|
37
42
|
}, {
|
38
43
|
headers: Object.assign({ 'Content-Type': 'application/json' }, httpHeaders),
|
@@ -40,5 +45,5 @@ function getAssetsByOwner(rpcEndpoint, owner) {
|
|
40
45
|
.then((res) => res.data.result);
|
41
46
|
});
|
42
47
|
}
|
43
|
-
exports.
|
44
|
-
//# sourceMappingURL=
|
48
|
+
exports.getAssetsByOwnerDas = getAssetsByOwnerDas;
|
49
|
+
//# sourceMappingURL=getAssetsByOwnerDas.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAssetsByOwnerDas.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getAssetsByOwnerDas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA6C;AAC7C,qEAAkE;AAElE,SAAsB,mBAAmB,CACvC,WAAwB,EACxB,KAAa;;QAEb,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS;YACvC,CAAC,CAAC,IAAA,yCAAmB,EACjB,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9B,WAAW,CAAC,SAAS,CAAC,QAAQ,CAC/B;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO,eAAK;aACT,IAAI,CACH,WAAW,CAAC,GAAG,EACf;YACE,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC5B,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE;gBACN,YAAY,EAAE,KAAK;gBACnB,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE;oBACN,MAAM,EAAE,SAAS;oBACjB,aAAa,EAAE,KAAK;iBACrB;gBACD,cAAc,EAAE;oBACd,YAAY,EAAE,KAAK;oBACnB,iBAAiB,EAAE,KAAK;oBACxB,eAAe,EAAE,IAAI;iBACtB;aACF;SACF,EACD;YACE,OAAO,kBACL,cAAc,EAAE,kBAAkB,IAC/B,WAAW,CACf;SACF,CACF;aACA,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CAAA;AAzCD,kDAyCC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getAssetsByOwner.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getAssetsByOwner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA6C;AAC7C,qEAAkE;AAElE,SAAsB,gBAAgB,CACpC,WAAwB,EACxB,KAAa;;QAEb,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS;YACvC,CAAC,CAAC,IAAA,yCAAmB,EACjB,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9B,WAAW,CAAC,SAAS,CAAC,QAAQ,CAC/B;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO,eAAK;aACT,IAAI,CACH,WAAW,CAAC,GAAG,EACf;YACE,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC5B,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE;gBACN,YAAY,EAAE,KAAK;gBACnB,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE;oBACN,MAAM,EAAE,SAAS;oBACjB,aAAa,EAAE,KAAK;iBACrB;aACF;SACF,EACD;YACE,OAAO,kBACL,cAAc,EAAE,kBAAkB,IAC/B,WAAW,CACf;SACF,CACF;aACA,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CAAA;AApCD,4CAoCC"}
|