Skip to content

dispatchDelegateAuthorization

dispatchDelegateAuthorization(request, namespaceAuthorizationUri, delegatorAuthorizationUri, authorAccount): Promise<RegistryAuthorizationUri>

Dispatches a transaction to authorize a delegate for a specified registry.

This function checks the existence of the registry and the authorization for the delegator, then constructs an extrinsic to add the delegate authorization with the given permission. It submits the transaction to the chain and throws an error if any step fails.

Parameters

request: IRegistryAuthorization

The authorization request object, containing the registry URI, delegate URI, and permission.

namespaceAuthorizationUri: `namespaceauth:cord:${string}`

: The URI for the associated namespace authorization. @param delegatorAuthorizationUri - The authorization URI of the delegator authorizing the action. @param authorAccount - The account of the author who signs and submits the transaction. @returns The RegistryAuthorizationUri` after successfully dispatching the authorization.

delegatorAuthorizationUri: `registryauth:cord:${string}`

authorAccount: CordKeyringPair

Returns

Promise<RegistryAuthorizationUri>

Throws

If the registry or authorization does not exist, or if there’s an error during dispatch.

Example

// Example: Dispatch a delegate authorization to the chain
const authorizationUri = await dispatchDelegateAuthorization(
{
uri: 'registryUri123',
delegateUri: 'did:cord:3delegate123',
permission: RegistryPermission.ADMIN
},
'namespaceAuthUri123',
'delegatorAuthorizationUri456',
authorAccount
);
console.log('Authorization dispatched with URI:', authorizationUri);

Source

registries/src/Registries.chain.ts:705