@@ -25,27 +25,27 @@ const getCount = async (veaOutbox: VeaOutboxArbToEth | VeaOutboxArbToGnosis, cha
25
25
return Number ( result [ "snapshotSaveds" ] [ 0 ] . count ) ;
26
26
} ;
27
27
28
- const relay = async ( chainid : number , nonce : number ) => {
29
- const routeParams = getBridgeConfig ( chainid ) ;
30
- const veaOutbox = getVeaOutbox ( routeParams . veaOutboxAddress , process . env . PRIVATE_KEY , routeParams . rpcOutbox , chainid ) ;
31
- const count = await getCount ( veaOutbox , chainid ) ;
28
+ const relay = async ( chainId : number , nonce : number ) => {
29
+ const routeParams = getBridgeConfig ( chainId ) ;
30
+ const veaOutbox = getVeaOutbox ( routeParams . veaOutboxAddress , process . env . PRIVATE_KEY , routeParams . rpcOutbox , chainId ) ;
31
+ const count = await getCount ( veaOutbox , chainId ) ;
32
32
33
33
const [ proof , [ to , data ] ] = await Promise . all ( [
34
- getProofAtCount ( chainid , nonce , count ) ,
35
- getMessageDataToRelay ( chainid , nonce ) ,
34
+ getProofAtCount ( chainId , nonce , count ) ,
35
+ getMessageDataToRelay ( chainId , nonce ) ,
36
36
] ) ;
37
37
38
38
const txn = await veaOutbox . sendMessage ( proof , nonce , to , data ) ;
39
39
await txn . wait ( ) ;
40
40
} ;
41
41
42
- const relayBatch = async ( chainid : number , nonce : number , maxBatchSize : number ) => {
43
- const routeParams = getBridgeConfig ( chainid ) ;
42
+ const relayBatch = async ( chainId : number , nonce : number , maxBatchSize : number ) => {
43
+ const routeParams = getBridgeConfig ( chainId ) ;
44
44
const web3 = new Web3 ( routeParams . rpcOutbox ) ;
45
45
const batchedSend = initializeBatchedSend ( web3 , routeParams . batcher , process . env . PRIVATE_KEY , 0 ) ;
46
46
const veaOutboxInstance = new web3 . eth . Contract ( routeParams . veaOutboxContract . abi , routeParams . veaOutboxAddress ) ;
47
- const veaOutbox = getVeaOutbox ( routeParams . veaOutboxAddress , process . env . PRIVATE_KEY , routeParams . rpcOutbox , chainid ) ;
48
- const count = await getCount ( veaOutbox , chainid ) ;
47
+ const veaOutbox = getVeaOutbox ( routeParams . veaOutboxAddress , process . env . PRIVATE_KEY , routeParams . rpcOutbox , chainId ) ;
48
+ const count = await getCount ( veaOutbox , chainId ) ;
49
49
50
50
while ( nonce < count ) {
51
51
let batchMessages = 0 ;
@@ -57,8 +57,8 @@ const relayBatch = async (chainid: number, nonce: number, maxBatchSize: number)
57
57
continue ;
58
58
}
59
59
const [ proof , [ to , data ] ] = await Promise . all ( [
60
- getProofAtCount ( chainid , nonce , count ) ,
61
- getMessageDataToRelay ( chainid , nonce ) ,
60
+ getProofAtCount ( chainId , nonce , count ) ,
61
+ getMessageDataToRelay ( chainId , nonce ) ,
62
62
] ) ;
63
63
txns . push ( {
64
64
args : [ proof , nonce , to , data ] ,
@@ -75,8 +75,8 @@ const relayBatch = async (chainid: number, nonce: number, maxBatchSize: number)
75
75
return nonce ;
76
76
} ;
77
77
78
- const relayAllFrom = async ( chainid : number , nonce : number , msgSender : string ) : Promise < number > => {
79
- const routeParams = getBridgeConfig ( chainid ) ;
78
+ const relayAllFrom = async ( chainId : number , nonce : number , msgSender : string ) : Promise < number > => {
79
+ const routeParams = getBridgeConfig ( chainId ) ;
80
80
81
81
const web3 = new Web3 ( routeParams . rpcOutbox ) ;
82
82
const batchedSend = initializeBatchedSend (
@@ -88,19 +88,19 @@ const relayAllFrom = async (chainid: number, nonce: number, msgSender: string):
88
88
) ;
89
89
90
90
const contract = new web3 . eth . Contract ( routeParams . veaOutboxContract . abi , routeParams . veaOutboxAddress ) ;
91
- const veaOutbox = getVeaOutbox ( routeParams . veaOutboxAddress , process . env . PRIVATE_KEY , routeParams . rpcOutbox , chainid ) ;
92
- const count = await getCount ( veaOutbox , chainid ) ;
91
+ const veaOutbox = getVeaOutbox ( routeParams . veaOutboxAddress , process . env . PRIVATE_KEY , routeParams . rpcOutbox , chainId ) ;
92
+ const count = await getCount ( veaOutbox , chainId ) ;
93
93
94
94
if ( ! count ) return null ;
95
95
96
96
let txns = [ ] ;
97
97
98
- const nonces = await getNonceFrom ( chainid , nonce , msgSender ) ;
98
+ const nonces = await getNonceFrom ( chainId , nonce , msgSender ) ;
99
99
100
100
for ( const x of nonces ) {
101
101
const [ proof , [ to , data ] ] = await Promise . all ( [
102
- getProofAtCount ( chainid , x , count ) ,
103
- getMessageDataToRelay ( chainid , x ) ,
102
+ getProofAtCount ( chainId , x , count ) ,
103
+ getMessageDataToRelay ( chainId , x ) ,
104
104
] ) ;
105
105
txns . push ( {
106
106
args : [ proof , x , to , data ] ,
@@ -114,9 +114,9 @@ const relayAllFrom = async (chainid: number, nonce: number, msgSender: string):
114
114
return nonces [ nonces . length - 1 ] ;
115
115
} ;
116
116
117
- const getNonceFrom = async ( chainid : number , nonce : number , msgSender : string ) => {
117
+ const getNonceFrom = async ( chainId : number , nonce : number , msgSender : string ) => {
118
118
try {
119
- const subgraph = getInboxSubgraph ( chainid ) ;
119
+ const subgraph = getInboxSubgraph ( chainId ) ;
120
120
121
121
const result = await request (
122
122
`https://api.studio.thegraph.com/query/${ subgraph } ` ,
0 commit comments