Synchronizer
The Synchronizer helps you synchronize on-chain data to the local environment.
Data Structure
SynchronizerStatus
Property | Type | Description |
---|---|---|
chains | List<ChainStatus> | Chain status list |
ChainStatus
Property | Type | Description |
---|---|---|
chainId | Int | Chain id |
syncedBlock | Int | Synced block number |
targetBlock | Int | Target block number |
contracts | List<ContractStatus> | Contract status list |
ContractStatus
Property | Type | Description |
---|---|---|
contractAddress | String | Contract address |
syncedBlock | Int | Synced block number |
ChainSyncedBlock
Sync block data according to chain id.
import 'package:mystiko_flutter/mystiko_flutter.dart';
MystikoSynchronizerApi api = await Mystiko.mystikoSynchronizerApi();
Response<Int64, SynchronizerError> response = await api.chainSyncedBlock(1);
ContractSyncedBlock
Sync block data according to chain id and contract address.
import 'package:mystiko_flutter/mystiko_flutter.dart';
MystikoSynchronizerApi api = await Mystiko.mystikoSynchronizerApi();
Response<Int64, SynchronizerError> response = await api.contractSyncedBlock(1, '0x123456');
Status
Check the Sync Status.
Parameter: withContracts
Indicates whether to include contract-related data in the synchronization status.
import 'package:mystiko_flutter/mystiko_flutter.dart';
MystikoSynchronizerApi api = await Mystiko.mystikoSynchronizerApi();
Response<SynchronizerStatus, SynchronizerError> response = await api.status(true);
Sync
Sync the data.
import 'package:mystiko_flutter/mystiko_flutter.dart';
MystikoSynchronizerApi api = await Mystiko.mystikoSynchronizerApi();
Response<void, SynchronizerError> response = await api.sync(SynchronizerSyncOptions());
The parameter list for SynchronizerSyncOptions
:
Parameter | Required | Description |
---|---|---|
disableDatapackerFetcher | false | Disable the datapacker fetcher. |
enableDatapackerFetcherValidate | false | Enable the datapacker fetcher validate. |
disableSequencerFetcher | false | Disable the sequencer fetcher. |
enableSequencerFetcherValidate | false | Enable the sequencer fetcher validate. |
disableProviderFetcher | false | Disable the provider fetcher. |
disableProviderFetcherValidate | false | Disable the provider fetcher validate. |
disableRuleValidator | false | Disable the rule validator. |
disableRuleValidatorIntegrityCheck | false | Disable the rule validator integrity check. |
disableRuleValidatorSequenceCheck | false | Disable the rule validator sequence check. |
disableRuleValidatorCounterCheck | false | Disable the rule validator counter check. |
disableRuleValidatorTreeCheck | false | Disable the rule validator tree check. |
fetcherFetchTimeoutMs | false | The fetcher fetch timeout in milliseconds. |
fetcherQueryLoadedBlockTimeoutMs | false | The fetcher query loaded block timeout in milliseconds. |
validatorValidateConcurrency | false | The validator validate concurrency. |
chainIds | false | The chain ids. |
Reset
Reset the synchronization data.
import 'package:mystiko_flutter/mystiko_flutter.dart';
MystikoSynchronizerApi api = await Mystiko.mystikoSynchronizerApi();
Response<void, SynchronizerError> response = await api.reset(SynchronizerResetOptions());
The parameter list for SynchronizerResetOptions
:
Parameter | Required | Description |
---|---|---|
chains | false | Reset chain options |
ResetChainOptions
:
Parameter | Required | Description |
---|---|---|
chainId | true | The chain id. |
contract_addresses | false | The contract addresses. |
block_number | false | The block number. |