[#7188] undefined is not an object (evaluating 'e.substring') when dapps / stickers offline
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
c61ce1892f
commit
d0de1c5c24
|
@ -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]))))
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue