Skip to content

Commit

Permalink
feat: add requirement of account id to be public in RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
polydez committed Apr 3, 2024
1 parent 63160a2 commit 3999a47
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rpc/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,20 @@ impl api_server::Api for RpcApi {
debug!(target: COMPONENT, request = ?request.get_ref());

// Validating account using conversion:
let _account_id: AccountId = request
let account_id: AccountId = request
.get_ref()
.account_id
.clone()
.ok_or(Status::invalid_argument("account_id is missing"))?
.try_into()
.map_err(|err| Status::invalid_argument(format!("Invalid account id: {err}")))?;

if !account_id.is_on_chain() {
return Err(Status::invalid_argument(
"Invalid account id: account required to be public",
));
}

self.store.clone().get_public_account_details(request).await
}
}

0 comments on commit 3999a47

Please sign in to comment.