From 8948ffd7d9806414b9bf28512523691ffcc7b4f9 Mon Sep 17 00:00:00 2001 From: b4rtaz Date: Thu, 18 Apr 2024 13:04:02 +0200 Subject: [PATCH 1/3] feat: getWalletHistory. --- .changeset/pink-pianos-nail.md | 7 + .changeset/popular-turkeys-knock.md | 7 + .changeset/rich-ads-lay.md | 7 + .../apiGenerator/src/generator/Generator.ts | 14 +- .../common/evmUtils/generator.config.json | 14 +- .../src/dataTypes/EvmBlock/EvmBlock.ts | 4 +- .../EvmInternalTransaction.test.ts | 18 +- .../EvmInternalTransaction.ts | 65 +++-- .../dataTypes/EvmInternalTransaction/types.ts | 4 - .../EvmTransaction/EvmTransaction.ts | 4 +- .../src/generated/client/abstractClient.ts | 33 +++ .../operations/GetWalletHistoryOperation.ts | 138 ++++++++++ .../src/generated/operations/index.ts | 1 + .../src/generated/operations/operations.ts | 2 + .../src/generated/types/EvmChainList.ts | 6 +- .../types/EvmETransactionCategory.ts | 16 ++ .../src/generated/types/EvmErc20Metadata.ts | 13 +- ...HottestNFTCollectionByTradingVolumeItem.ts | 70 +++++ ...tDataTopCryptoCurrenciesByMarketCapItem.ts | 128 +++++---- ...rketDataTopNFTCollectionByMarketCapItem.ts | 20 ++ .../generated/types/EvmNativeErc20Price.ts | 14 +- .../src/generated/types/EvmNativeTransfer.ts | 135 +++++++++ .../generated/types/EvmNormalizedMetadata.ts | 92 +++++++ .../types/EvmNormalizedMetadataAttribute.ts | 95 +++++++ .../EvmNormalizedMetadataAttributeValue.ts | 16 ++ .../src/generated/types/EvmOrderList.ts | 16 ++ .../generated/types/EvmWalletActiveChains.ts | 13 +- .../src/generated/types/EvmWalletHistory.ts | 72 +++++ .../types/EvmWalletHistoryErc20Transfer.ts | 173 ++++++++++++ .../types/EvmWalletHistoryNftTransfer.ts | 216 +++++++++++++++ .../types/EvmWalletHistoryTransaction.ts | 260 ++++++++++++++++++ .../evmUtils/src/generated/types/index.ts | 10 + .../src/operations/block/getBlockOperation.ts | 5 +- .../getInternalTransactionsOperation.ts | 8 +- .../transaction/getTransactionOperation.ts | 5 +- .../getWalletTransactionsOperation.ts | 6 +- .../test/getWalletActiveChains.test.ts | 2 +- packages/evmApi/src/generated/ClientEvmApi.ts | 5 +- 38 files changed, 1574 insertions(+), 140 deletions(-) create mode 100644 .changeset/pink-pianos-nail.md create mode 100644 .changeset/popular-turkeys-knock.md create mode 100644 .changeset/rich-ads-lay.md create mode 100644 packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmETransactionCategory.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmNativeTransfer.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmNormalizedMetadata.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttribute.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttributeValue.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmOrderList.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmWalletHistory.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmWalletHistoryErc20Transfer.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmWalletHistoryNftTransfer.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts diff --git a/.changeset/pink-pianos-nail.md b/.changeset/pink-pianos-nail.md new file mode 100644 index 0000000000..0605f08322 --- /dev/null +++ b/.changeset/pink-pianos-nail.md @@ -0,0 +1,7 @@ +--- +'@moralisweb3/common-evm-utils': minor +'@moralisweb3/api-generator': minor +'@moralisweb3/evm-api': minor +--- + +The `toJSON` method of the `EvmInternalTransaction` class returns now the same format as the API (names with underscores). diff --git a/.changeset/popular-turkeys-knock.md b/.changeset/popular-turkeys-knock.md new file mode 100644 index 0000000000..0827eea727 --- /dev/null +++ b/.changeset/popular-turkeys-knock.md @@ -0,0 +1,7 @@ +--- +'@moralisweb3/common-evm-utils': minor +'@moralisweb3/api-generator': minor +'@moralisweb3/evm-api': minor +--- + +The `address` property of the `EvmWalletActiveChains` has `EvmAddress` type now. diff --git a/.changeset/rich-ads-lay.md b/.changeset/rich-ads-lay.md new file mode 100644 index 0000000000..3114a2267c --- /dev/null +++ b/.changeset/rich-ads-lay.md @@ -0,0 +1,7 @@ +--- +'@moralisweb3/common-evm-utils': minor +'@moralisweb3/evm-api': minor +'moralis': minor +--- + +Added the `getWalletHistory` method to the EVM API. diff --git a/packages/apiGenerator/src/generator/Generator.ts b/packages/apiGenerator/src/generator/Generator.ts index ac10fdd3ba..2b96d0a6fd 100644 --- a/packages/apiGenerator/src/generator/Generator.ts +++ b/packages/apiGenerator/src/generator/Generator.ts @@ -54,19 +54,27 @@ export class Generator { ) {} public generate() { + const excludedRefs = new Set(this.configuration.mappings.refs.map(r => r.refs).flat()); + this.writer.prepare(); for (const operation of this.contract.operations) { this.generateOperation(operation); } for (const simpleType of this.contract.simpleTypes) { - this.generateSimpleType(simpleType); + if (!excludedRefs.has(simpleType.descriptor.ref.toString())) { + this.generateSimpleType(simpleType); + } } for (const complexType of this.contract.complexTypes) { - this.generateComplexType(complexType); + if (!excludedRefs.has(complexType.descriptor.ref.toString())) { + this.generateComplexType(complexType); + } } for (const unionType of this.contract.unionTypes) { - this.generateUnionType(unionType); + if (!excludedRefs.has(unionType.descriptor.ref.toString())) { + this.generateUnionType(unionType); + } } const abstractClientFileGenerator = new AbstractClientFileGenerator( diff --git a/packages/common/evmUtils/generator.config.json b/packages/common/evmUtils/generator.config.json index c11b255665..9d2ffa9a01 100644 --- a/packages/common/evmUtils/generator.config.json +++ b/packages/common/evmUtils/generator.config.json @@ -22,6 +22,11 @@ "#/components/schemas/erc20Transfer/properties/block_timestamp" ], "nativeType": "Date" + }, + { + "refs": ["#/components/schemas/internalTransaction"], + "className": "EvmInternalTransaction", + "import": "../../dataTypes" } ], "complexTypeProperties": [ @@ -35,7 +40,11 @@ "contract_address", "from_wallet", "to_wallet", - "collection_address" + "collection_address", + + "address", + "to_address", + "from_address" ], "className": "EvmAddress", "import": "../../dataTypes" @@ -108,7 +117,8 @@ "getPairPrice", "resolveAddressToDomain", "getTopCryptoCurrenciesByMarketCap", - "getTopCryptoCurrenciesByTradingVolume" + "getTopCryptoCurrenciesByTradingVolume", + "getWalletHistory" ] } } diff --git a/packages/common/evmUtils/src/dataTypes/EvmBlock/EvmBlock.ts b/packages/common/evmUtils/src/dataTypes/EvmBlock/EvmBlock.ts index b01e5b09e7..2005f7dbc6 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmBlock/EvmBlock.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmBlock/EvmBlock.ts @@ -1,4 +1,4 @@ -import { MoralisDataObject, BigNumber, dateInputToDate } from '@moralisweb3/common-core'; +import { BigNumber, dateInputToDate } from '@moralisweb3/common-core'; import { EvmAddress } from '../EvmAddress'; import { EvmChain } from '../EvmChain'; import { EvmTransaction } from '../EvmTransaction'; @@ -16,7 +16,7 @@ export type EvmBlockish = EvmBlockInput | EvmBlock; * * @category DataType */ -export class EvmBlock implements MoralisDataObject { +export class EvmBlock { /** * Create a new instance of EvmBlock from any valid transaction input * @param data - the EvmBlockish type diff --git a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts index c026b25a2a..ae6fcbda59 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts @@ -2,7 +2,6 @@ import { EvmInternalTransaction } from './EvmInternalTransaction'; import { EvmInternalTransactionInput } from './types'; const exampleInput: EvmInternalTransactionInput = { - chain: '0x1', transactionHash: '0x2ac6283fb30fe33499416b0388ff27145a0eeb6aa8b37bca40af87d7f1c74e2d', blockNumber: 16876143, blockHash: '0xc8d7592122307a771c5172af09699b5a2d36fa540d0fbc656f3d52c619c7536e', @@ -23,7 +22,6 @@ describe('EvmInternalTransaction', () => { it('should create a new EvmInternalTransaction', () => { const transaction = EvmInternalTransaction.create(exampleInput); - expect(transaction.chain.hex).toBe('0x1'); expect(transaction.transactionHash).toBe('0x2ac6283fb30fe33499416b0388ff27145a0eeb6aa8b37bca40af87d7f1c74e2d'); expect(transaction.blockNumber.toString()).toBe('16876143'); expect(transaction.blockHash).toBe('0xc8d7592122307a771c5172af09699b5a2d36fa540d0fbc656f3d52c619c7536e'); @@ -46,14 +44,13 @@ describe('EvmInternalTransaction', () => { const value = transaction.toJSON(); expect(value).toStrictEqual({ - chain: '0x1', from: '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5', to: '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85', - transactionHash: '0x2ac6283fb30fe33499416b0388ff27145a0eeb6aa8b37bca40af87d7f1c74e2d', + transaction_hash: '0x2ac6283fb30fe33499416b0388ff27145a0eeb6aa8b37bca40af87d7f1c74e2d', gas: '263200', - gasUsed: '2569', - blockNumber: '16876143', - blockHash: '0xc8d7592122307a771c5172af09699b5a2d36fa540d0fbc656f3d52c619c7536e', + gas_used: '2569', + block_number: '16876143', + block_nash: '0xc8d7592122307a771c5172af09699b5a2d36fa540d0fbc656f3d52c619c7536e', input: '0x96e494e8d40a37cd10c71cb3896d1b05b6c707e29cb5aeff0278c6fc7e5e5b31623a1baa', output: '0x0000000000000000000000000000000000000000000000000000000000000001', value: '100000', @@ -78,13 +75,6 @@ describe('EvmInternalTransaction', () => { expect(EvmInternalTransaction.equals(transactionA, transactionB)).toBeTruthy(); }); - it('should check inequality when chain is different', () => { - const transactionA = EvmInternalTransaction.create(exampleInput); - const transactionB = EvmInternalTransaction.create({ ...exampleInput, chain: '0x2' }); - - expect(transactionA.equals(transactionB)).toBeFalsy(); - }); - it('should check inequality when transactionHash is different', () => { const transactionA = EvmInternalTransaction.create(exampleInput); const transactionB = EvmInternalTransaction.create({ diff --git a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.ts b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.ts index 6c76dc5036..c16ac6dc0b 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.ts @@ -1,6 +1,5 @@ -import { MoralisDataObject, BigNumber } from '@moralisweb3/common-core'; +import { BigNumber } from '@moralisweb3/common-core'; import { EvmAddress } from '../EvmAddress'; -import { EvmChain } from '../EvmChain'; import { EvmInternalTransactionInput, EvmInternalTransactionData } from './types'; /** @@ -9,6 +8,20 @@ import { EvmInternalTransactionInput, EvmInternalTransactionData } from './types */ export type EvmInternalTransactionish = EvmInternalTransactionInput | EvmInternalTransaction; +export interface EvmInternalTransactionJSON { + readonly transaction_hash: string; + readonly block_number: string; + readonly block_hash: string; + readonly type: string; + readonly from: string; + readonly to: string; + readonly value: string; + readonly gas: string; + readonly gas_used: string; + readonly input: string; + readonly output: string; +} + /** * The EvmTranaction is a representation of a published transaction. * @@ -16,7 +29,7 @@ export type EvmInternalTransactionish = EvmInternalTransactionInput | EvmInterna * * @category DataType */ -export class EvmInternalTransaction implements MoralisDataObject { +export class EvmInternalTransaction { /** * Create a new instance of EvmInternalTransaction from any valid transaction input * @param data - the EvmInternalTransactionish type @@ -32,6 +45,22 @@ export class EvmInternalTransaction implements MoralisDataObject { return new EvmInternalTransaction(data); } + static fromJSON(json: EvmInternalTransactionJSON) { + return new EvmInternalTransaction({ + blockHash: json.block_hash, + blockNumber: json.block_number, + from: json.from, + gas: json.gas, + gasUsed: json.gas_used, + input: json.input, + output: json.output, + to: json.to, + transactionHash: json.transaction_hash, + type: json.type, + value: json.value, + }); + } + private _data: EvmInternalTransactionData; constructor(data: EvmInternalTransactionInput) { @@ -39,7 +68,6 @@ export class EvmInternalTransaction implements MoralisDataObject { } static parse = (data: EvmInternalTransactionInput): EvmInternalTransactionData => ({ - chain: EvmChain.create(data.chain), from: EvmAddress.create(data.from), to: EvmAddress.create(data.to), transactionHash: data.transactionHash, @@ -66,10 +94,6 @@ export class EvmInternalTransaction implements MoralisDataObject { const transactionA = EvmInternalTransaction.create(dataA); const transactionB = EvmInternalTransaction.create(dataB); - if (!transactionA._data.chain.equals(transactionB._data.chain)) { - return false; - } - if (transactionA._data.transactionHash !== transactionB._data.transactionHash) { return false; } @@ -89,17 +113,20 @@ export class EvmInternalTransaction implements MoralisDataObject { return EvmInternalTransaction.equals(this, data); } - toJSON() { + toJSON(): EvmInternalTransactionJSON { const data = this._data; return { - ...data, - to: data.to?.toJSON(), - from: data.from?.toJSON(), - gas: data.gas?.toString(), - gasUsed: data.gasUsed?.toString(), - value: data.value?.toString(), - chain: data.chain?.toJSON(), - blockNumber: data.blockNumber?.toString(), + block_hash: data.blockHash, + input: data.input, + output: data.output, + transaction_hash: data.transactionHash, + type: data.type, + to: data.to.toJSON(), + from: data.from.toJSON(), + gas: data.gas.toString(), + gas_used: data.gasUsed.toString(), + value: data.value.toString(), + block_number: data.blockNumber.toString(), }; } @@ -114,10 +141,6 @@ export class EvmInternalTransaction implements MoralisDataObject { return this._data; } - get chain() { - return this._data.chain; - } - get transactionHash() { return this._data.transactionHash; } diff --git a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/types.ts b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/types.ts index 2a4841a11f..aa3b343e16 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/types.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/types.ts @@ -1,6 +1,5 @@ import { BigNumber, BigNumberish } from '@moralisweb3/common-core'; import { EvmAddressish, EvmAddress } from '../EvmAddress'; -import { EvmChain, EvmChainish } from '../EvmChain'; /** * Valid EvmInternalTransactionLog input. @@ -8,7 +7,6 @@ import { EvmChain, EvmChainish } from '../EvmChain'; * @example * ```ts * const input = { - * "chain": "0x1", * "transactionHash": "0x2ac6283fb30fe33499416b0388ff27145a0eeb6aa8b37bca40af87d7f1c74e2d", * "block_number": 16876143, * "block_hash": "0xc8d7592122307a771c5172af09699b5a2d36fa540d0fbc656f3d52c619c7536e", @@ -24,7 +22,6 @@ import { EvmChain, EvmChainish } from '../EvmChain'; * ``` */ export interface EvmInternalTransactionInput { - chain: EvmChainish; transactionHash: string; blockNumber: BigNumberish; blockHash: string; @@ -42,7 +39,6 @@ export interface EvmInternalTransactionInput { * Represents a processed internal transaction log. */ export interface EvmInternalTransactionData { - chain: EvmChain; transactionHash: string; blockNumber: BigNumber; blockHash: string; diff --git a/packages/common/evmUtils/src/dataTypes/EvmTransaction/EvmTransaction.ts b/packages/common/evmUtils/src/dataTypes/EvmTransaction/EvmTransaction.ts index de9d6f9e9a..d71d6956a7 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmTransaction/EvmTransaction.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmTransaction/EvmTransaction.ts @@ -1,4 +1,4 @@ -import { MoralisDataObject, maybe, BigNumber, dateInputToDate } from '@moralisweb3/common-core'; +import { maybe, BigNumber, dateInputToDate } from '@moralisweb3/common-core'; import { EvmAddress } from '../EvmAddress'; import { EvmChain } from '../EvmChain'; import { EvmNative } from '../EvmNative'; @@ -20,7 +20,7 @@ export type EvmTransactionish = EvmTransactionInput | EvmTransaction; * * @category DataType */ -export class EvmTransaction implements MoralisDataObject { +export class EvmTransaction { /** * Create a new instance of EvmTransaction from any valid transaction input * @param data - the EvmTransactionish type diff --git a/packages/common/evmUtils/src/generated/client/abstractClient.ts b/packages/common/evmUtils/src/generated/client/abstractClient.ts index 2b7187ba3c..dfbe2d303b 100644 --- a/packages/common/evmUtils/src/generated/client/abstractClient.ts +++ b/packages/common/evmUtils/src/generated/client/abstractClient.ts @@ -3,6 +3,8 @@ import { EvmTradeCollection, EvmTradeCollectionJSON } from '../types/EvmTradeCol import { GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationRequestJSON } from '../operations/GetMultipleTokenPricesOperation'; import { EvmErc20Price, EvmErc20PriceJSON } from '../types/EvmErc20Price'; import { EvmGetMultipleTokenPricesDto, EvmGetMultipleTokenPricesDtoInput, EvmGetMultipleTokenPricesDtoJSON } from '../types/EvmGetMultipleTokenPricesDto'; +import { GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationRequestJSON } from '../operations/GetWalletHistoryOperation'; +import { EvmWalletHistory, EvmWalletHistoryJSON } from '../types/EvmWalletHistory'; import { GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationRequestJSON } from '../operations/GetWalletTokenBalancesPriceOperation'; import { EvmErc20TokenBalanceWithPriceResult, EvmErc20TokenBalanceWithPriceResultJSON } from '../types/EvmErc20TokenBalanceWithPriceResult'; import { GetWalletNetWorthOperation, GetWalletNetWorthOperationRequest, GetWalletNetWorthOperationRequestJSON } from '../operations/GetWalletNetWorthOperation'; @@ -310,6 +312,37 @@ export abstract class AbstractClient { >(ReviewContractsOperation), }; public readonly wallets = { + /** + * @description Get the complete history of a wallet + * @param request Request with parameters. + * @param {Object} request.address The address of the wallet + * @param {Object} [request.chain] The chain to query (optional) + * @param {Number} [request.fromBlock] The minimum block number from which to get the transactions + * * 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 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) + * * 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) + * * Provide the param 'to_block' or 'to_date' + * * 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.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) + * @param {Number} [request.limit] The desired page size of the result. (optional) + * @returns {Object} Response for the request. + */ + getWalletHistory: this.createEndpoint< + GetWalletHistoryOperationRequest, + GetWalletHistoryOperationRequestJSON, + EvmWalletHistory, + EvmWalletHistoryJSON + >(GetWalletHistoryOperation), /** * @description Get token balances for a specific wallet address and their token prices in USD. * @param request Request with parameters. diff --git a/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts b/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts new file mode 100644 index 0000000000..684118c1d2 --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetWalletHistoryOperation.ts @@ -0,0 +1,138 @@ +import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmOrderList, EvmOrderListValue, EvmOrderListInput, EvmOrderListJSON } from '../types/EvmOrderList'; +import { EvmWalletHistory, EvmWalletHistoryJSON } from '../types/EvmWalletHistory'; + +// request parameters: +// - chain ($ref: #/components/schemas/chainList) +// - from_block ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/1/schema) +// - to_block ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/2/schema) +// - from_date ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/3/schema) +// - to_date ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/4/schema) +// - 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) +// - order ($ref: #/components/schemas/orderList) +// - limit ($ref: #/paths/~1wallets~1{address}~1history/get/parameters/11/schema) + +export interface GetWalletHistoryOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description The minimum block number from which to get the transactions + * * Provide the param 'from_block' or 'from_date' + * * If 'from_date' and 'from_block' are provided, 'from_block' will be used. + */ + readonly fromBlock?: number; + /** + * @description 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. + */ + readonly toBlock?: number; + /** + * @description 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. + */ + readonly fromDate?: string; + /** + * @description Get the transactions up to this date (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. + */ + readonly toDate?: Date; + /** + * @description The address of the wallet + */ + readonly address: EvmAddressInput | EvmAddress; + /** + * @description If the result should contain the internal transactions. + */ + readonly includeInternalTransactions?: boolean; + /** + * @description Set the input data from the result + */ + readonly includeInputData?: boolean; + /** + * @description If the result should contain the nft metadata. + */ + readonly nftMetadata?: boolean; + /** + * @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; + /** + * @description The desired page size of the result. + */ + readonly limit?: number; +} + +export interface GetWalletHistoryOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly from_block?: number; + readonly to_block?: number; + readonly from_date?: string; + readonly to_date?: string; + readonly address: EvmAddressJSON; + readonly include_internal_transactions?: boolean; + readonly include_input_data?: boolean; + readonly nft_metadata?: boolean; + readonly cursor?: string; + readonly order?: EvmOrderListJSON; + readonly limit?: number; +} + +export type GetWalletHistoryOperationResponse = EvmWalletHistory; +export type GetWalletHistoryOperationResponseJSON = EvmWalletHistoryJSON; + +export const GetWalletHistoryOperation = { + operationId: "getWalletHistory", + 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"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmWalletHistoryJSON): EvmWalletHistory { + return EvmWalletHistory.fromJSON(json); + }, + + serializeRequest(request: GetWalletHistoryOperationRequest): GetWalletHistoryOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const fromBlock = request.fromBlock; + const toBlock = request.toBlock; + const fromDate = request.fromDate; + const toDate = request.toDate; + const address = EvmAddress.create(request.address); + const includeInternalTransactions = request.includeInternalTransactions; + const includeInputData = request.includeInputData; + const nftMetadata = request.nftMetadata; + const cursor = request.cursor; + const order = request.order ? EvmOrderList.create(request.order) : undefined; + const limit = request.limit; + return { + chain: chain ? chain.toJSON() : undefined, + from_block: fromBlock, + to_block: toBlock, + from_date: fromDate, + to_date: toDate !== undefined ? toDate.toISOString() : undefined, + address: address.toJSON(), + include_internal_transactions: includeInternalTransactions, + include_input_data: includeInputData, + nft_metadata: nftMetadata, + cursor: cursor, + order: order ? order : undefined, + limit: limit, + }; + }, + +} diff --git a/packages/common/evmUtils/src/generated/operations/index.ts b/packages/common/evmUtils/src/generated/operations/index.ts index 018de417ff..c305095a6d 100644 --- a/packages/common/evmUtils/src/generated/operations/index.ts +++ b/packages/common/evmUtils/src/generated/operations/index.ts @@ -1,5 +1,6 @@ export * from './GetNFTTradesOperation'; export * from './GetMultipleTokenPricesOperation'; +export * from './GetWalletHistoryOperation'; export * from './GetWalletTokenBalancesPriceOperation'; export * from './GetWalletNetWorthOperation'; export * from './Web3ApiVersionOperation'; diff --git a/packages/common/evmUtils/src/generated/operations/operations.ts b/packages/common/evmUtils/src/generated/operations/operations.ts index 2a6769e742..82880f024a 100644 --- a/packages/common/evmUtils/src/generated/operations/operations.ts +++ b/packages/common/evmUtils/src/generated/operations/operations.ts @@ -1,5 +1,6 @@ import { GetNFTTradesOperation } from './GetNFTTradesOperation'; import { GetMultipleTokenPricesOperation } from './GetMultipleTokenPricesOperation'; +import { GetWalletHistoryOperation } from './GetWalletHistoryOperation'; import { GetWalletTokenBalancesPriceOperation } from './GetWalletTokenBalancesPriceOperation'; import { GetWalletNetWorthOperation } from './GetWalletNetWorthOperation'; import { Web3ApiVersionOperation } from './Web3ApiVersionOperation'; @@ -23,6 +24,7 @@ import { GetBlockStatsOperation } from './GetBlockStatsOperation'; export const operations = [ GetNFTTradesOperation, GetMultipleTokenPricesOperation, + GetWalletHistoryOperation, GetWalletTokenBalancesPriceOperation, GetWalletNetWorthOperation, Web3ApiVersionOperation, diff --git a/packages/common/evmUtils/src/generated/types/EvmChainList.ts b/packages/common/evmUtils/src/generated/types/EvmChainList.ts index d8ff44eecc..e9868ef373 100644 --- a/packages/common/evmUtils/src/generated/types/EvmChainList.ts +++ b/packages/common/evmUtils/src/generated/types/EvmChainList.ts @@ -1,9 +1,9 @@ // $ref: #/components/schemas/chainList // typeName: chainList -export type EvmChainListJSON = "eth" | "0x1" | "goerli" | "0x5" | "sepolia" | "0xaa36a7" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fantom" | "0xfa" | "palm" | "0x2a15c308d" | "cronos" | "0x19" | "arbitrum" | "0xa4b1" | "chiliz" | "0x15b38" | "chiliz testnet" | "0x15b32" | "gnosis" | "0x64" | "gnosis testnet" | "0x27d8" | "base" | "0x2105" | "base testnet" | "0x14a33" | "optimism" | "0xa"; -export type EvmChainListInput = "eth" | "0x1" | "goerli" | "0x5" | "sepolia" | "0xaa36a7" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fantom" | "0xfa" | "palm" | "0x2a15c308d" | "cronos" | "0x19" | "arbitrum" | "0xa4b1" | "chiliz" | "0x15b38" | "chiliz testnet" | "0x15b32" | "gnosis" | "0x64" | "gnosis testnet" | "0x27d8" | "base" | "0x2105" | "base testnet" | "0x14a33" | "optimism" | "0xa"; -export type EvmChainListValue = "eth" | "0x1" | "goerli" | "0x5" | "sepolia" | "0xaa36a7" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fantom" | "0xfa" | "palm" | "0x2a15c308d" | "cronos" | "0x19" | "arbitrum" | "0xa4b1" | "chiliz" | "0x15b38" | "chiliz testnet" | "0x15b32" | "gnosis" | "0x64" | "gnosis testnet" | "0x27d8" | "base" | "0x2105" | "base testnet" | "0x14a33" | "optimism" | "0xa"; +export type EvmChainListJSON = "eth" | "0x1" | "goerli" | "0x5" | "sepolia" | "0xaa36a7" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fantom" | "0xfa" | "palm" | "0x2a15c308d" | "cronos" | "0x19" | "arbitrum" | "0xa4b1" | "chiliz" | "0x15b38" | "chiliz testnet" | "0x15b32" | "gnosis" | "0x64" | "gnosis testnet" | "0x27d8" | "base" | "0x2105" | "base testnet" | "0x14a33" | "base sepolia" | "0x14a34" | "optimism" | "0xa" | "holesky" | "0x4268" | "polygon amoy" | "0x13882" | "linea" | "0xe708"; +export type EvmChainListInput = "eth" | "0x1" | "goerli" | "0x5" | "sepolia" | "0xaa36a7" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fantom" | "0xfa" | "palm" | "0x2a15c308d" | "cronos" | "0x19" | "arbitrum" | "0xa4b1" | "chiliz" | "0x15b38" | "chiliz testnet" | "0x15b32" | "gnosis" | "0x64" | "gnosis testnet" | "0x27d8" | "base" | "0x2105" | "base testnet" | "0x14a33" | "base sepolia" | "0x14a34" | "optimism" | "0xa" | "holesky" | "0x4268" | "polygon amoy" | "0x13882" | "linea" | "0xe708"; +export type EvmChainListValue = "eth" | "0x1" | "goerli" | "0x5" | "sepolia" | "0xaa36a7" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fantom" | "0xfa" | "palm" | "0x2a15c308d" | "cronos" | "0x19" | "arbitrum" | "0xa4b1" | "chiliz" | "0x15b38" | "chiliz testnet" | "0x15b32" | "gnosis" | "0x64" | "gnosis testnet" | "0x27d8" | "base" | "0x2105" | "base testnet" | "0x14a33" | "base sepolia" | "0x14a34" | "optimism" | "0xa" | "holesky" | "0x4268" | "polygon amoy" | "0x13882" | "linea" | "0xe708"; export abstract class EvmChainList { public static create(input: EvmChainListInput | EvmChainListValue): EvmChainListValue { diff --git a/packages/common/evmUtils/src/generated/types/EvmETransactionCategory.ts b/packages/common/evmUtils/src/generated/types/EvmETransactionCategory.ts new file mode 100644 index 0000000000..2852a4f35f --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmETransactionCategory.ts @@ -0,0 +1,16 @@ +// $ref: #/components/schemas/ETransactionCategory +// typeName: ETransactionCategory + +export type EvmETransactionCategoryJSON = "send" | "receive" | "token send" | "token receive" | "nft send" | "nft receive" | "token swap" | "deposit" | "withdraw" | "nft purchase" | "nft sale" | "airdrop" | "mint" | "burn" | "borrow" | "contract interaction"; +export type EvmETransactionCategoryInput = "send" | "receive" | "token send" | "token receive" | "nft send" | "nft receive" | "token swap" | "deposit" | "withdraw" | "nft purchase" | "nft sale" | "airdrop" | "mint" | "burn" | "borrow" | "contract interaction"; +export type EvmETransactionCategoryValue = "send" | "receive" | "token send" | "token receive" | "nft send" | "nft receive" | "token swap" | "deposit" | "withdraw" | "nft purchase" | "nft sale" | "airdrop" | "mint" | "burn" | "borrow" | "contract interaction"; + +export abstract class EvmETransactionCategory { + public static create(input: EvmETransactionCategoryInput | EvmETransactionCategoryValue): EvmETransactionCategoryValue { + return input; + } + + public static fromJSON(json: EvmETransactionCategoryJSON): EvmETransactionCategoryValue { + return json; + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmErc20Metadata.ts b/packages/common/evmUtils/src/generated/types/EvmErc20Metadata.ts index 47a53e4fd5..6dd1efe4f5 100644 --- a/packages/common/evmUtils/src/generated/types/EvmErc20Metadata.ts +++ b/packages/common/evmUtils/src/generated/types/EvmErc20Metadata.ts @@ -1,3 +1,4 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; import { BigNumber, BigNumberInput, BigNumberJSON } from '@moralisweb3/common-core'; // $ref: #/components/schemas/erc20Metadata @@ -18,7 +19,7 @@ import { BigNumber, BigNumberInput, BigNumberJSON } from '@moralisweb3/common-co // - verified_contract ($ref: #/components/schemas/erc20Metadata/properties/verified_contract) export interface EvmErc20MetadataJSON { - readonly address: string; + readonly address: EvmAddressJSON; readonly address_label?: string; readonly name: string; readonly symbol: string; @@ -34,7 +35,7 @@ export interface EvmErc20MetadataJSON { } export interface EvmErc20MetadataInput { - readonly address: string; + readonly address: EvmAddressInput | EvmAddress; readonly addressLabel?: string; readonly name: string; readonly symbol: string; @@ -59,7 +60,7 @@ export class EvmErc20Metadata { public static fromJSON(json: EvmErc20MetadataJSON): EvmErc20Metadata { const input: EvmErc20MetadataInput = { - address: json.address, + address: EvmAddress.fromJSON(json.address), addressLabel: json.address_label, name: json.name, symbol: json.symbol, @@ -79,7 +80,7 @@ export class EvmErc20Metadata { /** * @description The address of the token contract */ - public readonly address: string; + public readonly address: EvmAddress; /** * @description The label of the address */ @@ -124,7 +125,7 @@ export class EvmErc20Metadata { public readonly verifiedContract?: boolean; private constructor(input: EvmErc20MetadataInput) { - this.address = input.address; + this.address = EvmAddress.create(input.address); this.addressLabel = input.addressLabel; this.name = input.name; this.symbol = input.symbol; @@ -141,7 +142,7 @@ export class EvmErc20Metadata { public toJSON(): EvmErc20MetadataJSON { return { - address: this.address, + address: this.address.toJSON(), address_label: this.addressLabel, name: this.name, symbol: this.symbol, diff --git a/packages/common/evmUtils/src/generated/types/EvmMarketDataHottestNFTCollectionByTradingVolumeItem.ts b/packages/common/evmUtils/src/generated/types/EvmMarketDataHottestNFTCollectionByTradingVolumeItem.ts index 417e79cc44..bb72166cb8 100644 --- a/packages/common/evmUtils/src/generated/types/EvmMarketDataHottestNFTCollectionByTradingVolumeItem.ts +++ b/packages/common/evmUtils/src/generated/types/EvmMarketDataHottestNFTCollectionByTradingVolumeItem.ts @@ -12,6 +12,13 @@ import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; // - volume_24hr_percent_change ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/volume_24hr_percent_change) // - average_price_usd ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/average_price_usd) // - collection_address ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/collection_address) +// - average_price ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/average_price) +// - floor_price ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/floor_price) +// - floor_price_usd_24hr_percent_change ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/floor_price_usd_24hr_percent_change) +// - floor_price_7d_percent_change ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/floor_price_7d_percent_change) +// - floor_price_usd_7d_percent_change ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/floor_price_usd_7d_percent_change) +// - floor_price_30d_percent_change ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/floor_price_30d_percent_change) +// - floor_price_usd_30d_percent_change ($ref: #/components/schemas/marketDataHottestNFTCollectionByTradingVolume/items/properties/floor_price_usd_30d_percent_change) export interface EvmMarketDataHottestNFTCollectionByTradingVolumeItemJSON { readonly rank: number; @@ -23,6 +30,13 @@ export interface EvmMarketDataHottestNFTCollectionByTradingVolumeItemJSON { readonly volume_24hr_percent_change: string; readonly average_price_usd?: string; readonly collection_address: EvmAddressJSON; + readonly average_price?: string; + readonly floor_price?: string; + readonly floor_price_usd_24hr_percent_change?: string; + readonly floor_price_7d_percent_change?: string; + readonly floor_price_usd_7d_percent_change?: string; + readonly floor_price_30d_percent_change?: string; + readonly floor_price_usd_30d_percent_change?: string; } export interface EvmMarketDataHottestNFTCollectionByTradingVolumeItemInput { @@ -35,6 +49,13 @@ export interface EvmMarketDataHottestNFTCollectionByTradingVolumeItemInput { readonly volume24hrPercentChange: string; readonly averagePriceUsd?: string; readonly collectionAddress: EvmAddressInput | EvmAddress; + readonly averagePrice?: string; + readonly floorPrice?: string; + readonly floorPriceUsd24hrPercentChange?: string; + readonly floorPrice7dPercentChange?: string; + readonly floorPriceUsd7dPercentChange?: string; + readonly floorPrice30dPercentChange?: string; + readonly floorPriceUsd30dPercentChange?: string; } export class EvmMarketDataHottestNFTCollectionByTradingVolumeItem { @@ -56,6 +77,13 @@ export class EvmMarketDataHottestNFTCollectionByTradingVolumeItem { volume24hrPercentChange: json.volume_24hr_percent_change, averagePriceUsd: json.average_price_usd, collectionAddress: EvmAddress.fromJSON(json.collection_address), + averagePrice: json.average_price, + floorPrice: json.floor_price, + floorPriceUsd24hrPercentChange: json.floor_price_usd_24hr_percent_change, + floorPrice7dPercentChange: json.floor_price_7d_percent_change, + floorPriceUsd7dPercentChange: json.floor_price_usd_7d_percent_change, + floorPrice30dPercentChange: json.floor_price_30d_percent_change, + floorPriceUsd30dPercentChange: json.floor_price_usd_30d_percent_change, }; return EvmMarketDataHottestNFTCollectionByTradingVolumeItem.create(input); } @@ -96,6 +124,34 @@ export class EvmMarketDataHottestNFTCollectionByTradingVolumeItem { * @description The collection address */ public readonly collectionAddress: EvmAddress; + /** + * @description The average price + */ + public readonly averagePrice?: string; + /** + * @description The floor price + */ + public readonly floorPrice?: string; + /** + * @description The floor price usd 24hr percent change + */ + public readonly floorPriceUsd24hrPercentChange?: string; + /** + * @description The floor price 7d percent change + */ + public readonly floorPrice7dPercentChange?: string; + /** + * @description The floor price usd 7d percent change + */ + public readonly floorPriceUsd7dPercentChange?: string; + /** + * @description The floor price 30d percent change + */ + public readonly floorPrice30dPercentChange?: string; + /** + * @description The floor price usd 30d percent change + */ + public readonly floorPriceUsd30dPercentChange?: string; private constructor(input: EvmMarketDataHottestNFTCollectionByTradingVolumeItemInput) { this.rank = input.rank; @@ -107,6 +163,13 @@ export class EvmMarketDataHottestNFTCollectionByTradingVolumeItem { this.volume24hrPercentChange = input.volume24hrPercentChange; this.averagePriceUsd = input.averagePriceUsd; this.collectionAddress = EvmAddress.create(input.collectionAddress); + this.averagePrice = input.averagePrice; + this.floorPrice = input.floorPrice; + this.floorPriceUsd24hrPercentChange = input.floorPriceUsd24hrPercentChange; + this.floorPrice7dPercentChange = input.floorPrice7dPercentChange; + this.floorPriceUsd7dPercentChange = input.floorPriceUsd7dPercentChange; + this.floorPrice30dPercentChange = input.floorPrice30dPercentChange; + this.floorPriceUsd30dPercentChange = input.floorPriceUsd30dPercentChange; } public toJSON(): EvmMarketDataHottestNFTCollectionByTradingVolumeItemJSON { @@ -120,6 +183,13 @@ export class EvmMarketDataHottestNFTCollectionByTradingVolumeItem { volume_24hr_percent_change: this.volume24hrPercentChange, average_price_usd: this.averagePriceUsd, collection_address: this.collectionAddress.toJSON(), + average_price: this.averagePrice, + floor_price: this.floorPrice, + floor_price_usd_24hr_percent_change: this.floorPriceUsd24hrPercentChange, + floor_price_7d_percent_change: this.floorPrice7dPercentChange, + floor_price_usd_7d_percent_change: this.floorPriceUsd7dPercentChange, + floor_price_30d_percent_change: this.floorPrice30dPercentChange, + floor_price_usd_30d_percent_change: this.floorPriceUsd30dPercentChange, } } } diff --git a/packages/common/evmUtils/src/generated/types/EvmMarketDataTopCryptoCurrenciesByMarketCapItem.ts b/packages/common/evmUtils/src/generated/types/EvmMarketDataTopCryptoCurrenciesByMarketCapItem.ts index babb66c086..8dc74a1f07 100644 --- a/packages/common/evmUtils/src/generated/types/EvmMarketDataTopCryptoCurrenciesByMarketCapItem.ts +++ b/packages/common/evmUtils/src/generated/types/EvmMarketDataTopCryptoCurrenciesByMarketCapItem.ts @@ -9,17 +9,20 @@ // - max_supply ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/max_supply) // - market_cap_usd ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/market_cap_usd) // - market_cap_rank ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/market_cap_rank) -// - market_cap_24h_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/market_cap_24h_change) -// - market_cap_24h_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/market_cap_24h_percent_change) +// - market_cap_24hr_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/market_cap_24hr_change) +// - market_cap_24hr_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/market_cap_24hr_percent_change) // - total_volume ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/total_volume) -// - price_usd ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/price_usd) -// - usd_price_24h_high ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24h_high) -// - usd_price_24h_low ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24h_low) -// - usd_price_24h_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24h_change) -// - usd_price_24h_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24h_percent_change) +// - usd_price ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price) +// - usd_price_24hr_high ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24hr_high) +// - usd_price_24hr_low ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24hr_low) +// - usd_price_24hr_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24hr_change) +// - usd_price_24hr_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_24hr_percent_change) // - usd_price_ath ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_ath) // - ath_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/ath_percent_change) // - ath_date ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/ath_date) +// - usd_price_1hr_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_1hr_percent_change) +// - usd_price_7d_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_7d_percent_change) +// - usd_price_30d_percent_change ($ref: #/components/schemas/marketDataTopCryptoCurrenciesByMarketCap/items/properties/usd_price_30d_percent_change) export interface EvmMarketDataTopCryptoCurrenciesByMarketCapItemJSON { readonly symbol: string; @@ -30,17 +33,20 @@ export interface EvmMarketDataTopCryptoCurrenciesByMarketCapItemJSON { readonly max_supply: string; readonly market_cap_usd: string; readonly market_cap_rank: string; - readonly market_cap_24h_change: string; - readonly market_cap_24h_percent_change: string; + readonly market_cap_24hr_change: string; + readonly market_cap_24hr_percent_change: string; readonly total_volume: string; - readonly price_usd: string; - readonly usd_price_24h_high: string; - readonly usd_price_24h_low: string; - readonly usd_price_24h_change: string; - readonly usd_price_24h_percent_change: string; + readonly usd_price?: string; + readonly usd_price_24hr_high: string; + readonly usd_price_24hr_low: string; + readonly usd_price_24hr_change: string; + readonly usd_price_24hr_percent_change: string; readonly usd_price_ath: string; readonly ath_percent_change: string; readonly ath_date: string; + readonly usd_price_1hr_percent_change?: string; + readonly usd_price_7d_percent_change?: string; + readonly usd_price_30d_percent_change?: string; } export interface EvmMarketDataTopCryptoCurrenciesByMarketCapItemInput { @@ -52,17 +58,20 @@ export interface EvmMarketDataTopCryptoCurrenciesByMarketCapItemInput { readonly maxSupply: string; readonly marketCapUsd: string; readonly marketCapRank: string; - readonly marketCap24hChange: string; - readonly marketCap24hPercentChange: string; + readonly marketCap24hrChange: string; + readonly marketCap24hrPercentChange: string; readonly totalVolume: string; - readonly priceUsd: string; - readonly usdPrice24hHigh: string; - readonly usdPrice24hLow: string; - readonly usdPrice24hChange: string; - readonly usdPrice24hPercentChange: string; + readonly usdPrice?: string; + readonly usdPrice24hrHigh: string; + readonly usdPrice24hrLow: string; + readonly usdPrice24hrChange: string; + readonly usdPrice24hrPercentChange: string; readonly usdPriceAth: string; readonly athPercentChange: string; readonly athDate: string; + readonly usdPrice1hrPercentChange?: string; + readonly usdPrice7dPercentChange?: string; + readonly usdPrice30dPercentChange?: string; } export class EvmMarketDataTopCryptoCurrenciesByMarketCapItem { @@ -83,17 +92,20 @@ export class EvmMarketDataTopCryptoCurrenciesByMarketCapItem { maxSupply: json.max_supply, marketCapUsd: json.market_cap_usd, marketCapRank: json.market_cap_rank, - marketCap24hChange: json.market_cap_24h_change, - marketCap24hPercentChange: json.market_cap_24h_percent_change, + marketCap24hrChange: json.market_cap_24hr_change, + marketCap24hrPercentChange: json.market_cap_24hr_percent_change, totalVolume: json.total_volume, - priceUsd: json.price_usd, - usdPrice24hHigh: json.usd_price_24h_high, - usdPrice24hLow: json.usd_price_24h_low, - usdPrice24hChange: json.usd_price_24h_change, - usdPrice24hPercentChange: json.usd_price_24h_percent_change, + usdPrice: json.usd_price, + usdPrice24hrHigh: json.usd_price_24hr_high, + usdPrice24hrLow: json.usd_price_24hr_low, + usdPrice24hrChange: json.usd_price_24hr_change, + usdPrice24hrPercentChange: json.usd_price_24hr_percent_change, usdPriceAth: json.usd_price_ath, athPercentChange: json.ath_percent_change, athDate: json.ath_date, + usdPrice1hrPercentChange: json.usd_price_1hr_percent_change, + usdPrice7dPercentChange: json.usd_price_7d_percent_change, + usdPrice30dPercentChange: json.usd_price_30d_percent_change, }; return EvmMarketDataTopCryptoCurrenciesByMarketCapItem.create(input); } @@ -133,11 +145,11 @@ export class EvmMarketDataTopCryptoCurrenciesByMarketCapItem { /** * @description The market cap 24h change */ - public readonly marketCap24hChange: string; + public readonly marketCap24hrChange: string; /** * @description The market cap 24h percent change */ - public readonly marketCap24hPercentChange: string; + public readonly marketCap24hrPercentChange: string; /** * @description The total volume */ @@ -145,23 +157,23 @@ export class EvmMarketDataTopCryptoCurrenciesByMarketCapItem { /** * @description The price in USD */ - public readonly priceUsd: string; + public readonly usdPrice?: string; /** * @description The price 24h high */ - public readonly usdPrice24hHigh: string; + public readonly usdPrice24hrHigh: string; /** * @description The price 24h low */ - public readonly usdPrice24hLow: string; + public readonly usdPrice24hrLow: string; /** * @description The price 24h change */ - public readonly usdPrice24hChange: string; + public readonly usdPrice24hrChange: string; /** * @description The price 24h percent change */ - public readonly usdPrice24hPercentChange: string; + public readonly usdPrice24hrPercentChange: string; /** * @description The price ath */ @@ -174,6 +186,18 @@ export class EvmMarketDataTopCryptoCurrenciesByMarketCapItem { * @description The ath date */ public readonly athDate: string; + /** + * @description The price 1h percent change + */ + public readonly usdPrice1hrPercentChange?: string; + /** + * @description The price 7d percent change + */ + public readonly usdPrice7dPercentChange?: string; + /** + * @description The price 30d percent change + */ + public readonly usdPrice30dPercentChange?: string; private constructor(input: EvmMarketDataTopCryptoCurrenciesByMarketCapItemInput) { this.symbol = input.symbol; @@ -184,17 +208,20 @@ export class EvmMarketDataTopCryptoCurrenciesByMarketCapItem { this.maxSupply = input.maxSupply; this.marketCapUsd = input.marketCapUsd; this.marketCapRank = input.marketCapRank; - this.marketCap24hChange = input.marketCap24hChange; - this.marketCap24hPercentChange = input.marketCap24hPercentChange; + this.marketCap24hrChange = input.marketCap24hrChange; + this.marketCap24hrPercentChange = input.marketCap24hrPercentChange; this.totalVolume = input.totalVolume; - this.priceUsd = input.priceUsd; - this.usdPrice24hHigh = input.usdPrice24hHigh; - this.usdPrice24hLow = input.usdPrice24hLow; - this.usdPrice24hChange = input.usdPrice24hChange; - this.usdPrice24hPercentChange = input.usdPrice24hPercentChange; + this.usdPrice = input.usdPrice; + this.usdPrice24hrHigh = input.usdPrice24hrHigh; + this.usdPrice24hrLow = input.usdPrice24hrLow; + this.usdPrice24hrChange = input.usdPrice24hrChange; + this.usdPrice24hrPercentChange = input.usdPrice24hrPercentChange; this.usdPriceAth = input.usdPriceAth; this.athPercentChange = input.athPercentChange; this.athDate = input.athDate; + this.usdPrice1hrPercentChange = input.usdPrice1hrPercentChange; + this.usdPrice7dPercentChange = input.usdPrice7dPercentChange; + this.usdPrice30dPercentChange = input.usdPrice30dPercentChange; } public toJSON(): EvmMarketDataTopCryptoCurrenciesByMarketCapItemJSON { @@ -207,17 +234,20 @@ export class EvmMarketDataTopCryptoCurrenciesByMarketCapItem { max_supply: this.maxSupply, market_cap_usd: this.marketCapUsd, market_cap_rank: this.marketCapRank, - market_cap_24h_change: this.marketCap24hChange, - market_cap_24h_percent_change: this.marketCap24hPercentChange, + market_cap_24hr_change: this.marketCap24hrChange, + market_cap_24hr_percent_change: this.marketCap24hrPercentChange, total_volume: this.totalVolume, - price_usd: this.priceUsd, - usd_price_24h_high: this.usdPrice24hHigh, - usd_price_24h_low: this.usdPrice24hLow, - usd_price_24h_change: this.usdPrice24hChange, - usd_price_24h_percent_change: this.usdPrice24hPercentChange, + usd_price: this.usdPrice, + usd_price_24hr_high: this.usdPrice24hrHigh, + usd_price_24hr_low: this.usdPrice24hrLow, + usd_price_24hr_change: this.usdPrice24hrChange, + usd_price_24hr_percent_change: this.usdPrice24hrPercentChange, usd_price_ath: this.usdPriceAth, ath_percent_change: this.athPercentChange, ath_date: this.athDate, + usd_price_1hr_percent_change: this.usdPrice1hrPercentChange, + usd_price_7d_percent_change: this.usdPrice7dPercentChange, + usd_price_30d_percent_change: this.usdPrice30dPercentChange, } } } diff --git a/packages/common/evmUtils/src/generated/types/EvmMarketDataTopNFTCollectionByMarketCapItem.ts b/packages/common/evmUtils/src/generated/types/EvmMarketDataTopNFTCollectionByMarketCapItem.ts index b9eab62a60..0864e6de0f 100644 --- a/packages/common/evmUtils/src/generated/types/EvmMarketDataTopNFTCollectionByMarketCapItem.ts +++ b/packages/common/evmUtils/src/generated/types/EvmMarketDataTopNFTCollectionByMarketCapItem.ts @@ -13,6 +13,8 @@ import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; // - volume_usd ($ref: #/components/schemas/marketDataTopNFTCollectionByMarketCap/items/properties/volume_usd) // - volume_24hr_percent_change ($ref: #/components/schemas/marketDataTopNFTCollectionByMarketCap/items/properties/volume_24hr_percent_change) // - collection_address ($ref: #/components/schemas/marketDataTopNFTCollectionByMarketCap/items/properties/collection_address) +// - floor_price ($ref: #/components/schemas/marketDataTopNFTCollectionByMarketCap/items/properties/floor_price) +// - floor_price_usd_24hr_percent_change ($ref: #/components/schemas/marketDataTopNFTCollectionByMarketCap/items/properties/floor_price_usd_24hr_percent_change) export interface EvmMarketDataTopNFTCollectionByMarketCapItemJSON { readonly rank: number; @@ -25,6 +27,8 @@ export interface EvmMarketDataTopNFTCollectionByMarketCapItemJSON { readonly volume_usd: string; readonly volume_24hr_percent_change: string; readonly collection_address: EvmAddressJSON; + readonly floor_price?: string; + readonly floor_price_usd_24hr_percent_change?: string; } export interface EvmMarketDataTopNFTCollectionByMarketCapItemInput { @@ -38,6 +42,8 @@ export interface EvmMarketDataTopNFTCollectionByMarketCapItemInput { readonly volumeUsd: string; readonly volume24hrPercentChange: string; readonly collectionAddress: EvmAddressInput | EvmAddress; + readonly floorPrice?: string; + readonly floorPriceUsd24hrPercentChange?: string; } export class EvmMarketDataTopNFTCollectionByMarketCapItem { @@ -60,6 +66,8 @@ export class EvmMarketDataTopNFTCollectionByMarketCapItem { volumeUsd: json.volume_usd, volume24hrPercentChange: json.volume_24hr_percent_change, collectionAddress: EvmAddress.fromJSON(json.collection_address), + floorPrice: json.floor_price, + floorPriceUsd24hrPercentChange: json.floor_price_usd_24hr_percent_change, }; return EvmMarketDataTopNFTCollectionByMarketCapItem.create(input); } @@ -104,6 +112,14 @@ export class EvmMarketDataTopNFTCollectionByMarketCapItem { * @description The collection address */ public readonly collectionAddress: EvmAddress; + /** + * @description The floor price + */ + public readonly floorPrice?: string; + /** + * @description The floor price usd 24hr percent change + */ + public readonly floorPriceUsd24hrPercentChange?: string; private constructor(input: EvmMarketDataTopNFTCollectionByMarketCapItemInput) { this.rank = input.rank; @@ -116,6 +132,8 @@ export class EvmMarketDataTopNFTCollectionByMarketCapItem { this.volumeUsd = input.volumeUsd; this.volume24hrPercentChange = input.volume24hrPercentChange; this.collectionAddress = EvmAddress.create(input.collectionAddress); + this.floorPrice = input.floorPrice; + this.floorPriceUsd24hrPercentChange = input.floorPriceUsd24hrPercentChange; } public toJSON(): EvmMarketDataTopNFTCollectionByMarketCapItemJSON { @@ -130,6 +148,8 @@ export class EvmMarketDataTopNFTCollectionByMarketCapItem { volume_usd: this.volumeUsd, volume_24hr_percent_change: this.volume24hrPercentChange, collection_address: this.collectionAddress.toJSON(), + floor_price: this.floorPrice, + floor_price_usd_24hr_percent_change: this.floorPriceUsd24hrPercentChange, } } } diff --git a/packages/common/evmUtils/src/generated/types/EvmNativeErc20Price.ts b/packages/common/evmUtils/src/generated/types/EvmNativeErc20Price.ts index 8f7263beb9..86d5d71a71 100644 --- a/packages/common/evmUtils/src/generated/types/EvmNativeErc20Price.ts +++ b/packages/common/evmUtils/src/generated/types/EvmNativeErc20Price.ts @@ -1,3 +1,5 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + // $ref: #/components/schemas/nativeErc20Price // type: nativeErc20Price // properties: @@ -12,7 +14,7 @@ export interface EvmNativeErc20PriceJSON { readonly decimals: number; readonly name: string; readonly symbol: string; - readonly address: string; + readonly address: EvmAddressJSON; } export interface EvmNativeErc20PriceInput { @@ -20,7 +22,7 @@ export interface EvmNativeErc20PriceInput { readonly decimals: number; readonly name: string; readonly symbol: string; - readonly address: string; + readonly address: EvmAddressInput | EvmAddress; } export class EvmNativeErc20Price { @@ -37,7 +39,7 @@ export class EvmNativeErc20Price { decimals: json.decimals, name: json.name, symbol: json.symbol, - address: json.address, + address: EvmAddress.fromJSON(json.address), }; return EvmNativeErc20Price.create(input); } @@ -61,14 +63,14 @@ export class EvmNativeErc20Price { /** * @description The address of the native token */ - public readonly address: string; + public readonly address: EvmAddress; private constructor(input: EvmNativeErc20PriceInput) { this.value = input.value; this.decimals = input.decimals; this.name = input.name; this.symbol = input.symbol; - this.address = input.address; + this.address = EvmAddress.create(input.address); } public toJSON(): EvmNativeErc20PriceJSON { @@ -77,7 +79,7 @@ export class EvmNativeErc20Price { decimals: this.decimals, name: this.name, symbol: this.symbol, - address: this.address, + address: this.address.toJSON(), } } } diff --git a/packages/common/evmUtils/src/generated/types/EvmNativeTransfer.ts b/packages/common/evmUtils/src/generated/types/EvmNativeTransfer.ts new file mode 100644 index 0000000000..9f93ebc2d1 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmNativeTransfer.ts @@ -0,0 +1,135 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/native_transfer +// type: native_transfer +// properties: +// - from_address ($ref: #/components/schemas/native_transfer/properties/from_address) +// - from_address_label ($ref: #/components/schemas/native_transfer/properties/from_address_label) +// - to_address ($ref: #/components/schemas/native_transfer/properties/to_address) +// - to_address_label ($ref: #/components/schemas/native_transfer/properties/to_address_label) +// - value ($ref: #/components/schemas/native_transfer/properties/value) +// - value_formatted ($ref: #/components/schemas/native_transfer/properties/value_formatted) +// - direction ($ref: #/components/schemas/native_transfer/properties/direction) +// - internal_transaction ($ref: #/components/schemas/native_transfer/properties/internal_transaction) +// - token_symbol ($ref: #/components/schemas/native_transfer/properties/token_symbol) +// - token_logo ($ref: #/components/schemas/native_transfer/properties/token_logo) + +export interface EvmNativeTransferJSON { + readonly from_address: EvmAddressJSON; + readonly from_address_label?: string; + readonly to_address?: EvmAddressJSON; + readonly to_address_label?: string; + readonly value: string; + readonly value_formatted: string; + readonly direction?: string; + readonly internal_transaction: boolean; + readonly token_symbol: string; + readonly token_logo: string; +} + +export interface EvmNativeTransferInput { + readonly fromAddress: EvmAddressInput | EvmAddress; + readonly fromAddressLabel?: string; + readonly toAddress?: EvmAddressInput | EvmAddress; + readonly toAddressLabel?: string; + readonly value: string; + readonly valueFormatted: string; + readonly direction?: string; + readonly internalTransaction: boolean; + readonly tokenSymbol: string; + readonly tokenLogo: string; +} + +export class EvmNativeTransfer { + public static create(input: EvmNativeTransferInput | EvmNativeTransfer): EvmNativeTransfer { + if (input instanceof EvmNativeTransfer) { + return input; + } + return new EvmNativeTransfer(input); + } + + public static fromJSON(json: EvmNativeTransferJSON): EvmNativeTransfer { + const input: EvmNativeTransferInput = { + fromAddress: EvmAddress.fromJSON(json.from_address), + fromAddressLabel: json.from_address_label, + toAddress: json.to_address ? EvmAddress.fromJSON(json.to_address) : undefined, + toAddressLabel: json.to_address_label, + value: json.value, + valueFormatted: json.value_formatted, + direction: json.direction, + internalTransaction: json.internal_transaction, + tokenSymbol: json.token_symbol, + tokenLogo: json.token_logo, + }; + return EvmNativeTransfer.create(input); + } + + /** + * @description The address that sent the NFT + */ + public readonly fromAddress: EvmAddress; + /** + * @description The label of the from address + */ + public readonly fromAddressLabel?: string; + /** + * @description The address that received the NFT + */ + public readonly toAddress?: EvmAddress; + /** + * @description The label of the to address + */ + public readonly toAddressLabel?: string; + /** + * @description The value that was sent in the transaction (ETH/BNB/etc..) + */ + public readonly value: string; + /** + * @description The value that was sent in the transaction (ETH/BNB/etc..) in decimal format + */ + public readonly valueFormatted: string; + /** + * @description The direction of the transfer + */ + public readonly direction?: string; + /** + * @description Indicates if the transaction is internal + */ + public readonly internalTransaction: boolean; + /** + * @description The symbol of the token transferred + */ + public readonly tokenSymbol: string; + /** + * @description The logo of the token transferred + */ + public readonly tokenLogo: string; + + private constructor(input: EvmNativeTransferInput) { + this.fromAddress = EvmAddress.create(input.fromAddress); + this.fromAddressLabel = input.fromAddressLabel; + this.toAddress = input.toAddress ? EvmAddress.create(input.toAddress) : undefined; + this.toAddressLabel = input.toAddressLabel; + this.value = input.value; + this.valueFormatted = input.valueFormatted; + this.direction = input.direction; + this.internalTransaction = input.internalTransaction; + this.tokenSymbol = input.tokenSymbol; + this.tokenLogo = input.tokenLogo; + } + + public toJSON(): EvmNativeTransferJSON { + return { + from_address: this.fromAddress.toJSON(), + from_address_label: this.fromAddressLabel, + to_address: this.toAddress ? this.toAddress.toJSON() : undefined, + to_address_label: this.toAddressLabel, + value: this.value, + value_formatted: this.valueFormatted, + direction: this.direction, + internal_transaction: this.internalTransaction, + token_symbol: this.tokenSymbol, + token_logo: this.tokenLogo, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadata.ts b/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadata.ts new file mode 100644 index 0000000000..b3f0f3c111 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadata.ts @@ -0,0 +1,92 @@ +import { EvmNormalizedMetadataAttribute, EvmNormalizedMetadataAttributeInput, EvmNormalizedMetadataAttributeJSON } from '../types/EvmNormalizedMetadataAttribute'; + +// $ref: #/components/schemas/normalizedMetadata +// type: normalizedMetadata +// properties: +// - name ($ref: #/components/schemas/normalizedMetadata/properties/name) +// - description ($ref: #/components/schemas/normalizedMetadata/properties/description) +// - image ($ref: #/components/schemas/normalizedMetadata/properties/image) +// - external_link ($ref: #/components/schemas/normalizedMetadata/properties/external_link) +// - animation_url ($ref: #/components/schemas/normalizedMetadata/properties/animation_url) +// - attributes ($ref: #/components/schemas/normalizedMetadataAttribute) + +export interface EvmNormalizedMetadataJSON { + readonly name?: string; + readonly description?: string; + readonly image?: string; + readonly external_link?: string; + readonly animation_url?: string; + readonly attributes?: EvmNormalizedMetadataAttributeJSON[]; +} + +export interface EvmNormalizedMetadataInput { + readonly name?: string; + readonly description?: string; + readonly image?: string; + readonly externalLink?: string; + readonly animationUrl?: string; + readonly attributes?: EvmNormalizedMetadataAttributeInput[] | EvmNormalizedMetadataAttribute[]; +} + +export class EvmNormalizedMetadata { + public static create(input: EvmNormalizedMetadataInput | EvmNormalizedMetadata): EvmNormalizedMetadata { + if (input instanceof EvmNormalizedMetadata) { + return input; + } + return new EvmNormalizedMetadata(input); + } + + public static fromJSON(json: EvmNormalizedMetadataJSON): EvmNormalizedMetadata { + const input: EvmNormalizedMetadataInput = { + name: json.name, + description: json.description, + image: json.image, + externalLink: json.external_link, + animationUrl: json.animation_url, + attributes: json.attributes ? json.attributes.map((item) => EvmNormalizedMetadataAttribute.fromJSON(item)) : undefined, + }; + return EvmNormalizedMetadata.create(input); + } + + /** + * @description The name or title of the NFT + */ + public readonly name?: string; + /** + * @description A detailed description of the NFT + */ + public readonly description?: string; + /** + * @description The URL of the NFT's image + */ + public readonly image?: string; + /** + * @description A link to additional information + */ + public readonly externalLink?: string; + /** + * @description An animated version of the NFT's image + */ + public readonly animationUrl?: string; + public readonly attributes?: EvmNormalizedMetadataAttribute[]; + + private constructor(input: EvmNormalizedMetadataInput) { + this.name = input.name; + this.description = input.description; + this.image = input.image; + this.externalLink = input.externalLink; + this.animationUrl = input.animationUrl; + this.attributes = input.attributes ? input.attributes.map((item) => EvmNormalizedMetadataAttribute.create(item)) : undefined; + } + + public toJSON(): EvmNormalizedMetadataJSON { + return { + name: this.name, + description: this.description, + image: this.image, + external_link: this.externalLink, + animation_url: this.animationUrl, + attributes: this.attributes ? this.attributes.map((item) => item.toJSON()) : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttribute.ts b/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttribute.ts new file mode 100644 index 0000000000..e62ee8a3eb --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttribute.ts @@ -0,0 +1,95 @@ +import { EvmNormalizedMetadataAttributeValue, EvmNormalizedMetadataAttributeValueValue, EvmNormalizedMetadataAttributeValueInput, EvmNormalizedMetadataAttributeValueJSON } from '../types/EvmNormalizedMetadataAttributeValue'; + +// $ref: #/components/schemas/normalizedMetadataAttribute +// type: normalizedMetadataAttribute +// properties: +// - trait_type ($ref: #/components/schemas/normalizedMetadataAttribute/properties/trait_type) +// - value ($ref: #/components/schemas/normalizedMetadataAttribute/properties/value) +// - display_type ($ref: #/components/schemas/normalizedMetadataAttribute/properties/display_type) +// - max_value ($ref: #/components/schemas/normalizedMetadataAttribute/properties/max_value) +// - trait_count ($ref: #/components/schemas/normalizedMetadataAttribute/properties/trait_count) +// - order ($ref: #/components/schemas/normalizedMetadataAttribute/properties/order) + +export interface EvmNormalizedMetadataAttributeJSON { + readonly trait_type?: string; + readonly value?: EvmNormalizedMetadataAttributeValueJSON; + readonly display_type?: string; + readonly max_value?: number; + readonly trait_count?: number; + readonly order?: number; +} + +export interface EvmNormalizedMetadataAttributeInput { + readonly traitType?: string; + readonly value?: EvmNormalizedMetadataAttributeValueInput | EvmNormalizedMetadataAttributeValueValue; + readonly displayType?: string; + readonly maxValue?: number; + readonly traitCount?: number; + readonly order?: number; +} + +export class EvmNormalizedMetadataAttribute { + public static create(input: EvmNormalizedMetadataAttributeInput | EvmNormalizedMetadataAttribute): EvmNormalizedMetadataAttribute { + if (input instanceof EvmNormalizedMetadataAttribute) { + return input; + } + return new EvmNormalizedMetadataAttribute(input); + } + + public static fromJSON(json: EvmNormalizedMetadataAttributeJSON): EvmNormalizedMetadataAttribute { + const input: EvmNormalizedMetadataAttributeInput = { + traitType: json.trait_type, + value: json.value ? EvmNormalizedMetadataAttributeValue.fromJSON(json.value) : undefined, + displayType: json.display_type, + maxValue: json.max_value, + traitCount: json.trait_count, + order: json.order, + }; + return EvmNormalizedMetadataAttribute.create(input); + } + + /** + * @description The trait title or descriptor + */ + public readonly traitType?: string; + /** + * @description The value of the attribute + */ + public readonly value?: EvmNormalizedMetadataAttributeValueValue; + /** + * @description The type the attribute value should be displayed as + */ + public readonly displayType?: string; + /** + * @description For numeric values, the upper range + */ + public readonly maxValue?: number; + /** + * @description The number of possible values for this trait + */ + public readonly traitCount?: number; + /** + * @description Order the trait should appear in the attribute list. + */ + public readonly order?: number; + + private constructor(input: EvmNormalizedMetadataAttributeInput) { + this.traitType = input.traitType; + this.value = input.value ? EvmNormalizedMetadataAttributeValue.create(input.value) : undefined; + this.displayType = input.displayType; + this.maxValue = input.maxValue; + this.traitCount = input.traitCount; + this.order = input.order; + } + + public toJSON(): EvmNormalizedMetadataAttributeJSON { + return { + trait_type: this.traitType, + value: this.value ? this.value : undefined, + display_type: this.displayType, + max_value: this.maxValue, + trait_count: this.traitCount, + order: this.order, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttributeValue.ts b/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttributeValue.ts new file mode 100644 index 0000000000..0d44675388 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmNormalizedMetadataAttributeValue.ts @@ -0,0 +1,16 @@ +// $ref: #/components/schemas/normalizedMetadataAttribute/properties/value +// typeName: normalizedMetadataAttribute_value + +export type EvmNormalizedMetadataAttributeValueJSON = object; +export type EvmNormalizedMetadataAttributeValueInput = object; +export type EvmNormalizedMetadataAttributeValueValue = object; + +export abstract class EvmNormalizedMetadataAttributeValue { + public static create(input: EvmNormalizedMetadataAttributeValueInput | EvmNormalizedMetadataAttributeValueValue): EvmNormalizedMetadataAttributeValueValue { + return input; + } + + public static fromJSON(json: EvmNormalizedMetadataAttributeValueJSON): EvmNormalizedMetadataAttributeValueValue { + return json; + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmOrderList.ts b/packages/common/evmUtils/src/generated/types/EvmOrderList.ts new file mode 100644 index 0000000000..3c71bc2cf4 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmOrderList.ts @@ -0,0 +1,16 @@ +// $ref: #/components/schemas/orderList +// typeName: orderList + +export type EvmOrderListJSON = "ASC" | "DESC"; +export type EvmOrderListInput = "ASC" | "DESC"; +export type EvmOrderListValue = "ASC" | "DESC"; + +export abstract class EvmOrderList { + public static create(input: EvmOrderListInput | EvmOrderListValue): EvmOrderListValue { + return input; + } + + public static fromJSON(json: EvmOrderListJSON): EvmOrderListValue { + return json; + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletActiveChains.ts b/packages/common/evmUtils/src/generated/types/EvmWalletActiveChains.ts index 55cdd46a86..26bec972c3 100644 --- a/packages/common/evmUtils/src/generated/types/EvmWalletActiveChains.ts +++ b/packages/common/evmUtils/src/generated/types/EvmWalletActiveChains.ts @@ -1,3 +1,4 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; import { EvmWalletActiveChain, EvmWalletActiveChainInput, EvmWalletActiveChainJSON } from '../types/EvmWalletActiveChain'; // $ref: #/components/schemas/walletActiveChains @@ -7,12 +8,12 @@ import { EvmWalletActiveChain, EvmWalletActiveChainInput, EvmWalletActiveChainJS // - active_chains ($ref: #/components/schemas/walletActiveChain) export interface EvmWalletActiveChainsJSON { - readonly address: string; + readonly address: EvmAddressJSON; readonly active_chains: EvmWalletActiveChainJSON[]; } export interface EvmWalletActiveChainsInput { - readonly address: string; + readonly address: EvmAddressInput | EvmAddress; readonly activeChains: EvmWalletActiveChainInput[] | EvmWalletActiveChain[]; } @@ -26,7 +27,7 @@ export class EvmWalletActiveChains { public static fromJSON(json: EvmWalletActiveChainsJSON): EvmWalletActiveChains { const input: EvmWalletActiveChainsInput = { - address: json.address, + address: EvmAddress.fromJSON(json.address), activeChains: json.active_chains.map((item) => EvmWalletActiveChain.fromJSON(item)), }; return EvmWalletActiveChains.create(input); @@ -35,17 +36,17 @@ export class EvmWalletActiveChains { /** * @description The address of the wallet */ - public readonly address: string; + public readonly address: EvmAddress; public readonly activeChains: EvmWalletActiveChain[]; private constructor(input: EvmWalletActiveChainsInput) { - this.address = input.address; + this.address = EvmAddress.create(input.address); this.activeChains = input.activeChains.map((item) => EvmWalletActiveChain.create(item)); } public toJSON(): EvmWalletActiveChainsJSON { return { - address: this.address, + address: this.address.toJSON(), active_chains: this.activeChains.map((item) => item.toJSON()), } } diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletHistory.ts b/packages/common/evmUtils/src/generated/types/EvmWalletHistory.ts new file mode 100644 index 0000000000..79d603f497 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmWalletHistory.ts @@ -0,0 +1,72 @@ +import { EvmWalletHistoryTransaction, EvmWalletHistoryTransactionInput, EvmWalletHistoryTransactionJSON } from '../types/EvmWalletHistoryTransaction'; + +// $ref: #/components/schemas/walletHistory +// type: walletHistory +// properties: +// - page ($ref: #/components/schemas/walletHistory/properties/page) +// - page_size ($ref: #/components/schemas/walletHistory/properties/page_size) +// - cursor ($ref: #/components/schemas/walletHistory/properties/cursor) +// - result ($ref: #/components/schemas/walletHistoryTransaction) + +export interface EvmWalletHistoryJSON { + readonly page: number; + readonly page_size: number; + readonly cursor: string; + readonly result: EvmWalletHistoryTransactionJSON[]; +} + +export interface EvmWalletHistoryInput { + readonly page: number; + readonly pageSize: number; + readonly cursor: string; + readonly result: EvmWalletHistoryTransactionInput[] | EvmWalletHistoryTransaction[]; +} + +export class EvmWalletHistory { + public static create(input: EvmWalletHistoryInput | EvmWalletHistory): EvmWalletHistory { + if (input instanceof EvmWalletHistory) { + return input; + } + return new EvmWalletHistory(input); + } + + public static fromJSON(json: EvmWalletHistoryJSON): EvmWalletHistory { + const input: EvmWalletHistoryInput = { + page: json.page, + pageSize: json.page_size, + cursor: json.cursor, + result: json.result.map((item) => EvmWalletHistoryTransaction.fromJSON(item)), + }; + return EvmWalletHistory.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: EvmWalletHistoryTransaction[]; + + private constructor(input: EvmWalletHistoryInput) { + this.page = input.page; + this.pageSize = input.pageSize; + this.cursor = input.cursor; + this.result = input.result.map((item) => EvmWalletHistoryTransaction.create(item)); + } + + public toJSON(): EvmWalletHistoryJSON { + 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/EvmWalletHistoryErc20Transfer.ts b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryErc20Transfer.ts new file mode 100644 index 0000000000..faf49bc378 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryErc20Transfer.ts @@ -0,0 +1,173 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/walletHistoryErc20Transfer +// type: walletHistoryErc20Transfer +// properties: +// - token_name ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/token_name) +// - token_symbol ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/token_symbol) +// - token_logo ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/token_logo) +// - token_decimals ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/token_decimals) +// - address ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/address) +// - block_timestamp ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/block_timestamp) +// - to_address ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/to_address) +// - to_address_label ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/to_address_label) +// - from_address ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/from_address) +// - from_address_label ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/from_address_label) +// - value ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/value) +// - value_formatted ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/value_formatted) +// - log_index ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/log_index) +// - possible_spam ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/possible_spam) +// - verified_contract ($ref: #/components/schemas/walletHistoryErc20Transfer/properties/verified_contract) + +export interface EvmWalletHistoryErc20TransferJSON { + readonly token_name: string; + readonly token_symbol: string; + readonly token_logo: string; + readonly token_decimals: string; + readonly address: EvmAddressJSON; + readonly block_timestamp?: string; + readonly to_address: EvmAddressJSON; + readonly to_address_label?: string; + readonly from_address: EvmAddressJSON; + readonly from_address_label?: string; + readonly value: string; + readonly value_formatted: string; + readonly log_index: number; + readonly possible_spam: boolean; + readonly verified_contract: boolean; +} + +export interface EvmWalletHistoryErc20TransferInput { + readonly tokenName: string; + readonly tokenSymbol: string; + readonly tokenLogo: string; + readonly tokenDecimals: number; + readonly address: EvmAddressInput | EvmAddress; + readonly blockTimestamp?: string; + readonly toAddress: EvmAddressInput | EvmAddress; + readonly toAddressLabel?: string; + readonly fromAddress: EvmAddressInput | EvmAddress; + readonly fromAddressLabel?: string; + readonly value: string; + readonly valueFormatted: string; + readonly logIndex: number; + readonly possibleSpam: boolean; + readonly verifiedContract: boolean; +} + +export class EvmWalletHistoryErc20Transfer { + public static create(input: EvmWalletHistoryErc20TransferInput | EvmWalletHistoryErc20Transfer): EvmWalletHistoryErc20Transfer { + if (input instanceof EvmWalletHistoryErc20Transfer) { + return input; + } + return new EvmWalletHistoryErc20Transfer(input); + } + + public static fromJSON(json: EvmWalletHistoryErc20TransferJSON): EvmWalletHistoryErc20Transfer { + const input: EvmWalletHistoryErc20TransferInput = { + tokenName: json.token_name, + tokenSymbol: json.token_symbol, + tokenLogo: json.token_logo, + tokenDecimals: Number(json.token_decimals), + address: EvmAddress.fromJSON(json.address), + blockTimestamp: json.block_timestamp, + toAddress: EvmAddress.fromJSON(json.to_address), + toAddressLabel: json.to_address_label, + fromAddress: EvmAddress.fromJSON(json.from_address), + fromAddressLabel: json.from_address_label, + value: json.value, + valueFormatted: json.value_formatted, + logIndex: json.log_index, + possibleSpam: json.possible_spam, + verifiedContract: json.verified_contract, + }; + return EvmWalletHistoryErc20Transfer.create(input); + } + + public readonly tokenName: string; + public readonly tokenSymbol: string; + public readonly tokenLogo: string; + public readonly tokenDecimals: number; + /** + * @description The address of the token + */ + public readonly address: EvmAddress; + /** + * @description The block timestamp + */ + public readonly blockTimestamp?: string; + /** + * @description The recipient + */ + public readonly toAddress: EvmAddress; + /** + * @description The label of the to address + */ + public readonly toAddressLabel?: string; + /** + * @description The sender + */ + public readonly fromAddress: EvmAddress; + /** + * @description The label of the from address + */ + public readonly fromAddressLabel?: string; + /** + * @description The value that was transfered (in wei) + */ + public readonly value: string; + /** + * @description The value that was transfered decimal format + */ + public readonly valueFormatted: string; + /** + * @description The log index of the transfer within the block + */ + public readonly logIndex: number; + /** + * @description Indicates if a contract is possibly a spam contract + */ + public readonly possibleSpam: boolean; + /** + * @description Indicates if a contract is verified + */ + public readonly verifiedContract: boolean; + + private constructor(input: EvmWalletHistoryErc20TransferInput) { + this.tokenName = input.tokenName; + this.tokenSymbol = input.tokenSymbol; + this.tokenLogo = input.tokenLogo; + this.tokenDecimals = input.tokenDecimals; + this.address = EvmAddress.create(input.address); + this.blockTimestamp = input.blockTimestamp; + this.toAddress = EvmAddress.create(input.toAddress); + this.toAddressLabel = input.toAddressLabel; + this.fromAddress = EvmAddress.create(input.fromAddress); + this.fromAddressLabel = input.fromAddressLabel; + this.value = input.value; + this.valueFormatted = input.valueFormatted; + this.logIndex = input.logIndex; + this.possibleSpam = input.possibleSpam; + this.verifiedContract = input.verifiedContract; + } + + public toJSON(): EvmWalletHistoryErc20TransferJSON { + return { + token_name: this.tokenName, + token_symbol: this.tokenSymbol, + token_logo: this.tokenLogo, + token_decimals: String(this.tokenDecimals), + address: this.address.toJSON(), + block_timestamp: this.blockTimestamp, + to_address: this.toAddress.toJSON(), + to_address_label: this.toAddressLabel, + from_address: this.fromAddress.toJSON(), + from_address_label: this.fromAddressLabel, + value: this.value, + value_formatted: this.valueFormatted, + log_index: this.logIndex, + possible_spam: this.possibleSpam, + verified_contract: this.verifiedContract, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletHistoryNftTransfer.ts b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryNftTransfer.ts new file mode 100644 index 0000000000..3ed21c9878 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryNftTransfer.ts @@ -0,0 +1,216 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmNormalizedMetadata, EvmNormalizedMetadataInput, EvmNormalizedMetadataJSON } from '../types/EvmNormalizedMetadata'; + +// $ref: #/components/schemas/walletHistoryNftTransfer +// type: walletHistoryNftTransfer +// properties: +// - token_address ($ref: #/components/schemas/walletHistoryNftTransfer/properties/token_address) +// - token_id ($ref: #/components/schemas/walletHistoryNftTransfer/properties/token_id) +// - from_address ($ref: #/components/schemas/walletHistoryNftTransfer/properties/from_address) +// - from_address_label ($ref: #/components/schemas/walletHistoryNftTransfer/properties/from_address_label) +// - to_address ($ref: #/components/schemas/walletHistoryNftTransfer/properties/to_address) +// - to_address_label ($ref: #/components/schemas/walletHistoryNftTransfer/properties/to_address_label) +// - value ($ref: #/components/schemas/walletHistoryNftTransfer/properties/value) +// - amount ($ref: #/components/schemas/walletHistoryNftTransfer/properties/amount) +// - contract_type ($ref: #/components/schemas/walletHistoryNftTransfer/properties/contract_type) +// - transaction_type ($ref: #/components/schemas/walletHistoryNftTransfer/properties/transaction_type) +// - log_index ($ref: #/components/schemas/walletHistoryNftTransfer/properties/log_index) +// - operator ($ref: #/components/schemas/walletHistoryNftTransfer/properties/operator) +// - possible_spam ($ref: #/components/schemas/walletHistoryNftTransfer/properties/possible_spam) +// - verified_collection ($ref: #/components/schemas/walletHistoryNftTransfer/properties/verified_collection) +// - direction ($ref: #/components/schemas/walletHistoryNftTransfer/properties/direction) +// - collection_logo ($ref: #/components/schemas/walletHistoryNftTransfer/properties/collection_logo) +// - collection_banner_image ($ref: #/components/schemas/walletHistoryNftTransfer/properties/collection_banner_image) +// - normalized_metadata ($ref: #/components/schemas/normalizedMetadata) + +export interface EvmWalletHistoryNftTransferJSON { + readonly token_address: EvmAddressJSON; + readonly token_id: string; + readonly from_address: EvmAddressJSON; + readonly from_address_label?: string; + readonly to_address: EvmAddressJSON; + readonly to_address_label?: string; + readonly value: string; + readonly amount: string; + readonly contract_type: string; + readonly transaction_type: string; + readonly log_index: number; + readonly operator?: string; + readonly possible_spam: boolean; + readonly verified_collection?: boolean; + readonly direction: string; + readonly collection_logo?: string; + readonly collection_banner_image?: string; + readonly normalized_metadata?: EvmNormalizedMetadataJSON; +} + +export interface EvmWalletHistoryNftTransferInput { + readonly tokenAddress: EvmAddressInput | EvmAddress; + readonly tokenId: string; + readonly fromAddress: EvmAddressInput | EvmAddress; + readonly fromAddressLabel?: string; + readonly toAddress: EvmAddressInput | EvmAddress; + readonly toAddressLabel?: string; + readonly value: string; + readonly amount: string; + readonly contractType: string; + readonly transactionType: string; + readonly logIndex: number; + readonly operator?: string; + readonly possibleSpam: boolean; + readonly verifiedCollection?: boolean; + readonly direction: string; + readonly collectionLogo?: string; + readonly collectionBannerImage?: string; + readonly normalizedMetadata?: EvmNormalizedMetadataInput | EvmNormalizedMetadata; +} + +export class EvmWalletHistoryNftTransfer { + public static create(input: EvmWalletHistoryNftTransferInput | EvmWalletHistoryNftTransfer): EvmWalletHistoryNftTransfer { + if (input instanceof EvmWalletHistoryNftTransfer) { + return input; + } + return new EvmWalletHistoryNftTransfer(input); + } + + public static fromJSON(json: EvmWalletHistoryNftTransferJSON): EvmWalletHistoryNftTransfer { + const input: EvmWalletHistoryNftTransferInput = { + tokenAddress: EvmAddress.fromJSON(json.token_address), + tokenId: json.token_id, + fromAddress: EvmAddress.fromJSON(json.from_address), + fromAddressLabel: json.from_address_label, + toAddress: EvmAddress.fromJSON(json.to_address), + toAddressLabel: json.to_address_label, + value: json.value, + amount: json.amount, + contractType: json.contract_type, + transactionType: json.transaction_type, + logIndex: json.log_index, + operator: json.operator, + possibleSpam: json.possible_spam, + verifiedCollection: json.verified_collection, + direction: json.direction, + collectionLogo: json.collection_logo, + collectionBannerImage: json.collection_banner_image, + normalizedMetadata: json.normalized_metadata ? EvmNormalizedMetadata.fromJSON(json.normalized_metadata) : undefined, + }; + return EvmWalletHistoryNftTransfer.create(input); + } + + /** + * @description The address of the NFT contract + */ + public readonly tokenAddress: EvmAddress; + /** + * @description The token ID of the NFT + */ + public readonly tokenId: string; + /** + * @description The address that sent the NFT + */ + public readonly fromAddress: EvmAddress; + /** + * @description The label of the from address + */ + public readonly fromAddressLabel?: string; + /** + * @description The address that received the NFT + */ + public readonly toAddress: EvmAddress; + /** + * @description The label of the to address + */ + public readonly toAddressLabel?: string; + /** + * @description The value that was sent in the transaction (ETH/BNB/etc..) + */ + public readonly value: string; + /** + * @description The number of tokens transferred + */ + public readonly amount: string; + /** + * @description The type of NFT contract standard + */ + public readonly contractType: string; + /** + * @description The transaction type + */ + public readonly transactionType: string; + /** + * @description The log index + */ + public readonly logIndex: number; + /** + * @description The operator present only for ERC1155 transfers + */ + public readonly operator?: string; + /** + * @description Indicates if a contract is possibly a spam contract + */ + public readonly possibleSpam: boolean; + /** + * @description Indicates if a contract is verified + */ + public readonly verifiedCollection?: boolean; + /** + * @description The direction of the transfer + */ + public readonly direction: string; + /** + * @description The logo of the collection + */ + public readonly collectionLogo?: string; + /** + * @description The banner image of the collection + */ + public readonly collectionBannerImage?: string; + /** + * @description A normalized metadata version of the NFT's metadata. + */ + public readonly normalizedMetadata?: EvmNormalizedMetadata; + + private constructor(input: EvmWalletHistoryNftTransferInput) { + this.tokenAddress = EvmAddress.create(input.tokenAddress); + this.tokenId = input.tokenId; + this.fromAddress = EvmAddress.create(input.fromAddress); + this.fromAddressLabel = input.fromAddressLabel; + this.toAddress = EvmAddress.create(input.toAddress); + this.toAddressLabel = input.toAddressLabel; + this.value = input.value; + this.amount = input.amount; + this.contractType = input.contractType; + this.transactionType = input.transactionType; + this.logIndex = input.logIndex; + this.operator = input.operator; + this.possibleSpam = input.possibleSpam; + this.verifiedCollection = input.verifiedCollection; + this.direction = input.direction; + this.collectionLogo = input.collectionLogo; + this.collectionBannerImage = input.collectionBannerImage; + this.normalizedMetadata = input.normalizedMetadata ? EvmNormalizedMetadata.create(input.normalizedMetadata) : undefined; + } + + public toJSON(): EvmWalletHistoryNftTransferJSON { + return { + token_address: this.tokenAddress.toJSON(), + token_id: this.tokenId, + from_address: this.fromAddress.toJSON(), + from_address_label: this.fromAddressLabel, + to_address: this.toAddress.toJSON(), + to_address_label: this.toAddressLabel, + value: this.value, + amount: this.amount, + contract_type: this.contractType, + transaction_type: this.transactionType, + log_index: this.logIndex, + operator: this.operator, + possible_spam: this.possibleSpam, + verified_collection: this.verifiedCollection, + direction: this.direction, + collection_logo: this.collectionLogo, + collection_banner_image: this.collectionBannerImage, + normalized_metadata: this.normalizedMetadata ? this.normalizedMetadata.toJSON() : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts new file mode 100644 index 0000000000..f2b7a2f9b0 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts @@ -0,0 +1,260 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON, EvmInternalTransaction, EvmInternalTransactionInput, EvmInternalTransactionJSON } from '../../dataTypes'; +import { BigNumber, BigNumberInput, BigNumberJSON } from '@moralisweb3/common-core'; +import { EvmETransactionCategory, EvmETransactionCategoryValue, EvmETransactionCategoryInput, EvmETransactionCategoryJSON } from '../types/EvmETransactionCategory'; +import { EvmWalletHistoryNftTransfer, EvmWalletHistoryNftTransferInput, EvmWalletHistoryNftTransferJSON } from '../types/EvmWalletHistoryNftTransfer'; +import { EvmWalletHistoryErc20Transfer, EvmWalletHistoryErc20TransferInput, EvmWalletHistoryErc20TransferJSON } from '../types/EvmWalletHistoryErc20Transfer'; +import { EvmNativeTransfer, EvmNativeTransferInput, EvmNativeTransferJSON } from '../types/EvmNativeTransfer'; + +// $ref: #/components/schemas/walletHistoryTransaction +// type: walletHistoryTransaction +// properties: +// - hash ($ref: #/components/schemas/walletHistoryTransaction/properties/hash) +// - nonce ($ref: #/components/schemas/walletHistoryTransaction/properties/nonce) +// - transaction_index ($ref: #/components/schemas/walletHistoryTransaction/properties/transaction_index) +// - from_address ($ref: #/components/schemas/walletHistoryTransaction/properties/from_address) +// - from_address_label ($ref: #/components/schemas/walletHistoryTransaction/properties/from_address_label) +// - to_address ($ref: #/components/schemas/walletHistoryTransaction/properties/to_address) +// - to_address_label ($ref: #/components/schemas/walletHistoryTransaction/properties/to_address_label) +// - value ($ref: #/components/schemas/walletHistoryTransaction/properties/value) +// - gas ($ref: #/components/schemas/walletHistoryTransaction/properties/gas) +// - gas_price ($ref: #/components/schemas/walletHistoryTransaction/properties/gas_price) +// - input ($ref: #/components/schemas/walletHistoryTransaction/properties/input) +// - receipt_cumulative_gas_used ($ref: #/components/schemas/walletHistoryTransaction/properties/receipt_cumulative_gas_used) +// - receipt_gas_used ($ref: #/components/schemas/walletHistoryTransaction/properties/receipt_gas_used) +// - receipt_status ($ref: #/components/schemas/walletHistoryTransaction/properties/receipt_status) +// - block_timestamp ($ref: #/components/schemas/walletHistoryTransaction/properties/block_timestamp) +// - block_number ($ref: #/components/schemas/walletHistoryTransaction/properties/block_number) +// - block_hash ($ref: #/components/schemas/walletHistoryTransaction/properties/block_hash) +// - internal_transactions ($ref: #/components/schemas/internalTransaction) +// - category ($ref: #/components/schemas/ETransactionCategory) +// - possible_spam ($ref: #/components/schemas/walletHistoryTransaction/properties/possible_spam) +// - method_label ($ref: #/components/schemas/walletHistoryTransaction/properties/method_label) +// - summary ($ref: #/components/schemas/walletHistoryTransaction/properties/summary) +// - nft_transfers ($ref: #/components/schemas/walletHistoryNftTransfer) +// - erc20_transfers ($ref: #/components/schemas/walletHistoryErc20Transfer) +// - native_transfers ($ref: #/components/schemas/native_transfer) + +export interface EvmWalletHistoryTransactionJSON { + readonly hash: string; + readonly nonce: string; + readonly transaction_index: string; + readonly from_address: EvmAddressJSON; + readonly from_address_label?: string; + readonly to_address: EvmAddressJSON; + readonly to_address_label?: string; + readonly value: string; + readonly gas?: string; + readonly gas_price: string; + readonly input?: string; + readonly receipt_cumulative_gas_used: string; + readonly receipt_gas_used: string; + readonly receipt_status: string; + readonly block_timestamp: string; + readonly block_number: BigNumberJSON; + readonly block_hash: string; + readonly internal_transactions?: EvmInternalTransactionJSON[]; + readonly category: EvmETransactionCategoryJSON; + readonly possible_spam?: boolean; + readonly method_label?: string; + readonly summary: string; + readonly nft_transfers: EvmWalletHistoryNftTransferJSON[]; + readonly erc20_transfers: EvmWalletHistoryErc20TransferJSON[]; + readonly native_transfers: EvmNativeTransferJSON[]; +} + +export interface EvmWalletHistoryTransactionInput { + readonly hash: string; + readonly nonce: string; + readonly transactionIndex: number; + readonly fromAddress: EvmAddressInput | EvmAddress; + readonly fromAddressLabel?: string; + readonly toAddress: EvmAddressInput | EvmAddress; + readonly toAddressLabel?: string; + readonly value: string; + readonly gas?: string; + readonly gasPrice: string; + readonly input?: string; + readonly receiptCumulativeGasUsed: string; + readonly receiptGasUsed: string; + readonly receiptStatus: string; + readonly blockTimestamp: string; + readonly blockNumber: BigNumberInput | BigNumber; + readonly blockHash: string; + readonly internalTransactions?: EvmInternalTransactionInput[] | EvmInternalTransaction[]; + readonly category: EvmETransactionCategoryInput | EvmETransactionCategoryValue; + readonly possibleSpam?: boolean; + readonly methodLabel?: string; + readonly summary: string; + readonly nftTransfers: EvmWalletHistoryNftTransferInput[] | EvmWalletHistoryNftTransfer[]; + readonly erc20Transfers: EvmWalletHistoryErc20TransferInput[] | EvmWalletHistoryErc20Transfer[]; + readonly nativeTransfers: EvmNativeTransferInput[] | EvmNativeTransfer[]; +} + +export class EvmWalletHistoryTransaction { + public static create(input: EvmWalletHistoryTransactionInput | EvmWalletHistoryTransaction): EvmWalletHistoryTransaction { + if (input instanceof EvmWalletHistoryTransaction) { + return input; + } + return new EvmWalletHistoryTransaction(input); + } + + public static fromJSON(json: EvmWalletHistoryTransactionJSON): EvmWalletHistoryTransaction { + const input: EvmWalletHistoryTransactionInput = { + hash: json.hash, + nonce: json.nonce, + transactionIndex: Number(json.transaction_index), + fromAddress: EvmAddress.fromJSON(json.from_address), + fromAddressLabel: json.from_address_label, + toAddress: EvmAddress.fromJSON(json.to_address), + toAddressLabel: json.to_address_label, + value: json.value, + gas: json.gas, + gasPrice: json.gas_price, + input: json.input, + receiptCumulativeGasUsed: json.receipt_cumulative_gas_used, + receiptGasUsed: json.receipt_gas_used, + receiptStatus: json.receipt_status, + blockTimestamp: json.block_timestamp, + blockNumber: BigNumber.fromJSON(json.block_number), + blockHash: json.block_hash, + internalTransactions: json.internal_transactions ? json.internal_transactions.map((item) => EvmInternalTransaction.fromJSON(item)) : undefined, + category: EvmETransactionCategory.fromJSON(json.category), + possibleSpam: json.possible_spam, + methodLabel: json.method_label, + summary: json.summary, + 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)), + }; + return EvmWalletHistoryTransaction.create(input); + } + + /** + * @description The hash of the transaction + */ + public readonly hash: string; + /** + * @description The nonce + */ + public readonly nonce: string; + public readonly transactionIndex: number; + /** + * @description The from address + */ + public readonly fromAddress: EvmAddress; + /** + * @description The label of the from address + */ + public readonly fromAddressLabel?: string; + /** + * @description The to address + */ + public readonly toAddress: EvmAddress; + /** + * @description The label of the to address + */ + public readonly toAddressLabel?: string; + /** + * @description The value sent + */ + public readonly value: string; + public readonly gas?: string; + /** + * @description The gas price + */ + public readonly gasPrice: string; + public readonly input?: string; + public readonly receiptCumulativeGasUsed: string; + public readonly receiptGasUsed: string; + public readonly receiptStatus: string; + /** + * @description The block timestamp + */ + public readonly blockTimestamp: string; + /** + * @description The block number + */ + public readonly blockNumber: BigNumber; + /** + * @description The hash of the block + */ + public readonly blockHash: string; + /** + * @description The internal transactions of the transaction + */ + public readonly internalTransactions?: EvmInternalTransaction[]; + public readonly category: EvmETransactionCategoryValue; + /** + * @description Is transaction possible spam + */ + public readonly possibleSpam?: boolean; + /** + * @description The label of the method called if any called + */ + public readonly methodLabel?: string; + /** + * @description Summary of what happened on the transaction + */ + public readonly summary: string; + public readonly nftTransfers: EvmWalletHistoryNftTransfer[]; + public readonly erc20Transfers: EvmWalletHistoryErc20Transfer[]; + public readonly nativeTransfers: EvmNativeTransfer[]; + + private constructor(input: EvmWalletHistoryTransactionInput) { + this.hash = input.hash; + this.nonce = input.nonce; + this.transactionIndex = input.transactionIndex; + this.fromAddress = EvmAddress.create(input.fromAddress); + this.fromAddressLabel = input.fromAddressLabel; + this.toAddress = EvmAddress.create(input.toAddress); + this.toAddressLabel = input.toAddressLabel; + this.value = input.value; + this.gas = input.gas; + this.gasPrice = input.gasPrice; + this.input = input.input; + this.receiptCumulativeGasUsed = input.receiptCumulativeGasUsed; + this.receiptGasUsed = input.receiptGasUsed; + this.receiptStatus = input.receiptStatus; + this.blockTimestamp = input.blockTimestamp; + this.blockNumber = BigNumber.create(input.blockNumber); + this.blockHash = input.blockHash; + this.internalTransactions = input.internalTransactions ? input.internalTransactions.map((item) => EvmInternalTransaction.create(item)) : undefined; + this.category = EvmETransactionCategory.create(input.category); + this.possibleSpam = input.possibleSpam; + this.methodLabel = input.methodLabel; + this.summary = input.summary; + 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)); + } + + public toJSON(): EvmWalletHistoryTransactionJSON { + return { + hash: this.hash, + nonce: this.nonce, + transaction_index: String(this.transactionIndex), + from_address: this.fromAddress.toJSON(), + from_address_label: this.fromAddressLabel, + to_address: this.toAddress.toJSON(), + to_address_label: this.toAddressLabel, + value: this.value, + gas: this.gas, + gas_price: this.gasPrice, + input: this.input, + receipt_cumulative_gas_used: this.receiptCumulativeGasUsed, + receipt_gas_used: this.receiptGasUsed, + receipt_status: this.receiptStatus, + block_timestamp: this.blockTimestamp, + block_number: this.blockNumber.toJSON(), + block_hash: this.blockHash, + internal_transactions: this.internalTransactions ? this.internalTransactions.map((item) => item.toJSON()) : undefined, + category: this.category, + possible_spam: this.possibleSpam, + method_label: this.methodLabel, + summary: this.summary, + nft_transfers: this.nftTransfers.map((item) => item.toJSON()), + erc20_transfers: this.erc20Transfers.map((item) => item.toJSON()), + native_transfers: this.nativeTransfers.map((item) => item.toJSON()), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/index.ts b/packages/common/evmUtils/src/generated/types/index.ts index 4cd98ca9dd..9114675145 100644 --- a/packages/common/evmUtils/src/generated/types/index.ts +++ b/packages/common/evmUtils/src/generated/types/index.ts @@ -1,12 +1,16 @@ export * from './EvmChainList'; export * from './EvmGetNFTTradesMarketplaceEnum'; export * from './EvmGetMultipleTokenPricesIncludeEnum'; +export * from './EvmOrderList'; export * from './EvmResolveAddressToDomainCurrencyEnum'; +export * from './EvmETransactionCategory'; export * from './EvmContractsReviewItemReportTypeEnum'; export * from './EvmContractsReviewItemContractTypeEnum'; +export * from './EvmNormalizedMetadataAttributeValue'; export * from './EvmTradeCollection'; export * from './EvmErc20Price'; export * from './EvmGetMultipleTokenPricesDto'; +export * from './EvmWalletHistory'; export * from './EvmErc20TokenBalanceWithPriceResult'; export * from './EvmNetWorthResult'; export * from './EvmWeb3version'; @@ -29,6 +33,7 @@ export * from './EvmBlockTokenStat'; export * from './EvmTrade'; export * from './EvmNativeErc20Price'; export * from './EvmTokenPriceItem'; +export * from './EvmWalletHistoryTransaction'; export * from './EvmErc20TokenBalanceWithPrice'; export * from './EvmChainNetWorth'; export * from './EvmErc20Metadata'; @@ -44,4 +49,9 @@ export * from './EvmNftTokenStatTransfers'; export * from './EvmErc20TokenStatTransfers'; export * from './EvmBlockTokenStatTransactions'; export * from './EvmBlockTokenStatNftTransfers'; +export * from './EvmWalletHistoryNftTransfer'; +export * from './EvmWalletHistoryErc20Transfer'; +export * from './EvmNativeTransfer'; export * from './EvmTransactionTimestamp'; +export * from './EvmNormalizedMetadata'; +export * from './EvmNormalizedMetadataAttribute'; diff --git a/packages/common/evmUtils/src/operations/block/getBlockOperation.ts b/packages/common/evmUtils/src/operations/block/getBlockOperation.ts index 08783be808..6c062ddfb5 100644 --- a/packages/common/evmUtils/src/operations/block/getBlockOperation.ts +++ b/packages/common/evmUtils/src/operations/block/getBlockOperation.ts @@ -112,10 +112,7 @@ function deserializeResponse(jsonResponse: GetBlockJSONResponse, request: GetBlo }), internalTransactions: (transaction.internalTransactions ?? []).map((jsonInternalTransaction) => { const internalTransaction = toCamelCase(jsonInternalTransaction); - return EvmInternalTransaction.create({ - chain, - ...internalTransaction, - }); + return EvmInternalTransaction.create(internalTransaction); }), }), ), diff --git a/packages/common/evmUtils/src/operations/transaction/getInternalTransactionsOperation.ts b/packages/common/evmUtils/src/operations/transaction/getInternalTransactionsOperation.ts index a2f9abf5c2..fb517f1e49 100644 --- a/packages/common/evmUtils/src/operations/transaction/getInternalTransactionsOperation.ts +++ b/packages/common/evmUtils/src/operations/transaction/getInternalTransactionsOperation.ts @@ -72,15 +72,9 @@ function deserializeRequest(jsonRequest: GetInternalTransactionsJSONRequest): Ge }; } -function deserializeResponse( - jsonResponse: GetInternalTransactionsJSONResponse, - request: GetInternalTransactionsJSONRequest, - core: Core, -) { +function deserializeResponse(jsonResponse: GetInternalTransactionsJSONResponse) { return (jsonResponse ?? []).map((transaction) => { - const chain = EvmChainResolver.resolve(request.chain, core); return EvmInternalTransaction.create({ - chain, blockHash: transaction.block_hash, blockNumber: transaction.block_number, from: transaction.from, diff --git a/packages/common/evmUtils/src/operations/transaction/getTransactionOperation.ts b/packages/common/evmUtils/src/operations/transaction/getTransactionOperation.ts index 0a2f9a9b84..dc1333f2f3 100644 --- a/packages/common/evmUtils/src/operations/transaction/getTransactionOperation.ts +++ b/packages/common/evmUtils/src/operations/transaction/getTransactionOperation.ts @@ -115,10 +115,7 @@ function deserializeResponse(jsonResponse: GetTransactionJSONResponse, request: ), internalTransactions: (jsonResponse.internal_transactions ?? []).map((jsonInternalTransaction) => { const internalTransaction = toCamelCase(jsonInternalTransaction); - return EvmInternalTransaction.create({ - chain, - ...internalTransaction, - }); + return EvmInternalTransaction.create(internalTransaction); }), receiptRoot: jsonResponse.receipt_root as string, receiptStatus: jsonResponse.receipt_status, diff --git a/packages/common/evmUtils/src/operations/transaction/getWalletTransactionsOperation.ts b/packages/common/evmUtils/src/operations/transaction/getWalletTransactionsOperation.ts index fe9f49a4f9..33b54f004c 100644 --- a/packages/common/evmUtils/src/operations/transaction/getWalletTransactionsOperation.ts +++ b/packages/common/evmUtils/src/operations/transaction/getWalletTransactionsOperation.ts @@ -123,7 +123,6 @@ function deserializeResponse( core: Core, ) { return (jsonResponse.result ?? []).map((transfer) => { - const chain = EvmChainResolver.resolve(request.chain, core); return EvmTransaction.create({ cumulativeGasUsed: transfer.receipt_cumulative_gas_used, gasPrice: transfer.gas_price, @@ -145,10 +144,7 @@ function deserializeResponse( to: transfer.to_address ? (transfer.to_address as string) : null, internalTransactions: (transfer.internal_transactions ?? []).map((jsonInternalTransaction) => { const internalTransaction = toCamelCase(jsonInternalTransaction); - return EvmInternalTransaction.create({ - chain, - ...internalTransaction, - }); + return EvmInternalTransaction.create(internalTransaction); }), }); }); diff --git a/packages/evmApi/integration/test/getWalletActiveChains.test.ts b/packages/evmApi/integration/test/getWalletActiveChains.test.ts index a752886117..ec61522ebf 100644 --- a/packages/evmApi/integration/test/getWalletActiveChains.test.ts +++ b/packages/evmApi/integration/test/getWalletActiveChains.test.ts @@ -19,7 +19,7 @@ describe('getWalletActiveChains', () => { chains: [EvmChain.ETHEREUM], }); - expect(result.result.address).toBe('0x78605df79524164911c144801f41e9811b7db73d'); + expect(result.result.address.checksum).toBe('0x78605Df79524164911C144801f41e9811B7DB73D'); const ac0 = result.result.activeChains[0]; expect(ac0.chain).toBe('eth'); expect(ac0.chainId).toBe('0x1'); diff --git a/packages/evmApi/src/generated/ClientEvmApi.ts b/packages/evmApi/src/generated/ClientEvmApi.ts index 78f60dad7e..05aef4b63d 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, 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, 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, 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 { NullableOperationResolver, OperationResolver, OperationV3Resolver, PaginatedOperationResolver, PaginatedResponseV3Adapter, PaginatedOperationV3Resolver } from '@moralisweb3/api-utils'; import { ApiModule, ResponseAdapter } from '@moralisweb3/common-core'; export abstract class ClientEvmApi extends ApiModule { @@ -202,6 +202,9 @@ export abstract class ClientEvmApi extends ApiModule { }; public readonly wallets = { + getWalletHistory: (request: GetWalletHistoryOperationRequest): Promise> => { + return new PaginatedOperationV3Resolver(GetWalletHistoryOperation, this.baseUrl, this.core).fetch(request, null); + }, getWalletTokenBalancesPrice: (request: GetWalletTokenBalancesPriceOperationRequest): Promise> => { return new PaginatedOperationV3Resolver(GetWalletTokenBalancesPriceOperation, this.baseUrl, this.core).fetch(request, null); }, From 0bf8d132bccfda26d43f03a5bc8069aeaa2de60e Mon Sep 17 00:00:00 2001 From: b4rtaz Date: Thu, 18 Apr 2024 13:18:36 +0200 Subject: [PATCH 2/3] fix: prettier. --- packages/apiGenerator/src/generator/Generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apiGenerator/src/generator/Generator.ts b/packages/apiGenerator/src/generator/Generator.ts index 2b96d0a6fd..8bab776f7e 100644 --- a/packages/apiGenerator/src/generator/Generator.ts +++ b/packages/apiGenerator/src/generator/Generator.ts @@ -54,7 +54,7 @@ export class Generator { ) {} public generate() { - const excludedRefs = new Set(this.configuration.mappings.refs.map(r => r.refs).flat()); + const excludedRefs = new Set(this.configuration.mappings.refs.map((r) => r.refs).flat()); this.writer.prepare(); From 4d124a5bf8a1d7ef9cd7b3e8380aa0bbea47c1ea Mon Sep 17 00:00:00 2001 From: b4rtaz Date: Thu, 18 Apr 2024 13:36:40 +0200 Subject: [PATCH 3/3] fix: typo. --- .../EvmInternalTransaction/EvmInternalTransaction.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts index ae6fcbda59..24922dc877 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmInternalTransaction/EvmInternalTransaction.test.ts @@ -50,7 +50,7 @@ describe('EvmInternalTransaction', () => { gas: '263200', gas_used: '2569', block_number: '16876143', - block_nash: '0xc8d7592122307a771c5172af09699b5a2d36fa540d0fbc656f3d52c619c7536e', + block_hash: '0xc8d7592122307a771c5172af09699b5a2d36fa540d0fbc656f3d52c619c7536e', input: '0x96e494e8d40a37cd10c71cb3896d1b05b6c707e29cb5aeff0278c6fc7e5e5b31623a1baa', output: '0x0000000000000000000000000000000000000000000000000000000000000001', value: '100000',