-
Notifications
You must be signed in to change notification settings - Fork 198
feat(multi): domains integration #1318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
49e73af
feat: add domains lookup
lok52 8b8e41f
feat: preload domains for addresses
lok52 2f83ac1
fix: include domains in balance_entities
lok52 299d107
fix: update bens-proto dep
lok52 5944f9c
Merge branch 'main' into lok52/multi-domains-integration
lok52 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
101 changes: 101 additions & 0 deletions
101
multichain-aggregator/multichain-aggregator-logic/src/clients/bens.rs
This file contains hidden or 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,101 @@ | ||
| use api_client_framework::{Endpoint, Error, HttpApiClient as Client, HttpApiClientConfig}; | ||
| use reqwest::Method; | ||
| use url::Url; | ||
|
|
||
| pub fn new_client(url: Url) -> Result<Client, Error> { | ||
| let config = HttpApiClientConfig::default(); | ||
| Client::new(url, config) | ||
| } | ||
|
|
||
| pub mod lookup_domain_name { | ||
| use super::*; | ||
| use api_client_framework::serialize_query; | ||
| use bens_proto::blockscout::bens::v1::{ | ||
| LookupDomainNameRequest, LookupDomainNameResponse, Order, | ||
| }; | ||
| use serde::Serialize; | ||
|
|
||
| pub struct LookupDomainName { | ||
| pub request: LookupDomainNameRequest, | ||
| } | ||
|
|
||
| impl Endpoint for LookupDomainName { | ||
| type Response = LookupDomainNameResponse; | ||
|
|
||
| fn method(&self) -> Method { | ||
| Method::GET | ||
| } | ||
|
|
||
| fn path(&self) -> String { | ||
| format!("/api/v1/{}/domains:lookup", self.request.chain_id) | ||
| } | ||
|
|
||
| fn query(&self) -> Option<String> { | ||
| #[derive(Serialize)] | ||
| pub struct Params<'a> { | ||
| pub name: Option<&'a String>, | ||
| pub chain_id: i64, | ||
| pub only_active: bool, | ||
| pub sort: &'a String, | ||
| pub order: Order, | ||
| pub page_size: Option<u32>, | ||
| pub page_token: Option<&'a String>, | ||
| pub protocols: Option<&'a String>, | ||
| } | ||
|
|
||
| let params = Params { | ||
| name: self.request.name.as_ref(), | ||
| chain_id: self.request.chain_id, | ||
| only_active: self.request.only_active, | ||
| sort: &self.request.sort, | ||
| order: self | ||
| .request | ||
| .order | ||
| .try_into() | ||
| .expect("valid order enum should be provided"), | ||
| page_size: self.request.page_size, | ||
| page_token: self.request.page_token.as_ref(), | ||
| protocols: self.request.protocols.as_ref(), | ||
| }; | ||
| serialize_query(¶ms) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| pub mod get_address { | ||
| use super::*; | ||
| use api_client_framework::serialize_query; | ||
| use bens_proto::blockscout::bens::v1::{GetAddressRequest, GetAddressResponse}; | ||
| use serde::Serialize; | ||
|
|
||
| pub struct GetAddress { | ||
| pub request: GetAddressRequest, | ||
| } | ||
|
|
||
| impl Endpoint for GetAddress { | ||
| type Response = GetAddressResponse; | ||
|
|
||
| fn method(&self) -> Method { | ||
| Method::GET | ||
| } | ||
|
|
||
| fn path(&self) -> String { | ||
| format!( | ||
| "/api/v1/{}/addresses/{}", | ||
| self.request.chain_id, self.request.address | ||
| ) | ||
| } | ||
|
|
||
| fn query(&self) -> Option<String> { | ||
| #[derive(Serialize)] | ||
| pub struct Params<'a> { | ||
| pub protocol_id: Option<&'a String>, | ||
| } | ||
|
|
||
| let params = Params { | ||
| protocol_id: self.request.protocol_id.as_ref(), | ||
| }; | ||
| serialize_query(¶ms) | ||
| } | ||
| } | ||
| } | ||
1 change: 1 addition & 0 deletions
1
multichain-aggregator/multichain-aggregator-logic/src/clients/mod.rs
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| pub mod bens; | ||
| pub mod dapp; | ||
| pub mod token_info; |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.