[ISSUE #3429] Use proper etherscan URLs
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
50ac9125fe
commit
3510f79e89
|
@ -1,27 +1,32 @@
|
|||
(ns status-im.utils.transactions
|
||||
(:require [status-im.utils.utils :as utils]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.money :as money]))
|
||||
[status-im.utils.types :as types]))
|
||||
|
||||
(defn- get-network-subdomain [network]
|
||||
(case network
|
||||
("testnet" "testnet_rpc") "ropsten"
|
||||
("mainnet" "mainnet_rpc") nil
|
||||
("rinkeby" "rinkeby_rpc") "rinkeby"))
|
||||
|
||||
(defn get-transaction-details-url [network hash]
|
||||
(let [network-subdomain (get-network-subdomain network)]
|
||||
(str "https://" (when network-subdomain (str network-subdomain ".")) "etherscan.io/tx/" hash)))
|
||||
|
||||
(def etherscan-api-key "DMSI4UAAKUBVGCDMVP3H2STAMSAUV7BYFI")
|
||||
|
||||
(defn get-network-subdomain [network]
|
||||
(defn- get-api-network-subdomain [network]
|
||||
(case network
|
||||
("testnet" "testnet_rpc") "api-ropsten"
|
||||
("mainnet" "mainnet_rpc") "api"
|
||||
("rinkeby" "rinkeby_rpc") "api-rinkeby"))
|
||||
|
||||
(defn get-transaction-details-url [network hash]
|
||||
(let [network-subdomain (get-network-subdomain network)]
|
||||
(str "https://" network-subdomain ".etherscan.io/tx/" hash)))
|
||||
|
||||
(defn get-transaction-url [network account]
|
||||
(let [network-subdomain (get-network-subdomain network)]
|
||||
(let [network-subdomain (get-api-network-subdomain network)]
|
||||
(str "https://" network-subdomain ".etherscan.io/api?module=account&action=txlist&address=0x"
|
||||
account "&startblock=0&endblock=99999999&sort=desc&apikey=" etherscan-api-key "?q=json")))
|
||||
|
||||
(defn- format-transaction [account {:keys [value timeStamp blockNumber hash from to gas gasPrice gasUsed nonce confirmations input]}]
|
||||
(let [inbound? (= (str "0x" account) to)]
|
||||
(let [inbound? (= (str "0x" account) to)]
|
||||
{:value value
|
||||
;; timestamp is in seconds, we convert it in ms
|
||||
:timestamp (str timeStamp "000")
|
||||
|
|
Loading…
Reference in New Issue