contractEstimateDeployMultiSig method
Implementation
Future<ContractEstimateDeployResponse> contractEstimateDeployMultiSig(
String nodeAddress, int maxVotes, int minVotes, double amount) async {
ContractEstimateDeployRequest contractEstimateDeployRequest;
ContractEstimateDeployResponse contractEstimateDeployResponse;
Map<String, dynamic> mapParams;
Completer<ContractEstimateDeployResponse> _completer =
new Completer<ContractEstimateDeployResponse>();
mapParams = {
'method': ContractEstimateDeployRequest.METHOD_NAME,
'params': [
{
"from": nodeAddress,
"codeHash": "0x05",
"amount": amount,
"args": [
{"index": 0, "format": "byte", "value": maxVotes.toString()},
{"index": 1, "format": "byte", "value": minVotes.toString()}
]
}
],
'id': 101,
'key': keyApp
};
try {
if (this.nodeType == NORMAL_VPS_NODE) {
SSHClientStatus sshClientStatus;
sshClientStatus = await VpsUtil().connectVps(this.apiUrl, keyApp);
if (sshClientStatus.sshClientStatus) {
sshClient = sshClientStatus.sshClient;
}
var response = await ssh.HttpClientImpl(
clientFactory: () =>
ssh.SSHTunneledBaseClient(sshClientStatus.sshClient)).request(
this.apiUrl,
method: 'POST',
data: jsonEncode(mapParams),
headers: requestHeaders);
if (response.status == 200) {
contractEstimateDeployResponse =
contractEstimateDeployResponseFromJson(response.text);
}
} else {
contractEstimateDeployRequest =
ContractEstimateDeployRequest.fromJson(mapParams);
body = json.encode(contractEstimateDeployRequest.toJson());
responseHttp = await http.post(Uri.parse(this.apiUrl),
body: body, headers: requestHeaders);
if (responseHttp.statusCode == 200) {
contractEstimateDeployResponse =
contractEstimateDeployResponseFromJson(responseHttp.body);
}
}
} catch (e) {
logger.e(e.toString());
}
_completer.complete(contractEstimateDeployResponse);
return _completer.future;
}