core

package
Version: v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DB_PATH = ".darwinia/cache/shadow.db"

Same directory as `darwinia.js`

View Source
const GENESIS_ERROR = "The requested block number is too low, only support blocks heigher than %v"

Shadow genesis block error message

View Source
const PROOF_LOCK = "proof.lock"

Variables

This section is empty.

Functions

func ConnectDb added in v0.1.2

func ConnectDb() (*gorm.DB, error)

Connect to cache

Types

type EthHeaderWithProofCache added in v0.1.2

type EthHeaderWithProofCache struct {
	gorm.Model
	Number uint64 `json:"number" gorm:"unique_index"`
	Header string `json:"eth_header"`
	Proof  string `json:"proof"`
}

EthHeaderWithProof Cache

func (*EthHeaderWithProofCache) Fetch added in v0.1.2

Fetch Eth Header by number

func (*EthHeaderWithProofCache) FromResp added in v0.1.2

Save header to cache

func (*EthHeaderWithProofCache) IntoResp added in v0.1.2

Convert EthHeader

type GetEthHeaderByHashParams added in v0.1.2

type GetEthHeaderByHashParams struct {
	Hash string `json:"hash"`
}

*

* GetEthHeaderByHash

type GetEthHeaderByHashResp added in v0.1.2

type GetEthHeaderByHashResp struct {
	Header types.Header `json:"header"`
}

type GetEthHeaderByNumberParams

type GetEthHeaderByNumberParams struct {
	Number uint64 `json:"number"`
}

*

* GetEthHeaderByNumber

type GetEthHeaderByNumberResp

type GetEthHeaderByNumberResp struct {
	Header types.Header `json:"header"`
}

type GetEthHeaderWithProofByHashParams added in v0.1.2

type GetEthHeaderWithProofByHashParams struct {
	Hash    string                               `json:"hash"`
	Options GetEthHeaderWithProofByNumberOptions `json:"options"`
}

*

* GetEthHeaderWithProofByNumber

type GetEthHeaderWithProofByNumberCodecResp added in v0.1.1

type GetEthHeaderWithProofByNumberCodecResp struct {
	Header string `json:"header"`
	Proof  string `json:"proof"`
}

type GetEthHeaderWithProofByNumberJSONResp added in v0.1.1

type GetEthHeaderWithProofByNumberJSONResp struct {
	Header util.DarwiniaEthHeaderHexFormat  `json:"eth_header"`
	Proof  []util.DoubleNodeWithMerkleProof `json:"proof"`
}

type GetEthHeaderWithProofByNumberOptions added in v0.1.1

type GetEthHeaderWithProofByNumberOptions struct {
	Format string `json:"format"`
}

*

* GetEthHeaderWithProofByNumber

type GetEthHeaderWithProofByNumberParams

type GetEthHeaderWithProofByNumberParams struct {
	Number  uint64                               `json:"block_num"`
	Options GetEthHeaderWithProofByNumberOptions `json:"options"`
}

type GetEthHeaderWithProofByNumberRawResp added in v0.1.1

type GetEthHeaderWithProofByNumberRawResp struct {
	Header util.DarwiniaEthHeader           `json:"eth_header"`
	Proof  []util.DoubleNodeWithMerkleProof `json:"proof"`
}

type Shadow

type Shadow struct {
	Config util.Config
}

Dimmy shadow service

func (*Shadow) GetEthHeaderByHash added in v0.1.2

func (s *Shadow) GetEthHeaderByHash(
	params GetEthHeaderByHashParams,
	resp *GetEthHeaderByHashResp,
) error

func (*Shadow) GetEthHeaderByNumber

func (s *Shadow) GetEthHeaderByNumber(
	params GetEthHeaderByNumberParams,
	resp *GetEthHeaderByNumberResp,
) error

func (*Shadow) GetEthHeaderWithProofByHash added in v0.1.2

func (s *Shadow) GetEthHeaderWithProofByHash(
	params GetEthHeaderWithProofByHashParams,
	resp *interface{},
) error

func (*Shadow) GetEthHeaderWithProofByNumber

func (s *Shadow) GetEthHeaderWithProofByNumber(
	params GetEthHeaderWithProofByNumberParams,
	resp *interface{},
) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL