-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add statement handler Signed-off-by: Adi Bhagavath <[email protected]> * remove .vscode * Add DecoderUtils to converst the hex to string Signed-off-by: System Administrator <[email protected]> * update statement Signed-off-by: Adi Bhagavath <[email protected]> * use extrinsic.block to get the blocknumber * minor fixes Signed-off-by: System Administrator <[email protected]> * remove logs and correct the alignment Signed-off-by: System Administrator <[email protected]> * Add call index Signed-off-by: Adi Bhagavath <[email protected]> * feat: Add identity handler Signed-off-by: Adi Bhagavath <[email protected]> * Remove GitHub Actions --------- Signed-off-by: Adi Bhagavath <[email protected]> Signed-off-by: System Administrator <[email protected]> Co-authored-by: Ujjwal Sharma <[email protected]>
- Loading branch information
1 parent
2a3c068
commit 85d9b7e
Showing
3 changed files
with
130 additions
and
3 deletions.
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
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,86 @@ | ||
import { SubstrateExtrinsic } from "@subql/types"; | ||
import { SetIdentity, ProvidedJudgement, JudgementRequest } from "../types"; | ||
|
||
export async function indexIdentityCall( | ||
extrinsic: SubstrateExtrinsic, | ||
id: string, | ||
method: string | ||
): Promise<void> { | ||
const data = extrinsic.extrinsic.method; | ||
|
||
const arrayed = JSON.parse(JSON.stringify(data)); | ||
|
||
if (method === "setIdentity") { | ||
let identity = new SetIdentity(id); | ||
identity.method = method; | ||
identity.callIndex = arrayed.callIndex; | ||
identity.blockNumber = extrinsic.block.block.header.number.toBigInt(); | ||
|
||
identity.display = arrayed.args.info.display.raw; | ||
identity.legal = arrayed.args.info.legal.raw; | ||
identity.web = arrayed.args.info.web.raw; | ||
identity.email = arrayed.args.info.email.raw; | ||
identity.additional = JSON.stringify(arrayed.args.info.additional); | ||
|
||
await identity.save(); | ||
} | ||
if (method === "requestJudgement") { | ||
let judgementRequest = new JudgementRequest(id); | ||
judgementRequest.method = method; | ||
judgementRequest.callIndex = arrayed.callIndex; | ||
judgementRequest.blockNumber = | ||
extrinsic.block.block.header.number.toBigInt(); | ||
judgementRequest.registrar = arrayed.args.registrar; | ||
|
||
await judgementRequest.save(); | ||
} | ||
if (method === "provideJudgement") { | ||
let providedJudgement = new ProvidedJudgement(id); | ||
providedJudgement.method = method; | ||
providedJudgement.callIndex = arrayed.callIndex; | ||
providedJudgement.blockNumber = | ||
extrinsic.block.block.header.number.toBigInt(); | ||
|
||
providedJudgement.callIndex = arrayed.callIndex; | ||
providedJudgement.targetId = arrayed.args.target.id; | ||
providedJudgement.judgement = arrayed.args.judgement; | ||
providedJudgement.digest = arrayed.args.digest; | ||
|
||
await providedJudgement.save(); | ||
} | ||
|
||
if (method === "identityCleared") { | ||
// ToDo: | ||
// Develop a demo script within the GitHub repository at github.com/dhiway/cord.js which | ||
// calls this method. Execute the script to capture the extrinsic information, analyze the obtained data, | ||
// and complete the implementation. | ||
} | ||
if (method === "identityKilled") { | ||
/* ToDo: | ||
Develop a demo script within the GitHub repository at github.com/dhiway/cord.js which | ||
calls this method. Execute the script to capture the extrinsic information, analyze the obtained data, | ||
and complete the implementation. | ||
*/ | ||
} | ||
if (method === "judgementUnrequested") { | ||
/* ToDo: | ||
Develop a demo script within the GitHub repository at github.com/dhiway/cord.js which | ||
calls this method. Execute the script to capture the extrinsic information, analyze the obtained data, | ||
and complete the implementation. | ||
*/ | ||
} | ||
if (method === "registrarAdded") { | ||
/* ToDo: | ||
Develop a demo script within the GitHub repository at github.com/dhiway/cord.js which | ||
calls this method. Execute the script to capture the extrinsic information, analyze the obtained data, | ||
and complete the implementation. | ||
*/ | ||
} | ||
if (method === "registrarRemoved") { | ||
/* ToDo: | ||
Develop a demo script within the GitHub repository at github.com/dhiway/cord.js which | ||
calls this method. Execute the script to capture the extrinsic information, analyze the obtained data, | ||
and complete the implementation. | ||
*/ | ||
} | ||
} |