@1delta/margin-fetcher 0.0.125 → 0.0.127
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/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { getLenderPublicData, getLenderPublicDataViaApi, getLenderPublicDataAll, getLenderUserDataResult, convertLenderUserDataResult, inititalizeAllData, fetchLenderMetaFromDirAndInitialize, fetchLenderMetaFromDir, } from './lending';
|
|
1
|
+
export { getLenderPublicData, getLenderPublicDataViaApi, getLenderPublicDataAll, getLenderUserDataResult, convertLenderUserDataResult, inititalizeAllData, fetchLenderMetaFromDirAndInitialize, fetchLenderMetaFromDir, getLenderUserDataMulti, type ChainQuery, type ProviderOptions, type BaseLendingPosition, type BasicReserveResponse, } from './lending';
|
|
2
2
|
export { type LendingPair, generateLendingPairs, getTopPairs, } from './lending-pairs';
|
|
3
3
|
export { type PoolWithMeta, generateLendingPools, unflattenLenderData, } from './lending-pools';
|
|
4
4
|
export { fetchGeneralYields } from './yields';
|
|
5
5
|
export { fetchDefillamaData, fetchDefillamaHistData, fetchMainPrices, fetchPendlePrices, } from './prices';
|
|
6
6
|
export { getLendersForChain, filterLendersByProtocol, getAavesForChain, getLenderAssets, isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isAaveV3Type, isAaveV2Type, isYLDR, isAaveV32Type, isAaveType, isMultiMarket, } from './utils';
|
|
7
7
|
export { fetchFlashLiquidityForChain, attachPricesToFlashLiquidity, } from './flash-liquidity';
|
|
8
|
-
export { type GenericCurrency, type GenericTokenList, type ParsedResponse, type ChainLinkResponse, type LenderRewardsMap, type NumberMap, type FullLenderRewardsMap, type AdditionalYields, type TokenList, type LenderUserQuery, type UserLendingPosition, type LenderUserResponse, type AaveV2UserReserveResponse, type AaveV3UserReserveResponse, type MorphoUserReserveResponse, type CompoundV3UserReserveResponse, type AaveV3Public, type LenderPublicBase, type LenderYields, type LenderTotalAmounts, type LenderConfigMap, type LenderConfigData, type ModeBase, type EModeData, type AaveV2Public, type CompoundV3Public, type UserApr, type InitUserReserveResponse, type InitPublic, } from './types';
|
|
8
|
+
export { type GenericCurrency, type GenericTokenList, type ParsedResponse, type ChainLinkResponse, type LenderRewardsMap, type NumberMap, type FullLenderRewardsMap, type AdditionalYields, type TokenList, type LenderUserQuery, type UserLendingPosition, type LenderUserResponse, type AaveV2UserReserveResponse, type AaveV3UserReserveResponse, type MorphoUserReserveResponse, type CompoundV3UserReserveResponse, type AaveV3Public, type LenderPublicBase, type LenderYields, type LenderTotalAmounts, type LenderConfigMap, type LenderConfigData, type ModeBase, type EModeData, type AaveV2Public, type CompoundV3Public, type UserApr, type InitUserReserveResponse, type InitPublic, type LenderData, } from './types';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,mCAAmC,EACnC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,mCAAmC,EACnC,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,WAAW,EAChB,oBAAoB,EACpB,WAAW,GACZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,KAAK,YAAY,EACjB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,GAClB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { formatEther, BaseError, formatUnits } from './chunk-WJRQGN7X.js';
|
|
|
2
2
|
import './chunk-BYTNVMX7.js';
|
|
3
3
|
import './chunk-PR4QN5HX.js';
|
|
4
4
|
import { Lender, AAVE_V3_LENDERS, AAVE_V2_LENDERS, AAVE_V32_LENDERS, COMPOUND_V2_LENDERS, VENUS_LENDERS } from '@1delta/lender-registry';
|
|
5
|
-
import lodash from 'lodash';
|
|
6
|
-
import { multicallRetry } from '@1delta/providers';
|
|
5
|
+
import lodash, { isArray as isArray$1 } from 'lodash';
|
|
6
|
+
import { getEvmClientUniversal, multicallRetry } from '@1delta/providers';
|
|
7
7
|
import { BALANCER_V2_FORKS, BALANCER_V3_FORKS, UNISWAP_V4_FORKS, FLASH_LOAN_IDS } from '@1delta/dex-registry';
|
|
8
8
|
|
|
9
9
|
// src/abis/aave-v2/ProtocolDataProvider.ts
|
|
@@ -18988,6 +18988,67 @@ var convertLenderUserDataResult = (chainId, queriesRaw, rawResults, prices, pric
|
|
|
18988
18988
|
}
|
|
18989
18989
|
return lenderData;
|
|
18990
18990
|
};
|
|
18991
|
+
var DEFAULT_OPTIONS = {
|
|
18992
|
+
allowFailure: true,
|
|
18993
|
+
batchSize: MULTICALL_DEFAULT_BATCH_SIZE,
|
|
18994
|
+
retries: 3,
|
|
18995
|
+
logs: false
|
|
18996
|
+
};
|
|
18997
|
+
async function getLenderUserDataMulti(account, chainQueries, prices = {}, pricesHist = {}, lenderState) {
|
|
18998
|
+
const parsedLenderState = isArray$1(lenderState) ? unflattenLenderData(lenderState) : lenderState;
|
|
18999
|
+
const cleanChainQueries = chainQueries.map(
|
|
19000
|
+
({ chainId, queries, providerOptions }) => {
|
|
19001
|
+
const safeProviderOptions = {
|
|
19002
|
+
...DEFAULT_OPTIONS,
|
|
19003
|
+
// override via the package
|
|
19004
|
+
getEvmClient: (chain, rpcId) => getEvmClientUniversal({ chain, rpcId }),
|
|
19005
|
+
...providerOptions
|
|
19006
|
+
};
|
|
19007
|
+
if (!queries || queries?.every((q) => !q.lender)) {
|
|
19008
|
+
const lenders = Object.keys(parsedLenderState[chainId].data);
|
|
19009
|
+
queries = lenders.map((lender) => ({ account, lender }));
|
|
19010
|
+
}
|
|
19011
|
+
return {
|
|
19012
|
+
queries,
|
|
19013
|
+
providerOptions: safeProviderOptions,
|
|
19014
|
+
chainId
|
|
19015
|
+
};
|
|
19016
|
+
}
|
|
19017
|
+
);
|
|
19018
|
+
const promises = cleanChainQueries.map(
|
|
19019
|
+
async ({ chainId, queries, providerOptions }) => {
|
|
19020
|
+
return await getLenderUserDataResult(
|
|
19021
|
+
chainId,
|
|
19022
|
+
queries,
|
|
19023
|
+
providerOptions.getEvmClient,
|
|
19024
|
+
providerOptions.allowFailure,
|
|
19025
|
+
providerOptions.batchSize,
|
|
19026
|
+
providerOptions.retries,
|
|
19027
|
+
providerOptions.logs
|
|
19028
|
+
);
|
|
19029
|
+
}
|
|
19030
|
+
);
|
|
19031
|
+
const data = await Promise.all(promises);
|
|
19032
|
+
const returndata = {};
|
|
19033
|
+
cleanChainQueries.forEach(({ chainId, queries, providerOptions }, i) => {
|
|
19034
|
+
try {
|
|
19035
|
+
const dataForChain = convertLenderUserDataResult(
|
|
19036
|
+
chainId,
|
|
19037
|
+
queries,
|
|
19038
|
+
data[i],
|
|
19039
|
+
prices,
|
|
19040
|
+
pricesHist,
|
|
19041
|
+
parsedLenderState
|
|
19042
|
+
);
|
|
19043
|
+
returndata[chainId] = dataForChain;
|
|
19044
|
+
} catch (e) {
|
|
19045
|
+
if (providerOptions.logs) {
|
|
19046
|
+
console.warn("error parsing for " + chainId, e);
|
|
19047
|
+
}
|
|
19048
|
+
}
|
|
19049
|
+
});
|
|
19050
|
+
return returndata;
|
|
19051
|
+
}
|
|
18991
19052
|
|
|
18992
19053
|
// src/lending/meta/index.ts
|
|
18993
19054
|
var baseUrl = "https://raw.githubusercontent.com/1delta-DAO/lender-metadata/main";
|
|
@@ -23444,6 +23505,6 @@ function attachPricesToFlashLiquidity(chainId, liq, prices, list = {}) {
|
|
|
23444
23505
|
return liqCopy;
|
|
23445
23506
|
}
|
|
23446
23507
|
|
|
23447
|
-
export { attachPricesToFlashLiquidity, convertLenderUserDataResult, fetchDefillamaData, fetchDefillamaHistData, fetchFlashLiquidityForChain, fetchGeneralYields, fetchLenderMetaFromDir, fetchLenderMetaFromDirAndInitialize, fetchMainPrices, fetchPendlePrices, filterLendersByProtocol, generateLendingPairs, generateLendingPools, getAavesForChain, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataResult, getLendersForChain, getTopPairs, inititalizeAllData, isAaveType, isAaveV2Type, isAaveV32Type, isAaveV3Type, isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isMultiMarket, isYLDR, unflattenLenderData };
|
|
23508
|
+
export { attachPricesToFlashLiquidity, convertLenderUserDataResult, fetchDefillamaData, fetchDefillamaHistData, fetchFlashLiquidityForChain, fetchGeneralYields, fetchLenderMetaFromDir, fetchLenderMetaFromDirAndInitialize, fetchMainPrices, fetchPendlePrices, filterLendersByProtocol, generateLendingPairs, generateLendingPools, getAavesForChain, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getTopPairs, inititalizeAllData, isAaveType, isAaveV2Type, isAaveV32Type, isAaveV3Type, isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isMultiMarket, isYLDR, unflattenLenderData };
|
|
23448
23509
|
//# sourceMappingURL=index.js.map
|
|
23449
23510
|
//# sourceMappingURL=index.js.map
|