@@ -122,6 +122,19 @@ pub struct EIP1559Transaction {
122122 pub data : Vec < u8 > ,
123123}
124124
125+ /// Identifies the case of the recipient address given as hexadecimal string.
126+ /// This function exists as a convenience to potentially help clients to determine the case of the
127+ /// recipient address.
128+ pub fn eth_identify_case ( recipient_address : & str ) -> pb:: EthAddressCase {
129+ if recipient_address. to_uppercase ( ) == recipient_address {
130+ pb:: EthAddressCase :: Upper
131+ } else if recipient_address. to_lowercase ( ) == recipient_address {
132+ pb:: EthAddressCase :: Lower
133+ } else {
134+ pb:: EthAddressCase :: Mixed
135+ }
136+ }
137+
125138#[ cfg( feature = "rlp" ) ]
126139impl TryFrom < & [ u8 ] > for Transaction {
127140 type Error = ( ) ;
@@ -465,6 +478,7 @@ impl<R: Runtime> PairedBitBox<R> {
465478 chain_id : u64 ,
466479 keypath : & Keypath ,
467480 tx : & Transaction ,
481+ address_case : Option < pb:: EthAddressCase > ,
468482 ) -> Result < [ u8 ; 65 ] , Error > {
469483 // passing chainID instead of coin only since v9.10.0
470484 self . validate_version ( ">=9.10.0" ) ?;
@@ -483,7 +497,7 @@ impl<R: Runtime> PairedBitBox<R> {
483497 commitment : crate :: antiklepto:: host_commit ( & host_nonce) . to_vec ( ) ,
484498 } ) ,
485499 chain_id,
486- address_case : pb:: EthAddressCase :: Mixed as _ ,
500+ address_case : address_case . unwrap_or ( pb:: EthAddressCase :: Mixed ) . into ( ) ,
487501 } ) ;
488502 let response = self . query_proto_eth ( request) . await ?;
489503 self . handle_antiklepto ( & response, host_nonce) . await
@@ -496,6 +510,7 @@ impl<R: Runtime> PairedBitBox<R> {
496510 & self ,
497511 keypath : & Keypath ,
498512 tx : & EIP1559Transaction ,
513+ address_case : Option < pb:: EthAddressCase > ,
499514 ) -> Result < [ u8 ; 65 ] , Error > {
500515 // EIP1559 is suported from v9.16.0
501516 self . validate_version ( ">=9.16.0" ) ?;
@@ -516,7 +531,7 @@ impl<R: Runtime> PairedBitBox<R> {
516531 host_nonce_commitment : Some ( pb:: AntiKleptoHostNonceCommitment {
517532 commitment : crate :: antiklepto:: host_commit ( & host_nonce) . to_vec ( ) ,
518533 } ) ,
519- address_case : pb:: EthAddressCase :: Mixed as _ ,
534+ address_case : address_case . unwrap_or ( pb:: EthAddressCase :: Mixed ) . into ( ) ,
520535 } ) ;
521536 let response = self . query_proto_eth ( request) . await ?;
522537 self . handle_antiklepto ( & response, host_nonce) . await
0 commit comments