feat: Use Arc instead of & for protocol_state in Swap
- dealing with lifetimes makes refactoring painful for our users.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user