[#11136] Warning to users sending ERC20 directly to smart contract
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
b32367a9b2
commit
8eed842c62
|
@ -25,6 +25,7 @@
|
||||||
"eth_getBlockByNumber" {}
|
"eth_getBlockByNumber" {}
|
||||||
"eth_newBlockFilter" {:subscription? true}
|
"eth_newBlockFilter" {:subscription? true}
|
||||||
"eth_newFilter" {:subscription? true}
|
"eth_newFilter" {:subscription? true}
|
||||||
|
"eth_getCode" {}
|
||||||
"eth_syncing" {}
|
"eth_syncing" {}
|
||||||
"net_version" {}
|
"net_version" {}
|
||||||
"web3_clientVersion" {}
|
"web3_clientVersion" {}
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
(fx/defn set-recipient
|
(fx/defn set-recipient
|
||||||
{:events [::recipient-address-resolved]}
|
{:events [::recipient-address-resolved]}
|
||||||
[{:keys [db]} raw-recipient id]
|
[{:keys [db] :as cofx} raw-recipient id]
|
||||||
(when (or (not id) (= id @resolve-last-id))
|
(when (or (not id) (= id @resolve-last-id))
|
||||||
(reset! resolve-last-id nil)
|
(reset! resolve-last-id nil)
|
||||||
(let [chain (ethereum/chain-keyword db)
|
(let [chain (ethereum/chain-keyword db)
|
||||||
|
@ -64,9 +64,17 @@
|
||||||
(ethereum/address? recipient)
|
(ethereum/address? recipient)
|
||||||
(let [checksum (eip55/address->checksum recipient)]
|
(let [checksum (eip55/address->checksum recipient)]
|
||||||
(if (eip55/valid-address-checksum? checksum)
|
(if (eip55/valid-address-checksum? checksum)
|
||||||
|
(fx/merge cofx
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:wallet/recipient :searching] false)
|
(assoc-in [:wallet/recipient :searching] false)
|
||||||
(assoc-in [:wallet/recipient :resolved-address] checksum))}
|
(assoc-in [:wallet/recipient :resolved-address] checksum))}
|
||||||
|
(json-rpc/call
|
||||||
|
{:method "eth_getCode"
|
||||||
|
:params [checksum "latest"]
|
||||||
|
:on-success #(when (not= "0x" %)
|
||||||
|
(utils/show-popup (i18n/label :t/warning)
|
||||||
|
(i18n/label :t/warning-sending-to-contract-descr)))
|
||||||
|
:number-of-retries 3}))
|
||||||
{:ui/show-error (i18n/label :t/wallet-invalid-address-checksum {:data recipient})
|
{:ui/show-error (i18n/label :t/wallet-invalid-address-checksum {:data recipient})
|
||||||
:db (assoc-in db [:wallet/recipient :searching] false)}))
|
:db (assoc-in db [:wallet/recipient :searching] false)}))
|
||||||
(and (not (string/blank? recipient)) (ens/valid-eth-name-prefix? recipient))
|
(and (not (string/blank? recipient)) (ens/valid-eth-name-prefix? recipient))
|
||||||
|
|
|
@ -1273,5 +1273,6 @@
|
||||||
"recent-empty": "Recently used addresses will appear here",
|
"recent-empty": "Recently used addresses will appear here",
|
||||||
"address-or-ens-name": "Address or ENS name",
|
"address-or-ens-name": "Address or ENS name",
|
||||||
"name-optional": "Name (optional)",
|
"name-optional": "Name (optional)",
|
||||||
"mute": "Mute"
|
"mute": "Mute",
|
||||||
|
"warning-sending-to-contract-descr": "The address you entered is a smart contract, sending funds to this address may result in loss of funds. To interact with a DApp, open the DApp in the Status DApp Browser."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue