-
Notifications
You must be signed in to change notification settings - Fork 19
/
cmParentContext.ts
27 lines (23 loc) · 1.03 KB
/
cmParentContext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { IContextDef } from "plugin-api/IContextDef";
import { ICmPageContext } from "app/eth-extended/page/cm/cmPage";
import { ICmDetails } from "app/eth-extended/data/contractMsg/details/ICmDetails";
import { ICmParentContext } from "./ICmParentContext";
import { cmContextType } from "app/shared/context/cmContextType";
import { cmParentContextType } from "app/eth-extended/context/cmParentContextType";
export const cmParentContext: IContextDef<ICmPageContext, ICmParentContext> = {
parentContextType: cmContextType,
contextType: cmParentContextType,
dataAdapters: [{
ref: "adapter://aleth.io/cm/details"
}],
create(parentCtx, parentData) {
let cmDetails = parentData.get("adapter://aleth.io/cm/details")!.data as ICmDetails;
let ctx: ICmParentContext = {
txHash: parentCtx.txHash,
parentValidationIndex: cmDetails.parentTxValidationIndex,
validationIndex: parentCtx.validationIndex,
blockNumber: cmDetails.block.id
};
return ctx;
}
};