implement eth_exportAccount (#331)

This commit is contained in:
noot
2020-06-17 14:23:36 -04:00
committed by GitHub
parent 94f6acc651
commit 9f573690a6
8 changed files with 123 additions and 6 deletions
+13
View File
@@ -264,6 +264,19 @@ func (e *PublicEthAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log,
return e.backend.GetTransactionLogs(txHash)
}
// ExportAccount exports an account's balance, code, and storage at the given block number
// TODO: deprecate this once the export genesis command works
func (e *PublicEthAPI) ExportAccount(address common.Address, blockNumber BlockNumber) (string, error) {
ctx := e.cliCtx.WithHeight(blockNumber.Int64())
res, _, err := ctx.QueryWithData(fmt.Sprintf("custom/%s/%s/%s", types.ModuleName, evm.QueryExportAccount, address.Hex()), nil)
if err != nil {
return "", err
}
return string(res), nil
}
// Sign signs the provided data using the private key of address via Geth's signature standard.
func (e *PublicEthAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) {
// TODO: Change this functionality to find an unlocked account by address