filclient

package
v0.0.0-...-269d6e4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilClient

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

FilClient provides API to interact with the Filecoin network.

func New

func New(api v0api.FullNode, h host.Host, opts ...Option) (*FilClient, error)

New returns a new FilClient.

func (*FilClient) CheckChainDeal

func (fc *FilClient) CheckChainDeal(
	ctx context.Context,
	dealid int64) (active bool, expiration uint64, slashed bool, err error)

CheckChainDeal checks if a deal is active on-chain. If that's the case, it also returns the deal expiration as a second parameter.

func (*FilClient) CheckDealStatusWithStorageProvider

func (fc *FilClient) CheckDealStatusWithStorageProvider(
	ctx context.Context,
	storageProviderID string,
	dealIdentifier string,
	rw *store.RemoteWallet,
) (pcid *cid.Cid, ds storagemarket.StorageDealStatus, err error)

CheckDealStatusWithStorageProvider checks a deal proposal status with a storage-provider. The caller should be aware that shouldn't fully trust data from storage-providers. To fully confirm the deal, a call to CheckChainDeal must be made after the storage-provider publishes the deal on-chain.

func (*FilClient) ExecuteAuctionDeal

func (fc *FilClient) ExecuteAuctionDeal(
	ctx context.Context,
	ad store.AuctionData,
	aud store.AuctionDeal,
	rw *store.RemoteWallet) (didentifier string, retriable bool, err error)

ExecuteAuctionDeal creates a deal with a storage-provider using the data described in an auction deal.

func (*FilClient) GetChainHeight

func (fc *FilClient) GetChainHeight(ctx context.Context) (height uint64, err error)

GetChainHeight returns the current chain height.

func (*FilClient) ResolveDealIDFromMessage

func (fc *FilClient) ResolveDealIDFromMessage(
	ctx context.Context,
	publishDealMessage cid.Cid,
	spID string,
	pieceCid cid.Cid,
	startEpoch uint64) (dealID int64, err error)

ResolveDealIDFromMessage looks for a publish deal message by its Cid and resolves the deal-id from the receipt. If the message isn't found, the return parameters are 0,nil. If the message is found, a deal-id is returned which can be trusted to match the original ProposalCid. This method is mostly what Estuary does with some tweaks, kudos to them!

type Option

type Option func(*config) error

Option applies a configuration change.

func WithAllowUnverifiedDeals

func WithAllowUnverifiedDeals(allow bool) Option

WithAllowUnverifiedDeals indicates if unverified deals are allowed.

func WithExportedKey

func WithExportedKey(exportedHexKey string) Option

WithExportedKey configures the wallet address private key used to make deals.

func WithMaxPriceLimits

func WithMaxPriceLimits(maxVerifiedPricePerGiBPerEpoch, maxUnverifiedPricePerGiBPerEpoch int64) Option

WithMaxPriceLimits indicates maximum attoFIL per GiB per epoch in proosals.

func WithRelayAddr

func WithRelayAddr(relayMaddr string) Option

WithRelayAddr configures a relay multiaddr to include while dialing remote wallet.

Jump to

Keyboard shortcuts

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