diff --git a/docs/evm_api/block.md b/docs/evm_api/block.md index 86b139e..67fd7f5 100644 --- a/docs/evm_api/block.md +++ b/docs/evm_api/block.md @@ -5,6 +5,7 @@ - [get_block](#get_block) - [get_block_stats](#get_block_stats) - [get_date_to_block](#get_date_to_block) +- [get_latest_block_number](#get_latest_block_number) --- @@ -117,5 +118,39 @@ print(result) +--- +## get_latest_block_number + +> `evm_api.block.get_latest_block_number()` + +Returns the latest block number for the given chain. + + +### Example +```python +from moralis import evm_api + +api_key = "YOUR_API_KEY" +params = { + "chain": "eth", +} + +result = evm_api.block.get_latest_block_number( + api_key=api_key, + params=params, +) + +print(result) + +``` + +### Parameters + +| Name | Type | Description | Required | Default | Example | +|------|------|-------------|----------|---------|---------| +| chain | enum[str]:
- "eth"
- "0x1"
- "sepolia"
- "0xaa36a7"
- "polygon"
- "0x89"
- "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 sepolia"
- "0x14a34"
- "optimism"
- "0xa"
- "holesky"
- "0x4268"
- "polygon amoy"
- "0x13882"
- "linea"
- "0xe708"
- "moonbeam"
- "0x504"
- "moonriver"
- "0x505"
- "moonbase"
- "0x507"
- "linea sepolia"
- "0xe705" | The chain to query | Yes | "eth" | "eth" | + + + diff --git a/docs/evm_api/token.md b/docs/evm_api/token.md index 9fbe77a..c2ae8fb 100644 --- a/docs/evm_api/token.md +++ b/docs/evm_api/token.md @@ -381,7 +381,7 @@ print(result) | Name | Type | Description | Required | Default | Example | |------|------|-------------|----------|---------|---------| | address | str | The ERC20 token address. | Yes | | "" | -| days | str | Timeframe in days for which profitability is calculated, Options include 'all', '7', '30', '60', '90' default is 'all'. | | | "" | +| days | str | Timeframe in days for which profitability is calculated, Options include 'all', '7', '30' default is 'all'. | | | "" | | chain | enum[str]:
- "eth"
- "mainnet"
- "0x1"
- "matic"
- "0x89"
- "polygon"
- "bsc"
- "binance"
- "0x38"
- "fantom"
- "ftm"
- "0xfa"
- "arbitrum"
- "0xa4b1"
- "optimism"
- "0xa"
- "pulsechain"
- "0x171"
- "base"
- "0x2105"
- "linea"
- "0xe708" | The chain to query | | | "eth" | diff --git a/src/moralis/evm_api/block/block.py b/src/moralis/evm_api/block/block.py index d90eefa..07d129c 100644 --- a/src/moralis/evm_api/block/block.py +++ b/src/moralis/evm_api/block/block.py @@ -1,3 +1,4 @@ from .get_block import get_block from .get_block_stats import get_block_stats from .get_date_to_block import get_date_to_block +from .get_latest_block_number import get_latest_block_number diff --git a/src/moralis/evm_api/block/get_latest_block_number.py b/src/moralis/evm_api/block/get_latest_block_number.py new file mode 100644 index 0000000..cb7a855 --- /dev/null +++ b/src/moralis/evm_api/block/get_latest_block_number.py @@ -0,0 +1,25 @@ +import json +import typing +import typing_extensions +from .api_instance import get_api_instance +from openapi_evm_api.paths.latest_block_number_chain.get import RequestPathParams + + + + + +class Params(RequestPathParams,): + pass + +def get_latest_block_number(api_key: str, params: Params): + api_instance = get_api_instance(api_key, params) + path_params: typing.Any = {k: v for k, v in params.items() if k in RequestPathParams.__annotations__.keys()} + api_response = api_instance.get_latest_block_number( + path_params=path_params, + accept_content_types=( + 'application/json; charset=utf-8', + ), + skip_deserialization=True + ) + + return json.loads(api_response.response.data) diff --git a/src/openapi_evm_api/apis/path_to_api.py b/src/openapi_evm_api/apis/path_to_api.py index 219804d..cd0ef28 100644 --- a/src/openapi_evm_api/apis/path_to_api.py +++ b/src/openapi_evm_api/apis/path_to_api.py @@ -46,6 +46,7 @@ from openapi_evm_api.apis.paths.transaction_transaction_hash import TransactionTransactionHash from openapi_evm_api.apis.paths.transaction_transaction_hash_verbose import TransactionTransactionHashVerbose from openapi_evm_api.apis.paths.block_block_number_or_hash import BlockBlockNumberOrHash +from openapi_evm_api.apis.paths.latest_block_number_chain import LatestBlockNumberChain from openapi_evm_api.apis.paths.date_to_block import DateToBlock from openapi_evm_api.apis.paths.address_logs import AddressLogs from openapi_evm_api.apis.paths.address_events import AddressEvents @@ -138,6 +139,7 @@ PathValues.TRANSACTION_TRANSACTION_HASH: TransactionTransactionHash, PathValues.TRANSACTION_TRANSACTION_HASH_VERBOSE: TransactionTransactionHashVerbose, PathValues.BLOCK_BLOCK_NUMBER_OR_HASH: BlockBlockNumberOrHash, + PathValues.LATEST_BLOCK_NUMBER_CHAIN: LatestBlockNumberChain, PathValues.DATE_TO_BLOCK: DateToBlock, PathValues.ADDRESS_LOGS: AddressLogs, PathValues.ADDRESS_EVENTS: AddressEvents, @@ -231,6 +233,7 @@ PathValues.TRANSACTION_TRANSACTION_HASH: TransactionTransactionHash, PathValues.TRANSACTION_TRANSACTION_HASH_VERBOSE: TransactionTransactionHashVerbose, PathValues.BLOCK_BLOCK_NUMBER_OR_HASH: BlockBlockNumberOrHash, + PathValues.LATEST_BLOCK_NUMBER_CHAIN: LatestBlockNumberChain, PathValues.DATE_TO_BLOCK: DateToBlock, PathValues.ADDRESS_LOGS: AddressLogs, PathValues.ADDRESS_EVENTS: AddressEvents, diff --git a/src/openapi_evm_api/apis/paths/latest_block_number_chain.py b/src/openapi_evm_api/apis/paths/latest_block_number_chain.py new file mode 100644 index 0000000..bc05798 --- /dev/null +++ b/src/openapi_evm_api/apis/paths/latest_block_number_chain.py @@ -0,0 +1,7 @@ +from openapi_evm_api.paths.latest_block_number_chain.get import ApiForget + + +class LatestBlockNumberChain( + ApiForget, +): + pass diff --git a/src/openapi_evm_api/apis/tags/block_api.py b/src/openapi_evm_api/apis/tags/block_api.py index 6d94b36..0911cdc 100644 --- a/src/openapi_evm_api/apis/tags/block_api.py +++ b/src/openapi_evm_api/apis/tags/block_api.py @@ -12,12 +12,14 @@ from openapi_evm_api.paths.block_block_number_or_hash.get import GetBlock from openapi_evm_api.paths.block_block_number_or_hash_stats.get import GetBlockStats from openapi_evm_api.paths.date_to_block.get import GetDateToBlock +from openapi_evm_api.paths.latest_block_number_chain.get import GetLatestBlockNumber class BlockApi( GetBlock, GetBlockStats, GetDateToBlock, + GetLatestBlockNumber, ): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech diff --git a/src/openapi_evm_api/model/wallet_profitability_token_data.py b/src/openapi_evm_api/model/wallet_profitability_token_data.py index 839ba8e..4be912d 100644 --- a/src/openapi_evm_api/model/wallet_profitability_token_data.py +++ b/src/openapi_evm_api/model/wallet_profitability_token_data.py @@ -37,7 +37,6 @@ class MetaOapg: required = { "symbol", "total_tokens_bought", - "thumbnail", "total_buys", "total_sells", "avg_cost_of_quantity_sold", @@ -46,13 +45,13 @@ class MetaOapg: "avg_sell_price_usd", "total_usd_invested", "realized_profit_usd", + "possible_spam", "realized_profit_percentage", "decimals", "avg_buy_price_usd", "name", "total_tokens_sold", "logo", - "logo_hash", "total_sold_usd", } @@ -74,8 +73,6 @@ class properties: symbol = schemas.StrSchema decimals = schemas.StrSchema logo = schemas.StrSchema - logo_hash = schemas.StrSchema - thumbnail = schemas.StrSchema possible_spam = schemas.BoolSchema __annotations__ = { "token_address": token_address, @@ -95,14 +92,11 @@ class properties: "symbol": symbol, "decimals": decimals, "logo": logo, - "logo_hash": logo_hash, - "thumbnail": thumbnail, "possible_spam": possible_spam, } symbol: MetaOapg.properties.symbol total_tokens_bought: MetaOapg.properties.total_tokens_bought - thumbnail: MetaOapg.properties.thumbnail total_buys: MetaOapg.properties.total_buys total_sells: MetaOapg.properties.total_sells avg_cost_of_quantity_sold: MetaOapg.properties.avg_cost_of_quantity_sold @@ -111,13 +105,13 @@ class properties: avg_sell_price_usd: MetaOapg.properties.avg_sell_price_usd total_usd_invested: MetaOapg.properties.total_usd_invested realized_profit_usd: MetaOapg.properties.realized_profit_usd + possible_spam: MetaOapg.properties.possible_spam realized_profit_percentage: MetaOapg.properties.realized_profit_percentage decimals: MetaOapg.properties.decimals avg_buy_price_usd: MetaOapg.properties.avg_buy_price_usd name: MetaOapg.properties.name total_tokens_sold: MetaOapg.properties.total_tokens_sold logo: MetaOapg.properties.logo - logo_hash: MetaOapg.properties.logo_hash total_sold_usd: MetaOapg.properties.total_sold_usd @typing.overload @@ -171,19 +165,13 @@ def __getitem__(self, name: typing_extensions.Literal["decimals"]) -> MetaOapg.p @typing.overload def __getitem__(self, name: typing_extensions.Literal["logo"]) -> MetaOapg.properties.logo: ... - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["logo_hash"]) -> MetaOapg.properties.logo_hash: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["thumbnail"]) -> MetaOapg.properties.thumbnail: ... - @typing.overload def __getitem__(self, name: typing_extensions.Literal["possible_spam"]) -> MetaOapg.properties.possible_spam: ... @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "logo_hash", "thumbnail", "possible_spam", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "possible_spam", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -240,18 +228,12 @@ def get_item_oapg(self, name: typing_extensions.Literal["decimals"]) -> MetaOapg def get_item_oapg(self, name: typing_extensions.Literal["logo"]) -> MetaOapg.properties.logo: ... @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["logo_hash"]) -> MetaOapg.properties.logo_hash: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["thumbnail"]) -> MetaOapg.properties.thumbnail: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["possible_spam"]) -> typing.Union[MetaOapg.properties.possible_spam, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["possible_spam"]) -> MetaOapg.properties.possible_spam: ... @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "logo_hash", "thumbnail", "possible_spam", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "possible_spam", ], str]): return super().get_item_oapg(name) @@ -260,7 +242,6 @@ def __new__( *args: typing.Union[dict, frozendict.frozendict, ], symbol: typing.Union[MetaOapg.properties.symbol, str, ], total_tokens_bought: typing.Union[MetaOapg.properties.total_tokens_bought, str, ], - thumbnail: typing.Union[MetaOapg.properties.thumbnail, str, ], total_buys: typing.Union[MetaOapg.properties.total_buys, decimal.Decimal, int, float, ], total_sells: typing.Union[MetaOapg.properties.total_sells, decimal.Decimal, int, float, ], avg_cost_of_quantity_sold: typing.Union[MetaOapg.properties.avg_cost_of_quantity_sold, str, ], @@ -269,15 +250,14 @@ def __new__( avg_sell_price_usd: typing.Union[MetaOapg.properties.avg_sell_price_usd, str, ], total_usd_invested: typing.Union[MetaOapg.properties.total_usd_invested, str, ], realized_profit_usd: typing.Union[MetaOapg.properties.realized_profit_usd, str, ], + possible_spam: typing.Union[MetaOapg.properties.possible_spam, bool, ], realized_profit_percentage: typing.Union[MetaOapg.properties.realized_profit_percentage, decimal.Decimal, int, float, ], decimals: typing.Union[MetaOapg.properties.decimals, str, ], avg_buy_price_usd: typing.Union[MetaOapg.properties.avg_buy_price_usd, str, ], name: typing.Union[MetaOapg.properties.name, str, ], total_tokens_sold: typing.Union[MetaOapg.properties.total_tokens_sold, str, ], logo: typing.Union[MetaOapg.properties.logo, str, ], - logo_hash: typing.Union[MetaOapg.properties.logo_hash, str, ], total_sold_usd: typing.Union[MetaOapg.properties.total_sold_usd, str, ], - possible_spam: typing.Union[MetaOapg.properties.possible_spam, bool, schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'WalletProfitabilityTokenData': @@ -286,7 +266,6 @@ def __new__( *args, symbol=symbol, total_tokens_bought=total_tokens_bought, - thumbnail=thumbnail, total_buys=total_buys, total_sells=total_sells, avg_cost_of_quantity_sold=avg_cost_of_quantity_sold, @@ -295,15 +274,14 @@ def __new__( avg_sell_price_usd=avg_sell_price_usd, total_usd_invested=total_usd_invested, realized_profit_usd=realized_profit_usd, + possible_spam=possible_spam, realized_profit_percentage=realized_profit_percentage, decimals=decimals, avg_buy_price_usd=avg_buy_price_usd, name=name, total_tokens_sold=total_tokens_sold, logo=logo, - logo_hash=logo_hash, total_sold_usd=total_sold_usd, - possible_spam=possible_spam, _configuration=_configuration, **kwargs, ) diff --git a/src/openapi_evm_api/model/wallet_profitability_token_data.pyi b/src/openapi_evm_api/model/wallet_profitability_token_data.pyi index 839ba8e..4be912d 100644 --- a/src/openapi_evm_api/model/wallet_profitability_token_data.pyi +++ b/src/openapi_evm_api/model/wallet_profitability_token_data.pyi @@ -37,7 +37,6 @@ class WalletProfitabilityTokenData( required = { "symbol", "total_tokens_bought", - "thumbnail", "total_buys", "total_sells", "avg_cost_of_quantity_sold", @@ -46,13 +45,13 @@ class WalletProfitabilityTokenData( "avg_sell_price_usd", "total_usd_invested", "realized_profit_usd", + "possible_spam", "realized_profit_percentage", "decimals", "avg_buy_price_usd", "name", "total_tokens_sold", "logo", - "logo_hash", "total_sold_usd", } @@ -74,8 +73,6 @@ class WalletProfitabilityTokenData( symbol = schemas.StrSchema decimals = schemas.StrSchema logo = schemas.StrSchema - logo_hash = schemas.StrSchema - thumbnail = schemas.StrSchema possible_spam = schemas.BoolSchema __annotations__ = { "token_address": token_address, @@ -95,14 +92,11 @@ class WalletProfitabilityTokenData( "symbol": symbol, "decimals": decimals, "logo": logo, - "logo_hash": logo_hash, - "thumbnail": thumbnail, "possible_spam": possible_spam, } symbol: MetaOapg.properties.symbol total_tokens_bought: MetaOapg.properties.total_tokens_bought - thumbnail: MetaOapg.properties.thumbnail total_buys: MetaOapg.properties.total_buys total_sells: MetaOapg.properties.total_sells avg_cost_of_quantity_sold: MetaOapg.properties.avg_cost_of_quantity_sold @@ -111,13 +105,13 @@ class WalletProfitabilityTokenData( avg_sell_price_usd: MetaOapg.properties.avg_sell_price_usd total_usd_invested: MetaOapg.properties.total_usd_invested realized_profit_usd: MetaOapg.properties.realized_profit_usd + possible_spam: MetaOapg.properties.possible_spam realized_profit_percentage: MetaOapg.properties.realized_profit_percentage decimals: MetaOapg.properties.decimals avg_buy_price_usd: MetaOapg.properties.avg_buy_price_usd name: MetaOapg.properties.name total_tokens_sold: MetaOapg.properties.total_tokens_sold logo: MetaOapg.properties.logo - logo_hash: MetaOapg.properties.logo_hash total_sold_usd: MetaOapg.properties.total_sold_usd @typing.overload @@ -171,19 +165,13 @@ class WalletProfitabilityTokenData( @typing.overload def __getitem__(self, name: typing_extensions.Literal["logo"]) -> MetaOapg.properties.logo: ... - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["logo_hash"]) -> MetaOapg.properties.logo_hash: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["thumbnail"]) -> MetaOapg.properties.thumbnail: ... - @typing.overload def __getitem__(self, name: typing_extensions.Literal["possible_spam"]) -> MetaOapg.properties.possible_spam: ... @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "logo_hash", "thumbnail", "possible_spam", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "possible_spam", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -240,18 +228,12 @@ class WalletProfitabilityTokenData( def get_item_oapg(self, name: typing_extensions.Literal["logo"]) -> MetaOapg.properties.logo: ... @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["logo_hash"]) -> MetaOapg.properties.logo_hash: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["thumbnail"]) -> MetaOapg.properties.thumbnail: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["possible_spam"]) -> typing.Union[MetaOapg.properties.possible_spam, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["possible_spam"]) -> MetaOapg.properties.possible_spam: ... @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "logo_hash", "thumbnail", "possible_spam", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["token_address", "avg_buy_price_usd", "avg_sell_price_usd", "total_usd_invested", "total_tokens_sold", "total_tokens_bought", "total_sold_usd", "avg_cost_of_quantity_sold", "count_of_trades", "realized_profit_usd", "realized_profit_percentage", "total_buys", "total_sells", "name", "symbol", "decimals", "logo", "possible_spam", ], str]): return super().get_item_oapg(name) @@ -260,7 +242,6 @@ class WalletProfitabilityTokenData( *args: typing.Union[dict, frozendict.frozendict, ], symbol: typing.Union[MetaOapg.properties.symbol, str, ], total_tokens_bought: typing.Union[MetaOapg.properties.total_tokens_bought, str, ], - thumbnail: typing.Union[MetaOapg.properties.thumbnail, str, ], total_buys: typing.Union[MetaOapg.properties.total_buys, decimal.Decimal, int, float, ], total_sells: typing.Union[MetaOapg.properties.total_sells, decimal.Decimal, int, float, ], avg_cost_of_quantity_sold: typing.Union[MetaOapg.properties.avg_cost_of_quantity_sold, str, ], @@ -269,15 +250,14 @@ class WalletProfitabilityTokenData( avg_sell_price_usd: typing.Union[MetaOapg.properties.avg_sell_price_usd, str, ], total_usd_invested: typing.Union[MetaOapg.properties.total_usd_invested, str, ], realized_profit_usd: typing.Union[MetaOapg.properties.realized_profit_usd, str, ], + possible_spam: typing.Union[MetaOapg.properties.possible_spam, bool, ], realized_profit_percentage: typing.Union[MetaOapg.properties.realized_profit_percentage, decimal.Decimal, int, float, ], decimals: typing.Union[MetaOapg.properties.decimals, str, ], avg_buy_price_usd: typing.Union[MetaOapg.properties.avg_buy_price_usd, str, ], name: typing.Union[MetaOapg.properties.name, str, ], total_tokens_sold: typing.Union[MetaOapg.properties.total_tokens_sold, str, ], logo: typing.Union[MetaOapg.properties.logo, str, ], - logo_hash: typing.Union[MetaOapg.properties.logo_hash, str, ], total_sold_usd: typing.Union[MetaOapg.properties.total_sold_usd, str, ], - possible_spam: typing.Union[MetaOapg.properties.possible_spam, bool, schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'WalletProfitabilityTokenData': @@ -286,7 +266,6 @@ class WalletProfitabilityTokenData( *args, symbol=symbol, total_tokens_bought=total_tokens_bought, - thumbnail=thumbnail, total_buys=total_buys, total_sells=total_sells, avg_cost_of_quantity_sold=avg_cost_of_quantity_sold, @@ -295,15 +274,14 @@ class WalletProfitabilityTokenData( avg_sell_price_usd=avg_sell_price_usd, total_usd_invested=total_usd_invested, realized_profit_usd=realized_profit_usd, + possible_spam=possible_spam, realized_profit_percentage=realized_profit_percentage, decimals=decimals, avg_buy_price_usd=avg_buy_price_usd, name=name, total_tokens_sold=total_tokens_sold, logo=logo, - logo_hash=logo_hash, total_sold_usd=total_sold_usd, - possible_spam=possible_spam, _configuration=_configuration, **kwargs, ) diff --git a/src/openapi_evm_api/paths/__init__.py b/src/openapi_evm_api/paths/__init__.py index 078393d..d51e86b 100644 --- a/src/openapi_evm_api/paths/__init__.py +++ b/src/openapi_evm_api/paths/__init__.py @@ -51,6 +51,7 @@ class PathValues(str, enum.Enum): TRANSACTION_TRANSACTION_HASH = "/transaction/{transaction_hash}" TRANSACTION_TRANSACTION_HASH_VERBOSE = "/transaction/{transaction_hash}/verbose" BLOCK_BLOCK_NUMBER_OR_HASH = "/block/{block_number_or_hash}" + LATEST_BLOCK_NUMBER_CHAIN = "/latestBlockNumber/{chain}" DATE_TO_BLOCK = "/dateToBlock" ADDRESS_LOGS = "/{address}/logs" ADDRESS_EVENTS = "/{address}/events" diff --git a/src/openapi_evm_api/paths/latest_block_number_chain/__init__.py b/src/openapi_evm_api/paths/latest_block_number_chain/__init__.py new file mode 100644 index 0000000..e1b15d4 --- /dev/null +++ b/src/openapi_evm_api/paths/latest_block_number_chain/__init__.py @@ -0,0 +1,7 @@ +# do not import all endpoints into this module because that uses a lot of memory and stack frames +# if you need the ability to import all endpoints from this module, import them with +# from openapi_evm_api.paths.latest_block_number_chain import Api + +from openapi_evm_api.paths import PathValues + +path = PathValues.LATEST_BLOCK_NUMBER_CHAIN \ No newline at end of file diff --git a/src/openapi_evm_api/paths/latest_block_number_chain/get.py b/src/openapi_evm_api/paths/latest_block_number_chain/get.py new file mode 100644 index 0000000..b68caa0 --- /dev/null +++ b/src/openapi_evm_api/paths/latest_block_number_chain/get.py @@ -0,0 +1,293 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from openapi_evm_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from openapi_evm_api import schemas # noqa: F401 + +from openapi_evm_api.model.chain_list import ChainList + +from . import path + +# Path params +ChainSchema = ChainList +RequestRequiredPathParams = typing_extensions.TypedDict( + 'RequestRequiredPathParams', + { + 'chain': typing.Union[ChainSchema, ], + } +) +RequestOptionalPathParams = typing_extensions.TypedDict( + 'RequestOptionalPathParams', + { + }, + total=False +) + + +class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): + pass + + +request_path_chain = api_client.PathParameter( + name="chain", + style=api_client.ParameterStyle.SIMPLE, + schema=ChainSchema, + required=True, +) +_auth = [ + 'ApiKeyAuth', +] +SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema + + +@dataclass +class ApiResponseFor200(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor200ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_200 = api_client.OpenApiResponse( + response_cls=ApiResponseFor200, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), + }, +) +_status_code_to_response = { + '200': _response_for_200, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_latest_block_number_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def _get_latest_block_number_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_latest_block_number_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_latest_block_number_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Get latest block number. + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value + + _path_params = {} + for parameter in ( + request_path_chain, + ): + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetLatestBlockNumber(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_latest_block_number( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get_latest_block_number( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_latest_block_number( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_latest_block_number( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_latest_block_number_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_latest_block_number_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/src/openapi_evm_api/paths/latest_block_number_chain/get.pyi b/src/openapi_evm_api/paths/latest_block_number_chain/get.pyi new file mode 100644 index 0000000..afb1349 --- /dev/null +++ b/src/openapi_evm_api/paths/latest_block_number_chain/get.pyi @@ -0,0 +1,285 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from openapi_evm_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from openapi_evm_api import schemas # noqa: F401 + +from openapi_evm_api.model.chain_list import ChainList + +# Path params +ChainSchema = ChainList +RequestRequiredPathParams = typing_extensions.TypedDict( + 'RequestRequiredPathParams', + { + 'chain': typing.Union[ChainSchema, ], + } +) +RequestOptionalPathParams = typing_extensions.TypedDict( + 'RequestOptionalPathParams', + { + }, + total=False +) + + +class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): + pass + + +request_path_chain = api_client.PathParameter( + name="chain", + style=api_client.ParameterStyle.SIMPLE, + schema=ChainSchema, + required=True, +) +SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema + + +@dataclass +class ApiResponseFor200(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + SchemaFor200ResponseBodyApplicationJson, + ] + headers: schemas.Unset = schemas.unset + + +_response_for_200 = api_client.OpenApiResponse( + response_cls=ApiResponseFor200, + content={ + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), + }, +) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_latest_block_number_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def _get_latest_block_number_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_latest_block_number_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_latest_block_number_oapg( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Get latest block number. + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value + + _path_params = {} + for parameter in ( + request_path_chain, + ): + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetLatestBlockNumber(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_latest_block_number( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get_latest_block_number( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_latest_block_number( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_latest_block_number( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_latest_block_number_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + ApiResponseFor200, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + ApiResponseFor200, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParams = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_latest_block_number_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + +