@merkl/api 0.10.78
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +201 -0
- package/README.md +125 -0
- package/dist/database/api/.generated/default.d.ts +1 -0
- package/dist/database/api/.generated/edge.d.ts +1 -0
- package/dist/database/api/.generated/index.d.ts +36404 -0
- package/dist/database/api/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
- package/dist/database/api/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
- package/dist/database/api/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
- package/dist/database/api/.generated/package.json +84 -0
- package/dist/database/api/.generated/runtime/index-browser.d.ts +365 -0
- package/dist/database/api/.generated/runtime/library.d.ts +3273 -0
- package/dist/database/api/.generated/schema.prisma +366 -0
- package/dist/database/api/.generated/wasm.d.ts +1 -0
- package/dist/database/api/seeder/resources/protocol.d.ts +353 -0
- package/dist/database/engine/.generated/default.d.ts +1 -0
- package/dist/database/engine/.generated/edge.d.ts +1 -0
- package/dist/database/engine/.generated/index.d.ts +16342 -0
- package/dist/database/engine/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
- package/dist/database/engine/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
- package/dist/database/engine/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
- package/dist/database/engine/.generated/package.json +84 -0
- package/dist/database/engine/.generated/runtime/index-browser.d.ts +365 -0
- package/dist/database/engine/.generated/runtime/library.d.ts +3273 -0
- package/dist/database/engine/.generated/schema.prisma +205 -0
- package/dist/database/engine/.generated/wasm.d.ts +1 -0
- package/dist/src/backgroundJobs/index.d.ts +1 -0
- package/dist/src/backgroundJobs/jobs/campaignsCacheUpdater.d.ts +45 -0
- package/dist/src/backgroundJobs/jobs/health.d.ts +40 -0
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.d.ts +37 -0
- package/dist/src/backgroundJobs/jobs/priceUpdater.d.ts +35 -0
- package/dist/src/backgroundJobs/jobs/sync.d.ts +39 -0
- package/dist/src/cache/declaration.d.ts +153 -0
- package/dist/src/cache/index.d.ts +52 -0
- package/dist/src/cache/redis.d.ts +311 -0
- package/dist/src/constants.d.ts +349 -0
- package/dist/src/eden/index.d.ts +4882 -0
- package/dist/src/eden/index.js +4 -0
- package/dist/src/entities/campaign.d.ts +58 -0
- package/dist/src/entities/opportunity.d.ts +17 -0
- package/dist/src/errors/BadRequest.error.d.ts +4 -0
- package/dist/src/errors/Conflict.error.d.ts +4 -0
- package/dist/src/errors/HttpError.d.ts +6 -0
- package/dist/src/errors/NotFound.error.d.ts +4 -0
- package/dist/src/errors/Opportunity.error.d.ts +6 -0
- package/dist/src/errors/Unauthorized.error.d.ts +4 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/guards/BackOffice.guard.d.ts +7 -0
- package/dist/src/guards/Engine.guard.d.ts +7 -0
- package/dist/src/guards/TokenAuth.guard.d.ts +7 -0
- package/dist/src/hooks/checkQueryAddressValidity.d.ts +21 -0
- package/dist/src/hooks/checkQueryChainIdValidity.d.ts +21 -0
- package/dist/src/index.d.ts +1889 -0
- package/dist/src/internal/controllers/endingCampaigns.d.ts +42 -0
- package/dist/src/internal/controllers/unclaimed.d.ts +43 -0
- package/dist/src/internal/index.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/AjnaDynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/BadgerDynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.d.ts +3 -0
- package/dist/src/libs/campaigns/campaignTypes/CompoundDynamicData.d.ts +3 -0
- package/dist/src/libs/campaigns/campaignTypes/DolomiteDynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.d.ts +3 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/eulerVaultNames.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/getBlacklistedSupply.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/metamorphoTvl.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/spliceTVL.d.ts +7 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +45 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.d.ts +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +23 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.d.ts +7 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.d.ts +6 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.d.ts +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20_SNAPSHOTDynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.d.ts +3 -0
- package/dist/src/libs/campaigns/campaignTypes/JSON_AIRDROPDynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/MORPHODynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.d.ts +3 -0
- package/dist/src/libs/campaigns/campaignTypes/SILODynamicData.d.ts +7 -0
- package/dist/src/libs/campaigns/campaignsDynamicData.d.ts +3 -0
- package/dist/src/libs/campaigns/getCampaigns.d.ts +1 -0
- package/dist/src/libs/campaigns/getRewards.d.ts +29 -0
- package/dist/src/libs/campaigns/utils/fetchA51Strategies.d.ts +18 -0
- package/dist/src/libs/campaigns/utils/fetchClamInfo.d.ts +2 -0
- package/dist/src/libs/campaigns/utils/fetchLogs.d.ts +10 -0
- package/dist/src/libs/campaigns/utils/getCompV2ForksVaults.d.ts +19 -0
- package/dist/src/libs/campaigns/utils/getContractCreationBlock.d.ts +2 -0
- package/dist/src/libs/campaigns/utils/getDolomiteMarkets.d.ts +7 -0
- package/dist/src/libs/campaigns/utils/getEulerV2Vaults.d.ts +16 -0
- package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.d.ts +2 -0
- package/dist/src/libs/computeFee.d.ts +4 -0
- package/dist/src/libs/custom/twtParticipants.d.ts +6 -0
- package/dist/src/libs/deprecated-merklv3/index.d.ts +5 -0
- package/dist/src/libs/getTokensList.d.ts +27 -0
- package/dist/src/libs/merklChainData.d.ts +4 -0
- package/dist/src/libs/parse/marketsWithCache.d.ts +4 -0
- package/dist/src/libs/positions/ajna/index.d.ts +41 -0
- package/dist/src/libs/positions/badger/index.d.ts +27 -0
- package/dist/src/libs/positions/clamm/index.d.ts +8 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.d.ts +5 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.d.ts +8 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.d.ts +11 -0
- package/dist/src/libs/positions/clamm/thegraph/index.d.ts +37 -0
- package/dist/src/libs/positions/compound/index.d.ts +26 -0
- package/dist/src/libs/positions/dolomite/index.d.ts +17 -0
- package/dist/src/libs/positions/erc20/index.d.ts +5 -0
- package/dist/src/libs/positions/euler/index.d.ts +5 -0
- package/dist/src/libs/positions/index.d.ts +3 -0
- package/dist/src/libs/positions/morpho/index.d.ts +40 -0
- package/dist/src/libs/positions/prepareFetch.d.ts +22 -0
- package/dist/src/libs/positions/silo/index.d.ts +5 -0
- package/dist/src/libs/positions/types.d.ts +20 -0
- package/dist/src/libs/reports/campaignReport.d.ts +9 -0
- package/dist/src/libs/reports/mainParameterRewards.d.ts +3 -0
- package/dist/src/libs/rewards/userRewards.d.ts +2 -0
- package/dist/src/libs/staticCampaigns.d.ts +2 -0
- package/dist/src/libs/tokens/balances.d.ts +11 -0
- package/dist/src/libs/tokens/tokenInfo.d.ts +8 -0
- package/dist/src/modules/v4/accounting/accounting.controller.d.ts +206 -0
- package/dist/src/modules/v4/accounting/accounting.model.d.ts +32 -0
- package/dist/src/modules/v4/accounting/accounting.repository.d.ts +99 -0
- package/dist/src/modules/v4/accounting/accounting.service.d.ts +44 -0
- package/dist/src/modules/v4/accounting/index.d.ts +3 -0
- package/dist/src/modules/v4/apr/apr.controller.d.ts +0 -0
- package/dist/src/modules/v4/apr/apr.model.d.ts +15 -0
- package/dist/src/modules/v4/apr/apr.repository.d.ts +0 -0
- package/dist/src/modules/v4/apr/apr.service.d.ts +6 -0
- package/dist/src/modules/v4/apr/index.d.ts +2 -0
- package/dist/src/modules/v4/blacklist/blacklist.controller.d.ts +122 -0
- package/dist/src/modules/v4/blacklist/blacklist.model.d.ts +15 -0
- package/dist/src/modules/v4/blacklist/blacklist.repository.d.ts +24 -0
- package/dist/src/modules/v4/blacklist/blacklist.service.d.ts +24 -0
- package/dist/src/modules/v4/blacklist/index.d.ts +3 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +139 -0
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +85 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +110 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +180 -0
- package/dist/src/modules/v4/campaign/index.d.ts +3 -0
- package/dist/src/modules/v4/chain/chain.controller.d.ts +91 -0
- package/dist/src/modules/v4/chain/chain.model.d.ts +19 -0
- package/dist/src/modules/v4/chain/chain.repository.d.ts +66 -0
- package/dist/src/modules/v4/chain/chain.service.d.ts +42 -0
- package/dist/src/modules/v4/chain/index.d.ts +3 -0
- package/dist/src/modules/v4/enso/enso.model.d.ts +130 -0
- package/dist/src/modules/v4/enso/enso.service.d.ts +47 -0
- package/dist/src/modules/v4/explorer/explorer.repository.d.ts +8 -0
- package/dist/src/modules/v4/explorer/explorer.service.d.ts +8 -0
- package/dist/src/modules/v4/explorer/index.d.ts +1 -0
- package/dist/src/modules/v4/index.d.ts +4 -0
- package/dist/src/modules/v4/merklRoot/index.d.ts +3 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +44 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.model.d.ts +6 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.repository.d.ts +21 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.service.d.ts +34 -0
- package/dist/src/modules/v4/opportunity/index.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +349 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +113 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +432 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +413 -0
- package/dist/src/modules/v4/opportunity/subservices/getAjnaMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getBadgerMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getCompoundMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getDolomiteMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getErc20SnapshotMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getJsonAirDropMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getMorphoMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getRadiantMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getSiloMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/transform-id.pipe.d.ts +5 -0
- package/dist/src/modules/v4/opportunity/validate-id.pipe.d.ts +5 -0
- package/dist/src/modules/v4/participate/participate.controller.d.ts +120 -0
- package/dist/src/modules/v4/participate/participate.model.d.ts +51 -0
- package/dist/src/modules/v4/participate/participate.service.d.ts +8 -0
- package/dist/src/modules/v4/price/index.d.ts +3 -0
- package/dist/src/modules/v4/price/price.controller.d.ts +169 -0
- package/dist/src/modules/v4/price/price.model.d.ts +32 -0
- package/dist/src/modules/v4/price/price.repository.d.ts +33 -0
- package/dist/src/modules/v4/price/price.service.d.ts +33 -0
- package/dist/src/modules/v4/prisma/index.d.ts +32 -0
- package/dist/src/modules/v4/protocol/index.d.ts +3 -0
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +87 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +27 -0
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +37 -0
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +10 -0
- package/dist/src/modules/v4/reward/index.d.ts +3 -0
- package/dist/src/modules/v4/reward/reward.controller.d.ts +158 -0
- package/dist/src/modules/v4/reward/reward.model.d.ts +158 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +158 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +523 -0
- package/dist/src/modules/v4/reward/rewardConvertor.service.d.ts +14 -0
- package/dist/src/modules/v4/router.d.ts +1865 -0
- package/dist/src/modules/v4/status/index.d.ts +3 -0
- package/dist/src/modules/v4/status/status.controller.d.ts +143 -0
- package/dist/src/modules/v4/status/status.model.d.ts +23 -0
- package/dist/src/modules/v4/status/status.repository.d.ts +68 -0
- package/dist/src/modules/v4/status/status.service.d.ts +38 -0
- package/dist/src/modules/v4/token/index.d.ts +3 -0
- package/dist/src/modules/v4/token/token.controller.d.ts +131 -0
- package/dist/src/modules/v4/token/token.model.d.ts +35 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +59 -0
- package/dist/src/modules/v4/token/token.service.d.ts +165 -0
- package/dist/src/modules/v4/tvl/index.d.ts +2 -0
- package/dist/src/modules/v4/tvl/tvl.controller.d.ts +0 -0
- package/dist/src/modules/v4/tvl/tvl.model.d.ts +15 -0
- package/dist/src/modules/v4/tvl/tvl.repository.d.ts +0 -0
- package/dist/src/modules/v4/tvl/tvl.service.d.ts +6 -0
- package/dist/src/modules/v4/uniswapV4/index.d.ts +4 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +52 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.model.d.ts +15 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.repository.d.ts +2 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.service.d.ts +20 -0
- package/dist/src/modules/v4/user/index.d.ts +3 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +325 -0
- package/dist/src/modules/v4/user/user.model.d.ts +25 -0
- package/dist/src/modules/v4/user/user.repository.d.ts +19 -0
- package/dist/src/modules/v4/user/user.service.d.ts +19 -0
- package/dist/src/plugins/error-handling.plugin.d.ts +28 -0
- package/dist/src/plugins/logger.plugin.d.ts +21 -0
- package/dist/src/routes/v1/allowances.d.ts +66 -0
- package/dist/src/routes/v1/balances.d.ts +49 -0
- package/dist/src/routes/v1/prices.d.ts +41 -0
- package/dist/src/routes/v1/tokens.d.ts +44 -0
- package/dist/src/routes/v2/merkl.d.ts +54 -0
- package/dist/src/routes/v3/ERC20Campaigns.d.ts +1910 -0
- package/dist/src/routes/v3/app.d.ts +39 -0
- package/dist/src/routes/v3/blacklist.d.ts +1910 -0
- package/dist/src/routes/v3/campaign/delay.d.ts +41 -0
- package/dist/src/routes/v3/campaignClaims.d.ts +43 -0
- package/dist/src/routes/v3/campaignReport.d.ts +42 -0
- package/dist/src/routes/v3/campaignUnclaimed.d.ts +43 -0
- package/dist/src/routes/v3/campaigns.d.ts +1915 -0
- package/dist/src/routes/v3/campaignsForMainParameter.d.ts +42 -0
- package/dist/src/routes/v3/campaignsInfo.d.ts +1902 -0
- package/dist/src/routes/v3/campaignsRewardsReport.d.ts +43 -0
- package/dist/src/routes/v3/claims.d.ts +45 -0
- package/dist/src/routes/v3/compoundV2.d.ts +40 -0
- package/dist/src/routes/v3/createCampaign.d.ts +46 -0
- package/dist/src/routes/v3/dolomite.d.ts +40 -0
- package/dist/src/routes/v3/euler.d.ts +40 -0
- package/dist/src/routes/v3/exports/campaigns.d.ts +42 -0
- package/dist/src/routes/v3/fetch.d.ts +45 -0
- package/dist/src/routes/v3/health.d.ts +39 -0
- package/dist/src/routes/v3/lostyield.d.ts +52 -0
- package/dist/src/routes/v3/merkl.d.ts +87 -0
- package/dist/src/routes/v3/morphoMarkets.d.ts +61 -0
- package/dist/src/routes/v3/morphoVaults.d.ts +51 -0
- package/dist/src/routes/v3/multiChainPositions.d.ts +1909 -0
- package/dist/src/routes/v3/opportunity.d.ts +1946 -0
- package/dist/src/routes/v3/overview.d.ts +60 -0
- package/dist/src/routes/v3/parse.d.ts +46 -0
- package/dist/src/routes/v3/payload.d.ts +57 -0
- package/dist/src/routes/v3/poolInfo.d.ts +42 -0
- package/dist/src/routes/v3/positions.d.ts +1927 -0
- package/dist/src/routes/v3/radiant.d.ts +55 -0
- package/dist/src/routes/v3/recipients.d.ts +38 -0
- package/dist/src/routes/v3/rewards.d.ts +1910 -0
- package/dist/src/routes/v3/rewardsReport.d.ts +48 -0
- package/dist/src/routes/v3/rootForTimestamp.d.ts +52 -0
- package/dist/src/routes/v3/silo.d.ts +52 -0
- package/dist/src/routes/v3/token.d.ts +50 -0
- package/dist/src/routes/v3/tokenUnclaimed.d.ts +43 -0
- package/dist/src/routes/v3/twt/participants.d.ts +40 -0
- package/dist/src/routes/v3/updates.d.ts +1907 -0
- package/dist/src/routes/v3/userRewards.d.ts +1931 -0
- package/dist/src/types/index.d.ts +46 -0
- package/dist/src/types/parameters/Action.d.ts +4 -0
- package/dist/src/types/parameters/Chain.d.ts +4 -0
- package/dist/src/types/parameters/ChainCampaignId.d.ts +4 -0
- package/dist/src/types/parameters/MainParameter.d.ts +4 -0
- package/dist/src/types/parameters/OpportunityId.d.ts +4 -0
- package/dist/src/types/parameters/Timestamp.d.ts +4 -0
- package/dist/src/types/parameters/Type.d.ts +4 -0
- package/dist/src/types/parameters/index.d.ts +36 -0
- package/dist/src/types/returnTypes.d.ts +27 -0
- package/dist/src/types/utils.d.ts +5 -0
- package/dist/src/utils/addString.d.ts +2 -0
- package/dist/src/utils/bigintToString.d.ts +1 -0
- package/dist/src/utils/crypto.d.ts +1 -0
- package/dist/src/utils/error.d.ts +53 -0
- package/dist/src/utils/execute.d.ts +32 -0
- package/dist/src/utils/generic.d.ts +24 -0
- package/dist/src/utils/hashArray.d.ts +1 -0
- package/dist/src/utils/lastBlockBefore.d.ts +3 -0
- package/dist/src/utils/logger.d.ts +24 -0
- package/dist/src/utils/pricer.d.ts +52 -0
- package/dist/src/utils/prices/chainlinkRead.d.ts +4 -0
- package/dist/src/utils/prices/curveVirtualPrice.d.ts +4 -0
- package/dist/src/utils/prices/getDQUICK.d.ts +4 -0
- package/dist/src/utils/prices/priceFetcherFactory.d.ts +10 -0
- package/dist/src/utils/prices/priceService.d.ts +13 -0
- package/dist/src/utils/prices/services/coinGeckoService.d.ts +12 -0
- package/dist/src/utils/prices/services/defillamaService.d.ts +12 -0
- package/dist/src/utils/prices/services/dexScreenerService.d.ts +12 -0
- package/dist/src/utils/prices/services/erc4626Service.d.ts +9 -0
- package/dist/src/utils/prices/services/getERC4626.d.ts +4 -0
- package/dist/src/utils/prices/services/indexCoopService.d.ts +12 -0
- package/dist/src/utils/prices/services/priceFetcher.d.ts +8 -0
- package/dist/src/utils/prices/uniV2Price.d.ts +7 -0
- package/dist/src/utils/prisma.d.ts +16 -0
- package/dist/src/utils/providers.d.ts +13 -0
- package/dist/src/utils/queries/activeCampaigns.d.ts +3 -0
- package/dist/src/utils/queries/allCampaigns.d.ts +6 -0
- package/dist/src/utils/queries/campaignsForMainParameter.d.ts +2 -0
- package/dist/src/utils/queries/claimsOverTime.d.ts +8 -0
- package/dist/src/utils/queries/endingCampaigns.d.ts +10 -0
- package/dist/src/utils/queries/futureCampaigns.d.ts +3 -0
- package/dist/src/utils/queries/mainParameterCampaigns.d.ts +5 -0
- package/dist/src/utils/queries/rewardsAmount.d.ts +10 -0
- package/dist/src/utils/queries/unclaimed.d.ts +11 -0
- package/dist/src/utils/rateLimit.d.ts +63 -0
- package/dist/src/utils/stryke.d.ts +2 -0
- package/dist/src/utils/throw.d.ts +4 -0
- package/dist/src/utils/trace.d.ts +26 -0
- package/dist/src/utils/validation.d.ts +5 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -0
- package/package.json +91 -0
@@ -0,0 +1,143 @@
|
|
1
|
+
import Elysia from "elysia";
|
2
|
+
export declare const StatusController: Elysia<"/campaignStatus", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
}, {
|
14
|
+
campaignStatus: {
|
15
|
+
engine: {
|
16
|
+
post: {
|
17
|
+
body: {
|
18
|
+
status: {
|
19
|
+
value: "SUCCESS";
|
20
|
+
computedUntil: number;
|
21
|
+
} | {
|
22
|
+
value: "PROCESSING";
|
23
|
+
} | {
|
24
|
+
error: string;
|
25
|
+
details: string;
|
26
|
+
value: "SKIPPED";
|
27
|
+
} | {
|
28
|
+
error: string;
|
29
|
+
details: string;
|
30
|
+
value: "FAILED";
|
31
|
+
};
|
32
|
+
campaignId: string;
|
33
|
+
distributionChain: number;
|
34
|
+
};
|
35
|
+
params: Record<never, string>;
|
36
|
+
query: unknown;
|
37
|
+
headers: {
|
38
|
+
authorization: string;
|
39
|
+
};
|
40
|
+
response: {
|
41
|
+
200: void;
|
42
|
+
};
|
43
|
+
};
|
44
|
+
};
|
45
|
+
};
|
46
|
+
} & {
|
47
|
+
campaignStatus: {
|
48
|
+
index: {
|
49
|
+
get: {
|
50
|
+
body: unknown;
|
51
|
+
params: Record<never, string>;
|
52
|
+
query: unknown;
|
53
|
+
headers: unknown;
|
54
|
+
response: {
|
55
|
+
200: {
|
56
|
+
campaignId: string;
|
57
|
+
computedUntil: bigint;
|
58
|
+
processingStarted: bigint;
|
59
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
60
|
+
error: string;
|
61
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
62
|
+
}[];
|
63
|
+
};
|
64
|
+
};
|
65
|
+
};
|
66
|
+
};
|
67
|
+
} & {
|
68
|
+
campaignStatus: {
|
69
|
+
unique: {
|
70
|
+
get: {
|
71
|
+
body: unknown;
|
72
|
+
params: Record<never, string>;
|
73
|
+
query: {
|
74
|
+
identifier: string;
|
75
|
+
distributionChain: number;
|
76
|
+
};
|
77
|
+
headers: unknown;
|
78
|
+
response: {
|
79
|
+
200: {
|
80
|
+
campaignId: string;
|
81
|
+
computedUntil: bigint;
|
82
|
+
processingStarted: bigint;
|
83
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
84
|
+
error: string;
|
85
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
86
|
+
};
|
87
|
+
};
|
88
|
+
};
|
89
|
+
};
|
90
|
+
};
|
91
|
+
} & {
|
92
|
+
campaignStatus: {
|
93
|
+
computeChain: {
|
94
|
+
":chainId": {
|
95
|
+
get: {
|
96
|
+
body: unknown;
|
97
|
+
params: {
|
98
|
+
chainId: number;
|
99
|
+
};
|
100
|
+
query: unknown;
|
101
|
+
headers: unknown;
|
102
|
+
response: {
|
103
|
+
200: {
|
104
|
+
campaignId: string;
|
105
|
+
computedUntil: bigint;
|
106
|
+
processingStarted: bigint;
|
107
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
108
|
+
error: string;
|
109
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
110
|
+
}[];
|
111
|
+
};
|
112
|
+
};
|
113
|
+
};
|
114
|
+
};
|
115
|
+
};
|
116
|
+
} & {
|
117
|
+
campaignStatus: {
|
118
|
+
overlaps: {
|
119
|
+
get: {
|
120
|
+
body: unknown;
|
121
|
+
params: Record<never, string>;
|
122
|
+
query: {
|
123
|
+
identifier: string;
|
124
|
+
distributionChain: number;
|
125
|
+
};
|
126
|
+
headers: {
|
127
|
+
authorization: string;
|
128
|
+
};
|
129
|
+
response: {
|
130
|
+
200: boolean;
|
131
|
+
};
|
132
|
+
};
|
133
|
+
};
|
134
|
+
};
|
135
|
+
}, {
|
136
|
+
derive: {};
|
137
|
+
resolve: {};
|
138
|
+
schema: {};
|
139
|
+
}, {
|
140
|
+
derive: {};
|
141
|
+
resolve: {};
|
142
|
+
schema: {};
|
143
|
+
}>;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export declare const ChainDto: import("@sinclair/typebox").TObject<{
|
2
|
+
chainId: import("@sinclair/typebox").TNumber;
|
3
|
+
}>;
|
4
|
+
export declare const UpdateStatusDto: import("@sinclair/typebox").TObject<{
|
5
|
+
distributionChain: import("@sinclair/typebox").TNumber;
|
6
|
+
campaignId: import("@sinclair/typebox").TString;
|
7
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
8
|
+
value: import("@sinclair/typebox").TLiteral<"SUCCESS">;
|
9
|
+
computedUntil: import("@sinclair/typebox").TNumber;
|
10
|
+
}>, import("@sinclair/typebox").TObject<{
|
11
|
+
value: import("@sinclair/typebox").TLiteral<"PROCESSING">;
|
12
|
+
}>, import("@sinclair/typebox").TObject<{
|
13
|
+
value: import("@sinclair/typebox").TLiteral<"SKIPPED">;
|
14
|
+
error: import("@sinclair/typebox").TString;
|
15
|
+
details: import("@sinclair/typebox").TString;
|
16
|
+
}>, import("@sinclair/typebox").TObject<{
|
17
|
+
value: import("@sinclair/typebox").TLiteral<"FAILED">;
|
18
|
+
error: import("@sinclair/typebox").TString;
|
19
|
+
details: import("@sinclair/typebox").TString;
|
20
|
+
}>]>;
|
21
|
+
}>;
|
22
|
+
export declare const ChainModel: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
23
|
+
export type UpdateStatusModel = typeof UpdateStatusDto.static;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import type { RunStatus } from "../../../../database/api/.generated";
|
2
|
+
import { type CampaignUnique } from "../campaign";
|
3
|
+
export declare class StatusRepository {
|
4
|
+
static findMany(): Promise<{
|
5
|
+
campaignId: string;
|
6
|
+
computedUntil: bigint;
|
7
|
+
processingStarted: bigint;
|
8
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
9
|
+
error: string;
|
10
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
11
|
+
}[]>;
|
12
|
+
static findManyPerChain(chainId: number): Promise<{
|
13
|
+
campaignId: string;
|
14
|
+
computedUntil: bigint;
|
15
|
+
processingStarted: bigint;
|
16
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
17
|
+
error: string;
|
18
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
19
|
+
}[]>;
|
20
|
+
static findUniqueOrThrow(campaignUnique: CampaignUnique): Promise<{
|
21
|
+
campaignId: string;
|
22
|
+
computedUntil: bigint;
|
23
|
+
processingStarted: bigint;
|
24
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
25
|
+
error: string;
|
26
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
27
|
+
}>;
|
28
|
+
static findUnique(campaignUnique: CampaignUnique): Promise<{
|
29
|
+
campaignId: string;
|
30
|
+
computedUntil: bigint;
|
31
|
+
processingStarted: bigint;
|
32
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
33
|
+
error: string;
|
34
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
35
|
+
} | null>;
|
36
|
+
static create(campaign: CampaignUnique, startTimestamp: bigint): Promise<{
|
37
|
+
campaignId: string;
|
38
|
+
computedUntil: bigint;
|
39
|
+
processingStarted: bigint;
|
40
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
41
|
+
error: string;
|
42
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
43
|
+
}>;
|
44
|
+
static updateSuccess(campaignUnique: CampaignUnique, computedUntil: number): Promise<{
|
45
|
+
campaignId: string;
|
46
|
+
computedUntil: bigint;
|
47
|
+
processingStarted: bigint;
|
48
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
49
|
+
error: string;
|
50
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
51
|
+
}>;
|
52
|
+
static updateWithError(campaignUnique: CampaignUnique, status: Exclude<RunStatus, "SUCCESS" | "PROCESSING">, error: string, details: string): Promise<{
|
53
|
+
campaignId: string;
|
54
|
+
computedUntil: bigint;
|
55
|
+
processingStarted: bigint;
|
56
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
57
|
+
error: string;
|
58
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
59
|
+
}>;
|
60
|
+
static updateProcessing(campaignUnique: CampaignUnique): Promise<{
|
61
|
+
campaignId: string;
|
62
|
+
computedUntil: bigint;
|
63
|
+
processingStarted: bigint;
|
64
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
65
|
+
error: string;
|
66
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
67
|
+
}>;
|
68
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { type CampaignUnique } from "../campaign";
|
2
|
+
import type { UpdateStatusModel } from "./status.model";
|
3
|
+
export declare class StatusService {
|
4
|
+
static findMany(): Promise<{
|
5
|
+
campaignId: string;
|
6
|
+
computedUntil: bigint;
|
7
|
+
processingStarted: bigint;
|
8
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
9
|
+
error: string;
|
10
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
11
|
+
}[]>;
|
12
|
+
static findManyPerChain(chainId: number): Promise<{
|
13
|
+
campaignId: string;
|
14
|
+
computedUntil: bigint;
|
15
|
+
processingStarted: bigint;
|
16
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
17
|
+
error: string;
|
18
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
19
|
+
}[]>;
|
20
|
+
static findUniqueOrThrow(campaignUnique: CampaignUnique): Promise<{
|
21
|
+
campaignId: string;
|
22
|
+
computedUntil: bigint;
|
23
|
+
processingStarted: bigint;
|
24
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
25
|
+
error: string;
|
26
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
27
|
+
}>;
|
28
|
+
static findUnique(campaignUnique: CampaignUnique): Promise<{
|
29
|
+
campaignId: string;
|
30
|
+
computedUntil: bigint;
|
31
|
+
processingStarted: bigint;
|
32
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
33
|
+
error: string;
|
34
|
+
details: import("../../../../database/api/.generated").Prisma.JsonValue;
|
35
|
+
} | null>;
|
36
|
+
static update(x: UpdateStatusModel): Promise<void>;
|
37
|
+
static isSafeForOverlaps(campaignUnique: CampaignUnique): Promise<boolean>;
|
38
|
+
}
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import Elysia from "elysia";
|
2
|
+
export declare const TokenController: Elysia<"/tokens", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
}, {
|
14
|
+
tokens: {
|
15
|
+
":id": {
|
16
|
+
get: {
|
17
|
+
body: unknown;
|
18
|
+
params: {
|
19
|
+
id: string;
|
20
|
+
};
|
21
|
+
query: unknown;
|
22
|
+
headers: unknown;
|
23
|
+
response: {
|
24
|
+
200: ({
|
25
|
+
symbol: string;
|
26
|
+
name: string | null;
|
27
|
+
id: string;
|
28
|
+
chainId: number;
|
29
|
+
address: string;
|
30
|
+
icon: string;
|
31
|
+
decimals: number;
|
32
|
+
verified: boolean;
|
33
|
+
} & {
|
34
|
+
price?: number | null | undefined;
|
35
|
+
}) | undefined;
|
36
|
+
};
|
37
|
+
};
|
38
|
+
};
|
39
|
+
};
|
40
|
+
} & {
|
41
|
+
tokens: {
|
42
|
+
balances: {
|
43
|
+
get: {
|
44
|
+
body: unknown;
|
45
|
+
params: Record<never, string>;
|
46
|
+
query: {
|
47
|
+
tokenAddress?: string | undefined;
|
48
|
+
additionalTokenAddresses?: string[] | undefined;
|
49
|
+
chainId: number;
|
50
|
+
userAddress: string;
|
51
|
+
};
|
52
|
+
headers: unknown;
|
53
|
+
response: {
|
54
|
+
200: ({
|
55
|
+
symbol: string;
|
56
|
+
name: string | null;
|
57
|
+
id: string;
|
58
|
+
chainId: number;
|
59
|
+
address: string;
|
60
|
+
icon: string;
|
61
|
+
decimals: number;
|
62
|
+
verified: boolean;
|
63
|
+
} & {
|
64
|
+
price?: number | null | undefined;
|
65
|
+
} & {
|
66
|
+
balance: bigint;
|
67
|
+
})[];
|
68
|
+
};
|
69
|
+
};
|
70
|
+
};
|
71
|
+
};
|
72
|
+
} & {
|
73
|
+
tokens: {
|
74
|
+
index: {
|
75
|
+
get: {
|
76
|
+
body: unknown;
|
77
|
+
params: Record<never, string>;
|
78
|
+
query: {
|
79
|
+
symbol?: string | undefined;
|
80
|
+
name?: string | undefined;
|
81
|
+
chainId?: any;
|
82
|
+
address?: string | undefined;
|
83
|
+
verified?: boolean | undefined;
|
84
|
+
};
|
85
|
+
headers: unknown;
|
86
|
+
response: {
|
87
|
+
200: ({
|
88
|
+
symbol: string;
|
89
|
+
name: string | null;
|
90
|
+
id: string;
|
91
|
+
chainId: number;
|
92
|
+
address: string;
|
93
|
+
icon: string;
|
94
|
+
decimals: number;
|
95
|
+
verified: boolean;
|
96
|
+
} & {
|
97
|
+
price?: number | null | undefined;
|
98
|
+
})[];
|
99
|
+
};
|
100
|
+
};
|
101
|
+
};
|
102
|
+
};
|
103
|
+
} & {
|
104
|
+
tokens: {
|
105
|
+
count: {
|
106
|
+
get: {
|
107
|
+
body: unknown;
|
108
|
+
params: Record<never, string>;
|
109
|
+
query: {
|
110
|
+
symbol?: string | undefined;
|
111
|
+
name?: string | undefined;
|
112
|
+
chainId?: any;
|
113
|
+
address?: string | undefined;
|
114
|
+
verified?: boolean | undefined;
|
115
|
+
};
|
116
|
+
headers: unknown;
|
117
|
+
response: {
|
118
|
+
200: number;
|
119
|
+
};
|
120
|
+
};
|
121
|
+
};
|
122
|
+
};
|
123
|
+
}, {
|
124
|
+
derive: {};
|
125
|
+
resolve: {};
|
126
|
+
schema: {};
|
127
|
+
}, {
|
128
|
+
derive: {};
|
129
|
+
resolve: {};
|
130
|
+
schema: {};
|
131
|
+
}>;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { Resource } from "../prisma";
|
2
|
+
/**
|
3
|
+
* Token
|
4
|
+
* @description Data of an onchain asset
|
5
|
+
* @see {@link Resource}
|
6
|
+
*/
|
7
|
+
export type Token = Resource<"Token", never, {
|
8
|
+
price?: number | null;
|
9
|
+
}>;
|
10
|
+
export type TokenUnique = {
|
11
|
+
chainId: number;
|
12
|
+
address: string;
|
13
|
+
};
|
14
|
+
export declare const FindUniqueTokenDto: import("@sinclair/typebox").TObject<{
|
15
|
+
id: import("@sinclair/typebox").TString;
|
16
|
+
}>;
|
17
|
+
export declare const GetTokenQueryDto: import("@sinclair/typebox").TObject<{
|
18
|
+
symbol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
19
|
+
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<any>>;
|
20
|
+
address: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
21
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
22
|
+
verified: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
23
|
+
}>;
|
24
|
+
export declare const TokenDto: import("@sinclair/typebox").TObject<{
|
25
|
+
address: import("@sinclair/typebox").TString;
|
26
|
+
chainId: import("@sinclair/typebox").TNumber;
|
27
|
+
}>;
|
28
|
+
export declare const GetTokenBalanceDto: import("@sinclair/typebox").TObject<{
|
29
|
+
chainId: import("@sinclair/typebox").TNumber;
|
30
|
+
userAddress: import("@sinclair/typebox").TString;
|
31
|
+
tokenAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
32
|
+
additionalTokenAddresses: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
33
|
+
}>;
|
34
|
+
export type TokenModel = typeof TokenDto.static;
|
35
|
+
export type GetTokenQueryModel = typeof GetTokenQueryDto.static;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import type { ChainId } from "@sdk";
|
2
|
+
import type { GetTokenQueryModel, Token, TokenModel } from "./token.model";
|
3
|
+
export declare abstract class TokenRepository {
|
4
|
+
#private;
|
5
|
+
/**
|
6
|
+
* Fetch token metadata from onchain
|
7
|
+
* @param chainId
|
8
|
+
* @param address
|
9
|
+
* @returns
|
10
|
+
*/
|
11
|
+
static getTokenInfo(token: TokenModel): Promise<{
|
12
|
+
name: string;
|
13
|
+
symbol: string;
|
14
|
+
decimals: number;
|
15
|
+
}>;
|
16
|
+
/**
|
17
|
+
* Read token from database
|
18
|
+
* @param chainId
|
19
|
+
* @param address
|
20
|
+
*/
|
21
|
+
static findUnique(id: string): Promise<Token["model"] | undefined>;
|
22
|
+
/**
|
23
|
+
* Read token from database
|
24
|
+
* @param chainId
|
25
|
+
* @param address
|
26
|
+
*/
|
27
|
+
static findUniqueOrThrow(id: string): Promise<Token["model"] | undefined>;
|
28
|
+
/**
|
29
|
+
* Read token from database by its symbol
|
30
|
+
* @param symbol
|
31
|
+
*/
|
32
|
+
static findMany(query: GetTokenQueryModel): Promise<Token["model"][]>;
|
33
|
+
static countMany(query: GetTokenQueryModel): Promise<number>;
|
34
|
+
/**
|
35
|
+
* upsert a token on database
|
36
|
+
* @param token
|
37
|
+
*/
|
38
|
+
static upsert(token: Token["model"]): Promise<Token["model"] | undefined>;
|
39
|
+
/**
|
40
|
+
* Updates price of tokens that share the same symbol
|
41
|
+
* @param symbol
|
42
|
+
* @param price value
|
43
|
+
* @param excludeAddresses to not update even if symbol match
|
44
|
+
*/
|
45
|
+
static updateSymbolPrices(symbol: string, price: number, excludeAddresses: string[]): Promise<import("../../../../database/api/.generated").Prisma.BatchPayload>;
|
46
|
+
/**
|
47
|
+
* Updates price of tokens that share the same address
|
48
|
+
* @param address
|
49
|
+
* @param price value
|
50
|
+
* @param chainId
|
51
|
+
*/
|
52
|
+
static updateAddressPrices(address: string, price: number, chainId?: number): Promise<import("../../../../database/api/.generated").Prisma.BatchPayload>;
|
53
|
+
static findChains(): Promise<Record<string, ChainId>>;
|
54
|
+
/**
|
55
|
+
* create a token on database
|
56
|
+
* @param token
|
57
|
+
*/
|
58
|
+
static create(token: Token["model"]): Promise<Token["model"] | undefined>;
|
59
|
+
}
|
@@ -0,0 +1,165 @@
|
|
1
|
+
import type { GetTokenQueryModel, Token, TokenModel, TokenUnique } from "./";
|
2
|
+
import type { Pricer } from "../../../utils/pricer";
|
3
|
+
import { Prisma } from "../../../../database/api/.generated";
|
4
|
+
import { type ChainId } from "@sdk";
|
5
|
+
export declare abstract class TokenService {
|
6
|
+
static hashId(token: TokenUnique): string;
|
7
|
+
/**
|
8
|
+
* Fetches balances of provided tokens
|
9
|
+
*/
|
10
|
+
static fetchBalances(chainId: number, userAddress: string, tokens: Token["model"][]): Promise<(Token["model"] & {
|
11
|
+
balance: bigint;
|
12
|
+
})[]>;
|
13
|
+
/**
|
14
|
+
* Fetches tokens and include balances
|
15
|
+
*/
|
16
|
+
static fetchTokensAndBalances(chainId: number, userAddress: string, addresses: string[]): Promise<({
|
17
|
+
symbol: string;
|
18
|
+
name: string | null;
|
19
|
+
id: string;
|
20
|
+
chainId: number;
|
21
|
+
address: string;
|
22
|
+
icon: string;
|
23
|
+
decimals: number;
|
24
|
+
verified: boolean;
|
25
|
+
} & {
|
26
|
+
price?: number | null | undefined;
|
27
|
+
} & {
|
28
|
+
balance: bigint;
|
29
|
+
})[]>;
|
30
|
+
/**
|
31
|
+
* Fetches balances of verified tokens
|
32
|
+
* @info tokens that are popular and must be detected in the app are marked as 'verified'
|
33
|
+
* @param additionalTokens balances along with the verified ones
|
34
|
+
*/
|
35
|
+
static fetchVerifiedBalances(chainId: number, userAddress: string, additionalTokenAddresses?: string[]): Promise<({
|
36
|
+
symbol: string;
|
37
|
+
name: string | null;
|
38
|
+
id: string;
|
39
|
+
chainId: number;
|
40
|
+
address: string;
|
41
|
+
icon: string;
|
42
|
+
decimals: number;
|
43
|
+
verified: boolean;
|
44
|
+
} & {
|
45
|
+
price?: number | null | undefined;
|
46
|
+
} & {
|
47
|
+
balance: bigint;
|
48
|
+
})[]>;
|
49
|
+
static fetchOnChain(token: TokenModel): Promise<Omit<Token["model"], "id">>;
|
50
|
+
static fetchManyOnChain(chainId: ChainId, addresses: string[]): Promise<{
|
51
|
+
[address: string]: Omit<{
|
52
|
+
symbol: string;
|
53
|
+
name: string | null;
|
54
|
+
id: string;
|
55
|
+
chainId: number;
|
56
|
+
address: string;
|
57
|
+
icon: string;
|
58
|
+
decimals: number;
|
59
|
+
verified: boolean;
|
60
|
+
} & {
|
61
|
+
price?: number | null | undefined;
|
62
|
+
}, "id">;
|
63
|
+
}>;
|
64
|
+
/**
|
65
|
+
* Updates price of tokens that share the same symbol
|
66
|
+
* @param symbol
|
67
|
+
* @param price value
|
68
|
+
* @param excludeAddresses to not update symbols that defined using addresses
|
69
|
+
*/
|
70
|
+
static updateSymbolPrices(symbol: string, price: number, excludeAddresses: string[]): Promise<Prisma.BatchPayload>;
|
71
|
+
/**
|
72
|
+
* Updates price of tokens that share the same address
|
73
|
+
* @param address
|
74
|
+
* @param price value
|
75
|
+
* @param chainId
|
76
|
+
*/
|
77
|
+
static updateAddressPrices(address: string, price: number, chainId?: number): Promise<Prisma.BatchPayload>;
|
78
|
+
/**
|
79
|
+
* Updates price of tokens that share the same symbol
|
80
|
+
* @param symbol
|
81
|
+
* @param price value
|
82
|
+
* @param excludeAddresses to not update symbols that defined using addresses
|
83
|
+
*/
|
84
|
+
static updatePrices(pricer: Pricer): Promise<void>;
|
85
|
+
/**
|
86
|
+
* Get all tokens from https://github.com/AngleProtocol/angle-token-list and override icons from it
|
87
|
+
* TODO: use the bucket
|
88
|
+
*/
|
89
|
+
static fillTokenAndIconsFromTokenList(): Promise<void>;
|
90
|
+
/**
|
91
|
+
* Create token on database
|
92
|
+
* @param chainId
|
93
|
+
* @param address
|
94
|
+
*/
|
95
|
+
static create(token: Omit<Token["model"], "id">): Promise<({
|
96
|
+
symbol: string;
|
97
|
+
name: string | null;
|
98
|
+
id: string;
|
99
|
+
chainId: number;
|
100
|
+
address: string;
|
101
|
+
icon: string;
|
102
|
+
decimals: number;
|
103
|
+
verified: boolean;
|
104
|
+
} & {
|
105
|
+
price?: number | null | undefined;
|
106
|
+
}) | undefined>;
|
107
|
+
/**
|
108
|
+
* Read token from database
|
109
|
+
* @param chainId
|
110
|
+
* @param address
|
111
|
+
*/
|
112
|
+
static findUniqueOrThrow(token: TokenUnique): Promise<({
|
113
|
+
symbol: string;
|
114
|
+
name: string | null;
|
115
|
+
id: string;
|
116
|
+
chainId: number;
|
117
|
+
address: string;
|
118
|
+
icon: string;
|
119
|
+
decimals: number;
|
120
|
+
verified: boolean;
|
121
|
+
} & {
|
122
|
+
price?: number | null | undefined;
|
123
|
+
}) | undefined>;
|
124
|
+
/**
|
125
|
+
* Get the list of tokens satisfying the query
|
126
|
+
* @param query
|
127
|
+
* @returns A list of tokens
|
128
|
+
*/
|
129
|
+
static findMany(query: GetTokenQueryModel): Promise<({
|
130
|
+
symbol: string;
|
131
|
+
name: string | null;
|
132
|
+
id: string;
|
133
|
+
chainId: number;
|
134
|
+
address: string;
|
135
|
+
icon: string;
|
136
|
+
decimals: number;
|
137
|
+
verified: boolean;
|
138
|
+
} & {
|
139
|
+
price?: number | null | undefined;
|
140
|
+
})[]>;
|
141
|
+
/**
|
142
|
+
* Get value of tokens
|
143
|
+
* @param tokenAmounts address/chain + amount of token
|
144
|
+
* @returns the cumulated dollar value of all tokens
|
145
|
+
*/
|
146
|
+
static getValue(tokenAmounts: {
|
147
|
+
amount: bigint;
|
148
|
+
address: string;
|
149
|
+
chainId: number;
|
150
|
+
}[]): Promise<number>;
|
151
|
+
/**
|
152
|
+
* Counts the number of tokens that complies to query
|
153
|
+
* @description used for pagination purposes
|
154
|
+
* @param query
|
155
|
+
* @returns the number of tokens
|
156
|
+
*/
|
157
|
+
static countMany(query: GetTokenQueryModel): Promise<number>;
|
158
|
+
static findChains(): Promise<Record<string, ChainId>>;
|
159
|
+
/**
|
160
|
+
* Read token from DB or fetch onchain
|
161
|
+
* @param chainId
|
162
|
+
* @param address
|
163
|
+
*/
|
164
|
+
static getManyOrCreate(tokens: TokenModel[]): Promise<(Token["model"] | undefined)[]>;
|
165
|
+
}
|
File without changes
|