-
Notifications
You must be signed in to change notification settings - Fork 93
/
types.ts
153 lines (138 loc) · 4.27 KB
/
types.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import {
BigNumber,
BigNumberish,
ExternalProvider as EthersExternalProvider,
JsonRpcFetchFunc,
StaticJsonRpcProvider,
Overrides,
Web3Provider,
} from './ethers';
// ========================================= Ethers types ==========================================
export { TransactionResponse } from './ethers';
import { TransactionResponse } from './ethers';
export type ExternalProvider = EthersExternalProvider | JsonRpcFetchFunc;
export type EthersProvider = Web3Provider | StaticJsonRpcProvider;
// Transaction responses on L2s and other chains may have more fields than on L1.
export interface TransactionResponseExtended extends TransactionResponse {
// Arbitrum fields.
arbSubType?: number;
arbType?: number;
indexInParent?: number;
l1BlockNumber?: number; // Also in Optimism.
l1SequenceNumber?: string;
parentRequestId?: string; // 32-byte hex string
// Optimism fields.
index?: number;
l1Timestamp?: number;
l1TxOrigin?: string | null;
queueIndex?: number | null;
queueOrigin?: string;
rawTransaction?: string;
transactionIndex?: number;
// Placeholder for anything else
[key: string]: any;
}
// ======================================= Umbra class types =======================================
// Settings when instantiating an instance of the Umbra class
export interface ChainConfig {
chainId: number; // Chain ID of the deployed contract
umbraAddress: string; // address of Umbra contract
batchSendAddress: string | null; // address of UmbraBatchSend contract
startBlock: number; // block Umbra contract was deployed at
subgraphUrl: string | false; // URL of the subgraph used to fetch Announcement events, or false to not use a subgraph
}
// Used for passing around encrypted random number
export interface EncryptedPayload {
ephemeralPublicKey: string; // hex string with 0x04 prefix
ciphertext: string; // hex string with 0x prefix
}
// Type for storing compressed public keys
export interface CompressedPublicKey {
prefix: number;
pubKeyXCoordinate: string; // has 0x prefix
}
// Overrides when sending funds. See the lookupRecipient method documentation for more information
export interface SendOverrides extends Overrides {
advanced?: boolean;
supportPubKey?: boolean;
supportTxHash?: boolean;
}
// Overrides for the start and end block numbers to use when scanning for events
export interface ScanOverrides {
startBlock?: number | string;
endBlock?: number | string;
}
// Type definition for Announcement events emitted from the contract
export interface Announcement {
amount: BigNumber;
ciphertext: string;
pkx: string;
receiver: string;
token: string;
}
// Type definition for Announcement event with extra data from the chain
export interface AnnouncementDetail {
amount: BigNumber;
ciphertext: string;
pkx: string;
receiver: string;
token: string;
block: string;
from: string;
timestamp: string;
txHash: string;
}
// Modified announcement data received from subgraph queries
export interface SubgraphAnnouncement {
amount: string;
block: string;
ciphertext: string;
from: string;
id: string; // the subgraph uses an ID of `timestamp-logIndex`
pkx: string;
receiver: string;
timestamp: string;
token: string;
txHash: string;
}
// A UserAnnouncement is an Announcement event from Umbra where the recipient is the specified user
export interface UserAnnouncement {
amount: BigNumber;
from: string; // sender address
isWithdrawn: boolean;
randomNumber: string;
receiver: string;
timestamp: string;
token: string; // token address
txHash: string;
}
// StealthKeyChanged event data received from subgraph queries
export interface SubgraphStealthKeyChangedEvent {
block: string;
from: string;
id: string; // the subgraph uses an ID of `timestamp-logIndex`
registrant: string;
spendingPubKeyPrefix: BigNumber;
spendingPubKey: BigNumber;
timestamp: string;
txHash: string;
viewingPubKeyPrefix: BigNumber;
viewingPubKey: BigNumber;
}
export interface SendBatch {
token: string;
amount: BigNumberish;
address: string;
}
export interface SendData {
receiver: string;
tokenAddr: string;
amount: BigNumberish;
pkx: string;
ciphertext: string;
}
export type GraphFilterOverride = {
startBlock?: number | string;
endBlock?: number | string;
registrant?: string;
};