MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / gets_an_account_balance

Function gets_an_account_balance

chain/src/method.rs:203–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201
202 #[tokio::test]
203 async fn gets_an_account_balance() {
204 let (blockchain, id_1, _) = setup().await;
205 let balance = blockchain
206 .lock()
207 .await
208 .accounts
209 .get_account(&id_1)
210 .unwrap()
211 .balance;
212 let mut module = RpcModule::new(blockchain);
213 eth_get_balance(&mut module).unwrap();
214 let response: String = module.call("eth_getBalance", [id_1]).await.unwrap();
215
216 assert_eq!(response, to_hex(balance));
217 }
218}

Callers

nothing calls this directly

Calls 3

setupFunction · 0.85
eth_get_balanceFunction · 0.85
get_accountMethod · 0.80

Tested by

no test coverage detected