Skip to content

Commit

Permalink
move block type from types.go >> api_block.go
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesKimara committed Oct 26, 2021
1 parent bdf903e commit f036f0b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 19 deletions.
48 changes: 48 additions & 0 deletions api_block.go
Expand Up @@ -8,6 +8,54 @@ import (
"net/url"
)

// Block defines content of a block
type Block struct {
// Block creation time in UNIX time
Time int `json:"time"`

// Block number
Height int `json:"height"`

// Hash of the block
Hash string `json:"hash"`

// Slot number
Slot int `json:"slot"`

// Epoch number
Epoch int `json:"epoch"`

// Slot within the epoch
EpochSlot int `json:"epoch_slot"`

// Bech32 ID of the slot leader or specific block description in case there is no slot leader
SlotLeader string `json:"slot_leader"`

// Block size in Bytes
Size int `json:"size"`

// Number of transactions in the block
TxCount int `json:"tx_count"`

// Total output within the block in Lovelaces
Output string `json:"output"`

// Total fees within the block in Lovelaces
Fees string `json:"fees"`

// VRF key of the block
BlockVRF string `json:"block_vrf"`

// Hash of the previous block
PreviousBlock string `json:"previous_block"`

// Hash of the next block
NextBlock string `json:"next_block"`

// Number of block confirmations
Confirmations int `json:"confirmations"`
}

// BlocksLatest Return the latest block available to the backends, also known as the
// tip of the blockchain.
func (c *apiClient) BlockLatest(ctx context.Context) (b Block, err error) {
Expand Down
19 changes: 0 additions & 19 deletions types.go
Expand Up @@ -73,25 +73,6 @@ type UnauthorizedError struct {
StatusCode int `json:"status_code"`
}

// Block defines content of a block
type Block struct {
Time int `json:"time,"`
Height int `json:"height,"`
Hash string `json:"hash,"`
Slot int `json:"slot,"`
Epoch int `json:"epoch,"`
EpochSlot int `json:"epoch_slot,"`
SlotLeader string `json:"slot_leader"`
Size int `json:"size,"`
TxCount int `json:"tx_count,"`
Output string `json:"output,"`
Fees string `json:"fees,"`
BlockVRF string `json:"block_vrf,"`
PreviousBlock string `json:"previous_block,"`
NextBlock string `json:"next_block,"`
Confirmations int `json:"confirmations,"`
}

type Transaction string

// APIQueryParams contains query parameters. Marshalled to
Expand Down

0 comments on commit f036f0b

Please sign in to comment.