Skip to content

Commit

Permalink
upgrade caigo to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoryguillou committed Jun 29, 2022
1 parent 1971f33 commit 6ae91b9
Show file tree
Hide file tree
Showing 15 changed files with 293 additions and 1,857 deletions.
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/alecthomas/kong"
indexer "github.com/cartridge-gg/starknet-indexer"
_ "github.com/cartridge-gg/starknet-indexer/ent/runtime"
"github.com/dontpanicdao/caigo/jsonrpc"
"github.com/dontpanicdao/caigo/rpc"
"github.com/dontpanicdao/caigo/types"
_ "github.com/mattn/go-sqlite3"
"github.com/rs/zerolog/log"
Expand All @@ -29,7 +29,7 @@ func main() {
log.Fatal().Err(err).Msg("opening ent client")
}

provider, err := jsonrpc.DialContext(context.Background(), "https://starknet-goerli.cartridge.gg/")
provider, err := rpc.DialContext(context.Background(), "https://starknet-goerli.cartridge.gg/")
if err != nil {
log.Fatal().Err(err).Msg("Dialing provider")
}
Expand Down
10 changes: 5 additions & 5 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/cartridge-gg/starknet-indexer/ent"
"github.com/cartridge-gg/starknet-indexer/processor"
"github.com/dontpanicdao/caigo/jsonrpc"
"github.com/dontpanicdao/caigo/rpc"
"github.com/dontpanicdao/caigo/types"
"github.com/rs/zerolog/log"
concurrently "github.com/tejzpr/ordered-concurrently/v3"
Expand All @@ -33,14 +33,14 @@ type Engine struct {
sync.Mutex
client *ent.Client
latest uint64
provider *jsonrpc.Client
provider *rpc.Client
ticker *time.Ticker
blockProcessors []processor.BlockProcessor
transactionProcessors []processor.TransactionProcessor
eventProcessors []processor.EventProcessor
}

func NewEngine(ctx context.Context, client *ent.Client, provider *jsonrpc.Client, config Config) (*Engine, error) {
func NewEngine(ctx context.Context, client *ent.Client, provider *rpc.Client, config Config) (*Engine, error) {
e := &Engine{
client: client,
provider: provider,
Expand Down Expand Up @@ -153,7 +153,7 @@ func (e *Engine) process(ctx context.Context) error {

// Create a type based on your input to the work function
type fetcher struct {
provider *jsonrpc.Client
provider *rpc.Client
blockNumber uint64
blockProcessors []processor.BlockProcessor
transactionProcessors []processor.TransactionProcessor
Expand Down Expand Up @@ -196,7 +196,7 @@ func (f fetcher) Run(ctx context.Context) interface{} {

for i, evt := range t.Events {
for _, p := range f.eventProcessors {
cb, err := p.Process(ctx, f.provider, block, t, &processor.Event{evt, uint64(i)})
cb, err := p.Process(ctx, f.provider, block, t, &processor.Event{Event: evt, Index: uint64(i)})
if err != nil {
return response{block, nil, err}
}
Expand Down
264 changes: 0 additions & 264 deletions ent/token/where.go

This file was deleted.

Loading

0 comments on commit 6ae91b9

Please sign in to comment.