Blockcoli.Libra.Net 0.7.4

Libra Wallet SDK for .NET

Install-Package Blockcoli.Libra.Net -Version 0.7.4
dotnet add package Blockcoli.Libra.Net --version 0.7.4
<PackageReference Include="Blockcoli.Libra.Net" Version="0.7.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Blockcoli.Libra.Net --version 0.7.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Blockcoli.Libra.Net, 0.7.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Blockcoli.Libra.Net as a Cake Addin
#addin nuget:?package=Blockcoli.Libra.Net&version=0.7.4

// Install Blockcoli.Libra.Net as a Cake Tool
#tool nuget:?package=Blockcoli.Libra.Net&version=0.7.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Blockcoli.Libra.Net

Libra Wallet SDK for .NET

Blockcoli is an open source project which is the world 1st .NET SDK for creating Libra wallet. It is hosted on Github repository and also built as a Nuget package.

What's New

  • Update Proto file

Installation

To install the nuget package from a command line, run:

dotnet add package Blockcoli.Libra.Net

Or from Visual Studio Package Manager Console

Install-Package Blockcoli.Libra.Net

Usage

At the top of your class file, add using for two namespaces.

using Blockcoli.Libra.Net.Wallet;
using Blockcoli.Libra.Net.Client;

Creating an account

In order to create a libra account, you would need to instantiate the LibraWallet as shown in the following code example:

// Create a new wallet
var wallet = new LibraWallet();

// Create a new account
var account = wallet.NewAccount();

// Mnemonic words (secret) for recovering wallet
var mnemonic = wallet.Mnemonic;
Console.WriteLine(mnemonic);

// Get your account address
Console.WriteLine(account.Address);

Recovering an account

In order to create a libra account, you would need to instantiate the LibraWallet as shown in the following code example:

// Recovering a wallet with mnemonic words (secret)
var mnemonic = "elite kidney kangaroo enhance list mule paddle arrange popular frown ahead carry endorse thunder toy broken absorb level surprise arrow analyst segment wave fat";

// Create a wallet
var wallet = new LibraWallet(mnemonic);

// Recover an Account
var account = wallet.NewAccount();

// Get your account address
Console.WriteLine(account.Address);

Minting an amount

To mint an amount, you would need to create a LibraClient and use it to mint

// Currently minting only works for testnet and uses the faucet service.
var client = new LibraClient(LibraNetwork.Testnet);

// Mint amout in Micro-Libra. (1 Libra = 1000000 Micro-Libra)
var sequenceNumber = await client.MintWithFaucetService(account.Address, 1000000);

Checking an address balance

// You can use parameter array for checking multiple addresses.
var accountState = await client.QueryBalance(account.Address);
Console.WriteLine(accountState.Balance);

Transferring Libra coins

// You can use parameter array for checking multiple addresses.
var sender = wallet.Accounts.ElementAt(0).Value;
var receiverAddress = "face4412ab3325cf6e26624cff089eb1bf8ec6da489f05aad72a81de5ff7b5d1";
var amount = 10000000UL;
var success = await client.TransferCoins(sender, receiverAddress, amount);
Console.WriteLine($"AC Status: {success}");

Related projects

License

MIT License Copyright (c) 2019 Blockcoli

Official website

blockcoli.com

Blockcoli.Libra.Net

Libra Wallet SDK for .NET

Blockcoli is an open source project which is the world 1st .NET SDK for creating Libra wallet. It is hosted on Github repository and also built as a Nuget package.

What's New

  • Update Proto file

Installation

To install the nuget package from a command line, run:

dotnet add package Blockcoli.Libra.Net

Or from Visual Studio Package Manager Console

Install-Package Blockcoli.Libra.Net

Usage

At the top of your class file, add using for two namespaces.

using Blockcoli.Libra.Net.Wallet;
using Blockcoli.Libra.Net.Client;

Creating an account

In order to create a libra account, you would need to instantiate the LibraWallet as shown in the following code example:

// Create a new wallet
var wallet = new LibraWallet();

// Create a new account
var account = wallet.NewAccount();

// Mnemonic words (secret) for recovering wallet
var mnemonic = wallet.Mnemonic;
Console.WriteLine(mnemonic);

// Get your account address
Console.WriteLine(account.Address);

Recovering an account

In order to create a libra account, you would need to instantiate the LibraWallet as shown in the following code example:

// Recovering a wallet with mnemonic words (secret)
var mnemonic = "elite kidney kangaroo enhance list mule paddle arrange popular frown ahead carry endorse thunder toy broken absorb level surprise arrow analyst segment wave fat";

// Create a wallet
var wallet = new LibraWallet(mnemonic);

// Recover an Account
var account = wallet.NewAccount();

// Get your account address
Console.WriteLine(account.Address);

Minting an amount

To mint an amount, you would need to create a LibraClient and use it to mint

// Currently minting only works for testnet and uses the faucet service.
var client = new LibraClient(LibraNetwork.Testnet);

// Mint amout in Micro-Libra. (1 Libra = 1000000 Micro-Libra)
var sequenceNumber = await client.MintWithFaucetService(account.Address, 1000000);

Checking an address balance

// You can use parameter array for checking multiple addresses.
var accountState = await client.QueryBalance(account.Address);
Console.WriteLine(accountState.Balance);

Transferring Libra coins

// You can use parameter array for checking multiple addresses.
var sender = wallet.Accounts.ElementAt(0).Value;
var receiverAddress = "face4412ab3325cf6e26624cff089eb1bf8ec6da489f05aad72a81de5ff7b5d1";
var amount = 10000000UL;
var success = await client.TransferCoins(sender, receiverAddress, amount);
Console.WriteLine($"AC Status: {success}");

Related projects

License

MIT License Copyright (c) 2019 Blockcoli

Official website

blockcoli.com

Release Notes

Update Proto file

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.7.4 375 2/3/2020
0.7.3 201 1/16/2020
0.7.2 190 1/14/2020
0.7.1 237 1/2/2020
0.7.0 206 12/18/2019
0.6.0 205 10/31/2019
0.5.0 232 9/30/2019
0.4.0 210 9/10/2019
0.3.0 221 8/26/2019
0.2.0 210 8/25/2019
0.1.0 213 8/20/2019