@@ -5,7 +5,7 @@ use crate::{
55 JUP_V6_SHARED_ACCOUNT_ROUTE_DESTINATION_ACCOUNT_INDEX ,
66 JUP_V6_SHARED_ACCOUNT_ROUTE_SOURCE_ACCOUNT_INDEX ,
77 } ,
8- error:: ZapSdkError ,
8+ error:: ProtozolZapError ,
99 safe_math:: { SafeCast , SafeMath } ,
1010 RawZapOutAmmInfo , ZapInfoProcessor , ZapOutParameters ,
1111} ;
@@ -15,7 +15,7 @@ use jupiter::types::Swap;
1515
1616pub struct ZapJupV6RouteInfoProcessor ;
1717
18- fn ensure_whitelisted_swap_leg ( route_plan_steps : & [ RoutePlanStep ] ) -> Result < ( ) , ZapSdkError > {
18+ fn ensure_whitelisted_swap_leg ( route_plan_steps : & [ RoutePlanStep ] ) -> Result < ( ) , ProtozolZapError > {
1919 for step in route_plan_steps {
2020 match step. swap {
2121 Swap :: Meteora
@@ -33,7 +33,7 @@ fn ensure_whitelisted_swap_leg(route_plan_steps: &[RoutePlanStep]) -> Result<(),
3333 | Swap :: RaydiumClmmV2 => {
3434 // whitelisted swap leg
3535 }
36- _ => return Err ( ZapSdkError :: InvalidZapOutParameters ) ,
36+ _ => return Err ( ProtozolZapError :: InvalidZapOutParameters ) ,
3737 }
3838 }
3939
@@ -45,7 +45,7 @@ fn ensure_whitelisted_swap_leg(route_plan_steps: &[RoutePlanStep]) -> Result<(),
4545/// - All swap paths must converge to exactly one terminal output
4646pub ( crate ) fn ensure_route_plan_fully_converges (
4747 route_plan_steps : & [ RoutePlanStep ] ,
48- ) -> Result < ( ) , ZapSdkError > {
48+ ) -> Result < ( ) , ProtozolZapError > {
4949 // Verify each unique input_index sums to exactly 100%
5050 for ( i, step) in route_plan_steps. iter ( ) . enumerate ( ) {
5151 // Only process first occurrence of each input_index
@@ -60,10 +60,10 @@ pub(crate) fn ensure_route_plan_fully_converges(
6060 . iter ( )
6161 . filter ( |s| s. input_index == step. input_index )
6262 . try_fold ( 0u8 , |acc, s| acc. checked_add ( s. percent ) )
63- . ok_or ( ZapSdkError :: MathOverflow ) ?;
63+ . ok_or ( ProtozolZapError :: MathOverflow ) ?;
6464
6565 if percent_sum != 100 {
66- return Err ( ZapSdkError :: InvalidZapOutParameters ) ;
66+ return Err ( ProtozolZapError :: InvalidZapOutParameters ) ;
6767 }
6868 }
6969
@@ -83,22 +83,22 @@ pub(crate) fn ensure_route_plan_fully_converges(
8383 . count ( ) ;
8484
8585 if terminal_count != 1 {
86- return Err ( ZapSdkError :: InvalidZapOutParameters ) ;
86+ return Err ( ProtozolZapError :: InvalidZapOutParameters ) ;
8787 }
8888
8989 Ok ( ( ) )
9090}
9191
9292impl ZapInfoProcessor for ZapJupV6RouteInfoProcessor {
93- fn validate_payload ( & self , payload : & [ u8 ] ) -> Result < ( ) , ZapSdkError > {
93+ fn validate_payload ( & self , payload : & [ u8 ] ) -> Result < ( ) , ProtozolZapError > {
9494 let route_params = jupiter:: client:: args:: Route :: try_from_slice ( payload)
95- . map_err ( |_| ZapSdkError :: InvalidZapOutParameters ) ?;
95+ . map_err ( |_| ProtozolZapError :: InvalidZapOutParameters ) ?;
9696 ensure_whitelisted_swap_leg ( & route_params. route_plan ) ?;
9797 ensure_route_plan_fully_converges ( & route_params. route_plan ) ?;
9898
9999 // Ensure no platform_fee_bps is 0, so operator can't steal funds by providing their account as platform_fee_account
100100 if route_params. platform_fee_bps != 0 {
101- return Err ( ZapSdkError :: InvalidZapOutParameters ) ;
101+ return Err ( ProtozolZapError :: InvalidZapOutParameters ) ;
102102 }
103103
104104 Ok ( ( ) )
@@ -107,7 +107,7 @@ impl ZapInfoProcessor for ZapJupV6RouteInfoProcessor {
107107 fn extract_raw_zap_out_amm_info (
108108 & self ,
109109 zap_params : & ZapOutParameters ,
110- ) -> Result < RawZapOutAmmInfo , ZapSdkError > {
110+ ) -> Result < RawZapOutAmmInfo , ProtozolZapError > {
111111 let amount_in_offset = zap_params
112112 . payload_data
113113 . len ( )
@@ -125,15 +125,15 @@ impl ZapInfoProcessor for ZapJupV6RouteInfoProcessor {
125125pub struct ZapJupV6SharedRouteInfoProcessor ;
126126
127127impl ZapInfoProcessor for ZapJupV6SharedRouteInfoProcessor {
128- fn validate_payload ( & self , payload : & [ u8 ] ) -> Result < ( ) , ZapSdkError > {
128+ fn validate_payload ( & self , payload : & [ u8 ] ) -> Result < ( ) , ProtozolZapError > {
129129 let route_params = jupiter:: client:: args:: SharedAccountsRoute :: try_from_slice ( payload)
130- . map_err ( |_| ZapSdkError :: InvalidZapOutParameters ) ?;
130+ . map_err ( |_| ProtozolZapError :: InvalidZapOutParameters ) ?;
131131 ensure_whitelisted_swap_leg ( & route_params. route_plan ) ?;
132132 ensure_route_plan_fully_converges ( & route_params. route_plan ) ?;
133133
134134 // Ensure no platform_fee_bps is 0, so operator can't steal funds by providing their account as platform_fee_account
135135 if route_params. platform_fee_bps != 0 {
136- return Err ( ZapSdkError :: InvalidZapOutParameters ) ;
136+ return Err ( ProtozolZapError :: InvalidZapOutParameters ) ;
137137 }
138138
139139 Ok ( ( ) )
@@ -142,7 +142,7 @@ impl ZapInfoProcessor for ZapJupV6SharedRouteInfoProcessor {
142142 fn extract_raw_zap_out_amm_info (
143143 & self ,
144144 zap_params : & ZapOutParameters ,
145- ) -> Result < RawZapOutAmmInfo , ZapSdkError > {
145+ ) -> Result < RawZapOutAmmInfo , ProtozolZapError > {
146146 let amount_in_offset = zap_params
147147 . payload_data
148148 . len ( )
0 commit comments