Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update receipts and TX info #55

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions pkg/ethereum/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,51 @@ import (

// txReceiptJSONRPC is the receipt obtained over JSON/RPC from the ethereum client, with gas used, logs and contract address
type TXReceiptJSONRPC struct {
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash"`
BlockNumber *ethtypes.HexInteger `json:"blockNumber"`
ContractAddress *ethtypes.AddressWithChecksum `json:"contractAddress"`
CumulativeGasUsed *ethtypes.HexInteger `json:"cumulativeGasUsed"`
From *ethtypes.AddressWithChecksum `json:"from"`
GasUsed *ethtypes.HexInteger `json:"gasUsed"`
Logs []*LogJSONRPC `json:"logs"`
Status *ethtypes.HexInteger `json:"status"`
To *ethtypes.AddressWithChecksum `json:"to"`
TransactionHash ethtypes.HexBytes0xPrefix `json:"transactionHash"`
TransactionIndex *ethtypes.HexInteger `json:"transactionIndex"`
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash"`
BlockNumber *ethtypes.HexInteger `json:"blockNumber"`
ContractAddress *ethtypes.Address0xHex `json:"contractAddress"`
CumulativeGasUsed *ethtypes.HexInteger `json:"cumulativeGasUsed"`
From *ethtypes.Address0xHex `json:"from"`
GasUsed *ethtypes.HexInteger `json:"gasUsed"`
Logs []*LogJSONRPC `json:"logs"`
Status *ethtypes.HexInteger `json:"status"`
To *ethtypes.Address0xHex `json:"to"`
TransactionHash ethtypes.HexBytes0xPrefix `json:"transactionHash"`
TransactionIndex *ethtypes.HexInteger `json:"transactionIndex"`
}

// receiptExtraInfo is the version of the receipt we store under the TX.
// - We omit the full logs from the JSON/RPC
// - We omit fields already in the standardized cross-blockchain section
// - We format numbers as decimals
type ReceiptExtraInfo struct {
ContractAddress *ethtypes.AddressWithChecksum `json:"contractAddress"`
CumulativeGasUsed *fftypes.FFBigInt `json:"cumulativeGasUsed"`
From *ethtypes.AddressWithChecksum `json:"from"`
To *ethtypes.AddressWithChecksum `json:"to"`
GasUsed *fftypes.FFBigInt `json:"gasUsed"`
Status *fftypes.FFBigInt `json:"status"`
ErrorMessage *string `json:"errorMessage"`
ContractAddress *ethtypes.Address0xHex `json:"contractAddress"`
CumulativeGasUsed *fftypes.FFBigInt `json:"cumulativeGasUsed"`
From *ethtypes.Address0xHex `json:"from"`
To *ethtypes.Address0xHex `json:"to"`
GasUsed *fftypes.FFBigInt `json:"gasUsed"`
Status *fftypes.FFBigInt `json:"status"`
ErrorMessage *string `json:"errorMessage"`
}

// txInfoJSONRPC is the transaction info obtained over JSON/RPC from the ethereum client, with input data
type TXInfoJSONRPC struct {
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash"` // null if pending
BlockNumber *ethtypes.HexInteger `json:"blockNumber"` // null if pending
From *ethtypes.AddressWithChecksum `json:"from"`
ChainID *ethtypes.HexInteger `json:"chainID"`
Gas *ethtypes.HexInteger `json:"gas"`
GasPrice *ethtypes.HexInteger `json:"gasPrice"`
Hash ethtypes.HexBytes0xPrefix `json:"hash"`
Input ethtypes.HexBytes0xPrefix `json:"input"`
Nonce *ethtypes.HexInteger `json:"nonce"`
R *ethtypes.HexInteger `json:"r"`
S *ethtypes.HexInteger `json:"s"`
To *ethtypes.AddressWithChecksum `json:"to"`
TransactionIndex *ethtypes.HexInteger `json:"transactionIndex"` // null if pending
Type *ethtypes.HexInteger `json:"type"`
V *ethtypes.HexInteger `json:"v"`
Value *ethtypes.HexInteger `json:"value"`
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash"` // null if pending
BlockNumber *ethtypes.HexInteger `json:"blockNumber"` // null if pending
From *ethtypes.Address0xHex `json:"from"`
ChainID *ethtypes.HexInteger `json:"chainID"`
Gas *ethtypes.HexInteger `json:"gas"`
GasPrice *ethtypes.HexInteger `json:"gasPrice"`
Hash ethtypes.HexBytes0xPrefix `json:"hash"`
Input ethtypes.HexBytes0xPrefix `json:"input"`
Nonce *ethtypes.HexInteger `json:"nonce"`
R *ethtypes.HexInteger `json:"r"`
S *ethtypes.HexInteger `json:"s"`
To *ethtypes.Address0xHex `json:"to"`
TransactionIndex *ethtypes.HexInteger `json:"transactionIndex"` // null if pending
Type *ethtypes.HexInteger `json:"type"`
V *ethtypes.HexInteger `json:"v"`
Value *ethtypes.HexInteger `json:"value"`
}

func (t *TXInfoJSONRPC) Cost() *big.Int {
Expand Down
Loading