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 17

Classes

AkashicPay
build
AkashicPay

Members

KeyBackup

# keyBackup

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

View Source main.ts, line 55

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.

View Source main.ts, line 439

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.

View Source main.ts, line 548

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.

View Source main.ts, line 498

Promise.<Array.<IBalance>>

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

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

View Source main.ts, line 515

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

View Source main.ts, line 471

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

View Source main.ts, line 507

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

View Source main.ts, line 491

Promise.<Array.<ITransaction>>

# keyBackup() → {KeyBackup}

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

View Source main.ts, line 448

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

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

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`

View Source main.ts, line 461

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.

View Source main.ts, line 559

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

View Source main.ts, line 569

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 581

Promise.<void>