forked from dhiway/cord.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
AnshulGoyal589
committed
May 20, 2024
1 parent
7b2d45d
commit 1cdf9bb
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |