adaptors

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ConsulsCount = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EthereumAdapterOption

type EthereumAdapterOption func(*EthereumAdaptor) error

func EthAdapterWithGhClient

func EthAdapterWithGhClient(ghClient *gravity.Client) EthereumAdapterOption

func WithEthereumGravityContract

func WithEthereumGravityContract(address string) EthereumAdapterOption

type EthereumAdaptor

type EthereumAdaptor struct {
	// contains filtered or unexported fields
}

func NewEthereumAdaptor

func NewEthereumAdaptor(privKey []byte, nodeUrl string, ctx context.Context, opts ...EthereumAdapterOption) (*EthereumAdaptor, error)

func (*EthereumAdaptor) AddPulse

func (adaptor *EthereumAdaptor) AddPulse(nebulaId account.NebulaId, pulseId uint64, validators []account.OraclesPubKey, hash []byte, ctx context.Context) (string, error)

func (*EthereumAdaptor) GetHeight

func (adaptor *EthereumAdaptor) GetHeight(ctx context.Context) (uint64, error)

func (*EthereumAdaptor) LastPulseId

func (adaptor *EthereumAdaptor) LastPulseId(nebulaId account.NebulaId, ctx context.Context) (uint64, error)

func (*EthereumAdaptor) LastRound

func (adaptor *EthereumAdaptor) LastRound(ctx context.Context) (uint64, error)

func (*EthereumAdaptor) PubKey

func (adaptor *EthereumAdaptor) PubKey() account.OraclesPubKey

func (*EthereumAdaptor) RoundExist

func (adaptor *EthereumAdaptor) RoundExist(roundId int64, ctx context.Context) (bool, error)

func (*EthereumAdaptor) SendConsulsToGravityContract

func (adaptor *EthereumAdaptor) SendConsulsToGravityContract(newConsulsAddresses []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)

func (*EthereumAdaptor) SendValueToSubs

func (adaptor *EthereumAdaptor) SendValueToSubs(nebulaId account.NebulaId, pulseId uint64, value *extractor.Data, ctx context.Context) error

func (*EthereumAdaptor) SetOraclesToNebula

func (adaptor *EthereumAdaptor) SetOraclesToNebula(nebulaId account.NebulaId, oracles []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)

func (*EthereumAdaptor) Sign

func (adaptor *EthereumAdaptor) Sign(msg []byte) ([]byte, error)

func (*EthereumAdaptor) SignConsuls

func (adaptor *EthereumAdaptor) SignConsuls(consulsAddresses []*account.OraclesPubKey, roundId int64) ([]byte, error)

func (*EthereumAdaptor) SignOracles

func (adaptor *EthereumAdaptor) SignOracles(nebulaId account.NebulaId, oracles []*account.OraclesPubKey) ([]byte, error)

func (*EthereumAdaptor) ValueType

func (adaptor *EthereumAdaptor) ValueType(nebulaId account.NebulaId, ctx context.Context) (contracts.ExtractorType, error)

func (*EthereumAdaptor) WaitTx

func (adaptor *EthereumAdaptor) WaitTx(id string, ctx context.Context) error

type IBlockchainAdaptor

type IBlockchainAdaptor interface {
	GetHeight(ctx context.Context) (uint64, error)
	WaitTx(id string, ctx context.Context) error
	Sign(msg []byte) ([]byte, error)
	PubKey() account.OraclesPubKey
	ValueType(nebulaId account.NebulaId, ctx context.Context) (contracts.ExtractorType, error)

	AddPulse(nebulaId account.NebulaId, pulseId uint64, validators []account.OraclesPubKey, hash []byte, ctx context.Context) (string, error)
	SendValueToSubs(nebulaId account.NebulaId, pulseId uint64, value *extractor.Data, ctx context.Context) error

	SetOraclesToNebula(nebulaId account.NebulaId, oracles []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)
	SendConsulsToGravityContract(newConsulsAddresses []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)
	SignConsuls(consulsAddresses []*account.OraclesPubKey, roundId int64) ([]byte, error)
	SignOracles(nebulaId account.NebulaId, oracles []*account.OraclesPubKey) ([]byte, error)

	LastPulseId(nebulaId account.NebulaId, ctx context.Context) (uint64, error)
	LastRound(ctx context.Context) (uint64, error)
	RoundExist(roundId int64, ctx context.Context) (bool, error)
}

type SubType

type SubType uint8
const (
	Int64  SubType = 0
	String SubType = 1
	Bytes  SubType = 2
)

type WavesAdapterOption

type WavesAdapterOption func(*WavesAdaptor) error

func WavesAdapterWithGhClient

func WavesAdapterWithGhClient(ghClient *gravity.Client) WavesAdapterOption

func WithWavesGravityContract

func WithWavesGravityContract(address string) WavesAdapterOption

type WavesAdaptor

type WavesAdaptor struct {
	// contains filtered or unexported fields
}

func NewWavesAdapter

func NewWavesAdapter(seed []byte, nodeUrl string, chainId byte, opts ...WavesAdapterOption) (*WavesAdaptor, error)

func (*WavesAdaptor) AddPulse

func (adaptor *WavesAdaptor) AddPulse(nebulaId account.NebulaId, pulseId uint64, validators []account.OraclesPubKey, hash []byte, ctx context.Context) (string, error)

func (*WavesAdaptor) GetHeight

func (adaptor *WavesAdaptor) GetHeight(ctx context.Context) (uint64, error)

func (*WavesAdaptor) LastPulseId

func (adaptor *WavesAdaptor) LastPulseId(nebulaId account.NebulaId, ctx context.Context) (uint64, error)

func (*WavesAdaptor) LastRound

func (adaptor *WavesAdaptor) LastRound(ctx context.Context) (uint64, error)

func (*WavesAdaptor) PubKey

func (adaptor *WavesAdaptor) PubKey() account.OraclesPubKey

func (*WavesAdaptor) RoundExist

func (adaptor *WavesAdaptor) RoundExist(roundId int64, ctx context.Context) (bool, error)

func (*WavesAdaptor) SendConsulsToGravityContract

func (adaptor *WavesAdaptor) SendConsulsToGravityContract(newConsulsAddresses []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)

func (*WavesAdaptor) SendValueToSubs

func (adaptor *WavesAdaptor) SendValueToSubs(nebulaId account.NebulaId, pulseId uint64, value *extractor.Data, ctx context.Context) error

func (*WavesAdaptor) SetOraclesToNebula

func (adaptor *WavesAdaptor) SetOraclesToNebula(nebulaId account.NebulaId, oracles []*account.OraclesPubKey, signs map[account.OraclesPubKey][]byte, round int64, ctx context.Context) (string, error)

func (*WavesAdaptor) Sign

func (adaptor *WavesAdaptor) Sign(msg []byte) ([]byte, error)

func (*WavesAdaptor) SignConsuls

func (adaptor *WavesAdaptor) SignConsuls(consulsAddresses []*account.OraclesPubKey, roundId int64) ([]byte, error)

func (*WavesAdaptor) SignOracles

func (adaptor *WavesAdaptor) SignOracles(nebulaId account.NebulaId, oracles []*account.OraclesPubKey) ([]byte, error)

func (*WavesAdaptor) ValueType

func (adaptor *WavesAdaptor) ValueType(nebulaId account.NebulaId, ctx context.Context) (contracts.ExtractorType, error)

func (*WavesAdaptor) WaitTx

func (adaptor *WavesAdaptor) WaitTx(id string, ctx context.Context) error

Jump to

Keyboard shortcuts

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