@@ -66,6 +66,7 @@ use starknet::signers::{LocalWallet, Signer, SigningKey};
6666use starknet_paymaster:: core:: types:: Call as PaymasterCall ;
6767use tracing:: { debug, info} ;
6868use url:: Url ;
69+ #[ cfg( feature = "vrf" ) ]
6970pub use vrf:: VrfServiceConfig ;
7071use vrf:: { outside_execution_calls_len, request_random_call, VrfService } ;
7172
@@ -76,7 +77,8 @@ pub struct CartridgeConfig {
7677 pub paymaster_api_key : Option < String > ,
7778 pub controller_deployer_address : ContractAddress ,
7879 pub controller_deployer_private_key : Felt ,
79- pub vrf : Option < VrfServiceConfig > ,
80+ #[ cfg( feature = "vrf" ) ]
81+ pub vrf : Option < vrf:: VrfServiceConfig > ,
8082}
8183
8284#[ allow( missing_debug_implementations) ]
@@ -91,6 +93,7 @@ pub struct CartridgeApi<EF: ExecutorFactory, PF: ProviderFactory> {
9193 controller_deployer_address : ContractAddress ,
9294 /// The paymaster account private key.
9395 controller_deployer_private_key : Felt ,
96+ #[ cfg( feature = "vrf" ) ]
9497 vrf_service : Option < VrfService > ,
9598}
9699
@@ -109,6 +112,7 @@ where
109112 paymaster_client : self . paymaster_client . clone ( ) ,
110113 controller_deployer_address : self . controller_deployer_address ,
111114 controller_deployer_private_key : self . controller_deployer_private_key ,
115+ #[ cfg( feature = "vrf" ) ]
112116 vrf_service : self . vrf_service . clone ( ) ,
113117 }
114118 }
@@ -129,6 +133,7 @@ where
129133 config : CartridgeConfig ,
130134 ) -> anyhow:: Result < Self > {
131135 let api_client = cartridge:: Client :: new ( config. api_url ) ;
136+ #[ cfg( feature = "vrf" ) ]
132137 let vrf_service = config. vrf . map ( VrfService :: new) ;
133138
134139 info ! ( target: "rpc::cartridge" , vrf_enabled = vrf_service. is_some( ) , "Cartridge API initialized." ) ;
@@ -154,6 +159,7 @@ where
154159 paymaster_client,
155160 controller_deployer_address : config. controller_deployer_address ,
156161 controller_deployer_private_key : config. controller_deployer_private_key ,
162+ #[ cfg( feature = "vrf" ) ]
157163 vrf_service,
158164 } )
159165 }
@@ -209,6 +215,7 @@ where
209215 build_execute_from_outside_call ( address, & outside_execution, & signature) ;
210216 let mut user_address: Felt = address. into ( ) ;
211217
218+ #[ cfg( feature = "vrf" ) ]
212219 if let Some ( vrf_service) = & this. vrf_service {
213220 // check first if the outside execution calls include a request_random call
214221 if let Some ( ( request_random_call, position) ) =
0 commit comments