AkashicPaySDK 1.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package AkashicPaySDK --version 1.0.9                
NuGet\Install-Package AkashicPaySDK -Version 1.0.9                
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="AkashicPaySDK" Version="1.0.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AkashicPaySDK --version 1.0.9                
#r "nuget: AkashicPaySDK, 1.0.9"                
#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 AkashicPaySDK as a Cake Addin
#addin nuget:?package=AkashicPaySDK&version=1.0.9

// Install AkashicPaySDK as a Cake Tool
#tool nuget:?package=AkashicPaySDK&version=1.0.9                

AkashicPay SDK

AkashicPay SDK is a C# based SDK for interacting with the AkashicPay platform. This SDK allows you to create otks, generate deposit addresses, and initialize the SDK based on different environments.

Table of Contents

  1. Overview
  2. Installation
  3. Usage
  4. Key Classes and Methods
  5. Contribution
  6. License

Overview

AkashicPay SDK is designed to interact with the AkashicPay blockchain network. This SDK provides functionalities such as otk creation, deposit address requests, and transaction queries.

Installation

Requirements

  • C# 10 or higher
  • NuGet

NuGet

Add the following dependency to your command line:

dotnet add package AkashicPaySDK
Build
dotnet publish -c Release -r win-x64;
dotnet publish -c Release -r linux-x64;
dotnet publish -c Release -r osx-x64;
Lint apply
dotnet tool install -g dotnet-format
dotnet format csharp-sdk.csproj

Usage

Creating a Otk

using AkashicPaySDK;
using AkashicPaySDK.Constants;

namespace ApSdkTests;

public class Example
{
    public static async Task Main(string[] args)
    {
        var environment =
            Environment.GetEnvironmentVariable("environment") == "production" ?
                APEnvironment.Production :
                APEnvironment.Development;

        var otk = ApSdkFactory.CreateOtkFromKeyPair("your_private_key", "your_l2Address");
        var sdk = await ApSdkFactory.CreateSdk(environment, otk);
    }

}

Initializing and Using the SDK

using AkashicPaySDK.Constants;
using AkashicPaySDK.Model;

namespace AkashicPaySDK;

public class Example
{
    public static async Task Main(string[] args) // Main 메서드를 Task로 반환
    {
        const string l2Address = "your l2Address";
        const string privateKey = "your privateKey";
        var otk = ApSdkFactory.CreateOtkFromKeyPair(l2Address,privateKey);

        var sdk = await ApSdkFactory.CreateSdk(APEnvironment.Development, otk);

        // Backup otk for only the development environment
        var backupOtk = sdk.KeyBackup();

        const string identifier = "your_identifier";
        var depositResult = await sdk.GetDepositAddressAsync(TronShastaNetworkSymbol.Value, identifier);

        const string recipientId = "your_recipientId";
        const string toAddress = "your_L1ToAddress";

        var trxPayoutResult = await sdk.PayoutAsync(recipientId, toAddress, 0.000001, TronShastaNetworkSymbol.Value, ApTokenSymbol.Usdt);

    }
}

Key Classes and Methods

ApSdkFactory

  • AcOtk CreateOtkFromKeyPair(string privateKey, string l2Address): Creates a otk from a key pair.
  • AcOtk CreateOtkFromRecoveryPhrase(string recoveryPhrase, string l2Address): Creates a otk from a recovery phrase.
  • AcOtk CreateOtk(): Creates a new otk.(this method is only allowed with DEVELOPMENT environment)
  • Task<IApSdk> CreateSdk(APEnvironment environment, AcOtk otk): Creates an SDK instance based on the given environment and otk.

IApSdk

The IApSdk interface provides the main functionalities of the AkashicPay SDK. Below are the key methods:

Task Init()

Initializes the SDK. This method should be called before using any other methods in the SDK.

Task<ApDepositAddressResult> GetDepositAddressAsync(BaseNetworkSymbol networkSymbol, string identifier)

Retrieves a deposit address for the specified network symbol and identifier.

Parameters:

  • network - The network symbol.
  • identifier - The identifier.

Returns: The result containing the deposit address.

Task<ApPayoutResult> PayoutAsync(string recipientId, string to, double amount, BaseNetworkSymbol networkSymbol, ApTokenSymbol tokenSymbol)

Performs a payout operation.

Parameters:

  • recipientId - The recipient's ID.
  • to - The address to payout to.
  • amount - The amount to payout.
  • networkSymbol - The network symbol.
  • tokenSymbol - The token symbol.

Returns: The result of the payout operation.

Task<ApPayoutResult> PayoutAsync(string recipientId, string to, double amount, BaseNetworkSymbol networkSymbol)

Performs a payout operation with an additional token symbol parameter.

Parameters:

  • recipientId - The recipient's ID.
  • to - The address to payout to.
  • amount - The amount to payout.
  • networkSymbol - The network symbol.

Returns: The result of the payout operation.

Task<ApBalanceResult?> GetBalanceAsync(string l2Address)

Gets the current balance for the specified L2 address.

Parameters:

  • l2Address - The L2 address.

Returns: The result containing the balance information. Returns Optional.empty() if the balance is not available.

Task<ApTransactionDetailResult?> GetTransactionDetailAsync(string l2TxHash)

Gets the details of a specific transaction for the given L2 transaction hash.

Parameters:

  • l2TxHash - The L2 transaction hash.

Returns: The result containing the transaction details. Returns Optional.empty() if the transaction details are not available.


These methods provide the essential functionalities required to interact with the AkashicPay SDK, enabling operations such as initialization, deposit address retrieval, payouts, transfer listing, balance checking, and transaction detail fetching.

Contribution

Contributions are welcome! If you find any bugs or have suggestions for improvements, please file an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.