Documentation

AkashicPay
in package

Table of Contents

Constants

AC_PRIVATE_KEY_REGEX  = '/^0x[a-f\d]{64}$/'
L2_REGEX  = '/^AS[A-Fa-f\d]{64}$/'

Properties

$akashicChain  : AkashicChain
$akashicPayUrl  : string
$akashicUrl  : string
$apiSecret  : string
$env  : string
$httpClient  : HttpClient
$isFxBp  : bool
$logger  : Logger
$otk  : array<string|int, mixed>
$targetNode  : array<string|int, mixed>

Methods

__construct()  : mixed
checkIfBp()  : array<string|int, mixed>
Check if BP
createDepositOrder()  : array<string|int, mixed>
Create deposit order
getBalance()  : array<string|int, mixed>
Get total balances, divided by Network and Token.
getByOwnerAndIdentifier()  : array<string|int, mixed>|null
Get key by BP and identifier
getDepositAddress()  : array<string|int, mixed>
Get an L1-address on the specified network for a user to deposit into
getDepositAddressWithRequestedValue()  : array<string|int, mixed>
Get an L1-address on the specified network for a user to deposit into
getDepositUrl()  : string
Get deposit page url
getDepositUrlWithRequestedValue()  : string
Get deposit page url with requested value Callback will match the requested value
getExchangeRates()  : array<string|int, mixed>
Get exchange rates for all supported main-net coins in value of requested currency
getKeysByOwnerAndIdentifier()  : array<string|int, mixed>|null
Get all keys by BP and identifier
getSupportedCurrencies()  : array<string|int, mixed>
Get the currently supported currencies in AkashicPay
getTransactionDetails()  : array<string|int, mixed>|null
Get details of an individual transaction. Returns null if no transaction found for the queried hash
getTransfers()  : array<string|int, mixed>
Get all or a subset of transactions. Optionally paginated with `page` and `limit`.
lookForL2Address()  : array<string|int, mixed>
Check which L2-address an alias or L1-address belongs to. Or call with an L2-address to verify it exists
payout()  : array<string|int, mixed>|string
Send a crypto-transaction
verifySignature()  : bool
Verify HMAC signature against body and secret with sorted keys
prepareL2Transaction()  : array<string|int, mixed>
Prepares an L2 transaction by sending transaction data to the Akashic API.
boolsToString()  : mixed
chooseBestACNode()  : array<string|int, mixed>
Finds an AkashicChain node to target for requests. The SDK will attempt to find the fastest node for you.
get()  : array<string|int, mixed>|null
getCoinSymbol()  : mixed
getDepositAddressFunc()  : mixed
getDepositUrlFunc()  : mixed
mapMainToTestCurrency()  : string|null
Map receive currency from mainnet to testnet if in development
normalizeTokenInput()  : string|null
Normalize token input (map USDT to TETHER for Tron Shasta network)
normalizeTokenSymbol()  : string|null
Normalize token symbols (map TETHER to USDT)
post()  : array<string|int, mixed>|null
setOtkFromKeyPair()  : void
Sets your OTK to sign transactions on AkashicChain (AC)
setOtkFromRecoveryPhrase()  : void
Sets your OTK to sign transactions on AkashicChain (AC)
sign()  : mixed
sortKeys()  : mixed
Recursively sort array keys for consistent JSON serialization

Constants

AC_PRIVATE_KEY_REGEX

private mixed AC_PRIVATE_KEY_REGEX = '/^0x[a-f\d]{64}$/'

L2_REGEX

private mixed L2_REGEX = '/^AS[A-Fa-f\d]{64}$/'

Properties

$targetNode

private array<string|int, mixed> $targetNode

Methods

__construct()

public __construct(mixed $args) : mixed
Parameters
$args : mixed

checkIfBp()

Check if BP

public checkIfBp(mixed $l2Address) : array<string|int, mixed>
Parameters
$l2Address : mixed
Return values
array<string|int, mixed>

createDepositOrder()

Create deposit order

public createDepositOrder(mixed $payload) : array<string|int, mixed>
Parameters
$payload : mixed
Return values
array<string|int, mixed>

getBalance()

Get total balances, divided by Network and Token.

public getBalance() : array<string|int, mixed>
Return values
array<string|int, mixed>

getByOwnerAndIdentifier()

Get key by BP and identifier

public getByOwnerAndIdentifier(mixed $getByOwnerAndIdentifierParams) : array<string|int, mixed>|null
Parameters
$getByOwnerAndIdentifierParams : mixed
Return values
array<string|int, mixed>|null

address

getDepositAddress()

Get an L1-address on the specified network for a user to deposit into

public getDepositAddress(string $network, string $identifier[, string $referenceId = null ]) : array<string|int, mixed>
Parameters
$network : string

L1-network

$identifier : string

userID or similar identifier of the user making the deposit

$referenceId : string = null

referenceId to identify the order

Return values
array<string|int, mixed>

getDepositAddressWithRequestedValue()

Get an L1-address on the specified network for a user to deposit into

public getDepositAddressWithRequestedValue(string $network, string $identifier, string $referenceId, string $requestedCurrency, string $requestedAmount[, string $token = null ]) : array<string|int, mixed>
Parameters
$network : string

L1-network

$identifier : string

userID or similar identifier of the user making the deposit

$referenceId : string

referenceId to identify the order

$requestedCurrency : string

CurrencySymbol requestedCurrency to identify the order

$requestedAmount : string

requestedAmount to identify the order

$token : string = null

Optional. Include if sending token, e.g. USDT

Return values
array<string|int, mixed>

getDepositUrl()

Get deposit page url

public getDepositUrl(string $identifier[, string $referenceId = null ][, array<string|int, mixed> $receiveCurrencies = null ][, mixed $redirectUrl = null ]) : string
Parameters
$identifier : string

userID or similar identifier of the user making the deposit

$referenceId : string = null

optional referenceId to identify the order

$receiveCurrencies : array<string|int, mixed> = null

optional currencies to be display on deposit page, comma separated

$redirectUrl : mixed = null
Return values
string

getDepositUrlWithRequestedValue()

Get deposit page url with requested value Callback will match the requested value

public getDepositUrlWithRequestedValue(string $identifier, string $referenceId, string $requestedCurrency, string $requestedAmount[, array<string|int, mixed> $receiveCurrencies = null ][, mixed $redirectUrl = null ]) : string
Parameters
$identifier : string

userID or similar identifier of the user making the deposit

$referenceId : string

referenceId to identify the order

$requestedCurrency : string

CurrencySymbol requestedCurrency to identify the order

$requestedAmount : string

requestedAmount to identify the order

$receiveCurrencies : array<string|int, mixed> = null

optional currencies to be display on deposit page, comma separated

$redirectUrl : mixed = null
Return values
string

getExchangeRates()

Get exchange rates for all supported main-net coins in value of requested currency

public getExchangeRates(string $requestedCurrency) : array<string|int, mixed>
Parameters
$requestedCurrency : string
Return values
array<string|int, mixed>

getKeysByOwnerAndIdentifier()

Get all keys by BP and identifier

public getKeysByOwnerAndIdentifier(mixed $getKeysByOwnerAndIdentifierParams) : array<string|int, mixed>|null
Parameters
$getKeysByOwnerAndIdentifierParams : mixed
Return values
array<string|int, mixed>|null

address

getSupportedCurrencies()

Get the currently supported currencies in AkashicPay

public getSupportedCurrencies() : array<string|int, mixed>
Return values
array<string|int, mixed>

with the currency as the keys and a list of networks as the values

getTransactionDetails()

Get details of an individual transaction. Returns null if no transaction found for the queried hash

public getTransactionDetails(string $l2TxHash) : array<string|int, mixed>|null
Parameters
$l2TxHash : string

l2Hash of transaction

Return values
array<string|int, mixed>|null

getTransfers()

Get all or a subset of transactions. Optionally paginated with `page` and `limit`.

public getTransfers(array<string|int, mixed> $getTransactionParams) : array<string|int, mixed>

Optionally parameters: layer, status, startDate, endDate, hideSmallTransactions. hideSmallTransactions excludes values below 1 USD

Parameters
$getTransactionParams : array<string|int, mixed>
Return values
array<string|int, mixed>

lookForL2Address()

Check which L2-address an alias or L1-address belongs to. Or call with an L2-address to verify it exists

public lookForL2Address(string $aliasOrL1OrL2Address[, string|null $network = null ]) : array<string|int, mixed>
Parameters
$aliasOrL1OrL2Address : string
$network : string|null = null
Return values
array<string|int, mixed>

payout()

Send a crypto-transaction

public payout(string $recipientId, string $to, string $amount, string $network[, string|null $token = null ]) : array<string|int, mixed>|string
Parameters
$recipientId : string

userID or similar identifier of the user requesting the payout

$to : string

L1 or L2 address of receiver

$amount : string
$network : string

L1-Network the funds belong to, e.g. ETH

$token : string|null = null

Optional. Include if sending token, e.g. USDT

Return values
array<string|int, mixed>|string

$l2Hash|$error L2 Transaction hash of the transaction or error

verifySignature()

Verify HMAC signature against body and secret with sorted keys

public verifySignature(mixed $body, string $signature) : bool
Parameters
$body : mixed
$signature : string
Return values
bool

prepareL2Transaction()

Prepares an L2 transaction by sending transaction data to the Akashic API.

protected prepareL2Transaction(array<string|int, mixed> $transactionData) : array<string|int, mixed>
Parameters
$transactionData : array<string|int, mixed>

The transaction data required for the L2 withdrawal.

Tags
throws
GuzzleException

If the HTTP request fails.

Return values
array<string|int, mixed>

The signed transactionData

boolsToString()

private boolsToString(mixed $value) : mixed
Parameters
$value : mixed

chooseBestACNode()

Finds an AkashicChain node to target for requests. The SDK will attempt to find the fastest node for you.

private chooseBestACNode() : array<string|int, mixed>
Tags
Returns

string The URL of an AC node on the network matching your environment (production or development)

Return values
array<string|int, mixed>

get()

private get(string $url) : array<string|int, mixed>|null
Parameters
$url : string
Return values
array<string|int, mixed>|null

getCoinSymbol()

private getCoinSymbol(mixed $key) : mixed
Parameters
$key : mixed

getDepositAddressFunc()

private getDepositAddressFunc(mixed $network, mixed $identifier[, mixed $referenceId = null ][, mixed $token = null ][, mixed $requestedCurrency = null ][, mixed $requestedAmount = null ]) : mixed
Parameters
$network : mixed
$identifier : mixed
$referenceId : mixed = null
$token : mixed = null
$requestedCurrency : mixed = null
$requestedAmount : mixed = null

getDepositUrlFunc()

private getDepositUrlFunc(mixed $identifier[, mixed $referenceId = null ][, mixed $receiveCurrencies = null ][, mixed $redirectUrl = null ][, mixed $requestedCurrency = null ][, mixed $requestedAmount = null ]) : mixed
Parameters
$identifier : mixed
$referenceId : mixed = null
$receiveCurrencies : mixed = null
$redirectUrl : mixed = null
$requestedCurrency : mixed = null
$requestedAmount : mixed = null

mapMainToTestCurrency()

Map receive currency from mainnet to testnet if in development

private mapMainToTestCurrency(string|null $currency) : string|null
Parameters
$currency : string|null
Return values
string|null

normalizeTokenInput()

Normalize token input (map USDT to TETHER for Tron Shasta network)

private normalizeTokenInput(string $network, string|null $token) : string|null
Parameters
$network : string
$token : string|null
Return values
string|null

normalizeTokenSymbol()

Normalize token symbols (map TETHER to USDT)

private normalizeTokenSymbol(string|null $symbol) : string|null
Parameters
$symbol : string|null
Return values
string|null

post()

private post(string $url, mixed $payload) : array<string|int, mixed>|null
Parameters
$url : string
$payload : mixed
Return values
array<string|int, mixed>|null

setOtkFromKeyPair()

Sets your OTK to sign transactions on AkashicChain (AC)

private setOtkFromKeyPair(string $privateKey, string $l2Address) : void
Parameters
$privateKey : string

private key from Akashic Link.

$l2Address : string

L2-address of your Akashic account

setOtkFromRecoveryPhrase()

Sets your OTK to sign transactions on AkashicChain (AC)

private setOtkFromRecoveryPhrase(string $recoveryPhrase, string $l2Address) : void
Parameters
$recoveryPhrase : string

the recovery phrase generated when you created your Akashic Link account.

$l2Address : string

L2-address of your Akashic account

sign()

private sign(mixed $data) : mixed
Parameters
$data : mixed

sortKeys()

Recursively sort array keys for consistent JSON serialization

private sortKeys(mixed $obj) : mixed
Parameters
$obj : mixed

        
On this page

Search results