@@ -119,7 +119,7 @@ pub fn executable_invoke_tx(cairo_version: CairoVersion) -> AccountTransaction {
119
119
120
120
let mut tx_generator = MultiAccountTransactionGenerator :: new ( ) ;
121
121
tx_generator. register_account ( default_account) ;
122
- tx_generator. account_with_id ( 0 ) . generate_executable_invoke ( )
122
+ tx_generator. account_with_id_mut ( 0 ) . generate_executable_invoke ( )
123
123
}
124
124
125
125
pub fn generate_deploy_account_with_salt (
@@ -162,9 +162,9 @@ type SharedNonceManager = Rc<RefCell<NonceManager>>;
162
162
/// tx_generator.register_account_for_flow_test(some_account_type.clone());
163
163
/// tx_generator.register_account_for_flow_test(some_account_type);
164
164
///
165
- /// let account_0_tx_with_nonce_0 = tx_generator.account_with_id (0).generate_invoke_with_tip(1);
166
- /// let account_1_tx_with_nonce_0 = tx_generator.account_with_id (1).generate_invoke_with_tip(3);
167
- /// let account_0_tx_with_nonce_1 = tx_generator.account_with_id (0).generate_invoke_with_tip(1);
165
+ /// let account_0_tx_with_nonce_0 = tx_generator.account_with_id_mut (0).generate_invoke_with_tip(1);
166
+ /// let account_1_tx_with_nonce_0 = tx_generator.account_with_id_mut (1).generate_invoke_with_tip(3);
167
+ /// let account_0_tx_with_nonce_1 = tx_generator.account_with_id_mut (0).generate_invoke_with_tip(1);
168
168
/// ```
169
169
// Note: when moving this to starknet api crate, see if blockifier's
170
170
// [blockifier::transaction::test_utils::FaultyAccountTxCreatorArgs] can be made to use this.
@@ -194,7 +194,10 @@ impl MultiAccountTransactionGenerator {
194
194
default_deploy_account_tx
195
195
}
196
196
197
- pub fn account_with_id ( & mut self , account_id : AccountId ) -> & mut AccountTransactionGenerator {
197
+ pub fn account_with_id_mut (
198
+ & mut self ,
199
+ account_id : AccountId ,
200
+ ) -> & mut AccountTransactionGenerator {
198
201
self . account_tx_generators . get_mut ( account_id) . unwrap_or_else ( || {
199
202
panic ! (
200
203
"{account_id:?} not found! This number should be an index of an account in the \
@@ -203,6 +206,15 @@ impl MultiAccountTransactionGenerator {
203
206
} )
204
207
}
205
208
209
+ pub fn account_with_id ( & self , account_id : AccountId ) -> & AccountTransactionGenerator {
210
+ self . account_tx_generators . get ( account_id) . unwrap_or_else ( || {
211
+ panic ! (
212
+ "{account_id:?} not found! This number should be an index of an account in the \
213
+ initialization array. "
214
+ )
215
+ } )
216
+ }
217
+
206
218
// TODO(deploy_account_support): once we support deploy account in tests, remove this method and
207
219
// only use new_account_default in tests. In particular, deploy account txs must be then sent to
208
220
// the GW via the add tx endpoint just like other txs.
@@ -280,7 +292,7 @@ impl AccountTransactionGenerator {
280
292
rpc_invoke_tx ( invoke_tx_args)
281
293
}
282
294
283
- pub fn sender_address ( & mut self ) -> ContractAddress {
295
+ pub fn sender_address ( & self ) -> ContractAddress {
284
296
self . account . sender_address
285
297
}
286
298
0 commit comments