telefil

package module
v0.0.0-...-645266a Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0, MIT Imports: 9 Imported by: 1

README

📡 Telefil

Go Reference Go Test

Filecoin API client in pure Go

Telefil offers a seamless way to engage with the Filecoin chain API using the JSON RPC 2.0 protocol, all while being written purely in Go. Notably, there are zero dependencies on Lotus, eliminating the need for C-bindings.

Features

Filecoin API interactions provided by Telefil are:

  • Filecoin.StateMinerInfo
  • Filecoin.ChainHead
  • Filecoin.ChainGetGenesis
  • Filecoin.StateDealProviderCollateralBounds
  • Filecoin.StateListMiners
  • Filecoin.StateMinerPower
  • Filecoin.StateMarketStorageDeal

Installation

go get github.com/filecoin-shipyard/telefil@latest

Status

🚧 This repository is under active development. 🚧

Please be aware that while we strive to keep the master branch stable, breaking changes may be introduced as we push forward. We recommend using released versions for production systems and always checking the release notes before updating.

Documentation

For detailed usage and integration guidance, please refer to godoc documentation.

Contribution

Contributions are welcome! Please see the CONTRIBUTING.md for more details.

License

This project is licensed under the MIT and Apache 2.0 Licenses - see the LICENSE.md file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainGenesis

type ChainGenesis struct {
	Blocks []struct {
		Timestamp int64 `json:"Timestamp"`
	} `json:"Blocks"`
}

type ChainHead

type ChainHead struct {
	Height abi.ChainEpoch `json:"Height"`
}

type Claim

type Claim struct {
	QualityAdjPower big.Int `json:"QualityAdjPower"`
	RawBytePower    big.Int `json:"RawBytePower"`
}

type Option

type Option func(*options) error

func WithFilecoinAPI

func WithFilecoinAPI(url string) Option

WithFilecoinAPI sets the Filecoin API endpoint. Defaults to https://api.node.glif.io

type StateDealProviderCollateralBounds

type StateDealProviderCollateralBounds struct {
	Min big.Int `json:"Min"`
	Max big.Int `json:"Max"`
}

type StateMarketStorageDeal

type StateMarketStorageDeal struct {
	Proposal market.DealProposal `json:"Proposal"`
	State    market.DealState    `json:"State"`
}

type StateMinerPower

type StateMinerPower struct {
	HasMinPower bool  `json:"HasMinPower"`
	MinerPower  Claim `json:"MinerPower"`
	TotalPower  Claim `json:"TotalPower"`
}

type Telefil

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

func New

func New(o ...Option) (*Telefil, error)

func (*Telefil) ChainGetGenesis

func (f *Telefil) ChainGetGenesis(ctx context.Context) (*ChainGenesis, error)

func (*Telefil) ChainHead

func (f *Telefil) ChainHead(ctx context.Context) (*ChainHead, error)

func (*Telefil) StateDealProviderCollateralBounds

func (f *Telefil) StateDealProviderCollateralBounds(ctx context.Context, pieceSize abi.PaddedPieceSize, verified bool) (*StateDealProviderCollateralBounds, error)

func (*Telefil) StateListMiners

func (f *Telefil) StateListMiners(ctx context.Context) ([]address.Address, error)

func (*Telefil) StateMarketStorageDeal

func (f *Telefil) StateMarketStorageDeal(ctx context.Context, id abi.DealID) (*StateMarketStorageDeal, error)

func (*Telefil) StateMinerInfo

func (f *Telefil) StateMinerInfo(ctx context.Context, sp address.Address) (*peer.AddrInfo, error)

func (*Telefil) StateMinerPower

func (f *Telefil) StateMinerPower(ctx context.Context, sp address.Address) (*StateMinerPower, error)

Jump to

Keyboard shortcuts

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