feat: Use Arc instead of & for protocol_state in Swap

- dealing with lifetimes makes refactoring painful for our users.
This commit is contained in:
TAMARA LIPOWSKI
2025-08-20 15:25:16 -04:00
parent 2a68dd117b
commit a2a53195ed
5 changed files with 26 additions and 23 deletions

View File

@@ -739,7 +739,7 @@ impl SwapEncoder for BebopSwapEncoder {
}
let (partial_fill_offset, original_filled_taker_amount, bebop_calldata) =
if let Some(state) = swap.protocol_state {
if let Some(state) = &swap.protocol_state {
let indicatively_priced_state = state
.as_indicatively_priced()
.map_err(|e| {
@@ -1994,7 +1994,7 @@ mod tests {
let swap = SwapBuilder::new(bebop_component, token_in.clone(), token_out.clone())
.estimated_amount_in(BigUint::from_str("3000000000").unwrap())
.protocol_state(&bebop_state)
.protocol_state(Arc::new(bebop_state))
.build();
let encoding_context = EncodingContext {