Skip to content

Commit

Permalink
fixes issue dhiway#201
Browse files Browse the repository at this point in the history
  • Loading branch information
AnshulGoyal589 committed May 20, 2024
1 parent 7b2d45d commit 1cdf9bb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/chain-space/src/ChainSpace.chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ function dispatchDelegateAuthorizationTx(
* .then(authorizationId => {
* console.log('Authorization dispatched with ID:', authorizationId);
* })
* .catch(error => {
* .catch(error => {
* console.error('Error dispatching authorization:', error);
* });
* ```
Expand Down
27 changes: 27 additions & 0 deletions packages/chain-space/src/delegateService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

import { ApiPromise } from '@polkadot/api';
import { SubmittableExtrinsic } from '@polkadot/api/types';
import * as Did from '@cord.network/did'
import type {PermissionType} from '@cord.network/types'

interface DelegateInfo {
permission: PermissionType,
spaceId: string,
delegateId: string,
authId: string
}

const api = {} as ApiPromise;

export async function prepareDelegateAuthorizationExtrinsic(delegateInfo: DelegateInfo): Promise<SubmittableExtrinsic<'promise'>[]> {
const extrinsics: SubmittableExtrinsic<'promise'>[] = [];

const delegateAuthorizationTx = api.tx.delegate.dispatchDelegateAuthorizationTx(delegateInfo);
extrinsics.push(delegateAuthorizationTx);

// Prepare the extrinsic for DID authorization
const extrinsic = Did.authorizeTx(delegateInfo);
extrinsics.push(extrinsic);

return extrinsics;
}
1 change: 1 addition & 0 deletions packages/chain-space/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './ChainSpace.js'
export * from './ChainSpace.chain.js'
export * from './delegateService.js'

0 comments on commit 1cdf9bb

Please sign in to comment.