Skip to content

feat: add rpc endpoint eth_getBalance#160

Merged
fmoletta merged 39 commits into
mainfrom
eth_get_Balance
Jul 18, 2024
Merged

feat: add rpc endpoint eth_getBalance#160
fmoletta merged 39 commits into
mainfrom
eth_get_Balance

Conversation

@fmoletta

@fmoletta fmoletta commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

Based on #145

Motivation

Support rpc endpoint eth_getBalance
Description

Add rpc endpoint eth_getBalance

Closes #36

@fmoletta fmoletta changed the base branch from main to get_block_by_number July 17, 2024 18:23
@fmoletta fmoletta marked this pull request as ready for review July 17, 2024 18:29
@fmoletta fmoletta requested a review from a team as a code owner July 17, 2024 18:29
}

impl GetBalanceRequest {
pub fn parse(params: &Option<Vec<Value>>) -> Option<GetBalanceRequest> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why this returns Option instead of Result? Not against it, just curious

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All failure cases lead to a RpcError::BadParams error, by returning an Option we can omit all the repeated error mapping and just map once where the function is called. We could also use an internal function and make parse return the RpcError::BadParams

Base automatically changed from get_block_by_number to main July 18, 2024 13:10
@fmoletta fmoletta merged commit 6cbde32 into main Jul 18, 2024
@fmoletta fmoletta deleted the eth_get_Balance branch July 18, 2024 15:52
fmoletta added a commit that referenced this pull request Jul 18, 2024
Based on #160 

**Motivation**

Support rpc endpoint `eth_getCode`

**Description**

* Add rpc endpoint `eth_getCode`
* Add methods to obtain account code to `Store` api
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement eth_getBalance RPC endpoint

2 participants