@@ -4,6 +4,7 @@ package flashbotsrpc
4
4
5
5
import (
6
6
"crypto/ecdsa"
7
+ "encoding/json"
7
8
"errors"
8
9
"fmt"
9
10
"io"
@@ -1227,6 +1228,55 @@ func (s *FlashbotsRPCTestSuite) TestFlashbotsGetBundleStats() {
1227
1228
s .Require ().Equal (expected , bundleStats )
1228
1229
}
1229
1230
1231
+ func (s * FlashbotsRPCTestSuite ) TestFlashbotsGetBundleStatsV2 () {
1232
+ params := FlashbotsGetBundleStatsParam {
1233
+ BlockNumber : "0x10C063C" ,
1234
+ BundleHash : "0x9f93055488f7b9db678c14c1c5056c3ea01ef91e35c4f5e4cbeb6d8eb434f32d" ,
1235
+ }
1236
+
1237
+ s .registerResponseError (errors .New ("Error" ))
1238
+ _ , err := s .rpc .FlashbotsGetBundleStatsV2 (s .privKey , params )
1239
+ s .Require ().NotNil (err )
1240
+
1241
+ response := `{
1242
+ "isSimulated": true,
1243
+ "isSentToMiners": true,
1244
+ "isHighPriority": true,
1245
+ "simulatedAt": "2022-10-06T21:36:06.317Z",
1246
+ "submittedAt": "2022-10-06T21:36:06.250Z",
1247
+ "sentToMinersAt": "2022-10-06T21:36:06.343Z",
1248
+ "consideredByBuildersAt": [
1249
+ {
1250
+ "pubkey": "0x81babeec8c9f2bb9c329fd8a3b176032fe0ab5f3b92a3f44d4575a231c7bd9c31d10b6328ef68ed1e8c02a3dbc8e80f9",
1251
+ "timestamp": "2022-10-06T21:36:06.343Z"
1252
+ },
1253
+ {
1254
+ "pubkey": "0x81beef03aafd3dd33ffd7deb337407142c80fea2690e5b3190cfc01bde5753f28982a7857c96172a75a234cb7bcb994f",
1255
+ "timestamp": "2022-10-06T21:36:06.394Z"
1256
+ }
1257
+ ],
1258
+ "sealedByBuildersAt": [
1259
+ {
1260
+ "pubkey": "0x81beef03aafd3dd33ffd7deb337407142c80fea2690e5b3190cfc01bde5753f28982a7857c96172a75a234cb7bcb994f",
1261
+ "timestamp": "2022-10-06T21:36:07.742Z"
1262
+ }
1263
+ ]
1264
+ }`
1265
+
1266
+ s .registerResponse (response , func (body []byte ) {
1267
+ s .methodEqual (body , "flashbots_getBundleStatsV2" )
1268
+ s .paramsEqual (body , `[{"blockNumber": "0x10C063C", "bundleHash": "0x9f93055488f7b9db678c14c1c5056c3ea01ef91e35c4f5e4cbeb6d8eb434f32d"}]` )
1269
+ })
1270
+
1271
+ bundleStats , err := s .rpc .FlashbotsGetBundleStatsV2 (s .privKey , params )
1272
+ s .Require ().Nil (err )
1273
+
1274
+ bundleStatsExpected := FlashbotsGetBundleStatsResponseV2 {}
1275
+ err = json .Unmarshal ([]byte (response ), & bundleStatsExpected )
1276
+ s .Require ().Nil (err )
1277
+ s .Require ().Equal (bundleStatsExpected , bundleStats )
1278
+ }
1279
+
1230
1280
func TestFlashbotsRPCTestSuite (t * testing.T ) {
1231
1281
suite .Run (t , new (FlashbotsRPCTestSuite ))
1232
1282
}
0 commit comments