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

upgrade caigo to 0.3.0 #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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