Skip to content

Commit

Permalink
feat: add ChainGetEvents to the gateway API (#11724)
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Mar 15, 2024
1 parent bfb3602 commit 12b6d76
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/api_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ type Gateway interface {

GetActorEvents(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
SubscribeActorEvents(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)
ChainGetEvents(context.Context, cid.Cid) ([]types.Event, error)
}
13 changes: 13 additions & 0 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/gateway.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
1 change: 1 addition & 0 deletions gateway/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ type TargetAPI interface {

GetActorEvents(ctx context.Context, filter *types.ActorEventFilter) ([]*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
Expand Down
7 changes: 7 additions & 0 deletions gateway/proxy_fil.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,13 @@ func (gw *Node) SubscribeActorEvents(ctx context.Context, filter *types.ActorEve
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) {
if err := gw.limit(ctx, stateRateLimitTokens); err != nil {
return nil, err
Expand Down

0 comments on commit 12b6d76

Please sign in to comment.