Zenon.Sdk 0.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Zenon.Sdk --version 0.3.2                
NuGet\Install-Package Zenon.Sdk -Version 0.3.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zenon.Sdk" Version="0.3.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Zenon.Sdk --version 0.3.2                
#r "nuget: Zenon.Sdk, 0.3.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Zenon.Sdk as a Cake Addin
#addin nuget:?package=Zenon.Sdk&version=0.3.2

// Install Zenon.Sdk as a Cake Tool
#tool nuget:?package=Zenon.Sdk&version=0.3.2                

Zenon Sdk for .NET

nuget build codecov

Reference implementation for the Zenon SDK for .NET. Compatible with the Zenon Alphanet - Network of Momentum Phase 0. It provides a simple integration with any .NET based projects.

Installation

Install the Zenon.Sdk package from NuGet

dotnet add package Zenon.Sdk

Usage

Connect node

using Zenon;

var nodeUrl = new Uri("ws://nodes.zenon.place:35998");

await Znn.Instance.Client.Value.StartAsync(nodeUrl);
...
await Znn.Instance.Client.Value.StopAsync();

Generate wallet

using Zenon;

var wallet = "name";
var passphrase = "secret";

Znn.Instance.DefaultKeyStorePath = 
    Znn.Instance.KeyStoreManager.CreateNew(passphrase, wallet);
Znn.Instance.DefaultKeyStore = 
    Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);

Generate wallet from mnemonic

using Zenon;

var wallet = "name";
var passphrase = "secret";
var mnemonic =
      "route become dream access impulse price inform obtain engage ski believe awful absent pig thing vibrant possible exotic flee pepper marble rural fire fancy";

Znn.Instance.DefaultKeyStore = 
    Znn.Instance.KeyStoreManager.CreateFromMnemonic(mnemonic, passphrase, wallet);
Znn.Instance.DefaultKeyStore = 
    Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);

Sending a transaction

using Zenon;

var nodeUrl = new Uri("ws://nodes.zenon.place:35998");
var wallet = "name";
var passphrase = "secret";
var mnemonic =
      "route become dream access impulse price inform obtain engage ski believe awful absent pig thing vibrant possible exotic flee pepper marble rural fire fancy";

Znn.Instance.DefaultKeyStore = 
    Znn.Instance.KeyStoreManager.CreateFromMnemonic(mnemonic, passphrase, wallet);
Znn.Instance.DefaultKeyStore = 
    Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);
Znn.Instance.DefaultKeyPair = 
    Znn.Instance.DefaultKeyStore.GetKeyPair(); // Use primary address

await Znn.Instance.Client.Value.StartAsync(nodeUrl);

var tx = Znn.Instance.Embedded.Pillar.CollectReward();

await Znn.Instance.Send(tx);

await Znn.Instance.Client.Value.StopAsync();

Receive a transaction

using Zenon;
using Zenon.Model.NoM;

var nodeUrl = new Uri("ws://nodes.zenon.place:35998");
var wallet = "name";
var passphrase = "secret";
var mnemonic =
      "route become dream access impulse price inform obtain engage ski believe awful absent pig thing vibrant possible exotic flee pepper marble rural fire fancy";

Znn.Instance.DefaultKeyStore = 
    Znn.Instance.KeyStoreManager.CreateFromMnemonic(mnemonic, passphrase, wallet);
Znn.Instance.DefaultKeyStore = 
    Znn.Instance.KeyStoreManager.ReadKeyStore(passphrase, Znn.Instance.DefaultKeyStorePath);
Znn.Instance.DefaultKeyPair = 
    Znn.Instance.DefaultKeyStore.GetKeyPair(); // Use primary address

await Znn.Instance.Client.Value.StartAsync(nodeUrl);

var result = await Znn.Instance.Ledger
    .GetUnreceivedBlocksByAddress(Znn.Instance.DefaultKeyPair.Address);

if (result.Count != 0)
{
    foreach (var item in result.List)
    {
        var tx = AccountBlockTemplate.Receive(item.Hash);

        await Znn.Instance.Send(tx, true);
    }
}

await Znn.Instance.Client.Value.StopAsync();

Contributing

Please check CONTRIBUTING for more details.

License

The MIT License (MIT). Please check LICENSE for more information.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Zenon.Sdk:

Package Downloads
Zenon.Wallet.Ledger

Ledger wallet for the Zenon .NET SDK

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.25-ledger-g727123be4d 124 12/11/2023
0.6.24-ledger-g403a3f8f67 108 12/11/2023
0.6.22-ledger-gbdfa921f2b 102 12/11/2023
0.6.20-ledger-gef4ff81bd3 151 9/11/2023
0.6.19-ledger-ga45e76931d 140 9/11/2023
0.6.17-ledger-g59034ed1b6 106 9/6/2023
0.6.16-ledger-g6a30ee89b1 104 9/6/2023
0.6.15-ledger-g0b99f5fe01 130 9/6/2023
0.6.14 139 4/29/2024
0.6.14-ledger-g30ff5b1b3c 142 8/8/2023
0.6.13 183 4/4/2024
0.6.12 106 3/29/2024
0.6.12-ledger-gf29ee9d4de 162 7/23/2023
0.6.11 108 3/21/2024
0.6.10 170 3/6/2024
0.6.9 286 12/13/2023
0.6.8-g8373116dd0 110 12/13/2023
0.6.6 161 9/18/2023
0.6.4 154 9/6/2023
0.6.3 138 9/6/2023
0.6.2 146 9/6/2023
0.6.1 181 8/1/2023
0.5.8 179 5/22/2023
0.5.7 257 4/22/2023
0.5.4-ptlc-g5a7a6e5328 138 4/14/2023
0.4.1 197 4/14/2023
0.3.12 313 1/25/2023
0.3.10 324 1/14/2023
0.3.9 336 12/22/2022
0.3.8 321 12/22/2022
0.3.7 412 10/14/2022
0.3.6 421 10/14/2022
0.3.5 432 10/8/2022
0.3.2 461 7/12/2022