Last active
October 20, 2022 10:17
-
-
Save blurpesec/3d18b9d329073b176fb93a8823ed70e9 to your computer and use it in GitHub Desktop.
Transaction data types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// etherscan's normal tx | |
type NormalTx struct { | |
BlockNumber int `json:"blockNumber,string"` | |
TimeStamp Time `json:"timeStamp"` | |
Hash string `json:"hash"` | |
Nonce int `json:"nonce,string"` | |
BlockHash string `json:"blockHash"` | |
TransactionIndex int `json:"transactionIndex,string"` | |
From string `json:"from"` | |
To string `json:"to"` | |
Value *BigInt `json:"value"` | |
Gas int `json:"gas,string"` | |
GasPrice *BigInt `json:"gasPrice"` | |
IsError int `json:"isError,string"` | |
TxReceiptStatus string `json:"txreceipt_status"` | |
Input string `json:"input"` | |
ContractAddress string `json:"contractAddress"` | |
CumulativeGasUsed int `json:"cumulativeGasUsed,string"` | |
GasUsed int `json:"gasUsed,string"` | |
Confirmations int `json:"confirmations,string"` | |
} | |
// etherscan's internal tx | |
type InternalTx struct { | |
BlockNumber int `json:"blockNumber,string"` | |
TimeStamp Time `json:"timeStamp"` | |
Hash string `json:"hash"` | |
From string `json:"from"` | |
To string `json:"to"` | |
Value *BigInt `json:"value"` | |
ContractAddress string `json:"contractAddress"` | |
Input string `json:"input"` | |
Type string `json:"type"` | |
Gas int `json:"gas,string"` | |
GasUsed int `json:"gasUsed,string"` | |
TraceID string `json:"traceId"` | |
IsError int `json:"isError,string"` | |
ErrCode string `json:"errCode"` | |
} | |
// etherscan's erc20transfer | |
type ERC20Transfer struct { | |
BlockNumber int `json:"blockNumber,string"` | |
TimeStamp Time `json:"timeStamp"` | |
Hash string `json:"hash"` | |
Nonce int `json:"nonce,string"` | |
BlockHash string `json:"blockHash"` | |
From string `json:"from"` | |
ContractAddress string `json:"contractAddress"` | |
To string `json:"to"` | |
Value *BigInt `json:"value"` | |
TokenName string `json:"tokenName"` | |
TokenSymbol string `json:"tokenSymbol"` | |
TokenDecimal uint8 `json:"tokenDecimal,string"` | |
TransactionIndex int `json:"transactionIndex,string"` | |
Gas int `json:"gas,string"` | |
GasPrice *BigInt `json:"gasPrice"` | |
GasUsed int `json:"gasUsed,string"` | |
CumulativeGasUsed int `json:"cumulativeGasUsed,string"` | |
Input string `json:"input"` | |
Confirmations int `json:"confirmations,string"` | |
} | |
// etherscan's erc721transfer | |
type ERC721Transfer struct { | |
BlockNumber int `json:"blockNumber,string"` | |
TimeStamp Time `json:"timeStamp"` | |
Hash string `json:"hash"` | |
Nonce int `json:"nonce,string"` | |
BlockHash string `json:"blockHash"` | |
From string `json:"from"` | |
ContractAddress string `json:"contractAddress"` | |
To string `json:"to"` | |
TokenID *BigInt `json:"tokenID"` | |
TokenName string `json:"tokenName"` | |
TokenSymbol string `json:"tokenSymbol"` | |
TokenDecimal uint8 `json:"tokenDecimal,string"` | |
TransactionIndex int `json:"transactionIndex,string"` | |
Gas int `json:"gas,string"` | |
GasPrice *BigInt `json:"gasPrice"` | |
GasUsed int `json:"gasUsed,string"` | |
CumulativeGasUsed int `json:"cumulativeGasUsed,string"` | |
Input string `json:"input"` | |
Confirmations int `json:"confirmations,string"` | |
} | |
// etherscan's log type | |
type EtherscanTxLog struct { | |
Address string `json:"address"` | |
Topics []string `json:"topics"` | |
Data string `json:"data"` | |
BlockNumber string `json:"blockNumber"` // maybe exclude this in NormalTx | |
TransactionHash string `json:"transactionHash"` // maybe exclude this in NormalTx | |
BlockHash string `json:"blockHash"` // maybe exclude this in NormalTx | |
LogIndex string `json:"logIndex"` | |
Removed bool `json:"removed"` | |
} | |
// go-ethereum types.Log | |
type GethTxLog struct { | |
Address common.Address `json:"address" gencodec:"required"` | |
Topics []common.Hash `json:"topics" gencodec:"required"` | |
Data []byte `json:"data" gencodec:"required"` | |
BlockNumber uint64 `json:"blockNumber"` | |
TxHash common.Hash `json:"transactionHash" gencodec:"required"` | |
TxIndex uint `json:"transactionIndex"` | |
BlockHash common.Hash `json:"blockHash"` | |
Index uint `json:"logIndex"` | |
Removed bool `json:"removed"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// etherscan's normal tx | |
type NormalTx struct { | |
BlockNumber int `json:"blockNumber,string"` | |
TimeStamp Time `json:"timeStamp"` | |
Hash string `json:"hash"` | |
Nonce int `json:"nonce,string"` | |
BlockHash string `json:"blockHash"` | |
TransactionIndex int `json:"transactionIndex,string"` | |
From string `json:"from"` | |
To string `json:"to"` | |
Value *BigInt `json:"value"` | |
Gas int `json:"gas,string"` | |
GasPrice *BigInt `json:"gasPrice"` | |
IsError int `json:"isError,string"` | |
TxReceiptStatus string `json:"txreceipt_status"` | |
Input string `json:"input"` | |
ContractAddress string `json:"contractAddress"` | |
CumulativeGasUsed int `json:"cumulativeGasUsed,string"` | |
GasUsed int `json:"gasUsed,string"` | |
Confirmations int `json:"confirmations,string"` | |
// Optional - Logs | |
Logs []ExistingTransactionTypes.EtherscanTxLog `json:"logs,optional"` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment