-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathfragments.ts
More file actions
158 lines (152 loc) · 4.59 KB
/
fragments.ts
File metadata and controls
158 lines (152 loc) · 4.59 KB
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
154
155
156
157
158
/**
* =================
* MESSAGE GRAPHQL FRAGMENTS
* Not co-locating with UI code b.c. the backend also needs these for the API
* =================
*/
export const messageStubFragment = `
id
msg_id
nonce
sender
recipient
is_delivered
send_occurred_at
delivery_occurred_at
delivery_latency
origin_chain_id
origin_domain_id
origin_tx_id
origin_tx_hash
origin_tx_sender
origin_tx_recipient
destination_chain_id
destination_domain_id
destination_tx_id
destination_tx_hash
destination_tx_sender
destination_tx_recipient
message_body
`;
export const messageDetailsFragment = `
${messageStubFragment}
origin_block_hash
origin_block_height
origin_block_id
origin_mailbox
origin_tx_cumulative_gas_used
origin_tx_effective_gas_price
origin_tx_gas_limit
origin_tx_gas_price
origin_tx_gas_used
origin_tx_max_fee_per_gas
origin_tx_max_priority_fee_per_gas
origin_tx_nonce
destination_block_hash
destination_block_height
destination_block_id
destination_mailbox
destination_tx_cumulative_gas_used
destination_tx_effective_gas_price
destination_tx_gas_limit
destination_tx_gas_price
destination_tx_gas_used
destination_tx_max_fee_per_gas
destination_tx_max_priority_fee_per_gas
destination_tx_nonce
total_gas_amount
total_payment
num_payments
`;
export const rawMessageDispatchFragment = `
id
msg_id
nonce
origin_domain
destination_domain
sender
recipient
origin_tx_hash
origin_block_hash
origin_block_height
origin_mailbox
time_created
time_updated
`;
/**
* ===================================
* FRAGMENT TYPES
* Must correspond with fragments above
* ====================================
*/
export interface MessageStubEntry {
id: number; // database id, not message id
msg_id: string; // binary e.g. \\x123
nonce: number;
sender: string; // binary e.g. \\x123
recipient: string; // binary e.g. \\x123
is_delivered: boolean;
send_occurred_at: string; // e.g. "2022-08-28T17:30:15"
delivery_occurred_at: string | null; // e.g. "2022-08-28T17:30:15"
delivery_latency: string | null; // e.g. "00:00:32"
origin_chain_id: number;
origin_domain_id: number;
origin_tx_id: number; // database id
origin_tx_hash: string; // binary e.g. \\x123
origin_tx_sender: string; // binary e.g. \\x123
origin_tx_recipient: string; // binary e.g. \\x123
destination_chain_id: number;
destination_domain_id: number;
destination_tx_id: number | null; // database id
destination_tx_hash: string | null; // binary e.g. \\x123
destination_tx_sender: string | null; // binary e.g. \\x123
destination_tx_recipient: string; // binary e.g. \\x123
message_body: string | null; // binary e.g. \\x123
}
export interface MessageEntry extends MessageStubEntry {
origin_block_hash: string; // binary e.g. \\x123
origin_block_height: number;
origin_block_id: number; // database id
origin_mailbox: string; // binary e.g. \\x123
origin_tx_cumulative_gas_used: number;
origin_tx_effective_gas_price: number;
origin_tx_gas_limit: number;
origin_tx_gas_price: number;
origin_tx_gas_used: number;
origin_tx_max_fee_per_gas: number;
origin_tx_max_priority_fee_per_gas: number;
origin_tx_nonce: number;
destination_block_hash: string | null; // binary e.g. \\x123
destination_block_height: number | null;
destination_block_id: number | null; // database id
destination_mailbox: string; // binary e.g. \\x123
destination_tx_cumulative_gas_used: number | null;
destination_tx_effective_gas_price: number | null;
destination_tx_gas_limit: number | null;
destination_tx_gas_price: number | null;
destination_tx_gas_used: number | null;
destination_tx_max_fee_per_gas: number | null;
destination_tx_max_priority_fee_per_gas: number | null;
destination_tx_nonce: number | null;
total_gas_amount: number;
total_payment: number;
num_payments: number;
}
export interface RawMessageDispatchEntry {
id: number;
msg_id: string; // binary e.g. \\x123
nonce: number;
origin_domain: number;
destination_domain: number;
sender: string; // binary e.g. \\x123
recipient: string; // binary e.g. \\x123
origin_tx_hash: string; // binary e.g. \\x123
origin_block_hash: string; // binary e.g. \\x123
origin_block_height: number;
origin_mailbox: string; // binary e.g. \\x123
time_created: string | null; // e.g. "2022-08-28T17:30:15"
time_updated: string | null; // e.g. "2022-08-28T17:30:15"
}
export type MessagesStubQueryResult = Record<string, MessageStubEntry[]>;
export type MessagesQueryResult = Record<string, MessageEntry[]>;
export type RawMessagesQueryResult = Record<string, RawMessageDispatchEntry[]>;