Skip to content
Open
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions head.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package eosws

import "time"

func init() {
RegisterIncomingMessage("head_info", HeadInfo{})
RegisterOutgoingMessage("get_head_info", GetHeadInfo{})
}

type HeadInfo struct {
CommonIn
Data struct{
LastIrreversibleBlockNum uint32 `json:"last_irreversible_block_num"`
LastIrreversibleBlockId string `json:"last_irreversible_block_id"`
HeadBlockNum uint32 `json:"head_block_num"`
HeadBlockID string `json:"head_block_id"`
HeadBlockTime time.Time `json:"head_block_time"`
HeadBlockProducer string `json:"head_block_producer"`
} `json:"data"`
}

type GetHeadInfo struct {
CommonOut
}
32 changes: 32 additions & 0 deletions mdl/v1/block.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package mdl

import (
"time"
)

type Block struct {
ID string `json:"id"`
Irreversible bool `json:"irreversible"`
Header *BlockHeader `json:"header"`
TransactionCount int `json:"transaction_count"`
}

type BlockHeader struct {
Timestamp time.Time `json:"timestamp"`
Producer string `json:"producer"`
Confirmed uint16 `json:"confirmed"`
Previous string `json:"previous"`
TransactionMRoot string `json:"transaction_mroot"`
ActionMRoot string `json:"action_mroot"`
ScheduleVersion uint32 `json:"schedule_version"`
NewProducers *ProducerSchedule `json:"new_producers" eos:"optional"`
}

type ProducerSchedule struct {
Version uint32 `json:"version"`
Producers []ProducerKey `json:"producers"`
}
type ProducerKey struct {
AccountName string `json:"producer_name"`
BlockSigningKey string `json:"block_signing_key"`
}
7 changes: 6 additions & 1 deletion mdl/v1/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mdl
import (
"encoding/json"

eos "github.com/eoscanada/eos-go"
"github.com/eoscanada/eos-go"
"github.com/eoscanada/eos-go/ecc"
)

Expand Down Expand Up @@ -88,3 +88,8 @@ type ActionRef struct {
TrxID string `json:"trx_id"`
ActionIndex int `json:"action_index"`
}

type TransactionList struct {
NextCursor string `json:"next_cursor"`
Transactions []*TransactionLifecycle `json:"transactions"`
}
22 changes: 22 additions & 0 deletions transaction.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package eosws

import "github.com/shrimpliu/eosws-go/mdl/v1"

func init() {
RegisterOutgoingMessage("get_transaction_lifecycle", GetTrxLifecycle{})
RegisterIncomingMessage("transaction_lifecycle", TrxLifecycle{})
}

type GetTrxLifecycle struct {
CommonOut
Data struct{
ID string `json:"id"`
}
}

type TrxLifecycle struct {
CommonIn
Data struct{
Lifecycle *mdl.TransactionLifecycle `json:"lifecycle"`
} `json:"data"`
}