ReownCore constructor
ReownCore({
- required String projectId,
- String relayUrl = ReownConstants.DEFAULT_RELAY_URL,
- String pushUrl = ReownConstants.DEFAULT_PUSH_URL,
- bool memoryStore = false,
- LogLevel logLevel = LogLevel.nothing,
- IHttpClient httpClient = const HttpWrapper(),
- IWebSocketHandler? webSocketHandler,
Implementation
ReownCore({
required this.projectId,
this.relayUrl = ReownConstants.DEFAULT_RELAY_URL,
this.pushUrl = ReownConstants.DEFAULT_PUSH_URL,
bool memoryStore = false,
LogLevel logLevel = LogLevel.nothing,
IHttpClient httpClient = const HttpWrapper(),
IWebSocketHandler? webSocketHandler,
}) {
PrettyPrinter();
_logLevel = logLevel;
_logger = Logger(
level: _logLevel.toLevel(),
printer: _LogPrinter(
stackTraceBeginIndex: 0,
methodCount:
_logLevel == LogLevel.debug || _logLevel == LogLevel.error ? 8 : 0,
errorMethodCount: 8,
),
);
heartbeat = HeartBeat();
storage = SharedPrefsStores(
memoryStore: memoryStore,
);
crypto = Crypto(
core: this,
keyChain: GenericStore<String>(
storage: storage,
context: StoreVersions.CONTEXT_KEYCHAIN,
version: StoreVersions.VERSION_KEYCHAIN,
fromJson: (dynamic value) => value as String,
),
);
relayClient = RelayClient(
core: this,
messageTracker: MessageTracker(
storage: storage,
context: StoreVersions.CONTEXT_MESSAGE_TRACKER,
version: StoreVersions.VERSION_MESSAGE_TRACKER,
fromJson: (dynamic value) {
return ReownCoreUtils.convertMapTo<String>(value);
},
),
topicMap: GenericStore<String>(
storage: storage,
context: StoreVersions.CONTEXT_TOPIC_MAP,
version: StoreVersions.VERSION_TOPIC_MAP,
fromJson: (dynamic value) => value as String,
),
socketHandler: webSocketHandler,
);
expirer = Expirer(
storage: storage,
context: StoreVersions.CONTEXT_EXPIRER,
version: StoreVersions.VERSION_EXPIRER,
fromJson: (dynamic value) => value as int,
);
pairing = Pairing(
core: this,
pairings: PairingStore(
storage: storage,
context: StoreVersions.CONTEXT_PAIRINGS,
version: StoreVersions.VERSION_PAIRINGS,
fromJson: (dynamic value) {
return PairingInfo.fromJson(value as Map<String, dynamic>);
},
),
history: JsonRpcHistory(
storage: storage,
context: StoreVersions.CONTEXT_JSON_RPC_HISTORY,
version: StoreVersions.VERSION_JSON_RPC_HISTORY,
fromJson: (dynamic value) => JsonRpcRecord.fromJson(value),
),
topicToReceiverPublicKey: GenericStore(
storage: storage,
context: StoreVersions.CONTEXT_TOPIC_TO_RECEIVER_PUBLIC_KEY,
version: StoreVersions.VERSION_TOPIC_TO_RECEIVER_PUBLIC_KEY,
fromJson: (dynamic value) => ReceiverPublicKey.fromJson(value),
),
);
echo = Echo(
core: this,
echoClient: EchoClient(
baseUrl: pushUrl,
httpClient: httpClient,
),
);
verify = Verify(
core: this,
httpClient: httpClient,
);
connectivity = ConnectivityState(
core: this,
);
linkModeStore = LinkModeStore(
storage: storage,
context: StoreVersions.CONTEXT_LINKMODE,
version: StoreVersions.VERSION_LINKMODE,
fromJson: (dynamic value) => value as List<String>,
);
}