mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
fns docs comments
This commit is contained in:
parent
685690723a
commit
53d7143156
1 changed files with 10 additions and 0 deletions
|
@ -293,6 +293,7 @@ class SubscribableElectrumXClient {
|
||||||
return '{"jsonrpc": "2.0", "id": "$id","method": "$method","params": $paramString}\r\n';
|
return '{"jsonrpc": "2.0", "id": "$id","method": "$method","params": $paramString}\r\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Update the connection status and call the onConnectionStatusChanged callback if it exists.
|
||||||
void _updateConnectionStatus(bool connectionStatus) {
|
void _updateConnectionStatus(bool connectionStatus) {
|
||||||
if (_isConnected != connectionStatus && onConnectionStatusChanged != null) {
|
if (_isConnected != connectionStatus && onConnectionStatusChanged != null) {
|
||||||
onConnectionStatusChanged!(connectionStatus);
|
onConnectionStatusChanged!(connectionStatus);
|
||||||
|
@ -300,6 +301,7 @@ class SubscribableElectrumXClient {
|
||||||
_isConnected = connectionStatus;
|
_isConnected = connectionStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called when the socket has data.
|
||||||
void _dataHandler(List<int> data) {
|
void _dataHandler(List<int> data) {
|
||||||
_responseData.addAll(data);
|
_responseData.addAll(data);
|
||||||
|
|
||||||
|
@ -320,6 +322,7 @@ class SubscribableElectrumXClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called when the socket has a response.
|
||||||
void _responseHandler(Map<String, dynamic> response) {
|
void _responseHandler(Map<String, dynamic> response) {
|
||||||
// subscriptions will have a method in the response
|
// subscriptions will have a method in the response
|
||||||
if (response['method'] is String) {
|
if (response['method'] is String) {
|
||||||
|
@ -333,6 +336,7 @@ class SubscribableElectrumXClient {
|
||||||
_complete(id, result);
|
_complete(id, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called when the subscription has a response.
|
||||||
void _subscriptionHandler({
|
void _subscriptionHandler({
|
||||||
required Map<String, dynamic> response,
|
required Map<String, dynamic> response,
|
||||||
}) {
|
}) {
|
||||||
|
@ -356,6 +360,7 @@ class SubscribableElectrumXClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called when the socket has an error.
|
||||||
void _errorHandler(Object error, StackTrace trace) {
|
void _errorHandler(Object error, StackTrace trace) {
|
||||||
_updateConnectionStatus(false);
|
_updateConnectionStatus(false);
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
|
@ -363,12 +368,14 @@ class SubscribableElectrumXClient {
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called when the socket is closed.
|
||||||
void _doneHandler() {
|
void _doneHandler() {
|
||||||
_updateConnectionStatus(false);
|
_updateConnectionStatus(false);
|
||||||
Logging.instance.log("SubscribableElectrumXClient called _doneHandler",
|
Logging.instance.log("SubscribableElectrumXClient called _doneHandler",
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Complete a task with the given id and data.
|
||||||
void _complete(String id, dynamic data) {
|
void _complete(String id, dynamic data) {
|
||||||
if (_tasks[id] == null) {
|
if (_tasks[id] == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -385,6 +392,7 @@ class SubscribableElectrumXClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a task to the task list.
|
||||||
void _addTask({
|
void _addTask({
|
||||||
required String id,
|
required String id,
|
||||||
required Completer<dynamic> completer,
|
required Completer<dynamic> completer,
|
||||||
|
@ -392,6 +400,7 @@ class SubscribableElectrumXClient {
|
||||||
_tasks[id] = SocketTask(completer: completer, subscription: null);
|
_tasks[id] = SocketTask(completer: completer, subscription: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a subscription task to the task list.
|
||||||
void _addSubscriptionTask({
|
void _addSubscriptionTask({
|
||||||
required String id,
|
required String id,
|
||||||
required ElectrumXSubscription subscription,
|
required ElectrumXSubscription subscription,
|
||||||
|
@ -399,6 +408,7 @@ class SubscribableElectrumXClient {
|
||||||
_tasks[id] = SocketTask(completer: null, subscription: subscription);
|
_tasks[id] = SocketTask(completer: null, subscription: subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Write call to socket.
|
||||||
Future<dynamic> _call({
|
Future<dynamic> _call({
|
||||||
required String method,
|
required String method,
|
||||||
List<dynamic> params = const [],
|
List<dynamic> params = const [],
|
||||||
|
|
Loading…
Reference in a new issue