Skip to content

Commit

Permalink
feat: events: Add APIs to consume smart contract and built-in actor e…
Browse files Browse the repository at this point in the history
…vents
  • Loading branch information
simlecode committed Mar 6, 2024
1 parent 9ad1edd commit 4cac810
Show file tree
Hide file tree
Showing 27 changed files with 2,599 additions and 193 deletions.
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

0 comments on commit 4cac810

Please sign in to comment.