Skip to content

Commit f0d4d4c

Browse files
committed
fix(relayer-cli): references to the refactored relayer inbox subgraph
1 parent a2a3125 commit f0d4d4c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

relayer-cli/src/utils/proof.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ import { getInboxSubgraph } from "../consts/bridgeRoutes";
77
* @param nonce The nonce of the message
88
* @returns The message id and data to relay
99
*/
10-
const getMessageDataToRelay = async (chainId: number, nonce: number, requestGraph: typeof request = request) => {
10+
const getMessageDataToRelay = async (
11+
chainId: number,
12+
inbox: string,
13+
nonce: number,
14+
requestGraph: typeof request = request
15+
) => {
1116
try {
1217
const subgraph = getInboxSubgraph(chainId);
1318

1419
const result = await requestGraph(
1520
`https://api.studio.thegraph.com/query/${subgraph}`,
1621
`{
17-
messageSents(first: 5, where: {nonce: ${nonce}}) {
22+
messageSents(first: 5, where: {nonce: ${nonce}, inbox: "${inbox}"}) {
1823
nonce
1924
to {
2025
id

relayer-cli/src/utils/relay.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const relay = async (chainId: number, nonce: number) => {
4444

4545
const [proof, [to, data]] = await Promise.all([
4646
getProofAtCount(chainId, nonce, count),
47-
getMessageDataToRelay(chainId, nonce),
47+
getMessageDataToRelay(chainId, routeParams.veaInboxAddress, nonce),
4848
]);
4949

5050
const txn = await veaOutbox.sendMessage(proof, nonce, to, data);
@@ -112,7 +112,7 @@ const relayBatch = async ({
112112
}
113113
const [proof, [to, data]] = await Promise.all([
114114
fetchProofAtCount(chainId, nonce, count),
115-
fetchMessageDataToRelay(chainId, nonce),
115+
fetchMessageDataToRelay(chainId, routeParams.veaInboxAddress, nonce),
116116
]);
117117
try {
118118
await veaOutboxInstance.methods.sendMessage(proof, nonce, to, data).call();
@@ -162,12 +162,12 @@ const relayAllFrom = async (chainId: number, nonce: number, msgSender: string):
162162

163163
let txns = [];
164164

165-
const nonces = await getNonceFrom(chainId, nonce, msgSender);
165+
const nonces = await getNonceFrom(chainId, routeParams.veaInboxAddress, nonce, msgSender);
166166

167167
for (const x of nonces) {
168168
const [proof, [to, data]] = await Promise.all([
169169
getProofAtCount(chainId, x, count),
170-
getMessageDataToRelay(chainId, x),
170+
getMessageDataToRelay(chainId, routeParams.veaInboxAddress, x),
171171
]);
172172
txns.push({
173173
args: [proof, x, to, data],
@@ -188,7 +188,7 @@ const relayAllFrom = async (chainId: number, nonce: number, msgSender: string):
188188
* @param msgSender The address of the sender
189189
* @returns The nonces of the messages sent by the sender
190190
*/
191-
const getNonceFrom = async (chainId: number, nonce: number, msgSender: string) => {
191+
const getNonceFrom = async (chainId: number, inbox: string, nonce: number, msgSender: string) => {
192192
const subgraph = getInboxSubgraph(chainId);
193193

194194
const result = await request(
@@ -197,6 +197,7 @@ const getNonceFrom = async (chainId: number, nonce: number, msgSender: string) =
197197
messageSents(
198198
first: 1000,
199199
where: {
200+
inbox: "${inbox}",
200201
nonce_gte: ${nonce},
201202
msgSender_: {id: "${msgSender}"}
202203
},

0 commit comments

Comments
 (0)