35 lines
656 B
Go
35 lines
656 B
Go
|
package state
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/filecoin-project/go-address"
|
||
|
|
||
|
"github.com/filecoin-project/lotus/chain/types"
|
||
|
)
|
||
|
|
||
|
type FastChainApiAPI interface {
|
||
|
ChainAPI
|
||
|
|
||
|
ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error)
|
||
|
}
|
||
|
|
||
|
type fastAPI struct {
|
||
|
FastChainApiAPI
|
||
|
}
|
||
|
|
||
|
func WrapFastAPI(api FastChainApiAPI) ChainAPI {
|
||
|
return &fastAPI{
|
||
|
api,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (a *fastAPI) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
||
|
ts, err := a.FastChainApiAPI.ChainGetTipSet(ctx, tsk)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return a.FastChainApiAPI.StateGetActor(ctx, actor, ts.Parents())
|
||
|
}
|