setConnection method
Sets the active XMR node connection on the server.
This method sends a SetConnectionRequest to the Haveno gRPC server to set a new active XMR node. The connection is also set locally.
Example:
final newConnection = await xmrConnectionsClient.setConnection(connection);
print('New Active Node: ${newConnection?.url}');
Returns:
- A
Future
containing the new active UrlConnection. null
if an error occurs.
Implementation
Future<UrlConnection?> setConnection(UrlConnection connection) async {
if (!havenoChannel.isConnected) {
throw DaemonNotConnectedException();
}
try {
await havenoChannel.xmrConnectionsClient!
.setConnection(SetConnectionRequest(connection: connection));
return connection; // Set the new active node locally
} on GrpcError catch (e) {
handleGrpcError(e);
}
return null;
}