Skip to content

Commit dc203b8

Browse files
Set rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q as example account (#19)
1 parent 22430e6 commit dc203b8

File tree

15 files changed

+54
-33
lines changed

15 files changed

+54
-33
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ XUMM when the session KYC was initiated by.
9696

9797
```C#
9898
@inject IXummMiscClient _miscClient
99-
var kycStatus = await _miscClient.GetKycStatusAsync("00000000-0000-0000-0000-000000000000");
99+
var kycStatus = await _miscClient.GetKycStatusAsync("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q");
100100
```
101101

102102
Returns: [`XummKycStatus`](https://github.com/XRPL-Labs/XUMM.NET.SDK/blob/main/XUMM.Net/Enums/XummKycStatus.cs)
@@ -165,7 +165,7 @@ A payload can contain an XRPL transaction template. Some properties may be omitt
165165
```C#
166166
var payload = new XummPostJsonPayload(
167167
"{ \"TransactionType\": \"Payment\", " +
168-
"\"Destination\": \"rwiETSee2wMz3SBnAG8hkMsCgvGy9LWbZ1\", " +
168+
"\"Destination\": \"rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q\", " +
169169
"\"Amount\": \"1337\" }");
170170
```
171171

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace XUMM.NET.ServerApp.Configs
2+
{
3+
public class XrplConfig
4+
{
5+
internal const string SectionKey = "Xrpl";
6+
7+
public string Account { get; set; } = default!;
8+
public string CurrencyCode { get; set; } = default!;
9+
}
10+
}

examples/XUMM.Net.ServerApp/Pages/Misc/Avatar.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@using XUMM.NET.SDK.Clients.Interfaces
33
@using XUMM.NET.SDK.Extensions
44

5+
@inject IOptions<XrplConfig> Config
56
@inject IXummMiscClient _miscClient
67

78
<PageTitle>Avatar</PageTitle>
@@ -23,7 +24,7 @@
2324
<div class="mb-3">
2425
<label for="accountaddress" class="form-label">Account Address</label>
2526
<input id="accountaddress" type="text" class="form-control" placeholder="Account address" aria-label="Account Address" aria-describedby="basic-addon2" @bind="_account">
26-
<small id="accountaddressHelp" class="form-text text-muted">eg. @ExampleAccount</small>
27+
<small id="accountaddressHelp" class="form-text text-muted">eg. @Config.Value.Account</small>
2728
</div>
2829
<div class="btn-group mb-3" role="group">
2930
<button class="btn btn-primary" type="button" @onclick="GetAvatarUrl">Get Avatar</button>
@@ -43,7 +44,6 @@
4344
</div>
4445

4546
@code {
46-
private const string ExampleAccount = "rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB";
4747
private string _account = default!;
4848
private int _dimensions;
4949
private int _padding;
@@ -53,7 +53,7 @@
5353
{
5454
if (!_account.IsAccountAddress())
5555
{
56-
_account = ExampleAccount;
56+
_account = Config.Value.Account;
5757
}
5858

5959
if (_dimensions < 200)

examples/XUMM.Net.ServerApp/Pages/Misc/KycStatus.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@using XUMM.NET.SDK.Enums
44
@using XUMM.NET.SDK.Extensions
55

6+
@inject IOptions<XrplConfig> Config
67
@inject IXummMiscClient _miscClient
78

89
<PageTitle>KYC Status</PageTitle>
@@ -17,7 +18,7 @@
1718
<div class="mb-3">
1819
<label for="usertokenoraccount" class="form-label">User token or account</label>
1920
<input id="usertokenoraccount" type="text" class="form-control" placeholder="User Token or Account address" aria-label="User token or account" aria-describedby="basic-addon2" @bind="_userTokenOrAccount">
20-
<small id="usertokenoraccounthelp" class="form-text text-muted">eg. @ExampleAccount</small>
21+
<small id="usertokenoraccounthelp" class="form-text text-muted">eg. @Config.Value.Account</small>
2122
</div>
2223
<div class="btn-group mb-3" role="group">
2324
<button class="btn btn-primary" type="button" @onclick="GetKycStatusAsync">Fetch KYC Status</button>
@@ -38,7 +39,6 @@
3839
</div>
3940

4041
@code {
41-
private const string ExampleAccount = "rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB";
4242
private ResponseAlertBox _responseAlertBox = default!;
4343
private string _userTokenOrAccount = default!;
4444
private string _userTokenOrAccountType = default!;
@@ -48,7 +48,7 @@
4848
{
4949
if (!_userTokenOrAccount.IsAccountAddress() && !_userTokenOrAccount.IsValidUuid())
5050
{
51-
_userTokenOrAccount = ExampleAccount;
51+
_userTokenOrAccount = Config.Value.Account;
5252
}
5353

5454
_kycStatus = await _responseAlertBox.GetResponseAndSetAlertAsync(() => _miscClient.GetKycStatusAsync(_userTokenOrAccount));

examples/XUMM.Net.ServerApp/Pages/Misc/Rates.razor

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@using XUMM.NET.SDK.Clients.Interfaces
33
@using XUMM.NET.SDK.Models.Misc
44

5+
@inject IOptions<XrplConfig> Config
56
@inject IXummMiscClient _miscClient
67

78
<PageTitle>Rates</PageTitle>
@@ -16,7 +17,7 @@
1617
<div class="mb-3">
1718
<label for="currency" class="form-label">Currency</label>
1819
<input id="currency" class="form-control" placeholder="The 3 alpha char currency code" aria-label="Currency" aria-describedby="basic-addon2" @bind="_currency">
19-
<small id="currencyhelp" class="form-text text-muted">eg. INR</small>
20+
<small id="currencyhelp" class="form-text text-muted">eg. @Config.Value.CurrencyCode</small>
2021
</div>
2122
<div class="btn-group mb-3" role="group">
2223
<button class="btn btn-primary" type="button" @onclick="GetRatesAsync">Fetch Rates</button>
@@ -47,7 +48,7 @@
4748
{
4849
if (string.IsNullOrWhiteSpace(_currency))
4950
{
50-
_currency = "INR";
51+
_currency = Config.Value.CurrencyCode;
5152
}
5253

5354
_rates = await _responseAlertBox.GetResponseAndSetAlertAsync(() => _miscClient.GetRatesAsync(_currency));

examples/XUMM.Net.ServerApp/Pages/Misc/Transaction.razor

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939

4040
private async Task GetTransactionAsync()
4141
{
42+
if (string.IsNullOrWhiteSpace(_txHash))
43+
{
44+
return;
45+
}
46+
4247
_transaction = await _responseAlertBox.GetResponseAndSetAlertAsync(() => _miscClient.GetTransactionAsync(_txHash));
4348
_responseAlertBox.SetAlert("Transaction Details", _transaction != null);
4449
}

examples/XUMM.Net.ServerApp/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using XUMM.NET.SDK;
22
using XUMM.NET.SDK.Webhooks;
3+
using XUMM.NET.ServerApp.Configs;
34
using XUMM.NET.ServerApp.Webhooks;
45

56
var builder = WebApplication.CreateBuilder(args);
@@ -10,6 +11,7 @@
1011
builder.Services.AddHttpClient();
1112
builder.Services.AddXummNet(builder.Configuration);
1213
builder.Services.AddXummWebhooks<XummWebhookProcessor>();
14+
builder.Services.Configure<XrplConfig>(builder.Configuration.GetSection(XrplConfig.SectionKey));
1315
builder.Services.AddMemoryCache();
1416

1517
var app = builder.Build();

examples/XUMM.Net.ServerApp/_Imports.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@using Microsoft.AspNetCore.Components.Routing
66
@using Microsoft.AspNetCore.Components.Web
77
@using Microsoft.AspNetCore.Components.Web.Virtualization
8+
@using Microsoft.Extensions.Options
89
@using Microsoft.JSInterop
910
@using XUMM.NET.ServerApp
10-
@using XUMM.NET.ServerApp.Shared
11+
@using XUMM.NET.ServerApp.Configs
12+
@using XUMM.NET.ServerApp.Shared

examples/XUMM.Net.ServerApp/appsettings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"ApiKey": "", // API Key which can be obtained from the xumm Developer Console.
55
"ApiSecret": "" // API Secret which can be obtained from the xumm Developer Console.
66
},
7+
"Xrpl": {
8+
"Account": "rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q",
9+
"CurrencyCode": "INR"
10+
},
711
"Logging": {
812
"LogLevel": {
913
"Default": "Information",

src/XUMM.NET.SDK.Tests/Clients/XummMiscClientTests.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void GetKycStatusAsync_WithUserTokenAndInvalidStatus_ShouldThrowException
101101
}
102102

103103
[Test]
104-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB")]
104+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q")]
105105
public async Task GetKycStatusAsync_WithAccount_ShouldReturnKycStatusAsync(string account)
106106
{
107107
// Arrange
@@ -116,7 +116,7 @@ public async Task GetKycStatusAsync_WithAccount_ShouldReturnKycStatusAsync(strin
116116

117117
[Test]
118118
[TestCase("2557f69c661740dc9d1ea34487cb3f90")]
119-
[TestCase("qrDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB")]
119+
[TestCase("qrBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q")]
120120
public void GetKycStatusAsync_WithInvalidUserTokenAndAccount_ShouldThrowExceptionAsync(string userTokenOrAccount)
121121
{
122122
// Act
@@ -298,9 +298,9 @@ public void GetAvatarUrl_WithInvalidAccount_ShouldThrowExceptionAsync(string acc
298298
}
299299

300300
[Test]
301-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 50, 5)]
302-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 100, 0)]
303-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 199, 2)]
301+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 50, 5)]
302+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 100, 0)]
303+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 199, 2)]
304304
public void GetAvatarUrl_WithInvalidDimensions_ShouldThrowException(string account, int dimensions, int padding)
305305
{
306306
// Act
@@ -312,8 +312,8 @@ public void GetAvatarUrl_WithInvalidDimensions_ShouldThrowException(string accou
312312
}
313313

314314
[Test]
315-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 200, -50)]
316-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 250, -1)]
315+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 200, -50)]
316+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 250, -1)]
317317
public void GetAvatarUrl_WithInvalidPadding_ShouldThrowException(string account, int dimensions, int padding)
318318
{
319319
// Act
@@ -325,12 +325,9 @@ public void GetAvatarUrl_WithInvalidPadding_ShouldThrowException(string account,
325325
}
326326

327327
[Test]
328-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 200, 5,
329-
"https://xumm.app/avatar/rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB_200_5.png")]
330-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 250, 0,
331-
"https://xumm.app/avatar/rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB_250_0.png")]
332-
[TestCase("rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB", 500, 2,
333-
"https://xumm.app/avatar/rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB_500_2.png")]
328+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 200, 5, "https://xumm.app/avatar/rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q_200_5.png")]
329+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 250, 0, "https://xumm.app/avatar/rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q_250_0.png")]
330+
[TestCase("rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q", 500, 2, "https://xumm.app/avatar/rBLomsmaSJ1ttBmS3WPmPpWLAUDKFwiF9Q_500_2.png")]
334331
public void GetAvatarUrl_WithValidDimensions_ShouldReturnAvatarUrl(string account, int dimensions, int padding,
335332
string expected)
336333
{

0 commit comments

Comments
 (0)