Compare commits

..

1 Commits

Author SHA1 Message Date
0638590e16
added admin functionality 2025-02-06 00:19:56 +02:00
3 changed files with 5 additions and 5 deletions

@ -196,7 +196,7 @@ message AirdropReq {
uint64 tokens = 2; uint64 tokens = 2;
} }
message ListAccountsResp { message Account {
string pubkey = 1; string pubkey = 1;
uint64 balance = 2; uint64 balance = 2;
uint64 tmp_locked = 3; uint64 tmp_locked = 3;
@ -214,5 +214,5 @@ service BrainCli {
// admin commands // admin commands
rpc Airdrop (AirdropReq) returns (Empty); rpc Airdrop (AirdropReq) returns (Empty);
rpc ListAllContracts (Empty) returns (stream Contract); rpc ListAllContracts (Empty) returns (stream Contract);
rpc ListAccounts (Empty) returns (stream ListAccountsResp); rpc ListAccounts (Empty) returns (stream Account);
} }

@ -689,10 +689,10 @@ impl BrainData {
contracts.iter().cloned().collect() contracts.iter().cloned().collect()
} }
pub fn list_accounts(&self) -> Vec<grpc::ListAccountsResp> { pub fn list_accounts(&self) -> Vec<grpc::Account> {
self.accounts self.accounts
.iter() .iter()
.map(|a| grpc::ListAccountsResp { .map(|a| grpc::Account {
pubkey: a.key().to_string(), pubkey: a.key().to_string(),
balance: a.balance, balance: a.balance,
tmp_locked: a.tmp_locked, tmp_locked: a.tmp_locked,

@ -300,7 +300,7 @@ impl BrainCli for BrainCliMock {
)) ))
} }
type ListAccountsStream = Pin<Box<dyn Stream<Item = Result<ListAccountsResp, Status>> + Send>>; type ListAccountsStream = Pin<Box<dyn Stream<Item = Result<Account, Status>> + Send>>;
async fn list_accounts( async fn list_accounts(
&self, &self,
req: Request<Empty>, req: Request<Empty>,