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 |
Members
anchor
Gets the SDK's Anchor module
blob
Gets the SDK's Blob module
did
Gets the SDK's DID module
isConnected
Checks if the API instance is connected to the node
revocation
Gets the SDK's revocation module
Methods
getAccount() → {KeyringPair}
Gets the current account used to sign transactions
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. |
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 |
(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 |
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 |
Returns:
- Type
- Promise