@@ -41,18 +41,18 @@ pub unsafe extern "C" fn tw_barz_get_counterfactual_address(
41
41
42
42
/// Returns the init code parameter of ERC-4337 User Operation
43
43
///
44
- /// \param factory The address of the factory contract.
44
+ /// \param factory The address of the factory contract
45
45
/// \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
48
48
/// \return The init code.
49
49
#[ tw_ffi( ty = static_function, class = TWBarz , name = GetInitCode ) ]
50
50
#[ no_mangle]
51
51
pub unsafe extern "C" fn tw_barz_get_init_code (
52
52
factory : Nonnull < TWString > ,
53
53
public_key : NonnullMut < TWPublicKey > ,
54
54
verification_facet : Nonnull < TWString > ,
55
- salt : u32 ,
55
+ salt : i32 ,
56
56
) -> NullableMut < TWData > {
57
57
let factory_address = try_or_else ! ( TWString :: from_ptr_as_ref( factory) , std:: ptr:: null_mut) ;
58
58
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(
63
63
std:: ptr:: null_mut
64
64
) ;
65
65
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
+
66
68
let init_code = try_or_else ! (
67
69
get_init_code(
68
70
factory_address,
@@ -117,18 +119,20 @@ pub unsafe extern "C" fn tw_barz_get_formatted_signature(
117
119
///
118
120
/// \param msg_hash Original msgHash
119
121
/// \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
121
123
/// \return The final hash to be signed.
122
124
#[ tw_ffi( ty = static_function, class = TWBarz , name = GetPrefixedMsgHash ) ]
123
125
#[ no_mangle]
124
126
pub unsafe extern "C" fn tw_barz_get_prefixed_msg_hash (
125
127
msg_hash : Nonnull < TWData > ,
126
128
barz_address : Nonnull < TWString > ,
127
- chain_id : u32 ,
129
+ chain_id : i32 ,
128
130
) -> NullableMut < TWData > {
129
131
let msg_hash = try_or_else ! ( TWData :: from_ptr_as_ref( msg_hash) , std:: ptr:: null_mut) ;
130
132
let barz_address = try_or_else ! ( TWString :: from_ptr_as_ref( barz_address) , std:: ptr:: null_mut) ;
131
133
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
+
132
136
let prefixed_msg_hash = try_or_else ! (
133
137
get_prefixed_msg_hash( msg_hash. as_slice( ) , barz_address, chain_id) ,
134
138
std:: ptr:: null_mut
0 commit comments