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.
Classes
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). In production, you must provide the L2-address of an Akashic-Link account, and either the corresponding private-key or recovery-phrase. In development, these arguments are optional; if not provided, a new OTK will be generated during initialisation. It can be retrieved with `.keyBackup` so that you may save it and supply it next time. |
Promise.<AkashicPay.<Environment>>
# async protected chooseBestACNode() → {Promise.<(ACNode|ACDevNode)>}
Finds an AkashicChain node to target for requests. The SDK will attempt to
find the fastest node for you.
The URL of an AC node on the network matching your environment
(production or development)
Promise.<(ACNode|ACDevNode)>
# async getBalance() → {Promise.<Array.<IBalance>>}
Get total balances, divided by Network and Token.
Promise.<Array.<IBalance>>
# async getByOwnerAndIdentifier(getByOwnerAndIdentifierParams) → {Promise.<IGetByOwnerAndIdentifierResposne>}
Get key by BP and identifier
Parameters:
Name | Type | Description |
---|---|---|
getByOwnerAndIdentifierParams |
IGetByOwnerAndIdentifier
|
Promise.<IGetByOwnerAndIdentifierResposne>
# async getDepositAddress(network, identifier) → {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 making the deposit |
Promise.<IDepositAddress>
# 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 |
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`.
`hideSmallTransactions` excludes values below 1 USD
Parameters:
Name | Type | Description |
---|---|---|
getTransactionParams |
IGetTransactions
|
Promise.<Array.<ITransaction>>
# keyBackup() → {KeyBackup}
Get the OTK (One-Time-Key) object for this instance.
if the environment is production.
Error
if the environment is development. This enables you to
easily create an OTK and re-use it in future tests or dev work.
# 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
|
Promise.<ILookForL2AddressResult>
# async payout(recipientId, to, amount, network, tokenopt) → {Promise.<IPayoutResponse>}
Send a crypto-transaction
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
recipientId |
string
|
userID or similar identifier of the user 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` |
L2 Transaction hash of the transaction
Promise.<IPayoutResponse>
# async protected setNewOTK() → {Promise.<void>}
Generates a new OTK and assigns it to `this.otk`. The OTK will live and die
with the lifetime of this AkashicPay instance.
Only for us in development/testing environments.
Promise.<void>
# 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 |
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 |
Promise.<void>