diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandHandler.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandHandler.cs index e3baba0..58d580d 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandHandler.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandHandler.cs @@ -8,7 +8,9 @@ public class StoreMnemonicCommandHandler : IRequestHandler Handle(StoreMnemonicCommand request, CancellationToken cancellationToken) { - StoreMnemonicCommandMessage message = new StoreMnemonicCommandMessage(request.Mnemonic); + StoreMnemonicCommandMessageData messageData = new StoreMnemonicCommandMessageData(request.Mnemonic); + StoreMnemonicCommandMessage message = new StoreMnemonicCommandMessage(messageData); + string messageJson = JsonConvert.SerializeObject(message); RustBridgeGenericResponse genericResponse = await request.Wallet.SendMessageAsync(messageJson); diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandMessage.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandMessage.cs index de19870..3673687 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandMessage.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandMessage.cs @@ -2,14 +2,14 @@ namespace IotaWalletNet.Application.WalletContext.Commands.StoreMnemonic { - internal class StoreMnemonicCommandMessage : Message + internal class StoreMnemonicCommandMessage : Message { private const string COMMAND = "storeMnemonic"; - public StoreMnemonicCommandMessage(string mnemonic) + public StoreMnemonicCommandMessage(StoreMnemonicCommandMessageData storeMnemonicCommandMessageData) { Cmd = COMMAND; - Payload = mnemonic; + Payload = storeMnemonicCommandMessageData; } } } diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandMessageData.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandMessageData.cs new file mode 100644 index 0000000..8708c2a --- /dev/null +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/StoreMnemonic/StoreMnemonicCommandMessageData.cs @@ -0,0 +1,12 @@ +namespace IotaWalletNet.Application.WalletContext.Commands.StoreMnemonic +{ + internal class StoreMnemonicCommandMessageData + { + public StoreMnemonicCommandMessageData(string mnemonic) + { + Mnemonic= mnemonic; + } + + public string Mnemonic { get; private set; } + } +} diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandHandler.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandHandler.cs index e046252..c97a11c 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandHandler.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandHandler.cs @@ -8,7 +8,8 @@ public class VerifyMnemonicCommandHandler : IRequestHandler Handle(VerifyMnemonicCommand request, CancellationToken cancellationToken) { - VerifyMnemonicCommandMessage message = new VerifyMnemonicCommandMessage(request.Mnemonic); + VerifyMnemonicCommandMessageData messageData = new VerifyMnemonicCommandMessageData(request.Mnemonic); + VerifyMnemonicCommandMessage message = new VerifyMnemonicCommandMessage(messageData); string json = JsonConvert.SerializeObject(message); RustBridgeGenericResponse genericResponse = await request.Wallet.SendMessageAsync(json); diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandMessage.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandMessage.cs index f3055e5..29f0530 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandMessage.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandMessage.cs @@ -2,14 +2,14 @@ namespace IotaWalletNet.Application.WalletContext.Commands.VerifyMnemonic { - public class VerifyMnemonicCommandMessage : Message + internal class VerifyMnemonicCommandMessage : Message { private const string COMMAND = "verifyMnemonic"; - public VerifyMnemonicCommandMessage(string mnemonic) + public VerifyMnemonicCommandMessage(VerifyMnemonicCommandMessageData verifyMnemonicCommandMessageData) { Cmd = COMMAND; - Payload = mnemonic; + Payload = verifyMnemonicCommandMessageData; } } } diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandMessageData.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandMessageData.cs new file mode 100644 index 0000000..fdbe087 --- /dev/null +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicCommandMessageData.cs @@ -0,0 +1,12 @@ +namespace IotaWalletNet.Application.WalletContext.Commands.VerifyMnemonic +{ + internal class VerifyMnemonicCommandMessageData + { + public VerifyMnemonicCommandMessageData(string mnemonic) + { + Mnemonic = mnemonic; + } + + public string Mnemonic { get; set; } + } +} diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryHandler.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryHandler.cs index 7094f7f..5eb0f10 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryHandler.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryHandler.cs @@ -9,7 +9,8 @@ public partial class GetAccountQueryHandler : IRequestHandler Handle(GetAccountQuery request, CancellationToken cancellationToken) { - GetAccountQueryMessage message = new GetAccountQueryMessage(request.Username); + GetAccountQueryMessageData messageData = new GetAccountQueryMessageData(request.Username); + GetAccountQueryMessage message = new GetAccountQueryMessage(messageData); string json = JsonConvert.SerializeObject(message); RustBridgeGenericResponse genericResponse = await request.Wallet.SendMessageAsync(json); diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryMessage.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryMessage.cs index 1cb1a2a..08b9653 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryMessage.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryMessage.cs @@ -2,14 +2,14 @@ namespace IotaWalletNet.Application.WalletContext.Queries.GetAccount { - public class GetAccountQueryMessage : Message + internal class GetAccountQueryMessage : Message { private const string COMMAND = "getAccount"; - public GetAccountQueryMessage(string username) + public GetAccountQueryMessage(GetAccountQueryMessageData getAccountQueryMessageData) { Cmd = COMMAND; - Payload = username; + Payload = getAccountQueryMessageData; } } } diff --git a/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryMessageData.cs b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryMessageData.cs new file mode 100644 index 0000000..7225da4 --- /dev/null +++ b/csharp/IotaWalletNet/IotaWalletNet.Application/WalletContext/Queries/GetAccount/GetAccountQueryMessageData.cs @@ -0,0 +1,12 @@ +namespace IotaWalletNet.Application.WalletContext.Queries.GetAccount +{ + internal class GetAccountQueryMessageData + { + public GetAccountQueryMessageData(string username) + { + AccountId= username; + } + + public string AccountId { get; private set; } + } +} diff --git a/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/Events/Subscribe/EventsExample.cs b/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/Events/Subscribe/EventsExample.cs index ef04ada..22c9e3d 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/Events/Subscribe/EventsExample.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/Events/Subscribe/EventsExample.cs @@ -69,7 +69,7 @@ public static async Task Run() SyncAccountResponse syncAccountResponse = await account.SyncAccountAsync(); Console.WriteLine($"SyncAccountAsync: {syncAccountResponse}"); - await account.ConsolidateOutputsAsync(true); + //await account.ConsolidateOutputsAsync(true); GetBalanceResponse getBalanceResponse = await account.GetBalanceAsync(); Console.WriteLine($"GetBalanceAsync: {getBalanceResponse}"); diff --git a/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Burn/BurnNftExample.cs b/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Burn/BurnNftExample.cs index c5c09e1..dbcd26f 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Burn/BurnNftExample.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Burn/BurnNftExample.cs @@ -56,8 +56,10 @@ public static async Task Run() //Sync account await account.SyncAccountAsync(); + Console.WriteLine(await account.GetBalanceAsync()); + //TODO: Replace with an nft output id from your accounts. - string outputId = "0x9c5fc8b575e29377e0401d2cd6138c0f4859fbb95b5acf0ea81b3354de6eb2e70100"; + string outputId = "0xbb237bab9e5277867c99cb05ce89176838a57bce230a9cd593aee586bffa11b50000"; var nftId = outputId.ComputeBlake2bHash(); diff --git a/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Send/SendNftExample.cs b/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Send/SendNftExample.cs index d16f136..933ee69 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Send/SendNftExample.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Main/Examples/NFTs/Send/SendNftExample.cs @@ -57,12 +57,13 @@ public static async Task Run() await account.SyncAccountAsync(); + Console.WriteLine(await account.GetBalanceAsync()); //TODO: Replace with the address of your choice! string receiverAddress = "rms1qz8wf6jrchvsfmcnsfhlf6s53x3u85y0j4hvwth9a5ff3xhrxtmvvyc9ae7"; //TODO: Replace with an nft output id from your accounts. - string outputId = "0x9c5fc8b575e29377e0401d2cd6138c0f4859fbb95b5acf0ea81b3354de6eb2e70000"; + string outputId = "0xbb237bab9e5277867c99cb05ce89176838a57bce230a9cd593aee586bffa11b50100"; var nftId = outputId.ComputeBlake2bHash(); diff --git a/csharp/IotaWalletNet/IotaWalletNet.Main/IotaWalletNet.Main.csproj b/csharp/IotaWalletNet/IotaWalletNet.Main/IotaWalletNet.Main.csproj index c6ea65a..f78ccc8 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Main/IotaWalletNet.Main.csproj +++ b/csharp/IotaWalletNet/IotaWalletNet.Main/IotaWalletNet.Main.csproj @@ -10,7 +10,7 @@ - + diff --git a/csharp/IotaWalletNet/IotaWalletNet.Main/Program.cs b/csharp/IotaWalletNet/IotaWalletNet.Main/Program.cs index f25c96a..f6481bb 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Main/Program.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Main/Program.cs @@ -1,5 +1,17 @@ -using IotaWalletNet.Main.Examples.Events.WaitForTransactionConfirmation; +using IotaWalletNet.Main.Examples.Accounts_and_Addresses; +using IotaWalletNet.Main.Examples.Accounts_and_Addresses.Check_Balance; +using IotaWalletNet.Main.Examples.Accounts_and_Addresses.Generate_an_Address; +using IotaWalletNet.Main.Examples.Events.Subscribe; +using IotaWalletNet.Main.Examples.Events.WaitForTransactionConfirmation; +using IotaWalletNet.Main.Examples.Native_Tokens.Melt; +using IotaWalletNet.Main.Examples.Native_Tokens.Mint; +using IotaWalletNet.Main.Examples.Native_Tokens.Send; +using IotaWalletNet.Main.Examples.NFTs.Burn; +using IotaWalletNet.Main.Examples.NFTs.Mint; +using IotaWalletNet.Main.Examples.NFTs.Send; using IotaWalletNet.Main.Examples.Outputs_and_Transactions.Periodic_Syncing; +using IotaWalletNet.Main.Examples.Outputs_and_Transactions.Request_Tokens_from_Faucet; +using IotaWalletNet.Main.Examples.Outputs_and_Transactions.Send_a_Transaction; namespace IotaWalletNet.Main { @@ -7,6 +19,7 @@ internal class Program { private static async Task Main(string[] args) { + //await CreateAWalletAndAccountExample.Run(); //await RequestTokensFromFaucetExample.Run(); @@ -37,7 +50,7 @@ private static async Task Main(string[] args) //await ClaimOutputsExample.Run(); //await PeriodicSyncingExample.Run(); - await WaitForTransactionConfirmationExample.Run(); + //await WaitForTransactionConfirmationExample.Run(); } } diff --git a/csharp/IotaWalletNet/IotaWalletNet.Tests/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicTests.cs b/csharp/IotaWalletNet/IotaWalletNet.Tests/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicTests.cs index a748ca9..4de3e08 100644 --- a/csharp/IotaWalletNet/IotaWalletNet.Tests/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicTests.cs +++ b/csharp/IotaWalletNet/IotaWalletNet.Tests/WalletContext/Commands/VerifyMnemonic/VerifyMnemonicTests.cs @@ -31,6 +31,15 @@ public async Task WalletShouldValidateFalseForWrongMnemonic() IWallet wallet = _serviceScope.ServiceProvider.GetRequiredService(); wallet = await CreateOfflineFullWalletAsync(wallet, shouldCreateAndStoreMnemonic: false); string mnemonic = "hood medal among prevent during embrace inmate swarm ancient damp token rail wolf risk tortoise record dose language rival cloud sting grace palm style"; + try + { + await wallet.VerifyMnemonicAsync("asdasd"); + + } + catch(RustBridgeException e) + { + + } await wallet.Awaiting(x => x.VerifyMnemonicAsync("wrong mnemonic")).Should().ThrowAsync(); await wallet.Awaiting(x => x.VerifyMnemonicAsync(mnemonic + "random")).Should().ThrowAsync();