Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: events: Add APIs to consume smart contract and built-in actor events #6279

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/libp2p/go-libp2p"
"github.com/pkg/errors"

"github.com/filecoin-project/venus/app/submodule/actorevent"
"github.com/filecoin-project/venus/app/submodule/blockstore"
"github.com/filecoin-project/venus/app/submodule/chain"
"github.com/filecoin-project/venus/app/submodule/common"
Expand Down Expand Up @@ -171,6 +172,10 @@ func (b *Builder) build(ctx context.Context) (*Node, error) {
return nil, err
}

if nd.actorEvent, err = actorevent.NewActorEventSubModule(ctx, b.repo.Config(), nd.chain, nd.eth); err != nil {
return nil, err
}

apiBuilder := NewBuilder()
apiBuilder.NameSpace("Filecoin")

Expand All @@ -188,6 +193,7 @@ func (b *Builder) build(ctx context.Context) (*Node, error) {
nd.market,
nd.common,
nd.eth,
nd.actorEvent,
)

if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion app/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/awnumar/memguard"
"github.com/etherlabsio/healthcheck/v2"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/venus/app/submodule/actorevent"
"github.com/filecoin-project/venus/app/submodule/blockstore"
chain2 "github.com/filecoin-project/venus/app/submodule/chain"
"github.com/filecoin-project/venus/app/submodule/common"
Expand Down Expand Up @@ -100,7 +101,8 @@ type Node struct {

common *common.CommonModule

eth *eth.EthSubModule
eth *eth.EthSubModule
actorEvent *actorevent.ActorEventSubModule

//
// Jsonrpc
Expand Down
4 changes: 3 additions & 1 deletion app/node/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"reflect"

"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/venus/app/submodule/actorevent"
"github.com/filecoin-project/venus/app/submodule/eth"
v0api "github.com/filecoin-project/venus/venus-shared/api/chain/v0"
v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
Expand Down Expand Up @@ -40,14 +41,15 @@ func (builder *RPCBuilder) AddServices(services ...RPCService) error {
}

var ethSubModuleTyp = reflect.TypeOf(&eth.EthSubModule{}).Elem()
var actorEventSubModuleTyp = reflect.TypeOf(&actorevent.ActorEventSubModule{}).Elem()

func skipV0API(in interface{}) bool {
inT := reflect.TypeOf(in)
if inT.Kind() == reflect.Pointer {
inT = inT.Elem()
}

return inT.AssignableTo(ethSubModuleTyp)
return inT.AssignableTo(ethSubModuleTyp) || inT.AssignableTo(actorEventSubModuleTyp)
}

func (builder *RPCBuilder) AddV0API(service RPCService) error {
Expand Down
Loading
Loading