Skip to content

Commit

Permalink
Merge pull request #21 from alias-bitsignal/master
Browse files Browse the repository at this point in the history
api & release update
  • Loading branch information
alias-bitsignal authored Dec 18, 2024
2 parents 3634249 + 75b9ccd commit 2243dd4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified wallet/.DS_Store
Binary file not shown.
Binary file added wallet/crystals/.DS_Store
Binary file not shown.
19 changes: 14 additions & 5 deletions wallet/crystals/060_ethbridge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from modules.helpers import base_path
from hashlib import sha256
from decimal import Decimal, getcontext, ROUND_HALF_EVEN
import aiohttp
import ssl
import certifi

DEFAULT_THEME_PATH = path.join(base_path(), "crystals/060_ethbridge/themes/default")

Expand Down Expand Up @@ -46,6 +49,11 @@ def f8_to_int(a_str: str):
# Helper function to convert a legacy string 0.8f to compact int format
return int(Decimal(a_str) * DECIMAL_1E8)

async def fetch_json(url):
ssl_context = ssl.create_default_context(cafile=certifi.where())
async with aiohttp.ClientSession() as session:
async with session.get(url, ssl=ssl_context) as response:
return await response.json()

class EthbridgeHandler(CrystalHandler):

Expand Down Expand Up @@ -75,11 +83,12 @@ async def about(self, params=None):
self.bismuth_vars['extra']["footer"] += f'<script src= "/crystal/ethbridge/static/about.js"></script>\n'
self.bismuth_vars['extra']["circulating"] = "N/A"
try:
res = await async_get_with_http_fallback("https://hypernodes.bismuth.live/api/coinsupply.php")
# print(res)
self.bismuth_vars['extra']["circulating"] = res["circulating"]
except:
pass
url = "https://bismuth.im/api/info/coinsupply"
res = await fetch_json(url)
if res:
self.bismuth_vars['extra']["circulating"] = res.get("circulating", "N/A")
except Exception as e:
print(f"Error in about method: {e}")
self.render("about.html", bismuth=self.bismuth_vars)

async def message_popup(self, params=None):
Expand Down
21 changes: 15 additions & 6 deletions wallet/crystals/061_bscbridge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from modules.helpers import base_path
from hashlib import sha256
from decimal import Decimal, getcontext, ROUND_HALF_EVEN
import aiohttp
import ssl
import certifi

DEFAULT_THEME_PATH = path.join(base_path(), "crystals/061_bscbridge/themes/default")

Expand Down Expand Up @@ -45,6 +48,11 @@ def f8_to_int(a_str: str):
# Helper function to convert a legacy string 0.8f to compact int format
return int(Decimal(a_str) * DECIMAL_1E8)

async def fetch_json(url):
ssl_context = ssl.create_default_context(cafile=certifi.where())
async with aiohttp.ClientSession() as session:
async with session.get(url, ssl=ssl_context) as response:
return await response.json()

class BscbridgeHandler(CrystalHandler):

Expand All @@ -69,16 +77,17 @@ def initialize(self):
@staticmethod
def sha256(txid: str):
return sha256(txid.encode('utf-8')).hexdigest()

async def about(self, params=None):
self.bismuth_vars['extra']["footer"] += f'<script src= "/crystal/bscbridge/static/about.js"></script>\n'
self.bismuth_vars['extra']["circulating"] = "N/A"
try:
res = await async_get_with_http_fallback("https://hypernodes.bismuth.live/api/coinsupply.php")
# print(res)
self.bismuth_vars['extra']["circulating"] = res["circulating"]
except:
pass
url = "https://bismuth.im/api/info/coinsupply"
res = await fetch_json(url)
if res:
self.bismuth_vars['extra']["circulating"] = res.get("circulating", "N/A")
except Exception as e:
print(f"Error in about method: {e}")
self.render("about.html", bismuth=self.bismuth_vars)

async def message_popup(self, params=None):
Expand Down
2 changes: 1 addition & 1 deletion wallet/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from modules.crystals import CrystalManager
from modules import i18n # helps pyinstaller, do not remove

__version__ = "0.1.45"
__version__ = "0.1.46"

define("port", default=8888, help="run on the given port", type=int)
define(
Expand Down

0 comments on commit 2243dd4

Please sign in to comment.