14 lines
569 B
Rust
14 lines
569 B
Rust
use crate::records::wallet_registry::resolve_owner_from_vanity_address;
|
|
use crate::rpc::responses::RpcResponse;
|
|
use crate::sled::Db;
|
|
|
|
pub async fn lookup(vanity_address: String, db: &Db) -> RpcResponse {
|
|
match resolve_owner_from_vanity_address(db, &vanity_address) {
|
|
Ok(Some(owner_short_address)) => RpcResponse::Binary(owner_short_address.into_bytes()),
|
|
Ok(None) => RpcResponse::Binary(Vec::new()),
|
|
Err(err) => RpcResponse::Binary(
|
|
format!("error: Failed to lookup vanity owner address: {err}").into_bytes(),
|
|
),
|
|
}
|
|
}
|