From 1835e1954ef17d4ad8389fd829d690cd0151752d Mon Sep 17 00:00:00 2001 From: Piotr Heilman Date: Thu, 19 Sep 2024 12:17:40 +0200 Subject: [PATCH] Add script to generate client. Unify some names. --- .dockerignore | 2 +- .gitignore | 1 + Dockerfile | 6 ++ README.md | 10 ++- .../tx-sitter-client/.openapi-generator/FILES | 20 +++--- crates/tx-sitter-client/Cargo.toml | 2 +- crates/tx-sitter-client/README.md | 14 ++-- crates/tx-sitter-client/docs/AdminV1Api.md | 22 +++--- .../docs/CreateNetworkRequest.md | 13 ++++ .../tx-sitter-client/docs/NetworkResponse.md | 14 ++++ .../docs/RelayerGasPriceLimitResponse.md | 12 ++++ .../tx-sitter-client/docs/RelayerResponse.md | 21 ++++++ .../docs/RelayerUpdateRequest.md | 15 ++++ crates/tx-sitter-client/docs/RelayerV1Api.md | 2 +- crates/tx-sitter-client/docs/ServiceApi.md | 2 +- .../tx-sitter-client/src/apis/admin_v1_api.rs | 20 +++--- .../src/apis/configuration.rs | 4 +- .../src/apis/relayer_v1_api.rs | 2 +- .../tx-sitter-client/src/apis/service_api.rs | 2 +- .../src/models/create_api_key_response.rs | 2 +- .../src/models/create_network_request.rs | 37 ++++++++++ .../src/models/create_relayer_request.rs | 2 +- .../src/models/create_relayer_response.rs | 2 +- .../src/models/get_tx_response.rs | 2 +- .../src/models/json_rpc_version.rs | 2 +- crates/tx-sitter-client/src/models/mod.rs | 20 +++--- .../src/models/network_response.rs | 41 +++++++++++ .../relayer_gas_price_limit_response.rs | 31 ++++++++ .../src/models/relayer_response.rs | 70 +++++++++++++++++++ .../src/models/relayer_update_request.rs | 45 ++++++++++++ .../src/models/rpc_request.rs | 2 +- .../src/models/send_tx_request.rs | 2 +- .../src/models/send_tx_response.rs | 2 +- .../src/models/transaction_priority.rs | 2 +- .../tx-sitter-client/src/models/tx_status.rs | 2 +- generate_api_client.sh | 19 +++++ src/bin/api_spec_generator.rs | 22 ++++++ src/server.rs | 35 +++++++--- tests/disabled_relayer.rs | 2 +- tests/send_too_many_txs.rs | 2 +- 40 files changed, 448 insertions(+), 80 deletions(-) create mode 100644 crates/tx-sitter-client/docs/CreateNetworkRequest.md create mode 100644 crates/tx-sitter-client/docs/NetworkResponse.md create mode 100644 crates/tx-sitter-client/docs/RelayerGasPriceLimitResponse.md create mode 100644 crates/tx-sitter-client/docs/RelayerResponse.md create mode 100644 crates/tx-sitter-client/docs/RelayerUpdateRequest.md create mode 100644 crates/tx-sitter-client/src/models/create_network_request.rs create mode 100644 crates/tx-sitter-client/src/models/network_response.rs create mode 100644 crates/tx-sitter-client/src/models/relayer_gas_price_limit_response.rs create mode 100644 crates/tx-sitter-client/src/models/relayer_response.rs create mode 100644 crates/tx-sitter-client/src/models/relayer_update_request.rs create mode 100755 generate_api_client.sh create mode 100644 src/bin/api_spec_generator.rs diff --git a/.dockerignore b/.dockerignore index 2957cfd..85dbafd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,4 @@ target/ README.md TODO.md manual_test.nu -config.toml +config.toml \ No newline at end of file diff --git a/.gitignore b/.gitignore index dc3bc43..56ed6f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ target/ .env +schema.yaml diff --git a/Dockerfile b/Dockerfile index add7e48..7d656e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,16 +23,22 @@ RUN rustup component add cargo # TODO: Hacky but it works RUN mkdir -p ./src +RUN mkdir -p ./crates/base-api-types/src RUN mkdir -p ./crates/postgres-docker-utils/src +RUN mkdir -p ./crates/tx-sitter-client/src # Copy only Cargo.toml for better caching COPY .cargo/config.toml .cargo/config.toml COPY ./Cargo.toml ./Cargo.toml COPY ./Cargo.lock ./Cargo.lock +COPY ./crates/base-api-types/Cargo.toml ./crates/base-api-types/Cargo.toml COPY ./crates/postgres-docker-utils/Cargo.toml ./crates/postgres-docker-utils/Cargo.toml +COPY ./crates/tx-sitter-client/Cargo.toml ./crates/tx-sitter-client/Cargo.toml RUN echo "fn main() {}" > ./src/main.rs +RUN echo "fn main() {}" > ./crates/base-api-types/src/main.rs RUN echo "fn main() {}" > ./crates/postgres-docker-utils/src/main.rs +RUN echo "fn main() {}" > ./crates/tx-sitter-client/src/main.rs # Prebuild dependencies RUN cargo fetch diff --git a/README.md b/README.md index 7d3a328..38a13ed 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,16 @@ can be used instead. Client crate is located in `creates/tx-sitter-client`. It is generated using official OpenAPI generator with modified template files. Modified template files are located in `client-template/` directory. Possible files to overwrite could be fined here https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/rust. -To generate client OpenAPI spec schema is required. To get one just run tx-sitter and then call `/schema.yaml` endpoint. To download schema you can use curl for example: +### Runnin script + +Just run `./generate_api_client.sh`. + +### Manual generation + +To generate client OpenAPI spec schema is required. To get one just run api spec generator command: ```shell -curl http://localhost:3000/schema.yml > schema.yaml +cargo run --bin api_spec_generator > schema.yaml ``` Client generation is done by using default OpenAPI tools. You can install generator or use docker image as shown below: diff --git a/crates/tx-sitter-client/.openapi-generator/FILES b/crates/tx-sitter-client/.openapi-generator/FILES index 7f1a432..a236dbd 100644 --- a/crates/tx-sitter-client/.openapi-generator/FILES +++ b/crates/tx-sitter-client/.openapi-generator/FILES @@ -4,15 +4,15 @@ Cargo.toml README.md docs/AdminV1Api.md docs/CreateApiKeyResponse.md +docs/CreateNetworkRequest.md docs/CreateRelayerRequest.md docs/CreateRelayerResponse.md docs/GetTxResponse.md docs/JsonRpcVersion.md -docs/NetworkInfo.md -docs/NewNetworkInfo.md -docs/RelayerGasPriceLimit.md -docs/RelayerInfo.md -docs/RelayerUpdate.md +docs/NetworkResponse.md +docs/RelayerGasPriceLimitResponse.md +docs/RelayerResponse.md +docs/RelayerUpdateRequest.md docs/RelayerV1Api.md docs/RpcRequest.md docs/SendTxRequest.md @@ -28,16 +28,16 @@ src/apis/relayer_v1_api.rs src/apis/service_api.rs src/lib.rs src/models/create_api_key_response.rs +src/models/create_network_request.rs src/models/create_relayer_request.rs src/models/create_relayer_response.rs src/models/get_tx_response.rs src/models/json_rpc_version.rs src/models/mod.rs -src/models/network_info.rs -src/models/new_network_info.rs -src/models/relayer_gas_price_limit.rs -src/models/relayer_info.rs -src/models/relayer_update.rs +src/models/network_response.rs +src/models/relayer_gas_price_limit_response.rs +src/models/relayer_response.rs +src/models/relayer_update_request.rs src/models/rpc_request.rs src/models/send_tx_request.rs src/models/send_tx_response.rs diff --git a/crates/tx-sitter-client/Cargo.toml b/crates/tx-sitter-client/Cargo.toml index 0feb7d7..ccd8b45 100644 --- a/crates/tx-sitter-client/Cargo.toml +++ b/crates/tx-sitter-client/Cargo.toml @@ -2,7 +2,7 @@ name = "tx-sitter-client" version = "0.1.0" authors = ["OpenAPI Generator team and contributors"] -description = "A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. " +description = "A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. " # Override this license by providing a License Object in the OpenAPI. license = "Unlicense" edition = "2021" diff --git a/crates/tx-sitter-client/README.md b/crates/tx-sitter-client/README.md index 2c0aa56..56e71bd 100644 --- a/crates/tx-sitter-client/README.md +++ b/crates/tx-sitter-client/README.md @@ -6,7 +6,7 @@ A transaction relayer service! ## Operating a relayer -Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. +Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. @@ -47,7 +47,7 @@ tx-sitter-client = { path = "./tx-sitter-client" } ## Documentation for API Endpoints -All URIs are relative to *http://localhost:3000* +All URIs are relative to *http://localhost:8000* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- @@ -69,15 +69,15 @@ Class | Method | HTTP request | Description ## Documentation For Models - [CreateApiKeyResponse](docs/CreateApiKeyResponse.md) + - [CreateNetworkRequest](docs/CreateNetworkRequest.md) - [CreateRelayerRequest](docs/CreateRelayerRequest.md) - [CreateRelayerResponse](docs/CreateRelayerResponse.md) - [GetTxResponse](docs/GetTxResponse.md) - [JsonRpcVersion](docs/JsonRpcVersion.md) - - [NetworkInfo](docs/NetworkInfo.md) - - [NewNetworkInfo](docs/NewNetworkInfo.md) - - [RelayerGasPriceLimit](docs/RelayerGasPriceLimit.md) - - [RelayerInfo](docs/RelayerInfo.md) - - [RelayerUpdate](docs/RelayerUpdate.md) + - [NetworkResponse](docs/NetworkResponse.md) + - [RelayerGasPriceLimitResponse](docs/RelayerGasPriceLimitResponse.md) + - [RelayerResponse](docs/RelayerResponse.md) + - [RelayerUpdateRequest](docs/RelayerUpdateRequest.md) - [RpcRequest](docs/RpcRequest.md) - [SendTxRequest](docs/SendTxRequest.md) - [SendTxResponse](docs/SendTxResponse.md) diff --git a/crates/tx-sitter-client/docs/AdminV1Api.md b/crates/tx-sitter-client/docs/AdminV1Api.md index 757c572..0257019 100644 --- a/crates/tx-sitter-client/docs/AdminV1Api.md +++ b/crates/tx-sitter-client/docs/AdminV1Api.md @@ -1,6 +1,6 @@ # \AdminV1Api -All URIs are relative to *http://localhost:3000* +All URIs are relative to *http://localhost:8000* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -17,7 +17,7 @@ Method | HTTP request | Description ## create_network -> create_network(chain_id, new_network_info) +> create_network(chain_id, create_network_request) Create Network ### Parameters @@ -26,7 +26,7 @@ Create Network Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **chain_id** | **i32** | | [required] | -**new_network_info** | [**NewNetworkInfo**](NewNetworkInfo.md) | | [required] | +**create_network_request** | [**CreateNetworkRequest**](CreateNetworkRequest.md) | | [required] | ### Return type @@ -74,7 +74,7 @@ Name | Type | Description | Required | Notes ## get_networks -> Vec get_networks() +> Vec get_networks() Get Networks ### Parameters @@ -83,7 +83,7 @@ This endpoint does not need any parameter. ### Return type -[**Vec**](NetworkInfo.md) +[**Vec**](NetworkResponse.md) ### Authorization @@ -99,7 +99,7 @@ This endpoint does not need any parameter. ## get_relayer -> models::RelayerInfo get_relayer(relayer_id) +> models::RelayerResponse get_relayer(relayer_id) Get Relayer ### Parameters @@ -111,7 +111,7 @@ Name | Type | Description | Required | Notes ### Return type -[**models::RelayerInfo**](RelayerInfo.md) +[**models::RelayerResponse**](RelayerResponse.md) ### Authorization @@ -127,7 +127,7 @@ Name | Type | Description | Required | Notes ## get_relayers -> Vec get_relayers() +> Vec get_relayers() Get Relayers ### Parameters @@ -136,7 +136,7 @@ This endpoint does not need any parameter. ### Return type -[**Vec**](RelayerInfo.md) +[**Vec**](RelayerResponse.md) ### Authorization @@ -210,7 +210,7 @@ Name | Type | Description | Required | Notes ## update_relayer -> update_relayer(relayer_id, relayer_update) +> update_relayer(relayer_id, relayer_update_request) Update Relayer ### Parameters @@ -219,7 +219,7 @@ Update Relayer Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **relayer_id** | **String** | | [required] | -**relayer_update** | [**RelayerUpdate**](RelayerUpdate.md) | | [required] | +**relayer_update_request** | [**RelayerUpdateRequest**](RelayerUpdateRequest.md) | | [required] | ### Return type diff --git a/crates/tx-sitter-client/docs/CreateNetworkRequest.md b/crates/tx-sitter-client/docs/CreateNetworkRequest.md new file mode 100644 index 0000000..bf27ad6 --- /dev/null +++ b/crates/tx-sitter-client/docs/CreateNetworkRequest.md @@ -0,0 +1,13 @@ +# CreateNetworkRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | +**http_rpc** | **String** | | +**ws_rpc** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/tx-sitter-client/docs/NetworkResponse.md b/crates/tx-sitter-client/docs/NetworkResponse.md new file mode 100644 index 0000000..4916d0e --- /dev/null +++ b/crates/tx-sitter-client/docs/NetworkResponse.md @@ -0,0 +1,14 @@ +# NetworkResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain_id** | **i32** | | +**name** | **String** | | +**http_rpc** | **String** | | +**ws_rpc** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/tx-sitter-client/docs/RelayerGasPriceLimitResponse.md b/crates/tx-sitter-client/docs/RelayerGasPriceLimitResponse.md new file mode 100644 index 0000000..f51571a --- /dev/null +++ b/crates/tx-sitter-client/docs/RelayerGasPriceLimitResponse.md @@ -0,0 +1,12 @@ +# RelayerGasPriceLimitResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | [**base_api_types::DecimalU256**](base_api_types::DecimalU256.md) | A decimal 256-bit unsigned integer | [default to 0] +**chain_id** | **i64** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/tx-sitter-client/docs/RelayerResponse.md b/crates/tx-sitter-client/docs/RelayerResponse.md new file mode 100644 index 0000000..431b1de --- /dev/null +++ b/crates/tx-sitter-client/docs/RelayerResponse.md @@ -0,0 +1,21 @@ +# RelayerResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**chain_id** | **i32** | | +**key_id** | **String** | | +**address** | [**base_api_types::Address**](base_api_types::Address.md) | Hex encoded ethereum address | +**nonce** | **i32** | | +**current_nonce** | **i32** | | +**max_inflight_txs** | **i32** | | +**max_queued_txs** | **i32** | | +**gas_price_limits** | [**Vec**](RelayerGasPriceLimitResponse.md) | | +**enabled** | **bool** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/tx-sitter-client/docs/RelayerUpdateRequest.md b/crates/tx-sitter-client/docs/RelayerUpdateRequest.md new file mode 100644 index 0000000..add0c5e --- /dev/null +++ b/crates/tx-sitter-client/docs/RelayerUpdateRequest.md @@ -0,0 +1,15 @@ +# RelayerUpdateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**relayer_name** | Option<**String**> | | [optional] +**max_inflight_txs** | Option<**i32**> | | [optional] +**max_queued_txs** | Option<**i32**> | | [optional] +**gas_price_limits** | Option<[**Vec**](RelayerGasPriceLimitResponse.md)> | | [optional] +**enabled** | Option<**bool**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/tx-sitter-client/docs/RelayerV1Api.md b/crates/tx-sitter-client/docs/RelayerV1Api.md index 80e792d..a09ee10 100644 --- a/crates/tx-sitter-client/docs/RelayerV1Api.md +++ b/crates/tx-sitter-client/docs/RelayerV1Api.md @@ -1,6 +1,6 @@ # \RelayerV1Api -All URIs are relative to *http://localhost:3000* +All URIs are relative to *http://localhost:8000* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/crates/tx-sitter-client/docs/ServiceApi.md b/crates/tx-sitter-client/docs/ServiceApi.md index 457d1e8..840d163 100644 --- a/crates/tx-sitter-client/docs/ServiceApi.md +++ b/crates/tx-sitter-client/docs/ServiceApi.md @@ -1,6 +1,6 @@ # \ServiceApi -All URIs are relative to *http://localhost:3000* +All URIs are relative to *http://localhost:8000* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/crates/tx-sitter-client/src/apis/admin_v1_api.rs b/crates/tx-sitter-client/src/apis/admin_v1_api.rs index ba5f371..4846bce 100644 --- a/crates/tx-sitter-client/src/apis/admin_v1_api.rs +++ b/crates/tx-sitter-client/src/apis/admin_v1_api.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * @@ -19,7 +19,7 @@ use crate::models; #[derive(Clone, Debug)] pub struct CreateNetworkParams { pub chain_id: i32, - pub new_network_info: models::NewNetworkInfo, + pub create_network_request: models::CreateNetworkRequest, } /// struct for passing parameters to the method [`create_relayer`] @@ -50,7 +50,7 @@ pub struct ResetRelayerParams { #[derive(Clone, Debug)] pub struct UpdateRelayerParams { pub relayer_id: String, - pub relayer_update: models::RelayerUpdate, + pub relayer_update_request: models::RelayerUpdateRequest, } /// struct for typed errors of method [`create_network`] @@ -117,7 +117,7 @@ pub async fn create_network( // unbox the parameters let chain_id = params.chain_id; - let new_network_info = params.new_network_info; + let create_network_request = params.create_network_request; let local_var_client = &local_var_configuration.client; @@ -139,7 +139,7 @@ pub async fn create_network( local_var_auth_conf.1.to_owned(), ); }; - local_var_req_builder = local_var_req_builder.json(&new_network_info); + local_var_req_builder = local_var_req_builder.json(&create_network_request); let local_var_req = local_var_req_builder.build()?; let local_var_resp = local_var_client.execute(local_var_req).await?; @@ -215,7 +215,7 @@ pub async fn create_relayer( pub async fn get_networks( configuration: &configuration::Configuration, -) -> Result, Error> { +) -> Result, Error> { let local_var_configuration = configuration; // unbox the parameters @@ -263,7 +263,7 @@ pub async fn get_networks( pub async fn get_relayer( configuration: &configuration::Configuration, params: GetRelayerParams, -) -> Result> { +) -> Result> { let local_var_configuration = configuration; // unbox the parameters @@ -314,7 +314,7 @@ pub async fn get_relayer( pub async fn get_relayers( configuration: &configuration::Configuration, -) -> Result, Error> { +) -> Result, Error> { let local_var_configuration = configuration; // unbox the parameters @@ -472,7 +472,7 @@ pub async fn update_relayer( // unbox the parameters let relayer_id = params.relayer_id; - let relayer_update = params.relayer_update; + let relayer_update_request = params.relayer_update_request; let local_var_client = &local_var_configuration.client; @@ -494,7 +494,7 @@ pub async fn update_relayer( local_var_auth_conf.1.to_owned(), ); }; - local_var_req_builder = local_var_req_builder.json(&relayer_update); + local_var_req_builder = local_var_req_builder.json(&relayer_update_request); let local_var_req = local_var_req_builder.build()?; let local_var_resp = local_var_client.execute(local_var_req).await?; diff --git a/crates/tx-sitter-client/src/apis/configuration.rs b/crates/tx-sitter-client/src/apis/configuration.rs index b19192b..011e7ca 100644 --- a/crates/tx-sitter-client/src/apis/configuration.rs +++ b/crates/tx-sitter-client/src/apis/configuration.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * @@ -31,7 +31,7 @@ pub struct ApiKey { impl Default for Configuration { fn default() -> Self { Configuration { - base_path: "http://localhost:3000".to_owned(), + base_path: "http://localhost:8000".to_owned(), user_agent: Some("OpenAPI-Generator/0.1.0/rust".to_owned()), client: reqwest_middleware::ClientBuilder::new( reqwest::Client::new(), diff --git a/crates/tx-sitter-client/src/apis/relayer_v1_api.rs b/crates/tx-sitter-client/src/apis/relayer_v1_api.rs index 9a492c0..572f3e4 100644 --- a/crates/tx-sitter-client/src/apis/relayer_v1_api.rs +++ b/crates/tx-sitter-client/src/apis/relayer_v1_api.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/apis/service_api.rs b/crates/tx-sitter-client/src/apis/service_api.rs index 1276177..976146a 100644 --- a/crates/tx-sitter-client/src/apis/service_api.rs +++ b/crates/tx-sitter-client/src/apis/service_api.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/create_api_key_response.rs b/crates/tx-sitter-client/src/models/create_api_key_response.rs index 9d15396..7f9d361 100644 --- a/crates/tx-sitter-client/src/models/create_api_key_response.rs +++ b/crates/tx-sitter-client/src/models/create_api_key_response.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/create_network_request.rs b/crates/tx-sitter-client/src/models/create_network_request.rs new file mode 100644 index 0000000..2dd3a8c --- /dev/null +++ b/crates/tx-sitter-client/src/models/create_network_request.rs @@ -0,0 +1,37 @@ +/* + * Tx Sitter + * + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * + * The version of the OpenAPI document: 0.1.0 + * + * Generated by: https://openapi-generator.tech + */ + +use serde::{Deserialize, Serialize}; + +use crate::models; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateNetworkRequest { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "httpRpc")] + pub http_rpc: String, + #[serde(rename = "wsRpc")] + pub ws_rpc: String, +} + +impl CreateNetworkRequest { + pub fn new( + name: String, + http_rpc: String, + ws_rpc: String, + ) -> CreateNetworkRequest { + CreateNetworkRequest { + name, + http_rpc, + ws_rpc, + } + } +} diff --git a/crates/tx-sitter-client/src/models/create_relayer_request.rs b/crates/tx-sitter-client/src/models/create_relayer_request.rs index 95eb406..f951c22 100644 --- a/crates/tx-sitter-client/src/models/create_relayer_request.rs +++ b/crates/tx-sitter-client/src/models/create_relayer_request.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/create_relayer_response.rs b/crates/tx-sitter-client/src/models/create_relayer_response.rs index 3381d1a..eb2ca48 100644 --- a/crates/tx-sitter-client/src/models/create_relayer_response.rs +++ b/crates/tx-sitter-client/src/models/create_relayer_response.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/get_tx_response.rs b/crates/tx-sitter-client/src/models/get_tx_response.rs index 2351c4e..870db8a 100644 --- a/crates/tx-sitter-client/src/models/get_tx_response.rs +++ b/crates/tx-sitter-client/src/models/get_tx_response.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/json_rpc_version.rs b/crates/tx-sitter-client/src/models/json_rpc_version.rs index b92696c..c340fd0 100644 --- a/crates/tx-sitter-client/src/models/json_rpc_version.rs +++ b/crates/tx-sitter-client/src/models/json_rpc_version.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/mod.rs b/crates/tx-sitter-client/src/models/mod.rs index 75f702f..3bd1f92 100644 --- a/crates/tx-sitter-client/src/models/mod.rs +++ b/crates/tx-sitter-client/src/models/mod.rs @@ -1,5 +1,7 @@ pub mod create_api_key_response; pub use self::create_api_key_response::CreateApiKeyResponse; +pub mod create_network_request; +pub use self::create_network_request::CreateNetworkRequest; pub mod create_relayer_request; pub use self::create_relayer_request::CreateRelayerRequest; pub mod create_relayer_response; @@ -8,16 +10,14 @@ pub mod get_tx_response; pub use self::get_tx_response::GetTxResponse; pub mod json_rpc_version; pub use self::json_rpc_version::JsonRpcVersion; -pub mod network_info; -pub use self::network_info::NetworkInfo; -pub mod new_network_info; -pub use self::new_network_info::NewNetworkInfo; -pub mod relayer_gas_price_limit; -pub use self::relayer_gas_price_limit::RelayerGasPriceLimit; -pub mod relayer_info; -pub use self::relayer_info::RelayerInfo; -pub mod relayer_update; -pub use self::relayer_update::RelayerUpdate; +pub mod network_response; +pub use self::network_response::NetworkResponse; +pub mod relayer_gas_price_limit_response; +pub use self::relayer_gas_price_limit_response::RelayerGasPriceLimitResponse; +pub mod relayer_response; +pub use self::relayer_response::RelayerResponse; +pub mod relayer_update_request; +pub use self::relayer_update_request::RelayerUpdateRequest; pub mod rpc_request; pub use self::rpc_request::RpcRequest; pub mod send_tx_request; diff --git a/crates/tx-sitter-client/src/models/network_response.rs b/crates/tx-sitter-client/src/models/network_response.rs new file mode 100644 index 0000000..c0ad32c --- /dev/null +++ b/crates/tx-sitter-client/src/models/network_response.rs @@ -0,0 +1,41 @@ +/* + * Tx Sitter + * + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * + * The version of the OpenAPI document: 0.1.0 + * + * Generated by: https://openapi-generator.tech + */ + +use serde::{Deserialize, Serialize}; + +use crate::models; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkResponse { + #[serde(rename = "chainId")] + pub chain_id: i32, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "httpRpc")] + pub http_rpc: String, + #[serde(rename = "wsRpc")] + pub ws_rpc: String, +} + +impl NetworkResponse { + pub fn new( + chain_id: i32, + name: String, + http_rpc: String, + ws_rpc: String, + ) -> NetworkResponse { + NetworkResponse { + chain_id, + name, + http_rpc, + ws_rpc, + } + } +} diff --git a/crates/tx-sitter-client/src/models/relayer_gas_price_limit_response.rs b/crates/tx-sitter-client/src/models/relayer_gas_price_limit_response.rs new file mode 100644 index 0000000..62dd483 --- /dev/null +++ b/crates/tx-sitter-client/src/models/relayer_gas_price_limit_response.rs @@ -0,0 +1,31 @@ +/* + * Tx Sitter + * + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * + * The version of the OpenAPI document: 0.1.0 + * + * Generated by: https://openapi-generator.tech + */ + +use serde::{Deserialize, Serialize}; + +use crate::models; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RelayerGasPriceLimitResponse { + /// A decimal 256-bit unsigned integer + #[serde(rename = "value")] + pub value: base_api_types::DecimalU256, + #[serde(rename = "chainId")] + pub chain_id: i64, +} + +impl RelayerGasPriceLimitResponse { + pub fn new( + value: base_api_types::DecimalU256, + chain_id: i64, + ) -> RelayerGasPriceLimitResponse { + RelayerGasPriceLimitResponse { value, chain_id } + } +} diff --git a/crates/tx-sitter-client/src/models/relayer_response.rs b/crates/tx-sitter-client/src/models/relayer_response.rs new file mode 100644 index 0000000..63aae09 --- /dev/null +++ b/crates/tx-sitter-client/src/models/relayer_response.rs @@ -0,0 +1,70 @@ +/* + * Tx Sitter + * + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * + * The version of the OpenAPI document: 0.1.0 + * + * Generated by: https://openapi-generator.tech + */ + +use serde::{Deserialize, Serialize}; + +use crate::models; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RelayerResponse { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "chainId")] + pub chain_id: i32, + #[serde(rename = "keyId")] + pub key_id: String, + /// Hex encoded ethereum address + #[serde(rename = "address")] + pub address: base_api_types::Address, + #[serde(rename = "nonce")] + pub nonce: i32, + #[serde(rename = "currentNonce")] + pub current_nonce: i32, + #[serde(rename = "maxInflightTxs")] + pub max_inflight_txs: i32, + #[serde(rename = "maxQueuedTxs")] + pub max_queued_txs: i32, + #[serde(rename = "gasPriceLimits")] + pub gas_price_limits: Vec, + #[serde(rename = "enabled")] + pub enabled: bool, +} + +impl RelayerResponse { + pub fn new( + id: String, + name: String, + chain_id: i32, + key_id: String, + address: base_api_types::Address, + nonce: i32, + current_nonce: i32, + max_inflight_txs: i32, + max_queued_txs: i32, + gas_price_limits: Vec, + enabled: bool, + ) -> RelayerResponse { + RelayerResponse { + id, + name, + chain_id, + key_id, + address, + nonce, + current_nonce, + max_inflight_txs, + max_queued_txs, + gas_price_limits, + enabled, + } + } +} diff --git a/crates/tx-sitter-client/src/models/relayer_update_request.rs b/crates/tx-sitter-client/src/models/relayer_update_request.rs new file mode 100644 index 0000000..7a17e0c --- /dev/null +++ b/crates/tx-sitter-client/src/models/relayer_update_request.rs @@ -0,0 +1,45 @@ +/* + * Tx Sitter + * + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * + * The version of the OpenAPI document: 0.1.0 + * + * Generated by: https://openapi-generator.tech + */ + +use serde::{Deserialize, Serialize}; + +use crate::models; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RelayerUpdateRequest { + #[serde(rename = "relayerName", skip_serializing_if = "Option::is_none")] + pub relayer_name: Option, + #[serde( + rename = "maxInflightTxs", + skip_serializing_if = "Option::is_none" + )] + pub max_inflight_txs: Option, + #[serde(rename = "maxQueuedTxs", skip_serializing_if = "Option::is_none")] + pub max_queued_txs: Option, + #[serde( + rename = "gasPriceLimits", + skip_serializing_if = "Option::is_none" + )] + pub gas_price_limits: Option>, + #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} + +impl RelayerUpdateRequest { + pub fn new() -> RelayerUpdateRequest { + RelayerUpdateRequest { + relayer_name: None, + max_inflight_txs: None, + max_queued_txs: None, + gas_price_limits: None, + enabled: None, + } + } +} diff --git a/crates/tx-sitter-client/src/models/rpc_request.rs b/crates/tx-sitter-client/src/models/rpc_request.rs index a97f016..f7bfda4 100644 --- a/crates/tx-sitter-client/src/models/rpc_request.rs +++ b/crates/tx-sitter-client/src/models/rpc_request.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/send_tx_request.rs b/crates/tx-sitter-client/src/models/send_tx_request.rs index c10f359..d212ad6 100644 --- a/crates/tx-sitter-client/src/models/send_tx_request.rs +++ b/crates/tx-sitter-client/src/models/send_tx_request.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/send_tx_response.rs b/crates/tx-sitter-client/src/models/send_tx_response.rs index 12d39ac..74fc8f9 100644 --- a/crates/tx-sitter-client/src/models/send_tx_response.rs +++ b/crates/tx-sitter-client/src/models/send_tx_response.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/transaction_priority.rs b/crates/tx-sitter-client/src/models/transaction_priority.rs index af08ca0..19f8c44 100644 --- a/crates/tx-sitter-client/src/models/transaction_priority.rs +++ b/crates/tx-sitter-client/src/models/transaction_priority.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/crates/tx-sitter-client/src/models/tx_status.rs b/crates/tx-sitter-client/src/models/tx_status.rs index cb7d6e9..24e6286 100644 --- a/crates/tx-sitter-client/src/models/tx_status.rs +++ b/crates/tx-sitter-client/src/models/tx_status.rs @@ -1,7 +1,7 @@ /* * Tx Sitter * - * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that septs 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. + * A transaction relayer service! ## Operating a relayer Below is a guide on using this service. Note that steps 1 through 4 require authentication using HTTP Basic auth. Using swagger explorer make sure to click the authorize button and use the correct credentials. Default dev creds are `admin:admin`. ### 1. Setup a network tx-sitter keeps track of supported networks in its internal database. In order to be able to create any relayers at least one network must be present. To add a network use the `POST /1/admin/networks/:chain_id` endpoint. To see the list of currently added networks use the `GET /1/admin/networks` endpoint. ### 2. Create a relayer A relayer is an abstraction layer on top of a private key stored locally (for testing purposes only!) or using a secrets manager (currently only AWS KMS is supported). To create a relayer use the `POST /1/admin/relayer` endpoint. The data returned will contain a relayer id, make sure to copy it to the clipboard. ### 3. Create an API key By itself a relayer is not very useful. In order to send transactions one must create an API key. To do that use the `POST /1/admin/relayer/:relayer_id/key` endpoint. **Make sure to copy the API key from the response. It's not possible to recover it!** But it's always possible to create a new one. ### 4. Use the API key Once an API keys has been created it's possible to use the relayer api to, among other things, send transactions. You can use the `POST /1/api/:api_token/tx` endpoint to create a transaction. * * The version of the OpenAPI document: 0.1.0 * diff --git a/generate_api_client.sh b/generate_api_client.sh new file mode 100755 index 0000000..8bab049 --- /dev/null +++ b/generate_api_client.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -eux + +cargo run --bin api_spec_generator > ./schema.yaml + +docker run --rm -v "${PWD}:/local" --user "$(id -u):$(id -g)" -- openapitools/openapi-generator-cli generate \ + -i /local/schema.yaml \ + -g rust \ + -o /local/crates/tx-sitter-client \ + -t /local/client-template \ + --skip-validate-spec \ + --additional-properties=packageName=tx-sitter-client,supportMiddleware=true,useSingleRequestParameter=true,avoidBoxedModels=true \ + --type-mappings=\ +address=base_api_types::Address,\ +decimal-u256=base_api_types::DecimalU256,\ +h256=base_api_types::H256,\ +bytes=base_api_types::HexBytes,\ +hex-u256=base_api_types::HexU256 diff --git a/src/bin/api_spec_generator.rs b/src/bin/api_spec_generator.rs new file mode 100644 index 0000000..1dccd2d --- /dev/null +++ b/src/bin/api_spec_generator.rs @@ -0,0 +1,22 @@ +use clap::Parser; +use tx_sitter::server::generate_spec_yaml; + +#[derive(Parser)] +#[clap(rename_all = "kebab-case")] +struct Args { + #[clap(short, long)] + #[cfg_attr( + feature = "default-config", + clap(default_value = "http://localhost:8000") + )] + service_endpoint: String, +} + +#[tokio::main] +async fn main() -> eyre::Result<()> { + let args = Args::parse(); + + println!("{}", generate_spec_yaml(Some(&args.service_endpoint)).await); + + Ok(()) +} diff --git a/src/server.rs b/src/server.rs index 5777d52..91c4888 100644 --- a/src/server.rs +++ b/src/server.rs @@ -547,17 +547,15 @@ impl ServerHandle { } } -pub async fn spawn_server(app: Arc) -> eyre::Result { - let mut api_service = OpenApiService::new( - (AdminApi, RelayerApi, ServiceApi), - "Tx Sitter", - version::version!(), - ) - .description(include_str!("./server/description.md")); +pub async fn generate_spec_yaml(server_address: Option<&String>) -> String { + let api_service = create_api_service(server_address); - if let Some(server_address) = app.config.server.server_address.as_ref() { - api_service = api_service.server(server_address.clone()); - } + api_service.spec_yaml() +} + +pub async fn spawn_server(app: Arc) -> eyre::Result { + let api_service = + create_api_service(app.config.server.server_address.as_ref()); let router = Route::new() .nest("/rapidoc", api_service.rapidoc()) @@ -587,3 +585,20 @@ pub async fn spawn_server(app: Arc) -> eyre::Result { server_handle, }) } + +fn create_api_service( + server_address: Option<&String>, +) -> OpenApiService<(AdminApi, RelayerApi, ServiceApi), ()> { + let mut api_service = OpenApiService::new( + (AdminApi, RelayerApi, ServiceApi), + "Tx Sitter", + version::version!(), + ) + .description(include_str!("./server/description.md")); + + if let Some(server_address) = server_address { + api_service = api_service.server(server_address.clone()); + } + + api_service +} diff --git a/tests/disabled_relayer.rs b/tests/disabled_relayer.rs index f6f77fd..80b3947 100644 --- a/tests/disabled_relayer.rs +++ b/tests/disabled_relayer.rs @@ -45,7 +45,7 @@ async fn disabled_relayer() -> eyre::Result<()> { &client, UpdateRelayerParams { relayer_id: relayer_id.clone(), - relayer_update: RelayerUpdate { + relayer_update_request: RelayerUpdateRequest { enabled: Some(false), ..Default::default() }, diff --git a/tests/send_too_many_txs.rs b/tests/send_too_many_txs.rs index e684d6a..3963ce7 100644 --- a/tests/send_too_many_txs.rs +++ b/tests/send_too_many_txs.rs @@ -85,7 +85,7 @@ async fn send_too_many_txs() -> eyre::Result<()> { &client, UpdateRelayerParams { relayer_id: secondary_relayer_id.clone(), - relayer_update: RelayerUpdate { + relayer_update_request: RelayerUpdateRequest { max_queued_txs: Some(MAX_QUEUED_TXS as i32), ..Default::default() },