|
| 1 | +package v2api |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + |
| 6 | + "github.com/filecoin-project/lotus/chain/types" |
| 7 | +) |
| 8 | + |
| 9 | +//go:generate go run github.com/golang/mock/mockgen -destination=v2mocks/mock_full.go -package=v2mocks . FullNode |
| 10 | + |
| 11 | +// FullNode represents an interface for the v2 full node APIs. This interface |
| 12 | +// currently consists of chain-related functionalities and the API is |
| 13 | +// experimental and subject to change. |
| 14 | +type FullNode interface { |
| 15 | + // MethodGroup: Chain |
| 16 | + // The Chain method group contains methods for interacting with |
| 17 | + // the blockchain. |
| 18 | + // |
| 19 | + // <b>Note: This API is experimental and may change in the future.<b/> |
| 20 | + // |
| 21 | + // Please see Filecoin V2 API design documentation for more details: |
| 22 | + // - https://www.notion.so/filecoindev/Lotus-F3-aware-APIs-1cfdc41950c180ae97fef580e79427d5 |
| 23 | + // - https://www.notion.so/filecoindev/Filecoin-V2-APIs-1d0dc41950c1808b914de5966d501658 |
| 24 | + |
| 25 | + // ChainGetTipSet retrieves a tipset that corresponds to the specified selector |
| 26 | + // criteria. The criteria can be provided in the form of a tipset key, a |
| 27 | + // blockchain height including an optional fallback to previous non-null tipset, |
| 28 | + // or a designated tag such as "latest" or "finalized". |
| 29 | + // |
| 30 | + // The "Finalized" tag returns the tipset that is considered finalized based on |
| 31 | + // the consensus protocol of the current node, either Filecoin EC Finality or |
| 32 | + // Filecoin Fast Finality (F3). The finalized tipset selection gracefully falls |
| 33 | + // back to EC finality in cases where F3 isn't ready or not running. |
| 34 | + // |
| 35 | + // In a case where no selector is provided, an error is returned. The selector |
| 36 | + // must be explicitly specified. |
| 37 | + // |
| 38 | + // For more details, refer to the types.TipSetSelector and |
| 39 | + // types.NewTipSetSelector. |
| 40 | + // |
| 41 | + // Example usage: |
| 42 | + // |
| 43 | + // selector := types.TipSetSelectors.Latest |
| 44 | + // tipSet, err := node.ChainGetTipSet(context.Background(), selector) |
| 45 | + // if err != nil { |
| 46 | + // fmt.Println("Error retrieving tipset:", err) |
| 47 | + // return |
| 48 | + // } |
| 49 | + // fmt.Printf("Latest TipSet: %v\n", tipSet) |
| 50 | + // |
| 51 | + ChainGetTipSet(context.Context, types.TipSetSelector) (*types.TipSet, error) //perm:read |
| 52 | +} |
0 commit comments