Make rpc/v1 StakingTxReceipt type field ethereum compatible (#4111)

* rpc metric identifier for getBlockReceipts

* made rpc response types compatible with ethereum

* implement hmyv2_getBlockReceipts RPC API

* Revert "made rpc response types compatible with ethereum"

This reverts commit 6182c62f45.

* encode rpc/v1 receipt type field ethereum compatible
pull/4116/head
bbist 3 years ago committed by GitHub
parent 68e761b596
commit 18c97e7e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      rpc/v1/types.go

@ -192,19 +192,19 @@ type TxReceipt struct {
// StakingTxReceipt represents a staking transaction receipt that will serialize to the RPC representation.
type StakingTxReceipt struct {
BlockHash common.Hash `json:"blockHash"`
TransactionHash common.Hash `json:"transactionHash"`
BlockNumber hexutil.Uint64 `json:"blockNumber"`
TransactionIndex hexutil.Uint64 `json:"transactionIndex"`
GasUsed hexutil.Uint64 `json:"gasUsed"`
CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed"`
ContractAddress common.Address `json:"contractAddress"`
Logs []*types.Log `json:"logs"`
LogsBloom ethtypes.Bloom `json:"logsBloom"`
Sender string `json:"sender"`
Type staking.Directive `json:"type"`
Root hexutil.Bytes `json:"root"`
Status hexutil.Uint `json:"status"`
BlockHash common.Hash `json:"blockHash"`
TransactionHash common.Hash `json:"transactionHash"`
BlockNumber hexutil.Uint64 `json:"blockNumber"`
TransactionIndex hexutil.Uint64 `json:"transactionIndex"`
GasUsed hexutil.Uint64 `json:"gasUsed"`
CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed"`
ContractAddress common.Address `json:"contractAddress"`
Logs []*types.Log `json:"logs"`
LogsBloom ethtypes.Bloom `json:"logsBloom"`
Sender string `json:"sender"`
Type hexutil.Uint64 `json:"type"`
Root hexutil.Bytes `json:"root"`
Status hexutil.Uint `json:"status"`
}
// CxReceipt represents a CxReceipt that will serialize to the RPC representation of a CxReceipt
@ -398,7 +398,7 @@ func NewStakingTxReceipt(
Logs: receipt.Logs,
LogsBloom: receipt.Bloom,
Sender: sender,
Type: tx.StakingType(),
Type: hexutil.Uint64(tx.StakingType()),
Root: receipt.PostState,
Status: hexutil.Uint(receipt.Status),
}

Loading…
Cancel
Save