dispatchDelegateAuthorization
dispatchDelegateAuthorization(
request,authorAccount,authorizationUri):Promise<AuthorizationId>
Dispatches a delegate authorization transaction to the CORD blockchain.
Parameters
Section titled “Parameters”• request: ISpaceAuthorizationAccountType
The space authorization request containing necessary information for dispatching the authorization.
• authorAccount: CordKeyringPair
The blockchain account used to sign and submit the transaction.
• authorizationUri: `auth:cord:${string}`
The URI of the authorization used for delegating permissions.
Returns
Section titled “Returns”Promise<AuthorizationId>
A promise resolving to the authorization ID after successful processing by the blockchain.
Remarks
Section titled “Remarks”This function manages the process of submitting a delegate authorization request to the blockchain. It checks if the specified authorization already exists. If it does not, the function constructs and submits a transaction to authorize a delegate for a specific space. The transaction is authorized by the delegator’s DID and signed using the provided blockchain account.
Example
Section titled “Example”const request: ISpaceAuthorization = { uri: 'space:example_uri', delegateUri: 'did:example:delegateUri', permission: PermissionType.EXAMPLE_PERMISSION, authorizationUri: 'auth:example_uri', delegatorUri: 'did:example:creatorUri'};const authorAccount: CordKeyringPair = { ... };const authorizationUri: AuthorizationUri = 'auth:example_uri';const signCallback: SignExtrinsicCallback = (tx) => { ... };
dispatchDelegateAuthorization(request, authorAccount, authorizationUri, signCallback) .then(authorizationId => { console.log('Authorization dispatched with ID:', authorizationId); }) .catch(error => { console.error('Error dispatching authorization:', error); });Throws
Section titled “Throws”- Thrown on error during the dispatch process.