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
environment
APEnvironmentapBaseUrl
ApBaseUrlcontract
AcBaseContractotk
AcOtkacTargetNode
AcBaseNode.UriInfoapiSecret
string
ApSdk(APEnvironment, ApBaseUrl, AcBaseContract, AcOtk, string?)
public ApSdk(APEnvironment environment, ApBaseUrl apBaseUrl, AcBaseContract contract, AcOtk otk, string? apiSecret = null)
Parameters
environment
APEnvironmentapBaseUrl
ApBaseUrlcontract
AcBaseContractotk
AcOtkapiSecret
string
Methods
Dispose()
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
networkSymbol
BaseNetworkSymbolThe blockchain network symbol (e.g., ETH, TRON).
identifier
stringThe user or client identifier.
referenceId
stringOptional client-provided reference ID for tracking.
Returns
- Task<ApDepositAddressResult>
The result containing the deposit address.
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
network
BaseNetworkSymbolThe blockchain network (e.g., ETH, BSC).
identifier
stringThe user or application identifier.
referenceId
stringA reference ID to correlate this request with the client system.
requestedCurrency
ApCurrencySymbolThe currency intended for deposit (e.g., USDT).
requestedAmount
doubleThe amount intended to be deposited.
token
ApTokenSymbolThe 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
request
ApDepositUrlRequestThe 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
identifier
stringThe identifier associated with the deposit.
referenceId
stringOptional 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
request
ApDepositUrlWithRequestedValueRequestThe 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
identifier
stringThe identifier associated with the deposit.
referenceId
stringA client-side reference ID to associate with this request.
requestedCurrency
ApCurrencySymbolThe currency the user wants to deposit.
requestedAmount
doubleThe 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
currencySymbol
ApCurrencySymbolThe 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
identifier
stringThe unique identifier (e.g., user or app ID).
Returns
- Task<ApKeysByIdentifierResult>
The result containing the associated key information.
GetTransactionDetailAsync(string)
Retrieves detailed information about a transaction using its L2 transaction hash.
public Task<ApTransactionDetailResult?> GetTransactionDetailAsync(string l2TxHash)
Parameters
l2TxHash
stringThe 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
param
ApTransactionsParamThe 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 recipientId, string to, double amount, BaseNetworkSymbol networkSymbol)
Parameters
recipientId
stringThe internal recipient identifier.
to
stringThe blockchain address to send funds to.
amount
doubleThe amount to send.
networkSymbol
BaseNetworkSymbolThe 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 recipientId, string to, double amount, BaseNetworkSymbol networkSymbol, ApTokenSymbol tokenSymbol)
Parameters
recipientId
stringThe internal recipient identifier.
to
stringThe blockchain address to send funds to.
amount
doubleThe amount to send.
networkSymbol
BaseNetworkSymbolThe blockchain network.
tokenSymbol
ApTokenSymbolThe token symbol used for the payout.
Returns
- Task<ApPayoutResult>
The result of the payout operation.
VerifySignature(string, string)
Verifies the digital signature of a request body.
public bool VerifySignature(string body, string signature)
Parameters
body
stringThe raw body content of the request.
signature
stringThe signature to verify against the body.
Returns
- bool
True if the signature is valid; otherwise, false.