Skip to content

Commit 563777f

Browse files
committed
Change display of coin from 'dvpn' to 'p2p'
1 parent 3374422 commit 563777f

5 files changed

Lines changed: 50 additions & 41 deletions

File tree

src/cli/wallet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ def send_2plan_wallet(self, KEYNAME, plan_id, DENOM, amount_required, tax: bool=
406406
amount_required = int(amount_required) # Just in case was passed as str
407407

408408
# F***ck we have always a unit issue ...
409-
if DENOM == "dvpn":
410-
print(f"Denom is a dvpn, convert as udvpn, amount_required: {amount_required}dvpn")
409+
if DENOM == "p2p":
410+
print(f"Denom is a p2p, convert as udvpn, amount_required: {amount_required}p2p")
411411
DENOM = "udvpn"
412412
ubalance = balance.get("dvpn", 0) * IBCTokens.SATOSHI
413413
else:

src/kv/meile.kv

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,7 @@ WindowManager:
21162116
MDDropDownItem:
21172117
id: drop_item
21182118
pos_hint: {'center_x': .5, 'center_y': .5}
2119-
text: "dvpn"
2119+
text: "p2p"
21202120
on_release: root.menu.open()
21212121

21222122
MDLabel:
@@ -2175,7 +2175,7 @@ WindowManager:
21752175
font_size: sp(12)
21762176
TooltipMDIconButton:
21772177
icon: "help-circle"
2178-
tooltip_text: "Pay with Wallet in DVPN or IBC enabled coins"
2178+
tooltip_text: "Pay with Wallet in P2P or IBC enabled coins"
21792179

21802180
MDBoxLayout:
21812181
orientation: "horizontal"
@@ -2258,7 +2258,7 @@ WindowManager:
22582258
MDDropDownItem:
22592259
id: drop_item
22602260
pos_hint: {'center_x': .5, 'center_y': .5}
2261-
text: "dvpn"
2261+
text: "p2p"
22622262
on_release: root.menu.open()
22632263

22642264
MDLabel:
@@ -2450,7 +2450,7 @@ WindowManager:
24502450
text_color: get_color_from_hex(MeileColors.MEILE)
24512451
MDLabel:
24522452
font_name: "DejaVuSans"
2453-
text: "There are two primary ways to receive tokens to purchase dVPN (the currency) subscriptions and utilize the network. 1.) You get the DVPN token on a exchange and send it to your wallet address. Current exchanges are KuCoin, HotBit, Polarity and Osmosis. Once you purchase the tokens on the exchange, you need to withdraw them to your address listed in the wallet section of this app. The tokens should appear within minutes after a withdrawal and you can begin purchasing and subscribing to Sentinel dVPN nodes through Meile. 2.) You can purchase the currency used for Meile dVPN right in our app via the 'RE-FUEL' button within the wallet. These funds will be handled by our servers and the payment processing is handled by Stripe. Once you successfully complete a purchase, your funds should appear in your wallet within minutes of a successful purchase through our app. This is the easiest method to using Meile dVPN."
2453+
text: "There are two primary ways to receive coins to purchase P2P (the currency) subscriptions and utilize the network. 1.) You get the P2P coin on a exchange and send it to your wallet address. Current exchanges are KuCoin, HotBit, Polarity and Osmosis. Once you purchase the tokens on the exchange, you need to withdraw them to your address listed in the wallet section of this app. The tokens should appear within minutes after a withdrawal and you can begin purchasing and subscribing to Sentinel dVPN nodes through Meile. 2.) You can purchase the currency used for Meile dVPN right in our app via the 'RE-FUEL' button within the wallet. These funds will be handled by our servers and the payment processing is handled by Stripe. Once you successfully complete a purchase, your funds should appear in your wallet within minutes of a successful purchase through our app. This is the easiest method to using Meile dVPN."
24542454
size_hint_y: None
24552455
height: self.texture_size[1]
24562456
size_hint_x: 1
@@ -2593,7 +2593,7 @@ WindowManager:
25932593

25942594
MDLabel:
25952595
font_name: "DejaVuSans"
2596-
text: "Sentinel is a Layer-1 blockchain within the Cosmos ecosystem. It was founded in 2017, and provides privacy services, such as decentralized VPN to users both of traditional commerce and blockchain enthusiasts. It's native coin ticker is $DVPN. "
2596+
text: "Sentinel is a Layer-1 blockchain within the Cosmos ecosystem. It was founded in 2017, and provides privacy services, such as decentralized VPN to users both of traditional commerce and blockchain enthusiasts. It's native coin ticker is $P2P. "
25972597
size_hint_y: None
25982598
height: self.texture_size[1]
25992599
size_hint_x: 1
@@ -2722,7 +2722,7 @@ WindowManager:
27222722
id: token
27232723
pos_hint: {"x": .355, "center_y": .60}
27242724
text_color: get_color_from_hex(MeileColors.MEILE)
2725-
text: 'dvpn'
2725+
text: 'p2p'
27262726
on_release: root.menu_token.open()
27272727

27282728
MDDropDownItem:
@@ -2748,7 +2748,7 @@ WindowManager:
27482748

27492749
MDLabel:
27502750
id: dvpn_price
2751-
text: "DVPN: $" + str(root.get_token_price('dvpn'))
2751+
text: "P2P: $" + str(root.get_token_price('dvpn'))
27522752
theme_text_color: "Custom"
27532753
text_color: get_color_from_hex(MeileColors.MEILE)
27542754
pos_hint: {"x": .40, "center_y": .48}
@@ -2763,7 +2763,7 @@ WindowManager:
27632763
font_size: "16sp"
27642764
MDLabel:
27652765
id: coin_qty
2766-
text:"QTY: " + str(root.DVPNOptions[root.idvpn]) + " dvpn"
2766+
text:"QTY: " + str(root.DVPNOptions[root.idvpn]) + " p2p"
27672767
theme_text_color: "Custom"
27682768
text_color: get_color_from_hex(MeileColors.MEILE)
27692769
pos_hint: {"x": .40, "center_y": .38}

src/typedef/konstants.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,20 +555,24 @@ class IBCTokens():
555555
ZANO_WALLET = "ZxDEXCMwvpwirJujwjZExHfKFEqNjMWdjLw5MGYXa5KxScvcsr2BNGm8TFyk4mvFAhAPtWh54tadWNgS5CxPAqXX1fpoQLkJJ"
556556

557557
IBCCOINS = [{'uscrt' : IBCSCRT}, {'uatom' : IBCATOM}, {'uosmo' : IBCOSMO}, {'uknwn' :IBCUNKWN}, {'unam' : IBCNAM}]
558-
UNITTOKEN = {'uscrt' : 'scrt', 'uatom' : 'atom' , 'uosmo' : 'osmo', 'udvpn' : 'dvpn', 'unam' : 'nam', 'tsent' : 'tsent'}
558+
UNITTOKEN = {'uscrt' : 'scrt', 'uatom' : 'atom' , 'uosmo' : 'osmo', 'udvpn' : 'p2p', 'unam' : 'nam', 'tsent' : 'tsent'}
559559
IBCUNITTOKEN = {'uscrt' : IBCSCRT, 'uatom' : IBCATOM , 'uosmo' : IBCOSMO, 'unam' : IBCNAM, 'udvpn' : 'udvpn', 'tsent' : 'tsent'}
560560
mu_coins = ["udvpn", "uscrt", "uosmo", "uatom", "unam"]
561-
ibc_coins = ["dvpn", "scrt", "osmo", "atom", "nam"]
561+
ibc_coins = ["p2p", "scrt", "osmo", "atom", "nam"]
562+
COIN_DISPLAY = {'dvpn': 'P2P'}
562563
ibc_mu_coins = {"tsent" : "tsent",
563564
"dvpn" : "udvpn",
564565
"scrt" : "uscrt",
565566
"osmo" : "uosmo",
566567
"atom" : "uatom",
567-
"nam" : "unam"}
568+
"nam" : "unam",
569+
"p2p" : "udvpn"}
570+
568571
CSAPPMAP = {'atom' : 'cosmos',
569572
'scrt' : 'secret',
570573
'osmo' : 'osmosis',
571574
'dvpn' : 'sentinel',
575+
'p2p' : 'sentinel',
572576
'beam' : 'beam',
573577
'firo' : 'zcoin',
574578
'pivx' : 'pivx',
@@ -604,7 +608,7 @@ class IBCTokens():
604608
#mu_coins = ["tsent", "udvpn", "uscrt", "uosmo", "uatom", "udec"]
605609
class TextStrings():
606610
dash = "-"
607-
VERSION = "v2.5.4"
611+
VERSION = "v2.5.5"
608612
BUILD = "17748518213"
609613
RootTag = "SENTINEL"
610614
GITHUB_API_URL = "https://api.github.com/repos/MathNodes/meile-gui/releases/latest"

src/ui/screens.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
from helpers.v2ray import generate_v2ray_uri
2323
from helpers.update_checker import UpdateChecker, format_update_message
2424
from ui.update_dialog import UpdateDialog
25+
from coin_api.get_price import GetPriceAPI
2526

2627
from kivy.properties import BooleanProperty, StringProperty, ColorProperty,ObjectProperty, NumericProperty
2728
from kivy.uix.screenmanager import Screen, SlideTransition
28-
from kivymd.uix.button import MDFlatButton, MDRaisedButton,MDTextButton, MDFillRoundFlatButton
29+
from kivymd.uix.button import MDFlatButton, MDRaisedButton
2930
from kivymd.uix.dialog import MDDialog
3031
from kivy.clock import Clock, mainthread
3132
from kivyoav.delayed import delayable
@@ -36,18 +37,15 @@
3637
from kivymd.uix.behaviors import HoverBehavior
3738
#from kivymd.theming import ThemableBehavior
3839
from kivy.core.window import Window
39-
#from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
4040
from kivy_garden.mapview import MapMarkerPopup, MapView, MapSource
4141
from kivymd.toast import toast
4242
from kivy.uix.carousel import Carousel
4343
from kivymd.uix.boxlayout import MDBoxLayout
4444
from kivy.uix.floatlayout import FloatLayout
45-
from kivymd.uix.anchorlayout import MDAnchorLayout
4645
from kivymd.uix.label.label import MDLabel
4746
from kivy.animation import Animation
4847
from kivy.app import App
4948

50-
import requests
5149
from requests.auth import HTTPBasicAuth
5250
import sys
5351
import copy
@@ -58,7 +56,6 @@
5856
from shutil import rmtree
5957
from os import path,geteuid, chdir, remove
6058
from threading import Thread
61-
import threading
6259
from unidecode import unidecode
6360
from datetime import datetime, timedelta
6461
import json
@@ -1720,7 +1717,7 @@ def __init__(self, ADDRESS, **kwargs):
17201717
width_mult=3,
17211718
position="center",
17221719
max_height=max_height,
1723-
background_color=get_color_from_hex(MeileColors.BLACK))
1720+
md_bg_color=get_color_from_hex(MeileColors.BLACK))
17241721
Clock.schedule_once(self.build)
17251722

17261723
def build(self, dt):
@@ -1894,11 +1891,11 @@ def SetBalances(self, CoinDict):
18941891
self.scrt_text = str(CoinDict['scrt']) + " scrt"
18951892
self.atom_text = str(CoinDict['atom']) + " atom"
18961893
self.osmo_text = str(CoinDict['osmo']) + " osmo"
1897-
self.dvpn_text = str(CoinDict['dvpn']) + " dvpn"
1894+
self.dvpn_text = str(CoinDict['dvpn']) + " p2p"
18981895
self.nam_text = str(CoinDict['nam']) + " nam"
18991896
#self.dvpn_text = str(CoinDict['tsent']) + " tsent"
19001897
data = [
1901-
{ "logo" : self.return_coin_logo("dvpn"), "text" : self.dvpn_text },
1898+
{ "logo" : self.return_coin_logo("p2p"), "text" : self.dvpn_text },
19021899
{ "logo" : self.return_coin_logo("scrt"), "text" : self.scrt_text },
19031900
{ "logo" : self.return_coin_logo("atom"), "text" : self.atom_text },
19041901
{ "logo" : self.return_coin_logo("osmo"), "text" : self.osmo_text },
@@ -1912,7 +1909,7 @@ def SetBalances(self, CoinDict):
19121909
self.scrt_text = str("0.0") + " scrt"
19131910
self.atom_text = str("0.0") + " atom"
19141911
self.osmo_text = str("0.0") + " osmo"
1915-
self.dvpn_text = str("0.0") + " dvpn"
1912+
self.dvpn_text = str("0.0") + " p2p"
19161913
self.nam_text = str("0.0") + " nam"
19171914
#self.dvpn_text = str("0.0") + " tsent"
19181915

@@ -1945,7 +1942,7 @@ def set_previous_screen(self):
19451942
Meile.app.root.transistion = SlideTransition(direction="down")
19461943
Meile.app.root.current = WindowNames.MAIN_WINDOW
19471944

1948-
1945+
# deprecated
19491946
class SubscriptionScreen(MDBoxLayout):
19501947

19511948
def __init__(self, node_tree, **kwargs):
@@ -2293,11 +2290,13 @@ def build(self):
22932290
for pd in plan_data:
22942291
req3 = http.get(HTTParams.PLAN_API + HTTParams.API_PLANS_NODES % pd['uuid'], auth=HTTPBasicAuth(scrtsxx.PLANUSERNAME, scrtsxx.PLANPASSWORD))
22952292
plan_nodes = req3.json() if req3.ok and req3.status_code != 404 else []
2296-
no_of_nodes = len(plan_nodes)
2293+
no_of_nodes = 0
22972294
countries = []
22982295
no_of_countries = 0
22992296
for node in plan_nodes:
23002297
node_data = self.mw.NodeTree.NodeTree.get_node(node)
2298+
if node_data:
2299+
no_of_nodes += 1
23012300
try:
23022301
if node_data.data['Country'] in countries:
23032302
continue
@@ -2311,9 +2310,10 @@ def build(self):
23112310
self.PlanData.append(pd)
23122311
self.TotalCountries.append(no_of_countries)
23132312
self.TotalNodes.append(no_of_nodes)
2314-
#self.build_plans( pd, user_enrolled_plans, no_of_nodes, no_of_countries)
2315-
2316-
#self.finish_loading()
2313+
2314+
price_api = GetPriceAPI()
2315+
self.p2p_price = price_api.get_usd("p2p")['price']
2316+
23172317
Clock.schedule_once(self.finished)
23182318

23192319
def build_plans(self, data, plans, no_of_nodes, no_of_countries):
@@ -2326,12 +2326,15 @@ def build_plans(self, data, plans, no_of_nodes, no_of_countries):
23262326

23272327
# In the future cost should be both in dvpn and euro (fuck usd)
23282328
# Can use coin_api to get dvpn price and translate cost
2329+
2330+
plancost = int(data['plan_price'] / IBCTokens.SATOSHI)
2331+
plancost_usd = round(float(plancost * self.p2p_price),2)
23292332
item = PlanAccordion(
23302333
node=PlanRow(
23312334
plan_name=data['plan_name'],
23322335
num_of_nodes=str(no_of_nodes),
23332336
num_of_countries=str(no_of_countries),
2334-
cost=str(round(float(data['plan_price'] / IBCTokens.SATOSHI),2)) + data['plan_denom'],
2337+
cost=str(plancost) + data['plan_denom'] + f"[color=fcb711] ${plancost_usd}[/color]",
23352338
logo_image=data['logo'],
23362339
uuid=data['uuid'],
23372340
id=str(plan['subscription_id']) if plan else str(0),

src/ui/widgets.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def return_sub_type(self):
418418
except AttributeError:
419419
return " GB"
420420

421-
def refresh_price_async(self, mu_coin="dvpn", cache=30, callback=None):
421+
def refresh_price_async(self, mu_coin="p2p", cache=30, callback=None):
422422
def fetch_price():
423423
try:
424424
if mu_coin not in self.price_cache or time.time() - self.price_cache[mu_coin]["time"] > cache:
@@ -483,7 +483,7 @@ def __init__ (self, price, white_label, nnodes, logo_image):
483483
self.price_cache = {}
484484

485485
self.price_text = price
486-
self.parse_coin_deposit("dvpn")
486+
self.parse_coin_deposit("p2p")
487487

488488
self.white_label = white_label
489489
self.nnodes = str(nnodes)
@@ -561,7 +561,7 @@ def on_checkbox_active(self, pay_with: str, checkbox, value):
561561
self.set_item("arrr")
562562

563563
else:
564-
self.ids.drop_item.text = "dvpn"
564+
self.ids.drop_item.text = "p2p"
565565
menu_items = [
566566
{
567567
"viewclass": "IconListItem",
@@ -595,27 +595,28 @@ def parse_coin_deposit(self, mu_coin, callback=None):
595595
self.deposit_callback = callback
596596

597597
def after_dvpn_fetched(dt):
598-
if mu_coin != "dvpn":
598+
if mu_coin != "p2p":
599599
self.refresh_price_async(mu_coin, cache=30, callback=self.after_both_prices_fetched)
600600
else:
601601
self.after_both_prices_fetched(None)
602602

603-
self.refresh_price_async("dvpn", cache=30, callback=after_dvpn_fetched)
603+
self.refresh_price_async("p2p", cache=30, callback=after_dvpn_fetched)
604604

605605

606606

607607
def after_both_prices_fetched(self, dt):
608608
mu_coin = self.selected_mu_coin
609609
price_text = self.price_text_copy
610610
month = int(self.ids.slider1.value)
611+
price = price_text.split("p2p")[0]
611612

612613
try:
613-
if mu_coin == "dvpn":
614-
value = float(price_text.rstrip(mu_coin).strip())
614+
if mu_coin == "p2p":
615+
value = float(price.strip())
615616
else:
616617
value = round(
617-
float(price_text.rstrip("dvpn").strip()) *
618-
self.price_cache["dvpn"]["price"] /
618+
float(price.strip()) *
619+
self.price_cache["p2p"]["price"] /
619620
self.price_cache[mu_coin]["price"], 8
620621
)
621622

@@ -631,7 +632,7 @@ def after_both_prices_fetched(self, dt):
631632
if self.deposit_callback:
632633
self.deposit_callback("Error")
633634

634-
def refresh_price_async(self, mu_coin="dvpn", cache=30, callback=None):
635+
def refresh_price_async(self, mu_coin="p2p", cache=30, callback=None):
635636
def fetch_price():
636637
if mu_coin not in self.price_cache or time.time() - self.price_cache[mu_coin]["time"] > cache:
637638
try:
@@ -720,7 +721,7 @@ def on_leave(self, *args):
720721
self.md_bg_color = get_color_from_hex("#fcb711")
721722
Window.set_system_cursor('arrow')
722723

723-
724+
# deprecated
724725
class NodeRow(MDGridLayout):
725726
moniker = StringProperty()
726727
location = StringProperty()
@@ -731,7 +732,8 @@ class NodeRow(MDGridLayout):
731732
def get_font(self):
732733
Config = MeileGuiConfig()
733734
return Config.resource_path(MeileColors.FONT_FACE)
734-
735+
736+
# deprecated
735737
class NodeDetails(MDGridLayout):
736738
sub_id = StringProperty()
737739
allocated = StringProperty()

0 commit comments

Comments
 (0)