handle error from infura
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
329182fdbe
commit
4704cef3da
|
@ -42,6 +42,7 @@
|
||||||
:method "resolver(bytes32)"
|
:method "resolver(bytes32)"
|
||||||
:params [(namehash ens-name)]
|
:params [(namehash ens-name)]
|
||||||
:outputs ["address"]
|
:outputs ["address"]
|
||||||
|
:on-error #(cb "0x")
|
||||||
:on-success
|
:on-success
|
||||||
(fn [[address]]
|
(fn [[address]]
|
||||||
(cb (when-not (= address default-address) address)))}))
|
(cb (when-not (= address default-address) address)))}))
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
:method "owner(bytes32)"
|
:method "owner(bytes32)"
|
||||||
:params [(namehash ens-name)]
|
:params [(namehash ens-name)]
|
||||||
:outputs ["address"]
|
:outputs ["address"]
|
||||||
|
:on-error #(cb "0x")
|
||||||
:on-success
|
:on-success
|
||||||
(fn [[address]]
|
(fn [[address]]
|
||||||
(cb address))}))
|
(cb address))}))
|
||||||
|
@ -80,6 +82,7 @@
|
||||||
:method "addr(bytes32)"
|
:method "addr(bytes32)"
|
||||||
:params [(namehash ens-name)]
|
:params [(namehash ens-name)]
|
||||||
:outputs ["address"]
|
:outputs ["address"]
|
||||||
|
:on-error #(cb "0x")
|
||||||
:on-success
|
:on-success
|
||||||
(fn [[address]]
|
(fn [[address]]
|
||||||
(cb address))}))
|
(cb address))}))
|
||||||
|
@ -95,6 +98,7 @@
|
||||||
:method "name(bytes32)"
|
:method "name(bytes32)"
|
||||||
:params [(namehash ens-name)]
|
:params [(namehash ens-name)]
|
||||||
:outputs ["string"]
|
:outputs ["string"]
|
||||||
|
:on-error #(cb "0x")
|
||||||
:on-success
|
:on-success
|
||||||
(fn [[name]]
|
(fn [[name]]
|
||||||
(cb name))}))
|
(cb name))}))
|
||||||
|
@ -123,6 +127,7 @@
|
||||||
{:contract resolver
|
{:contract resolver
|
||||||
:method "contenthash(bytes32)"
|
:method "contenthash(bytes32)"
|
||||||
:params [(namehash ens-name)]
|
:params [(namehash ens-name)]
|
||||||
|
:on-error #(cb "0x")
|
||||||
:on-success
|
:on-success
|
||||||
(fn [raw-hash]
|
(fn [raw-hash]
|
||||||
;; NOTE: it would be better if our abi-spec/decode was able to do that
|
;; NOTE: it would be better if our abi-spec/decode was able to do that
|
||||||
|
@ -172,7 +177,10 @@
|
||||||
:on-success
|
:on-success
|
||||||
(fn [[x y]]
|
(fn [[x y]]
|
||||||
(let [public-key (uncompressed-public-key x y)]
|
(let [public-key (uncompressed-public-key x y)]
|
||||||
(cb public-key)))}))
|
(cb public-key)))
|
||||||
|
;;at some point infura started to return execution reverted error instead of "0x" result
|
||||||
|
;;our code expects "0x" result
|
||||||
|
:on-error #(cb "0x")}))
|
||||||
|
|
||||||
(defn get-addr
|
(defn get-addr
|
||||||
[registry ens-name cb]
|
[registry ens-name cb]
|
||||||
|
|
Loading…
Reference in New Issue