Documentation
¶
Index ¶
- Variables
- func NewApiCollector(manager *sync.Manager, feeder *feeder.Client) *apiCollector
- func NewL1Collector(manager *sync.Manager, feeder *feeder.Client, l1client L1Client, chainID int) *l1Collector
- type CollectorDiff
- type L1Client
- type StateDiffCollector
- type Synchronizer
- func (s *Synchronizer) ChainID() *big.Int
- func (s *Synchronizer) Close()
- func (s *Synchronizer) GetLatestBlockOnChain() int64
- func (s *Synchronizer) GetPendingBlock() *feeder.StarknetBlock
- func (s *Synchronizer) GetStateDiff(blockHash *felt.Felt) (*types.StateUpdate, error)
- func (s *Synchronizer) LatestBlockSynced() (blockNumber int64, blockHash *felt.Felt)
- func (s *Synchronizer) Run()
- func (s *Synchronizer) SetCode(collectedDiff *CollectorDiff, deployedContract *types.DeployedContract) error
- func (s *Synchronizer) Status() *types.SyncStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorMemoryPageNotFound = errors.New("memory page not found") ErrorFactAlreadySaved = errors.New("fact already saved") )
Functions ¶
func NewApiCollector ¶
NewApiCollector create a new api Collector notest
Types ¶
type CollectorDiff ¶
type CollectorDiff struct {
Code map[string]*starknetTypes.Contract
// contains filtered or unexported fields
}
type L1Client ¶
type L1Client interface {
ChainID(ctx context.Context) (*big.Int, error)
BlockNumber(ctx context.Context) (uint64, error)
FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethtypes.Log, error)
SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethtypes.Log) (ethereum.Subscription, error)
TransactionByHash(ctx context.Context, hash common.Hash) (tx *ethtypes.Transaction, isPending bool, err error)
}
type StateDiffCollector ¶
type StateDiffCollector interface {
// Run starts the collection of StateDiff.
Run()
// GetChannel returns the channel that will be used to collect the StateDiff.
GetChannel() chan *CollectorDiff
// Close closes the collection of StateDiff.
Close()
// LatestBlock returns the last block of StarkNet
LatestBlock() *feeder.StarknetBlock
// PendingBlock returns the pending block of StarkNet
PendingBlock() *feeder.StarknetBlock
}
StateDiffCollector is a collection of StateDiff provided from the feeder gateway that can be iterated over.
type Synchronizer ¶
type Synchronizer struct {
// Running is true when the service is active and running
Running bool
// contains filtered or unexported fields
}
func NewSynchronizer ¶
func NewSynchronizer(n utils.Network, ethNode string, feederClient *feeder.Client, syncManager *sync.Manager, stateManager state.StateManager, blockManager *blockDB.Manager, transactionManager *transaction.Manager, ) *Synchronizer
NewSynchronizer creates a new Synchronizer. notest
func (*Synchronizer) ChainID ¶
func (s *Synchronizer) ChainID() *big.Int
func (*Synchronizer) GetLatestBlockOnChain ¶
func (s *Synchronizer) GetLatestBlockOnChain() int64
func (*Synchronizer) GetPendingBlock ¶
func (s *Synchronizer) GetPendingBlock() *feeder.StarknetBlock
func (*Synchronizer) GetStateDiff ¶
func (s *Synchronizer) GetStateDiff(blockHash *felt.Felt) (*types.StateUpdate, error)
func (*Synchronizer) LatestBlockSynced ¶
func (s *Synchronizer) LatestBlockSynced() (blockNumber int64, blockHash *felt.Felt)
func (*Synchronizer) SetCode ¶
func (s *Synchronizer) SetCode(collectedDiff *CollectorDiff, deployedContract *types.DeployedContract) error
func (*Synchronizer) Status ¶
func (s *Synchronizer) Status() *types.SyncStatus
Source Files
¶
Click to show internal directories.
Click to hide internal directories.