-
Notifications
You must be signed in to change notification settings - Fork 2
/
attestationresult.ts
104 lines (89 loc) · 2.3 KB
/
attestationresult.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// SPDX-License-Identifier: Apache-2.0
"use strict";
import {
jsonBigIntMember,
jsonObject,
jsonMapMember,
jsonMember,
MapShape,
} from "#erdstall/export/typedjson";
import { ErdstallObject, registerErdstallType } from "#erdstall/api";
import * as ledger from "#erdstall/ledger";
const typeName = "AttestResponse";
@jsonObject
export class Parameters {
@jsonBigIntMember() powDepth: bigint;
@jsonBigIntMember() epochDuration: bigint;
@jsonBigIntMember() initBlock: bigint;
@jsonMember(ledger.Address) tee: ledger.Address;
@jsonMember(ledger.Address) contract: ledger.Address;
@jsonMapMember(String, () => ledger.Address, { shape: MapShape.OBJECT })
tokenHolders: Map<string, ledger.Address>;
@jsonMember(String) network: string;
constructor(
powDepth: bigint,
epochDuration: bigint,
initBlock: bigint,
tee: ledger.Address,
contract: ledger.Address,
tokenHolders: Map<string, ledger.Address>,
network: string,
) {
this.powDepth = powDepth;
this.epochDuration = epochDuration;
this.initBlock = initBlock;
this.tee = tee;
this.contract = contract;
this.tokenHolders = tokenHolders;
this.network = network;
}
}
@jsonObject
export class AttestationReportData extends Parameters {
@jsonBigIntMember() nonce: bigint;
@jsonMember(String) trustedBlockHash: string;
@jsonBigIntMember() trustedBlockNum: bigint;
constructor(
p: Parameters,
nonce: bigint,
trustedBlockHash: string,
trustedBlockNum: bigint,
) {
super(
p?.powDepth,
p?.epochDuration,
p?.initBlock,
p?.tee,
p?.contract,
p?.tokenHolders,
p?.network,
);
this.nonce = nonce;
this.trustedBlockHash = trustedBlockHash;
this.trustedBlockNum = trustedBlockNum;
}
}
@jsonObject
export class AttestationResult {
@jsonMember(AttestationReportData) data: AttestationReportData;
@jsonMember(String) report: string;
constructor(data: AttestationReportData, report: string) {
this.data = data;
this.report = report;
}
}
@jsonObject
export class AttestResponse extends ErdstallObject {
@jsonMember(AttestationResult) attestation: AttestationResult;
constructor(attestation: AttestationResult) {
super();
this.attestation = attestation;
}
public objectType(): any {
return AttestResponse;
}
protected objectTypeName(): string {
return typeName;
}
}
registerErdstallType(typeName, AttestResponse);