diff --git a/src/status_im/browser/core.cljs b/src/status_im/browser/core.cljs index 0a541d289c..46e9fa3efc 100644 --- a/src/status_im/browser/core.cljs +++ b/src/status_im/browser/core.cljs @@ -81,11 +81,9 @@ (re-frame/dispatch [:browser.callback/resolve-ens-contenthash])))) (defn resolve-ens-contenthash-callback [hex] - (let [proto-code (subs hex 2 4) + (let [proto-code (when hex (subs hex 2 4)) hash (when hex (multihash/base58 (multihash/create :sha2-256 (subs hex 12))))] - ;; We only support IPFS and SWARM - ;; TODO Once more implementations / providers are published this will have to be improved - (if (and ((#{constants/swarm-proto-code constants/ipfs-proto-code} proto-code) hash (not= hash resolver/default-hash))) + (if (and proto-code (#{constants/swarm-proto-code constants/ipfs-proto-code} proto-code) hash (not= hash resolver/default-hash)) (re-frame/dispatch [:browser.callback/resolve-ens-multihash-success proto-code hash]) (re-frame/dispatch [:browser.callback/resolve-ens-multihash-error])))) diff --git a/src/status_im/utils/ethereum/stickers.cljs b/src/status_im/utils/ethereum/stickers.cljs index a7b11f228a..4a42fcb920 100644 --- a/src/status_im/utils/ethereum/stickers.cljs +++ b/src/status_im/utils/ethereum/stickers.cljs @@ -18,14 +18,14 @@ (ethereum/call web3 (ethereum/call-params contract "getPackData(uint256)" (ethereum/int->hex pack-id)) (fn [_ data] - (cb (abi-spec/decode (subs data 2) ["bytes4[]" "address" "bool" "uint256" "uint256" "bytes"]))))) + (cb (when data (abi-spec/decode (subs data 2) ["bytes4[]" "address" "bool" "uint256" "uint256" "bytes"])))))) (defn owned-tokens [web3 contract address cb] "Returns vector of owned tokens ids in the contract by address" (ethereum/call web3 (ethereum/call-params contract "tokensOwnedBy(address)" (ethereum/normalized-address address)) (fn [_ data] - (cb (first (abi-spec/decode (subs data 2) ["uint256[]"])))))) + (cb (when data (first (abi-spec/decode (subs data 2) ["uint256[]"]))))))) (defn token-pack-id [web3 contract token cb] "Returns pack id in the contract by token id"