|
| 1 | +@page "/account-meta" |
| 2 | +@using XUMM.NET.SDK.Clients.Interfaces |
| 3 | +@using XUMM.NET.SDK.Extensions |
| 4 | +@using XUMM.NET.SDK.Models.Misc |
| 5 | +@using XUMM.NET.ServerApp.Extensions |
| 6 | + |
| 7 | +@inject IOptions<XrplConfig> Config |
| 8 | +@inject IXummMiscClient _miscClient |
| 9 | + |
| 10 | +<PageTitle>Account Meta</PageTitle> |
| 11 | + |
| 12 | +<ResponseAlertBox @ref="_responseAlertBox"></ResponseAlertBox> |
| 13 | + |
| 14 | +<h1>Account Meta</h1> |
| 15 | + |
| 16 | +<div class="row align-items-start"> |
| 17 | + <div class="col-md-6"> |
| 18 | + <div class="row"> |
| 19 | + <div class="mb-3"> |
| 20 | + <label for="account" class="form-label">Account</label> |
| 21 | + <input id="account" type="text" class="form-control" placeholder="Account address, eg. @Config.Value.Account" aria-label="Account" aria-describedby="basic-addon2" @bind="_account"> |
| 22 | + </div> |
| 23 | + <div class="btn-group mb-3" role="group"> |
| 24 | + <button class="btn btn-primary" type="button" @onclick="GetAccountMetaAsync">Fetch Account Meta</button> |
| 25 | + </div> |
| 26 | + </div> |
| 27 | + |
| 28 | + @if (_accountMeta != null) |
| 29 | + { |
| 30 | + <div class="row"> |
| 31 | + <div class="mb-3"> |
| 32 | + <h2>Account Meta</h2> |
| 33 | + <dl class="row"> |
| 34 | + <dt class="col-6">Account</dt> |
| 35 | + <dd class="col-6 text-break">@_accountMeta.Account</dd> |
| 36 | + <dt class="col-6">KYC Approved</dt> |
| 37 | + <dd class="col-6 text-break">@(_accountMeta.KycApproved ? "Yes" : "No")</dd> |
| 38 | + <dt class="col-6">XUMM Pro</dt> |
| 39 | + <dd class="col-6 text-break">@(_accountMeta.XummPro ? "Yes" : "No")</dd> |
| 40 | + </dl> |
| 41 | + |
| 42 | + @if (_accountMeta.XummProfile != null) |
| 43 | + { |
| 44 | + <h2>XUMM Profile</h2> |
| 45 | + <dl class="row"> |
| 46 | + <dt class="col-6">Account Alias</dt> |
| 47 | + <dd class="col-6 text-break">@_accountMeta.XummProfile.AccountAlias</dd> |
| 48 | + <dt class="col-6">Owner Alias</dt> |
| 49 | + <dd class="col-6 text-break">@_accountMeta.XummProfile.OwnerAlias</dd> |
| 50 | + </dl> |
| 51 | + } |
| 52 | + |
| 53 | + @if (_accountMeta.GlobaliD?.ProfileUrl != null && _accountMeta.GlobaliD?.Linked != null) |
| 54 | + { |
| 55 | + <h2>GlobaliD</h2> |
| 56 | + <dl class="row"> |
| 57 | + <dt class="col-6">Profile URL</dt> |
| 58 | + <dd class="col-6 text-break"><a href="@_accountMeta.GlobaliD.ProfileUrl" target="_blank">@_accountMeta.GlobaliD.ProfileUrl</a></dd> |
| 59 | + <dt class="col-6">Linked</dt> |
| 60 | + <dd class="col-6 text-break">@_accountMeta.GlobaliD.Linked</dd> |
| 61 | + </dl> |
| 62 | + } |
| 63 | + |
| 64 | + @if (_accountMeta.ThirdPartyProfiles.Any()) |
| 65 | + { |
| 66 | + <h2>Third Party Profiles</h2> |
| 67 | + <table class="table"> |
| 68 | + <thead> |
| 69 | + <tr> |
| 70 | + <th scope="col">Source</th> |
| 71 | + <th scope="col">Account Alias</th> |
| 72 | + </tr> |
| 73 | + </thead> |
| 74 | + <tbody> |
| 75 | + @foreach (var thirdPartyProfile in _accountMeta.ThirdPartyProfiles.OrderBy(x => x.Source)) |
| 76 | + { |
| 77 | + <tr> |
| 78 | + <th scope="row">@thirdPartyProfile.Source</th> |
| 79 | + <td>@thirdPartyProfile.AccountAlias</td> |
| 80 | + </tr> |
| 81 | + } |
| 82 | + </tbody> |
| 83 | + </table> |
| 84 | + } |
| 85 | + </div> |
| 86 | + </div> |
| 87 | + } |
| 88 | + </div> |
| 89 | + <div class="col-md-6 text-center"> |
| 90 | + @if (_accountMeta?.Avatar != null) |
| 91 | + { |
| 92 | + <div class="input-group mb-3"> |
| 93 | + <figure class="figure"> |
| 94 | + <img src="@_accountMeta.Avatar" class="figure-img img-fluid rounded" alt="Avatar of account @_account"> |
| 95 | + <figcaption class="figure-caption text-break">@_accountMeta.Avatar</figcaption> |
| 96 | + </figure> |
| 97 | + </div> |
| 98 | + } |
| 99 | + </div> |
| 100 | +</div> |
| 101 | +@code { |
| 102 | + private ResponseAlertBox _responseAlertBox = default!; |
| 103 | + private string _account = default!; |
| 104 | + private XummAccountMetaResponse? _accountMeta; |
| 105 | + |
| 106 | + private async Task GetAccountMetaAsync() |
| 107 | + { |
| 108 | + if (!_account.IsAccountAddress()) |
| 109 | + { |
| 110 | + _account = Config.Value.Account; |
| 111 | + } |
| 112 | + |
| 113 | + _accountMeta = await _responseAlertBox.GetResponseAndSetAlertAsync(() => _miscClient.AccountMetaAsync(_account)); |
| 114 | + _responseAlertBox.SetAlert("Account Meta", _accountMeta != null); |
| 115 | + } |
| 116 | +} |
0 commit comments