dispatchRemoveDelegateToChain
dispatchRemoveDelegateToChain(
registryUri
,removeAuthorizationUri
,namespaceAuthorizationUri
,authorizationUri
,authorAccount
):Promise
<object
>
Removes a delegate from a registry on the chain.
This method is used to remove a delegate’s authorization from a given registry. It checks whether the registry and the provided authorization exist on-chain, constructs the required parameters, and dispatches the extrinsic to the blockchain for execution.
Parameters
• registryUri: `registry:cord:${string}`
The URI of the registry from which the delegate will be removed.
• removeAuthorizationUri: `registryauth:cord:${string}`
The URI of the authorization to be removed (i.e., the delegate’s authorization).
• namespaceAuthorizationUri: `namespaceauth:cord:${string}`
The URI of the namespace authorization associated with the registry.
• authorizationUri: `registryauth:cord:${string}`
The URI of the authorization of the account performing the removal (the caller’s authorization).
• authorAccount: CordKeyringPair
The account key pair of the entity removing the delegate, used for signing the transaction.
Returns
Promise
<object
>
An object containing the URIs related to the registry and authorizations.
- uri
: The URI of the registry.
- removeAuthorizationUri
: The authorization URI of the delegate being removed.
- namespaceAuthorizationUri
: The authorization URI of the namespace.
- authorizationUri
: The authorization URI of the signer performing the removal.
authorizationUri
authorizationUri:
RegistryAuthorizationUri
removeAuthorizationUri
removeAuthorizationUri:
RegistryAuthorizationUri
uri
uri:
RegistryUri
Async
Function
Throws
- If the registry URI does not exist on-chain.
- If the authorization URI of the signer does not exist on-chain.
- If an error occurs while dispatching the transaction to the chain.
Example
const registryUri = 'did:cord:registry:3abc...';const removeAuthorizationUri = 'did:cord:auth:3xyz...';const namespaceAuthorizationUri = 'did:cord:auth:238342...';const authorizationUri = 'did:cord:auth:3signer...';const authorAccount = keyring.addFromUri('//Alice');
dispatchRemoveDelegateToChain(registryUri, removeAuthorizationUri, authorizationUri, authorAccount) .then(result => { console.log('Delegate removed:', result); }) .catch(error => { console.error('Error removing delegate:', error); });
Description
The function first verifies the existence of the registry and the signer’s authorization on the blockchain. It then encodes the provided URIs into identifiers and submits a signed transaction to remove the delegate from the registry. If the removal is successful, it returns an object with the registry URI and relevant authorization URIs.