Skip to content

Commit

Permalink
Merge pull request #152 from BTCP-community/fix/explorer_url
Browse files Browse the repository at this point in the history
Fix explorers, add coinmarketcap, readme instructions
  • Loading branch information
ch4ot1c authored Mar 1, 2018
2 parents 24ba1ce + 24809dc commit ee2020e
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 41 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ Using Homebrew::
# Build .app, .dmg
./create-dmg

# Run

# Run the .app in dist/, or
./electrum-zcl

For Linux:
----------

Install Dependencies::

sudo apt-get install $(grep -vE "^\s*#" packages.txt | tr "\n" " ") python-pip
sudo apt-get install python-pip pyqt5-dev-tools $(grep -vE "^\s*#" packages.txt | tr "\n" " ")

pip3 install -r requirements.txt

Expand Down
4 changes: 2 additions & 2 deletions config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"server": "35.224.186.7:50001:t"
}
"server": "35.224.186.7:50001:t"
}
2 changes: 2 additions & 0 deletions create-dmg.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

sudo sh ./clean.sh

VERSION=$(python3 -c "from lib import version; print(version.ELECTRUM_VERSION)")
VERSION=${VERSION//ELECTRUM_VERSION=/}
echo "Creating package $VERSION"
Expand Down
2 changes: 1 addition & 1 deletion lib/currencies.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"CryptoCompare": [
"CoinMarketCap": [
"USD",
"EUR",
"CNY"
Expand Down
9 changes: 7 additions & 2 deletions lib/exchange_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ def get_rates(self, ccy):
"/data/pricehistorical?fsym=ZCL&tsyms=USD")
return {'USD': Decimal(json['ZCL']['USD'])}

class CoinMarketCap(ExchangeBase):
def get_rates(self, ccy):
json = self.get_json('api.coinmarketcap.com',
"/v1/ticker/zclassic?convert=%s")
return {'USD': Decimal(json[0]['price_usd'])}


def dictinvert(d):
Expand Down Expand Up @@ -199,7 +204,7 @@ def get_currency(self):
return self.config.get('currency', 'USD')

def config_exchange(self):
return self.config.get('use_exchange', 'CryptoCompare')
return self.config.get('use_exchange', 'CoinMarketCap')

def show_history(self):
return self.is_enabled() and self.get_history_config() and self.ccy in self.exchange.history_ccys()
Expand All @@ -211,7 +216,7 @@ def set_currency(self, ccy):
self.on_quotes()

def set_exchange(self, name):
class_ = globals().get(name, CryptoCompare)
class_ = globals().get(name, CoinMarketCap)
self.print_error("using exchange", name)
if self.config_exchange() != name:
self.config.set_key('use_exchange', name, True)
Expand Down
51 changes: 29 additions & 22 deletions lib/paymentrequest_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,19 +432,16 @@ def time_difference(distance_in_time, include_seconds):

# For raw json, append /insight-api-zcash
mainnet_block_explorers = {
'Zcl-explorer.com': ('http://zcl-explorer.com/insight/',
'zcl-explorer.com': ('https://zcl-explorer.com',
{'tx': 'tx', 'addr': 'address'}),
'zclzclzcl.com': ('http://zclzclzcl.com',
'eu1.zcl-explorer.com': ('https://eu1.zcl-explorer.com',
{'tx': 'tx', 'addr': 'address'}),
'Zcl-explorer.com - Alternate 1': ('http://as1.zcl-explorer.com',
'as1.zcl-explorer.com': ('https://as1.zcl-explorer.com',
{'tx': 'tx', 'addr': 'address'}),
'Zcl-explorer.com - Alternate 2': ('http://eu1.zcl-explorer.com',
'explorer.zclassic.org': ('https://explorer.zclassic.org',
{'tx': 'tx', 'addr': 'address'}),
'explorer.zclassic.org': ('http://explorer.zclassic.org',
'zclzclzcl.com': ('https://zclzclzcl.com',
{'tx': 'tx', 'addr': 'address'}),
'explorer1.zclassic.org': ('http://explorer1.zclassic.org',
{'tx': 'tx', 'addr': 'address'})

}

#http://zcl-explorer.com/insight/
Expand All @@ -454,9 +451,8 @@ def time_difference(distance_in_time, include_seconds):
#http://explorer.zclassic.org
#http://explorer1.zclassic.org

# TODO zcl testnet block explorer
testnet_block_explorers = {
#'Blocktrail.com': ('https://www.blocktrail.com/tBTC',
#'testnet.zclassic.org': ('https://testnet.zclassic.org',
#{'tx': 'tx', 'addr': 'address'}),
'system default': ('blockchain:',
{'tx': 'tx', 'addr': 'address'})
Expand All @@ -467,7 +463,7 @@ def block_explorer_info():
return testnet_block_explorers if bitcoin.NetworkConstants.TESTNET else mainnet_block_explorers

def block_explorer(config):
return config.get('block_explorer', 'Zcl-explorer.com')
return config.get('block_explorer', 'zcl-explorer.com')

def block_explorer_tuple(config):
return block_explorer_info().get(block_explorer(config))
Expand Down

0 comments on commit ee2020e

Please sign in to comment.