@tokemak/queries 0.6.0 → 0.8.1
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/dist/functions/getAutopools.d.ts +3 -1
- package/dist/functions/getAutopools.d.ts.map +1 -1
- package/dist/functions/getChainAutopools.d.ts +19 -17
- package/dist/functions/getChainAutopools.d.ts.map +1 -1
- package/dist/functions/getDeprecatedAutopools.d.ts +347 -0
- package/dist/functions/getDeprecatedAutopools.d.ts.map +1 -0
- package/dist/functions/getEthAutoLP.d.ts +1 -1
- package/dist/functions/getEthAutoLP.d.ts.map +1 -1
- package/dist/functions/getEthPriceAtBlock.d.ts +2 -2
- package/dist/functions/getEthPriceAtBlock.d.ts.map +1 -1
- package/dist/functions/getPoolsAndDestinations.d.ts +4 -2
- package/dist/functions/getPoolsAndDestinations.d.ts.map +1 -1
- package/dist/functions/getRebalanceStats.d.ts +5 -4
- package/dist/functions/getRebalanceStats.d.ts.map +1 -1
- package/dist/functions/getUniV4Pool.d.ts +13 -17
- package/dist/functions/getUniV4Pool.d.ts.map +1 -1
- package/dist/functions/getUserUniV4Positions.d.ts +1 -0
- package/dist/functions/getUserUniV4Positions.d.ts.map +1 -1
- package/dist/functions/index.d.ts +3 -23
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/uniV4Subgraph.d.ts +45 -0
- package/dist/functions/uniV4Subgraph.d.ts.map +1 -0
- package/dist/index.js +456 -1728
- package/dist/index.mjs +328 -1603
- package/dist/safe.js +49 -22
- package/dist/safe.mjs +45 -18
- package/dist/utils/getChainsForEnv.d.ts +12 -3
- package/dist/utils/getChainsForEnv.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/functions/getAllowance.d.ts +0 -8
- package/dist/functions/getAllowance.d.ts.map +0 -1
- package/dist/functions/getAutopoolsRebalances.d.ts +0 -53
- package/dist/functions/getAutopoolsRebalances.d.ts.map +0 -1
- package/dist/functions/getChainCycleRolloverBlockNumber.d.ts +0 -7
- package/dist/functions/getChainCycleRolloverBlockNumber.d.ts.map +0 -1
- package/dist/functions/getChainSToke.d.ts +0 -15
- package/dist/functions/getChainSToke.d.ts.map +0 -1
- package/dist/functions/getChainSTokeRewards.d.ts +0 -16
- package/dist/functions/getChainSTokeRewards.d.ts.map +0 -1
- package/dist/functions/getChainUserSToke.d.ts +0 -33
- package/dist/functions/getChainUserSToke.d.ts.map +0 -1
- package/dist/functions/getChainUserSTokeRewards.d.ts +0 -30
- package/dist/functions/getChainUserSTokeRewards.d.ts.map +0 -1
- package/dist/functions/getCombinedRewards.d.ts +0 -11
- package/dist/functions/getCombinedRewards.d.ts.map +0 -1
- package/dist/functions/getCurveLP.d.ts +0 -3
- package/dist/functions/getCurveLP.d.ts.map +0 -1
- package/dist/functions/getCycleV1.d.ts +0 -10
- package/dist/functions/getCycleV1.d.ts.map +0 -1
- package/dist/functions/getEthPrice.d.ts +0 -2
- package/dist/functions/getEthPrice.d.ts.map +0 -1
- package/dist/functions/getLayerzeroStatus.d.ts +0 -24
- package/dist/functions/getLayerzeroStatus.d.ts.map +0 -1
- package/dist/functions/getMultipleAutopoolRebalances.d.ts +0 -54
- package/dist/functions/getMultipleAutopoolRebalances.d.ts.map +0 -1
- package/dist/functions/getProtocolStats.d.ts +0 -41
- package/dist/functions/getProtocolStats.d.ts.map +0 -1
- package/dist/functions/getSToke.d.ts +0 -23
- package/dist/functions/getSToke.d.ts.map +0 -1
- package/dist/functions/getSTokeRewards.d.ts +0 -22
- package/dist/functions/getSTokeRewards.d.ts.map +0 -1
- package/dist/functions/getSushiLP.d.ts +0 -14
- package/dist/functions/getSushiLP.d.ts.map +0 -1
- package/dist/functions/getTokenList.d.ts +0 -3
- package/dist/functions/getTokenList.d.ts.map +0 -1
- package/dist/functions/getUserCurveLP.d.ts +0 -16
- package/dist/functions/getUserCurveLP.d.ts.map +0 -1
- package/dist/functions/getUserSToke.d.ts +0 -40
- package/dist/functions/getUserSToke.d.ts.map +0 -1
- package/dist/functions/getUserSTokeRewards.d.ts +0 -38
- package/dist/functions/getUserSTokeRewards.d.ts.map +0 -1
- package/dist/functions/getUserSushiLP.d.ts +0 -23
- package/dist/functions/getUserSushiLP.d.ts.map +0 -1
- package/dist/functions/getUserV1.d.ts +0 -18
- package/dist/functions/getUserV1.d.ts.map +0 -1
package/dist/safe.js
CHANGED
|
@@ -57,12 +57,16 @@ function mergeArrays(objectsArray, objectsToMergeArray) {
|
|
|
57
57
|
|
|
58
58
|
// utils/getChainsForEnv.ts
|
|
59
59
|
var import_constants = require("@tokemak/constants");
|
|
60
|
+
var import_config = require("@tokemak/config");
|
|
60
61
|
function getChainsForEnv({
|
|
61
|
-
includeTestnet = false
|
|
62
|
+
includeTestnet = false,
|
|
63
|
+
status = "all"
|
|
62
64
|
}) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return
|
|
65
|
+
const base = includeTestnet ? [...import_constants.SUPPORTED_DEV_CHAINS] : [...import_constants.SUPPORTED_PROD_CHAINS];
|
|
66
|
+
if (status === "all") return base;
|
|
67
|
+
return base.filter(
|
|
68
|
+
(chain) => status === "sunset" ? (0, import_config.isSunsetChain)(chain.chainId) : !(0, import_config.isSunsetChain)(chain.chainId)
|
|
69
|
+
);
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
// utils/getAutopoolCategory.ts
|
|
@@ -291,15 +295,21 @@ var import_graph_cli = require("@tokemak/graph-cli");
|
|
|
291
295
|
var import_chains = require("viem/chains");
|
|
292
296
|
|
|
293
297
|
// functions/getPoolsAndDestinations.ts
|
|
294
|
-
var
|
|
298
|
+
var import_config2 = require("@tokemak/config");
|
|
295
299
|
var import_abis = require("@tokemak/abis");
|
|
296
|
-
var getPoolsAndDestinations = async (client, {
|
|
300
|
+
var getPoolsAndDestinations = async (client, {
|
|
301
|
+
chainId,
|
|
302
|
+
account,
|
|
303
|
+
blockNumber
|
|
304
|
+
}) => {
|
|
297
305
|
try {
|
|
298
|
-
const { lens } = (0,
|
|
306
|
+
const { lens } = (0, import_config2.getCoreConfig)(chainId);
|
|
299
307
|
const { autoPools, destinations } = await client.readContract({
|
|
300
308
|
address: lens,
|
|
301
309
|
abi: import_abis.lensAbi,
|
|
302
|
-
functionName: "getPoolsAndDestinations"
|
|
310
|
+
functionName: "getPoolsAndDestinations",
|
|
311
|
+
account,
|
|
312
|
+
blockNumber
|
|
303
313
|
});
|
|
304
314
|
const autopoolsAndDestinations = mergeArraysWithKey(
|
|
305
315
|
autoPools,
|
|
@@ -316,7 +326,9 @@ var getPoolsAndDestinations = async (client, { chainId }) => {
|
|
|
316
326
|
var import_constants5 = require("@tokemak/constants");
|
|
317
327
|
var getChainAutopools = async (client, {
|
|
318
328
|
chainId,
|
|
319
|
-
prices
|
|
329
|
+
prices,
|
|
330
|
+
account,
|
|
331
|
+
blockNumber
|
|
320
332
|
}) => {
|
|
321
333
|
const { GetVaultAddeds, GetAutopoolsInactiveDestinations } = (0, import_graph_cli.getSdkByChainId)(chainId);
|
|
322
334
|
try {
|
|
@@ -329,7 +341,9 @@ var getChainAutopools = async (client, {
|
|
|
329
341
|
chainId
|
|
330
342
|
});
|
|
331
343
|
const autopoolsAndDestinations = await getPoolsAndDestinations(client, {
|
|
332
|
-
chainId
|
|
344
|
+
chainId,
|
|
345
|
+
account,
|
|
346
|
+
blockNumber
|
|
333
347
|
});
|
|
334
348
|
if (!autopoolsAndDestinations) {
|
|
335
349
|
throw new Error(`No autopools and destinations found for ${chainId}`);
|
|
@@ -711,11 +725,11 @@ var getChainAutopools = async (client, {
|
|
|
711
725
|
};
|
|
712
726
|
|
|
713
727
|
// functions/getEthPriceAtBlock.ts
|
|
714
|
-
var
|
|
728
|
+
var import_config3 = require("@tokemak/config");
|
|
715
729
|
var import_abis2 = require("@tokemak/abis");
|
|
716
730
|
var import_tokenlist3 = require("@tokemak/tokenlist");
|
|
717
|
-
var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
|
|
718
|
-
const config = (0,
|
|
731
|
+
var getEthPriceAtBlock = async (client, blockNumber, chainId, account) => {
|
|
732
|
+
const config = (0, import_config3.getCoreConfig)(chainId);
|
|
719
733
|
const rootPriceOracle = config.rootPriceOracle;
|
|
720
734
|
const weth = config.weth;
|
|
721
735
|
const usdc = import_tokenlist3.USDC_TOKEN.extensions?.bridgeInfo?.[chainId]?.tokenAddress || import_tokenlist3.USDC_TOKEN.address;
|
|
@@ -724,7 +738,8 @@ var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
|
|
|
724
738
|
abi: import_abis2.rootPriceOracleAbi,
|
|
725
739
|
functionName: "getPriceInQuote",
|
|
726
740
|
args: [weth, usdc],
|
|
727
|
-
blockNumber
|
|
741
|
+
blockNumber,
|
|
742
|
+
account
|
|
728
743
|
});
|
|
729
744
|
return priceAtBlock;
|
|
730
745
|
};
|
|
@@ -755,14 +770,15 @@ function inferBaseAssetDecimals(rebalance, chainId) {
|
|
|
755
770
|
}
|
|
756
771
|
return import_tokenlist4.USDC_TOKEN.decimals;
|
|
757
772
|
}
|
|
758
|
-
var getRebalanceValueUsd = async (rebalance, chainId, client) => {
|
|
773
|
+
var getRebalanceValueUsd = async (rebalance, chainId, client, account) => {
|
|
759
774
|
const ethWei = BigInt(rebalance.tokenOutValueInEth || "0");
|
|
760
775
|
if (ethWei === 0n) return null;
|
|
761
776
|
try {
|
|
762
777
|
const price = await getEthPriceAtBlock(
|
|
763
778
|
client,
|
|
764
779
|
BigInt(rebalance.blockNumber),
|
|
765
|
-
chainId
|
|
780
|
+
chainId,
|
|
781
|
+
account
|
|
766
782
|
);
|
|
767
783
|
const ethUsd = Number((0, import_utils5.formatUnitsNum)(price, import_tokenlist4.USDC_TOKEN.decimals));
|
|
768
784
|
const ethAmt = Number((0, import_utils5.formatEtherNum)(ethWei));
|
|
@@ -773,7 +789,7 @@ var getRebalanceValueUsd = async (rebalance, chainId, client) => {
|
|
|
773
789
|
return null;
|
|
774
790
|
}
|
|
775
791
|
};
|
|
776
|
-
var processRebalance = async (rebalance, chainId, client) => {
|
|
792
|
+
var processRebalance = async (rebalance, chainId, client, account) => {
|
|
777
793
|
const baseDecimals = inferBaseAssetDecimals(rebalance, chainId);
|
|
778
794
|
const baseAssetAmount = Number(
|
|
779
795
|
(0, import_utils5.formatUnitsNum)(
|
|
@@ -781,7 +797,12 @@ var processRebalance = async (rebalance, chainId, client) => {
|
|
|
781
797
|
baseDecimals
|
|
782
798
|
)
|
|
783
799
|
);
|
|
784
|
-
const ethPathUsd = await getRebalanceValueUsd(
|
|
800
|
+
const ethPathUsd = await getRebalanceValueUsd(
|
|
801
|
+
rebalance,
|
|
802
|
+
chainId,
|
|
803
|
+
client,
|
|
804
|
+
account
|
|
805
|
+
);
|
|
785
806
|
if (ethPathUsd != null) {
|
|
786
807
|
return {
|
|
787
808
|
autopool: rebalance.autopool,
|
|
@@ -801,12 +822,12 @@ var processRebalance = async (rebalance, chainId, client) => {
|
|
|
801
822
|
valueInAsset: baseAssetAmount
|
|
802
823
|
};
|
|
803
824
|
};
|
|
804
|
-
var processRebalancesInBatches = async (rebalances, chainId, client) => {
|
|
825
|
+
var processRebalancesInBatches = async (rebalances, chainId, client, account) => {
|
|
805
826
|
const processedRebalances = [];
|
|
806
827
|
for (let i = 0; i < rebalances.length; i += BATCH_SIZE) {
|
|
807
828
|
const batch = rebalances.slice(i, i + BATCH_SIZE);
|
|
808
829
|
const batchPromises = batch.map(
|
|
809
|
-
async (rebalance) => processRebalance(rebalance, chainId, client)
|
|
830
|
+
async (rebalance) => processRebalance(rebalance, chainId, client, account)
|
|
810
831
|
);
|
|
811
832
|
const batchResults = await Promise.all(batchPromises);
|
|
812
833
|
processedRebalances.push(...batchResults);
|
|
@@ -832,14 +853,20 @@ var calculateRebalanceStats = (rebalances) => {
|
|
|
832
853
|
};
|
|
833
854
|
};
|
|
834
855
|
var getRebalanceStats = async (getClient, {
|
|
835
|
-
includeTestnet = false
|
|
856
|
+
includeTestnet = false,
|
|
857
|
+
account
|
|
836
858
|
}) => {
|
|
837
859
|
const chains = getChainsForEnv({ includeTestnet });
|
|
838
860
|
const rebalances = await Promise.all(
|
|
839
861
|
chains.map(async (chain) => {
|
|
840
862
|
const rawRebalances = await fetchChainRebalances(chain.chainId);
|
|
841
863
|
const client = getClient(chain.chainId);
|
|
842
|
-
return processRebalancesInBatches(
|
|
864
|
+
return processRebalancesInBatches(
|
|
865
|
+
rawRebalances,
|
|
866
|
+
chain.chainId,
|
|
867
|
+
client,
|
|
868
|
+
account
|
|
869
|
+
);
|
|
843
870
|
})
|
|
844
871
|
);
|
|
845
872
|
const allRebalances = rebalances.flat();
|
package/dist/safe.mjs
CHANGED
|
@@ -25,12 +25,16 @@ import {
|
|
|
25
25
|
SUPPORTED_DEV_CHAINS,
|
|
26
26
|
SUPPORTED_PROD_CHAINS
|
|
27
27
|
} from "@tokemak/constants";
|
|
28
|
+
import { isSunsetChain } from "@tokemak/config";
|
|
28
29
|
function getChainsForEnv({
|
|
29
|
-
includeTestnet = false
|
|
30
|
+
includeTestnet = false,
|
|
31
|
+
status = "all"
|
|
30
32
|
}) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
33
|
+
const base = includeTestnet ? [...SUPPORTED_DEV_CHAINS] : [...SUPPORTED_PROD_CHAINS];
|
|
34
|
+
if (status === "all") return base;
|
|
35
|
+
return base.filter(
|
|
36
|
+
(chain) => status === "sunset" ? isSunsetChain(chain.chainId) : !isSunsetChain(chain.chainId)
|
|
37
|
+
);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
// utils/getAutopoolCategory.ts
|
|
@@ -277,13 +281,19 @@ import { sonic } from "viem/chains";
|
|
|
277
281
|
// functions/getPoolsAndDestinations.ts
|
|
278
282
|
import { getCoreConfig } from "@tokemak/config";
|
|
279
283
|
import { lensAbi } from "@tokemak/abis";
|
|
280
|
-
var getPoolsAndDestinations = async (client, {
|
|
284
|
+
var getPoolsAndDestinations = async (client, {
|
|
285
|
+
chainId,
|
|
286
|
+
account,
|
|
287
|
+
blockNumber
|
|
288
|
+
}) => {
|
|
281
289
|
try {
|
|
282
290
|
const { lens } = getCoreConfig(chainId);
|
|
283
291
|
const { autoPools, destinations } = await client.readContract({
|
|
284
292
|
address: lens,
|
|
285
293
|
abi: lensAbi,
|
|
286
|
-
functionName: "getPoolsAndDestinations"
|
|
294
|
+
functionName: "getPoolsAndDestinations",
|
|
295
|
+
account,
|
|
296
|
+
blockNumber
|
|
287
297
|
});
|
|
288
298
|
const autopoolsAndDestinations = mergeArraysWithKey(
|
|
289
299
|
autoPools,
|
|
@@ -305,7 +315,9 @@ import {
|
|
|
305
315
|
} from "@tokemak/constants";
|
|
306
316
|
var getChainAutopools = async (client, {
|
|
307
317
|
chainId,
|
|
308
|
-
prices
|
|
318
|
+
prices,
|
|
319
|
+
account,
|
|
320
|
+
blockNumber
|
|
309
321
|
}) => {
|
|
310
322
|
const { GetVaultAddeds, GetAutopoolsInactiveDestinations } = getSdkByChainId(chainId);
|
|
311
323
|
try {
|
|
@@ -318,7 +330,9 @@ var getChainAutopools = async (client, {
|
|
|
318
330
|
chainId
|
|
319
331
|
});
|
|
320
332
|
const autopoolsAndDestinations = await getPoolsAndDestinations(client, {
|
|
321
|
-
chainId
|
|
333
|
+
chainId,
|
|
334
|
+
account,
|
|
335
|
+
blockNumber
|
|
322
336
|
});
|
|
323
337
|
if (!autopoolsAndDestinations) {
|
|
324
338
|
throw new Error(`No autopools and destinations found for ${chainId}`);
|
|
@@ -703,7 +717,7 @@ var getChainAutopools = async (client, {
|
|
|
703
717
|
import { getCoreConfig as getCoreConfig2 } from "@tokemak/config";
|
|
704
718
|
import { rootPriceOracleAbi } from "@tokemak/abis";
|
|
705
719
|
import { USDC_TOKEN } from "@tokemak/tokenlist";
|
|
706
|
-
var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
|
|
720
|
+
var getEthPriceAtBlock = async (client, blockNumber, chainId, account) => {
|
|
707
721
|
const config = getCoreConfig2(chainId);
|
|
708
722
|
const rootPriceOracle = config.rootPriceOracle;
|
|
709
723
|
const weth = config.weth;
|
|
@@ -713,7 +727,8 @@ var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
|
|
|
713
727
|
abi: rootPriceOracleAbi,
|
|
714
728
|
functionName: "getPriceInQuote",
|
|
715
729
|
args: [weth, usdc],
|
|
716
|
-
blockNumber
|
|
730
|
+
blockNumber,
|
|
731
|
+
account
|
|
717
732
|
});
|
|
718
733
|
return priceAtBlock;
|
|
719
734
|
};
|
|
@@ -744,14 +759,15 @@ function inferBaseAssetDecimals(rebalance, chainId) {
|
|
|
744
759
|
}
|
|
745
760
|
return USDC_TOKEN2.decimals;
|
|
746
761
|
}
|
|
747
|
-
var getRebalanceValueUsd = async (rebalance, chainId, client) => {
|
|
762
|
+
var getRebalanceValueUsd = async (rebalance, chainId, client, account) => {
|
|
748
763
|
const ethWei = BigInt(rebalance.tokenOutValueInEth || "0");
|
|
749
764
|
if (ethWei === 0n) return null;
|
|
750
765
|
try {
|
|
751
766
|
const price = await getEthPriceAtBlock(
|
|
752
767
|
client,
|
|
753
768
|
BigInt(rebalance.blockNumber),
|
|
754
|
-
chainId
|
|
769
|
+
chainId,
|
|
770
|
+
account
|
|
755
771
|
);
|
|
756
772
|
const ethUsd = Number(formatUnitsNum2(price, USDC_TOKEN2.decimals));
|
|
757
773
|
const ethAmt = Number(formatEtherNum2(ethWei));
|
|
@@ -762,7 +778,7 @@ var getRebalanceValueUsd = async (rebalance, chainId, client) => {
|
|
|
762
778
|
return null;
|
|
763
779
|
}
|
|
764
780
|
};
|
|
765
|
-
var processRebalance = async (rebalance, chainId, client) => {
|
|
781
|
+
var processRebalance = async (rebalance, chainId, client, account) => {
|
|
766
782
|
const baseDecimals = inferBaseAssetDecimals(rebalance, chainId);
|
|
767
783
|
const baseAssetAmount = Number(
|
|
768
784
|
formatUnitsNum2(
|
|
@@ -770,7 +786,12 @@ var processRebalance = async (rebalance, chainId, client) => {
|
|
|
770
786
|
baseDecimals
|
|
771
787
|
)
|
|
772
788
|
);
|
|
773
|
-
const ethPathUsd = await getRebalanceValueUsd(
|
|
789
|
+
const ethPathUsd = await getRebalanceValueUsd(
|
|
790
|
+
rebalance,
|
|
791
|
+
chainId,
|
|
792
|
+
client,
|
|
793
|
+
account
|
|
794
|
+
);
|
|
774
795
|
if (ethPathUsd != null) {
|
|
775
796
|
return {
|
|
776
797
|
autopool: rebalance.autopool,
|
|
@@ -790,12 +811,12 @@ var processRebalance = async (rebalance, chainId, client) => {
|
|
|
790
811
|
valueInAsset: baseAssetAmount
|
|
791
812
|
};
|
|
792
813
|
};
|
|
793
|
-
var processRebalancesInBatches = async (rebalances, chainId, client) => {
|
|
814
|
+
var processRebalancesInBatches = async (rebalances, chainId, client, account) => {
|
|
794
815
|
const processedRebalances = [];
|
|
795
816
|
for (let i = 0; i < rebalances.length; i += BATCH_SIZE) {
|
|
796
817
|
const batch = rebalances.slice(i, i + BATCH_SIZE);
|
|
797
818
|
const batchPromises = batch.map(
|
|
798
|
-
async (rebalance) => processRebalance(rebalance, chainId, client)
|
|
819
|
+
async (rebalance) => processRebalance(rebalance, chainId, client, account)
|
|
799
820
|
);
|
|
800
821
|
const batchResults = await Promise.all(batchPromises);
|
|
801
822
|
processedRebalances.push(...batchResults);
|
|
@@ -821,14 +842,20 @@ var calculateRebalanceStats = (rebalances) => {
|
|
|
821
842
|
};
|
|
822
843
|
};
|
|
823
844
|
var getRebalanceStats = async (getClient, {
|
|
824
|
-
includeTestnet = false
|
|
845
|
+
includeTestnet = false,
|
|
846
|
+
account
|
|
825
847
|
}) => {
|
|
826
848
|
const chains = getChainsForEnv({ includeTestnet });
|
|
827
849
|
const rebalances = await Promise.all(
|
|
828
850
|
chains.map(async (chain) => {
|
|
829
851
|
const rawRebalances = await fetchChainRebalances(chain.chainId);
|
|
830
852
|
const client = getClient(chain.chainId);
|
|
831
|
-
return processRebalancesInBatches(
|
|
853
|
+
return processRebalancesInBatches(
|
|
854
|
+
rawRebalances,
|
|
855
|
+
chain.chainId,
|
|
856
|
+
client,
|
|
857
|
+
account
|
|
858
|
+
);
|
|
832
859
|
})
|
|
833
860
|
);
|
|
834
861
|
const allRebalances = rebalances.flat();
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { INetwork } from "@tokemak/tokenlist";
|
|
2
|
+
/**
|
|
3
|
+
* Lifecycle filter for the returned chain set.
|
|
4
|
+
* - "all" (default): every supported chain — back-compat behaviour.
|
|
5
|
+
* - "active": exclude sunset/deprecated chains (used by the main autopool
|
|
6
|
+
* fan-out so it never waits on deprecated chains' live reads).
|
|
7
|
+
* - "sunset": only sunset/deprecated chains (used by getDeprecatedAutopools).
|
|
8
|
+
*/
|
|
9
|
+
export type ChainStatusFilter = "active" | "sunset" | "all";
|
|
2
10
|
interface GetChainsOptions {
|
|
3
11
|
includeTestnet?: boolean;
|
|
12
|
+
status?: ChainStatusFilter;
|
|
4
13
|
}
|
|
5
14
|
/**
|
|
6
|
-
* Returns the appropriate array of chains
|
|
7
|
-
*
|
|
15
|
+
* Returns the appropriate array of chains based on environment
|
|
16
|
+
* (`includeTestnet`) and lifecycle `status`.
|
|
8
17
|
*/
|
|
9
|
-
export declare function getChainsForEnv({ includeTestnet, }: GetChainsOptions): INetwork[];
|
|
18
|
+
export declare function getChainsForEnv({ includeTestnet, status, }: GetChainsOptions): INetwork[];
|
|
10
19
|
export {};
|
|
11
20
|
//# sourceMappingURL=getChainsForEnv.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChainsForEnv.d.ts","sourceRoot":"","sources":["../../utils/getChainsForEnv.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getChainsForEnv.d.ts","sourceRoot":"","sources":["../../utils/getChainsForEnv.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE5D,UAAU,gBAAgB;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,cAAsB,EACtB,MAAc,GACf,EAAE,gBAAgB,GAAG,QAAQ,EAAE,CAY/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokemak/queries",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"@layerzerolabs/lz-v2-utilities": "3.0.4",
|
|
43
43
|
"@merkl/api": "1.17.4",
|
|
44
44
|
"graphql-request": "6.1.0",
|
|
45
|
-
"@tokemak/
|
|
46
|
-
"@tokemak/constants": "0.3.
|
|
47
|
-
"@tokemak/graph-cli": "0.4.
|
|
48
|
-
"@tokemak/config": "0.4.0",
|
|
45
|
+
"@tokemak/config": "0.6.0",
|
|
46
|
+
"@tokemak/constants": "0.3.2",
|
|
47
|
+
"@tokemak/graph-cli": "0.4.2",
|
|
49
48
|
"@tokemak/tokenlist": "0.4.0",
|
|
49
|
+
"@tokemak/utils": "0.2.3",
|
|
50
50
|
"@tokemak/abis": "0.2.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Config } from "@wagmi/core";
|
|
2
|
-
import { Address } from "viem";
|
|
3
|
-
export declare const getAllowance: (wagmiConfig: Config, { token, address, spender, }: {
|
|
4
|
-
token: Address;
|
|
5
|
-
address: Address;
|
|
6
|
-
spender: Address;
|
|
7
|
-
}) => Promise<bigint | undefined>;
|
|
8
|
-
//# sourceMappingURL=getAllowance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAllowance.d.ts","sourceRoot":"","sources":["../../functions/getAllowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,EAAY,MAAM,MAAM,CAAC;AAEzC,eAAO,MAAM,YAAY,GACvB,aAAa,MAAM,EACnB,8BAIG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,gCAa1D,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { SupportedChainIds } from "@tokemak/config";
|
|
2
|
-
export declare const getAutopoolsRebalances: (chainId?: SupportedChainIds) => Promise<{
|
|
3
|
-
__typename?: "Rebalance";
|
|
4
|
-
autopool: any;
|
|
5
|
-
blockNumber: any;
|
|
6
|
-
hash: string;
|
|
7
|
-
id: string;
|
|
8
|
-
ix: any;
|
|
9
|
-
timestamp: any;
|
|
10
|
-
outData?: {
|
|
11
|
-
__typename?: "RebalanceInOut";
|
|
12
|
-
id: string;
|
|
13
|
-
exchangeName: string;
|
|
14
|
-
ethValue: any;
|
|
15
|
-
destination: any;
|
|
16
|
-
underlyer: {
|
|
17
|
-
__typename?: "RefToken";
|
|
18
|
-
decimals: any;
|
|
19
|
-
id: any;
|
|
20
|
-
name?: string | null;
|
|
21
|
-
symbol?: string | null;
|
|
22
|
-
};
|
|
23
|
-
tokens: Array<{
|
|
24
|
-
__typename?: "RefToken";
|
|
25
|
-
decimals: any;
|
|
26
|
-
id: any;
|
|
27
|
-
name?: string | null;
|
|
28
|
-
symbol?: string | null;
|
|
29
|
-
}>;
|
|
30
|
-
} | null;
|
|
31
|
-
inData?: {
|
|
32
|
-
__typename?: "RebalanceInOut";
|
|
33
|
-
ethValue: any;
|
|
34
|
-
exchangeName: string;
|
|
35
|
-
id: string;
|
|
36
|
-
destination: any;
|
|
37
|
-
underlyer: {
|
|
38
|
-
__typename?: "RefToken";
|
|
39
|
-
decimals: any;
|
|
40
|
-
id: any;
|
|
41
|
-
name?: string | null;
|
|
42
|
-
symbol?: string | null;
|
|
43
|
-
};
|
|
44
|
-
tokens: Array<{
|
|
45
|
-
__typename?: "RefToken";
|
|
46
|
-
decimals: any;
|
|
47
|
-
id: any;
|
|
48
|
-
name?: string | null;
|
|
49
|
-
symbol?: string | null;
|
|
50
|
-
}>;
|
|
51
|
-
} | null;
|
|
52
|
-
}[]>;
|
|
53
|
-
//# sourceMappingURL=getAutopoolsRebalances.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAutopoolsRebalances.d.ts","sourceRoot":"","sources":["../../functions/getAutopoolsRebalances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,eAAO,MAAM,sBAAsB,GACjC,UAAS,iBAAqB;;;;;;;;;kBAOm8pjD,CAAC;;;;;;sBAAkN,CAAC;;;gBAAsG,CAAC;kBAA2C,CAAC;;;sBAAkG,CAAC;;;gBAAsG,CAAC;kBAA2C,CAAC;;;;kBAA4G,CAAC;;;;;;sBAAkN,CAAC;;;gBAAsG,CAAC;kBAA2C,CAAC;;;sBAAkG,CAAC;;;gBAAsG,CAAC;kBAA2C,CAAC;;;IADxwsjD,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Address } from "viem";
|
|
2
|
-
import { Config } from "@wagmi/core";
|
|
3
|
-
export declare const getChainCycleRolloverBlockNumber: (wagmiConfig: Config, { stoke, chainId, }: {
|
|
4
|
-
stoke: Address;
|
|
5
|
-
chainId: number;
|
|
6
|
-
}) => Promise<bigint | undefined>;
|
|
7
|
-
//# sourceMappingURL=getChainCycleRolloverBlockNumber.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getChainCycleRolloverBlockNumber.d.ts","sourceRoot":"","sources":["../../functions/getChainCycleRolloverBlockNumber.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EACL,MAAM,EAIP,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,gCAAgC,GAC3C,aAAa,MAAM,EACnB,qBAGG;IACD,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,gCA4CF,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Config } from "@wagmi/core";
|
|
2
|
-
export type ChainSTokeType = Awaited<ReturnType<typeof getChainSToke>>;
|
|
3
|
-
export declare const getChainSToke: (wagmiConfig: Config, { tokePrice, chainId, }: {
|
|
4
|
-
tokePrice: number;
|
|
5
|
-
chainId: number;
|
|
6
|
-
}) => Promise<{
|
|
7
|
-
rawTotalSupply: bigint | undefined;
|
|
8
|
-
totalSupply: string;
|
|
9
|
-
tvl: string;
|
|
10
|
-
rawTVL: number;
|
|
11
|
-
currentCycle: bigint | undefined;
|
|
12
|
-
chain: import("@tokemak/tokenlist").INetwork | undefined;
|
|
13
|
-
timeBeforeNextCycle: string;
|
|
14
|
-
} | undefined>;
|
|
15
|
-
//# sourceMappingURL=getChainSToke.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getChainSToke.d.ts","sourceRoot":"","sources":["../../functions/getChainSToke.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAC;AAWpD,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC;AAEvE,eAAO,MAAM,aAAa,GACxB,aAAa,MAAM,EACnB,yBAGG;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;;;;;;;;cA4CF,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SupportedChainIds } from "@tokemak/config";
|
|
2
|
-
export type ChainSTokeRewardsType = Awaited<ReturnType<typeof getChainSTokeRewards>>;
|
|
3
|
-
export declare const getChainSTokeRewards: ({ chainId, }: {
|
|
4
|
-
chainId: SupportedChainIds;
|
|
5
|
-
}) => Promise<{
|
|
6
|
-
autopools: Record<string, {
|
|
7
|
-
balance: number;
|
|
8
|
-
balanceUSD: number;
|
|
9
|
-
currentAprPerCredit: number;
|
|
10
|
-
}>;
|
|
11
|
-
totalEarnings: number;
|
|
12
|
-
totalEarningsUsd: number;
|
|
13
|
-
historicalRewards: import("..").AggregatedDayData[];
|
|
14
|
-
aprRange: number[];
|
|
15
|
-
} | null>;
|
|
16
|
-
//# sourceMappingURL=getChainSTokeRewards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getChainSTokeRewards.d.ts","sourceRoot":"","sources":["../../functions/getChainSTokeRewards.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAM9E,MAAM,MAAM,qBAAqB,GAAG,OAAO,CACzC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CACxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,cAExC;IACD,OAAO,EAAE,iBAAiB,CAAC;CAC5B;;iBAagB,MAAM;oBAAc,MAAM;6BAAuB,MAAM;;;;;;SAyDvE,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Address } from "viem";
|
|
2
|
-
import { Config } from "wagmi";
|
|
3
|
-
export declare const getChainUserSToke: (wagmiConfig: Config, { address, tokePrice, chainId, }: {
|
|
4
|
-
address: Address;
|
|
5
|
-
tokePrice: number;
|
|
6
|
-
chainId: number;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
balance: bigint;
|
|
9
|
-
balanceUSD: string;
|
|
10
|
-
balanceExcludingWithdrawal: string;
|
|
11
|
-
balanceExcludingWithdrawalUsd: string;
|
|
12
|
-
hasBalanceExcludingWithdrawal: boolean;
|
|
13
|
-
timeLeftBeforeUnlockRequestAvailable: string;
|
|
14
|
-
timeLeftBeforeUnlockRequestUnavailable: string;
|
|
15
|
-
withdrawalAmount: bigint;
|
|
16
|
-
withdrawalAmountUsd: string;
|
|
17
|
-
hasUnlockableBalance: boolean;
|
|
18
|
-
isUnlockRequestAvailable: boolean;
|
|
19
|
-
hasRequestedUnlock: boolean;
|
|
20
|
-
hasAddedLockedToke: boolean;
|
|
21
|
-
addedLockedToke: bigint;
|
|
22
|
-
unlockPeriodDateRange: string;
|
|
23
|
-
unlockPeriodStartFullDate: string;
|
|
24
|
-
unlockRenewalFullDate: string;
|
|
25
|
-
unlockPeriodStartDate: string | undefined;
|
|
26
|
-
unlockRenewalDate: string | undefined;
|
|
27
|
-
lockDurationInMonths: number;
|
|
28
|
-
boost: number;
|
|
29
|
-
points: number;
|
|
30
|
-
totalActiveCredits: number;
|
|
31
|
-
totalCredits: number;
|
|
32
|
-
} | undefined>;
|
|
33
|
-
//# sourceMappingURL=getChainUserSToke.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getChainUserSToke.d.ts","sourceRoot":"","sources":["../../functions/getChainUserSToke.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAe,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAM/B,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,EACnB,kCAIG;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;;;;;;;;;;;;;;cA0LF,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Config } from "wagmi";
|
|
2
|
-
import { Address } from "viem";
|
|
3
|
-
export declare const getChainUserSTokeRewards: (wagmiConfig: Config, { address, chainId, tokePrice, }: {
|
|
4
|
-
address: Address;
|
|
5
|
-
chainId: number;
|
|
6
|
-
tokePrice: number;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
claimable: bigint;
|
|
9
|
-
rewardsPayload: import("./getRewardsPayloadV1").IUserReward | null;
|
|
10
|
-
latestClaimablePayload: import("./getRewardsPayloadV1").IUserReward;
|
|
11
|
-
claimableUsd: number;
|
|
12
|
-
claimableNum: number;
|
|
13
|
-
hasClaimable: boolean;
|
|
14
|
-
pendingRewards: number;
|
|
15
|
-
pendingRewardsUsd: number;
|
|
16
|
-
totalRewardsReceived: number;
|
|
17
|
-
totalRewardsReceivedUsd: number;
|
|
18
|
-
} | {
|
|
19
|
-
rewardsPayload: import("./getRewardsPayloadV1").IUserReward | null;
|
|
20
|
-
latestClaimablePayload: null;
|
|
21
|
-
claimable?: undefined;
|
|
22
|
-
claimableUsd: number;
|
|
23
|
-
claimableNum: number;
|
|
24
|
-
hasClaimable: boolean;
|
|
25
|
-
pendingRewards: number;
|
|
26
|
-
pendingRewardsUsd: number;
|
|
27
|
-
totalRewardsReceived: number;
|
|
28
|
-
totalRewardsReceivedUsd: number;
|
|
29
|
-
}>;
|
|
30
|
-
//# sourceMappingURL=getChainUserSTokeRewards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getChainUserSTokeRewards.d.ts","sourceRoot":"","sources":["../../functions/getChainUserSTokeRewards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAI/B,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,EACnB,kCAIG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;EA2E5D,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type CombinedRewardsType = Awaited<ReturnType<typeof getCombinedRewards>>;
|
|
2
|
-
export declare const getCombinedRewards: () => Promise<{
|
|
3
|
-
totalEarnings: number;
|
|
4
|
-
totalEarningsUsd: number;
|
|
5
|
-
historicalRewards: {
|
|
6
|
-
balance: number;
|
|
7
|
-
balanceUSD: number;
|
|
8
|
-
formattedDate: string;
|
|
9
|
-
}[];
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=getCombinedRewards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCombinedRewards.d.ts","sourceRoot":"","sources":["../../functions/getCombinedRewards.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CACtC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;EAgE9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCurveLP.d.ts","sourceRoot":"","sources":["../../functions/getCurveLP.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,OAAO,GAAG,SAAS,CA6B9D,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Config } from "@wagmi/core";
|
|
2
|
-
export declare const getCycleV1: (wagmiConfig: Config, { currentBlockNumber, chainId, }: {
|
|
3
|
-
currentBlockNumber: BigInt;
|
|
4
|
-
chainId: number;
|
|
5
|
-
}) => Promise<{
|
|
6
|
-
currentCycleIndex: bigint;
|
|
7
|
-
cycleRolloverBlockNumber: bigint | BigInt;
|
|
8
|
-
timeBeforeNextCycle: string;
|
|
9
|
-
} | undefined>;
|
|
10
|
-
//# sourceMappingURL=getCycleV1.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCycleV1.d.ts","sourceRoot":"","sources":["../../functions/getCycleV1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAC;AAenD,eAAO,MAAM,UAAU,GACrB,aAAa,MAAM,EACnB,kCAGG;IAAE,kBAAkB,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;cAgDnD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getEthPrice.d.ts","sourceRoot":"","sources":["../../functions/getEthPrice.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB9D,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare enum MessageStatus {
|
|
2
|
-
INFLIGHT = "INFLIGHT",
|
|
3
|
-
DELIVERED = "DELIVERED",
|
|
4
|
-
FAILED = "FAILED",
|
|
5
|
-
PAYLOAD_STORED = "PAYLOAD_STORED",
|
|
6
|
-
BLOCKED = "BLOCKED",
|
|
7
|
-
CONFIRMING = "CONFIRMING"
|
|
8
|
-
}
|
|
9
|
-
export type LayerzeroStatus = {
|
|
10
|
-
status: {
|
|
11
|
-
name: MessageStatus;
|
|
12
|
-
message: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export type GetLayerzeroStatusConfig = {
|
|
16
|
-
txHash: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const getLayerzeroStatus: ({ txHash, }: GetLayerzeroStatusConfig) => Promise<LayerzeroStatus | undefined>;
|
|
19
|
-
export declare const waitForMessageReceived: ({ txHash, interval, timeout, }: {
|
|
20
|
-
txHash: string;
|
|
21
|
-
interval?: number;
|
|
22
|
-
timeout?: number;
|
|
23
|
-
}) => Promise<LayerzeroStatus>;
|
|
24
|
-
//# sourceMappingURL=getLayerzeroStatus.d.ts.map
|