Skip to content

Commit 9e7aed2

Browse files
ErnoWweb-flow
authored andcommitted
fix: automatic api update
1 parent 91fd1fb commit 9e7aed2

File tree

13 files changed

+674
-59
lines changed

13 files changed

+674
-59
lines changed

docs/evm_api/block.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [get_block](#get_block)
66
- [get_block_stats](#get_block_stats)
77
- [get_date_to_block](#get_date_to_block)
8+
- [get_latest_block_number](#get_latest_block_number)
89

910

1011
---
@@ -117,5 +118,39 @@ print(result)
117118

118119

119120

121+
---
122+
## get_latest_block_number
123+
124+
> `evm_api.block.get_latest_block_number()`
125+
126+
Returns the latest block number for the given chain.
127+
128+
129+
### Example
130+
```python
131+
from moralis import evm_api
132+
133+
api_key = "YOUR_API_KEY"
134+
params = {
135+
"chain": "eth",
136+
}
137+
138+
result = evm_api.block.get_latest_block_number(
139+
api_key=api_key,
140+
params=params,
141+
)
142+
143+
print(result)
144+
145+
```
146+
147+
### Parameters
148+
149+
| Name | Type | Description | Required | Default | Example |
150+
|------|------|-------------|----------|---------|---------|
151+
| chain | enum[str]: <br/>- "eth"<br/>- "0x1"<br/>- "sepolia"<br/>- "0xaa36a7"<br/>- "polygon"<br/>- "0x89"<br/>- "bsc"<br/>- "0x38"<br/>- "bsc testnet"<br/>- "0x61"<br/>- "avalanche"<br/>- "0xa86a"<br/>- "fantom"<br/>- "0xfa"<br/>- "palm"<br/>- "0x2a15c308d"<br/>- "cronos"<br/>- "0x19"<br/>- "arbitrum"<br/>- "0xa4b1"<br/>- "chiliz"<br/>- "0x15b38"<br/>- "chiliz testnet"<br/>- "0x15b32"<br/>- "gnosis"<br/>- "0x64"<br/>- "gnosis testnet"<br/>- "0x27d8"<br/>- "base"<br/>- "0x2105"<br/>- "base sepolia"<br/>- "0x14a34"<br/>- "optimism"<br/>- "0xa"<br/>- "holesky"<br/>- "0x4268"<br/>- "polygon amoy"<br/>- "0x13882"<br/>- "linea"<br/>- "0xe708"<br/>- "moonbeam"<br/>- "0x504"<br/>- "moonriver"<br/>- "0x505"<br/>- "moonbase"<br/>- "0x507"<br/>- "linea sepolia"<br/>- "0xe705" | The chain to query | Yes | "eth" | "eth" |
152+
153+
154+
120155

121156

docs/evm_api/token.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ print(result)
381381
| Name | Type | Description | Required | Default | Example |
382382
|------|------|-------------|----------|---------|---------|
383383
| address | str | The ERC20 token address. | Yes | | "" |
384-
| days | str | Timeframe in days for which profitability is calculated, Options include 'all', '7', '30', '60', '90' default is 'all'. | | | "" |
384+
| days | str | Timeframe in days for which profitability is calculated, Options include 'all', '7', '30' default is 'all'. | | | "" |
385385
| chain | enum[str]: <br/>- "eth"<br/>- "mainnet"<br/>- "0x1"<br/>- "matic"<br/>- "0x89"<br/>- "polygon"<br/>- "bsc"<br/>- "binance"<br/>- "0x38"<br/>- "fantom"<br/>- "ftm"<br/>- "0xfa"<br/>- "arbitrum"<br/>- "0xa4b1"<br/>- "optimism"<br/>- "0xa"<br/>- "pulsechain"<br/>- "0x171"<br/>- "base"<br/>- "0x2105"<br/>- "linea"<br/>- "0xe708" | The chain to query | | | "eth" |
386386

387387

src/moralis/evm_api/block/block.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from .get_block import get_block
22
from .get_block_stats import get_block_stats
33
from .get_date_to_block import get_date_to_block
4+
from .get_latest_block_number import get_latest_block_number
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import json
2+
import typing
3+
import typing_extensions
4+
from .api_instance import get_api_instance
5+
from openapi_evm_api.paths.latest_block_number_chain.get import RequestPathParams
6+
7+
8+
9+
10+
11+
class Params(RequestPathParams,):
12+
pass
13+
14+
def get_latest_block_number(api_key: str, params: Params):
15+
api_instance = get_api_instance(api_key, params)
16+
path_params: typing.Any = {k: v for k, v in params.items() if k in RequestPathParams.__annotations__.keys()}
17+
api_response = api_instance.get_latest_block_number(
18+
path_params=path_params,
19+
accept_content_types=(
20+
'application/json; charset=utf-8',
21+
),
22+
skip_deserialization=True
23+
)
24+
25+
return json.loads(api_response.response.data)

src/openapi_evm_api/apis/path_to_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from openapi_evm_api.apis.paths.transaction_transaction_hash import TransactionTransactionHash
4747
from openapi_evm_api.apis.paths.transaction_transaction_hash_verbose import TransactionTransactionHashVerbose
4848
from openapi_evm_api.apis.paths.block_block_number_or_hash import BlockBlockNumberOrHash
49+
from openapi_evm_api.apis.paths.latest_block_number_chain import LatestBlockNumberChain
4950
from openapi_evm_api.apis.paths.date_to_block import DateToBlock
5051
from openapi_evm_api.apis.paths.address_logs import AddressLogs
5152
from openapi_evm_api.apis.paths.address_events import AddressEvents
@@ -138,6 +139,7 @@
138139
PathValues.TRANSACTION_TRANSACTION_HASH: TransactionTransactionHash,
139140
PathValues.TRANSACTION_TRANSACTION_HASH_VERBOSE: TransactionTransactionHashVerbose,
140141
PathValues.BLOCK_BLOCK_NUMBER_OR_HASH: BlockBlockNumberOrHash,
142+
PathValues.LATEST_BLOCK_NUMBER_CHAIN: LatestBlockNumberChain,
141143
PathValues.DATE_TO_BLOCK: DateToBlock,
142144
PathValues.ADDRESS_LOGS: AddressLogs,
143145
PathValues.ADDRESS_EVENTS: AddressEvents,
@@ -231,6 +233,7 @@
231233
PathValues.TRANSACTION_TRANSACTION_HASH: TransactionTransactionHash,
232234
PathValues.TRANSACTION_TRANSACTION_HASH_VERBOSE: TransactionTransactionHashVerbose,
233235
PathValues.BLOCK_BLOCK_NUMBER_OR_HASH: BlockBlockNumberOrHash,
236+
PathValues.LATEST_BLOCK_NUMBER_CHAIN: LatestBlockNumberChain,
234237
PathValues.DATE_TO_BLOCK: DateToBlock,
235238
PathValues.ADDRESS_LOGS: AddressLogs,
236239
PathValues.ADDRESS_EVENTS: AddressEvents,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from openapi_evm_api.paths.latest_block_number_chain.get import ApiForget
2+
3+
4+
class LatestBlockNumberChain(
5+
ApiForget,
6+
):
7+
pass

src/openapi_evm_api/apis/tags/block_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
from openapi_evm_api.paths.block_block_number_or_hash.get import GetBlock
1313
from openapi_evm_api.paths.block_block_number_or_hash_stats.get import GetBlockStats
1414
from openapi_evm_api.paths.date_to_block.get import GetDateToBlock
15+
from openapi_evm_api.paths.latest_block_number_chain.get import GetLatestBlockNumber
1516

1617

1718
class BlockApi(
1819
GetBlock,
1920
GetBlockStats,
2021
GetDateToBlock,
22+
GetLatestBlockNumber,
2123
):
2224
"""NOTE: This class is auto generated by OpenAPI Generator
2325
Ref: https://openapi-generator.tech

src/openapi_evm_api/model/wallet_profitability_token_data.py

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class MetaOapg:
3737
required = {
3838
"symbol",
3939
"total_tokens_bought",
40-
"thumbnail",
4140
"total_buys",
4241
"total_sells",
4342
"avg_cost_of_quantity_sold",
@@ -46,13 +45,13 @@ class MetaOapg:
4645
"avg_sell_price_usd",
4746
"total_usd_invested",
4847
"realized_profit_usd",
48+
"possible_spam",
4949
"realized_profit_percentage",
5050
"decimals",
5151
"avg_buy_price_usd",
5252
"name",
5353
"total_tokens_sold",
5454
"logo",
55-
"logo_hash",
5655
"total_sold_usd",
5756
}
5857

@@ -74,8 +73,6 @@ class properties:
7473
symbol = schemas.StrSchema
7574
decimals = schemas.StrSchema
7675
logo = schemas.StrSchema
77-
logo_hash = schemas.StrSchema
78-
thumbnail = schemas.StrSchema
7976
possible_spam = schemas.BoolSchema
8077
__annotations__ = {
8178
"token_address": token_address,
@@ -95,14 +92,11 @@ class properties:
9592
"symbol": symbol,
9693
"decimals": decimals,
9794
"logo": logo,
98-
"logo_hash": logo_hash,
99-
"thumbnail": thumbnail,
10095
"possible_spam": possible_spam,
10196
}
10297

10398
symbol: MetaOapg.properties.symbol
10499
total_tokens_bought: MetaOapg.properties.total_tokens_bought
105-
thumbnail: MetaOapg.properties.thumbnail
106100
total_buys: MetaOapg.properties.total_buys
107101
total_sells: MetaOapg.properties.total_sells
108102
avg_cost_of_quantity_sold: MetaOapg.properties.avg_cost_of_quantity_sold
@@ -111,13 +105,13 @@ class properties:
111105
avg_sell_price_usd: MetaOapg.properties.avg_sell_price_usd
112106
total_usd_invested: MetaOapg.properties.total_usd_invested
113107
realized_profit_usd: MetaOapg.properties.realized_profit_usd
108+
possible_spam: MetaOapg.properties.possible_spam
114109
realized_profit_percentage: MetaOapg.properties.realized_profit_percentage
115110
decimals: MetaOapg.properties.decimals
116111
avg_buy_price_usd: MetaOapg.properties.avg_buy_price_usd
117112
name: MetaOapg.properties.name
118113
total_tokens_sold: MetaOapg.properties.total_tokens_sold
119114
logo: MetaOapg.properties.logo
120-
logo_hash: MetaOapg.properties.logo_hash
121115
total_sold_usd: MetaOapg.properties.total_sold_usd
122116

123117
@typing.overload
@@ -171,19 +165,13 @@ def __getitem__(self, name: typing_extensions.Literal["decimals"]) -> MetaOapg.p
171165
@typing.overload
172166
def __getitem__(self, name: typing_extensions.Literal["logo"]) -> MetaOapg.properties.logo: ...
173167

174-
@typing.overload
175-
def __getitem__(self, name: typing_extensions.Literal["logo_hash"]) -> MetaOapg.properties.logo_hash: ...
176-
177-
@typing.overload
178-
def __getitem__(self, name: typing_extensions.Literal["thumbnail"]) -> MetaOapg.properties.thumbnail: ...
179-
180168
@typing.overload
181169
def __getitem__(self, name: typing_extensions.Literal["possible_spam"]) -> MetaOapg.properties.possible_spam: ...
182170

183171
@typing.overload
184172
def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
185173

186-
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]):
174+
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]):
187175
# dict_instance[name] accessor
188176
return super().__getitem__(name)
189177

@@ -240,18 +228,12 @@ def get_item_oapg(self, name: typing_extensions.Literal["decimals"]) -> MetaOapg
240228
def get_item_oapg(self, name: typing_extensions.Literal["logo"]) -> MetaOapg.properties.logo: ...
241229

242230
@typing.overload
243-
def get_item_oapg(self, name: typing_extensions.Literal["logo_hash"]) -> MetaOapg.properties.logo_hash: ...
244-
245-
@typing.overload
246-
def get_item_oapg(self, name: typing_extensions.Literal["thumbnail"]) -> MetaOapg.properties.thumbnail: ...
247-
248-
@typing.overload
249-
def get_item_oapg(self, name: typing_extensions.Literal["possible_spam"]) -> typing.Union[MetaOapg.properties.possible_spam, schemas.Unset]: ...
231+
def get_item_oapg(self, name: typing_extensions.Literal["possible_spam"]) -> MetaOapg.properties.possible_spam: ...
250232

251233
@typing.overload
252234
def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
253235

254-
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]):
236+
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]):
255237
return super().get_item_oapg(name)
256238

257239

@@ -260,7 +242,6 @@ def __new__(
260242
*args: typing.Union[dict, frozendict.frozendict, ],
261243
symbol: typing.Union[MetaOapg.properties.symbol, str, ],
262244
total_tokens_bought: typing.Union[MetaOapg.properties.total_tokens_bought, str, ],
263-
thumbnail: typing.Union[MetaOapg.properties.thumbnail, str, ],
264245
total_buys: typing.Union[MetaOapg.properties.total_buys, decimal.Decimal, int, float, ],
265246
total_sells: typing.Union[MetaOapg.properties.total_sells, decimal.Decimal, int, float, ],
266247
avg_cost_of_quantity_sold: typing.Union[MetaOapg.properties.avg_cost_of_quantity_sold, str, ],
@@ -269,15 +250,14 @@ def __new__(
269250
avg_sell_price_usd: typing.Union[MetaOapg.properties.avg_sell_price_usd, str, ],
270251
total_usd_invested: typing.Union[MetaOapg.properties.total_usd_invested, str, ],
271252
realized_profit_usd: typing.Union[MetaOapg.properties.realized_profit_usd, str, ],
253+
possible_spam: typing.Union[MetaOapg.properties.possible_spam, bool, ],
272254
realized_profit_percentage: typing.Union[MetaOapg.properties.realized_profit_percentage, decimal.Decimal, int, float, ],
273255
decimals: typing.Union[MetaOapg.properties.decimals, str, ],
274256
avg_buy_price_usd: typing.Union[MetaOapg.properties.avg_buy_price_usd, str, ],
275257
name: typing.Union[MetaOapg.properties.name, str, ],
276258
total_tokens_sold: typing.Union[MetaOapg.properties.total_tokens_sold, str, ],
277259
logo: typing.Union[MetaOapg.properties.logo, str, ],
278-
logo_hash: typing.Union[MetaOapg.properties.logo_hash, str, ],
279260
total_sold_usd: typing.Union[MetaOapg.properties.total_sold_usd, str, ],
280-
possible_spam: typing.Union[MetaOapg.properties.possible_spam, bool, schemas.Unset] = schemas.unset,
281261
_configuration: typing.Optional[schemas.Configuration] = None,
282262
**kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
283263
) -> 'WalletProfitabilityTokenData':
@@ -286,7 +266,6 @@ def __new__(
286266
*args,
287267
symbol=symbol,
288268
total_tokens_bought=total_tokens_bought,
289-
thumbnail=thumbnail,
290269
total_buys=total_buys,
291270
total_sells=total_sells,
292271
avg_cost_of_quantity_sold=avg_cost_of_quantity_sold,
@@ -295,15 +274,14 @@ def __new__(
295274
avg_sell_price_usd=avg_sell_price_usd,
296275
total_usd_invested=total_usd_invested,
297276
realized_profit_usd=realized_profit_usd,
277+
possible_spam=possible_spam,
298278
realized_profit_percentage=realized_profit_percentage,
299279
decimals=decimals,
300280
avg_buy_price_usd=avg_buy_price_usd,
301281
name=name,
302282
total_tokens_sold=total_tokens_sold,
303283
logo=logo,
304-
logo_hash=logo_hash,
305284
total_sold_usd=total_sold_usd,
306-
possible_spam=possible_spam,
307285
_configuration=_configuration,
308286
**kwargs,
309287
)

0 commit comments

Comments
 (0)