-
Notifications
You must be signed in to change notification settings - Fork 34
/
wallet-registry.ts
134 lines (125 loc) · 3.37 KB
/
wallet-registry.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { Hex } from "../utils"
import { ChainEvent, GetChainEvents } from "./chain-event"
import { BigNumber } from "ethers"
import { ChainIdentifier } from "./chain-identifier"
/**
* Interface for communication with the WalletRegistry on-chain contract.
*/
export interface WalletRegistry {
/**
* Gets the chain-specific identifier of this contract.
*/
getChainIdentifier(): ChainIdentifier
/**
* Gets the public key for the given wallet.
* @param walletID ID of the wallet.
* @returns Uncompressed public key without the 04 prefix.
*/
getWalletPublicKey(walletID: Hex): Promise<Hex>
/**
* Get emitted DkgResultSubmittedEvent events.
* @see GetEventsFunction
*/
getDkgResultSubmittedEvents: GetChainEvents.Function<DkgResultSubmittedEvent>
/**
* Get emitted DkgResultApprovedEvent events.
* @see GetEventsFunction
*/
getDkgResultApprovedEvents: GetChainEvents.Function<DkgResultApprovedEvent>
/**
* Get emitted DkgResultChallengedEvent events.
* @see GetEventsFunction
*/
getDkgResultChallengedEvents: GetChainEvents.Function<DkgResultChallengedEvent>
}
/**
* Represents an event emitted when a DKG result is submitted to the on-chain
* wallet registry.
*/
export type DkgResultSubmittedEvent = {
/**
* 32-byte hash of the submitted DKG result.
*/
resultHash: Hex
/**
* 32-byte seed of the current DKG execution.
*/
seed: Hex
/**
* DKG result object.
*/
result: DkgResult
} & ChainEvent
/**
* Represents an event emitted when a DKG result is approved on the on-chain
* wallet registry.
*/
export type DkgResultApprovedEvent = {
/**
* 32-byte hash of the submitted DKG result.
*/
resultHash: Hex
/**
* Approver's chain identifier.
*/
approver: ChainIdentifier
} & ChainEvent
/**
* Represents an event emitted when a DKG result is challenged on the on-chain
* wallet registry.
*/
export type DkgResultChallengedEvent = {
/**
* 32-byte hash of the submitted DKG result.
*/
resultHash: Hex
/**
* Challenger's chain identifier.
*/
challenger: ChainIdentifier
/**
* Reason of the challenge.
*/
reason: string
} & ChainEvent
/**
* Represents a DKG on-chain result.
*/
type DkgResult = {
/**
* Claimed submitter candidate group member index. Is in range [1, groupSize].
*/
submitterMemberIndex: BigNumber
/**
* Generated group public key.
*/
groupPubKey: Hex
/**
* Array of misbehaved members indices (disqualified or inactive). Indices
* are in range [1, groupSize], unique, and sorted in ascending order.
*/
misbehavedMembersIndices: number[]
/**
* Concatenation of signatures from members supporting the result.
* The message to be signed by each member is keccak256 hash of the
* calculated group public key, misbehaved members indices and DKG
* start block. The calculated hash is also prefixed with
* `\x19Ethereum signed message:\n` before signing.
*/
signatures: Hex
/**
* Indices of members corresponding to each signature. Indices are
* in range [1, groupSize], unique, and sorted in ascending order.
*/
signingMembersIndices: BigNumber[]
/**
* Identifiers of candidate group members as outputted by the group
* selection protocol.
*/
members: number[]
/**
* Keccak256 hash of group members identifiers that actively took part
* in DKG (excluding IA/DQ members).
*/
membersHash: Hex
}