Updated to the new etherscan API URL scheme.
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
65a2f440c6
commit
6098da936a
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
(defn get-network-subdomain [network]
|
(defn get-network-subdomain [network]
|
||||||
(case network
|
(case network
|
||||||
("testnet" "testnet_rpc") "ropsten"
|
("testnet" "testnet_rpc") "api-ropsten"
|
||||||
("mainnet" "mainnet_rpc") "api"
|
("mainnet" "mainnet_rpc") "api"
|
||||||
("rinkeby" "rinkeby_rpc") "rinkeby"))
|
("rinkeby" "rinkeby_rpc") "api-rinkeby"))
|
||||||
|
|
||||||
(defn get-transaction-details-url [network hash]
|
(defn get-transaction-details-url [network hash]
|
||||||
(let [network-subdomain (get-network-subdomain network)]
|
(let [network-subdomain (get-network-subdomain network)]
|
||||||
|
|
|
@ -5,17 +5,17 @@ from tests import info
|
||||||
|
|
||||||
|
|
||||||
def get_transactions(address: str) -> dict:
|
def get_transactions(address: str) -> dict:
|
||||||
url = 'http://ropsten.etherscan.io/api?module=account&action=txlist&address=0x%s&sort=desc' % address
|
url = 'http://api-ropsten.etherscan.io/api?module=account&action=txlist&address=0x%s&sort=desc' % address
|
||||||
return requests.request('GET', url=url).json()['result']
|
return requests.request('GET', url=url).json()['result']
|
||||||
|
|
||||||
|
|
||||||
def is_transaction_successful(transaction_hash: str) -> int:
|
def is_transaction_successful(transaction_hash: str) -> int:
|
||||||
url = "https://ropsten.etherscan.io/api?module=transaction&action=getstatus&txhash=%s" % transaction_hash
|
url = "https://api-ropsten.etherscan.io/api?module=transaction&action=getstatus&txhash=%s" % transaction_hash
|
||||||
return not int(requests.request('GET', url=url).json()['result']['isError'])
|
return not int(requests.request('GET', url=url).json()['result']['isError'])
|
||||||
|
|
||||||
|
|
||||||
def get_balance(address):
|
def get_balance(address):
|
||||||
url = 'http://ropsten.etherscan.io/api?module=account&action=balance&address=0x%s&tag=latest' % address
|
url = 'http://api-ropsten.etherscan.io/api?module=account&action=balance&address=0x%s&tag=latest' % address
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
try:
|
try:
|
||||||
return int(requests.request('GET', url).json()["result"])
|
return int(requests.request('GET', url).json()["result"])
|
||||||
|
|
Loading…
Reference in New Issue