@@ -41,18 +41,18 @@ pub unsafe extern "C" fn tw_barz_get_counterfactual_address(
4141
4242/// Returns the init code parameter of ERC-4337 User Operation
4343///
44- /// \param factory The address of the factory contract.
44+ /// \param factory The address of the factory contract
4545/// \param public_key Public key for the verification facet
46- /// \param verification_facet The address of the verification facet.
47- /// \param salt The salt of the init code.
46+ /// \param verification_facet The address of the verification facet
47+ /// \param salt The salt of the init code; Must be non-negative
4848/// \return The init code.
4949#[ tw_ffi( ty = static_function, class = TWBarz , name = GetInitCode ) ]
5050#[ no_mangle]
5151pub unsafe extern "C" fn tw_barz_get_init_code (
5252 factory : Nonnull < TWString > ,
5353 public_key : NonnullMut < TWPublicKey > ,
5454 verification_facet : Nonnull < TWString > ,
55- salt : u32 ,
55+ salt : i32 ,
5656) -> NullableMut < TWData > {
5757 let factory_address = try_or_else ! ( TWString :: from_ptr_as_ref( factory) , std:: ptr:: null_mut) ;
5858 let factory_address = try_or_else ! ( factory_address. as_str( ) , std:: ptr:: null_mut) ;
@@ -63,6 +63,8 @@ pub unsafe extern "C" fn tw_barz_get_init_code(
6363 std:: ptr:: null_mut
6464 ) ;
6565 let verification_facet = try_or_else ! ( verification_facet. as_str( ) , std:: ptr:: null_mut) ;
66+ let salt = try_or_else ! ( salt. try_into( ) , std:: ptr:: null_mut) ;
67+
6668 let init_code = try_or_else ! (
6769 get_init_code(
6870 factory_address,
@@ -117,18 +119,20 @@ pub unsafe extern "C" fn tw_barz_get_formatted_signature(
117119///
118120/// \param msg_hash Original msgHash
119121/// \param barzAddress The address of Barz wallet signing the message
120- /// \param chainId The chainId of the network the verification will happen
122+ /// \param chainId The chainId of the network the verification will happen; Must be non-negative
121123/// \return The final hash to be signed.
122124#[ tw_ffi( ty = static_function, class = TWBarz , name = GetPrefixedMsgHash ) ]
123125#[ no_mangle]
124126pub unsafe extern "C" fn tw_barz_get_prefixed_msg_hash (
125127 msg_hash : Nonnull < TWData > ,
126128 barz_address : Nonnull < TWString > ,
127- chain_id : u32 ,
129+ chain_id : i32 ,
128130) -> NullableMut < TWData > {
129131 let msg_hash = try_or_else ! ( TWData :: from_ptr_as_ref( msg_hash) , std:: ptr:: null_mut) ;
130132 let barz_address = try_or_else ! ( TWString :: from_ptr_as_ref( barz_address) , std:: ptr:: null_mut) ;
131133 let barz_address = try_or_else ! ( barz_address. as_str( ) , std:: ptr:: null_mut) ;
134+ let chain_id = try_or_else ! ( chain_id. try_into( ) , std:: ptr:: null_mut) ;
135+
132136 let prefixed_msg_hash = try_or_else ! (
133137 get_prefixed_msg_hash( msg_hash. as_slice( ) , barz_address, chain_id) ,
134138 std:: ptr:: null_mut
0 commit comments