AkashicPaySDK 1.0.15
See the version list below for details.
dotnet add package AkashicPaySDK --version 1.0.15
NuGet\Install-Package AkashicPaySDK -Version 1.0.15
<PackageReference Include="AkashicPaySDK" Version="1.0.15" />
paket add AkashicPaySDK --version 1.0.15
#r "nuget: AkashicPaySDK, 1.0.15"
// Install AkashicPaySDK as a Cake Addin #addin nuget:?package=AkashicPaySDK&version=1.0.15 // Install AkashicPaySDK as a Cake Tool #tool nuget:?package=AkashicPaySDK&version=1.0.15
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
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
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 have a look at CONTRIBUTING.md and submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE
file for more details.
Product | Versions 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 is compatible. 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 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. |
-
net6.0
- BouncyCastle.Cryptography (>= 2.4.0)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 4.0.2-dev-02220)
-
net7.0
- BouncyCastle.Cryptography (>= 2.4.0)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 4.0.2-dev-02220)
-
net8.0
- BouncyCastle.Cryptography (>= 2.4.0)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 4.0.2-dev-02220)
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.3 | 81 | 11/12/2024 | |
1.1.2 | 78 | 11/8/2024 | |
1.1.1 | 83 | 10/28/2024 | |
1.1.0 | 77 | 10/16/2024 | |
1.0.15 | 127 | 9/20/2024 | |
1.0.14 | 167 | 9/16/2024 | |
1.0.13 | 133 | 9/11/2024 | |
1.0.12 | 126 | 9/11/2024 | |
1.0.11 | 117 | 9/11/2024 | |
1.0.10 | 133 | 9/11/2024 | |
1.0.9 | 175 | 9/11/2024 | |
1.0.8 | 133 | 9/11/2024 | |
1.0.7 | 123 | 9/11/2024 | |
1.0.6 | 127 | 9/11/2024 | |
1.0.5 | 144 | 9/10/2024 | |
1.0.4 | 143 | 9/5/2024 | |
1.0.3 | 124 | 9/5/2024 | |
1.0.2 | 127 | 9/4/2024 | |
1.0.1 | 109 | 9/4/2024 | |
1.0.0 | 117 | 8/28/2024 | |
0.0.1 | 101 | 9/4/2024 |