From 77d125401e908f6a337b81c2745d66f9f9f0996d Mon Sep 17 00:00:00 2001 From: Bart Tadych Date: Fri, 5 Jul 2024 14:52:40 +0200 Subject: [PATCH] fix: fromDate type. (#1220) --- .changeset/wet-paws-fail.md | 7 +++++++ packages/common/evmUtils/generator.config.json | 4 ++++ .../common/evmUtils/src/generated/client/abstractClient.ts | 4 ++-- .../src/generated/operations/GetNFTTradesOperation.ts | 4 ++-- .../src/generated/operations/GetWalletHistoryOperation.ts | 4 ++-- .../src/generated/types/EvmDiscoveryApiChainsList.ts | 6 +++--- 6 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 .changeset/wet-paws-fail.md diff --git a/.changeset/wet-paws-fail.md b/.changeset/wet-paws-fail.md new file mode 100644 index 0000000000..bb15d6e970 --- /dev/null +++ b/.changeset/wet-paws-fail.md @@ -0,0 +1,7 @@ +--- +'@moralisweb3/common-evm-utils': patch +'@moralisweb3/evm-api': patch +'moralis': patch +--- + +Updated the types of `fromDate` request fields. This change affects the `getNFTTrades` and `getWalletHistory` endpoints. diff --git a/packages/common/evmUtils/generator.config.json b/packages/common/evmUtils/generator.config.json index 3cc3d0c72c..c13a21e687 100644 --- a/packages/common/evmUtils/generator.config.json +++ b/packages/common/evmUtils/generator.config.json @@ -86,6 +86,10 @@ { "names": "to_date", "nativeType": "Date" + }, + { + "names": "from_date", + "nativeType": "Date" } ] }, diff --git a/packages/common/evmUtils/src/generated/client/abstractClient.ts b/packages/common/evmUtils/src/generated/client/abstractClient.ts index ab01ead21c..41ce18f0d4 100644 --- a/packages/common/evmUtils/src/generated/client/abstractClient.ts +++ b/packages/common/evmUtils/src/generated/client/abstractClient.ts @@ -196,7 +196,7 @@ export abstract class AbstractClient { * * Provide the param 'from_block' or 'from_date' * * If 'from_date' and 'from_block' are provided, 'from_block' will be used. (optional) * @param {Number} [request.toBlock] The block number to get the trades from (optional) - * @param {String} [request.fromDate] The start date from which to get the transfers (format in seconds or datestring accepted by momentjs) + * @param {Date} [request.fromDate] The start date from which to get the transfers (format in seconds or datestring accepted by momentjs) * * Provide the param 'from_block' or 'from_date' * * If 'from_date' and 'from_block' are provided, 'from_block' will be used. (optional) * @param {Date} [request.toDate] The end date from which to get the transfers (format in seconds or datestring accepted by momentjs) @@ -402,7 +402,7 @@ export abstract class AbstractClient { * @param {Number} [request.toBlock] The maximum block number from which to get the transactions. * * Provide the param 'to_block' or 'to_date' * * If 'to_date' and 'to_block' are provided, 'to_block' will be used. (optional) - * @param {String} [request.fromDate] The start date from which to get the transactions (format in seconds or datestring accepted by momentjs) + * @param {Date} [request.fromDate] The start date from which to get the transactions (format in seconds or datestring accepted by momentjs) * * Provide the param 'from_block' or 'from_date' * * If 'from_date' and 'from_block' are provided, 'from_block' will be used. (optional) * @param {Date} [request.toDate] Get the transactions up to this date (format in seconds or datestring accepted by momentjs) diff --git a/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts b/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts index 5fe6f31789..9deeb9ceea 100644 --- a/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetNFTTradesOperation.ts @@ -34,7 +34,7 @@ export interface GetNFTTradesOperationRequest { * * Provide the param 'from_block' or 'from_date' * * If 'from_date' and 'from_block' are provided, 'from_block' will be used. */ - readonly fromDate?: string; + readonly fromDate?: Date; /** * @description 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' @@ -107,7 +107,7 @@ export const GetNFTTradesOperation = { chain: chain ? chain.toJSON() : undefined, from_block: fromBlock, to_block: toBlock !== undefined ? String(toBlock) : undefined, - from_date: fromDate, + from_date: fromDate !== undefined ? fromDate.toISOString() : undefined, to_date: toDate !== undefined ? toDate.toISOString() : undefined, marketplace: marketplace ? marketplace : undefined, cursor: cursor, diff --git a/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts b/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts index 74c05f16fb..9df7e3c172 100644 --- a/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts @@ -39,7 +39,7 @@ export interface GetWalletHistoryOperationRequest { * * Provide the param 'from_block' or 'from_date' * * If 'from_date' and 'from_block' are provided, 'from_block' will be used. */ - readonly fromDate?: string; + readonly fromDate?: Date; /** * @description Get the transactions up to this date (format in seconds or datestring accepted by momentjs) * * Provide the param 'to_block' or 'to_date' @@ -130,7 +130,7 @@ export const GetWalletHistoryOperation = { chain: chain ? chain.toJSON() : undefined, from_block: fromBlock, to_block: toBlock, - from_date: fromDate, + from_date: fromDate !== undefined ? fromDate.toISOString() : undefined, to_date: toDate !== undefined ? toDate.toISOString() : undefined, address: address.toJSON(), include_internal_transactions: includeInternalTransactions, diff --git a/packages/common/evmUtils/src/generated/types/EvmDiscoveryApiChainsList.ts b/packages/common/evmUtils/src/generated/types/EvmDiscoveryApiChainsList.ts index c69af48235..285848a26a 100644 --- a/packages/common/evmUtils/src/generated/types/EvmDiscoveryApiChainsList.ts +++ b/packages/common/evmUtils/src/generated/types/EvmDiscoveryApiChainsList.ts @@ -1,9 +1,9 @@ // $ref: #/components/schemas/discoveryApiChainsList // typeName: discoveryApiChainsList -export type EvmDiscoveryApiChainsListJSON = "eth" | "mainnet" | "0x1" | "matic" | "0x89" | "polygon" | "bsc" | "binance" | "0x38" | "fantom" | "ftm" | "0xfa" | "arbitrum" | "0xa4b1" | "optimism" | "0xa" | "pulsechain" | "0x171" | "base" | "0x2105"; -export type EvmDiscoveryApiChainsListInput = "eth" | "mainnet" | "0x1" | "matic" | "0x89" | "polygon" | "bsc" | "binance" | "0x38" | "fantom" | "ftm" | "0xfa" | "arbitrum" | "0xa4b1" | "optimism" | "0xa" | "pulsechain" | "0x171" | "base" | "0x2105"; -export type EvmDiscoveryApiChainsListValue = "eth" | "mainnet" | "0x1" | "matic" | "0x89" | "polygon" | "bsc" | "binance" | "0x38" | "fantom" | "ftm" | "0xfa" | "arbitrum" | "0xa4b1" | "optimism" | "0xa" | "pulsechain" | "0x171" | "base" | "0x2105"; +export type EvmDiscoveryApiChainsListJSON = "eth" | "mainnet" | "0x1" | "matic" | "0x89" | "polygon" | "bsc" | "binance" | "0x38" | "fantom" | "ftm" | "0xfa" | "arbitrum" | "0xa4b1" | "optimism" | "0xa" | "pulsechain" | "0x171" | "base" | "0x2105" | "linea" | "0xe708"; +export type EvmDiscoveryApiChainsListInput = "eth" | "mainnet" | "0x1" | "matic" | "0x89" | "polygon" | "bsc" | "binance" | "0x38" | "fantom" | "ftm" | "0xfa" | "arbitrum" | "0xa4b1" | "optimism" | "0xa" | "pulsechain" | "0x171" | "base" | "0x2105" | "linea" | "0xe708"; +export type EvmDiscoveryApiChainsListValue = "eth" | "mainnet" | "0x1" | "matic" | "0x89" | "polygon" | "bsc" | "binance" | "0x38" | "fantom" | "ftm" | "0xfa" | "arbitrum" | "0xa4b1" | "optimism" | "0xa" | "pulsechain" | "0x171" | "base" | "0x2105" | "linea" | "0xe708"; export abstract class EvmDiscoveryApiChainsList { public static create(input: EvmDiscoveryApiChainsListInput | EvmDiscoveryApiChainsListValue): EvmDiscoveryApiChainsListValue {