Class

AkashicPay

AkashicPay()

Class AkashicPay
Constructor

# new AkashicPay()

Do not call this constructor directly; instead, use the factory function AkashicPay.build. The class itself is only exported for developers who want to extend it.

View Source main.ts, line 20

Classes

AkashicPay
build
AkashicPay

Methods

# async static build(args) → {Promise.<AkashicPay.<Environment>>}

Construct and initialise a new AkashicPay instance.
Parameters:
Name Type Description
args APBuilderArgs.<Environment> Differ depending on the environment property (i.e. APBuilderArgs.environment). You must provide the L2-address of an Akashic-Link account, and either the corresponding private-key or recovery-phrase.

View Source main.ts, line 730

Promise.<AkashicPay.<Environment>>

# async protected chooseBestACNode() → {Promise.<(ACNode|ACDevNode)>}

Finds an AkashicChain node to target for requests. If the chain is totally healthy, the SDK will return the fastest node. Otherwise, it will return the node least likely to experience consensus failures as the entry node.

View Source main.ts, line 920

The URL of an AC node on the network matching your environment (production or development)
Promise.<(ACNode|ACDevNode)>

# async createDepositOrder(createDepositOrderParams) → {Promise.<ICreateDepositOrderResponse>}

Create deposit order
Parameters:
Name Type Description
createDepositOrderParams ICreateDepositOrder

View Source main.ts, line 869

Promise.<ICreateDepositOrderResponse>

# async getBalance() → {Promise.<Array.<IBalance>>}

Get total balances, divided by Network and Token.

View Source main.ts, line 836

Promise.<Array.<IBalance>>

# async getByOwnerAndIdentifier(getByOwnerAndIdentifierParams) → {Promise.<IGetByOwnerAndIdentifierResponse>}

Get key by BP and identifier
Parameters:
Name Type Description
getByOwnerAndIdentifierParams IGetByOwnerAndIdentifier

View Source main.ts, line 861

Promise.<IGetByOwnerAndIdentifierResponse>

# async getDepositAddress(network, identifier, referenceId) → {Promise.<IDepositAddress>}

Get an L1-address on the specified network for a user to deposit into
Parameters:
Name Type Description
network NetworkSymbol L1-network
identifier string userID or similar identifier of the user
referenceId string optional referenceId to identify the order making the deposit

View Source main.ts, line 755

Promise.<IDepositAddress>

# async getDepositAddressWithRequestedValue(network, identifier, referenceId, requestedCurrency, requestedAmount, receiveCurrencies, token, markupPercentage) → {Promise.<IDepositAddress>}

Get an L1-address on the specified network for a user to deposit into with requested value callback will match the requested value
Parameters:
Name Type Description
network NetworkSymbol L1-network
identifier string userID or similar identifier of the user
referenceId string referenceId to identify the order making the deposit
requestedCurrency Currency requested currency
requestedAmount string requested amount
receiveCurrencies string optional currencies to be shown in deposit page, comma separated
token TokenSymbol optional token symbol
markupPercentage string optional markup percentage to be applied on exchange rate

View Source main.ts, line 773

Promise.<IDepositAddress>

# async getDepositUrl(identifier, referenceId, receiveCurrencies, networks, redirectUrl) → {Promise.<string>}

Get deposit page url
Parameters:
Name Type Description
identifier string userID or similar identifier of the user
referenceId string optional referenceId to identify the order
receiveCurrencies Array.<Currency> optional currencies to be shown in deposit page, comma separated
networks Array.<Network> optional networks to be shown in deposit page, comma separated
redirectUrl string optional redirect url to be used after making the deposit

View Source main.ts, line 785

Promise.<string>

# async getDepositUrlWithRequestedValue(identifier, referenceId, requestedCurrency, requestedAmount, receiveCurrencies, networks, markupPercentage, redirectUrl) → {Promise.<string>}

Get deposit page url with requested value callback will match the requested value
Parameters:
Name Type Description
identifier string userID or similar identifier of the user
referenceId string referenceId to identify the order
requestedCurrency Currency requested currency
requestedAmount string requested amount
receiveCurrencies Array.<Currency> optional currencies to be shown in deposit page, comma separated
networks Array.<NetworkSymbol> optional networks to be shown in deposit page, comma separated
markupPercentage string optional markup percentage to be applied on exchange rate
redirectUrl string optional redirect url to be used after deposit

View Source main.ts, line 801

Promise.<string>

# async getExchangeRates(requestedCurrency) → {Promise.<IGetExchangeRatesResult>}

Get exchange rates for all supported main-net coins in value of requested currency
Parameters:
Name Type Description
requestedCurrency string

View Source main.ts, line 809

Promise.<IGetExchangeRatesResult>

# async getKeysByOwnerAndIdentifier(getKeysByOwnerAndIdentifierParams) → {Promise.<Array.<IKeyByOwnerAndIdentifier>>}

Get all keys by BP and identifier
Parameters:
Name Type Description
getKeysByOwnerAndIdentifierParams IGetKeysByOwnerAndIdentifier

View Source main.ts, line 877

Promise.<Array.<IKeyByOwnerAndIdentifier>>

# async getSupportedCurrencies() → {Promise.<Record.<string, Array>>}

Get the currently supported currencies in AkashicPay Returns an object with the currency as the keys and a list of networks as the values

View Source main.ts, line 853

Promise.<Record.<string, Array>>

# async getTransactionDetails(l2TxHash) → {Promise.<(ITransaction|undefined)>}

Get details of an individual transaction. Returns undefined if no transaction found for the queried hash
Parameters:
Name Type Description
l2TxHash string L2 AkashicChain Hash of transaction

View Source main.ts, line 845

Promise.<(ITransaction|undefined)>

# async getTransfers(getTransactionParams) → {Promise.<Array.<ITransaction>>}

Get all or a subset of transactions. Optionally paginated with `page` and `limit`. Optional parameters: `layer`, `status`, `startDate`, `endDate`, `hideSmallTransactions`, `identifier`, `referenceId` `hideSmallTransactions` excludes values below 1 USD
Parameters:
Name Type Description
getTransactionParams IGetTransactions

View Source main.ts, line 829

Promise.<Array.<ITransaction>>

# async lookForL2Address(aliasOrL1OrL2Address, network) → {Promise.<ILookForL2AddressResult>}

Check which L2-address an alias or L1-address belongs to. Or call with an L2-address to verify it exists
Parameters:
Name Type Description
aliasOrL1OrL2Address string
network NetworkSymbol

View Source main.ts, line 819

Promise.<ILookForL2AddressResult>

# mapMainToTestCurrency()

Map receive currency from mainnet to testnet if in development

View Source main.ts, line 685

# async payout(referenceId, to, amount, network, tokenopt) → {Promise.<IPayoutResponse>}

Send a crypto-transaction
Parameters:
Name Type Attributes Description
referenceId string userID or similar identifier of the transaction requesting the payout
to string L1 or L2 address of receiver
amount string Amount to send
network NetworkSymbol L1-Network the funds belong to, e.g. `ETH`
token TokenSymbol <optional>
Optional. Include if sending token, e.g. `USDT`

View Source main.ts, line 744

L2 Transaction hash of the transaction or error if something went wrong
Promise.<IPayoutResponse>

# protected setOtkFromKeyPair(privateKey, l2Address) → {void}

Sets your OTK to sign transactions on AkashicChain (AC)
Parameters:
Name Type Description
privateKey string private key from Akashic Link.
l2Address string L2-address of your Akashic account

View Source main.ts, line 930

void

# async protected setOtkFromRecoveryPhrase(recoveryPhrase, l2Address) → {Promise.<void>}

Sets your OTK to sign transactions on AkashicChain (AC)
Parameters:
Name Type Description
recoveryPhrase string The recovery phrase generated when you created your Akashic Link account.
l2Address string L2-address of your Akashic account

View Source main.ts, line 942

Promise.<void>

# verifySignature(body, signature) → {boolean}

Verify HMAC signature against body and secret, sorting keys alphabetically
Parameters:
Name Type Description
body any
signature string

View Source main.ts, line 897

boolean