[#12920] Unable to perform swap on 1inch.exchange if initial swap was cancelled by closing bottom sheet

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2022-01-06 14:54:18 +01:00
parent a858918b80
commit 130308fa8a
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
6 changed files with 57 additions and 6 deletions

View File

@ -1011,6 +1011,25 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
StatusThreadPoolExecutor.getInstance().execute(r); StatusThreadPoolExecutor.getInstance().execute(r);
} }
@ReactMethod
public void recover(final String rpcParams, final Callback callback) {
Log.d(TAG, "recover");
if (!checkAvailability()) {
callback.invoke(false);
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
String res = Statusgo.recover(rpcParams);
callback.invoke(res);
}
};
StatusThreadPoolExecutor.getInstance().execute(r);
}
@ReactMethod @ReactMethod
public void signTypedData(final String data, final String account, final String password, final Callback callback) { public void signTypedData(final String data, final String account, final String password, final Callback callback) {
Log.d(TAG, "signTypedData"); Log.d(TAG, "signTypedData");

View File

@ -662,6 +662,18 @@ RCT_EXPORT_METHOD(signMessage:(NSString *)message
callback(@[result]); callback(@[result]);
} }
////////////////////////////////////////////////////////////////////
#pragma mark - Recover
//////////////////////////////////////////////////////////////////// recover
RCT_EXPORT_METHOD(recover:(NSString *)message
callback:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"Recover() method called");
#endif
NSString *result = StatusgoRecover(message);
callback(@[result]);
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#pragma mark - SignTypedData #pragma mark - SignTypedData
//////////////////////////////////////////////////////////////////// signTypedData //////////////////////////////////////////////////////////////////// signTypedData

View File

@ -107,6 +107,7 @@
} }
else else
{ {
if (window.statusAppDebug) { console.log("resolve " + callback.method + " :" + JSON.stringify(data.result.result)); }
callback.resolve(data.result.result); callback.resolve(data.result.result);
} }
} }
@ -239,6 +240,7 @@
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
callbacks[messageId] = {beta: true, callbacks[messageId] = {beta: true,
method: method,
resolve: resolve, resolve: resolve,
reject: reject}; reject: reject};
}); });

View File

@ -418,12 +418,19 @@
:result {:jsonrpc "2.0" :result {:jsonrpc "2.0"
:id (int id) :id (int id)
:result (if (= method "eth_coinbase") dapps-address [dapps-address])}}) :result (if (= method "eth_coinbase") dapps-address [dapps-address])}})
(if (= method "personal_ecRecover")
{:signing.fx/recover-message {:params {:message (first params)
:signature (second params)}
:on-completed #(re-frame/dispatch [:browser.callback/call-rpc
{:type constants/web3-send-async-callback
:messageId message-id
:result (types/json->clj %)}])}}
{:browser/call-rpc [payload {:browser/call-rpc [payload
#(re-frame/dispatch [:browser.callback/call-rpc #(re-frame/dispatch [:browser.callback/call-rpc
{:type constants/web3-send-async-callback {:type constants/web3-send-async-callback
:messageId message-id :messageId message-id
:error %1 :error %1
:result %2}])]})))) :result %2}])]})))))
(fx/defn handle-no-permissions [cofx {:keys [method id]} message-id] (fx/defn handle-no-permissions [cofx {:keys [method id]} message-id]
(if (= method "eth_accounts") (if (= method "eth_accounts")

View File

@ -253,6 +253,11 @@
(log/debug "[native-module] sign-message") (log/debug "[native-module] sign-message")
(.signMessage ^js (status) rpcParams callback)) (.signMessage ^js (status) rpcParams callback))
(defn recover-message
[rpcParams callback]
(log/debug "[native-module] recover")
(.recover ^js (status) rpcParams callback))
(defn send-transaction (defn send-transaction
"NOTE: beware, the password has to be sha3 hashed" "NOTE: beware, the password has to be sha3 hashed"
[rpcParams hashed-password callback] [rpcParams hashed-password callback]

View File

@ -47,6 +47,12 @@
(status/sign-message (types/clj->json params) (status/sign-message (types/clj->json params)
on-completed))) on-completed)))
(re-frame/reg-fx
:signing.fx/recover-message
(fn [{:keys [params on-completed]}]
(status/recover-message (types/clj->json params)
on-completed)))
(re-frame/reg-fx (re-frame/reg-fx
:signing.fx/sign-typed-data :signing.fx/sign-typed-data
(fn [{:keys [v4 data account on-completed hashed-password]}] (fn [{:keys [v4 data account on-completed hashed-password]}]