UNPKG

@akashicpay/sdk

Version:

SDK to interact with the Akashic ecosystem

55 lines (54 loc) 5.14 kB
import { type Logger } from 'winston'; import { AkashicChain } from './akashicChain'; import type { ICreateDepositOrderResponse, IGetByOwnerAndIdentifierResponse, IKeyByOwnerAndIdentifier, IKeyCreationResponse, IPrepareL2Withdrawal, IPrepareL2WithdrawalResponse } from './APACTypes'; import { Environment } from './constants'; import { type ACNodeT, type AkashicPayUrlT, type AkashicUrlT, type APBuilderArgs, type APConstructorArgs, type APInitialisationArgs, Currency, type HTTPResponse, type IBalance, type ICreateDepositOrder, type IDepositAddress, type IGetByOwnerAndIdentifier, type IGetExchangeRatesResult, type IGetKeysByOwnerAndIdentifier, type IGetTransactions, type IHttpClient, type ILookForL2AddressResult, type IPayoutResponse, type ITransaction, NetworkSymbol, TokenSymbol } from './types'; export declare class AkashicPay<Env extends Environment = Environment.Production> { #private; static readonly ACPrivateKeyRegex: RegExp; private isFxBp; protected targetNode: ACNodeT<Env>; protected akashicUrl: AkashicUrlT<Env>; protected akashicPayUrl: AkashicPayUrlT<Env>; protected logger: Logger; protected env: Env; protected httpClient: IHttpClient; protected akashicChain: AkashicChain; protected apiSecret: string | undefined; static build<Env extends Environment = Environment.Production>(args: APBuilderArgs<Env>): Promise<AkashicPay<Env>>; validateDecimalPlaces(amount: string, network: NetworkSymbol, token?: TokenSymbol): Promise<void>; payout(referenceId: string, to: string, amount: string, network: NetworkSymbol, token?: TokenSymbol): Promise<IPayoutResponse>; getDepositAddress(network: NetworkSymbol, identifier: string, referenceId?: string): Promise<IDepositAddress>; getDepositAddressWithRequestedValue(network: NetworkSymbol, identifier: string, referenceId: string, requestedCurrency: Currency, requestedAmount: string, token?: TokenSymbol, markupPercentage?: string): Promise<IDepositAddress>; protected getDepositAddressFunc(network: NetworkSymbol, identifier: string, referenceId?: string, token?: TokenSymbol, requestedCurrency?: Currency, requestedAmount?: string, markupPercentage?: string): Promise<IDepositAddress>; protected bulkCreateOrAssignKeys(networks: NetworkSymbol[], identifier: string): Promise<void>; protected createKey(network: NetworkSymbol, identifier: string): Promise<IKeyCreationResponse>; createDepositPayloadAndOrder(referenceId: string, identifier: string, address: string, network: NetworkSymbol, tokenSymbol?: TokenSymbol, requestedCurrency?: Currency, requestedAmount?: string, markupPercentage?: string): Promise<ICreateDepositOrderResponse>; getDepositUrl(identifier: string, referenceId?: string, receiveCurrencies?: Currency[], networks?: NetworkSymbol[], redirectUrl?: string): Promise<string>; getDepositUrlWithRequestedValue(identifier: string, referenceId: string, requestedCurrency: Currency, requestedAmount: string, receiveCurrencies?: Currency[], networks?: NetworkSymbol[], markupPercentage?: string, redirectUrl?: string): Promise<string>; protected getDepositUrlFunc(identifier: string, referenceId?: string, receiveCurrencies?: Currency[], networks?: NetworkSymbol[], redirectUrl?: string, requestedCurrency?: Currency, requestedAmount?: string, markupPercentage?: string): Promise<string>; verifyDepositAddress(): unknown; getExchangeRates(requestedCurrency: Currency): Promise<IGetExchangeRatesResult>; lookForL2Address(aliasOrL1OrL2Address: string, network?: NetworkSymbol): Promise<ILookForL2AddressResult>; getTransfers(getTransactionParams: IGetTransactions): Promise<ITransaction[]>; getBalance(): Promise<IBalance[]>; getTransactionDetails(l2TxHash: string): Promise<ITransaction | undefined>; getSupportedCurrencies(): Promise<Record<string, string[]>>; protected getPreseedNetworks(): Promise<NetworkSymbol[]>; getByOwnerAndIdentifier(getByOwnerAndIdentifierParams: IGetByOwnerAndIdentifier): Promise<IGetByOwnerAndIdentifierResponse>; createDepositOrder(createDepositOrderParams: ICreateDepositOrder): Promise<ICreateDepositOrderResponse>; getKeysByOwnerAndIdentifier(getKeysByOwnerAndIdentifierParams: IGetKeysByOwnerAndIdentifier): Promise<IKeyByOwnerAndIdentifier[]>; protected constructor(args: APConstructorArgs<Env>); verifySignature(body: any, signature: string): boolean; protected init(args: APInitialisationArgs): Promise<void>; protected chooseBestACNode(): Promise<ACNodeT<Env>>; protected setOtkFromKeyPair(privateKey: string, l2Address: string): void; protected setOtkFromRecoveryPhrase(recoveryPhrase: string, l2Address: string): Promise<void>; protected post<T>(url: string, payload: unknown): Promise<HTTPResponse<T>>; protected get<T>(url: string): Promise<HTTPResponse<T>>; protected prepareL2Transaction(transactionData: IPrepareL2Withdrawal): Promise<IPrepareL2WithdrawalResponse>; protected sign(otkPriv: string, data: string | Record<string, unknown>): string; private sortKeys; private mapUSDTToTether; private mapMainToTestCurrency; }