From 26d2a2e3974473d715b2e99ba7e48c3e47681ddc Mon Sep 17 00:00:00 2001 From: Loco <89942527+locothedev@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:42:07 +0700 Subject: [PATCH] feat: expose defi endpoints (#1211) --- .changeset/rude-panthers-tell.md | 6 + demos/cli/src/main.ts | 16 + .../common/evmUtils/generator.config.json | 5 +- .../src/generated/client/abstractClient.ts | 50 +++- .../GetDefiPositionsByProtocolOperation.ts | 58 ++++ .../GetDefiPositionsSummaryOperation.ts | 49 ++++ .../operations/GetDefiSummaryOperation.ts | 49 ++++ .../operations/GetNFTTradesOperation.ts | 12 +- .../operations/GetWalletHistoryOperation.ts | 16 +- .../src/generated/operations/index.ts | 3 + .../src/generated/operations/operations.ts | 6 + .../generated/types/EvmDefiPositionDetails.ts | 275 ++++++++++++++++++ .../EvmDefiPositionDetailsNftMetadata.ts | 16 + .../types/EvmDefiPositionSummaryResponse.ts | 85 ++++++ .../generated/types/EvmDefiProtocolBalance.ts | 63 ++++ .../generated/types/EvmDefiProtocolList.ts | 16 + .../types/EvmDefiProtocolPosition.ts | 94 ++++++ .../generated/types/EvmDefiTokenBalance.ts | 145 +++++++++ .../types/EvmGetDefiPositionsByProtocol.ts | 96 ++++++ .../evmUtils/src/generated/types/EvmLog.ts | 138 +++++++++ .../generated/types/EvmWalletDefiSummary.ts | 82 ++++++ .../types/EvmWalletHistoryTransaction.ts | 8 + .../evmUtils/src/generated/types/index.ts | 10 + packages/evmApi/src/generated/ClientEvmApi.ts | 11 +- 24 files changed, 1300 insertions(+), 9 deletions(-) create mode 100644 .changeset/rude-panthers-tell.md create mode 100644 packages/common/evmUtils/src/generated/operations/GetDefiPositionsByProtocolOperation.ts create mode 100644 packages/common/evmUtils/src/generated/operations/GetDefiPositionsSummaryOperation.ts create mode 100644 packages/common/evmUtils/src/generated/operations/GetDefiSummaryOperation.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmDefiPositionDetails.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmDefiPositionDetailsNftMetadata.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmDefiPositionSummaryResponse.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmDefiProtocolBalance.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmDefiProtocolList.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmDefiProtocolPosition.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmDefiTokenBalance.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmGetDefiPositionsByProtocol.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmLog.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmWalletDefiSummary.ts diff --git a/.changeset/rude-panthers-tell.md b/.changeset/rude-panthers-tell.md new file mode 100644 index 0000000000..955e048689 --- /dev/null +++ b/.changeset/rude-panthers-tell.md @@ -0,0 +1,6 @@ +--- +'@moralisweb3/common-evm-utils': patch +'@moralisweb3/evm-api': patch +--- + +Adding new DeFi endpoints to the SDK diff --git a/demos/cli/src/main.ts b/demos/cli/src/main.ts index 2a44aeb0a2..82a5e6218c 100644 --- a/demos/cli/src/main.ts +++ b/demos/cli/src/main.ts @@ -46,6 +46,22 @@ async function main() { address: '0x4a220e6096b25eadb88358cb44068a3248254675', }); console.log('tokenStats', tokenStats.result.toJSON()); + + const defiSummary = await Moralis.EvmApi.wallets.getDefiSummary({ + address: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', + }); + console.log('defiSummary', defiSummary.result.toJSON()); + + const defiPositions = await Moralis.EvmApi.wallets.getDefiPositionsSummary({ + address: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', + }); + console.log('defiPositions', defiPositions); + + const defiProtocolPositions = await Moralis.EvmApi.wallets.getDefiPositionsByProtocol({ + address: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', + protocol: 'uniswap-v2', + }); + console.log('defiProtocolPositions', defiProtocolPositions.result.toJSON().positions); } main(); diff --git a/packages/common/evmUtils/generator.config.json b/packages/common/evmUtils/generator.config.json index 5ccb942fc7..eafb1d2369 100644 --- a/packages/common/evmUtils/generator.config.json +++ b/packages/common/evmUtils/generator.config.json @@ -121,7 +121,10 @@ "getWalletHistory", "getNFTSalePrices", "getNFTContractSalePrices", - "getTokenOwners" + "getTokenOwners", + "getDefiSummary", + "getDefiPositionsByProtocol", + "getDefiPositionsSummary" ] } } diff --git a/packages/common/evmUtils/src/generated/client/abstractClient.ts b/packages/common/evmUtils/src/generated/client/abstractClient.ts index 1e3c436c56..87b472da3d 100644 --- a/packages/common/evmUtils/src/generated/client/abstractClient.ts +++ b/packages/common/evmUtils/src/generated/client/abstractClient.ts @@ -36,6 +36,12 @@ import { GetTopCryptoCurrenciesByTradingVolumeOperation, GetTopCryptoCurrenciesB import { ReviewContractsOperation, ReviewContractsOperationRequest, ReviewContractsOperationRequestJSON } from '../operations/ReviewContractsOperation'; import { EvmReviewContracts, EvmReviewContractsJSON } from '../types/EvmReviewContracts'; import { EvmContractsReviewDto, EvmContractsReviewDtoInput, EvmContractsReviewDtoJSON } from '../types/EvmContractsReviewDto'; +import { GetDefiSummaryOperation, GetDefiSummaryOperationRequest, GetDefiSummaryOperationRequestJSON } from '../operations/GetDefiSummaryOperation'; +import { EvmWalletDefiSummary, EvmWalletDefiSummaryJSON } from '../types/EvmWalletDefiSummary'; +import { GetDefiPositionsByProtocolOperation, GetDefiPositionsByProtocolOperationRequest, GetDefiPositionsByProtocolOperationRequestJSON } from '../operations/GetDefiPositionsByProtocolOperation'; +import { EvmGetDefiPositionsByProtocol, EvmGetDefiPositionsByProtocolJSON } from '../types/EvmGetDefiPositionsByProtocol'; +import { GetDefiPositionsSummaryOperation, GetDefiPositionsSummaryOperationRequest, GetDefiPositionsSummaryOperationRequestJSON } from '../operations/GetDefiPositionsSummaryOperation'; +import { EvmDefiPositionSummaryResponse, EvmDefiPositionSummaryResponseJSON } from '../types/EvmDefiPositionSummaryResponse'; import { GetWalletActiveChainsOperation, GetWalletActiveChainsOperationRequest, GetWalletActiveChainsOperationRequestJSON } from '../operations/GetWalletActiveChainsOperation'; import { EvmWalletActiveChains, EvmWalletActiveChainsJSON } from '../types/EvmWalletActiveChains'; import { GetWalletStatsOperation, GetWalletStatsOperationRequest, GetWalletStatsOperationRequestJSON } from '../operations/GetWalletStatsOperation'; @@ -176,7 +182,7 @@ export abstract class AbstractClient { }; public readonly nft = { /** - * @description Get trades of NFTs for a given contract and marketplace. + * @description Get trades of NFTs for a given contract with the ability to filter by marketplace. * @param request Request with parameters. * @param {Object} request.address The address of the NFT contract * @param {Object} [request.chain] The chain to query (optional) @@ -193,6 +199,7 @@ export abstract class AbstractClient { * @param {Object} [request.marketplace] Marketplace from which to get the trades. See [supported Marketplaces](https://docs.moralis.io/web3-data-api/evm/nft-marketplaces). (optional) * @param {String} [request.cursor] The cursor returned in the previous response (used for getting the next page). (optional) * @param {Number} [request.limit] The desired page size of the result. (optional) + * @param {Boolean} [request.nftMetadata] Include the NFT Metadata of the NFT Token (optional) * @returns {Object} Response for the request. */ getNFTTrades: this.createEndpoint< @@ -383,6 +390,7 @@ export abstract class AbstractClient { * * If 'to_date' and 'to_block' are provided, 'to_block' will be used. (optional) * @param {Boolean} [request.includeInternalTransactions] If the result should contain the internal transactions. (optional) * @param {Boolean} [request.includeInputData] Set the input data from the result (optional) + * @param {Boolean} [request.includeLogsData] Set the logs data from the result (optional) * @param {Boolean} [request.nftMetadata] If the result should contain the nft metadata. (optional) * @param {String} [request.cursor] The cursor returned in the previous response (used for getting the next page). (optional) * @param {Object} [request.order] The order of the result, in ascending (ASC) or descending (DESC) (optional) @@ -430,6 +438,46 @@ export abstract class AbstractClient { EvmNetWorthResult, EvmNetWorthResultJSON >(GetWalletNetWorthOperation), + /** + * @description Get the defi summary of a wallet address. + * @param request Request with parameters. + * @param {Object} request.address Wallet address + * @param {Object} [request.chain] The chain to query (optional) + * @returns {Object} Response for the request. + */ + getDefiSummary: this.createEndpoint< + GetDefiSummaryOperationRequest, + GetDefiSummaryOperationRequestJSON, + EvmWalletDefiSummary, + EvmWalletDefiSummaryJSON + >(GetDefiSummaryOperation), + /** + * @description Get the detailed defi positions by protocol for a wallet address. + * @param request Request with parameters. + * @param {Object} request.address Wallet address + * @param {Object} request.protocol The protocol to query + * @param {Object} [request.chain] The chain to query (optional) + * @returns {Object} Response for the request. + */ + getDefiPositionsByProtocol: this.createEndpoint< + GetDefiPositionsByProtocolOperationRequest, + GetDefiPositionsByProtocolOperationRequestJSON, + EvmGetDefiPositionsByProtocol, + EvmGetDefiPositionsByProtocolJSON + >(GetDefiPositionsByProtocolOperation), + /** + * @description Get the positions summary of a wallet address. + * @param request Request with parameters. + * @param {Object} request.address Wallet address + * @param {Object} [request.chain] The chain to query (optional) + * @returns {Object[]} Response for the request. + */ + getDefiPositionsSummary: this.createEndpoint< + GetDefiPositionsSummaryOperationRequest, + GetDefiPositionsSummaryOperationRequestJSON, + EvmDefiPositionSummaryResponse[], + EvmDefiPositionSummaryResponseJSON[] + >(GetDefiPositionsSummaryOperation), /** * @description Get the active chains for a wallet address. * @param request Request with parameters. diff --git a/packages/common/evmUtils/src/generated/operations/GetDefiPositionsByProtocolOperation.ts b/packages/common/evmUtils/src/generated/operations/GetDefiPositionsByProtocolOperation.ts new file mode 100644 index 0000000000..e46f0563a1 --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetDefiPositionsByProtocolOperation.ts @@ -0,0 +1,58 @@ +import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmDefiProtocolList, EvmDefiProtocolListValue, EvmDefiProtocolListInput, EvmDefiProtocolListJSON } from '../types/EvmDefiProtocolList'; +import { EvmGetDefiPositionsByProtocol, EvmGetDefiPositionsByProtocolJSON } from '../types/EvmGetDefiPositionsByProtocol'; + +// request parameters: +// - chain ($ref: #/components/schemas/chainList) +// - address ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/parameters/1/schema) +// - protocol ($ref: #/components/schemas/defiProtocolList) + +export interface GetDefiPositionsByProtocolOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description Wallet address + */ + readonly address: EvmAddressInput | EvmAddress; + /** + * @description The protocol to query + */ + readonly protocol: EvmDefiProtocolListInput | EvmDefiProtocolListValue; +} + +export interface GetDefiPositionsByProtocolOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly address: EvmAddressJSON; + readonly protocol: EvmDefiProtocolListJSON; +} + +export type GetDefiPositionsByProtocolOperationResponse = EvmGetDefiPositionsByProtocol; +export type GetDefiPositionsByProtocolOperationResponseJSON = EvmGetDefiPositionsByProtocolJSON; + +export const GetDefiPositionsByProtocolOperation = { + operationId: "getDefiPositionsByProtocol", + groupName: "wallets", + httpMethod: "get", + routePattern: "/wallets/{address}/defi/{protocol}/positions", + parameterNames: ["chain","address","protocol"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmGetDefiPositionsByProtocolJSON): EvmGetDefiPositionsByProtocol { + return EvmGetDefiPositionsByProtocol.fromJSON(json); + }, + + serializeRequest(request: GetDefiPositionsByProtocolOperationRequest): GetDefiPositionsByProtocolOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const address = EvmAddress.create(request.address); + const protocol = EvmDefiProtocolList.create(request.protocol); + return { + chain: chain ? chain.toJSON() : undefined, + address: address.toJSON(), + protocol: protocol, + }; + }, + +} diff --git a/packages/common/evmUtils/src/generated/operations/GetDefiPositionsSummaryOperation.ts b/packages/common/evmUtils/src/generated/operations/GetDefiPositionsSummaryOperation.ts new file mode 100644 index 0000000000..07940f92bb --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetDefiPositionsSummaryOperation.ts @@ -0,0 +1,49 @@ +import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmDefiPositionSummaryResponse, EvmDefiPositionSummaryResponseJSON } from '../types/EvmDefiPositionSummaryResponse'; + +// request parameters: +// - chain ($ref: #/components/schemas/chainList) +// - address ($ref: #/paths/~1wallets~1{address}~1defi~1positions/get/parameters/1/schema) + +export interface GetDefiPositionsSummaryOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description Wallet address + */ + readonly address: EvmAddressInput | EvmAddress; +} + +export interface GetDefiPositionsSummaryOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly address: EvmAddressJSON; +} + +export type GetDefiPositionsSummaryOperationResponse = EvmDefiPositionSummaryResponse[]; +export type GetDefiPositionsSummaryOperationResponseJSON = EvmDefiPositionSummaryResponseJSON[]; + +export const GetDefiPositionsSummaryOperation = { + operationId: "getDefiPositionsSummary", + groupName: "wallets", + httpMethod: "get", + routePattern: "/wallets/{address}/defi/positions", + parameterNames: ["chain","address"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmDefiPositionSummaryResponseJSON[]): EvmDefiPositionSummaryResponse[] { + return json.map((item) => EvmDefiPositionSummaryResponse.fromJSON(item)); + }, + + serializeRequest(request: GetDefiPositionsSummaryOperationRequest): GetDefiPositionsSummaryOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const address = EvmAddress.create(request.address); + return { + chain: chain ? chain.toJSON() : undefined, + address: address.toJSON(), + }; + }, + +} diff --git a/packages/common/evmUtils/src/generated/operations/GetDefiSummaryOperation.ts b/packages/common/evmUtils/src/generated/operations/GetDefiSummaryOperation.ts new file mode 100644 index 0000000000..2d573a1a4d --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetDefiSummaryOperation.ts @@ -0,0 +1,49 @@ +import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmWalletDefiSummary, EvmWalletDefiSummaryJSON } from '../types/EvmWalletDefiSummary'; + +// request parameters: +// - chain ($ref: #/components/schemas/chainList) +// - address ($ref: #/paths/~1wallets~1{address}~1defi~1summary/get/parameters/1/schema) + +export interface GetDefiSummaryOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description Wallet address + */ + readonly address: EvmAddressInput | EvmAddress; +} + +export interface GetDefiSummaryOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly address: EvmAddressJSON; +} + +export type GetDefiSummaryOperationResponse = EvmWalletDefiSummary; +export type GetDefiSummaryOperationResponseJSON = EvmWalletDefiSummaryJSON; + +export const GetDefiSummaryOperation = { + operationId: "getDefiSummary", + groupName: "wallets", + httpMethod: "get", + routePattern: "/wallets/{address}/defi/summary", + parameterNames: ["chain","address"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmWalletDefiSummaryJSON): EvmWalletDefiSummary { + return EvmWalletDefiSummary.fromJSON(json); + }, + + serializeRequest(request: GetDefiSummaryOperationRequest): GetDefiSummaryOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const address = EvmAddress.create(request.address); + return { + chain: chain ? chain.toJSON() : undefined, + address: address.toJSON(), + }; + }, + +} diff --git a/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts b/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts index 0e51d53387..5fe6f31789 100644 --- a/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts @@ -11,7 +11,8 @@ import { EvmTradeCollection, EvmTradeCollectionJSON } from '../types/EvmTradeCol // - marketplace ($ref: #/paths/~1nft~1{address}~1trades/get/parameters/5/schema) // - cursor ($ref: #/paths/~1nft~1{address}~1trades/get/parameters/6/schema) // - limit ($ref: #/paths/~1nft~1{address}~1trades/get/parameters/7/schema) -// - address ($ref: #/paths/~1nft~1{address}~1trades/get/parameters/8/schema) +// - nft_metadata ($ref: #/paths/~1nft~1{address}~1trades/get/parameters/8/schema) +// - address ($ref: #/paths/~1nft~1{address}~1trades/get/parameters/9/schema) export interface GetNFTTradesOperationRequest { /** @@ -52,6 +53,10 @@ export interface GetNFTTradesOperationRequest { * @description The desired page size of the result. */ readonly limit?: number; + /** + * @description Include the NFT Metadata of the NFT Token + */ + readonly nftMetadata?: boolean; /** * @description The address of the NFT contract */ @@ -67,6 +72,7 @@ export interface GetNFTTradesOperationRequestJSON { readonly marketplace?: EvmGetNFTTradesMarketplaceEnumJSON; readonly cursor?: string; readonly limit?: number; + readonly nft_metadata?: boolean; readonly address: EvmAddressJSON; } @@ -78,7 +84,7 @@ export const GetNFTTradesOperation = { groupName: "nft", httpMethod: "get", routePattern: "/nft/{address}/trades", - parameterNames: ["chain","from_block","to_block","from_date","to_date","marketplace","cursor","limit","address"], + parameterNames: ["chain","from_block","to_block","from_date","to_date","marketplace","cursor","limit","nft_metadata","address"], hasResponse: true, hasBody: false, @@ -95,6 +101,7 @@ export const GetNFTTradesOperation = { const marketplace = request.marketplace ? EvmGetNFTTradesMarketplaceEnum.create(request.marketplace) : undefined; const cursor = request.cursor; const limit = request.limit; + const nftMetadata = request.nftMetadata; const address = EvmAddress.create(request.address); return { chain: chain ? chain.toJSON() : undefined, @@ -105,6 +112,7 @@ export const GetNFTTradesOperation = { marketplace: marketplace ? marketplace : undefined, cursor: cursor, limit: limit, + nft_metadata: nftMetadata, address: address.toJSON(), }; }, diff --git a/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts b/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts index 684118c1d2..74c05f16fb 100644 --- a/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts @@ -11,10 +11,11 @@ import { EvmWalletHistory, EvmWalletHistoryJSON } from '../types/EvmWalletHistor // - address ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/5/schema) // - include_internal_transactions ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/6/schema) // - include_input_data ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/7/schema) -// - nft_metadata ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/8/schema) -// - cursor ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/9/schema) +// - include_logs_data ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/8/schema) +// - nft_metadata ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/9/schema) +// - cursor ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/10/schema) // - order ($ref: #/components/schemas/orderList) -// - limit ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/11/schema) +// - limit ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/12/schema) export interface GetWalletHistoryOperationRequest { /** @@ -57,6 +58,10 @@ export interface GetWalletHistoryOperationRequest { * @description Set the input data from the result */ readonly includeInputData?: boolean; + /** + * @description Set the logs data from the result + */ + readonly includeLogsData?: boolean; /** * @description If the result should contain the nft metadata. */ @@ -84,6 +89,7 @@ export interface GetWalletHistoryOperationRequestJSON { readonly address: EvmAddressJSON; readonly include_internal_transactions?: boolean; readonly include_input_data?: boolean; + readonly include_logs_data?: boolean; readonly nft_metadata?: boolean; readonly cursor?: string; readonly order?: EvmOrderListJSON; @@ -98,7 +104,7 @@ export const GetWalletHistoryOperation = { groupName: "wallets", httpMethod: "get", routePattern: "/wallets/{address}/history", - parameterNames: ["chain","from_block","to_block","from_date","to_date","address","include_internal_transactions","include_input_data","nft_metadata","cursor","order","limit"], + parameterNames: ["chain","from_block","to_block","from_date","to_date","address","include_internal_transactions","include_input_data","include_logs_data","nft_metadata","cursor","order","limit"], hasResponse: true, hasBody: false, @@ -115,6 +121,7 @@ export const GetWalletHistoryOperation = { const address = EvmAddress.create(request.address); const includeInternalTransactions = request.includeInternalTransactions; const includeInputData = request.includeInputData; + const includeLogsData = request.includeLogsData; const nftMetadata = request.nftMetadata; const cursor = request.cursor; const order = request.order ? EvmOrderList.create(request.order) : undefined; @@ -128,6 +135,7 @@ export const GetWalletHistoryOperation = { address: address.toJSON(), include_internal_transactions: includeInternalTransactions, include_input_data: includeInputData, + include_logs_data: includeLogsData, nft_metadata: nftMetadata, cursor: cursor, order: order ? order : undefined, diff --git a/packages/common/evmUtils/src/generated/operations/index.ts b/packages/common/evmUtils/src/generated/operations/index.ts index 613ca3fbeb..8e73171f22 100644 --- a/packages/common/evmUtils/src/generated/operations/index.ts +++ b/packages/common/evmUtils/src/generated/operations/index.ts @@ -17,6 +17,9 @@ export * from './GetHottestNFTCollectionsByTradingVolumeOperation'; export * from './GetTopCryptoCurrenciesByMarketCapOperation'; export * from './GetTopCryptoCurrenciesByTradingVolumeOperation'; export * from './ReviewContractsOperation'; +export * from './GetDefiSummaryOperation'; +export * from './GetDefiPositionsByProtocolOperation'; +export * from './GetDefiPositionsSummaryOperation'; export * from './GetWalletActiveChainsOperation'; export * from './GetWalletStatsOperation'; export * from './GetNFTCollectionStatsOperation'; diff --git a/packages/common/evmUtils/src/generated/operations/operations.ts b/packages/common/evmUtils/src/generated/operations/operations.ts index adfe0d3f1f..8e3d1fd15c 100644 --- a/packages/common/evmUtils/src/generated/operations/operations.ts +++ b/packages/common/evmUtils/src/generated/operations/operations.ts @@ -17,6 +17,9 @@ import { GetHottestNFTCollectionsByTradingVolumeOperation } from './GetHottestNF import { GetTopCryptoCurrenciesByMarketCapOperation } from './GetTopCryptoCurrenciesByMarketCapOperation'; import { GetTopCryptoCurrenciesByTradingVolumeOperation } from './GetTopCryptoCurrenciesByTradingVolumeOperation'; import { ReviewContractsOperation } from './ReviewContractsOperation'; +import { GetDefiSummaryOperation } from './GetDefiSummaryOperation'; +import { GetDefiPositionsByProtocolOperation } from './GetDefiPositionsByProtocolOperation'; +import { GetDefiPositionsSummaryOperation } from './GetDefiPositionsSummaryOperation'; import { GetWalletActiveChainsOperation } from './GetWalletActiveChainsOperation'; import { GetWalletStatsOperation } from './GetWalletStatsOperation'; import { GetNFTCollectionStatsOperation } from './GetNFTCollectionStatsOperation'; @@ -44,6 +47,9 @@ export const operations = [ GetTopCryptoCurrenciesByMarketCapOperation, GetTopCryptoCurrenciesByTradingVolumeOperation, ReviewContractsOperation, + GetDefiSummaryOperation, + GetDefiPositionsByProtocolOperation, + GetDefiPositionsSummaryOperation, GetWalletActiveChainsOperation, GetWalletStatsOperation, GetNFTCollectionStatsOperation, diff --git a/packages/common/evmUtils/src/generated/types/EvmDefiPositionDetails.ts b/packages/common/evmUtils/src/generated/types/EvmDefiPositionDetails.ts new file mode 100644 index 0000000000..f608b230fc --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmDefiPositionDetails.ts @@ -0,0 +1,275 @@ +import { EvmDefiPositionDetailsNftMetadata, EvmDefiPositionDetailsNftMetadataValue, EvmDefiPositionDetailsNftMetadataInput, EvmDefiPositionDetailsNftMetadataJSON } from '../types/EvmDefiPositionDetailsNftMetadata'; + +// $ref: #/components/schemas/defiPositionDetails +// type: defiPositionDetails +// properties: +// - fee_tier ($ref: #/components/schemas/defiPositionDetails/properties/fee_tier) +// - range_tnd ($ref: #/components/schemas/defiPositionDetails/properties/range_tnd) +// - reserves ($ref: #/components/schemas/defiPositionDetails/properties/reserves) +// - current_price ($ref: #/components/schemas/defiPositionDetails/properties/current_price) +// - is_in_range ($ref: #/components/schemas/defiPositionDetails/properties/is_in_range) +// - price_upper ($ref: #/components/schemas/defiPositionDetails/properties/price_upper) +// - price_lower ($ref: #/components/schemas/defiPositionDetails/properties/price_lower) +// - price_label ($ref: #/components/schemas/defiPositionDetails/properties/price_label) +// - liquidity ($ref: #/components/schemas/defiPositionDetails/properties/liquidity) +// - range_start ($ref: #/components/schemas/defiPositionDetails/properties/range_start) +// - pool_address ($ref: #/components/schemas/defiPositionDetails/properties/pool_address) +// - position_key ($ref: #/components/schemas/defiPositionDetails/properties/position_key) +// - nft_metadata ($ref: #/components/schemas/defiPositionDetails/properties/nft_metadata) +// - asset_standard ($ref: #/components/schemas/defiPositionDetails/properties/asset_standard) +// - apy ($ref: #/components/schemas/defiPositionDetails/properties/apy) +// - is_debt ($ref: #/components/schemas/defiPositionDetails/properties/is_debt) +// - is_variable_debt ($ref: #/components/schemas/defiPositionDetails/properties/is_variable_debt) +// - is_stable_debt ($ref: #/components/schemas/defiPositionDetails/properties/is_stable_debt) +// - shares ($ref: #/components/schemas/defiPositionDetails/properties/shares) +// - reserve0 ($ref: #/components/schemas/defiPositionDetails/properties/reserve0) +// - reserve1 ($ref: #/components/schemas/defiPositionDetails/properties/reserve1) +// - factory ($ref: #/components/schemas/defiPositionDetails/properties/factory) +// - pair ($ref: #/components/schemas/defiPositionDetails/properties/pair) +// - share_of_pool ($ref: #/components/schemas/defiPositionDetails/properties/share_of_pool) + +export interface EvmDefiPositionDetailsJSON { + readonly fee_tier?: number; + readonly range_tnd?: number; + readonly reserves?: string[]; + readonly current_price?: number; + readonly is_in_range?: boolean; + readonly price_upper?: number; + readonly price_lower?: number; + readonly price_label?: string; + readonly liquidity?: number; + readonly range_start?: number; + readonly pool_address?: string; + readonly position_key?: string; + readonly nft_metadata?: EvmDefiPositionDetailsNftMetadataJSON; + readonly asset_standard?: string; + readonly apy?: number; + readonly is_debt?: boolean; + readonly is_variable_debt?: boolean; + readonly is_stable_debt?: boolean; + readonly shares?: string; + readonly reserve0?: string; + readonly reserve1?: string; + readonly factory?: string; + readonly pair?: string; + readonly share_of_pool?: number; +} + +export interface EvmDefiPositionDetailsInput { + readonly feeTier?: number; + readonly rangeTnd?: number; + readonly reserves?: string[]; + readonly currentPrice?: number; + readonly isInRange?: boolean; + readonly priceUpper?: number; + readonly priceLower?: number; + readonly priceLabel?: string; + readonly liquidity?: number; + readonly rangeStart?: number; + readonly poolAddress?: string; + readonly positionKey?: string; + readonly nftMetadata?: EvmDefiPositionDetailsNftMetadataInput | EvmDefiPositionDetailsNftMetadataValue; + readonly assetStandard?: string; + readonly apy?: number; + readonly isDebt?: boolean; + readonly isVariableDebt?: boolean; + readonly isStableDebt?: boolean; + readonly shares?: string; + readonly reserve0?: string; + readonly reserve1?: string; + readonly factory?: string; + readonly pair?: string; + readonly shareOfPool?: number; +} + +export class EvmDefiPositionDetails { + public static create(input: EvmDefiPositionDetailsInput | EvmDefiPositionDetails): EvmDefiPositionDetails { + if (input instanceof EvmDefiPositionDetails) { + return input; + } + return new EvmDefiPositionDetails(input); + } + + public static fromJSON(json: EvmDefiPositionDetailsJSON): EvmDefiPositionDetails { + const input: EvmDefiPositionDetailsInput = { + feeTier: json.fee_tier, + rangeTnd: json.range_tnd, + reserves: json.reserves, + currentPrice: json.current_price, + isInRange: json.is_in_range, + priceUpper: json.price_upper, + priceLower: json.price_lower, + priceLabel: json.price_label, + liquidity: json.liquidity, + rangeStart: json.range_start, + poolAddress: json.pool_address, + positionKey: json.position_key, + nftMetadata: json.nft_metadata ? EvmDefiPositionDetailsNftMetadata.fromJSON(json.nft_metadata) : undefined, + assetStandard: json.asset_standard, + apy: json.apy, + isDebt: json.is_debt, + isVariableDebt: json.is_variable_debt, + isStableDebt: json.is_stable_debt, + shares: json.shares, + reserve0: json.reserve0, + reserve1: json.reserve1, + factory: json.factory, + pair: json.pair, + shareOfPool: json.share_of_pool, + }; + return EvmDefiPositionDetails.create(input); + } + + /** + * @description The fee tier of the position + */ + public readonly feeTier?: number; + /** + * @description The range trend of the position + */ + public readonly rangeTnd?: number; + /** + * @description The reserves of the position + */ + public readonly reserves?: string[]; + /** + * @description The current price of the position + */ + public readonly currentPrice?: number; + /** + * @description Whether the position is in range + */ + public readonly isInRange?: boolean; + /** + * @description The upper price of the range + */ + public readonly priceUpper?: number; + /** + * @description The lower price of the range + */ + public readonly priceLower?: number; + /** + * @description The price label + */ + public readonly priceLabel?: string; + /** + * @description The liquidity of the position + */ + public readonly liquidity?: number; + /** + * @description The start of the range + */ + public readonly rangeStart?: number; + /** + * @description The address of the pool + */ + public readonly poolAddress?: string; + /** + * @description The key of the position + */ + public readonly positionKey?: string; + /** + * @description Metadata of the NFT + */ + public readonly nftMetadata?: EvmDefiPositionDetailsNftMetadataValue; + /** + * @description The standard of the asset + */ + public readonly assetStandard?: string; + /** + * @description The annual percentage yield + */ + public readonly apy?: number; + /** + * @description Whether the position is a debt + */ + public readonly isDebt?: boolean; + /** + * @description Whether the position is a variable debt + */ + public readonly isVariableDebt?: boolean; + /** + * @description Whether the position is a stable debt + */ + public readonly isStableDebt?: boolean; + /** + * @description The shares of the position + */ + public readonly shares?: string; + /** + * @description The first reserve of the position + */ + public readonly reserve0?: string; + /** + * @description The second reserve of the position + */ + public readonly reserve1?: string; + /** + * @description The factory of the position + */ + public readonly factory?: string; + /** + * @description The pair of the position + */ + public readonly pair?: string; + /** + * @description The share of the pool + */ + public readonly shareOfPool?: number; + + private constructor(input: EvmDefiPositionDetailsInput) { + this.feeTier = input.feeTier; + this.rangeTnd = input.rangeTnd; + this.reserves = input.reserves; + this.currentPrice = input.currentPrice; + this.isInRange = input.isInRange; + this.priceUpper = input.priceUpper; + this.priceLower = input.priceLower; + this.priceLabel = input.priceLabel; + this.liquidity = input.liquidity; + this.rangeStart = input.rangeStart; + this.poolAddress = input.poolAddress; + this.positionKey = input.positionKey; + this.nftMetadata = input.nftMetadata ? EvmDefiPositionDetailsNftMetadata.create(input.nftMetadata) : undefined; + this.assetStandard = input.assetStandard; + this.apy = input.apy; + this.isDebt = input.isDebt; + this.isVariableDebt = input.isVariableDebt; + this.isStableDebt = input.isStableDebt; + this.shares = input.shares; + this.reserve0 = input.reserve0; + this.reserve1 = input.reserve1; + this.factory = input.factory; + this.pair = input.pair; + this.shareOfPool = input.shareOfPool; + } + + public toJSON(): EvmDefiPositionDetailsJSON { + return { + fee_tier: this.feeTier, + range_tnd: this.rangeTnd, + reserves: this.reserves, + current_price: this.currentPrice, + is_in_range: this.isInRange, + price_upper: this.priceUpper, + price_lower: this.priceLower, + price_label: this.priceLabel, + liquidity: this.liquidity, + range_start: this.rangeStart, + pool_address: this.poolAddress, + position_key: this.positionKey, + nft_metadata: this.nftMetadata ? this.nftMetadata : undefined, + asset_standard: this.assetStandard, + apy: this.apy, + is_debt: this.isDebt, + is_variable_debt: this.isVariableDebt, + is_stable_debt: this.isStableDebt, + shares: this.shares, + reserve0: this.reserve0, + reserve1: this.reserve1, + factory: this.factory, + pair: this.pair, + share_of_pool: this.shareOfPool, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmDefiPositionDetailsNftMetadata.ts b/packages/common/evmUtils/src/generated/types/EvmDefiPositionDetailsNftMetadata.ts new file mode 100644 index 0000000000..68df216f1a --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmDefiPositionDetailsNftMetadata.ts @@ -0,0 +1,16 @@ +// $ref: #/components/schemas/defiPositionDetails/properties/nft_metadata +// typeName: defiPositionDetails_nft_metadata + +export type EvmDefiPositionDetailsNftMetadataJSON = object; +export type EvmDefiPositionDetailsNftMetadataInput = object; +export type EvmDefiPositionDetailsNftMetadataValue = object; + +export abstract class EvmDefiPositionDetailsNftMetadata { + public static create(input: EvmDefiPositionDetailsNftMetadataInput | EvmDefiPositionDetailsNftMetadataValue): EvmDefiPositionDetailsNftMetadataValue { + return input; + } + + public static fromJSON(json: EvmDefiPositionDetailsNftMetadataJSON): EvmDefiPositionDetailsNftMetadataValue { + return json; + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmDefiPositionSummaryResponse.ts b/packages/common/evmUtils/src/generated/types/EvmDefiPositionSummaryResponse.ts new file mode 100644 index 0000000000..0bbe539bf0 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmDefiPositionSummaryResponse.ts @@ -0,0 +1,85 @@ +import { EvmDefiProtocolPosition, EvmDefiProtocolPositionInput, EvmDefiProtocolPositionJSON } from '../types/EvmDefiProtocolPosition'; + +// $ref: #/components/schemas/defiPositionSummaryResponse +// type: defiPositionSummaryResponse +// properties: +// - protocol_name ($ref: #/components/schemas/defiPositionSummaryResponse/properties/protocol_name) +// - protocol_id ($ref: #/components/schemas/defiPositionSummaryResponse/properties/protocol_id) +// - protocol_url ($ref: #/components/schemas/defiPositionSummaryResponse/properties/protocol_url) +// - protocol_logo ($ref: #/components/schemas/defiPositionSummaryResponse/properties/protocol_logo) +// - position ($ref: #/components/schemas/defiProtocolPosition) + +export interface EvmDefiPositionSummaryResponseJSON { + readonly protocol_name?: string; + readonly protocol_id?: string; + readonly protocol_url?: string; + readonly protocol_logo?: string; + readonly position?: EvmDefiProtocolPositionJSON; +} + +export interface EvmDefiPositionSummaryResponseInput { + readonly protocolName?: string; + readonly protocolId?: string; + readonly protocolUrl?: string; + readonly protocolLogo?: string; + readonly position?: EvmDefiProtocolPositionInput | EvmDefiProtocolPosition; +} + +export class EvmDefiPositionSummaryResponse { + public static create(input: EvmDefiPositionSummaryResponseInput | EvmDefiPositionSummaryResponse): EvmDefiPositionSummaryResponse { + if (input instanceof EvmDefiPositionSummaryResponse) { + return input; + } + return new EvmDefiPositionSummaryResponse(input); + } + + public static fromJSON(json: EvmDefiPositionSummaryResponseJSON): EvmDefiPositionSummaryResponse { + const input: EvmDefiPositionSummaryResponseInput = { + protocolName: json.protocol_name, + protocolId: json.protocol_id, + protocolUrl: json.protocol_url, + protocolLogo: json.protocol_logo, + position: json.position ? EvmDefiProtocolPosition.fromJSON(json.position) : undefined, + }; + return EvmDefiPositionSummaryResponse.create(input); + } + + /** + * @description The name of the protocol + */ + public readonly protocolName?: string; + /** + * @description The id of the protocol + */ + public readonly protocolId?: string; + /** + * @description The url of the protocol + */ + public readonly protocolUrl?: string; + /** + * @description The logo of the protocol + */ + public readonly protocolLogo?: string; + /** + * @description The position of the protocol + */ + public readonly position?: EvmDefiProtocolPosition; + + private constructor(input: EvmDefiPositionSummaryResponseInput) { + this.protocolName = input.protocolName; + this.protocolId = input.protocolId; + this.protocolUrl = input.protocolUrl; + this.protocolLogo = input.protocolLogo; + this.position = input.position ? EvmDefiProtocolPosition.create(input.position) : undefined; + } + + public toJSON(): EvmDefiPositionSummaryResponseJSON { + return { + protocol_name: this.protocolName, + protocol_id: this.protocolId, + protocol_url: this.protocolUrl, + protocol_logo: this.protocolLogo, + position: this.position ? this.position.toJSON() : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmDefiProtocolBalance.ts b/packages/common/evmUtils/src/generated/types/EvmDefiProtocolBalance.ts new file mode 100644 index 0000000000..31a06d5a4d --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmDefiProtocolBalance.ts @@ -0,0 +1,63 @@ +// $ref: #/components/schemas/defiProtocolBalance +// type: defiProtocolBalance +// properties: +// - total_usd_value ($ref: #/components/schemas/defiProtocolBalance/properties/total_usd_value) +// - total_unclaimed_usd_value ($ref: #/components/schemas/defiProtocolBalance/properties/total_unclaimed_usd_value) +// - positions ($ref: #/components/schemas/defiProtocolBalance/properties/positions) + +export interface EvmDefiProtocolBalanceJSON { + readonly total_usd_value: number; + readonly total_unclaimed_usd_value?: number; + readonly positions: number; +} + +export interface EvmDefiProtocolBalanceInput { + readonly totalUsdValue: number; + readonly totalUnclaimedUsdValue?: number; + readonly positions: number; +} + +export class EvmDefiProtocolBalance { + public static create(input: EvmDefiProtocolBalanceInput | EvmDefiProtocolBalance): EvmDefiProtocolBalance { + if (input instanceof EvmDefiProtocolBalance) { + return input; + } + return new EvmDefiProtocolBalance(input); + } + + public static fromJSON(json: EvmDefiProtocolBalanceJSON): EvmDefiProtocolBalance { + const input: EvmDefiProtocolBalanceInput = { + totalUsdValue: json.total_usd_value, + totalUnclaimedUsdValue: json.total_unclaimed_usd_value, + positions: json.positions, + }; + return EvmDefiProtocolBalance.create(input); + } + + /** + * @description The total USD value of the protocol + */ + public readonly totalUsdValue: number; + /** + * @description The total unclaimed USD value of the protocol + */ + public readonly totalUnclaimedUsdValue?: number; + /** + * @description The number of positions + */ + public readonly positions: number; + + private constructor(input: EvmDefiProtocolBalanceInput) { + this.totalUsdValue = input.totalUsdValue; + this.totalUnclaimedUsdValue = input.totalUnclaimedUsdValue; + this.positions = input.positions; + } + + public toJSON(): EvmDefiProtocolBalanceJSON { + return { + total_usd_value: this.totalUsdValue, + total_unclaimed_usd_value: this.totalUnclaimedUsdValue, + positions: this.positions, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmDefiProtocolList.ts b/packages/common/evmUtils/src/generated/types/EvmDefiProtocolList.ts new file mode 100644 index 0000000000..8d3f8caf53 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmDefiProtocolList.ts @@ -0,0 +1,16 @@ +// $ref: #/components/schemas/defiProtocolList +// typeName: defiProtocolList + +export type EvmDefiProtocolListJSON = "uniswap-v2" | "uniswap-v3" | "pancakeswap-v2" | "pancakeswap-v3" | "quickswap-v2" | "sushiswap-v2" | "aave-v2" | "aave-v3" | "fraxswap-v1" | "fraxswap-v2" | "lido" | "makerdao"; +export type EvmDefiProtocolListInput = "uniswap-v2" | "uniswap-v3" | "pancakeswap-v2" | "pancakeswap-v3" | "quickswap-v2" | "sushiswap-v2" | "aave-v2" | "aave-v3" | "fraxswap-v1" | "fraxswap-v2" | "lido" | "makerdao"; +export type EvmDefiProtocolListValue = "uniswap-v2" | "uniswap-v3" | "pancakeswap-v2" | "pancakeswap-v3" | "quickswap-v2" | "sushiswap-v2" | "aave-v2" | "aave-v3" | "fraxswap-v1" | "fraxswap-v2" | "lido" | "makerdao"; + +export abstract class EvmDefiProtocolList { + public static create(input: EvmDefiProtocolListInput | EvmDefiProtocolListValue): EvmDefiProtocolListValue { + return input; + } + + public static fromJSON(json: EvmDefiProtocolListJSON): EvmDefiProtocolListValue { + return json; + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmDefiProtocolPosition.ts b/packages/common/evmUtils/src/generated/types/EvmDefiProtocolPosition.ts new file mode 100644 index 0000000000..a876d1cbe8 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmDefiProtocolPosition.ts @@ -0,0 +1,94 @@ +import { EvmDefiTokenBalance, EvmDefiTokenBalanceInput, EvmDefiTokenBalanceJSON } from '../types/EvmDefiTokenBalance'; +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmDefiPositionDetails, EvmDefiPositionDetailsInput, EvmDefiPositionDetailsJSON } from '../types/EvmDefiPositionDetails'; + +// $ref: #/components/schemas/defiProtocolPosition +// type: defiProtocolPosition +// properties: +// - label ($ref: #/components/schemas/defiProtocolPosition/properties/label) +// - tokens ($ref: #/components/schemas/defiTokenBalance) +// - address ($ref: #/components/schemas/defiProtocolPosition/properties/address) +// - balance_usd ($ref: #/components/schemas/defiProtocolPosition/properties/balance_usd) +// - total_unclaimed_usd_value ($ref: #/components/schemas/defiProtocolPosition/properties/total_unclaimed_usd_value) +// - position_details ($ref: #/components/schemas/defiPositionDetails) + +export interface EvmDefiProtocolPositionJSON { + readonly label: string; + readonly tokens: EvmDefiTokenBalanceJSON[]; + readonly address?: EvmAddressJSON; + readonly balance_usd: number; + readonly total_unclaimed_usd_value: number; + readonly position_details?: EvmDefiPositionDetailsJSON; +} + +export interface EvmDefiProtocolPositionInput { + readonly label: string; + readonly tokens: EvmDefiTokenBalanceInput[] | EvmDefiTokenBalance[]; + readonly address?: EvmAddressInput | EvmAddress; + readonly balanceUsd: number; + readonly totalUnclaimedUsdValue: number; + readonly positionDetails?: EvmDefiPositionDetailsInput | EvmDefiPositionDetails; +} + +export class EvmDefiProtocolPosition { + public static create(input: EvmDefiProtocolPositionInput | EvmDefiProtocolPosition): EvmDefiProtocolPosition { + if (input instanceof EvmDefiProtocolPosition) { + return input; + } + return new EvmDefiProtocolPosition(input); + } + + public static fromJSON(json: EvmDefiProtocolPositionJSON): EvmDefiProtocolPosition { + const input: EvmDefiProtocolPositionInput = { + label: json.label, + tokens: json.tokens.map((item) => EvmDefiTokenBalance.fromJSON(item)), + address: json.address ? EvmAddress.fromJSON(json.address) : undefined, + balanceUsd: json.balance_usd, + totalUnclaimedUsdValue: json.total_unclaimed_usd_value, + positionDetails: json.position_details ? EvmDefiPositionDetails.fromJSON(json.position_details) : undefined, + }; + return EvmDefiProtocolPosition.create(input); + } + + /** + * @description The label of the position + */ + public readonly label: string; + public readonly tokens: EvmDefiTokenBalance[]; + /** + * @description The address of the position + */ + public readonly address?: EvmAddress; + /** + * @description The balance in USD + */ + public readonly balanceUsd: number; + /** + * @description The total unclaimed USD value of the position + */ + public readonly totalUnclaimedUsdValue: number; + /** + * @description The details of the position + */ + public readonly positionDetails?: EvmDefiPositionDetails; + + private constructor(input: EvmDefiProtocolPositionInput) { + this.label = input.label; + this.tokens = input.tokens.map((item) => EvmDefiTokenBalance.create(item)); + this.address = input.address ? EvmAddress.create(input.address) : undefined; + this.balanceUsd = input.balanceUsd; + this.totalUnclaimedUsdValue = input.totalUnclaimedUsdValue; + this.positionDetails = input.positionDetails ? EvmDefiPositionDetails.create(input.positionDetails) : undefined; + } + + public toJSON(): EvmDefiProtocolPositionJSON { + return { + label: this.label, + tokens: this.tokens.map((item) => item.toJSON()), + address: this.address ? this.address.toJSON() : undefined, + balance_usd: this.balanceUsd, + total_unclaimed_usd_value: this.totalUnclaimedUsdValue, + position_details: this.positionDetails ? this.positionDetails.toJSON() : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmDefiTokenBalance.ts b/packages/common/evmUtils/src/generated/types/EvmDefiTokenBalance.ts new file mode 100644 index 0000000000..6d67674ec4 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmDefiTokenBalance.ts @@ -0,0 +1,145 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/defiTokenBalance +// type: defiTokenBalance +// properties: +// - token_type ($ref: #/components/schemas/defiTokenBalance/properties/token_type) +// - name ($ref: #/components/schemas/defiTokenBalance/properties/name) +// - symbol ($ref: #/components/schemas/defiTokenBalance/properties/symbol) +// - contract_address ($ref: #/components/schemas/defiTokenBalance/properties/contract_address) +// - decimals ($ref: #/components/schemas/defiTokenBalance/properties/decimals) +// - logo ($ref: #/components/schemas/defiTokenBalance/properties/logo) +// - thumbnail ($ref: #/components/schemas/defiTokenBalance/properties/thumbnail) +// - balance ($ref: #/components/schemas/defiTokenBalance/properties/balance) +// - balance_formatted ($ref: #/components/schemas/defiTokenBalance/properties/balance_formatted) +// - usd_price ($ref: #/components/schemas/defiTokenBalance/properties/usd_price) +// - usd_value ($ref: #/components/schemas/defiTokenBalance/properties/usd_value) + +export interface EvmDefiTokenBalanceJSON { + readonly token_type: string; + readonly name: string; + readonly symbol: string; + readonly contract_address: EvmAddressJSON; + readonly decimals: number; + readonly logo?: string; + readonly thumbnail?: string; + readonly balance: string; + readonly balance_formatted: string; + readonly usd_price?: number; + readonly usd_value?: number; +} + +export interface EvmDefiTokenBalanceInput { + readonly tokenType: string; + readonly name: string; + readonly symbol: string; + readonly contractAddress: EvmAddressInput | EvmAddress; + readonly decimals: number; + readonly logo?: string; + readonly thumbnail?: string; + readonly balance: string; + readonly balanceFormatted: string; + readonly usdPrice?: number; + readonly usdValue?: number; +} + +export class EvmDefiTokenBalance { + public static create(input: EvmDefiTokenBalanceInput | EvmDefiTokenBalance): EvmDefiTokenBalance { + if (input instanceof EvmDefiTokenBalance) { + return input; + } + return new EvmDefiTokenBalance(input); + } + + public static fromJSON(json: EvmDefiTokenBalanceJSON): EvmDefiTokenBalance { + const input: EvmDefiTokenBalanceInput = { + tokenType: json.token_type, + name: json.name, + symbol: json.symbol, + contractAddress: EvmAddress.fromJSON(json.contract_address), + decimals: json.decimals, + logo: json.logo, + thumbnail: json.thumbnail, + balance: json.balance, + balanceFormatted: json.balance_formatted, + usdPrice: json.usd_price, + usdValue: json.usd_value, + }; + return EvmDefiTokenBalance.create(input); + } + + /** + * @description The token type (supply/defi/borrow token) + */ + public readonly tokenType: string; + /** + * @description The name of the token + */ + public readonly name: string; + /** + * @description The symbol of the token + */ + public readonly symbol: string; + /** + * @description The contract address + */ + public readonly contractAddress: EvmAddress; + /** + * @description The decimals of the token + */ + public readonly decimals: number; + /** + * @description The logo of the token + */ + public readonly logo?: string; + /** + * @description The thumbnail of the token + */ + public readonly thumbnail?: string; + /** + * @description The balance of the token + */ + public readonly balance: string; + /** + * @description The balance of the token formatted + */ + public readonly balanceFormatted: string; + /** + * @description The USD price of the token + */ + public readonly usdPrice?: number; + /** + * @description The USD value of the token + */ + public readonly usdValue?: number; + + private constructor(input: EvmDefiTokenBalanceInput) { + this.tokenType = input.tokenType; + this.name = input.name; + this.symbol = input.symbol; + this.contractAddress = EvmAddress.create(input.contractAddress); + this.decimals = input.decimals; + this.logo = input.logo; + this.thumbnail = input.thumbnail; + this.balance = input.balance; + this.balanceFormatted = input.balanceFormatted; + this.usdPrice = input.usdPrice; + this.usdValue = input.usdValue; + } + + public toJSON(): EvmDefiTokenBalanceJSON { + return { + token_type: this.tokenType, + name: this.name, + symbol: this.symbol, + contract_address: this.contractAddress.toJSON(), + decimals: this.decimals, + logo: this.logo, + thumbnail: this.thumbnail, + balance: this.balance, + balance_formatted: this.balanceFormatted, + usd_price: this.usdPrice, + usd_value: this.usdValue, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmGetDefiPositionsByProtocol.ts b/packages/common/evmUtils/src/generated/types/EvmGetDefiPositionsByProtocol.ts new file mode 100644 index 0000000000..8cb6c10e23 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmGetDefiPositionsByProtocol.ts @@ -0,0 +1,96 @@ +import { EvmDefiProtocolPosition, EvmDefiProtocolPositionInput, EvmDefiProtocolPositionJSON } from '../types/EvmDefiProtocolPosition'; + +// $ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/responses/200/content/application~1json/schema +// type: getDefiPositionsByProtocol +// properties: +// - protocol_name ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/responses/200/content/application~1json/schema/properties/protocol_name) +// - protocol_id ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/responses/200/content/application~1json/schema/properties/protocol_id) +// - protocol_url ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/responses/200/content/application~1json/schema/properties/protocol_url) +// - protocol_logo ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/responses/200/content/application~1json/schema/properties/protocol_logo) +// - total_usd_value ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/responses/200/content/application~1json/schema/properties/total_usd_value) +// - total_unclaimed_usd_value ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/responses/200/content/application~1json/schema/properties/total_unclaimed_usd_value) +// - positions ($ref: #/components/schemas/defiProtocolPosition) + +export interface EvmGetDefiPositionsByProtocolJSON { + readonly protocol_name?: string; + readonly protocol_id?: string; + readonly protocol_url?: string; + readonly protocol_logo?: string; + readonly total_usd_value?: number; + readonly total_unclaimed_usd_value?: number; + readonly positions?: EvmDefiProtocolPositionJSON[]; +} + +export interface EvmGetDefiPositionsByProtocolInput { + readonly protocolName?: string; + readonly protocolId?: string; + readonly protocolUrl?: string; + readonly protocolLogo?: string; + readonly totalUsdValue?: number; + readonly totalUnclaimedUsdValue?: number; + readonly positions?: EvmDefiProtocolPositionInput[] | EvmDefiProtocolPosition[]; +} + +export class EvmGetDefiPositionsByProtocol { + public static create(input: EvmGetDefiPositionsByProtocolInput | EvmGetDefiPositionsByProtocol): EvmGetDefiPositionsByProtocol { + if (input instanceof EvmGetDefiPositionsByProtocol) { + return input; + } + return new EvmGetDefiPositionsByProtocol(input); + } + + public static fromJSON(json: EvmGetDefiPositionsByProtocolJSON): EvmGetDefiPositionsByProtocol { + const input: EvmGetDefiPositionsByProtocolInput = { + protocolName: json.protocol_name, + protocolId: json.protocol_id, + protocolUrl: json.protocol_url, + protocolLogo: json.protocol_logo, + totalUsdValue: json.total_usd_value, + totalUnclaimedUsdValue: json.total_unclaimed_usd_value, + positions: json.positions ? json.positions.map((item) => EvmDefiProtocolPosition.fromJSON(item)) : undefined, + }; + return EvmGetDefiPositionsByProtocol.create(input); + } + + /** + * @description The name of the protocol + */ + public readonly protocolName?: string; + /** + * @description The id of the protocol + */ + public readonly protocolId?: string; + /** + * @description The url of the protocol + */ + public readonly protocolUrl?: string; + /** + * @description The logo of the protocol + */ + public readonly protocolLogo?: string; + public readonly totalUsdValue?: number; + public readonly totalUnclaimedUsdValue?: number; + public readonly positions?: EvmDefiProtocolPosition[]; + + private constructor(input: EvmGetDefiPositionsByProtocolInput) { + this.protocolName = input.protocolName; + this.protocolId = input.protocolId; + this.protocolUrl = input.protocolUrl; + this.protocolLogo = input.protocolLogo; + this.totalUsdValue = input.totalUsdValue; + this.totalUnclaimedUsdValue = input.totalUnclaimedUsdValue; + this.positions = input.positions ? input.positions.map((item) => EvmDefiProtocolPosition.create(item)) : undefined; + } + + public toJSON(): EvmGetDefiPositionsByProtocolJSON { + return { + protocol_name: this.protocolName, + protocol_id: this.protocolId, + protocol_url: this.protocolUrl, + protocol_logo: this.protocolLogo, + total_usd_value: this.totalUsdValue, + total_unclaimed_usd_value: this.totalUnclaimedUsdValue, + positions: this.positions ? this.positions.map((item) => item.toJSON()) : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmLog.ts b/packages/common/evmUtils/src/generated/types/EvmLog.ts new file mode 100644 index 0000000000..a6739d51bb --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmLog.ts @@ -0,0 +1,138 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { BigNumber, BigNumberInput, BigNumberJSON } from '@moralisweb3/common-core'; + +// $ref: #/components/schemas/log +// type: log +// properties: +// - log_index ($ref: #/components/schemas/log/properties/log_index) +// - transaction_hash ($ref: #/components/schemas/log/properties/transaction_hash) +// - transaction_index ($ref: #/components/schemas/log/properties/transaction_index) +// - address ($ref: #/components/schemas/log/properties/address) +// - data ($ref: #/components/schemas/log/properties/data) +// - topic0 ($ref: #/components/schemas/log/properties/topic0) +// - topic1 ($ref: #/components/schemas/log/properties/topic1) +// - topic2 ($ref: #/components/schemas/log/properties/topic2) +// - topic3 ($ref: #/components/schemas/log/properties/topic3) +// - block_timestamp ($ref: #/components/schemas/log/properties/block_timestamp) +// - block_number ($ref: #/components/schemas/log/properties/block_number) +// - block_hash ($ref: #/components/schemas/log/properties/block_hash) + +export interface EvmLogJSON { + readonly log_index: string; + readonly transaction_hash: string; + readonly transaction_index: string; + readonly address: EvmAddressJSON; + readonly data: string; + readonly topic0: string; + readonly topic1?: string; + readonly topic2?: string; + readonly topic3?: string; + readonly block_timestamp: string; + readonly block_number: BigNumberJSON; + readonly block_hash: string; +} + +export interface EvmLogInput { + readonly logIndex: number; + readonly transactionHash: string; + readonly transactionIndex: number; + readonly address: EvmAddressInput | EvmAddress; + readonly data: string; + readonly topic0: string; + readonly topic1?: string; + readonly topic2?: string; + readonly topic3?: string; + readonly blockTimestamp: string; + readonly blockNumber: BigNumberInput | BigNumber; + readonly blockHash: string; +} + +export class EvmLog { + public static create(input: EvmLogInput | EvmLog): EvmLog { + if (input instanceof EvmLog) { + return input; + } + return new EvmLog(input); + } + + public static fromJSON(json: EvmLogJSON): EvmLog { + const input: EvmLogInput = { + logIndex: Number(json.log_index), + transactionHash: json.transaction_hash, + transactionIndex: Number(json.transaction_index), + address: EvmAddress.fromJSON(json.address), + data: json.data, + topic0: json.topic0, + topic1: json.topic1, + topic2: json.topic2, + topic3: json.topic3, + blockTimestamp: json.block_timestamp, + blockNumber: BigNumber.fromJSON(json.block_number), + blockHash: json.block_hash, + }; + return EvmLog.create(input); + } + + public readonly logIndex: number; + /** + * @description The hash of the transaction + */ + public readonly transactionHash: string; + public readonly transactionIndex: number; + /** + * @description The address of the contract + */ + public readonly address: EvmAddress; + /** + * @description The data of the log + */ + public readonly data: string; + public readonly topic0: string; + public readonly topic1?: string; + public readonly topic2?: string; + public readonly topic3?: string; + /** + * @description The timestamp of the block + */ + public readonly blockTimestamp: string; + /** + * @description The block number + */ + public readonly blockNumber: BigNumber; + /** + * @description The hash of the block + */ + public readonly blockHash: string; + + private constructor(input: EvmLogInput) { + this.logIndex = input.logIndex; + this.transactionHash = input.transactionHash; + this.transactionIndex = input.transactionIndex; + this.address = EvmAddress.create(input.address); + this.data = input.data; + this.topic0 = input.topic0; + this.topic1 = input.topic1; + this.topic2 = input.topic2; + this.topic3 = input.topic3; + this.blockTimestamp = input.blockTimestamp; + this.blockNumber = BigNumber.create(input.blockNumber); + this.blockHash = input.blockHash; + } + + public toJSON(): EvmLogJSON { + return { + log_index: String(this.logIndex), + transaction_hash: this.transactionHash, + transaction_index: String(this.transactionIndex), + address: this.address.toJSON(), + data: this.data, + topic0: this.topic0, + topic1: this.topic1, + topic2: this.topic2, + topic3: this.topic3, + block_timestamp: this.blockTimestamp, + block_number: this.blockNumber.toJSON(), + block_hash: this.blockHash, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletDefiSummary.ts b/packages/common/evmUtils/src/generated/types/EvmWalletDefiSummary.ts new file mode 100644 index 0000000000..77f4a94e42 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmWalletDefiSummary.ts @@ -0,0 +1,82 @@ +import { EvmDefiProtocolBalance, EvmDefiProtocolBalanceInput, EvmDefiProtocolBalanceJSON } from '../types/EvmDefiProtocolBalance'; + +// $ref: #/components/schemas/walletDefiSummary +// type: walletDefiSummary +// properties: +// - active_protocols ($ref: #/components/schemas/walletDefiSummary/properties/active_protocols) +// - total_positions ($ref: #/components/schemas/walletDefiSummary/properties/total_positions) +// - total_usd_value ($ref: #/components/schemas/walletDefiSummary/properties/total_usd_value) +// - total_unclaimed_usd_value ($ref: #/components/schemas/walletDefiSummary/properties/total_unclaimed_usd_value) +// - protocols ($ref: #/components/schemas/defiProtocolBalance) + +export interface EvmWalletDefiSummaryJSON { + readonly active_protocols: number; + readonly total_positions: number; + readonly total_usd_value: number; + readonly total_unclaimed_usd_value?: number; + readonly protocols: EvmDefiProtocolBalanceJSON[]; +} + +export interface EvmWalletDefiSummaryInput { + readonly activeProtocols: number; + readonly totalPositions: number; + readonly totalUsdValue: number; + readonly totalUnclaimedUsdValue?: number; + readonly protocols: EvmDefiProtocolBalanceInput[] | EvmDefiProtocolBalance[]; +} + +export class EvmWalletDefiSummary { + public static create(input: EvmWalletDefiSummaryInput | EvmWalletDefiSummary): EvmWalletDefiSummary { + if (input instanceof EvmWalletDefiSummary) { + return input; + } + return new EvmWalletDefiSummary(input); + } + + public static fromJSON(json: EvmWalletDefiSummaryJSON): EvmWalletDefiSummary { + const input: EvmWalletDefiSummaryInput = { + activeProtocols: json.active_protocols, + totalPositions: json.total_positions, + totalUsdValue: json.total_usd_value, + totalUnclaimedUsdValue: json.total_unclaimed_usd_value, + protocols: json.protocols.map((item) => EvmDefiProtocolBalance.fromJSON(item)), + }; + return EvmWalletDefiSummary.create(input); + } + + /** + * @description The number of active protocols + */ + public readonly activeProtocols: number; + /** + * @description The number of total positions + */ + public readonly totalPositions: number; + /** + * @description The total USD value of the wallet + */ + public readonly totalUsdValue: number; + /** + * @description The total unclaimed USD value of the wallet + */ + public readonly totalUnclaimedUsdValue?: number; + public readonly protocols: EvmDefiProtocolBalance[]; + + private constructor(input: EvmWalletDefiSummaryInput) { + this.activeProtocols = input.activeProtocols; + this.totalPositions = input.totalPositions; + this.totalUsdValue = input.totalUsdValue; + this.totalUnclaimedUsdValue = input.totalUnclaimedUsdValue; + this.protocols = input.protocols.map((item) => EvmDefiProtocolBalance.create(item)); + } + + public toJSON(): EvmWalletDefiSummaryJSON { + return { + active_protocols: this.activeProtocols, + total_positions: this.totalPositions, + total_usd_value: this.totalUsdValue, + total_unclaimed_usd_value: this.totalUnclaimedUsdValue, + protocols: this.protocols.map((item) => item.toJSON()), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts index 2e7a608dfe..4791b12a0f 100644 --- a/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts +++ b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts @@ -4,6 +4,7 @@ import { EvmETransactionCategory, EvmETransactionCategoryValue, EvmETransactionC import { EvmWalletHistoryNftTransfer, EvmWalletHistoryNftTransferInput, EvmWalletHistoryNftTransferJSON } from '../types/EvmWalletHistoryNftTransfer'; import { EvmWalletHistoryErc20Transfer, EvmWalletHistoryErc20TransferInput, EvmWalletHistoryErc20TransferJSON } from '../types/EvmWalletHistoryErc20Transfer'; import { EvmNativeTransfer, EvmNativeTransferInput, EvmNativeTransferJSON } from '../types/EvmNativeTransfer'; +import { EvmLog, EvmLogInput, EvmLogJSON } from '../types/EvmLog'; // $ref: #/components/schemas/walletHistoryTransaction // type: walletHistoryTransaction @@ -34,6 +35,7 @@ import { EvmNativeTransfer, EvmNativeTransferInput, EvmNativeTransferJSON } from // - nft_transfers ($ref: #/components/schemas/walletHistoryNftTransfer) // - erc20_transfers ($ref: #/components/schemas/walletHistoryErc20Transfer) // - native_transfers ($ref: #/components/schemas/native_transfer) +// - logs ($ref: #/components/schemas/log) export interface EvmWalletHistoryTransactionJSON { readonly hash: string; @@ -62,6 +64,7 @@ export interface EvmWalletHistoryTransactionJSON { readonly nft_transfers: EvmWalletHistoryNftTransferJSON[]; readonly erc20_transfers: EvmWalletHistoryErc20TransferJSON[]; readonly native_transfers: EvmNativeTransferJSON[]; + readonly logs?: EvmLogJSON[]; } export interface EvmWalletHistoryTransactionInput { @@ -91,6 +94,7 @@ export interface EvmWalletHistoryTransactionInput { readonly nftTransfers: EvmWalletHistoryNftTransferInput[] | EvmWalletHistoryNftTransfer[]; readonly erc20Transfers: EvmWalletHistoryErc20TransferInput[] | EvmWalletHistoryErc20Transfer[]; readonly nativeTransfers: EvmNativeTransferInput[] | EvmNativeTransfer[]; + readonly logs?: EvmLogInput[] | EvmLog[]; } export class EvmWalletHistoryTransaction { @@ -129,6 +133,7 @@ export class EvmWalletHistoryTransaction { nftTransfers: json.nft_transfers.map((item) => EvmWalletHistoryNftTransfer.fromJSON(item)), erc20Transfers: json.erc20_transfers.map((item) => EvmWalletHistoryErc20Transfer.fromJSON(item)), nativeTransfers: json.native_transfers.map((item) => EvmNativeTransfer.fromJSON(item)), + logs: json.logs ? json.logs.map((item) => EvmLog.fromJSON(item)) : undefined, }; return EvmWalletHistoryTransaction.create(input); } @@ -204,6 +209,7 @@ export class EvmWalletHistoryTransaction { public readonly nftTransfers: EvmWalletHistoryNftTransfer[]; public readonly erc20Transfers: EvmWalletHistoryErc20Transfer[]; public readonly nativeTransfers: EvmNativeTransfer[]; + public readonly logs?: EvmLog[]; private constructor(input: EvmWalletHistoryTransactionInput) { this.hash = input.hash; @@ -232,6 +238,7 @@ export class EvmWalletHistoryTransaction { this.nftTransfers = input.nftTransfers.map((item) => EvmWalletHistoryNftTransfer.create(item)); this.erc20Transfers = input.erc20Transfers.map((item) => EvmWalletHistoryErc20Transfer.create(item)); this.nativeTransfers = input.nativeTransfers.map((item) => EvmNativeTransfer.create(item)); + this.logs = input.logs ? input.logs.map((item) => EvmLog.create(item)) : undefined; } public toJSON(): EvmWalletHistoryTransactionJSON { @@ -262,6 +269,7 @@ export class EvmWalletHistoryTransaction { nft_transfers: this.nftTransfers.map((item) => item.toJSON()), erc20_transfers: this.erc20Transfers.map((item) => item.toJSON()), native_transfers: this.nativeTransfers.map((item) => item.toJSON()), + logs: this.logs ? this.logs.map((item) => item.toJSON()) : undefined, } } } diff --git a/packages/common/evmUtils/src/generated/types/index.ts b/packages/common/evmUtils/src/generated/types/index.ts index 7feb5435bd..d74534c250 100644 --- a/packages/common/evmUtils/src/generated/types/index.ts +++ b/packages/common/evmUtils/src/generated/types/index.ts @@ -4,10 +4,12 @@ export * from './EvmChainList'; export * from './EvmGetMultipleTokenPricesIncludeEnum'; export * from './EvmOrderList'; export * from './EvmResolveAddressToDomainCurrencyEnum'; +export * from './EvmDefiProtocolList'; export * from './EvmETransactionCategory'; export * from './EvmErc20MetadataLinks'; export * from './EvmContractsReviewItemReportTypeEnum'; export * from './EvmContractsReviewItemContractTypeEnum'; +export * from './EvmDefiPositionDetailsNftMetadata'; export * from './EvmNormalizedMetadataAttributeValue'; export * from './EvmTradeCollection'; export * from './EvmSoldPrice'; @@ -28,6 +30,9 @@ export * from './EvmMarketDataHottestNFTCollectionByTradingVolumeItem'; export * from './EvmMarketDataTopCryptoCurrenciesByMarketCapItem'; export * from './EvmReviewContracts'; export * from './EvmContractsReviewDto'; +export * from './EvmWalletDefiSummary'; +export * from './EvmGetDefiPositionsByProtocol'; +export * from './EvmDefiPositionSummaryResponse'; export * from './EvmWalletActiveChains'; export * from './EvmWalletStat'; export * from './EvmNftCollectionStat'; @@ -47,6 +52,8 @@ export * from './EvmErc20TokenBalanceWithPrice'; export * from './EvmChainNetWorth'; export * from './EvmErc20Metadata'; export * from './EvmContractsReviewItem'; +export * from './EvmDefiProtocolBalance'; +export * from './EvmDefiProtocolPosition'; export * from './EvmWalletActiveChain'; export * from './EvmWalletStatTransactions'; export * from './EvmWalletStatNftTransfers'; @@ -64,6 +71,9 @@ export * from './EvmSoldPriceHighestSalePaymentToken'; export * from './EvmWalletHistoryNftTransfer'; export * from './EvmWalletHistoryErc20Transfer'; export * from './EvmNativeTransfer'; +export * from './EvmLog'; +export * from './EvmDefiTokenBalance'; +export * from './EvmDefiPositionDetails'; export * from './EvmTransactionTimestamp'; export * from './EvmNormalizedMetadata'; export * from './EvmNormalizedMetadataAttribute'; diff --git a/packages/evmApi/src/generated/ClientEvmApi.ts b/packages/evmApi/src/generated/ClientEvmApi.ts index a6ab7b40f1..8d87032497 100644 --- a/packages/evmApi/src/generated/ClientEvmApi.ts +++ b/packages/evmApi/src/generated/ClientEvmApi.ts @@ -1,6 +1,6 @@ // CAUTION: This file is automatically generated. Do not edit it manually! -import { getBlockOperation, GetBlockRequest, GetBlockResponseAdapter, getDateToBlockOperation, GetDateToBlockRequest, GetDateToBlockResponseAdapter, GetBlockStatsOperationResponseJSON, GetBlockStatsOperation, GetBlockStatsOperationRequest, GetBlockStatsOperationResponse, getContractEventsOperation, GetContractEventsRequest, GetContractEventsResponseAdapter, getContractLogsOperation, GetContractLogsRequest, GetContractLogsResponseAdapter, getContractNFTsOperation, GetContractNFTsRequest, GetContractNFTsResponseAdapter, getMultipleNFTsOperation, GetMultipleNFTsRequest, GetMultipleNFTsResponseAdapter, getNFTContractMetadataOperation, GetNFTContractMetadataRequest, GetNFTContractMetadataResponseAdapter, getNFTContractTransfersOperation, GetNFTContractTransfersRequest, GetNFTContractTransfersResponseAdapter, getNFTLowestPriceOperation, GetNFTLowestPriceRequest, GetNFTLowestPriceResponseAdapter, getNFTMetadataOperation, GetNFTMetadataRequest, GetNFTMetadataResponseAdapter, getNFTOwnersOperation, GetNFTOwnersRequest, GetNFTOwnersResponseAdapter, getNFTTokenIdOwnersOperation, GetNFTTokenIdOwnersRequest, GetNFTTokenIdOwnersResponseAdapter, getNFTTransfersByBlockOperation, GetNFTTransfersByBlockRequest, GetNFTTransfersByBlockResponseAdapter, getNFTTransfersFromToBlockOperation, GetNFTTransfersFromToBlockRequest, GetNFTTransfersFromToBlockResponseAdapter, getNFTTransfersOperation, GetNFTTransfersRequest, GetNFTTransfersResponseAdapter, getWalletNFTCollectionsOperation, GetWalletNFTCollectionsRequest, GetWalletNFTCollectionsResponseAdapter, getWalletNFTsOperation, GetWalletNFTsRequest, GetWalletNFTsResponseAdapter, getWalletNFTTransfersOperation, GetWalletNFTTransfersRequest, GetWalletNFTTransfersResponseAdapter, reSyncMetadataOperation, ReSyncMetadataRequest, ReSyncMetadataResponseAdapter, syncNFTContractOperation, SyncNFTContractRequest, SyncNFTContractResponseAdapter, GetNFTTradesOperationResponseJSON, GetNFTTradesOperation, GetNFTTradesOperationRequest, GetNFTTradesOperationResponse, GetNFTContractSalePricesOperationResponseJSON, GetNFTContractSalePricesOperation, GetNFTContractSalePricesOperationRequest, GetNFTContractSalePricesOperationResponse, GetNFTSalePricesOperationResponseJSON, GetNFTSalePricesOperation, GetNFTSalePricesOperationRequest, GetNFTSalePricesOperationResponse, GetNFTCollectionStatsOperationResponseJSON, GetNFTCollectionStatsOperation, GetNFTCollectionStatsOperationRequest, GetNFTCollectionStatsOperationResponse, GetNFTTokenStatsOperationResponseJSON, GetNFTTokenStatsOperation, GetNFTTokenStatsOperationRequest, GetNFTTokenStatsOperationResponse, getInternalTransactionsOperation, GetInternalTransactionsRequest, GetInternalTransactionsResponseAdapter, getTransactionOperation, GetTransactionRequest, GetTransactionResponseAdapter, getTransactionVerboseOperation, GetTransactionVerboseRequest, GetTransactionVerboseResponseAdapter, getWalletTransactionsOperation, GetWalletTransactionsRequest, GetWalletTransactionsResponseAdapter, getWalletTransactionsVerboseOperation, GetWalletTransactionsVerboseRequest, GetWalletTransactionsVerboseResponseAdapter, getNativeBalanceOperation, GetNativeBalanceRequest, GetNativeBalanceResponseAdapter, getNativeBalancesForAddressesOperation, GetNativeBalancesForAddressesRequest, GetNativeBalancesForAddressesResponseAdapter, getPairAddressOperation, GetPairAddressRequest, GetPairAddressResponseAdapter, getPairReservesOperation, GetPairReservesRequest, GetPairReservesResponseAdapter, GetPairPriceOperationResponseJSON, GetPairPriceOperation, GetPairPriceOperationRequest, GetPairPriceOperationResponse, getTokenAllowanceOperation, GetTokenAllowanceRequest, GetTokenAllowanceResponseAdapter, getTokenMetadataBySymbolOperation, GetTokenMetadataBySymbolRequest, GetTokenMetadataBySymbolResponseAdapter, getTokenMetadataOperation, GetTokenMetadataRequest, GetTokenMetadataResponseAdapter, getTokenPriceOperation, GetTokenPriceRequest, GetTokenPriceResponseAdapter, getTokenTransfersOperation, GetTokenTransfersRequest, GetTokenTransfersResponseAdapter, getWalletTokenBalancesOperation, GetWalletTokenBalancesRequest, GetWalletTokenBalancesResponseAdapter, getWalletTokenTransfersOperation, GetWalletTokenTransfersRequest, GetWalletTokenTransfersResponseAdapter, GetMultipleTokenPricesOperationResponseJSON, GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationBody, GetMultipleTokenPricesOperationResponse, GetTokenOwnersOperationResponseJSON, GetTokenOwnersOperation, GetTokenOwnersOperationRequest, GetTokenOwnersOperationResponse, GetTokenStatsOperationResponseJSON, GetTokenStatsOperation, GetTokenStatsOperationRequest, GetTokenStatsOperationResponse, resolveAddressOperation, ResolveAddressRequest, ResolveAddressResponseAdapter, resolveDomainOperation, ResolveDomainRequest, ResolveDomainResponseAdapter, resolveENSDomainOperation, ResolveENSDomainRequest, ResolveENSDomainResponseAdapter, ResolveAddressToDomainOperationResponseJSON, ResolveAddressToDomainOperation, ResolveAddressToDomainOperationRequest, ResolveAddressToDomainOperationResponse, runContractFunctionOperation, RunContractFunctionRequest, RunContractFunctionResponseAdapter, Web3ApiVersionOperationResponseJSON, Web3ApiVersionOperation, Web3ApiVersionOperationResponse, EndpointWeightsOperationResponseJSON, EndpointWeightsOperation, EndpointWeightsOperationResponse, ReviewContractsOperationResponseJSON, ReviewContractsOperation, ReviewContractsOperationRequest, ReviewContractsOperationBody, ReviewContractsOperationResponse, uploadFolderOperation, UploadFolderRequest, UploadFolderResponseAdapter, GetWalletHistoryOperationResponseJSON, GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationResponse, GetWalletTokenBalancesPriceOperationResponseJSON, GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationResponse, GetWalletNetWorthOperationResponseJSON, GetWalletNetWorthOperation, GetWalletNetWorthOperationRequest, GetWalletNetWorthOperationResponse, GetWalletActiveChainsOperationResponseJSON, GetWalletActiveChainsOperation, GetWalletActiveChainsOperationRequest, GetWalletActiveChainsOperationResponse, GetWalletStatsOperationResponseJSON, GetWalletStatsOperation, GetWalletStatsOperationRequest, GetWalletStatsOperationResponse, GetTopERC20TokensByMarketCapOperationResponseJSON, GetTopERC20TokensByMarketCapOperation, GetTopERC20TokensByMarketCapOperationResponse, GetTopERC20TokensByPriceMoversOperationResponseJSON, GetTopERC20TokensByPriceMoversOperation, GetTopERC20TokensByPriceMoversOperationResponse, GetTopNFTCollectionsByMarketCapOperationResponseJSON, GetTopNFTCollectionsByMarketCapOperation, GetTopNFTCollectionsByMarketCapOperationResponse, GetHottestNFTCollectionsByTradingVolumeOperationResponseJSON, GetHottestNFTCollectionsByTradingVolumeOperation, GetHottestNFTCollectionsByTradingVolumeOperationResponse, GetTopCryptoCurrenciesByMarketCapOperationResponseJSON, GetTopCryptoCurrenciesByMarketCapOperation, GetTopCryptoCurrenciesByMarketCapOperationResponse, GetTopCryptoCurrenciesByTradingVolumeOperationResponseJSON, GetTopCryptoCurrenciesByTradingVolumeOperation, GetTopCryptoCurrenciesByTradingVolumeOperationResponse } from '@moralisweb3/common-evm-utils'; +import { getBlockOperation, GetBlockRequest, GetBlockResponseAdapter, getDateToBlockOperation, GetDateToBlockRequest, GetDateToBlockResponseAdapter, GetBlockStatsOperationResponseJSON, GetBlockStatsOperation, GetBlockStatsOperationRequest, GetBlockStatsOperationResponse, getContractEventsOperation, GetContractEventsRequest, GetContractEventsResponseAdapter, getContractLogsOperation, GetContractLogsRequest, GetContractLogsResponseAdapter, getContractNFTsOperation, GetContractNFTsRequest, GetContractNFTsResponseAdapter, getMultipleNFTsOperation, GetMultipleNFTsRequest, GetMultipleNFTsResponseAdapter, getNFTContractMetadataOperation, GetNFTContractMetadataRequest, GetNFTContractMetadataResponseAdapter, getNFTContractTransfersOperation, GetNFTContractTransfersRequest, GetNFTContractTransfersResponseAdapter, getNFTLowestPriceOperation, GetNFTLowestPriceRequest, GetNFTLowestPriceResponseAdapter, getNFTMetadataOperation, GetNFTMetadataRequest, GetNFTMetadataResponseAdapter, getNFTOwnersOperation, GetNFTOwnersRequest, GetNFTOwnersResponseAdapter, getNFTTokenIdOwnersOperation, GetNFTTokenIdOwnersRequest, GetNFTTokenIdOwnersResponseAdapter, getNFTTransfersByBlockOperation, GetNFTTransfersByBlockRequest, GetNFTTransfersByBlockResponseAdapter, getNFTTransfersFromToBlockOperation, GetNFTTransfersFromToBlockRequest, GetNFTTransfersFromToBlockResponseAdapter, getNFTTransfersOperation, GetNFTTransfersRequest, GetNFTTransfersResponseAdapter, getWalletNFTCollectionsOperation, GetWalletNFTCollectionsRequest, GetWalletNFTCollectionsResponseAdapter, getWalletNFTsOperation, GetWalletNFTsRequest, GetWalletNFTsResponseAdapter, getWalletNFTTransfersOperation, GetWalletNFTTransfersRequest, GetWalletNFTTransfersResponseAdapter, reSyncMetadataOperation, ReSyncMetadataRequest, ReSyncMetadataResponseAdapter, syncNFTContractOperation, SyncNFTContractRequest, SyncNFTContractResponseAdapter, GetNFTTradesOperationResponseJSON, GetNFTTradesOperation, GetNFTTradesOperationRequest, GetNFTTradesOperationResponse, GetNFTContractSalePricesOperationResponseJSON, GetNFTContractSalePricesOperation, GetNFTContractSalePricesOperationRequest, GetNFTContractSalePricesOperationResponse, GetNFTSalePricesOperationResponseJSON, GetNFTSalePricesOperation, GetNFTSalePricesOperationRequest, GetNFTSalePricesOperationResponse, GetNFTCollectionStatsOperationResponseJSON, GetNFTCollectionStatsOperation, GetNFTCollectionStatsOperationRequest, GetNFTCollectionStatsOperationResponse, GetNFTTokenStatsOperationResponseJSON, GetNFTTokenStatsOperation, GetNFTTokenStatsOperationRequest, GetNFTTokenStatsOperationResponse, getInternalTransactionsOperation, GetInternalTransactionsRequest, GetInternalTransactionsResponseAdapter, getTransactionOperation, GetTransactionRequest, GetTransactionResponseAdapter, getTransactionVerboseOperation, GetTransactionVerboseRequest, GetTransactionVerboseResponseAdapter, getWalletTransactionsOperation, GetWalletTransactionsRequest, GetWalletTransactionsResponseAdapter, getWalletTransactionsVerboseOperation, GetWalletTransactionsVerboseRequest, GetWalletTransactionsVerboseResponseAdapter, getNativeBalanceOperation, GetNativeBalanceRequest, GetNativeBalanceResponseAdapter, getNativeBalancesForAddressesOperation, GetNativeBalancesForAddressesRequest, GetNativeBalancesForAddressesResponseAdapter, getPairAddressOperation, GetPairAddressRequest, GetPairAddressResponseAdapter, getPairReservesOperation, GetPairReservesRequest, GetPairReservesResponseAdapter, GetPairPriceOperationResponseJSON, GetPairPriceOperation, GetPairPriceOperationRequest, GetPairPriceOperationResponse, getTokenAllowanceOperation, GetTokenAllowanceRequest, GetTokenAllowanceResponseAdapter, getTokenMetadataBySymbolOperation, GetTokenMetadataBySymbolRequest, GetTokenMetadataBySymbolResponseAdapter, getTokenMetadataOperation, GetTokenMetadataRequest, GetTokenMetadataResponseAdapter, getTokenPriceOperation, GetTokenPriceRequest, GetTokenPriceResponseAdapter, getTokenTransfersOperation, GetTokenTransfersRequest, GetTokenTransfersResponseAdapter, getWalletTokenBalancesOperation, GetWalletTokenBalancesRequest, GetWalletTokenBalancesResponseAdapter, getWalletTokenTransfersOperation, GetWalletTokenTransfersRequest, GetWalletTokenTransfersResponseAdapter, GetMultipleTokenPricesOperationResponseJSON, GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationBody, GetMultipleTokenPricesOperationResponse, GetTokenOwnersOperationResponseJSON, GetTokenOwnersOperation, GetTokenOwnersOperationRequest, GetTokenOwnersOperationResponse, GetTokenStatsOperationResponseJSON, GetTokenStatsOperation, GetTokenStatsOperationRequest, GetTokenStatsOperationResponse, resolveAddressOperation, ResolveAddressRequest, ResolveAddressResponseAdapter, resolveDomainOperation, ResolveDomainRequest, ResolveDomainResponseAdapter, resolveENSDomainOperation, ResolveENSDomainRequest, ResolveENSDomainResponseAdapter, ResolveAddressToDomainOperationResponseJSON, ResolveAddressToDomainOperation, ResolveAddressToDomainOperationRequest, ResolveAddressToDomainOperationResponse, runContractFunctionOperation, RunContractFunctionRequest, RunContractFunctionResponseAdapter, Web3ApiVersionOperationResponseJSON, Web3ApiVersionOperation, Web3ApiVersionOperationResponse, EndpointWeightsOperationResponseJSON, EndpointWeightsOperation, EndpointWeightsOperationResponse, ReviewContractsOperationResponseJSON, ReviewContractsOperation, ReviewContractsOperationRequest, ReviewContractsOperationBody, ReviewContractsOperationResponse, uploadFolderOperation, UploadFolderRequest, UploadFolderResponseAdapter, GetWalletHistoryOperationResponseJSON, GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationResponse, GetWalletTokenBalancesPriceOperationResponseJSON, GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationResponse, GetWalletNetWorthOperationResponseJSON, GetWalletNetWorthOperation, GetWalletNetWorthOperationRequest, GetWalletNetWorthOperationResponse, GetDefiSummaryOperationResponseJSON, GetDefiSummaryOperation, GetDefiSummaryOperationRequest, GetDefiSummaryOperationResponse, GetDefiPositionsByProtocolOperationResponseJSON, GetDefiPositionsByProtocolOperation, GetDefiPositionsByProtocolOperationRequest, GetDefiPositionsByProtocolOperationResponse, GetDefiPositionsSummaryOperationResponseJSON, GetDefiPositionsSummaryOperation, GetDefiPositionsSummaryOperationRequest, GetDefiPositionsSummaryOperationResponse, GetWalletActiveChainsOperationResponseJSON, GetWalletActiveChainsOperation, GetWalletActiveChainsOperationRequest, GetWalletActiveChainsOperationResponse, GetWalletStatsOperationResponseJSON, GetWalletStatsOperation, GetWalletStatsOperationRequest, GetWalletStatsOperationResponse, GetTopERC20TokensByMarketCapOperationResponseJSON, GetTopERC20TokensByMarketCapOperation, GetTopERC20TokensByMarketCapOperationResponse, GetTopERC20TokensByPriceMoversOperationResponseJSON, GetTopERC20TokensByPriceMoversOperation, GetTopERC20TokensByPriceMoversOperationResponse, GetTopNFTCollectionsByMarketCapOperationResponseJSON, GetTopNFTCollectionsByMarketCapOperation, GetTopNFTCollectionsByMarketCapOperationResponse, GetHottestNFTCollectionsByTradingVolumeOperationResponseJSON, GetHottestNFTCollectionsByTradingVolumeOperation, GetHottestNFTCollectionsByTradingVolumeOperationResponse, GetTopCryptoCurrenciesByMarketCapOperationResponseJSON, GetTopCryptoCurrenciesByMarketCapOperation, GetTopCryptoCurrenciesByMarketCapOperationResponse, GetTopCryptoCurrenciesByTradingVolumeOperationResponseJSON, GetTopCryptoCurrenciesByTradingVolumeOperation, GetTopCryptoCurrenciesByTradingVolumeOperationResponse } from '@moralisweb3/common-evm-utils'; import { NullableOperationResolver, OperationResolver, OperationV3Resolver, PaginatedOperationResolver, PaginatedResponseV3Adapter, PaginatedOperationV3Resolver } from '@moralisweb3/api-utils'; import { ApiModule, ResponseAdapter } from '@moralisweb3/common-core'; export abstract class ClientEvmApi extends ApiModule { @@ -220,6 +220,15 @@ export abstract class ClientEvmApi extends ApiModule { getWalletNetWorth: (request: GetWalletNetWorthOperationRequest): Promise> => { return new OperationV3Resolver(GetWalletNetWorthOperation, this.baseUrl, this.core).fetch(request, null); }, + getDefiSummary: (request: GetDefiSummaryOperationRequest): Promise> => { + return new OperationV3Resolver(GetDefiSummaryOperation, this.baseUrl, this.core).fetch(request, null); + }, + getDefiPositionsByProtocol: (request: GetDefiPositionsByProtocolOperationRequest): Promise> => { + return new OperationV3Resolver(GetDefiPositionsByProtocolOperation, this.baseUrl, this.core).fetch(request, null); + }, + getDefiPositionsSummary: (request: GetDefiPositionsSummaryOperationRequest): Promise> => { + return new OperationV3Resolver(GetDefiPositionsSummaryOperation, this.baseUrl, this.core).fetch(request, null); + }, getWalletActiveChains: (request: GetWalletActiveChainsOperationRequest): Promise> => { return new OperationV3Resolver(GetWalletActiveChainsOperation, this.baseUrl, this.core).fetch(request, null); },