Class: BlobModule

BlobModule(api, signAndSend)

Class to create and update Blobs on chain.

Constructor

new BlobModule(api, signAndSend)

Creates a new instance of BlobModule and sets the api
Parameters:
Name Type Description
api object PolkadotJS API Reference
signAndSend
Source:

Methods

(async) createNewTx(blob, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create a signed transaction for adding a new blob
Parameters:
Name Type Description
blob
signerDid Signer of the blob
signingKeyRef The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createSignedAddBlob(blob, signerDid, signingKeyRef, nonce, didModule) → {Promise}

Create an `AddBlob` struct as expected by node and return along with signature.
Parameters:
Name Type Description
blob
signerDid DockDidOrDidMethodKey Signer DID
signingKeyRef The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise

(async) get(id) → {Promise.<Array>}

Get blob with given id from the chain. Throws if the blob can't be found.
Parameters:
Name Type Description
id string Can either be a full blob id like blob:dock:0x... or just the hex identifier
Source:
Returns:
- A 2-element array where the first is the author and the second is the blob contents.
Type
Promise.<Array>

getSerializedBlob(blob) → {Array}

Serializes the `Blob` (for signing before sending to the node)
Parameters:
Name Type Description
blob object `Blob` as expected by the Substrate node
Source:
Returns:
An array of Uint8
Type
Array

(async) new(blob, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Write a new blob on chain.
Parameters:
Name Type Description
blob
signerDid Signer of the blob
signingKeyRef The key id used by the signer. This will be used by the verifier (node) to fetch the public key for verification
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>