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
$akashicUrl  : string
$env  : string
$httpClient  : HttpClient
$logger  : Logger
$otk  : array<string|int, mixed>
$targetNode  : array<string|int, mixed>

Methods

__construct()  : mixed
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
getKeyBackup()  : array<string|int, mixed>
Get the OTK (One-Time-Key) object for this instance.
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>
Send a crypto-transaction
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
post()  : array<string|int, mixed>|null
setNewOTK()  : void
Generates a new OTK and assigns it to `this.otk`. The OTK will live and die with the lifetime of this AkashicPay instance.
setOtkFromKeyPair()  : void
Sets your OTK to sign transactions on AkashicChain (AC)
setOtkFromRecoveryPhrase()  : void
Sets your OTK to sign transactions on AkashicChain (AC)

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

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) : array<string|int, mixed>
Parameters
$network : string

L1-network

$identifier : string

userID or similar identifier of the user making the deposit

Return values
array<string|int, mixed>

getKeyBackup()

Get the OTK (One-Time-Key) object for this instance.

public getKeyBackup() : array<string|int, mixed>
Tags
throws
Exception

if the environment is production.

Return values
array<string|int, mixed>

if the environment is development. This enables you to easily create an OTK and re-use it in future tests or dev work.

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>
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>

L2 Transaction hash of the transaction

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

post()

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

setNewOTK()

Generates a new OTK and assigns it to `this.otk`. The OTK will live and die with the lifetime of this AkashicPay instance.

private setNewOTK() : void

Only for us in development/testing environments.

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


        
On this page

Search results