nearprovider

package
v0.0.0-...-af5322b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoShardsAvailable = errors.New("No shards available")
View Source
var ErrUnknownTx = errors.New("unknown tx")
View Source
var NearHooks = figure.Hooks{
	"*nearclient.Client": func(raw interface{}) (reflect.Value, error) {
		v, err := cast.ToStringE(raw)
		if err != nil {
			return reflect.Value{}, errors.Wrap(err, "expected string")
		}

		client, err := nearclient.New(v)
		if err != nil {
			return reflect.Value{}, errors.Wrap(err, "failed to create near rpc client")
		}

		return reflect.ValueOf(client), nil
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	S3  s3.Config `fig:"s3,required"`
	RPC RPCs      `fig:"rpc,required"`
}

type Message

type Message struct {
	Block  *common.BlockView   `json:"block"`
	Shards []*common.ShardView `json:"shards"`
}

type Nearer

type Nearer interface {
	Near() Provider
}

func NewNearer

func NewNearer(getter kv.Getter, log *logan.Entry) Nearer

type Provider

type Provider interface {
	ListBlocks(ctx context.Context, limit uint64, fromBlock common.BlockHeight) ([]common.BlockHeight, error)
	GetMessage(ctx context.Context, height common.BlockHeight) (*Message, error)
	GetTransaction(ctx context.Context, hash common.Hash, sender common.AccountID) (*common.FinalExecutionOutcomeWithReceiptView, error)
	GetLastKnownBlockHeight(ctx context.Context) (*common.BlockHeight, error)
	GetNFTMetadata(ctx context.Context, token common.AccountID, tokenID string) (*common.NftMetadataView, error)
}

func New

func New(client, historyClient *nearclient.Client, s3 s3.Connector, log *logan.Entry) Provider

type RPCs

type RPCs struct {
	Main    *nearclient.Client `fig:"main,required"`
	History *nearclient.Client `fig:"history,required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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