feat: add ChainGetEvents to the gateway API (#11724)
This commit is contained in:
parent
b4d4e7ad9a
commit
0555255a52
@ -132,4 +132,5 @@ type Gateway interface {
|
|||||||
|
|
||||||
GetActorEvents(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
|
GetActorEvents(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
|
||||||
SubscribeActorEvents(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)
|
SubscribeActorEvents(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)
|
||||||
|
ChainGetEvents(context.Context, cid.Cid) ([]types.Event, error)
|
||||||
}
|
}
|
||||||
|
@ -655,6 +655,8 @@ type GatewayMethods struct {
|
|||||||
|
|
||||||
ChainGetBlockMessages func(p0 context.Context, p1 cid.Cid) (*BlockMessages, error) ``
|
ChainGetBlockMessages func(p0 context.Context, p1 cid.Cid) (*BlockMessages, error) ``
|
||||||
|
|
||||||
|
ChainGetEvents func(p0 context.Context, p1 cid.Cid) ([]types.Event, error) ``
|
||||||
|
|
||||||
ChainGetGenesis func(p0 context.Context) (*types.TipSet, error) ``
|
ChainGetGenesis func(p0 context.Context) (*types.TipSet, error) ``
|
||||||
|
|
||||||
ChainGetMessage func(p0 context.Context, p1 cid.Cid) (*types.Message, error) ``
|
ChainGetMessage func(p0 context.Context, p1 cid.Cid) (*types.Message, error) ``
|
||||||
@ -4286,6 +4288,17 @@ func (s *GatewayStub) ChainGetBlockMessages(p0 context.Context, p1 cid.Cid) (*Bl
|
|||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *GatewayStruct) ChainGetEvents(p0 context.Context, p1 cid.Cid) ([]types.Event, error) {
|
||||||
|
if s.Internal.ChainGetEvents == nil {
|
||||||
|
return *new([]types.Event), ErrNotSupported
|
||||||
|
}
|
||||||
|
return s.Internal.ChainGetEvents(p0, p1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *GatewayStub) ChainGetEvents(p0 context.Context, p1 cid.Cid) ([]types.Event, error) {
|
||||||
|
return *new([]types.Event), ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
func (s *GatewayStruct) ChainGetGenesis(p0 context.Context) (*types.TipSet, error) {
|
func (s *GatewayStruct) ChainGetGenesis(p0 context.Context) (*types.TipSet, error) {
|
||||||
if s.Internal.ChainGetGenesis == nil {
|
if s.Internal.ChainGetGenesis == nil {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -149,6 +149,7 @@ type TargetAPI interface {
|
|||||||
|
|
||||||
GetActorEvents(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
|
GetActorEvents(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
|
||||||
SubscribeActorEvents(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)
|
SubscribeActorEvents(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)
|
||||||
|
ChainGetEvents(ctx context.Context, eventsRoot cid.Cid) ([]types.Event, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ TargetAPI = *new(api.FullNode) // gateway depends on latest
|
var _ TargetAPI = *new(api.FullNode) // gateway depends on latest
|
||||||
|
@ -451,6 +451,13 @@ func (gw *Node) SubscribeActorEvents(ctx context.Context, filter *types.ActorEve
|
|||||||
return gw.target.SubscribeActorEvents(ctx, filter)
|
return gw.target.SubscribeActorEvents(ctx, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gw *Node) ChainGetEvents(ctx context.Context, eventsRoot cid.Cid) ([]types.Event, error) {
|
||||||
|
if err := gw.limit(ctx, chainRateLimitTokens); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return gw.target.ChainGetEvents(ctx, eventsRoot)
|
||||||
|
}
|
||||||
|
|
||||||
func (gw *Node) StateReadState(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*api.ActorState, error) {
|
func (gw *Node) StateReadState(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*api.ActorState, error) {
|
||||||
if err := gw.limit(ctx, stateRateLimitTokens); err != nil {
|
if err := gw.limit(ctx, stateRateLimitTokens); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user