code.vegaprotocol.io/vega@v0.79.0/datanode/entities/node_basic.go (about)

     1  // Copyright (C) 2023 Gobalsky Labs Limited
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Affero General Public License as
     5  // published by the Free Software Foundation, either version 3 of the
     6  // License, or (at your option) any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU Affero General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Affero General Public License
    14  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15  
    16  package entities
    17  
    18  import (
    19  	"time"
    20  
    21  	v2 "code.vegaprotocol.io/vega/protos/data-node/api/v2"
    22  	"code.vegaprotocol.io/vega/protos/vega"
    23  )
    24  
    25  type NodeBasic struct {
    26  	ID              NodeID
    27  	PubKey          VegaPublicKey       `db:"vega_pub_key"`
    28  	TmPubKey        TendermintPublicKey `db:"tendermint_pub_key"`
    29  	EthereumAddress EthereumAddress
    30  	InfoURL         string
    31  	Location        string
    32  	Status          NodeStatus
    33  	Name            string
    34  	AvatarURL       string
    35  	TxHash          TxHash
    36  	VegaTime        time.Time
    37  }
    38  
    39  func (n NodeBasic) ToProto() *v2.NodeBasic {
    40  	return &v2.NodeBasic{
    41  		Id:              n.ID.String(),
    42  		PubKey:          n.PubKey.String(),
    43  		TmPubKey:        n.TmPubKey.String(),
    44  		EthereumAddress: n.EthereumAddress.String(),
    45  		InfoUrl:         n.InfoURL,
    46  		Location:        n.Location,
    47  		Status:          vega.NodeStatus(n.Status),
    48  		Name:            n.Name,
    49  		AvatarUrl:       n.AvatarURL,
    50  	}
    51  }