VottunERC20API.NET 1.1.0

dotnet add package VottunERC20API.NET --version 1.1.0                
NuGet\Install-Package VottunERC20API.NET -Version 1.1.0                
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="VottunERC20API.NET" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VottunERC20API.NET --version 1.1.0                
#r "nuget: VottunERC20API.NET, 1.1.0"                
#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 VottunERC20API.NET as a Cake Addin
#addin nuget:?package=VottunERC20API.NET&version=1.1.0

// Install VottunERC20API.NET as a Cake Tool
#tool nuget:?package=VottunERC20API.NET&version=1.1.0                

VottunERC20API.NET

This SDK for .NET 8 implements Vottun ERC20 API, and allows querying all API methods within a .NET 8 application. It provides wrapped classes for of all json requests and responses, as provided in Vottun ERC20 API(https://docs.vottun.io/api/erc20)

Implemented API methods:

Ready as a nugget package published in nuget.org, just search for VottunERC20API.NET.1.0.5.

Using VottunERC20API.NET SDK is very easy:

  1. In your project or solution, add reference to package VottunERC20API.NET available in nuget.org package repository:

image

  1. Declare your API and AUTH keys:

image

  1. Create a client using the provided factory in VottunApiClientFactory, passing your API keys.

image

  1. Build your request objetc, call the available API methods and get the response, that's all!

Example of use:

using VottunERC20API.NET;

//set your api and authorization key
var apiKey = "<your api key>";
var authorizationKey = "<your auth key>";

//instance a client by calling the provided factory
var client = VottunApiClientFactory.Create( apiKey, authorizationKey);


//examples of SDK usage
//1. Allowance
var allowanceRequest = new AllowanceRequest
{
    contractAddress = "0xBe0CD9c4C636373eB1c5e1d581b1269E9E40c517",
    network = 80001,
    owner = "0x7590a8ff8a4b8e2831db16a02f03c7acd65aca26",
    spender = "0x7590a8fF8A4B8E2831dB16A02f03c7AcD65aca26"
};
var allowance = await client.AllowanceAsync(  allowanceRequest , CancellationToken.None);

Console.WriteLine($"Allowance: {allowance.allowance}");

//2. Name
var nameRequest = new NameRequest
{
   contractAddress= "0xBe0CD9c4C636373eB1c5e1d581b1269E9E40c517",
   network=80001
};
var name = await client.NameAsync(nameRequest, CancellationToken.None);

Console.WriteLine($"Name: {name.name}");

//3. Symbol

var SymbolRequest = new SymbolRequest
{
    contractAddress = "0xBe0CD9c4C636373eB1c5e1d581b1269E9E40c517",
    network = 80001
};

var symbolResponse = await client.SymbolAsync(SymbolRequest, CancellationToken.None);
Console.WriteLine($"Symbol: {symbolResponse.symbol}");


//4. TotalSupply

var totalSupplyRequest = new TotalSupplyRequest
{
    contractAddress = "0xBe0CD9c4C636373eB1c5e1d581b1269E9E40c517",
    network = 80001
};

var totalSupplyResponse = await client.TotalSupplyAsync(totalSupplyRequest, CancellationToken.None);
Console.WriteLine($"TotalSupply: {totalSupplyResponse.totalSupply}");

//5. Decimals

var decimalsRequest = new DecimalsRequest
{
    contractAddress = "0xBe0CD9c4C636373eB1c5e1d581b1269E9E40c517",
    network = 80001
};

var decimalsResponse = await client.DecimalsAsync(decimalsRequest, CancellationToken.None);
Console.WriteLine($"Decimals: {decimalsResponse.decimals}");

//6. BalanceOf

var balanceOfRequest = new BalanceOfRequest
{
    contractAddress = "0xBe0CD9c4C636373eB1c5e1d581b1269E9E40c517",
    network = 80001,
    address = "0x7590a8ff8a4b8e2831db16a02f03c7acd65aca26"
};

var balanceOfResponse = await client.BalanceOfAsync(balanceOfRequest, CancellationToken.None);
Console.WriteLine($"BalanceOf: {balanceOfResponse.balance}");

//7. Deploy
var deployRequest = new DeployRequest
{
    name = "VottunToken",
    symbol = "VOT",
    alias  = "Vottun token ERC20 test",
    initialSupply = 21000000,
    network = 80001
};

var deployResponse = await client.DeployAsync(deployRequest, CancellationToken.None);
Console.WriteLine($"Deployed ContractAddress: {deployResponse.contractAddress}");


//8. Transfer
var transferRequest = new TransferRequest
{
    contractAddress = "0x5FbE0944D3d2df2C7D2B55c0ED2C9085bcD8971A",
    recipient = "0x7590a8ff8a4b8e2831db16a02f03c7acd65aca26",
    amount = 100,
    network = 80001
};

var transferResponse = await client.TransferAsync(transferRequest, CancellationToken.None);
Console.WriteLine($"Transfer TxnHash: {transferResponse.txHash}");


//9. TransferFrom
var transferFromRequest = new TransferFromRequest
{
    contractAddress = "0x5FbE0944D3d2df2C7D2B55c0ED2C9085bcD8971A",
    sender = "0x7590a8ff8a4b8e2831db16a02f03c7acd65aca26",
    recipient = "0x5770bf37D6617eec99744DD6Ee03a3DA12b681eE",
    amount = 100,
    network = 80001
};

var transferFromResponse = await client.TransferFromAsync(transferFromRequest, CancellationToken.None);
Console.WriteLine($"TransferFrom TxnHash: {transferFromResponse.txHash}");

//10. IncreaseAllowance
var increaseAllowanceRequest = new IncreaseAllowanceRequest
{
    contractAddress = "0x5FbE0944D3d2df2C7D2B55c0ED2C9085bcD8971A",
    spender = "0x5770bf37D6617eec99744DD6Ee03a3DA12b681eE",
    addedValue = 100,
    network = 80001
};

var increaseAllowanceResponse = await client.IncreaseAllowanceAsync(increaseAllowanceRequest, CancellationToken.None);
Console.WriteLine($"IncreaseAllowance TxnHash: {increaseAllowanceResponse.txHash}");


//11. DecreaseAllowance

var decreaseAllowanceRequest = new DecreaseAllowanceRequest
{
    contractAddress = "0x5FbE0944D3d2df2C7D2B55c0ED2C9085bcD8971A",
    spender = "0x5770bf37D6617eec99744DD6Ee03a3DA12b681eE",
    substractedValue = 100,
    network = 80001
};

var decreaseAllowanceResponse = await client.DecreaseAllowanceAsync(decreaseAllowanceRequest, CancellationToken.None);
Console.WriteLine($"DecreaseAllowance TxnHash: {decreaseAllowanceResponse.txHash}");

version changelog

  • 1.0.0:
    • first version
  • 1.0.5:
    • changed initialSupply attribute from string to int type and other minor changes
  • 1.0.6:
    • changed uint256 solidity type (initialSuply, value, allowance...) to System.Numeric.Biginteger NET.8 type as ERC20 supply and value are expressed in gwei (256bit integers)
  • 1.1.0:
    • Added tests for serialization/deserialization of BigInteger numbers when bigger than ulong (as solidity allows).

TO DO list

  • Extend to other vottun APIS
  • Include more examples
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 72 6/9/2024
1.0.6 117 4/29/2024
1.0.5 90 4/25/2024
1.0.0 90 4/25/2024

Changed uint256 solidity types to equivalent System.Numeric.BigInteger type.
Some typo corrections.