|
@ -113,6 +113,12 @@ char* sendRawTxWaitConfirm(char* rawTx) |
|
|
cJSON *resultJson = sendRpcRequest("eth_sendRawTransaction", params); |
|
|
cJSON *resultJson = sendRpcRequest("eth_sendRawTransaction", params); |
|
|
cJSON_Delete(params); |
|
|
cJSON_Delete(params); |
|
|
char *txId = NULL; |
|
|
char *txId = NULL; |
|
|
|
|
|
if (resultJson != NULL && is_cJSON_String(resultJson) && resultJson->valuestring != NULL) { |
|
|
|
|
|
char* tmp = resultJson->valuestring; |
|
|
|
|
|
txId = (char *) malloc(strlen(tmp) + 1); |
|
|
|
|
|
strcpy(txId, tmp); |
|
|
|
|
|
} |
|
|
|
|
|
/*
|
|
|
if (resultJson != NULL && is_cJSON_String(resultJson) && resultJson->valuestring != NULL) { |
|
|
if (resultJson != NULL && is_cJSON_String(resultJson) && resultJson->valuestring != NULL) { |
|
|
char* tmp = resultJson->valuestring; |
|
|
char* tmp = resultJson->valuestring; |
|
|
if (waitForConfirmation(tmp) > 0) { |
|
|
if (waitForConfirmation(tmp) > 0) { |
|
@ -120,6 +126,7 @@ char* sendRawTxWaitConfirm(char* rawTx) |
|
|
strcpy(txId, tmp); |
|
|
strcpy(txId, tmp); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
*/ |
|
|
cJSON_Delete(resultJson); |
|
|
cJSON_Delete(resultJson); |
|
|
pthread_mutex_unlock(&sendTxMutex); |
|
|
pthread_mutex_unlock(&sendTxMutex); |
|
|
return txId; |
|
|
return txId; |
|
@ -151,9 +158,9 @@ int64_t getNonce(char* address) |
|
|
}; |
|
|
}; |
|
|
cJSON *params = cJSON_CreateArray(); |
|
|
cJSON *params = cJSON_CreateArray(); |
|
|
cJSON_AddItemToArray(params, cJSON_CreateString(address)); |
|
|
cJSON_AddItemToArray(params, cJSON_CreateString(address)); |
|
|
cJSON_AddItemToArray(params, cJSON_CreateString("pending")); |
|
|
// cJSON_AddItemToArray(params, cJSON_CreateString("pending"));
|
|
|
int64_t nonce = -1; |
|
|
int64_t nonce = -1; |
|
|
cJSON *nonceJson = sendRpcRequest("eth_getTransactionCount", params); |
|
|
cJSON *nonceJson = sendRpcRequest("parity_nextNonce", params); |
|
|
cJSON_Delete(params); |
|
|
cJSON_Delete(params); |
|
|
if (nonceJson != NULL && is_cJSON_String(nonceJson) && nonceJson != NULL) { |
|
|
if (nonceJson != NULL && is_cJSON_String(nonceJson) && nonceJson != NULL) { |
|
|
nonce = (int64_t) strtol(nonceJson->valuestring, NULL, 0); |
|
|
nonce = (int64_t) strtol(nonceJson->valuestring, NULL, 0); |
|
|