Class ApSdk
- Namespace
- AkashicPaySDK.Sdk
- Assembly
- AkashicPaySDK.dll
public sealed class ApSdk : IApSdk, IDisposable
- Inheritance
-
ApSdk
- Implements
- Inherited Members
Constructors
ApSdk(APEnvironment, ApBaseUrl, AcBaseContract, AcOtk, UriInfo, string?)
public ApSdk(APEnvironment environment, ApBaseUrl apBaseUrl, AcBaseContract contract, AcOtk otk, AcBaseNode.UriInfo acTargetNode, string? apiSecret = null)
Parameters
environmentAPEnvironmentapBaseUrlApBaseUrlcontractAcBaseContractotkAcOtkacTargetNodeAcBaseNode.UriInfoapiSecretstring
ApSdk(APEnvironment, ApBaseUrl, AcBaseContract, AcOtk, string?)
public ApSdk(APEnvironment environment, ApBaseUrl apBaseUrl, AcBaseContract contract, AcOtk otk, string? apiSecret = null)
Parameters
environmentAPEnvironmentapBaseUrlApBaseUrlcontractAcBaseContractotkAcOtkapiSecretstring
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetBalanceAsync()
Gets the current balance of the account associated with the SDK.
public Task<ApBalanceResult?> GetBalanceAsync()
Returns
- Task<ApBalanceResult>
The result containing balance details, or null if the account is not initialized or inaccessible.
GetDepositAddressAsync(BaseNetworkSymbol, string, string?)
Gets a deposit address for the specified network and identifier.
public Task<ApDepositAddressResult> GetDepositAddressAsync(BaseNetworkSymbol networkSymbol, string identifier, string? referenceId = null)
Parameters
networkSymbolBaseNetworkSymbolThe blockchain network symbol (e.g., ETH, TRON).
identifierstringThe user or client identifier.
referenceIdstringOptional client-provided reference ID for tracking.
Returns
- Task<ApDepositAddressResult>
The result containing the deposit address.
GetDepositAddressWithRequestedValueAsync(ApDepositAddressWithRequestedValueRequest)
Gets a deposit address based on a single, strongly-typed request object. Use this overload when you already have an ApDepositAddressWithRequestedValueRequest instance that includes the network, identifier, reference ID, requested currency, requested amount, and token information.
public Task<ApExtendedDepositAddressResult> GetDepositAddressWithRequestedValueAsync(ApDepositAddressWithRequestedValueRequest request)
Parameters
requestApDepositAddressWithRequestedValueRequestThe request object that bundles all parameters required to generate an extended deposit address.
Returns
- Task<ApExtendedDepositAddressResult>
An ApExtendedDepositAddressResult containing the deposit address and related metadata for the specified request.
GetDepositAddressWithRequestedValueAsync(BaseNetworkSymbol, string, string, ApCurrencySymbol, double, ApTokenSymbol)
Gets a deposit address for a specific currency and amount. Useful for requests that specify how much and in what token the user wants to deposit.
public Task<ApExtendedDepositAddressResult> GetDepositAddressWithRequestedValueAsync(BaseNetworkSymbol network, string identifier, string referenceId, ApCurrencySymbol requestedCurrency, double requestedAmount, ApTokenSymbol token)
Parameters
networkBaseNetworkSymbolThe blockchain network (e.g., ETH, BSC).
identifierstringThe user or application identifier.
referenceIdstringA reference ID to correlate this request with the client system.
requestedCurrencyApCurrencySymbolThe currency intended for deposit (e.g., USDT).
requestedAmountdoubleThe amount intended to be deposited.
tokenApTokenSymbolThe token symbol used in the network.
Returns
- Task<ApExtendedDepositAddressResult>
The result containing extended deposit address details.
GetDepositUrlAsync(ApDepositUrlRequest)
Retrieves a deposit URL using a strongly-typed request object.
public Task<ApDepositUrlResult> GetDepositUrlAsync(ApDepositUrlRequest request)
Parameters
requestApDepositUrlRequestThe deposit URL request including identifier and optional reference ID.
Returns
- Task<ApDepositUrlResult>
The result containing the generated deposit URL.
GetDepositUrlAsync(string, string?)
Retrieves a deposit URL for a specific identifier. This URL can be shared with a user to initiate a deposit session.
public Task<ApDepositUrlResult> GetDepositUrlAsync(string identifier, string? referenceId = null)
Parameters
identifierstringThe identifier associated with the deposit.
referenceIdstringOptional client-provided reference ID for tracking.
Returns
- Task<ApDepositUrlResult>
A task that represents the asynchronous operation, containing the deposit URL result.
GetDepositUrlWithRequestedValueAsync(ApDepositUrlWithRequestedValueRequest)
Retrieves a deposit URL with a strongly-typed request containing deposit expectations.
public Task<ApDepositUrlResult> GetDepositUrlWithRequestedValueAsync(ApDepositUrlWithRequestedValueRequest request)
Parameters
requestApDepositUrlWithRequestedValueRequestThe request containing all parameters for generating a deposit URL.
Returns
- Task<ApDepositUrlResult>
The result containing the deposit URL.
GetDepositUrlWithRequestedValueAsync(string, string, ApCurrencySymbol, double)
Retrieves a deposit URL where the user intends to deposit a specific currency and amount.
public Task<ApDepositUrlResult> GetDepositUrlWithRequestedValueAsync(string identifier, string referenceId, ApCurrencySymbol requestedCurrency, double requestedAmount)
Parameters
identifierstringThe identifier associated with the deposit.
referenceIdstringA client-side reference ID to associate with this request.
requestedCurrencyApCurrencySymbolThe currency the user wants to deposit.
requestedAmountdoubleThe expected deposit amount.
Returns
- Task<ApDepositUrlResult>
The result containing the deposit URL with pre-configured expectations.
GetExchangeRatesAsync(ApCurrencySymbol)
Gets the latest exchange rates for the given currency.
public Task<ApExchangeRatesResult> GetExchangeRatesAsync(ApCurrencySymbol currencySymbol)
Parameters
currencySymbolApCurrencySymbolThe base currency symbol for exchange rate lookup.
Returns
- Task<ApExchangeRatesResult>
The result containing current exchange rates.
GetKeysByOwnerAndIdentifierAsync(string)
Retrieves public keys or verification keys associated with the given identifier.
public Task<ApKeysByIdentifierResult> GetKeysByOwnerAndIdentifierAsync(string identifier)
Parameters
identifierstringThe unique identifier (e.g., user or app ID).
Returns
- Task<ApKeysByIdentifierResult>
The result containing the associated key information.
GetSupportedCurrenciesAsync()
Gets the list of currencies that currently support deposits and payouts.
public Task<ApSupportedCurrenciesResult> GetSupportedCurrenciesAsync()
Returns
- Task<ApSupportedCurrenciesResult>
The result containing the supported currency information.
GetTransactionDetailAsync(string)
Retrieves detailed information about a transaction using its L2 transaction hash.
public Task<ApTransactionDetailResult?> GetTransactionDetailAsync(string l2TxHash)
Parameters
l2TxHashstringThe L2 transaction hash (unique ID from Layer 2).
Returns
- Task<ApTransactionDetailResult>
The result containing transaction details, or null if not found.
GetTransfersAsync(ApTransactionsParam)
Retrieves a list of transfers based on the provided filter parameters.
public Task<ApTransfersResult> GetTransfersAsync(ApTransactionsParam param)
Parameters
paramApTransactionsParamThe filtering parameters for transactions (e.g., date range, type).
Returns
- Task<ApTransfersResult>
The result containing the list of matching transfers.
Init()
Initializes the SDK by setting up internal configurations and authentication. This method must be called before using any other SDK functionalities.
public Task Init()
Returns
PayoutAsync(string, string, double, BaseNetworkSymbol)
Performs a payout using the default token for the specified network.
public Task<ApPayoutResult> PayoutAsync(string referenceId, string to, double amount, BaseNetworkSymbol networkSymbol)
Parameters
referenceIdstringThe internal recipient identifier.
tostringThe blockchain address to send funds to.
amountdoubleThe amount to send.
networkSymbolBaseNetworkSymbolThe blockchain network.
Returns
- Task<ApPayoutResult>
The result of the payout operation.
PayoutAsync(string, string, double, BaseNetworkSymbol, ApTokenSymbol)
Performs a payout to a recipient using the specified token.
public Task<ApPayoutResult> PayoutAsync(string referenceId, string to, double amount, BaseNetworkSymbol networkSymbol, ApTokenSymbol tokenSymbol)
Parameters
referenceIdstringThe internal recipient identifier.
tostringThe blockchain address to send funds to.
amountdoubleThe amount to send.
networkSymbolBaseNetworkSymbolThe blockchain network.
tokenSymbolApTokenSymbolThe token symbol used for the payout.
Returns
- Task<ApPayoutResult>
The result of the payout operation.
SetHttpClient(HttpClient)
Sets a custom HttpClient instance to be used by the SDK for all network operations. Use this method if you need to configure specific HTTP settings (e.g., custom handlers, timeouts, connection pool or proxies). If this method is not called, the SDK will automatically create and manage its own default HttpClient.
public void SetHttpClient(HttpClient httpClient)
Parameters
httpClientHttpClientThe HttpClient instance to be used by the SDK.
VerifySignature(string, string)
Verifies the digital signature of a request body.
public bool VerifySignature(string body, string signature)
Parameters
bodystringThe raw body content of the request.
signaturestringThe signature to verify against the body.
Returns
- bool
True if the signature is valid; otherwise, false.