add hash-transaction and send-transaction-with-signature

Signed-off-by: Andrea Franz <andrea@gravityblast.com>
This commit is contained in:
Andrea Franz 2019-02-28 16:09:21 +01:00
parent a98264014f
commit d4594d815f
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
3 changed files with 52 additions and 0 deletions

View File

@ -667,6 +667,44 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
return UUID.randomUUID().toString();
}
@ReactMethod
public void hashTransaction(final String txArgsJSON, final Callback callback) {
Log.d(TAG, "hashTransaction");
if (!checkAvailability()) {
callback.invoke(false);
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.hashTransaction(txArgsJSON);
callback.invoke(res);
}
};
StatusThreadPoolExecutor.getInstance().execute(r);
}
@ReactMethod
public void sendTransactionWithSignature(final String txArgsJSON, final String signature, final Callback callback) {
Log.d(TAG, "sendTransactionWithSignature");
if (!checkAvailability()) {
callback.invoke(false);
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.sendTransactionWithSignature(txArgsJSON, signature);
callback.invoke(res);
}
};
StatusThreadPoolExecutor.getInstance().execute(r);
}
@ReactMethod
public void sendTransaction(final String txArgsJSON, final String password, final Callback callback) {
Log.d(TAG, "sendTransaction");

View File

@ -52,6 +52,12 @@
(defn send-transaction [rpcParams password callback]
(native-module/send-transaction rpcParams password callback))
(defn hash-transaction [rpcParams callback]
(native-module/hash-transaction rpcParams callback))
(defn send-transaction-with-signature [rpcParams sig callback]
(native-module/send-transaction-with-signature rpcParams sig callback))
(defn send-data-notification [m callback]
(native-module/send-data-notification m callback))

View File

@ -100,10 +100,18 @@
(when (and @node-started status)
(.signMessage status rpcParams callback)))
(defn hash-transaction [rpcParams callback]
(when (and @node-started status)
(.hashTransaction status rpcParams callback)))
(defn send-transaction [rpcParams password callback]
(when (and @node-started status)
(.sendTransaction status rpcParams password callback)))
(defn send-transaction-with-signature [rpcParams sig callback]
(when (and @node-started status)
(.sendTransactionWithSignature status rpcParams sig callback)))
(defn close-application []
(.closeApplication status))