diff --git a/.changeset/tall-icons-remain.md b/.changeset/tall-icons-remain.md new file mode 100644 index 0000000000..a51d3f2639 --- /dev/null +++ b/.changeset/tall-icons-remain.md @@ -0,0 +1,7 @@ +--- +'@moralisweb3/common-evm-utils': patch +'@moralisweb3/evm-api': patch +'moralis': patch +--- + +add getTokenOwners function to SDK diff --git a/packages/common/evmUtils/generator.config.json b/packages/common/evmUtils/generator.config.json index 36775530dc..5ccb942fc7 100644 --- a/packages/common/evmUtils/generator.config.json +++ b/packages/common/evmUtils/generator.config.json @@ -120,7 +120,8 @@ "getTopCryptoCurrenciesByTradingVolume", "getWalletHistory", "getNFTSalePrices", - "getNFTContractSalePrices" + "getNFTContractSalePrices", + "getTokenOwners" ] } } diff --git a/packages/common/evmUtils/src/generated/client/abstractClient.ts b/packages/common/evmUtils/src/generated/client/abstractClient.ts index b7babf1674..1e3c436c56 100644 --- a/packages/common/evmUtils/src/generated/client/abstractClient.ts +++ b/packages/common/evmUtils/src/generated/client/abstractClient.ts @@ -6,6 +6,8 @@ import { GetNFTSalePricesOperation, GetNFTSalePricesOperationRequest, GetNFTSale import { GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationRequestJSON } from '../operations/GetMultipleTokenPricesOperation'; import { EvmErc20Price, EvmErc20PriceJSON } from '../types/EvmErc20Price'; import { EvmGetMultipleTokenPricesDto, EvmGetMultipleTokenPricesDtoInput, EvmGetMultipleTokenPricesDtoJSON } from '../types/EvmGetMultipleTokenPricesDto'; +import { GetTokenOwnersOperation, GetTokenOwnersOperationRequest, GetTokenOwnersOperationRequestJSON } from '../operations/GetTokenOwnersOperation'; +import { EvmErc20TokenOwnerCollection, EvmErc20TokenOwnerCollectionJSON } from '../types/EvmErc20TokenOwnerCollection'; import { GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationRequestJSON } from '../operations/GetWalletHistoryOperation'; import { EvmWalletHistory, EvmWalletHistoryJSON } from '../types/EvmWalletHistory'; import { GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationRequestJSON } from '../operations/GetWalletTokenBalancesPriceOperation'; @@ -188,7 +190,7 @@ export abstract class AbstractClient { * @param {Date} [request.toDate] The end date from which to get the transfers (format in seconds or datestring accepted by momentjs) * * Provide the param 'to_block' or 'to_date' * * If 'to_date' and 'to_block' are provided, 'to_block' will be used. (optional) - * @param {Object} [request.marketplace] Marketplace from which to get the trades (only OpenSea is supported at the moment) (optional) + * @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) * @returns {Object} Response for the request. @@ -205,7 +207,7 @@ export abstract class AbstractClient { * @param {Object} request.address The address of the NFT collection * @param {Object} [request.chain] The chain to query (optional) * @param {Number} [request.days] The number of days to look back to find the lowest price - * If not provided 7 days will be the default (optional) + * If not provided 7 days will be the default and 365 is the maximum (optional) * @returns {Object} Response for the request. */ getNFTContractSalePrices: this.createEndpoint< @@ -221,7 +223,7 @@ export abstract class AbstractClient { * @param {String} request.tokenId The token id of the NFT collection * @param {Object} [request.chain] The chain to query (optional) * @param {Number} [request.days] The number of days to look back to find the lowest price - * If not provided 7 days will be the default (optional) + * If not provided 7 days will be the default and 365 is the maximum (optional) * @returns {Object} Response for the request. */ getNFTSalePrices: this.createEndpoint< @@ -291,6 +293,22 @@ export abstract class AbstractClient { EvmGetMultipleTokenPricesDtoInput | EvmGetMultipleTokenPricesDto, EvmGetMultipleTokenPricesDtoJSON >(GetMultipleTokenPricesOperation), + /** + * @description Identify the major holders of an ERC20 token and understand their ownership percentages + * @param request Request with parameters. + * @param {String} request.tokenAddress The address of the token contract + * @param {Object} [request.chain] The chain to query (optional) + * @param {Number} [request.limit] The desired page size of the result. (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) + * @returns {Object} Response for the request. + */ + getTokenOwners: this.createEndpoint< + GetTokenOwnersOperationRequest, + GetTokenOwnersOperationRequestJSON, + EvmErc20TokenOwnerCollection, + EvmErc20TokenOwnerCollectionJSON + >(GetTokenOwnersOperation), /** * @description Get the stats for a erc20 token * @param request Request with parameters. diff --git a/packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts b/packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts index 6a9372ce89..85ff2b5d4d 100644 --- a/packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetNFTContractSalePricesOperation.ts @@ -13,7 +13,7 @@ export interface GetNFTContractSalePricesOperationRequest { readonly chain?: EvmChainInput | EvmChain; /** * @description The number of days to look back to find the lowest price - * If not provided 7 days will be the default + * If not provided 7 days will be the default and 365 is the maximum */ readonly days?: number; /** diff --git a/packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts b/packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts index 708db170d8..d4f70559e6 100644 --- a/packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetNFTSalePricesOperation.ts @@ -14,7 +14,7 @@ export interface GetNFTSalePricesOperationRequest { readonly chain?: EvmChainInput | EvmChain; /** * @description The number of days to look back to find the lowest price - * If not provided 7 days will be the default + * If not provided 7 days will be the default and 365 is the maximum */ readonly days?: number; /** diff --git a/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts b/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts index 0db83637c4..0e51d53387 100644 --- a/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts @@ -41,7 +41,7 @@ export interface GetNFTTradesOperationRequest { */ readonly toDate?: Date; /** - * @description Marketplace from which to get the trades (only OpenSea is supported at the moment) + * @description Marketplace from which to get the trades. See [supported Marketplaces](https://docs.moralis.io/web3-data-api/evm/nft-marketplaces). */ readonly marketplace?: EvmGetNFTTradesMarketplaceEnumInput | EvmGetNFTTradesMarketplaceEnumValue; /** diff --git a/packages/common/evmUtils/src/generated/operations/GetTokenOwnersOperation.ts b/packages/common/evmUtils/src/generated/operations/GetTokenOwnersOperation.ts new file mode 100644 index 0000000000..78e53d02c1 --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetTokenOwnersOperation.ts @@ -0,0 +1,74 @@ +import { EvmChain, EvmChainInput, EvmChainJSON } from '../../dataTypes'; +import { EvmOrderList, EvmOrderListValue, EvmOrderListInput, EvmOrderListJSON } from '../types/EvmOrderList'; +import { EvmErc20TokenOwnerCollection, EvmErc20TokenOwnerCollectionJSON } from '../types/EvmErc20TokenOwnerCollection'; + +// request parameters: +// - chain ($ref: #/components/schemas/chainList) +// - token_address ($ref: #/paths/~1erc20~1{token_address}~1owners/get/parameters/1/schema) +// - limit ($ref: #/paths/~1erc20~1{token_address}~1owners/get/parameters/2/schema) +// - cursor ($ref: #/paths/~1erc20~1{token_address}~1owners/get/parameters/3/schema) +// - order ($ref: #/components/schemas/orderList) + +export interface GetTokenOwnersOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description The address of the token contract + */ + readonly tokenAddress: string; + /** + * @description The desired page size of the result. + */ + readonly limit?: number; + /** + * @description The cursor returned in the previous response (used for getting the next page). + */ + readonly cursor?: string; + /** + * @description The order of the result, in ascending (ASC) or descending (DESC) + */ + readonly order?: EvmOrderListInput | EvmOrderListValue; +} + +export interface GetTokenOwnersOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly token_address: string; + readonly limit?: number; + readonly cursor?: string; + readonly order?: EvmOrderListJSON; +} + +export type GetTokenOwnersOperationResponse = EvmErc20TokenOwnerCollection; +export type GetTokenOwnersOperationResponseJSON = EvmErc20TokenOwnerCollectionJSON; + +export const GetTokenOwnersOperation = { + operationId: "getTokenOwners", + groupName: "token", + httpMethod: "get", + routePattern: "/erc20/{token_address}/owners", + parameterNames: ["chain","token_address","limit","cursor","order"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmErc20TokenOwnerCollectionJSON): EvmErc20TokenOwnerCollection { + return EvmErc20TokenOwnerCollection.fromJSON(json); + }, + + serializeRequest(request: GetTokenOwnersOperationRequest): GetTokenOwnersOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const tokenAddress = request.tokenAddress; + const limit = request.limit; + const cursor = request.cursor; + const order = request.order ? EvmOrderList.create(request.order) : undefined; + return { + chain: chain ? chain.toJSON() : undefined, + token_address: tokenAddress, + limit: limit, + 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 122299391c..613ca3fbeb 100644 --- a/packages/common/evmUtils/src/generated/operations/index.ts +++ b/packages/common/evmUtils/src/generated/operations/index.ts @@ -2,6 +2,7 @@ export * from './GetNFTTradesOperation'; export * from './GetNFTContractSalePricesOperation'; export * from './GetNFTSalePricesOperation'; export * from './GetMultipleTokenPricesOperation'; +export * from './GetTokenOwnersOperation'; export * from './GetWalletHistoryOperation'; export * from './GetWalletTokenBalancesPriceOperation'; export * from './GetWalletNetWorthOperation'; diff --git a/packages/common/evmUtils/src/generated/operations/operations.ts b/packages/common/evmUtils/src/generated/operations/operations.ts index 97c5811a66..adfe0d3f1f 100644 --- a/packages/common/evmUtils/src/generated/operations/operations.ts +++ b/packages/common/evmUtils/src/generated/operations/operations.ts @@ -2,6 +2,7 @@ import { GetNFTTradesOperation } from './GetNFTTradesOperation'; import { GetNFTContractSalePricesOperation } from './GetNFTContractSalePricesOperation'; import { GetNFTSalePricesOperation } from './GetNFTSalePricesOperation'; import { GetMultipleTokenPricesOperation } from './GetMultipleTokenPricesOperation'; +import { GetTokenOwnersOperation } from './GetTokenOwnersOperation'; import { GetWalletHistoryOperation } from './GetWalletHistoryOperation'; import { GetWalletTokenBalancesPriceOperation } from './GetWalletTokenBalancesPriceOperation'; import { GetWalletNetWorthOperation } from './GetWalletNetWorthOperation'; @@ -28,6 +29,7 @@ export const operations = [ GetNFTContractSalePricesOperation, GetNFTSalePricesOperation, GetMultipleTokenPricesOperation, + GetTokenOwnersOperation, GetWalletHistoryOperation, GetWalletTokenBalancesPriceOperation, GetWalletNetWorthOperation, diff --git a/packages/common/evmUtils/src/generated/types/EvmErc20Price.ts b/packages/common/evmUtils/src/generated/types/EvmErc20Price.ts index cff1f66564..e604235029 100644 --- a/packages/common/evmUtils/src/generated/types/EvmErc20Price.ts +++ b/packages/common/evmUtils/src/generated/types/EvmErc20Price.ts @@ -17,6 +17,8 @@ import { EvmNativeErc20Price, EvmNativeErc20PriceInput, EvmNativeErc20PriceJSON // - toBlock ($ref: #/components/schemas/erc20Price/properties/toBlock) // - possibleSpam ($ref: #/components/schemas/erc20Price/properties/possibleSpam) // - verifiedContract ($ref: #/components/schemas/erc20Price/properties/verifiedContract) +// - pairAddress ($ref: #/components/schemas/erc20Price/properties/pairAddress) +// - pairTotalLiquidityUsd ($ref: #/components/schemas/erc20Price/properties/pairTotalLiquidityUsd) export interface EvmErc20PriceJSON { readonly tokenName?: string; @@ -33,6 +35,8 @@ export interface EvmErc20PriceJSON { readonly toBlock?: string; readonly possibleSpam: boolean; readonly verifiedContract: boolean; + readonly pairAddress?: string; + readonly pairTotalLiquidityUsd?: string; } export interface EvmErc20PriceInput { @@ -50,6 +54,8 @@ export interface EvmErc20PriceInput { readonly toBlock?: string; readonly possibleSpam: boolean; readonly verifiedContract: boolean; + readonly pairAddress?: string; + readonly pairTotalLiquidityUsd?: string; } export class EvmErc20Price { @@ -76,6 +82,8 @@ export class EvmErc20Price { toBlock: json.toBlock, possibleSpam: json.possibleSpam, verifiedContract: json.verifiedContract, + pairAddress: json.pairAddress, + pairTotalLiquidityUsd: json.pairTotalLiquidityUsd, }; return EvmErc20Price.create(input); } @@ -133,6 +141,14 @@ export class EvmErc20Price { * @description Indicates if the contract is verified */ public readonly verifiedContract: boolean; + /** + * @description The address of the pair + */ + public readonly pairAddress?: string; + /** + * @description The total liquidity in USD of the pair + */ + public readonly pairTotalLiquidityUsd?: string; private constructor(input: EvmErc20PriceInput) { this.tokenName = input.tokenName; @@ -149,6 +165,8 @@ export class EvmErc20Price { this.toBlock = input.toBlock; this.possibleSpam = input.possibleSpam; this.verifiedContract = input.verifiedContract; + this.pairAddress = input.pairAddress; + this.pairTotalLiquidityUsd = input.pairTotalLiquidityUsd; } public toJSON(): EvmErc20PriceJSON { @@ -167,6 +185,8 @@ export class EvmErc20Price { toBlock: this.toBlock, possibleSpam: this.possibleSpam, verifiedContract: this.verifiedContract, + pairAddress: this.pairAddress, + pairTotalLiquidityUsd: this.pairTotalLiquidityUsd, } } } diff --git a/packages/common/evmUtils/src/generated/types/EvmErc20TokenOwner.ts b/packages/common/evmUtils/src/generated/types/EvmErc20TokenOwner.ts new file mode 100644 index 0000000000..d939661bf2 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmErc20TokenOwner.ts @@ -0,0 +1,103 @@ +// $ref: #/components/schemas/erc20TokenOwner +// type: erc20TokenOwner +// properties: +// - owner_address ($ref: #/components/schemas/erc20TokenOwner/properties/owner_address) +// - owner_address_label ($ref: #/components/schemas/erc20TokenOwner/properties/owner_address_label) +// - balance ($ref: #/components/schemas/erc20TokenOwner/properties/balance) +// - balance_formatted ($ref: #/components/schemas/erc20TokenOwner/properties/balance_formatted) +// - usd_value ($ref: #/components/schemas/erc20TokenOwner/properties/usd_value) +// - is_contract ($ref: #/components/schemas/erc20TokenOwner/properties/is_contract) +// - percentage_relative_to_total_supply ($ref: #/components/schemas/erc20TokenOwner/properties/percentage_relative_to_total_supply) + +export interface EvmErc20TokenOwnerJSON { + readonly owner_address: string; + readonly owner_address_label: string; + readonly balance: string; + readonly balance_formatted: string; + readonly usd_value: string; + readonly is_contract: boolean; + readonly percentage_relative_to_total_supply: number; +} + +export interface EvmErc20TokenOwnerInput { + readonly ownerAddress: string; + readonly ownerAddressLabel: string; + readonly balance: string; + readonly balanceFormatted: string; + readonly usdValue: string; + readonly isContract: boolean; + readonly percentageRelativeToTotalSupply: number; +} + +export class EvmErc20TokenOwner { + public static create(input: EvmErc20TokenOwnerInput | EvmErc20TokenOwner): EvmErc20TokenOwner { + if (input instanceof EvmErc20TokenOwner) { + return input; + } + return new EvmErc20TokenOwner(input); + } + + public static fromJSON(json: EvmErc20TokenOwnerJSON): EvmErc20TokenOwner { + const input: EvmErc20TokenOwnerInput = { + ownerAddress: json.owner_address, + ownerAddressLabel: json.owner_address_label, + balance: json.balance, + balanceFormatted: json.balance_formatted, + usdValue: json.usd_value, + isContract: json.is_contract, + percentageRelativeToTotalSupply: json.percentage_relative_to_total_supply, + }; + return EvmErc20TokenOwner.create(input); + } + + /** + * @description The address of the erc20 token owner + */ + public readonly ownerAddress: string; + /** + * @description The label of the owner_address + */ + public readonly ownerAddressLabel: string; + /** + * @description The amount holding of the ERC20 token + */ + public readonly balance: string; + /** + * @description The amount holding of the ERC20 token in decimaal + */ + public readonly balanceFormatted: string; + /** + * @description The USD value of the balance + */ + public readonly usdValue: string; + /** + * @description Indicates if the token address is for a contract or not + */ + public readonly isContract: boolean; + /** + * @description The percentage of total supply held by the owner + */ + public readonly percentageRelativeToTotalSupply: number; + + private constructor(input: EvmErc20TokenOwnerInput) { + this.ownerAddress = input.ownerAddress; + this.ownerAddressLabel = input.ownerAddressLabel; + this.balance = input.balance; + this.balanceFormatted = input.balanceFormatted; + this.usdValue = input.usdValue; + this.isContract = input.isContract; + this.percentageRelativeToTotalSupply = input.percentageRelativeToTotalSupply; + } + + public toJSON(): EvmErc20TokenOwnerJSON { + return { + owner_address: this.ownerAddress, + owner_address_label: this.ownerAddressLabel, + balance: this.balance, + balance_formatted: this.balanceFormatted, + usd_value: this.usdValue, + is_contract: this.isContract, + percentage_relative_to_total_supply: this.percentageRelativeToTotalSupply, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmErc20TokenOwnerCollection.ts b/packages/common/evmUtils/src/generated/types/EvmErc20TokenOwnerCollection.ts new file mode 100644 index 0000000000..7ddc2caf75 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmErc20TokenOwnerCollection.ts @@ -0,0 +1,72 @@ +import { EvmErc20TokenOwner, EvmErc20TokenOwnerInput, EvmErc20TokenOwnerJSON } from '../types/EvmErc20TokenOwner'; + +// $ref: #/components/schemas/erc20TokenOwnerCollection +// type: erc20TokenOwnerCollection +// properties: +// - page ($ref: #/components/schemas/erc20TokenOwnerCollection/properties/page) +// - page_size ($ref: #/components/schemas/erc20TokenOwnerCollection/properties/page_size) +// - cursor ($ref: #/components/schemas/erc20TokenOwnerCollection/properties/cursor) +// - result ($ref: #/components/schemas/erc20TokenOwner) + +export interface EvmErc20TokenOwnerCollectionJSON { + readonly page?: number; + readonly page_size?: number; + readonly cursor?: string; + readonly result: EvmErc20TokenOwnerJSON[]; +} + +export interface EvmErc20TokenOwnerCollectionInput { + readonly page?: number; + readonly pageSize?: number; + readonly cursor?: string; + readonly result: EvmErc20TokenOwnerInput[] | EvmErc20TokenOwner[]; +} + +export class EvmErc20TokenOwnerCollection { + public static create(input: EvmErc20TokenOwnerCollectionInput | EvmErc20TokenOwnerCollection): EvmErc20TokenOwnerCollection { + if (input instanceof EvmErc20TokenOwnerCollection) { + return input; + } + return new EvmErc20TokenOwnerCollection(input); + } + + public static fromJSON(json: EvmErc20TokenOwnerCollectionJSON): EvmErc20TokenOwnerCollection { + const input: EvmErc20TokenOwnerCollectionInput = { + page: json.page, + pageSize: json.page_size, + cursor: json.cursor, + result: json.result.map((item) => EvmErc20TokenOwner.fromJSON(item)), + }; + return EvmErc20TokenOwnerCollection.create(input); + } + + /** + * @description The current page of the result + */ + public readonly page?: number; + /** + * @description The number of results per page + */ + public readonly pageSize?: number; + /** + * @description The cursor to get to the next page + */ + public readonly cursor?: string; + public readonly result: EvmErc20TokenOwner[]; + + private constructor(input: EvmErc20TokenOwnerCollectionInput) { + this.page = input.page; + this.pageSize = input.pageSize; + this.cursor = input.cursor; + this.result = input.result.map((item) => EvmErc20TokenOwner.create(item)); + } + + public toJSON(): EvmErc20TokenOwnerCollectionJSON { + return { + page: this.page, + page_size: this.pageSize, + cursor: this.cursor, + result: this.result.map((item) => item.toJSON()), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmGetNFTTradesMarketplaceEnum.ts b/packages/common/evmUtils/src/generated/types/EvmGetNFTTradesMarketplaceEnum.ts index cd5359f86d..3702d535dd 100644 --- a/packages/common/evmUtils/src/generated/types/EvmGetNFTTradesMarketplaceEnum.ts +++ b/packages/common/evmUtils/src/generated/types/EvmGetNFTTradesMarketplaceEnum.ts @@ -1,9 +1,9 @@ // $ref: #/paths/~1nft~1{address}~1trades/get/parameters/5/schema // typeName: getNFTTrades_marketplace_Enum -export type EvmGetNFTTradesMarketplaceEnumJSON = "opensea"; -export type EvmGetNFTTradesMarketplaceEnumInput = "opensea"; -export type EvmGetNFTTradesMarketplaceEnumValue = "opensea"; +export type EvmGetNFTTradesMarketplaceEnumJSON = "opensea" | "blur" | "looksrare" | "x2y2" | "0xprotocol"; +export type EvmGetNFTTradesMarketplaceEnumInput = "opensea" | "blur" | "looksrare" | "x2y2" | "0xprotocol"; +export type EvmGetNFTTradesMarketplaceEnumValue = "opensea" | "blur" | "looksrare" | "x2y2" | "0xprotocol"; export abstract class EvmGetNFTTradesMarketplaceEnum { public static create(input: EvmGetNFTTradesMarketplaceEnumInput | EvmGetNFTTradesMarketplaceEnumValue): EvmGetNFTTradesMarketplaceEnumValue { diff --git a/packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts b/packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts index 227fd5ff27..8979e7bc45 100644 --- a/packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts +++ b/packages/common/evmUtils/src/generated/types/EvmSoldPrice.ts @@ -11,6 +11,7 @@ import { EvmSoldPriceAverageSale, EvmSoldPriceAverageSaleInput, EvmSoldPriceAver // - highest_sale ($ref: #/components/schemas/soldPrice/properties/highest_sale) // - average_sale ($ref: #/components/schemas/soldPrice/properties/average_sale) // - total_trades ($ref: #/components/schemas/soldPrice/properties/total_trades) +// - message ($ref: #/components/schemas/soldPrice/properties/message) export interface EvmSoldPriceJSON { readonly last_sale: EvmSoldPriceLastSaleJSON; @@ -18,6 +19,7 @@ export interface EvmSoldPriceJSON { readonly highest_sale: EvmSoldPriceHighestSaleJSON; readonly average_sale: EvmSoldPriceAverageSaleJSON; readonly total_trades?: number; + readonly message?: string; } export interface EvmSoldPriceInput { @@ -26,6 +28,7 @@ export interface EvmSoldPriceInput { readonly highestSale: EvmSoldPriceHighestSaleInput | EvmSoldPriceHighestSale; readonly averageSale: EvmSoldPriceAverageSaleInput | EvmSoldPriceAverageSale; readonly totalTrades?: number; + readonly message?: string; } export class EvmSoldPrice { @@ -43,6 +46,7 @@ export class EvmSoldPrice { highestSale: EvmSoldPriceHighestSale.fromJSON(json.highest_sale), averageSale: EvmSoldPriceAverageSale.fromJSON(json.average_sale), totalTrades: json.total_trades, + message: json.message, }; return EvmSoldPrice.create(input); } @@ -67,6 +71,10 @@ export class EvmSoldPrice { * @description The total trades in the timeframe */ public readonly totalTrades?: number; + /** + * @description The error message (if any) + */ + public readonly message?: string; private constructor(input: EvmSoldPriceInput) { this.lastSale = EvmSoldPriceLastSale.create(input.lastSale); @@ -74,6 +82,7 @@ export class EvmSoldPrice { this.highestSale = EvmSoldPriceHighestSale.create(input.highestSale); this.averageSale = EvmSoldPriceAverageSale.create(input.averageSale); this.totalTrades = input.totalTrades; + this.message = input.message; } public toJSON(): EvmSoldPriceJSON { @@ -83,6 +92,7 @@ export class EvmSoldPrice { highest_sale: this.highestSale.toJSON(), average_sale: this.averageSale.toJSON(), total_trades: this.totalTrades, + message: this.message, } } } diff --git a/packages/common/evmUtils/src/generated/types/index.ts b/packages/common/evmUtils/src/generated/types/index.ts index a59ace765f..7feb5435bd 100644 --- a/packages/common/evmUtils/src/generated/types/index.ts +++ b/packages/common/evmUtils/src/generated/types/index.ts @@ -13,6 +13,7 @@ export * from './EvmTradeCollection'; export * from './EvmSoldPrice'; export * from './EvmErc20Price'; export * from './EvmGetMultipleTokenPricesDto'; +export * from './EvmErc20TokenOwnerCollection'; export * from './EvmWalletHistory'; export * from './EvmErc20TokenBalanceWithPriceResult'; export * from './EvmNetWorthResult'; @@ -40,6 +41,7 @@ export * from './EvmSoldPriceHighestSale'; export * from './EvmSoldPriceAverageSale'; export * from './EvmNativeErc20Price'; export * from './EvmTokenPriceItem'; +export * from './EvmErc20TokenOwner'; export * from './EvmWalletHistoryTransaction'; export * from './EvmErc20TokenBalanceWithPrice'; export * from './EvmChainNetWorth'; diff --git a/packages/evmApi/src/generated/ClientEvmApi.ts b/packages/evmApi/src/generated/ClientEvmApi.ts index b69ccfd9b6..a6ab7b40f1 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, 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, 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 { @@ -162,6 +162,9 @@ export abstract class ClientEvmApi extends ApiModule { getMultipleTokenPrices: (request: GetMultipleTokenPricesOperationRequest, body: GetMultipleTokenPricesOperationBody): Promise> => { return new OperationV3Resolver(GetMultipleTokenPricesOperation, this.baseUrl, this.core).fetch(request, body); }, + getTokenOwners: (request: GetTokenOwnersOperationRequest): Promise> => { + return new PaginatedOperationV3Resolver(GetTokenOwnersOperation, this.baseUrl, this.core).fetch(request, null); + }, getTokenStats: (request: GetTokenStatsOperationRequest): Promise> => { return new OperationV3Resolver(GetTokenStatsOperation, this.baseUrl, this.core).fetch(request, null); },