-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #920 from blockscout/ll/new-bclient
[BLOCKSCOUT-CLIENT] New codegenerated client!
- Loading branch information
Showing
160 changed files
with
16,078 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Blockscout client | ||
=== | ||
|
||
This is a Rust client for the [Blockscout API](https://eth.blockscout.com/api-docs). | ||
|
||
This crate was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. | ||
|
||
## Installation | ||
|
||
Put the package under your project folder in a directory named `blockscout-client` and add the following to `Cargo.toml` under `[dependencies]`: | ||
|
||
``` | ||
blockscout-client = { version = "0.1.0" } | ||
``` | ||
|
||
|
||
## Generating the client | ||
|
||
1. Install [yarn](https://yarnpkg.com/), [docker](https://www.docker.com/) | ||
2. Install dependencies and generate the client: | ||
|
||
```commandline | ||
yarn install | ||
yarn generate-from-remote | ||
``` | ||
|
||
Files that written inside [crate/.openapi-generator-ignore](crate/.openapi-generator-ignore) will be ignored by the generator. | ||
|
||
|
||
|
||
## Tests | ||
|
||
If you want to generate stubs for mocking Blockscout API, you can edit [ts-src/record-stubs.ts](ts-src/record-stubs.ts) and indicate mocked urls. | ||
|
||
```js | ||
const paths = [ | ||
"/api/v1/health", | ||
"/api/v2/blocks", | ||
... | ||
] | ||
``` | ||
|
||
And run command to record stubs: | ||
|
||
```commandline | ||
yarn record-stubs | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target/ | ||
**/*.rs.bk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md | ||
|
||
# ======= | ||
# configs | ||
# ======= | ||
Cargo.toml | ||
README.md | ||
git_push.sh | ||
.gitignore | ||
docs/*.md | ||
.travis.yml | ||
|
||
src/lib.rs | ||
|
||
# === | ||
# api | ||
# === | ||
src/apis/configuration.rs | ||
|
||
# ====== | ||
# models | ||
# ====== | ||
src/models/address_param.rs | ||
src/models/block.rs | ||
src/models/decoded_input_parameter.rs | ||
src/models/internal_transaction.rs | ||
src/models/reward.rs | ||
src/models/smart_contract.rs | ||
src/models/smart_contract_for_list.rs | ||
src/models/transaction.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
src/apis/addresses_api.rs | ||
src/apis/blocks_api.rs | ||
src/apis/config_api.rs | ||
src/apis/health_api.rs | ||
src/apis/main_page_api.rs | ||
src/apis/mod.rs | ||
src/apis/search_api.rs | ||
src/apis/smart_contracts_api.rs | ||
src/apis/stats_api.rs | ||
src/apis/tokens_api.rs | ||
src/apis/transactions_api.rs | ||
src/apis/withdrawals_api.rs | ||
src/models/address.rs | ||
src/models/address_counters.rs | ||
src/models/address_tag.rs | ||
src/models/address_with_tx_count.rs | ||
src/models/argument.rs | ||
src/models/code_and_message.rs | ||
src/models/coin_balance_history_by_days_entry.rs | ||
src/models/coin_balance_history_entry.rs | ||
src/models/contract_source.rs | ||
src/models/decoded_input.rs | ||
src/models/decoded_input_log.rs | ||
src/models/decoded_input_log_parameter.rs | ||
src/models/error.rs | ||
src/models/extended_revert_reason_as_map.rs | ||
src/models/external_library.rs | ||
src/models/fee.rs | ||
src/models/get_address_blocks_validated_200_response.rs | ||
src/models/get_address_coin_balance_history_200_response.rs | ||
src/models/get_address_internal_txs_200_response.rs | ||
src/models/get_address_logs_200_response.rs | ||
src/models/get_address_token_transfers_200_response.rs | ||
src/models/get_address_tokens_200_response.rs | ||
src/models/get_addresses_200_response.rs | ||
src/models/get_block_txs_200_response.rs | ||
src/models/get_block_withdrawals_200_response.rs | ||
src/models/get_blocks_200_response.rs | ||
src/models/get_internal_txs_200_response.rs | ||
src/models/get_json_rpc_url_200_response.rs | ||
src/models/get_logs_200_response.rs | ||
src/models/get_market_chart_200_response.rs | ||
src/models/get_nft_instance_transfers_200_response.rs | ||
src/models/get_nft_instance_transfers_count_200_response.rs | ||
src/models/get_nft_instances_200_response.rs | ||
src/models/get_read_methods_200_response_inner.rs | ||
src/models/get_smart_contracts_200_response.rs | ||
src/models/get_smart_contracts_counters_200_response.rs | ||
src/models/get_state_changes_200_response.rs | ||
src/models/get_token_holders_200_response.rs | ||
src/models/get_token_instance_holders_200_response.rs | ||
src/models/get_token_token_transfers_200_response.rs | ||
src/models/get_token_transfers_200_response.rs | ||
src/models/get_tokens_list_200_response.rs | ||
src/models/get_txs_200_response.rs | ||
src/models/get_txs_chart_200_response.rs | ||
src/models/get_write_methods_200_response_inner.rs | ||
src/models/holder.rs | ||
src/models/indexing_status.rs | ||
src/models/log.rs | ||
src/models/market_chart_item.rs | ||
src/models/mod.rs | ||
src/models/nft_change.rs | ||
src/models/nft_instance.rs | ||
src/models/output_and_names.rs | ||
src/models/protobuf_any.rs | ||
src/models/query_read_method_200_response_inner.rs | ||
src/models/raw_trace.rs | ||
src/models/raw_trace_action.rs | ||
src/models/raw_trace_call_action.rs | ||
src/models/raw_trace_call_result.rs | ||
src/models/raw_trace_create_action.rs | ||
src/models/raw_trace_create_result.rs | ||
src/models/raw_trace_result.rs | ||
src/models/raw_trace_self_destruct_action.rs | ||
src/models/read_method_query_body.rs | ||
src/models/read_method_response.rs | ||
src/models/read_method_response_result.rs | ||
src/models/rpc_status.rs | ||
src/models/search_200_response.rs | ||
src/models/search_200_response_items_inner.rs | ||
src/models/search_result_address_or_contract.rs | ||
src/models/search_result_block.rs | ||
src/models/search_result_redirect.rs | ||
src/models/search_result_token.rs | ||
src/models/search_result_transaction.rs | ||
src/models/state_change.rs | ||
src/models/state_change_change.rs | ||
src/models/stats_response.rs | ||
src/models/token.rs | ||
src/models/token_balance.rs | ||
src/models/token_counters.rs | ||
src/models/token_info.rs | ||
src/models/token_transfer.rs | ||
src/models/token_transfer_total.rs | ||
src/models/total_erc1155.rs | ||
src/models/total_erc20.rs | ||
src/models/total_erc721.rs | ||
src/models/transaction_action.rs | ||
src/models/transaction_action_aave_v3_bswrf.rs | ||
src/models/transaction_action_aave_v3_enable_disable_collateral.rs | ||
src/models/transaction_action_aave_v3_liquidation_call.rs | ||
src/models/transaction_action_uniswap_v3_bcs.rs | ||
src/models/transaction_action_uniswap_v3_mint_nft.rs | ||
src/models/transaction_chart_item.rs | ||
src/models/transaction_reward.rs | ||
src/models/v1_data.rs | ||
src/models/v1_health_check_response.rs | ||
src/models/watchlist_name.rs | ||
src/models/withdrawal.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7.7.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
name = "blockscout-client" | ||
version = "0.1.0" | ||
authors = ["[email protected]"] | ||
description = "API for BlockScout web app" | ||
license = "Apache 2.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
serde = { version = "^1.0", features = ["derive"] } | ||
serde_json = { package = "serde_json_path_to_error", version = "0.1.4" } | ||
url = "^2.5" | ||
uuid = { version = "^1.8", features = ["serde", "v4"] } | ||
reqwest = { version = "^0.12", features = ["json", "multipart"] } | ||
reqwest-middleware = { version = "^0.3", features = ["json", "multipart"] } | ||
serde_with = "3.8.1" | ||
derive-new = "0.6.0" | ||
reqwest-retry = "0.5.0" | ||
|
||
|
||
[dev-dependencies] | ||
asserhttp = "0.7.1" | ||
pretty_assertions = "1.4.0" | ||
rstest = "0.21.0" | ||
stubr = { version = "0.6.2", features = ["record-reqwest", "record-standalone"] } | ||
tokio = { version = "1.38.0", features = ["full"] } | ||
|
Oops, something went wrong.