-
Notifications
You must be signed in to change notification settings - Fork 12
Feat/subsquid datasource #52
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
Conversation
…d working sequencer
…ion / FunctionInvocation / FeeTransferInvocation placing. TBD in newest blocks
pkg/indexer/indexer.go
Outdated
|
|
||
| func (indexer *Indexer) getNewBlocks(ctx context.Context) error { | ||
| head, err := indexer.receiver.Head(ctx) | ||
| commonReceiver, ok := indexer.receiver.(*receiver.Receiver) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как будто эту проверку можно перенести в начало sync метода. getNewBlocks только там и вызывается
| return traces, nil | ||
| } | ||
|
|
||
| func getTxTraces(traces []api.TraceResponse, txIndex uint) []api.TraceResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как ни странно, но здесь могут помочь итераторы =) не уверен, что будет выглядеть чище, но можешь посмотреть при желании
|
|
||
| for invokationIndex := range flatInvocations { | ||
| invocation := flatInvocations[invokationIndex] | ||
| calldata := make([]data.Felt, len(invocation.Calldata)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно сделать какую-нибудь вспомогательную функцию для перевода []string -> []data.Felt. Часто встречается
| return current | ||
| } | ||
|
|
||
| func filterEventsByAddress(events []api.Event, targetAddress []int) []api.Event { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тоже очень похоже на итераторы
| return response.Body().AsString() | ||
| } | ||
|
|
||
| func (s *Subsquid) GetBlocks(_ context.Context, from, to uint64, workerUrl string) ([]*SqdBlockResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Используй контекст workerClient.Context().Set()
| import "github.com/dipdup-io/starknet-go-api/pkg/data" | ||
|
|
||
| func (block *SqdBlockResponse) GetDeployContractAddress(txIndex uint) data.Felt { | ||
| for _, trace := range block.Traces { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделай итерацию по индексу лучше
| if value == nil { | ||
| return "" | ||
| } | ||
| return data.Felt(fmt.Sprintf("%d", *value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вроде через %x надо сделать
# Conflicts: # go.mod # go.sum
…o hex string repr.
No description provided.