types

package
v1.103.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockRequest

func BlockRequest(rpcHost string, height int64) (string, string)

func UnmarshalBlock

func UnmarshalBlock(buf []byte) (string, []string, error)

Types

type AccountResp

type AccountResp struct {
	Height string `json:"height"`
	Result struct {
		Value struct {
			AccountNumber uint64 `json:"account_number,string"`
			Sequence      uint64 `json:"sequence,string"`
		} `json:"value"`
	} `json:"result"`
}

AccountResp the response from mayaclient

type BroadcastResult

type BroadcastResult struct {
	JSONRPC string                            `json:"jsonrpc"`
	Result  coretypes.ResultBroadcastTxCommit `json:"result"`
}

type ErrataBlock

type ErrataBlock struct {
	Height int64
	Txs    []ErrataTx
}

type ErrataTx

type ErrataTx struct {
	TxID  common.TxID
	Chain common.Chain
}

type Msg

type Msg struct {
	Type  string                 `json:"type"`
	Value stypes.MsgObservedTxIn `json:"value"`
}

type RPCBlock

type RPCBlock struct {
	Jsonrpc string `json:"jsonrpc"`
	ID      string `json:"id"`
	Result  struct {
		Block struct {
			Header struct {
				Height string `json:"height"`
			} `json:"header"`
			Data struct {
				Txs []string `json:"txs"`
			} `json:"data"`
		} `json:"block"`
	} `json:"result"`
}

type SetTx

type SetTx struct {
	Mode string `json:"mode"`
	Tx   struct {
		Msg        []cosmos.Msg               `json:"msg"`
		Fee        legacytypes.StdFee         `json:"fee"`
		Signatures []legacytypes.StdSignature `json:"signatures"` // nolint
		Memo       string                     `json:"memo"`
	} `json:"tx"`
}

type Solvency

type Solvency struct {
	Height int64
	Chain  common.Chain
	PubKey common.PubKey
	Coins  common.Coins
}

Solvency structure is to hold all the information necessary to report solvency to THORNode

type TxArrayItem

type TxArrayItem struct {
	Chain                 common.Chain   `json:"chain,omitempty"`
	ToAddress             common.Address `json:"to_address,omitempty"`
	VaultPubKey           common.PubKey  `json:"vault_pub_key,omitempty"`
	Coin                  common.Coin    `json:"coin"`
	Memo                  string         `json:"memo,omitempty"`
	MaxGas                common.Gas     `json:"max_gas"`
	GasRate               int64          `json:"gas_rate,omitempty"`
	InHash                common.TxID    `json:"in_hash,omitempty"`
	OutHash               common.TxID    `json:"out_hash,omitempty"`
	Aggregator            string         `json:"aggregator,omitempty"`
	AggregatorTargetAsset string         `json:"aggregator_target_asset,omitempty"`
	AggregatorTargetLimit *cosmos.Uint   `json:"aggregator_target_limit,omitempty"`
}

TxArrayItem used to represent the tx out item coming from BASEChain, there is little difference between TxArrayItem and TxOutItem defined above , only Coin <-> Coins field are different. TxArrayItem from BASEChain has Coin , which only have a single coin TxOutItem used in bifrost need to support Coins , because when Yggdrasil return , it send all the coins back to asgard using multisend

func (TxArrayItem) TxOutItem

func (tx TxArrayItem) TxOutItem() TxOutItem

TxOutItem convert the information to TxOutItem

type TxIn

type TxIn struct {
	Count                string       `json:"count"`
	Chain                common.Chain `json:"chain"`
	TxArray              []TxInItem   `json:"txArray"`
	Filtered             bool         `json:"filtered"`
	MemPool              bool         `json:"mem_pool"`          // indicate whether this item is in the mempool or not
	SentUnFinalised      bool         `json:"sent_un_finalised"` // indicate whehter unfinalised tx had been sent to BASEChain
	Finalised            bool         `json:"finalised"`
	ConfirmationRequired int64        `json:"confirmation_required"`
}

func (TxIn) GetTotalGas

func (t TxIn) GetTotalGas() cosmos.Uint

GetTotalGas return the total gas

func (TxIn) GetTotalTransactionValue

func (t TxIn) GetTotalTransactionValue(asset common.Asset, excludeFrom []common.Address) cosmos.Uint

GetTotalTransactionValue return the total value of the requested asset

type TxInItem

type TxInItem struct {
	BlockHeight           int64         `json:"block_height"`
	Tx                    string        `json:"tx"`
	Memo                  string        `json:"memo"`
	Sender                string        `json:"sender"`
	To                    string        `json:"to"` // to adddress
	Coins                 common.Coins  `json:"coins"`
	Gas                   common.Gas    `json:"gas"`
	ObservedVaultPubKey   common.PubKey `json:"observed_vault_pub_key"`
	Aggregator            string        `json:"aggregator"`
	AggregatorTarget      string        `json:"aggregator_target"`
	AggregatorTargetLimit *cosmos.Uint  `json:"aggregator_target_limit"`
}

func (TxInItem) CacheHash

func (t TxInItem) CacheHash(chain common.Chain, inboundHash string) string

CacheHash calculate the has used for signer cache

func (TxInItem) IsEmpty

func (t TxInItem) IsEmpty() bool

IsEmpty return true only when every field in TxInItem is empty

type TxInStatus

type TxInStatus byte
const (
	Processing TxInStatus = iota
	Failed
)

type TxInStatusItem

type TxInStatusItem struct {
	TxIn   TxIn       `json:"tx_in"`
	Status TxInStatus `json:"status"`
}

TxInStatusItem represent the TxIn item status

type TxMode

type TxMode uint8
const (
	TxUnknown TxMode = iota
	TxAsync
	TxSync
	TxBlock
)

func NewMode

func NewMode(mode string) (TxMode, error)

func (TxMode) IsValid

func (tx TxMode) IsValid() bool

func (TxMode) String

func (tx TxMode) String() string

type TxOut

type TxOut struct {
	Height  int64         `json:"height"`
	TxArray []TxArrayItem `json:"tx_array"`
}

TxOut represent the tx out information , bifrost need to sign and process

type TxOutItem

type TxOutItem struct {
	Chain                 common.Chain   `json:"chain"`
	ToAddress             common.Address `json:"to"`
	VaultPubKey           common.PubKey  `json:"vault_pubkey"`
	Coins                 common.Coins   `json:"coins"`
	Memo                  string         `json:"memo"`
	MaxGas                common.Gas     `json:"max_gas"`
	GasRate               int64          `json:"gas_rate"`
	InHash                common.TxID    `json:"in_hash"`
	OutHash               common.TxID    `json:"out_hash"`
	Aggregator            string         `json:"aggregator"`
	AggregatorTargetAsset string         `json:"aggregator_target_asset,omitempty"`
	AggregatorTargetLimit *cosmos.Uint   `json:"aggregator_target_limit,omitempty"`
}

TxOutItem represent the information of a tx bifrost need to process

func (TxOutItem) CacheHash

func (tx TxOutItem) CacheHash() string

CacheHash return a hash that doesn't include VaultPubKey , thus this one can be used as cache key for txOutItem across different vaults

func (TxOutItem) Equals

func (tx TxOutItem) Equals(tx2 TxOutItem) bool

Equals compare two TxOutItem , return true when they are the same , otherwise false

func (TxOutItem) Hash

func (tx TxOutItem) Hash() string

Hash return a sha256 hash that can uniquely represent the TxOutItem

Jump to

Keyboard shortcuts

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