model

package
v1.0.1-rc20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Asset types
	AssetTypeFixed    = "fixed_cap"
	AssetTypeVariable = "variable_cap"
	AssetTypeNFT      = "nft"

	// PVM block types
	BlockTypeProposal = "proposal"
	BlockTypeStandard = "standard"
	BlockTypeAtomic   = "atomic"
	BlockTypeCommit   = "commit"
	BlockTypeAbort    = "abort"
	BlockTypeEvm      = "evm"

	// Transaction statuses
	TxStatusAccepted = "accepted"
	TxStatusRejected = "rejected"
	TxStatusReverted = "reverted"

	// PVM transaction types
	TxTypeCreateChain        = "p_create_chain"
	TxTypeCreateSubnet       = "p_create_subnet"
	TxTypeAddSubnetValidator = "p_add_subnet_validator"
	TxTypeAdvanceTime        = "p_advance_time"
	TxTypeRewardValidator    = "p_reward_validator"
	TxTypeAddValidator       = "p_add_validator"
	TxTypeAddDelegator       = "p_add_delegator"
	TxTypePImport            = "p_import"
	TxTypePExport            = "p_export"

	// AVM transaction types
	TxTypeBase        = "x_base"
	TxTypeXImport     = "x_import"
	TxTypeXExport     = "x_export"
	TxTypeCreateAsset = "x_create_asset"
	TxTypeOperation   = "x_operation"

	// EMV transaction types
	TxTypeAtomicExport = "c_atomic_export"
	TxTypeAtomicImport = "c_atomic_import"
	TxTypeEvm          = "c_evm"

	// Output types
	OutTypeTransfer      = "transfer"
	OutTypeStakeableLock = "stakeable_lock"
	OutTypeReward        = "reward"
	OutTypeMint          = "mint"
	OutTypeNftMint       = "nft_mint"
	OutTypeNftTransfer   = "nft_transfer"

	// Reward types
	RewardTypeValidator = "validator"
	RewardTypeDelegator = "delegator"

	// Event scopes
	EventScopeStaking = "staking"
	EventScopeRewards = "rewards"
	EventScopeNetwork = "network"

	// Event Item Types
	EventItemTypeValidator = "validator"
	EventItemTypeDelegator = "delegator"

	// Event types
	EventTypeValidatorAdded             = "validator_added"
	EventTypeValidatorFinished          = "validator_finished"
	EventTypeValidatorCommissionChanged = "validator_commission_changed"
	EventTypeDelegatorAdded             = "delegator_added"
	EventTypeDelegatorFinished          = "delegator_finished"
	EventTypeSubnetValidatorAdded       = "subnet_validator_added"
)

Variables

Functions

This section is empty.

Types

type Address

type Address struct {
	ID                 int       `json:"id"`
	Chain              string    `json:"chain"`
	Value              string    `json:"value"`
	Balance            uint64    `json:"balance"`
	UnlockedBalance    uint64    `json:"unlocked_balance"`
	LockedStakeable    uint64    `json:"locked_stakeable"`
	LockedNotStakeable uint64    `json:"locked_not_stakeable"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
}

func (Address) TableName

func (Address) TableName() string

type Asset added in v0.3.0

type Asset struct {
	ID                int    `json:"-"`
	AssetID           string `json:"id"`
	Type              string `json:"type"`
	Name              string `json:"name"`
	Symbol            string `json:"symbol"`
	Denomination      int    `json:"denomination"`
	TransactionsCount *int   `json:"transactions_count,omitempty" gorm:"-"`
}

func (Asset) TableName added in v0.3.0

func (Asset) TableName() string

type Block added in v0.3.0

type Block struct {
	ID        string    `json:"id"`
	Type      string    `json:"type"`
	Parent    string    `json:"parent"`
	Chain     string    `json:"chain"`
	Height    uint64    `json:"height"`
	Timestamp time.Time `json:"timestamp"`
}

func (Block) TableName added in v0.3.0

func (Block) TableName() string

type Chain added in v0.3.0

type Chain struct {
	ID      int    `json:"-"`
	ChainID string `json:"id"`
	Name    string `json:"name"`
	VM      string `json:"vm,omitempty"`
	Subnet  string `json:"subnet,omitempty"`
	Network uint32 `json:"network,omitempty"`
}

func (Chain) TableName added in v0.3.0

func (Chain) TableName() string

type Credential added in v0.3.0

type Credential struct {
	Address   string `json:"address"`
	PublicKey string `json:"public_key"`
	Signature string `json:"signature"`
}

type Delegation

type Delegation struct {
	ID              int          `json:"-"`
	ReferenceID     string       `json:"id"`
	NodeID          string       `json:"node_id"`
	StakeAmount     types.Amount `json:"stake_amount"`
	PotentialReward types.Amount `json:"potential_reward"`
	RewardAddress   string       `json:"reward_address"`
	Active          bool         `json:"active"`
	ActiveStartTime time.Time    `json:"active_start_time"`
	ActiveEndTime   time.Time    `json:"active_end_time"`
	FirstHeight     uint64       `json:"first_height"`
	LastHeight      uint64       `json:"last_height"`
	CreatedAt       time.Time    `json:"created_at"`
	UpdatedAt       time.Time    `json:"updated_at"`
}

func (Delegation) TableName

func (Delegation) TableName() string

type DelegatorSeq

type DelegatorSeq struct {
	ID              int
	NodeID          string
	StakeAmount     int64
	PotentialReward int64
	ActiveStartTime time.Time
	ActiveEndTime   time.Time
	CreatedAt       time.Time
}

func (DelegatorSeq) TableName

func (DelegatorSeq) TableName() string

type Event

type Event struct {
	ID          string    `json:"id"`
	Type        string    `json:"type"`
	Scope       string    `json:"scope,omitempty"`
	Chain       string    `json:"chain,omitempty"`
	BlockHash   string    `json:"block"`
	BlockHeight uint64    `json:"block_height"`
	TxHash      string    `json:"tx_hash"`
	ItemID      string    `json:"item_id"`
	ItemType    string    `json:"item_type"`
	Timestamp   time.Time `json:"timestamp"`
	Data        types.Map `json:"data,omitempty" gorm:"type:text"`
}

func (*Event) AssignID added in v0.4.0

func (e *Event) AssignID() error

func (Event) TableName

func (Event) TableName() string

type EvmLog added in v0.6.0

type EvmLog struct {
	Idx     int            `json:"index"`
	TxIdx   int            `json:"tx_index"`
	Address string         `json:"address"`
	Removed bool           `json:"removed"`
	Topics  pq.StringArray `gorm:"type:text[]" json:"topics"`
	Data    string         `json:"data"`
}

type EvmReceipt added in v0.6.0

type EvmReceipt struct {
	ID              string `json:"id"`
	Type            int    `json:"type"`
	Status          int    `json:"status"`
	ContractAddress string `json:"contract_address"`
	Logs            string `json:"-"`
}

func (EvmReceipt) TableName added in v0.6.0

func (EvmReceipt) TableName() string

type EvmTrace added in v0.6.0

type EvmTrace struct {
	ID        string    `json:"id"`
	Data      string    `json:"data"`
	Timestamp time.Time `json:"timestamp"`
}

func (EvmTrace) TableName added in v0.6.0

func (EvmTrace) TableName() string

type NetworkMetric

type NetworkMetric struct {
	ID                      int          `json:"-"`
	Time                    time.Time    `json:"time"`
	Height                  uint64       `json:"height"`
	PeersCount              int          `json:"peers_count"`
	BlockchainsCount        int          `json:"blockchains_count"`
	ActiveValidatorsCount   int          `json:"active_validators_count"`
	PendingValidatorsCount  int          `json:"pending_validators_count"`
	ActiveDelegationsCount  int          `json:"active_delegations_count"`
	PendingDelegationsCount int          `json:"pending_delegations_count"`
	MinValidatorStake       int64        `json:"min_validator_stake"`
	MinDelegationStake      int64        `json:"min_delegation_stake"`
	TxFee                   uint64       `json:"tx_fee"`
	CreationTxFee           uint64       `json:"creation_tx_fee"`
	Uptime                  float64      `json:"uptime"`
	DelegationFee           float64      `json:"delegation_fee"`
	TotalStaked             types.Amount `json:"total_staked"`
	TotalDelegated          types.Amount `json:"total_delegated"`
}

func (NetworkMetric) TableName

func (NetworkMetric) TableName() string

type NetworkStat

type NetworkStat struct {
	ID                 int          `json:"-"`
	Time               time.Time    `json:"time"`
	Bucket             string       `json:"bucket"`
	HeightChange       uint64       `json:"height_change"`
	Peers              int          `json:"peers"`
	Blockchains        int          `json:"blockchains"`
	ActiveValidators   int          `json:"active_validators"`
	PendingValidators  int          `json:"pending_validators"`
	ValidatorUptime    float64      `json:"validator_uptime"`
	ActiveDelegations  int          `json:"active_delegations"`
	PendingDelegations int          `json:"pending_delegations"`
	MinValidatorStake  int64        `json:"min_validator_stake"`
	MinDelegationStake int64        `json:"min_delegator_stake"`
	TxFee              int64        `json:"tx_fee"`
	CreateTxFee        int64        `json:"create_tx_fee"`
	TotalStaked        types.Amount `json:"total_staked"`
	TotalDelegated     types.Amount `json:"total_delegated"`
}

func (NetworkStat) TableName

func (NetworkStat) TableName() string

type Output added in v0.3.0

type Output struct {
	ID        string         `json:"id"`
	TxID      string         `json:"tx_id"`
	Chain     string         `json:"chain"`
	Asset     string         `json:"asset"`
	Type      string         `json:"type"`
	Index     uint64         `json:"index"`
	Locktime  uint64         `json:"locktime"`
	Threshold uint32         `json:"threshold"`
	Amount    uint64         `json:"amount"`
	Group     uint32         `json:"group"`
	Addresses pq.StringArray `json:"addresses" gorm:"type:text[]"`
	Stake     bool           `json:"stake"`
	Reward    bool           `json:"reward"`
	Spent     bool           `json:"spent"`
	SpentTxID *string        `json:"spent_in_tx"`
	Payload   *string        `json:"payload,omitempty"`
}

func (Output) TableName added in v0.3.0

func (Output) TableName() string

type RawMessage added in v0.3.0

type RawMessage struct {
	ID          int        `json:"id"`
	TopicID     int        `json:"topic_id"`
	IndexID     uint64     `json:"index_id"`
	Data        string     `json:"data"`
	Hash        string     `json:"hash"`
	CreatedAt   time.Time  `json:"created_at"`
	ProcessedAt *time.Time `json:"-"`
}

func (RawMessage) DataBytes added in v0.3.0

func (msg RawMessage) DataBytes() ([]byte, error)

type RawMessageTopic added in v0.3.0

type RawMessageTopic struct {
	ID    int    `json:"id"`
	Chain string `json:"chain"`
	Name  string `json:"name"`
	VM    string `json:"vm"`
}

type Reward added in v0.3.0

type Reward struct {
	ID            string    `json:"id"`
	TransactionID string    `json:"transaction_id"`
	Rewarded      bool      `json:"rewarded"`
	RewardedAt    time.Time `json:"rewarded_at"`
	ProcessedAt   time.Time `json:"processed_at"`
}

type RewardsOwner added in v0.3.0

type RewardsOwner struct {
	ID        string                `json:"id"`
	Locktime  uint64                `json:"locktime"`
	Threshold uint32                `json:"threshold"`
	Addresses []RewardsOwnerAddress `json:"-" gorm:"-"`
	Outputs   []RewardsOwnerOutput  `json:"-" gorm:"-"`
}

type RewardsOwnerAddress added in v0.3.0

type RewardsOwnerAddress struct {
	ID      string `json:"id"`
	Address string `json:"address"`
	Index   uint32 `json:"index"`
}

type RewardsOwnerOutput added in v0.3.0

type RewardsOwnerOutput struct {
	ID            string `json:"id"`
	TransactionID string `json:"transaction_id"`
	Index         uint32 `json:"index"`
}

type SyncStatus added in v0.3.0

type SyncStatus struct {
	ID        string    `json:"id"`
	IndexID   uint64    `json:"index_id"`
	IndexTime time.Time `json:"index_time"`
	TipID     uint64    `json:"tip_id"`
	TipTime   time.Time `json:"tip_time"`
}

func (SyncStatus) AtTip added in v0.3.0

func (s SyncStatus) AtTip() bool

func (SyncStatus) Lag added in v0.3.0

func (s SyncStatus) Lag() uint64

func (SyncStatus) NextID added in v0.3.0

func (s SyncStatus) NextID() uint64

func (SyncStatus) TableName added in v0.3.0

func (SyncStatus) TableName() string

type Transaction added in v0.3.0

type Transaction struct {
	ID            string  `json:"id"`
	ReferenceTxID *string `json:"reference_tx_id,omitempty"`

	Chain       string    `json:"chain"`
	Type        string    `json:"type"`
	Block       *string   `json:"block,omitempty"`
	BlockHeight *uint64   `json:"block_height,omitempty"`
	Timestamp   time.Time `json:"timestamp"`
	Status      string    `json:"status,omitempty"`

	Memo             *string   `json:"memo,omitempty"`
	MemoText         *string   `json:"memo_text,omitempty"`
	Nonce            *uint64   `json:"nonce,omitempty"`
	Fee              uint64    `json:"fee"`
	SourceChain      *string   `json:"source_chain,omitempty"`
	DestinationChain *string   `json:"destination_chain,omitempty"`
	Metadata         types.Map `json:"metadata,omitempty" gorm:"type:text"`

	Inputs        []Output          `json:"inputs,omitempty" sql:"-" gorm:"-"`
	InputAmounts  map[string]uint64 `json:"input_amounts,omitempty" sql:"-" gorm:"-"`
	Outputs       []Output          `json:"outputs,omitempty" sql:"-" gorm:"-"`
	OutputAmounts map[string]uint64 `json:"output_amounts,omitempty" sql:"-" gorm:"-"`
}

func (*Transaction) SetRawMemo added in v0.3.0

func (tx *Transaction) SetRawMemo(data []byte)

func (*Transaction) SetReferenceID added in v0.3.0

func (tx *Transaction) SetReferenceID(value string)

func (Transaction) TableName added in v0.3.0

func (Transaction) TableName() string

func (*Transaction) UpdateAmounts added in v0.3.0

func (tx *Transaction) UpdateAmounts()

func (*Transaction) UsesUTXOs added in v0.3.0

func (tx *Transaction) UsesUTXOs() bool

type TransactionInput added in v0.3.0

type TransactionInput struct {
	ID   string
	TxID string
}

func (TransactionInput) TableName added in v0.3.0

func (TransactionInput) TableName() string

type TransactionTypeCount added in v0.3.0

type TransactionTypeCount struct {
	Type       string `json:"type"`
	TotalCount int    `json:"total_count"`
}

type Validator

type Validator struct {
	ID                     int          `json:"-"`
	NodeID                 string       `json:"node_id"`
	StakeAmount            types.Amount `json:"stake_amount"`
	StakePercent           float64      `json:"stake_percent"`
	PotentialReward        types.Amount `json:"potential_reward"`
	RewardAddress          string       `json:"reward_address"`
	Active                 bool         `json:"active"`
	ActiveStartTime        time.Time    `json:"active_start_time"`
	ActiveEndTime          time.Time    `json:"active_end_time"`
	ActiveProgressPercent  float64      `json:"active_progress_percent"`
	Uptime                 float64      `json:"uptime"`
	DelegationsCount       int          `json:"delegations_count"`
	DelegationsPercent     float64      `json:"delegations_percent"`
	DelegatedAmount        types.Amount `json:"delegated_amount"`
	DelegatedAmountPercent float64      `json:"delegated_amount_percent"`
	DelegationFee          float64      `json:"delegation_fee"`
	Capacity               types.Amount `json:"capacity"`
	CapacityPercent        float64      `json:"capacity_percent"`
	FirstHeight            uint64       `json:"first_height"`
	LastHeight             uint64       `json:"last_height"`
	CreatedAt              time.Time    `json:"created_at"`
	UpdatedAt              time.Time    `json:"updated_at"`
}

func (Validator) TableName

func (Validator) TableName() string

type ValidatorReward added in v0.3.0

type ValidatorReward struct {
	ValidatorID string
	TxID        string
	RewardTxID  string
}

type ValidatorSeq

type ValidatorSeq struct {
	ID                     int
	Time                   time.Time
	Height                 uint64
	NodeID                 string
	StakeAmount            types.Amount
	StakePercent           float64
	PotentialReward        types.Amount
	RewardAddress          string
	Active                 bool
	ActiveStartTime        time.Time
	ActiveEndTime          time.Time
	ActiveProgressPercent  float64
	DelegationsCount       int
	DelegationsPercent     float64
	DelegatedAmount        types.Amount
	DelegatedAmountPercent float64
	DelegationFee          float64
	Uptime                 float64
}

func (ValidatorSeq) TableName

func (ValidatorSeq) TableName() string

type ValidatorStat

type ValidatorStat struct {
	ID                     int       `json:"-"`
	Time                   time.Time `json:"time"`
	Bucket                 string    `json:"bucket"`
	NodeID                 string    `json:"-"`
	UptimeMin              float64   `json:"uptime_min"`
	UptimeMax              float64   `json:"uptime_max"`
	UptimeAvg              float64   `json:"uptime_avg"`
	StakeAmount            int64     `json:"stake_amount"`
	StakePercent           float64   `json:"stake_percent"`
	DelegationsCount       int       `json:"delegations_count"`
	DelegationsPercent     float64   `json:"delegations_percent"`
	DelegatedAmount        int64     `json:"delegated_amount"`
	DelegatedAmountPercent float64   `json:"delegated_amount_percent"`
}

func (ValidatorStat) TableName

func (ValidatorStat) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL