Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
APIKey - Payload to be sent in POST request when either enabling or disabling state of API Key
type AuthPayload ¶
type AuthPayload struct { Message AuthPayloadMessage `json:"message" binding:"required"` Signature string `json:"signature" binding:"required"` }
AuthPayload - Payload to be sent in post request body, when performing login
func (*AuthPayload) HasExpired ¶
func (a *AuthPayload) HasExpired(window int64) bool
HasExpired - Checking if message was signed with in `window` seconds ( will be kept generally 30s ) time span from current server time or not
func (*AuthPayload) IsAdmin ¶
func (a *AuthPayload) IsAdmin(signer []byte) bool
IsAdmin - Given recovered signer address from authentication payload checks whether this address matches with admin address present in `.env` file or not
func (*AuthPayload) RecoverSigner ¶
func (a *AuthPayload) RecoverSigner() []byte
RecoverSigner - Given signed message & original message it recovers signer address as byte array, which is to be later used for matching against claimed signer address
func (*AuthPayload) VerifySignature ¶
func (a *AuthPayload) VerifySignature(signer []byte) bool
VerifySignature - Given recovered signer address from authentication payload checks whether person claiming to sign message has really signed or not
type AuthPayloadMessage ¶
type AuthPayloadMessage struct { Address common.Address `json:"address" binding:"required"` TimeStamp uint64 `json:"timestamp" binding:"required"` }
AuthPayloadMessage - Message to be signed by user
func (*AuthPayloadMessage) ToJSON ¶
func (a *AuthPayloadMessage) ToJSON() []byte
ToJSON - Encoding message to JSON, this is what was signed by user
type Block ¶
type Block struct { Hash string `json:"hash" gorm:"column:hash"` Number uint64 `json:"number" gorm:"column:number"` Time uint64 `json:"time" gorm:"column:time"` ParentHash string `json:"parentHash" gorm:"column:parenthash"` Difficulty string `json:"difficulty" gorm:"column:difficulty"` GasUsed uint64 `json:"gasUsed" gorm:"column:gasused"` GasLimit uint64 `json:"gasLimit" gorm:"column:gaslimit"` Nonce uint64 `json:"nonce" gorm:"column:nonce"` Miner string `json:"miner" gorm:"column:miner"` Size float64 `json:"size" gorm:"column:size"` TransactionRootHash string `json:"txRootHash" gorm:"column:txroothash"` ReceiptRootHash string `json:"receiptRootHash" gorm:"column:receiptroothash"` }
Block - Block related info to be delivered to client in this format
func (*Block) MarshalBinary ¶
MarshalBinary - Implementing binary marshalling function, to be invoked by redis before publishing data on channel
type BlockChainNodeConnection ¶
BlockChainNodeConnection - Holds network connection object for blockchain nodes
Use `RPC` i.e. HTTP based connection, for querying blockchain for data Use `Websocket` for real-time listening of events in blockchain
type Blocks ¶
type Blocks struct {
Blocks []*Block `json:"blocks"`
}
Blocks - A set of blocks to be held, extracted from DB query result also to be supplied to client in JSON encoded form
type Event ¶
type Event struct { Origin string `gorm:"column:origin"` Index uint `gorm:"column:index"` Topics pq.StringArray `gorm:"column:topics;type:text[]"` Data []byte `gorm:"column:data"` TransactionHash string `gorm:"column:txhash"` BlockHash string `gorm:"column:blockhash"` }
Event - Single event entity holder, extracted from db
func (*Event) MarshalBinary ¶
MarshalBinary - Implementing binary marshalling function, to be invoked by redis before publishing data on channel
func (*Event) MarshalJSON ¶
MarshalJSON - Custom JSON encoder
type Events ¶
type Events struct {
Events []*Event `json:"events"`
}
Events - A collection of event holder, to be delivered to client in this form
type Job ¶
type Job struct { Client *ethclient.Client DB *gorm.DB RedisClient *redis.Client RedisKey string Block uint64 Lock *sync.Mutex Synced *SyncState }
Job - For running a block fetching job, these are all the information which are required
type ResultStatus ¶ added in v1.1.0
ResultStatus - Keeps track of how many operations went successful and how many of them failed
func (ResultStatus) Total ¶ added in v1.1.0
func (r ResultStatus) Total() uint64
Total - Returns total count of operations which were supposed to be performed
To be useful when deciding whether all go routines have sent their status i.e. completed their task or not
type SyncState ¶
type SyncState struct { Done uint64 StartedAt time.Time BlockCountAtStartUp uint64 NewBlocksInserted uint64 }
SyncState - Whether `ette` is synced with blockchain or not
func (*SyncState) BlockCountInDB ¶
BlockCountInDB - Blocks currently present in database
type Transaction ¶
type Transaction struct { Hash string `json:"hash" gorm:"column:hash"` From string `json:"from" gorm:"column:from"` To string `json:"to" gorm:"column:to"` Contract string `json:"contract" gorm:"column:contract"` Value string `json:"value" gorm:"column:value"` Data []byte `json:"data" gorm:"column:data"` Gas uint64 `json:"gas" gorm:"column:gas"` GasPrice string `json:"gasPrice" gorm:"column:gasprice"` Cost string `json:"cost" gorm:"column:cost"` Nonce uint64 `json:"nonce" gorm:"column:nonce"` State uint64 `json:"state" gorm:"column:state"` BlockHash string `json:"blockHash" gorm:"column:blockhash"` }
Transaction - Transaction holder struct, to be supplied when queried using tx hash
func (*Transaction) MarshalBinary ¶
func (t *Transaction) MarshalBinary() ([]byte, error)
MarshalBinary - Implementing binary marshalling function, to be invoked by redis before publishing data on channel
func (*Transaction) MarshalJSON ¶
func (t *Transaction) MarshalJSON() ([]byte, error)
MarshalJSON - Custom JSON encoder
func (*Transaction) ToJSON ¶
func (t *Transaction) ToJSON() []byte
ToJSON - JSON encoder, to be invoked before delivering tx query data to client
type Transactions ¶
type Transactions struct {
Transactions []*Transaction `json:"transactions"`
}
Transactions - Multiple transactions holder struct
func (*Transactions) ToJSON ¶
func (t *Transactions) ToJSON() []byte
ToJSON - Encoding into JSON, to be invoked when delivering to client