Skip to content

dispatchRestoreToChain

dispatchRestoreToChain(statementUri, creatorUri, authorAccount, authorizationUri, signCallback): Promise<void>

Dispatches a statement restoration transaction to the CORD blockchain.

Parameters

statementUri: stmt:cord:${string}

The URI of the statement to be restored.

creatorUri: did:cord:3${string}

The DID URI of the creator of the statement. This identifier is used to authorize the transaction.

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.

signCallback: SignExtrinsicCallback

A callback function that handles the signing of the transaction.

Returns

Promise<void>

A promise that resolves once the transaction is successfully processed.

Remarks

This function is responsible for restoring a previously revoked statement on the blockchain. It constructs and submits a transaction to restore the statement identified by the given URI. The transaction is authorized by the creator and signed by the provided author account.

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

const statementUri = 'stmt:cord:example_uri';
const creatorUri = 'did:cord:creator_uri';
const authorAccount = // ... initialization ...
const authorizationUri = 'auth:cord:example_uri';
const signCallback = // ... implementation ...
dispatchRestoreToChain(statementUri, creatorUri, authorAccount, authorizationUri, signCallback)
.then(() => {
console.log('Statement successfully restored.');
})
.catch(error => {
console.error('Error dispatching statement restoration to chain:', error);
});

Source

statement/src/Statement.chain.ts:535