@sonarwatch/portfolio-plugins 0.11.149 → 0.11.151
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1331 -1323
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/index.js +8 -12
- package/src/index.js.map +1 -1
- package/src/plugins/armada-staking/constants.js.map +1 -0
- package/src/plugins/armada-staking/filters.js.map +1 -0
- package/src/plugins/{spl-staking → armada-staking}/index.js +7 -1
- package/src/plugins/armada-staking/index.js.map +1 -0
- package/src/plugins/armada-staking/poolsJob.js.map +1 -0
- package/src/plugins/armada-staking/stakingFetcher.js.map +1 -0
- package/src/plugins/armada-staking/structs.js.map +1 -0
- package/src/plugins/armada-staking/types.js.map +1 -0
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/{realms → daos}/constants.d.ts +4 -2
- package/src/plugins/{realms → daos}/constants.js +10 -3
- package/src/plugins/daos/constants.js.map +1 -0
- package/src/plugins/daos/filters.js.map +1 -0
- package/src/plugins/daos/helpers.d.ts +10 -0
- package/src/plugins/{realms → daos}/helpers.js +21 -29
- package/src/plugins/daos/helpers.js.map +1 -0
- package/src/plugins/daos/index.js +13 -0
- package/src/plugins/daos/index.js.map +1 -0
- package/src/plugins/{realms/depositsFetcher.js → daos/realmsDepositsFetcher.js} +1 -1
- package/src/plugins/daos/realmsDepositsFetcher.js.map +1 -0
- package/src/plugins/{realms/programsJob.js → daos/realmsProgramsJob.js} +4 -4
- package/src/plugins/daos/realmsProgramsJob.js.map +1 -0
- package/src/plugins/daos/structs/realms.js.map +1 -0
- package/src/plugins/{realms → daos}/types.d.ts +1 -1
- package/src/plugins/daos/types.js.map +1 -0
- package/src/plugins/flexlend/depositsFetcher.js +63 -4
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/flexlend/struct.d.ts +18 -0
- package/src/plugins/flexlend/struct.js +18 -0
- package/src/plugins/flexlend/struct.js.map +1 -0
- package/src/plugins/hawksight/positionsFetcher.js +31 -13
- package/src/plugins/hawksight/positionsFetcher.js.map +1 -1
- package/src/plugins/meteora/poolsJob.js +25 -3
- package/src/plugins/meteora/poolsJob.js.map +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.d.ts +2 -3
- package/src/plugins/orca/getWhirlpoolPositions.js +2 -14
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/plugins/orca/helpers.d.ts +2 -2
- package/src/plugins/orca/helpers.js +1 -1
- package/src/plugins/orca/helpers.js.map +1 -1
- package/src/plugins/raydium/getRaydiumCLMMPositions.d.ts +2 -3
- package/src/plugins/raydium/getRaydiumCLMMPositions.js +3 -3
- package/src/plugins/raydium/getRaydiumCLMMPositions.js.map +1 -1
- package/src/plugins/raydium/helpers.d.ts +2 -2
- package/src/plugins/raydium/helpers.js +6 -1
- package/src/plugins/raydium/helpers.js.map +1 -1
- package/src/plugins/solend/constants.d.ts +1 -0
- package/src/plugins/solend/constants.js +2 -1
- package/src/plugins/solend/constants.js.map +1 -1
- package/src/plugins/solend/helpers.d.ts +6 -0
- package/src/plugins/solend/helpers.js +132 -1
- package/src/plugins/solend/helpers.js.map +1 -1
- package/src/plugins/solend/marketsJob.js +6 -0
- package/src/plugins/solend/marketsJob.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +27 -156
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/solend/reservesJob.js +15 -6
- package/src/plugins/solend/reservesJob.js.map +1 -1
- package/src/plugins/solend/types.d.ts +1 -1
- package/src/plugins/suilend/obligationsFetcher.js +2 -0
- package/src/plugins/suilend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js +26 -15
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js.map +1 -1
- package/src/plugins/tokens/fetchers/solana.js +3 -1
- package/src/plugins/tokens/fetchers/solana.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/solana/das/getAssetsByOwnerDas.d.ts +2 -2
- package/src/utils/solana/das/getAssetsByOwnerDas.js +3 -9
- package/src/utils/solana/das/getAssetsByOwnerDas.js.map +1 -1
- package/src/utils/solana/das/getDisplayOptions.d.ts +2 -0
- package/src/utils/solana/das/getDisplayOptions.js +16 -0
- package/src/utils/solana/das/getDisplayOptions.js.map +1 -0
- package/src/utils/solana/das/types.d.ts +8 -0
- package/src/plugins/phoenix/constants.d.ts +0 -7
- package/src/plugins/phoenix/constants.js +0 -17
- package/src/plugins/phoenix/constants.js.map +0 -1
- package/src/plugins/phoenix/helpers.d.ts +0 -6
- package/src/plugins/phoenix/helpers.js +0 -46
- package/src/plugins/phoenix/helpers.js.map +0 -1
- package/src/plugins/phoenix/helpers2.d.ts +0 -0
- package/src/plugins/phoenix/helpers2.js +0 -179
- package/src/plugins/phoenix/helpers2.js.map +0 -1
- package/src/plugins/phoenix/index.js +0 -10
- package/src/plugins/phoenix/index.js.map +0 -1
- package/src/plugins/phoenix/marketsJob.js +0 -39
- package/src/plugins/phoenix/marketsJob.js.map +0 -1
- package/src/plugins/phoenix/positionsFetcher.js +0 -64
- package/src/plugins/phoenix/positionsFetcher.js.map +0 -1
- package/src/plugins/phoenix/structs.d.ts +0 -67
- package/src/plugins/phoenix/structs.js +0 -82
- package/src/plugins/phoenix/structs.js.map +0 -1
- package/src/plugins/phoenix/types.d.ts +0 -29
- package/src/plugins/phoenix/types.js.map +0 -1
- package/src/plugins/realms/constants.js.map +0 -1
- package/src/plugins/realms/depositsFetcher.d.ts +0 -3
- package/src/plugins/realms/depositsFetcher.js.map +0 -1
- package/src/plugins/realms/filters.js.map +0 -1
- package/src/plugins/realms/helpers.d.ts +0 -11
- package/src/plugins/realms/helpers.js.map +0 -1
- package/src/plugins/realms/index.js +0 -13
- package/src/plugins/realms/index.js.map +0 -1
- package/src/plugins/realms/programsJob.d.ts +0 -3
- package/src/plugins/realms/programsJob.js.map +0 -1
- package/src/plugins/realms/structs/realms.js.map +0 -1
- package/src/plugins/realms/types.js.map +0 -1
- package/src/plugins/spl-staking/constants.js.map +0 -1
- package/src/plugins/spl-staking/filters.js.map +0 -1
- package/src/plugins/spl-staking/index.d.ts +0 -6
- package/src/plugins/spl-staking/index.js.map +0 -1
- package/src/plugins/spl-staking/poolsJob.js.map +0 -1
- package/src/plugins/spl-staking/stakingFetcher.js.map +0 -1
- package/src/plugins/spl-staking/structs.js.map +0 -1
- package/src/plugins/spl-staking/types.js +0 -3
- package/src/plugins/spl-staking/types.js.map +0 -1
- /package/src/plugins/{spl-staking → armada-staking}/constants.d.ts +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/constants.js +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/filters.d.ts +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/filters.js +0 -0
- /package/src/plugins/{phoenix → armada-staking}/index.d.ts +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/poolsJob.d.ts +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/poolsJob.js +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/stakingFetcher.d.ts +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/stakingFetcher.js +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/structs.d.ts +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/structs.js +0 -0
- /package/src/plugins/{spl-staking → armada-staking}/types.d.ts +0 -0
- /package/src/plugins/{phoenix → armada-staking}/types.js +0 -0
- /package/src/plugins/{realms → daos}/filters.d.ts +0 -0
- /package/src/plugins/{realms → daos}/filters.js +0 -0
- /package/src/plugins/{realms → daos}/index.d.ts +0 -0
- /package/src/plugins/{phoenix/positionsFetcher.d.ts → daos/realmsDepositsFetcher.d.ts} +0 -0
- /package/src/plugins/{phoenix/marketsJob.d.ts → daos/realmsProgramsJob.d.ts} +0 -0
- /package/src/plugins/{realms → daos}/structs/realms.d.ts +0 -0
- /package/src/plugins/{realms → daos}/structs/realms.js +0 -0
- /package/src/plugins/{realms → daos}/types.js +0 -0
@@ -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;
|
@@ -8,17 +8,20 @@ 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
|
+
};
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
-
const web3_js_1 = require("@solana/web3.js");
|
14
|
-
const js_1 = require("@metaplex-foundation/js");
|
15
16
|
const constants_1 = require("../constants");
|
16
|
-
const clients_1 = require("../../../utils/clients");
|
17
17
|
const getRaydiumCLMMPositions_1 = require("../../raydium/getRaydiumCLMMPositions");
|
18
18
|
const getWhirlpoolPositions_1 = require("../../orca/getWhirlpoolPositions");
|
19
19
|
const helpers_1 = require("../../raydium/helpers");
|
20
20
|
const helpers_2 = require("../../orca/helpers");
|
21
|
-
const helpers_3 = require("../../
|
21
|
+
const helpers_3 = require("../../daos/helpers");
|
22
|
+
const getSolanaDasEndpoint_1 = __importDefault(require("../../../utils/clients/getSolanaDasEndpoint"));
|
23
|
+
const getAssetsByOwnerDas_1 = require("../../../utils/solana/das/getAssetsByOwnerDas");
|
24
|
+
const heliusAssetToAssetCollectible_1 = require("../../../utils/solana/das/heliusAssetToAssetCollectible");
|
22
25
|
// Add here any pair of [Identifier,Appraiser] =
|
23
26
|
// Identifier : a string to filter the asset concerned
|
24
27
|
// Appraiser : the function to apply to those asset to get their underlying value
|
@@ -27,26 +30,34 @@ const helpers_3 = require("../../realms/helpers");
|
|
27
30
|
const appraiserByIdentifier = new Map([
|
28
31
|
[helpers_1.isARaydiumPosition, getRaydiumCLMMPositions_1.getRaydiumCLMMPositions],
|
29
32
|
[helpers_2.isAnOrcaPosition, getWhirlpoolPositions_1.getWhirlpoolPositions],
|
30
|
-
[helpers_3.
|
33
|
+
[helpers_3.isAnHeliumNFTVote, helpers_3.getHeliumElementsFromNFTs],
|
31
34
|
]);
|
32
35
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
33
|
-
var _a;
|
34
|
-
const
|
35
|
-
const
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
var _a, _b;
|
37
|
+
const dasEndpoint = (0, getSolanaDasEndpoint_1.default)();
|
38
|
+
const displayOptions = {
|
39
|
+
showCollectionMetadata: true,
|
40
|
+
showUnverifiedCollections: true,
|
41
|
+
showInscription: false,
|
42
|
+
showNativeBalance: false,
|
43
|
+
showGrandTotal: false,
|
44
|
+
showFungible: true,
|
45
|
+
};
|
46
|
+
const assets = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner, displayOptions);
|
40
47
|
const nftsByIndentifier = new Map();
|
41
|
-
for (let n = 0; n <
|
42
|
-
const nft =
|
48
|
+
for (let n = 0; n < assets.length; n++) {
|
49
|
+
const nft = (0, heliusAssetToAssetCollectible_1.heliusAssetToAssetCollectible)(assets[n]);
|
50
|
+
if (!nft)
|
51
|
+
continue;
|
52
|
+
if ((_a = nft.attributes.tags) === null || _a === void 0 ? void 0 : _a.includes('compressed'))
|
53
|
+
continue;
|
43
54
|
for (const identifier of appraiserByIdentifier.keys()) {
|
44
55
|
if (identifier(nft)) {
|
45
56
|
if (!nftsByIndentifier.get(identifier)) {
|
46
57
|
nftsByIndentifier.set(identifier, [nft]);
|
47
58
|
}
|
48
59
|
else {
|
49
|
-
(
|
60
|
+
(_b = nftsByIndentifier.get(identifier)) === null || _b === void 0 ? void 0 : _b.push(nft);
|
50
61
|
}
|
51
62
|
}
|
52
63
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,4CAAoD;AAEpD,mFAAgF;AAChF,4EAAyE;AACzE,m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AI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;oBACvC,iBAAiB,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3C,CAAC;qBAAM,CAAC;oBACN,MAAA,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,0CAAE,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,iBAAiB,GAAkC,EAAE,CAAC;IAC5D,KAAK,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,qBAAqB,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,IAAI;YAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE3D,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC1D,IAAI,EAAE,CAAC;IAEV,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,0BAA0B;IACxD,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -24,7 +24,9 @@ const isHeliusFungibleAsset_1 = require("../../../utils/solana/das/isHeliusFungi
|
|
24
24
|
const getSolanaDasEndpoint_1 = __importDefault(require("../../../utils/clients/getSolanaDasEndpoint"));
|
25
25
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
26
|
const dasEndpoint = (0, getSolanaDasEndpoint_1.default)();
|
27
|
-
const items = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner
|
27
|
+
const items = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner, {
|
28
|
+
showNativeBalance: false,
|
29
|
+
});
|
28
30
|
const fungibleAddresses = items.reduce((addresses, curr) => {
|
29
31
|
if ((0, isHeliusFungibleAsset_1.isHeliusFungibleAsset)(curr))
|
30
32
|
addresses.push(curr.id);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAErC,4CAAwE;AAExE,wCAAkD;AAClD,wGAAgF;AAChF,sGAA8E;AAC9E,2GAAwG;AACxG,uFAAoF;AACpF,2FAAwF;AACxF,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,WAAW,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,IAAA,yCAAmB,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAErC,4CAAwE;AAExE,wCAAkD;AAClD,wGAAgF;AAChF,sGAA8E;AAC9E,2GAAwG;AACxG,uFAAoF;AACpF,2FAAwF;AACxF,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,WAAW,GAAG,IAAA,8BA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;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,SAAS;IACvC,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,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;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { RpcEndpoint } from '@sonarwatch/portfolio-core';
|
2
|
-
import { HeliusAsset } from './types';
|
3
|
-
export declare function getAssetsByOwnerDas(dasEndpoint: RpcEndpoint, owner: string): Promise<HeliusAsset[]>;
|
2
|
+
import { DisplayOptions, HeliusAsset } from './types';
|
3
|
+
export declare function getAssetsByOwnerDas(dasEndpoint: RpcEndpoint, owner: string, displayOptions?: DisplayOptions): Promise<HeliusAsset[]>;
|
@@ -15,9 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.getAssetsByOwnerDas = void 0;
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
17
17
|
const getBasicAuthHeaders_1 = require("../../misc/getBasicAuthHeaders");
|
18
|
+
const getDisplayOptions_1 = require("./getDisplayOptions");
|
18
19
|
const limit = 1000;
|
19
20
|
const maxPage = 10;
|
20
|
-
function getAssetsByOwnerDas(dasEndpoint, owner) {
|
21
|
+
function getAssetsByOwnerDas(dasEndpoint, owner, displayOptions) {
|
21
22
|
return __awaiter(this, void 0, void 0, function* () {
|
22
23
|
const httpHeaders = dasEndpoint.basicAuth
|
23
24
|
? (0, getBasicAuthHeaders_1.getBasicAuthHeaders)(dasEndpoint.basicAuth.username, dasEndpoint.basicAuth.password)
|
@@ -38,14 +39,7 @@ function getAssetsByOwnerDas(dasEndpoint, owner) {
|
|
38
39
|
sortBy: 'id',
|
39
40
|
sortDirection: 'asc',
|
40
41
|
},
|
41
|
-
displayOptions:
|
42
|
-
showNativeBalance: false,
|
43
|
-
showFungible: true,
|
44
|
-
showInscription: true,
|
45
|
-
showUnverifiedCollections: true,
|
46
|
-
showCollectionMetadata: true,
|
47
|
-
showGrandTotal: true,
|
48
|
-
},
|
42
|
+
displayOptions: (0, getDisplayOptions_1.getDisplayOptions)(displayOptions),
|
49
43
|
},
|
50
44
|
}, {
|
51
45
|
headers: Object.assign({ 'Content-Type': 'application/json' }, httpHeaders),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getAssetsByOwnerDas.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/getAssetsByOwnerDas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA6C;AAE7C,wEAAqE;
|
1
|
+
{"version":3,"file":"getAssetsByOwnerDas.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/getAssetsByOwnerDas.ts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;CAAA;AAhDD,kDAgDC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getDisplayOptions = void 0;
|
4
|
+
function getDisplayOptions(displayOptions) {
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
6
|
+
return {
|
7
|
+
showCollectionMetadata: (_a = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showCollectionMetadata) !== null && _a !== void 0 ? _a : true,
|
8
|
+
showFungible: (_b = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showFungible) !== null && _b !== void 0 ? _b : true,
|
9
|
+
showGrandTotal: (_c = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showGrandTotal) !== null && _c !== void 0 ? _c : true,
|
10
|
+
showInscription: (_d = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showInscription) !== null && _d !== void 0 ? _d : true,
|
11
|
+
showNativeBalance: (_e = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showNativeBalance) !== null && _e !== void 0 ? _e : true,
|
12
|
+
showUnverifiedCollections: (_f = displayOptions === null || displayOptions === void 0 ? void 0 : displayOptions.showUnverifiedCollections) !== null && _f !== void 0 ? _f : true,
|
13
|
+
};
|
14
|
+
}
|
15
|
+
exports.getDisplayOptions = getDisplayOptions;
|
16
|
+
//# sourceMappingURL=getDisplayOptions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getDisplayOptions.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/getDisplayOptions.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAC/B,cAA+B;;IAE/B,OAAO;QACL,sBAAsB,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,sBAAsB,mCAAI,IAAI;QACtE,YAAY,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,YAAY,mCAAI,IAAI;QAClD,cAAc,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,cAAc,mCAAI,IAAI;QACtD,eAAe,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,eAAe,mCAAI,IAAI;QACxD,iBAAiB,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,iBAAiB,mCAAI,IAAI;QAC5D,yBAAyB,EACvB,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,yBAAyB,mCAAI,IAAI;KACpD,CAAC;AACJ,CAAC;AAZD,8CAYC"}
|
@@ -1,3 +1,11 @@
|
|
1
|
+
export type DisplayOptions = {
|
2
|
+
showNativeBalance?: boolean;
|
3
|
+
showFungible?: boolean;
|
4
|
+
showInscription?: boolean;
|
5
|
+
showUnverifiedCollections?: boolean;
|
6
|
+
showCollectionMetadata?: boolean;
|
7
|
+
showGrandTotal?: boolean;
|
8
|
+
};
|
1
9
|
export type GetAssetsByOwnerOutput = {
|
2
10
|
jsonrpc: string;
|
3
11
|
result: HeliusAssetList;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { PublicKey } from '@solana/web3.js';
|
2
|
-
import { Platform } from '@sonarwatch/portfolio-core';
|
3
|
-
export declare const platformId = "phoenix";
|
4
|
-
export declare const platform: Platform;
|
5
|
-
export declare const marketsCachePrefix = "phoenix-markets";
|
6
|
-
export declare const phoenixPid: PublicKey;
|
7
|
-
export declare const phoenixSeatManagerPid: PublicKey;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.phoenixSeatManagerPid = exports.phoenixPid = exports.marketsCachePrefix = exports.platform = exports.platformId = void 0;
|
4
|
-
const web3_js_1 = require("@solana/web3.js");
|
5
|
-
exports.platformId = 'phoenix';
|
6
|
-
exports.platform = {
|
7
|
-
id: exports.platformId,
|
8
|
-
name: 'Phoenix',
|
9
|
-
image: 'https://sonar.watch/img/platforms/phoenix.webp',
|
10
|
-
website: 'https://www.phoenix.trade/',
|
11
|
-
twitter: 'https://twitter.com/PhoenixTrade',
|
12
|
-
defiLlamaId: 'phoenix', // from https://defillama.com/docs/api
|
13
|
-
};
|
14
|
-
exports.marketsCachePrefix = `${exports.platformId}-markets`;
|
15
|
-
exports.phoenixPid = new web3_js_1.PublicKey('PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY');
|
16
|
-
exports.phoenixSeatManagerPid = new web3_js_1.PublicKey('PSMxQbAoDWDbvd9ezQJgARyq6R9L5kJAasaLDVcZwf1');
|
17
|
-
//# sourceMappingURL=constants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/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,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,kCAAkC;IAC3C,WAAW,EAAE,SAAS,EAAE,sCAAsC;CAC/D,CAAC;AACW,QAAA,kBAAkB,GAAG,GAAG,kBAAU,UAAU,CAAC;AAC7C,QAAA,UAAU,GAAG,IAAI,mBAAS,CACrC,6CAA6C,CAC9C,CAAC;AACW,QAAA,qBAAqB,GAAG,IAAI,mBAAS,CAChD,6CAA6C,CAC9C,CAAC"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { PublicKey } from '@solana/web3.js';
|
2
|
-
import { MarketHeaderAccount } from './structs';
|
3
|
-
import { MarketHeader } from './types';
|
4
|
-
export declare function marketHeaderAccountToMarketHeader(marketHeaderAccount: MarketHeaderAccount): MarketHeader;
|
5
|
-
export declare function getSeatManagerAddress(market: PublicKey): PublicKey;
|
6
|
-
export declare function getSeatAddress(market: PublicKey, trader: PublicKey): PublicKey;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getSeatAddress = exports.getSeatManagerAddress = exports.marketHeaderAccountToMarketHeader = void 0;
|
4
|
-
const web3_js_1 = require("@solana/web3.js");
|
5
|
-
const constants_1 = require("./constants");
|
6
|
-
function marketHeaderAccountToMarketHeader(marketHeaderAccount) {
|
7
|
-
return {
|
8
|
-
discriminant: marketHeaderAccount.discriminant.toString(),
|
9
|
-
status: marketHeaderAccount.status.toString(),
|
10
|
-
marketSizeParams: {
|
11
|
-
bidsSize: marketHeaderAccount.marketSizeParams.bidsSize.toString(),
|
12
|
-
asksSize: marketHeaderAccount.marketSizeParams.asksSize.toString(),
|
13
|
-
numSeats: marketHeaderAccount.marketSizeParams.numSeats.toString(),
|
14
|
-
},
|
15
|
-
baseParams: {
|
16
|
-
decimals: marketHeaderAccount.baseParams.decimals,
|
17
|
-
vaultBump: marketHeaderAccount.baseParams.vaultBump,
|
18
|
-
mintKey: marketHeaderAccount.baseParams.mintKey.toString(),
|
19
|
-
vaultKey: marketHeaderAccount.baseParams.vaultKey.toString(),
|
20
|
-
},
|
21
|
-
baseLotSize: marketHeaderAccount.baseLotSize.toString(),
|
22
|
-
quoteParams: {
|
23
|
-
decimals: marketHeaderAccount.quoteParams.decimals,
|
24
|
-
vaultBump: marketHeaderAccount.quoteParams.vaultBump,
|
25
|
-
mintKey: marketHeaderAccount.quoteParams.mintKey.toString(),
|
26
|
-
vaultKey: marketHeaderAccount.quoteParams.vaultKey.toString(),
|
27
|
-
},
|
28
|
-
quoteLotSize: marketHeaderAccount.quoteLotSize.toString(),
|
29
|
-
tickSizeInQuoteAtomsPerBaseUnit: marketHeaderAccount.tickSizeInQuoteAtomsPerBaseUnit.toString(),
|
30
|
-
authority: marketHeaderAccount.authority.toString(),
|
31
|
-
feeRecipient: marketHeaderAccount.feeRecipient.toString(),
|
32
|
-
marketSequenceNumber: marketHeaderAccount.marketSequenceNumber.toString(),
|
33
|
-
successor: marketHeaderAccount.successor.toString(),
|
34
|
-
rawBaseUnitsPerBaseUnit: marketHeaderAccount.rawBaseUnitsPerBaseUnit,
|
35
|
-
};
|
36
|
-
}
|
37
|
-
exports.marketHeaderAccountToMarketHeader = marketHeaderAccountToMarketHeader;
|
38
|
-
function getSeatManagerAddress(market) {
|
39
|
-
return web3_js_1.PublicKey.findProgramAddressSync([market.toBuffer()], constants_1.phoenixSeatManagerPid)[0];
|
40
|
-
}
|
41
|
-
exports.getSeatManagerAddress = getSeatManagerAddress;
|
42
|
-
function getSeatAddress(market, trader) {
|
43
|
-
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('seat'), market.toBuffer(), trader.toBuffer()], constants_1.phoenixPid)[0];
|
44
|
-
}
|
45
|
-
exports.getSeatAddress = getSeatAddress;
|
46
|
-
//# sourceMappingURL=helpers.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG5C,2CAAgE;AAEhE,SAAgB,iCAAiC,CAC/C,mBAAwC;IAExC,OAAO;QACL,YAAY,EAAE,mBAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE;QACzD,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC7C,gBAAgB,EAAE;YAChB,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClE,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClE,QAAQ,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE;SACnE;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,QAAQ;YACjD,SAAS,EAAE,mB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AI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,EAC3D,sBAAU,CACX,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AARD,wCAQC"}
|
File without changes
|
@@ -1,179 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// import { BeetArgsStruct } from '@metaplex-foundation/beet';
|
3
|
-
// import { TraderState, marketHeaderStruct, orderIdBeet } from './structs';
|
4
|
-
// export function deserializeRedBlackTree<Key, Value>(
|
5
|
-
// data: Buffer,
|
6
|
-
// keyDeserializer: BeetArgsStruct<Key>,
|
7
|
-
// valueDeserializer: BeetArgsStruct<Value>
|
8
|
-
// ): Map<Key, Value> {
|
9
|
-
// const tree = new Map<Key, Value>();
|
10
|
-
// const treeNodes = deserializeRedBlackTreeNodes(
|
11
|
-
// data,
|
12
|
-
// keyDeserializer,
|
13
|
-
// valueDeserializer
|
14
|
-
// );
|
15
|
-
// const nodes = treeNodes[0];
|
16
|
-
// const freeNodes = treeNodes[1];
|
17
|
-
// for (const [index, [key, value]] of nodes.entries()) {
|
18
|
-
// if (!freeNodes.has(index)) {
|
19
|
-
// tree.set(key, value);
|
20
|
-
// }
|
21
|
-
// }
|
22
|
-
// return tree;
|
23
|
-
// }
|
24
|
-
// function deserializeRedBlackTreeNodes<Key, Value>(
|
25
|
-
// data: Buffer,
|
26
|
-
// keyDeserializer: BeetArgsStruct<Key>,
|
27
|
-
// valueDeserializer: BeetArgsStruct<Value>
|
28
|
-
// ): [Array<[Key, Value]>, Set<number>] {
|
29
|
-
// let offset = 0;
|
30
|
-
// const keySize = keyDeserializer.byteSize;
|
31
|
-
// const valueSize = valueDeserializer.byteSize;
|
32
|
-
// const nodes = new Array<[Key, Value]>();
|
33
|
-
// // Skip RBTree header
|
34
|
-
// offset += 16;
|
35
|
-
// // Skip node allocator size
|
36
|
-
// offset += 8;
|
37
|
-
// const bumpIndex = data.readInt32LE(offset);
|
38
|
-
// offset += 4;
|
39
|
-
// let freeListHead = data.readInt32LE(offset);
|
40
|
-
// offset += 4;
|
41
|
-
// const freeListPointers = new Array<[number, number]>();
|
42
|
-
// for (let index = 0; offset < data.length && index < bumpIndex - 1; index++) {
|
43
|
-
// const registers = new Array<number>();
|
44
|
-
// for (let i = 0; i < 4; i++) {
|
45
|
-
// registers.push(data.readInt32LE(offset)); // skip padding
|
46
|
-
// offset += 4;
|
47
|
-
// }
|
48
|
-
// const [key] = keyDeserializer.deserialize(
|
49
|
-
// data.subarray(offset, offset + keySize)
|
50
|
-
// );
|
51
|
-
// offset += keySize;
|
52
|
-
// const [value] = valueDeserializer.deserialize(
|
53
|
-
// data.subarray(offset, offset + valueSize)
|
54
|
-
// );
|
55
|
-
// offset += valueSize;
|
56
|
-
// nodes.push([key, value]);
|
57
|
-
// freeListPointers.push([index, registers[0]]);
|
58
|
-
// }
|
59
|
-
// const freeNodes = new Set<number>();
|
60
|
-
// let indexToRemove = freeListHead - 1;
|
61
|
-
// let counter = 0;
|
62
|
-
// // If there's an infinite loop here, that means that the state is corrupted
|
63
|
-
// while (freeListHead < bumpIndex) {
|
64
|
-
// // We need to subtract 1 because the node allocator is 1-indexed
|
65
|
-
// const next = freeListPointers[freeListHead - 1];
|
66
|
-
// [indexToRemove, freeListHead] = next;
|
67
|
-
// freeNodes.add(indexToRemove);
|
68
|
-
// counter += 1;
|
69
|
-
// if (counter > bumpIndex) {
|
70
|
-
// throw new Error('Infinite loop detected');
|
71
|
-
// }
|
72
|
-
// }
|
73
|
-
// return [nodes, freeNodes];
|
74
|
-
// }
|
75
|
-
// export function deserializeMarketData(data: Buffer) {
|
76
|
-
// // Deserialize the market header
|
77
|
-
// let offset = marketHeaderStruct.byteSize;
|
78
|
-
// const [header] = marketHeaderStruct.deserialize(data.subarray(0, offset));
|
79
|
-
// // Parse market data
|
80
|
-
// const paddingLen = 8 * 32;
|
81
|
-
// let remaining = data.subarray(offset + paddingLen);
|
82
|
-
// offset = 0;
|
83
|
-
// const baseLotsPerBaseUnit = Number(remaining.readBigUInt64LE(offset));
|
84
|
-
// offset += 8;
|
85
|
-
// const quoteLotsPerBaseUnitPerTick = Number(remaining.readBigUInt64LE(offset));
|
86
|
-
// offset += 8;
|
87
|
-
// const sequenceNumber = Number(remaining.readBigUInt64LE(offset));
|
88
|
-
// offset += 8;
|
89
|
-
// const takerFeeBps = Number(remaining.readBigUInt64LE(offset));
|
90
|
-
// offset += 8;
|
91
|
-
// const collectedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
|
92
|
-
// offset += 8;
|
93
|
-
// const unclaimedQuoteLotFees = Number(remaining.readBigUInt64LE(offset));
|
94
|
-
// offset += 8;
|
95
|
-
// remaining = remaining.subarray(offset);
|
96
|
-
// // Parse bids, asks and traders
|
97
|
-
// const numBids = header.marketSizeParams.bidsSize.toNumber();
|
98
|
-
// const numAsks = header.marketSizeParams.asksSize.toNumber();
|
99
|
-
// const numTraders = header.marketSizeParams.numSeats.toNumber();
|
100
|
-
// const bidsSize =
|
101
|
-
// 16 + 16 + (16 + orderIdBeet.byteSize + restingOrderBeet.byteSize) * numBids;
|
102
|
-
// const asksSize =
|
103
|
-
// 16 + 16 + (16 + orderIdBeet.byteSize + restingOrderBeet.byteSize) * numAsks;
|
104
|
-
// const tradersSize =
|
105
|
-
// 16 + 16 + (16 + 32 + traderStateBeet.byteSize) * numTraders;
|
106
|
-
// offset = 0;
|
107
|
-
// const bidBuffer = remaining.subarray(offset, offset + bidsSize);
|
108
|
-
// offset += bidsSize;
|
109
|
-
// const askBuffer = remaining.subarray(offset, offset + asksSize);
|
110
|
-
// offset += asksSize;
|
111
|
-
// const traderBuffer = remaining.subarray(offset, offset + tradersSize);
|
112
|
-
// const bidsUnsorted = deserializeRedBlackTree(
|
113
|
-
// bidBuffer,
|
114
|
-
// orderIdBeet,
|
115
|
-
// restingOrderBeet
|
116
|
-
// );
|
117
|
-
// const asksUnsorted = deserializeRedBlackTree(
|
118
|
-
// askBuffer,
|
119
|
-
// orderIdBeet,
|
120
|
-
// restingOrderBeet
|
121
|
-
// );
|
122
|
-
// // Sort bids in descending order of price, and ascending order of sequence number
|
123
|
-
// const bids = [...bidsUnsorted].sort((a, b) => {
|
124
|
-
// const priceComparison = sign(
|
125
|
-
// toBN(b[0].priceInTicks).sub(toBN(a[0].priceInTicks))
|
126
|
-
// );
|
127
|
-
// if (priceComparison !== 0) {
|
128
|
-
// return priceComparison;
|
129
|
-
// }
|
130
|
-
// return sign(
|
131
|
-
// getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0]))
|
132
|
-
// );
|
133
|
-
// });
|
134
|
-
// // Sort asks in ascending order of price, and ascending order of sequence number
|
135
|
-
// const asks = [...asksUnsorted].sort((a, b) => {
|
136
|
-
// const priceComparison = sign(
|
137
|
-
// toBN(a[0].priceInTicks).sub(toBN(b[0].priceInTicks))
|
138
|
-
// );
|
139
|
-
// if (priceComparison !== 0) {
|
140
|
-
// return priceComparison;
|
141
|
-
// }
|
142
|
-
// return sign(
|
143
|
-
// getUiOrderSequenceNumber(a[0]).sub(getUiOrderSequenceNumber(b[0]))
|
144
|
-
// );
|
145
|
-
// });
|
146
|
-
// const traders = new Map<string, TraderState>();
|
147
|
-
// for (const [k, traderState] of deserializeRedBlackTree(
|
148
|
-
// traderBuffer,
|
149
|
-
// publicKeyBeet,
|
150
|
-
// traderStateBeet
|
151
|
-
// )) {
|
152
|
-
// traders.set(k.publicKey.toString(), traderState);
|
153
|
-
// }
|
154
|
-
// const traderPubkeyToTraderIndex = new Map<string, number>();
|
155
|
-
// const traderIndexToTraderPubkey = new Map<number, string>();
|
156
|
-
// for (const [k, index] of getNodeIndices(
|
157
|
-
// traderBuffer,
|
158
|
-
// publicKeyBeet,
|
159
|
-
// traderStateBeet
|
160
|
-
// )) {
|
161
|
-
// traderPubkeyToTraderIndex.set(k.publicKey.toString(), index);
|
162
|
-
// traderIndexToTraderPubkey.set(index, k.publicKey.toString());
|
163
|
-
// }
|
164
|
-
// return {
|
165
|
-
// header,
|
166
|
-
// baseLotsPerBaseUnit,
|
167
|
-
// quoteLotsPerBaseUnitPerTick,
|
168
|
-
// orderSequenceNumber: sequenceNumber,
|
169
|
-
// takerFeeBps,
|
170
|
-
// collectedQuoteLotFees,
|
171
|
-
// unclaimedQuoteLotFees,
|
172
|
-
// bids,
|
173
|
-
// asks,
|
174
|
-
// traders,
|
175
|
-
// traderPubkeyToTraderIndex,
|
176
|
-
// traderIndexToTraderPubkey,
|
177
|
-
// };
|
178
|
-
// }
|
179
|
-
//# sourceMappingURL=helpers2.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"helpers2.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/phoenix/helpers2.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,4EAA4E;AAE5E,uDAAuD;AACvD,kBAAkB;AAClB,0CAA0C;AAC1C,6CAA6C;AAC7C,uBAAuB;AACvB,wCAAwC;AACxC,oDAAoD;AACpD,YAAY;AACZ,uBAAuB;AACvB,wBAAwB;AACxB,OAAO;AAEP,gCAAgC;AAChC,oCAAoC;AAEpC,2DAA2D;AAC3D,mCAAmC;AACnC,8BAA8B;AAC9B,QAAQ;AACR,MAAM;AAEN,iBAAiB;AACjB,IAAI;AAEJ,qDAAqD;AACrD,kBAAkB;AAClB,0CAA0C;AAC1C,6CAA6C;AAC7C,0CAA0C;AAC1C,oBAAoB;AACpB,8CAA8C;AAC9C,kDAAkD;AAElD,6CAA6C;AAE7C,0BAA0B;AAC1B,kBAAkB;AAElB,gCAAgC;AAChC,iBAAiB;AACjB,gDAAgD;AAChD,iBAAiB;AACjB,iDAAiD;AACjD,iBAAiB;AAEjB,4DAA4D;AAE5D,kFAAkF;AAClF,6CAA6C;AAC7C,oCAAoC;AACpC,kEAAkE;AAClE,qBAAqB;AACrB,QAAQ;AACR,iDAAiD;AACjD,gDAAgD;AAChD,SAAS;AACT,yBAAyB;AACzB,qDAAqD;AACrD,kD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