Skip to content

Commit

Permalink
fix: fromDate type. (#1220)
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz authored Jul 5, 2024
1 parent 7f8893b commit 77d1254
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .changeset/wet-paws-fail.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions packages/common/evmUtils/generator.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
{
"names": "to_date",
"nativeType": "Date"
},
{
"names": "from_date",
"nativeType": "Date"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

1 comment on commit 77d1254

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage

Title Lines Statements Branches Functions
api-utils Coverage: 20%
20.6% (61/296) 20.48% (17/83) 19.04% (12/63)
auth Coverage: 89%
92.45% (98/106) 83.33% (20/24) 86.66% (26/30)
evm-api Coverage: 76%
78.26% (90/115) 66.66% (6/9) 69.13% (56/81)
common-aptos-utils Coverage: 4%
4.56% (151/3306) 4.49% (25/556) 5.53% (45/813)
common-evm-utils Coverage: 54%
55.5% (2202/3967) 16.3% (172/1055) 36.59% (486/1328)
sol-api Coverage: 97%
97.56% (40/41) 66.66% (6/9) 93.75% (15/16)
common-sol-utils Coverage: 64%
65.42% (229/350) 41.86% (18/43) 50.89% (57/112)
common-streams-utils Coverage: 90%
90.73% (1204/1327) 73.63% (363/493) 82.07% (444/541)
streams Coverage: 91%
90.54% (603/666) 72.34% (68/94) 90.97% (131/144)

Please sign in to comment.