Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4218: Update state_get_account_info RPC handler r=zacshowa a=zacshowa # Summary of work done: - Update `state_get_account_info` RPC handler to handle an `AccountIdentifier` as a parameter - Add `AccountIdentifier` enum that can be a public key or account hash - Ensure serde properly formats the `AccountIdentifier` enum to prevent this change from breaking the RPC API ### Sample requests: Request for an account using a public key from an NCTL network ``` { "jsonrpc": "2.0", "method": "state_get_account_info", "params": { "public_key": "01fbabf372fe762ad840834f7dab5d88e522ffa39c9f53d1e991056cef110faeb2", "block_identifier": null }, "id": -2271248039839344330 } ``` Associated output: ``` { "jsonrpc": "2.0", "result": { "api_version": "1.0.0", "account": { "account_hash": "account-hash-c029c14904b870e64c1d443d428c606740e82f341bea0f8542ca6494cef1383e", "named_keys": [], "main_purse": "uref-cf8a03704e4865323fd1b02166e52302ce8fc4c931d76d04e6faea33ee52d93e-007", "associated_keys": [ { "account_hash": "account-hash-c029c14904b870e64c1d443d428c606740e82f341bea0f8542ca6494cef1383e", "weight": 1 } ], "action_thresholds": { "deployment": 1, "key_management": 1 } }, "merkle_proof": "[2228 hex chars]" }, "id": -2271248039839344330 } ``` Request for the same account using an account hash instead: ``` { "jsonrpc": "2.0", "method": "state_get_account_info", "params": { "public_key": "account-hash-c029c14904b870e64c1d443d428c606740e82f341bea0f8542ca6494cef1383e", "block_identifier": null }, "id": -3436401869523751496 } ``` Associated output: ``` { "jsonrpc": "2.0", "result": { "api_version": "1.0.0", "account": { "account_hash": "account-hash-c029c14904b870e64c1d443d428c606740e82f341bea0f8542ca6494cef1383e", "named_keys": [], "main_purse": "uref-cf8a03704e4865323fd1b02166e52302ce8fc4c931d76d04e6faea33ee52d93e-007", "associated_keys": [ { "account_hash": "account-hash-c029c14904b870e64c1d443d428c606740e82f341bea0f8542ca6494cef1383e", "weight": 1 } ], "action_thresholds": { "deployment": 1, "key_management": 1 } }, "merkle_proof": "[2228 hex chars]" }, "id": -3436401869523751496 } ``` # Associated ticket(s): - casper-network#4203 - [Update the RPC handler for state_get_account_info](https://app.zenhub.com/workspaces/rust-sdk-64b185bf2cb87924e7759d9d/issues/gh/casper-network/casper-node/4203) Co-authored-by: Zach Showalter <[email protected]> Co-authored-by: Zach Showalter <[email protected]>
- Loading branch information