@sonarwatch/portfolio-plugins 0.8.116 → 0.8.117
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/tensor/bidsFetcher.js +57 -0
- package/src/plugins/tensor/bidsFetcher.js.map +1 -0
- package/src/plugins/tensor/filters.d.ts +1 -0
- package/src/plugins/tensor/filters.js +11 -1
- package/src/plugins/tensor/filters.js.map +1 -1
- package/src/plugins/tensor/index.js +5 -4
- package/src/plugins/tensor/index.js.map +1 -1
- package/src/plugins/tensor/singleListingFetcher.d.ts +2 -0
- package/src/plugins/tensor/singleListingFetcher.js +114 -0
- package/src/plugins/tensor/singleListingFetcher.js.map +1 -0
- package/src/plugins/tensor/struct.d.ts +42 -0
- package/src/plugins/tensor/struct.js +39 -1
- package/src/plugins/tensor/struct.js.map +1 -1
- package/src/plugins/tokens/fetchers/solana-nfts.js +6 -3
- package/src/plugins/tokens/fetchers/solana-nfts.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/plugins/tensor/tensorFetcher.js +0 -102
- package/src/plugins/tensor/tensorFetcher.js.map +0 -1
- /package/src/plugins/tensor/{tensorFetcher.d.ts → bidsFetcher.d.ts} +0 -0
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.117](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.116...plugins-0.8.117) (2023-12-04)
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
## [0.8.116](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.115...plugins-0.8.116) (2023-12-01)
|
10
|
+
|
11
|
+
|
12
|
+
|
9
13
|
## [0.8.115](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.114...plugins-0.8.115) (2023-11-30)
|
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.117",
|
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.8.
|
44
|
+
"@sonarwatch/portfolio-core": "0.8.117"
|
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;
|
@@ -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;
|
@@ -0,0 +1,57 @@
|
|
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 clients_1 = require("../../utils/clients");
|
19
|
+
const solana_1 = require("../../utils/solana");
|
20
|
+
const filters_1 = require("./filters");
|
21
|
+
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
22
|
+
const struct_1 = require("./struct");
|
23
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
24
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
const client = (0, clients_1.getClientSolana)();
|
26
|
+
const bidsAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, struct_1.poolStruct, constants_1.tensorProgram, (0, filters_1.poolFilter)(owner));
|
27
|
+
if (bidsAccounts.length === 0)
|
28
|
+
return [];
|
29
|
+
const escrowAccountsInfo = yield (0, getMultipleAccountsInfoSafe_1.getMultipleAccountsInfoSafe)(client, bidsAccounts.map((account) => account.solEscrow));
|
30
|
+
if (escrowAccountsInfo.length === 0)
|
31
|
+
return [];
|
32
|
+
const rent = yield client.getMinimumBalanceForRentExemption(8);
|
33
|
+
const solRawBalance = escrowAccountsInfo.reduce((accu, escrow) => (escrow ? accu + escrow.lamports - rent : accu + 0), 0);
|
34
|
+
const solTokenPrice = yield cache.getTokenPrice(portfolio_core_1.solanaNativeWrappedAddress, portfolio_core_1.NetworkId.solana);
|
35
|
+
const amount = new bignumber_js_1.default(solRawBalance)
|
36
|
+
.dividedBy(Math.pow(10, portfolio_core_1.solanaNetwork.native.decimals))
|
37
|
+
.toNumber();
|
38
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.solanaNativeWrappedAddress, amount, portfolio_core_1.NetworkId.solana, solTokenPrice);
|
39
|
+
return [
|
40
|
+
{
|
41
|
+
type: portfolio_core_1.PortfolioElementType.single,
|
42
|
+
label: 'Deposit',
|
43
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
44
|
+
platformId: constants_1.platformId,
|
45
|
+
name: 'Bids',
|
46
|
+
value: asset.value,
|
47
|
+
data: { asset },
|
48
|
+
},
|
49
|
+
];
|
50
|
+
});
|
51
|
+
const fetcher = {
|
52
|
+
id: `${constants_1.platformId}-bids`,
|
53
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
54
|
+
executor,
|
55
|
+
};
|
56
|
+
exports.default = fetcher;
|
57
|
+
//# sourceMappingURL=bidsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bidsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/bidsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AAGrC,2CAAwD;AACxD,iDAAsD;AACtD,+CAA8D;AAC9D,uCAAuC;AACvC,gGAA6F;AAC7F,qCAAsC;AACtC,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KA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KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,EAAE,KAAK,EAAE;SAChB;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"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.singleListingFilter = void 0;
|
3
|
+
exports.poolFilter = exports.singleListingFilter = void 0;
|
4
4
|
const struct_1 = require("./struct");
|
5
5
|
const singleListingFilter = (owner) => [
|
6
6
|
{ dataSize: struct_1.singleListingStruct.byteSize },
|
@@ -12,4 +12,14 @@ const singleListingFilter = (owner) => [
|
|
12
12
|
},
|
13
13
|
];
|
14
14
|
exports.singleListingFilter = singleListingFilter;
|
15
|
+
const poolFilter = (owner) => [
|
16
|
+
{ dataSize: 293 },
|
17
|
+
{
|
18
|
+
memcmp: {
|
19
|
+
bytes: owner,
|
20
|
+
offset: 71,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
];
|
24
|
+
exports.poolFilter = poolFilter;
|
15
25
|
//# sourceMappingURL=filters.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/filters.ts"],"names":[],"mappings":";;;AACA,qCAA+C;AAExC,MAAM,mBAAmB,GAAG,CACjC,KAAa,EACe,EAAE,CAAC;IAC/B,EAAE,QAAQ,EAAE,4BAAmB,CAAC,QAAQ,EAAE;IAC1C;QACE,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC;SACV;KACF;CACF,CAAC;AAVW,QAAA,mBAAmB,uBAU9B"}
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/filters.ts"],"names":[],"mappings":";;;AACA,qCAA+C;AAExC,MAAM,mBAAmB,GAAG,CACjC,KAAa,EACe,EAAE,CAAC;IAC/B,EAAE,QAAQ,EAAE,4BAAmB,CAAC,QAAQ,EAAE;IAC1C;QACE,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC;SACV;KACF;CACF,CAAC;AAVW,QAAA,mBAAmB,uBAU9B;AAEK,MAAM,UAAU,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IACvE,EAAE,QAAQ,EAAE,GAAG,EAAE;IACjB;QACE,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC;AARW,QAAA,UAAU,cAQrB"}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
3
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
6
|
exports.fetchers = exports.platforms = void 0;
|
5
7
|
const constants_1 = require("./constants");
|
8
|
+
const bidsFetcher_1 = __importDefault(require("./bidsFetcher"));
|
6
9
|
exports.platforms = [constants_1.tensorPlatform];
|
7
|
-
exports.fetchers = [
|
8
|
-
// tensorFetcher
|
9
|
-
];
|
10
|
+
exports.fetchers = [bidsFetcher_1.default];
|
10
11
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/index.ts"],"names":[],"mappings":";;;;;;AAIA,2CAA6C;AAC7C,gEAAwC;AAE3B,QAAA,SAAS,GAAe,CAAC,0BAAc,CAAC,CAAC;AACzC,QAAA,QAAQ,GAAc,CAAC,qBAAW,CAAC,CAAC"}
|
@@ -0,0 +1,114 @@
|
|
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
|
+
const js_1 = require("@metaplex-foundation/js");
|
13
|
+
const constants_1 = require("./constants");
|
14
|
+
const solana_1 = require("../../utils/solana");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const struct_1 = require("./struct");
|
17
|
+
const filters_1 = require("./filters");
|
18
|
+
function getTensorSingleListings(owner) {
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
20
|
+
const connection = (0, clients_1.getClientSolana)();
|
21
|
+
const metaplex = new js_1.Metaplex(connection);
|
22
|
+
const singleListings = yield (0, solana_1.getParsedProgramAccounts)(connection, struct_1.singleListingStruct, constants_1.tensorProgram, (0, filters_1.singleListingFilter)(owner));
|
23
|
+
if (singleListings.length === 0)
|
24
|
+
return [];
|
25
|
+
const mints = singleListings.map((listing) => listing.nftMint);
|
26
|
+
const nftsMetadata = yield metaplex.nfts().findAllByMintList({
|
27
|
+
mints,
|
28
|
+
});
|
29
|
+
if (!nftsMetadata)
|
30
|
+
return [];
|
31
|
+
return nftsMetadata.map((nft) => nft || []).flat();
|
32
|
+
});
|
33
|
+
}
|
34
|
+
exports.default = getTensorSingleListings;
|
35
|
+
// const executor: FetcherExecutor = async (owner: string, cache: Cache) => {
|
36
|
+
// const connection = getClientSolana();
|
37
|
+
// const metaplex = new Metaplex(connection);
|
38
|
+
// const singleListings = await getParsedProgramAccounts(
|
39
|
+
// connection,
|
40
|
+
// singleListingStruct,
|
41
|
+
// tensorProgram,
|
42
|
+
// singleListingFilter(owner)
|
43
|
+
// );
|
44
|
+
// if (singleListings.length === 0) return [];
|
45
|
+
// const mints = singleListings.map((listing) => listing.nftMint);
|
46
|
+
// const nftsMetadata = await metaplex.nfts().findAllByMintList({
|
47
|
+
// mints,
|
48
|
+
// });
|
49
|
+
// if (!nftsMetadata) return [];
|
50
|
+
// const promises = nftsMetadata.map((nftMetadata) => {
|
51
|
+
// if (!nftMetadata?.uri) return undefined;
|
52
|
+
// return getImagefromUri(nftMetadata?.uri, NetworkId.solana, cache);
|
53
|
+
// });
|
54
|
+
// const imageResults = await Promise.allSettled(promises);
|
55
|
+
// const assets: PortfolioAsset[] = [];
|
56
|
+
// nftsMetadata.forEach((nftMetadata, i) => {
|
57
|
+
// if (!nftMetadata) return;
|
58
|
+
// const imageResult = imageResults[i];
|
59
|
+
// const image =
|
60
|
+
// imageResult.status === 'fulfilled' ? imageResult.value : undefined;
|
61
|
+
// const address =
|
62
|
+
// nftMetadata.model === 'metadata'
|
63
|
+
// ? nftMetadata.mintAddress.toString()
|
64
|
+
// : nftMetadata.mint.address.toString();
|
65
|
+
// const token: Token | null =
|
66
|
+
// isNftWithToken(nftMetadata) || isSftWithToken(nftMetadata)
|
67
|
+
// ? nftMetadata.token
|
68
|
+
// : null;
|
69
|
+
// const amount = token?.amount
|
70
|
+
// ? new BigNumber(token.amount.basisPoints.toString())
|
71
|
+
// .div(10 ** token.amount.currency.decimals)
|
72
|
+
// .toNumber()
|
73
|
+
// : 1;
|
74
|
+
// const collection = nftMetadata.collection
|
75
|
+
// ? {
|
76
|
+
// floorPrice: null,
|
77
|
+
// id: nftMetadata.collection.address.toString(),
|
78
|
+
// }
|
79
|
+
// : undefined;
|
80
|
+
// const asset: PortfolioAsset = {
|
81
|
+
// type: PortfolioAssetType.collectible,
|
82
|
+
// networkId: NetworkId.solana,
|
83
|
+
// value: null,
|
84
|
+
// data: {
|
85
|
+
// address,
|
86
|
+
// amount,
|
87
|
+
// price: null,
|
88
|
+
// name: nftMetadata.name,
|
89
|
+
// dataUri: nftMetadata.uri,
|
90
|
+
// imageUri: image,
|
91
|
+
// collection,
|
92
|
+
// },
|
93
|
+
// };
|
94
|
+
// assets.push(asset);
|
95
|
+
// });
|
96
|
+
// if (assets.length === 0) return [];
|
97
|
+
// const element: PortfolioElementMultiple = {
|
98
|
+
// type: PortfolioElementType.multiple,
|
99
|
+
// networkId: NetworkId.solana,
|
100
|
+
// platformId,
|
101
|
+
// label: 'Wallet',
|
102
|
+
// value: null,
|
103
|
+
// data: {
|
104
|
+
// assets,
|
105
|
+
// },
|
106
|
+
// };
|
107
|
+
// return [element];
|
108
|
+
// };
|
109
|
+
// const fetcher: Fetcher = {
|
110
|
+
// id: `${platformId}-linsting`,
|
111
|
+
// networkId: NetworkId.solana,
|
112
|
+
// executor,
|
113
|
+
// };
|
114
|
+
//# sourceMappingURL=singleListingFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"singleListingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/singleListingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gDAAuE;AACvE,2CAA4C;AAC5C,+CAA8D;AAC9D,iDAAsD;AACtD,qCAA+C;AAC/C,uCAAgD;AAEhD,SAA8B,uBAAuB,CACnD,KAAa;;QAEb,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,aAAQ,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,c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;AACZ,qBAAqB;AACrB,sCAAsC;AACtC,8CAA8C;AAC9C,qCAAqC;AACrC,qBAAqB;AACrB,gBAAgB;AAChB,mBAAmB;AACnB,kBAAkB;AAClB,uBAAuB;AACvB,kCAAkC;AAClC,oCAAoC;AACpC,2BAA2B;AAC3B,sBAAsB;AACtB,WAAW;AACX,SAAS;AACT,0BAA0B;AAC1B,QAAQ;AAER,wCAAwC;AAExC,gDAAgD;AAChD,2CAA2C;AAC3C,mCAAmC;AACnC,kBAAkB;AAClB,uBAAuB;AACvB,mBAAmB;AACnB,cAAc;AACd,gBAAgB;AAChB,SAAS;AACT,OAAO;AACP,sBAAsB;AACtB,KAAK;AAEL,6BAA6B;AAC7B,kCAAkC;AAClC,iCAAiC;AACjC,cAAc;AACd,KAAK"}
|
@@ -11,3 +11,45 @@ export type SingleListing = {
|
|
11
11
|
reserved: number[];
|
12
12
|
};
|
13
13
|
export declare const singleListingStruct: BeetStruct<SingleListing, Partial<SingleListing>>;
|
14
|
+
export declare enum PoolType {
|
15
|
+
Token = 0,
|
16
|
+
NFT = 1,
|
17
|
+
Trade = 2
|
18
|
+
}
|
19
|
+
export declare enum CurveType {
|
20
|
+
Linear = 0,
|
21
|
+
Exponential = 1
|
22
|
+
}
|
23
|
+
export type PoolConfig = {
|
24
|
+
poolType: PoolType;
|
25
|
+
curveType: CurveType;
|
26
|
+
startingPrice: BigNumber;
|
27
|
+
delta: BigNumber;
|
28
|
+
honorRoyalties: boolean;
|
29
|
+
mmFeeBps: number;
|
30
|
+
};
|
31
|
+
export declare const poolConfigStruct: BeetStruct<PoolConfig, Partial<PoolConfig>>;
|
32
|
+
export type TSwapConfig = {
|
33
|
+
feeBps: number;
|
34
|
+
};
|
35
|
+
export declare const tSwapConfigStruct: BeetStruct<TSwapConfig, Partial<TSwapConfig>>;
|
36
|
+
export type TSwap = {
|
37
|
+
version: number;
|
38
|
+
bump: number[];
|
39
|
+
config: TSwapConfig;
|
40
|
+
owner: PublicKey;
|
41
|
+
feeVault: PublicKey;
|
42
|
+
cosigner: PublicKey;
|
43
|
+
};
|
44
|
+
export declare const tSwapStruct: BeetStruct<TSwap, Partial<TSwap>>;
|
45
|
+
export type Pool = {
|
46
|
+
buffer: Buffer;
|
47
|
+
owner: PublicKey;
|
48
|
+
whitelist: PublicKey;
|
49
|
+
solEscrow: PublicKey;
|
50
|
+
takerSellCount: number;
|
51
|
+
takerBuyCount: number;
|
52
|
+
nftsHeld: number;
|
53
|
+
padding: Buffer;
|
54
|
+
};
|
55
|
+
export declare const poolStruct: BeetStruct<Pool, Partial<Pool>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.singleListingStruct = void 0;
|
3
|
+
exports.poolStruct = exports.tSwapStruct = exports.tSwapConfigStruct = exports.poolConfigStruct = exports.CurveType = exports.PoolType = exports.singleListingStruct = 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");
|
@@ -12,4 +12,42 @@ exports.singleListingStruct = new beet_1.BeetStruct([
|
|
12
12
|
['bump', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 1)],
|
13
13
|
['reserved', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 64)],
|
14
14
|
], (args) => args);
|
15
|
+
var PoolType;
|
16
|
+
(function (PoolType) {
|
17
|
+
PoolType[PoolType["Token"] = 0] = "Token";
|
18
|
+
PoolType[PoolType["NFT"] = 1] = "NFT";
|
19
|
+
PoolType[PoolType["Trade"] = 2] = "Trade";
|
20
|
+
})(PoolType || (exports.PoolType = PoolType = {}));
|
21
|
+
var CurveType;
|
22
|
+
(function (CurveType) {
|
23
|
+
CurveType[CurveType["Linear"] = 0] = "Linear";
|
24
|
+
CurveType[CurveType["Exponential"] = 1] = "Exponential";
|
25
|
+
})(CurveType || (exports.CurveType = CurveType = {}));
|
26
|
+
exports.poolConfigStruct = new beet_1.BeetStruct([
|
27
|
+
['poolType', beet_1.u8],
|
28
|
+
['curveType', beet_1.u8],
|
29
|
+
['startingPrice', solana_1.u64],
|
30
|
+
['delta', solana_1.u64],
|
31
|
+
['honorRoyalties', beet_1.bool],
|
32
|
+
['mmFeeBps', beet_1.u16],
|
33
|
+
], (args) => args);
|
34
|
+
exports.tSwapConfigStruct = new beet_1.BeetStruct([['feeBps', beet_1.u16]], (args) => args);
|
35
|
+
exports.tSwapStruct = new beet_1.BeetStruct([
|
36
|
+
['version', beet_1.u8],
|
37
|
+
['bump', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 1)],
|
38
|
+
['config', exports.tSwapConfigStruct],
|
39
|
+
['owner', beet_solana_1.publicKey],
|
40
|
+
['feeVault', beet_solana_1.publicKey],
|
41
|
+
['cosigner', beet_solana_1.publicKey],
|
42
|
+
], (args) => args);
|
43
|
+
exports.poolStruct = new beet_1.BeetStruct([
|
44
|
+
['buffer', (0, solana_1.blob)(71)],
|
45
|
+
['owner', beet_solana_1.publicKey],
|
46
|
+
['whitelist', beet_solana_1.publicKey],
|
47
|
+
['solEscrow', beet_solana_1.publicKey],
|
48
|
+
['takerSellCount', beet_1.u32],
|
49
|
+
['takerBuyCount', beet_1.u32],
|
50
|
+
['nftsHeld', beet_1.u32],
|
51
|
+
['padding', (0, solana_1.blob)(121)],
|
52
|
+
], (args) => args);
|
15
53
|
//# sourceMappingURL=struct.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"struct.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/struct.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"struct.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/struct.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AACnC,kEAA6D;AAG7D,+CAA+C;AAalC,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,C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AAC,CAAC,CAAC;IACtC,CAAC,QAAQ,EAAE,yBAAiB,CAAC;IAC7B,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,UAAU,EAAE,uBAAS,CAAC;CACxB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAa,CACxB,CAAC;AAaW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,EAAE,CAAC,CAAC;IACpB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,gBAAgB,EAAE,UAAG,CAAC;IACvB,CAAC,eAAe,EAAE,UAAG,CAAC;IACtB,CAAC,UAAU,EAAE,UAAG,CAAC;IACjB,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,GAAG,CAAC,CAAC;CACvB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC"}
|
@@ -19,6 +19,7 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
19
19
|
const constants_1 = require("../constants");
|
20
20
|
const clients_1 = require("../../../utils/clients");
|
21
21
|
const runInBatch_1 = __importDefault(require("../../../utils/misc/runInBatch"));
|
22
|
+
const singleListingFetcher_1 = __importDefault(require("../../tensor/singleListingFetcher"));
|
22
23
|
const prefix = 'nft-images';
|
23
24
|
const noImageValue = 'noimage';
|
24
25
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -27,7 +28,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
27
28
|
const outputs = yield metaplex.nfts().findAllByOwner({
|
28
29
|
owner: new web3_js_1.PublicKey(owner),
|
29
30
|
});
|
30
|
-
const
|
31
|
+
const nftsOnTensor = yield (0, singleListingFetcher_1.default)(owner);
|
32
|
+
const allNfts = [...outputs, ...nftsOnTensor].filter((nft) => nft !== null);
|
33
|
+
const cachedImages = yield cache.getItems(allNfts.map((o) => o.model === 'metadata'
|
31
34
|
? o.mintAddress.toString()
|
32
35
|
: o.mint.address.toString()), {
|
33
36
|
prefix,
|
@@ -35,7 +38,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
35
38
|
});
|
36
39
|
const images = new Map();
|
37
40
|
const missings = [];
|
38
|
-
|
41
|
+
allNfts.forEach((o, i) => {
|
39
42
|
const cachedImage = cachedImages[i];
|
40
43
|
if (cachedImage) {
|
41
44
|
const address = o.model === 'metadata'
|
@@ -66,7 +69,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
66
69
|
});
|
67
70
|
});
|
68
71
|
yield Promise.allSettled(promises);
|
69
|
-
const assets =
|
72
|
+
const assets = allNfts.map((output) => {
|
70
73
|
const address = output.model === 'metadata'
|
71
74
|
? output.mintAddress.toString()
|
72
75
|
: output.mint.address.toString();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana-nfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,6CAA4C;AAC5C,gDAMiC;AACjC,gEAAqC;AAErC,4CAAwE;AACxE,oDAAyD;AAEzD,gFAAwD;
|
1
|
+
{"version":3,"file":"solana-nfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,6CAA4C;AAC5C,gDAMiC;AACjC,gEAAqC;AAErC,4CAAwE;AACxE,oDAAyD;AAEzD,gFAAwD;AACxD,6FAAwE;AAExE,MAAM,MAAM,GAAG,YAAY,CAAC;AAC5B,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,MAAM,QAAQ,GAAoB,CAAO,KAAa,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AAK,EAAE,IAAI;YACX,IAAI,EAAE;gBACJ,OAAO;gBACP,MAAM;gBACN,OAAO,EAAE,MAAM,CAAC,GAAG;gBACnB,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU;aACX;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,OAAO,GAA6B;QACxC,IAAI,EAAE,qCAAoB,CAAC,QAAQ;QACnC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,UAAU,EAAE,8BAAkB,CAAC,EAAE;QACjC,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACJ,MAAM;SACP;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,cAAc;IAC5C,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,102 +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 js_1 = require("@metaplex-foundation/js");
|
17
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
-
const constants_1 = require("./constants");
|
19
|
-
const solana_1 = require("../../utils/solana");
|
20
|
-
const clients_1 = require("../../utils/clients");
|
21
|
-
const struct_1 = require("./struct");
|
22
|
-
const filters_1 = require("./filters");
|
23
|
-
const getImagefromUri_1 = require("../../utils/misc/getImagefromUri");
|
24
|
-
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
-
const connection = (0, clients_1.getClientSolana)();
|
26
|
-
const metaplex = new js_1.Metaplex(connection);
|
27
|
-
const singleListings = yield (0, solana_1.getParsedProgramAccounts)(connection, struct_1.singleListingStruct, constants_1.tensorProgram, (0, filters_1.singleListingFilter)(owner));
|
28
|
-
if (singleListings.length === 0)
|
29
|
-
return [];
|
30
|
-
const mints = singleListings.map((listing) => listing.nftMint);
|
31
|
-
const nftsMetadata = yield metaplex.nfts().findAllByMintList({
|
32
|
-
mints,
|
33
|
-
});
|
34
|
-
if (!nftsMetadata)
|
35
|
-
return [];
|
36
|
-
const promises = nftsMetadata.map((nftMetadata) => {
|
37
|
-
if (!(nftMetadata === null || nftMetadata === void 0 ? void 0 : nftMetadata.uri))
|
38
|
-
return undefined;
|
39
|
-
return (0, getImagefromUri_1.getImagefromUri)(nftMetadata === null || nftMetadata === void 0 ? void 0 : nftMetadata.uri, portfolio_core_1.NetworkId.solana, cache);
|
40
|
-
});
|
41
|
-
const imageResults = yield Promise.allSettled(promises);
|
42
|
-
const assets = [];
|
43
|
-
nftsMetadata.forEach((nftMetadata, i) => {
|
44
|
-
if (!nftMetadata)
|
45
|
-
return;
|
46
|
-
const imageResult = imageResults[i];
|
47
|
-
const image = imageResult.status === 'fulfilled' ? imageResult.value : undefined;
|
48
|
-
const address = nftMetadata.model === 'metadata'
|
49
|
-
? nftMetadata.mintAddress.toString()
|
50
|
-
: nftMetadata.mint.address.toString();
|
51
|
-
const token = (0, js_1.isNftWithToken)(nftMetadata) || (0, js_1.isSftWithToken)(nftMetadata)
|
52
|
-
? nftMetadata.token
|
53
|
-
: null;
|
54
|
-
const amount = (token === null || token === void 0 ? void 0 : token.amount)
|
55
|
-
? new bignumber_js_1.default(token.amount.basisPoints.toString())
|
56
|
-
.div(Math.pow(10, token.amount.currency.decimals))
|
57
|
-
.toNumber()
|
58
|
-
: 1;
|
59
|
-
const collection = nftMetadata.collection
|
60
|
-
? {
|
61
|
-
floorPrice: null,
|
62
|
-
id: nftMetadata.collection.address.toString(),
|
63
|
-
}
|
64
|
-
: undefined;
|
65
|
-
const asset = {
|
66
|
-
type: portfolio_core_1.PortfolioAssetType.collectible,
|
67
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
68
|
-
value: null,
|
69
|
-
data: {
|
70
|
-
address,
|
71
|
-
amount,
|
72
|
-
price: null,
|
73
|
-
name: nftMetadata.name,
|
74
|
-
dataUri: nftMetadata.uri,
|
75
|
-
imageUri: image,
|
76
|
-
collection,
|
77
|
-
},
|
78
|
-
};
|
79
|
-
assets.push(asset);
|
80
|
-
});
|
81
|
-
if (assets.length === 0)
|
82
|
-
return [];
|
83
|
-
const element = {
|
84
|
-
type: portfolio_core_1.PortfolioElementType.multiple,
|
85
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
86
|
-
platformId: constants_1.platformId,
|
87
|
-
label: 'Wallet',
|
88
|
-
tags: ['Single listing'],
|
89
|
-
value: null,
|
90
|
-
data: {
|
91
|
-
assets,
|
92
|
-
},
|
93
|
-
};
|
94
|
-
return [element];
|
95
|
-
});
|
96
|
-
const fetcher = {
|
97
|
-
id: `${constants_1.platformId}-linsting`,
|
98
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
99
|
-
executor,
|
100
|
-
};
|
101
|
-
exports.default = fetcher;
|
102
|
-
//# sourceMappingURL=tensorFetcher.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"tensorFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tensor/tensorFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gDAKiC;AACjC,gEAAqC;AACrC,2CAAwD;AACxD,+CAA8D;AAC9D,iDAAsD;AACtD,qCAA+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