dispatchUpdateToChain
dispatchUpdateToChain(
stmtEntry,authorAccount,authorizationUri):Promise<StatementUri>
Dispatches a statement update transaction to the CORD blockchain.
Parameters
Section titled “Parameters”• stmtEntry: IStatementEntry
The statement entry object containing the necessary information for updating the statement on the blockchain. This includes the digest, element URI, creator URI, space URI, and optionally a schema URI.
• authorAccount: CordKeyringPair
The blockchain account used to sign and submit the transaction.
• authorizationUri: `auth:cord:${string}`
The URI of the authorization used for the statement.
Returns
Section titled “Returns”Promise<StatementUri>
The element URI of the updated statement.
Remarks
Section titled “Remarks”This function is used to update an existing statement on the blockchain. It first checks if the statement with the given digest and space URI already exists. If it does, the function constructs and submits a transaction to update the statement. The transaction is authorized by the creator and signed by the provided author account.
Throws
Section titled “Throws”- Thrown when there is an error during the dispatch process, such as issues with constructing the transaction, signing, or submission to the blockchain.
Example
Section titled “Example”const stmtEntry = { // ... initialization of statement properties ...};const creatorUri = 'did:cord:creator_uri';const authorAccount = // ... initialization ...const authorizationUri = 'auth:cord:example_uri';const signCallback = // ... implementation ...
dispatchUpdateToChain(stmtEntry, creatorUri, authorAccount, authorizationUri, signCallback) .then(statementUri => { console.log('Statement updated with URI:', statementUri); }) .catch(error => { console.error('Error dispatching statement update to chain:', error); });