provider

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainProvider

type ChainProvider interface {
	ChainQuery
	NID() string
	Name() string
	Init(context.Context, string, kms.KMS) error
	Type() string
	Config() Config
	Listener(ctx context.Context, lastSavedHeight uint64, blockInfo chan *types.BlockInfo) error
	Route(ctx context.Context, message *types.Message, callback types.TxResponseFunc) error
	ShouldReceiveMessage(ctx context.Context, message *types.Message) (bool, error)
	ShouldSendMessage(ctx context.Context, message *types.Message) (bool, error)
	SetLastSavedHeightFunc(func() uint64)
	MessageReceived(ctx context.Context, key *types.MessageKey) (bool, error)
	SetAdmin(context.Context, string) error

	FinalityBlock(ctx context.Context) uint64
	GenerateMessages(ctx context.Context, messageKey *types.MessageKeyWithMessageHeight) ([]*types.Message, error)
	QueryBalance(ctx context.Context, addr string) (*types.Coin, error)

	NewKeystore(string) (string, error)
	RestoreKeystore(context.Context) error
	ImportKeystore(context.Context, string, string) (string, error)
	RevertMessage(context.Context, *big.Int) error
	GetFee(context.Context, string, bool) (uint64, error)
	SetFee(context.Context, string, *big.Int, *big.Int) error
	ClaimFee(context.Context) error
}

type ChainQuery

type ChainQuery interface {
	QueryLatestHeight(ctx context.Context) (uint64, error)
	QueryTransactionReceipt(ctx context.Context, txHash string) (*types.Receipt, error)
}

type CommonConfig added in v1.2.9

type CommonConfig struct {
	ChainName     string                  `json:"-" yaml:"-"`
	RPCUrl        string                  `json:"rpc-url" yaml:"rpc-url"`
	StartHeight   uint64                  `json:"start-height" yaml:"start-height"`
	Address       string                  `json:"address" yaml:"address"`
	Contracts     types.ContractConfigMap `json:"contracts" yaml:"contracts"`
	FinalityBlock uint64                  `json:"finality-block" yaml:"finality-block"`
	NID           string                  `json:"nid" yaml:"nid"`
	HomeDir       string                  `json:"-" yaml:"-"`
	Disabled      bool                    `json:"disabled" yaml:"disabled"`
}

CommonConfig is the common configuration for all chain providers

func (*CommonConfig) Enabled added in v1.2.9

func (c *CommonConfig) Enabled() bool

Enabled returns true if the provider is enabled

func (*CommonConfig) GetWallet added in v1.2.9

func (pc *CommonConfig) GetWallet() string

func (*CommonConfig) SetWallet added in v1.2.9

func (pc *CommonConfig) SetWallet(addr string)

func (*CommonConfig) Validate added in v1.2.9

func (pc *CommonConfig) Validate() error

type Config added in v1.1.0

type Config interface {
	NewProvider(context.Context, *zap.Logger, string, bool, string) (ChainProvider, error)
	SetWallet(string)
	GetWallet() string
	Validate() error
	Enabled() bool
}

Jump to

Keyboard shortcuts

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