-
Notifications
You must be signed in to change notification settings - Fork 1
/
chain.go
45 lines (33 loc) · 1.34 KB
/
chain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
package nodeapi
import (
"context"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid"
)
type Chain struct{}
func (c *Chain) ChainHead(ctx context.Context) (*types.TipSet, error) {
return NodeClient.ChainAPI.ChainHead(ctx)
}
func (c *Chain) ChainGetTipSet(ctx context.Context, key types.TipSetKey) (*types.TipSet, error) {
return NodeClient.ChainAPI.ChainGetTipSet(ctx, key)
}
func (c *Chain) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error) {
return NodeClient.ChainAPI.ChainNotify(ctx)
}
func (c *Chain) ChainGetBlockMessages(ctx context.Context, blockCid cid.Cid) (*api.BlockMessages, error) {
return NodeClient.ChainAPI.ChainGetBlockMessages(ctx, blockCid)
}
func (c *Chain) ChainGetTipSetByHeight(ctx context.Context, e abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error) {
return NodeClient.ChainAPI.ChainGetTipSetByHeight(ctx, e, tsk)
}
type ApiBStore struct{}
func (a *ApiBStore) ChainReadObj(ctx context.Context, c cid.Cid) ([]byte, error) {
return NodeClient.ChainAPI.ChainReadObj(ctx, c)
}
func (a *ApiBStore) ChainHasObj(ctx context.Context, c cid.Cid) (bool, error) {
return NodeClient.ChainAPI.ChainHasObj(ctx, c)
}