Rimmon 3 anni fa
parent
commit
288834e59f
1 ha cambiato i file con 61 aggiunte e 53 eliminazioni
  1. 61 53
      Pages/ModalAssets.razor

+ 61 - 53
Pages/ModalAssets.razor

@@ -7,10 +7,10 @@
                     <p>Цифровые активы</p>
                 </div>
                 @*<div class="modal__body__header__href">
-                    <a href="">Balans</a>
-                    <a href="">Swap</a>
-                    <a href="">Liquidity</a>
-                </div>*@
+                        <a href="">Balans</a>
+                        <a href="">Swap</a>
+                        <a href="">Liquidity</a>
+                    </div>*@
             </div>
             <div class="modal__body__container">
                 <div class="modal__body__container__left">
@@ -40,8 +40,8 @@
                         </div>
                         <div class="modal__body__calc__balance__numbers__value">
                             <div class="modal__body__calc__balance__numbers__value__item">
-                                <p>100.890110</p>
-                                <p>ETH</p>
+                                <p>@tokenBalance</p>
+                                <p>@ethBalance</p>
 
                             </div>
                             <div class="modal__body__calc__balance__numbers__value__item">
@@ -51,64 +51,72 @@
                         </div>
                     </div>
                     @*<div class="modal__body__calc__balance__button">
-                        <button class="btn_orange btn_center">Пополнение</button>
-                        <button class="btn_orange btn_center">Вывод</button>
-                    </div>*@
+                            <button class="btn_orange btn_center">Пополнение</button>
+                            <button class="btn_orange btn_center">Вывод</button>
+                        </div>*@
                 </div>
                 @*<div class="modal__body__container__right">
-                    <p class="modal__body__calc__change__header">Обмен</p>
-                    <p class="modal__body__calc__change__desc">Trade tokens in an istant</p>
-                    <div class="modal__input__box" place="From" balanc='0.00000410' currency='ETH'>
-                        <input type="text" class="modal__input">
-                        <select type="select" class="modal__select">
-                            <option>ETH</option>
-                            <option>2DH</option>
-                        </select>
-                    </div>
-                    <div class="modal__input__box" place="To" balanc='0.00000410' currency='2DH'>
-                        <input type="text" class="modal__input">
-                        <select type="select" class="modal__select">
-                            <option>2DH</option>
-                            <option>ETH</option>
-                        </select>
-                    </div>
-                    <div class="modal__input__total">
-                        <p>Price</p>
-                        <div class="modal_input_total_value">
-                            <p>1.000000050</p>
-                            <p>2DH</p>
+                        <p class="modal__body__calc__change__header">Обмен</p>
+                        <p class="modal__body__calc__change__desc">Trade tokens in an istant</p>
+                        <div class="modal__input__box" place="From" balanc='0.00000410' currency='ETH'>
+                            <input type="text" class="modal__input">
+                            <select type="select" class="modal__select">
+                                <option>ETH</option>
+                                <option>2DH</option>
+                            </select>
                         </div>
-                    </div>
-                    <div class="modal__input__button">
-                        <button class="btn_orange btn_center">ОК</button>
-                    </div>
-                </div>*@
+                        <div class="modal__input__box" place="To" balanc='0.00000410' currency='2DH'>
+                            <input type="text" class="modal__input">
+                            <select type="select" class="modal__select">
+                                <option>2DH</option>
+                                <option>ETH</option>
+                            </select>
+                        </div>
+                        <div class="modal__input__total">
+                            <p>Price</p>
+                            <div class="modal_input_total_value">
+                                <p>1.000000050</p>
+                                <p>2DH</p>
+                            </div>
+                        </div>
+                        <div class="modal__input__button">
+                            <button class="btn_orange btn_center">ОК</button>
+                        </div>
+                    </div>*@
             </div>
         </div>
         <a class="modal_close" style="cursor:pointer" @onclick="@Close">&#10006;</a>
     </div>
 </div>
 
-@code {
-    [Inject]
-    public IJSRuntime JsRuntime { get; set; }
-
-    [Parameter]
-    public RenderFragment Title { get; set; }
-
-    string elementid = "modal_assets";
-
+@code {[Inject]
+    public IJSRuntime JsRuntime { get; set; }
+
+    [Parameter]
+    public RenderFragment Title { get; set; }
+    string ethBalance;
+    string tokenBalance;
+
+    string elementid = "modal_assets";
+
     Models.AccountModel _account;
 
+        @using Models;Blockchain bcMain;
+
+        public async Task Balances()
+        {
+            ethBalance = await _account.GetBalance();
+            tokenBalance = await bcMain.BalanceOf("0xe5D682717955d6C35d465A3485625C64655a04f4", _account.GetActualAddress(bcMain));
+        }
 
-    public void Open(Models.AccountModel account)
-    {
-        _account = account;
-        JsRuntime.InvokeVoidAsync("OpenModal", elementid);
-    }
+        public void Open(Models.AccountModel account)
+        {
+            _account = account;
+            JsRuntime.InvokeVoidAsync("OpenModal", elementid);
+        }
 
-    public void Close()
-    {
-        JsRuntime.InvokeVoidAsync("CloseModal", elementid);
-    }
+        public void Close()
+        {
+            JsRuntime.InvokeVoidAsync("CloseModal", elementid);
+        }
 }