@@ -155,7 +155,11 @@ impl EthClient {
155
155
for url in self . urls . iter ( ) {
156
156
response = self . send_request_to_url ( url, & request) . await ;
157
157
if response. is_ok ( ) {
158
- return response;
158
+ // Some RPC servers don't implement all the endpoints or don't implement them completely/correctly
159
+ // so if the server returns Ok(RpcResponse::Error) we retry with the others
160
+ if let Ok ( RpcResponse :: Success ( ref _a) ) = response {
161
+ return response;
162
+ }
159
163
}
160
164
}
161
165
response
@@ -436,6 +440,20 @@ impl EthClient {
436
440
) ;
437
441
}
438
442
443
+ if !transaction. blobs . is_empty ( ) {
444
+ let blobs_str: Vec < _ > = transaction
445
+ . blobs
446
+ . into_iter ( )
447
+ . map ( |blob| format ! ( "0x{}" , hex:: encode( blob) ) )
448
+ . collect ( ) ;
449
+
450
+ data. as_object_mut ( )
451
+ . ok_or_else ( || {
452
+ EthClientError :: Custom ( "Failed to mutate data in estimate_gas" . to_owned ( ) )
453
+ } ) ?
454
+ . insert ( "blobs" . to_owned ( ) , json ! ( blobs_str) ) ;
455
+ }
456
+
439
457
// Add the nonce just if present, otherwise the RPC will use the latest nonce
440
458
if let Some ( nonce) = transaction. nonce {
441
459
if let Value :: Object ( ref mut map) = data {
@@ -843,7 +861,9 @@ impl EthClient {
843
861
) -> Result < ( ) , EthClientError > {
844
862
let mut transaction = match wrapped_tx {
845
863
WrappedTransaction :: EIP4844 ( wrapped_eip4844_transaction) => {
846
- GenericTransaction :: from ( wrapped_eip4844_transaction. clone ( ) . tx )
864
+ let mut tx = GenericTransaction :: from ( wrapped_eip4844_transaction. clone ( ) . tx ) ;
865
+ add_blobs_to_generic_tx ( & mut tx, & wrapped_eip4844_transaction. blobs_bundle ) ;
866
+ tx
847
867
}
848
868
WrappedTransaction :: EIP1559 ( eip1559_transaction) => {
849
869
GenericTransaction :: from ( eip1559_transaction. clone ( ) )
@@ -877,7 +897,9 @@ impl EthClient {
877
897
) -> Result < u64 , EthClientError > {
878
898
let mut transaction = match wrapped_tx {
879
899
WrappedTransaction :: EIP4844 ( wrapped_eip4844_transaction) => {
880
- GenericTransaction :: from ( wrapped_eip4844_transaction. clone ( ) . tx )
900
+ let mut tx = GenericTransaction :: from ( wrapped_eip4844_transaction. clone ( ) . tx ) ;
901
+ add_blobs_to_generic_tx ( & mut tx, & wrapped_eip4844_transaction. blobs_bundle ) ;
902
+ tx
881
903
}
882
904
WrappedTransaction :: EIP1559 ( eip1559_transaction) => {
883
905
GenericTransaction :: from ( eip1559_transaction. clone ( ) )
@@ -1423,6 +1445,14 @@ pub fn get_address_from_secret_key(secret_key: &SecretKey) -> Result<Address, Et
1423
1445
Ok ( Address :: from ( address_bytes) )
1424
1446
}
1425
1447
1448
+ pub fn add_blobs_to_generic_tx ( tx : & mut GenericTransaction , bundle : & BlobsBundle ) {
1449
+ tx. blobs = bundle
1450
+ . blobs
1451
+ . iter ( )
1452
+ . map ( |blob| Bytes :: copy_from_slice ( blob) )
1453
+ . collect ( )
1454
+ }
1455
+
1426
1456
#[ derive( Serialize , Deserialize , Debug ) ]
1427
1457
#[ serde( rename_all = "camelCase" ) ]
1428
1458
pub struct GetTransactionByHashTransaction {
0 commit comments