[ISSUE #3429] Use proper etherscan URLs

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Julien Eluard 2018-02-26 19:05:55 +01:00
parent 50ac9125fe
commit 3510f79e89
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
1 changed files with 14 additions and 9 deletions

View File

@ -1,22 +1,27 @@
(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")))