Class: DockAPI

DockAPI(customSignTxopt)

Helper class to interact with the Dock chain

Constructor

new DockAPI(customSignTxopt)

Creates a new instance of the DockAPI object, call init to initialize
Parameters:
Name Type Attributes Description
customSignTx function <optional>
Optional custom transaction sign method, a function that expects `extrinsic` as first argument and a dock api instance as second argument
Source:

Members

anchor

Gets the SDK's Anchor module
Source:

blob

Gets the SDK's Blob module
Source:

did

Gets the SDK's DID module
Source:

isConnected

Checks if the API instance is connected to the node
Source:

revocation

Gets the SDK's revocation module
Source:

Methods

getAccount() → {KeyringPair}

Gets the current account used to sign transactions
Source:
Returns:
PolkadotJS Keyring account
Type
KeyringPair

(async) send(extrinsic, waitForFinalization) → {Promise.<unknown>}

Helper function to send a transaction that has already been signed
Parameters:
Name Type Default Description
extrinsic Extrinsic to send
waitForFinalization true If true, waits for extrinsic's block to be finalized, else only wait to be included in block.
Source:
Returns:
Type
Promise.<unknown>

setAccount(account)

TODO: Should probably use set/get and rename account to _account Sets the account used to sign transactions
Parameters:
Name Type Description
account KeyringPair PolkadotJS Keyring account
Source:

(async) signAndSend(extrinsic, waitForFinalization, params) → {Promise}

Helper function to sign and send transaction
Parameters:
Name Type Default Description
extrinsic object Extrinsic to sign and send
waitForFinalization Boolean true If true, waits for extrinsic's block to be finalized, else only wait to be included in block.
params object An object used to parameters like nonce, etc to the extrinsic
Source:
Returns:
Type
Promise

(async) signExtrinsic(extrinsic, params) → {Promise}

Signs an extrinsic with either the set account or a custom sign method (see constructor)
Parameters:
Name Type Description
extrinsic object Extrinsic to send
params object An object used to parameters like nonce, etc to the extrinsic
Source:
Returns:
Type
Promise