@@ -3611,7 +3611,8 @@ pub mod args {
36113611 pub const NO_CONVERSIONS : ArgFlag = flag ( "no-conversions" ) ;
36123612 pub const NO_EXPIRATION : ArgFlag = flag ( "no-expiration" ) ;
36133613 pub const NUT : ArgFlag = flag ( "nut" ) ;
3614- pub const OSMOSIS_REST_RPC : Arg < String > = arg ( "osmosis-rest-rpc" ) ;
3614+ pub const OSMOSIS_LCD_RPC : ArgOpt < String > = arg_opt ( "osmosis-lcd" ) ;
3615+ pub const OSMOSIS_SQS_RPC : ArgOpt < String > = arg_opt ( "osmosis-sqs" ) ;
36153616 pub const OUT_FILE_PATH_OPT : ArgOpt < PathBuf > = arg_opt ( "out-file-path" ) ;
36163617 pub const OUTPUT : ArgOpt < PathBuf > = arg_opt ( "output" ) ;
36173618 pub const OUTPUT_DENOM : Arg < String > = arg ( "output-denom" ) ;
@@ -3673,7 +3674,7 @@ pub mod args {
36733674 pub const SENDER : Arg < String > = arg ( "sender" ) ;
36743675 pub const SHIELDED : ArgFlag = flag ( "shielded" ) ;
36753676 pub const SHOW_IBC_TOKENS : ArgFlag = flag ( "show-ibc-tokens" ) ;
3676- pub const SLIPPAGE : ArgOpt < f64 > = arg_opt ( "slippage-percentage" ) ;
3677+ pub const SLIPPAGE : ArgOpt < Dec > = arg_opt ( "slippage-percentage" ) ;
36773678 pub const SIGNING_KEYS : ArgMulti < WalletPublicKey , GlobStar > =
36783679 arg_multi ( "signing-keys" ) ;
36793680 pub const SIGNATURES : ArgMulti < PathBuf , GlobStar > = arg_multi ( "signatures" ) ;
@@ -3734,7 +3735,6 @@ pub mod args {
37343735 pub const WASM_DIR : ArgOpt < PathBuf > = arg_opt ( "wasm-dir" ) ;
37353736 pub const WASM_PATH : ArgOpt < PathBuf > = arg_opt ( "wasm-path" ) ;
37363737 pub const WEBSITE_OPT : ArgOpt < String > = arg_opt ( "website" ) ;
3737- pub const WINDOW_SECONDS : ArgOpt < u64 > = arg_opt ( "window-seconds" ) ;
37383738 pub const WITH_INDEXER : ArgOpt < String > = arg_opt ( "with-indexer" ) ;
37393739 pub const WRAPPER_SIGNATURE_OPT : ArgOpt < PathBuf > = arg_opt ( "gas-signature" ) ;
37403740 pub const TX_PATH : Arg < PathBuf > = arg ( "tx-path" ) ;
@@ -5241,49 +5241,41 @@ pub mod args {
52415241 slippage : self . slippage ,
52425242 local_recovery_addr : self . local_recovery_addr ,
52435243 route : self . route ,
5244- osmosis_rest_rpc : self . osmosis_rest_rpc ,
5244+ osmosis_lcd_rpc : self . osmosis_lcd_rpc ,
5245+ osmosis_sqs_rpc : self . osmosis_sqs_rpc ,
52455246 } )
52465247 }
52475248 }
52485249
52495250 impl Args for TxOsmosisSwap < CliTypes > {
52505251 fn parse ( matches : & ArgMatches ) -> Self {
52515252 let transfer = TxIbcTransfer :: parse ( matches) ;
5252- let osmosis_rest_rpc = OSMOSIS_REST_RPC . parse ( matches) ;
5253+ let osmosis_lcd_rpc = OSMOSIS_LCD_RPC . parse ( matches) ;
5254+ let osmosis_sqs_rpc = OSMOSIS_SQS_RPC . parse ( matches) ;
52535255 let output_denom = OUTPUT_DENOM . parse ( matches) ;
52545256 let maybe_trans_recipient = TARGET_OPT . parse ( matches) ;
52555257 let maybe_shielded_recipient =
52565258 PAYMENT_ADDRESS_TARGET_OPT . parse ( matches) ;
52575259 let maybe_overflow = OVERFLOW_OPT . parse ( matches) ;
52585260 let slippage_percent = SLIPPAGE . parse ( matches) ;
5259- if slippage_percent
5260- . is_some_and ( |percent| !( 0.0 ..=100.0 ) . contains ( & percent) )
5261- {
5261+ if slippage_percent. is_some_and ( |percent| {
5262+ let zero = Dec :: zero ( ) ;
5263+ let hundred = Dec :: new ( 100 , 0 ) . unwrap ( ) ;
5264+
5265+ percent < zero || percent > hundred
5266+ } ) {
52625267 panic ! (
52635268 "The slippage percent must be a number between 0 and 100."
52645269 )
52655270 }
5266- let window_seconds = WINDOW_SECONDS . parse ( matches) ;
52675271 let minimum_amount = MINIMUM_AMOUNT . parse ( matches) ;
52685272 let slippage = minimum_amount
52695273 . map ( |d| Slippage :: MinOutputAmount ( d. redenominate ( 0 ) . amount ( ) ) )
52705274 . or_else ( || {
52715275 Some ( Slippage :: Twap {
5272- slippage_percentage : slippage_percent
5273- . expect (
5274- "If a minimum amount was not provided, \
5275- slippage-percentage and window-seconds must \
5276- be specified.",
5277- )
5278- . to_string ( ) ,
5279- window_seconds : window_seconds. expect (
5280- "If a minimum amount was not provided, \
5281- slippage-percentage and window-seconds must be \
5282- specified.",
5283- ) ,
5276+ slippage_percentage : slippage_percent?,
52845277 } )
5285- } )
5286- . unwrap ( ) ;
5278+ } ) ;
52875279 let local_recovery_addr = LOCAL_RECOVERY_ADDR . parse ( matches) ;
52885280 let route = match OSMOSIS_POOL_HOP . parse ( matches) {
52895281 r if r. is_empty ( ) => None ,
@@ -5301,23 +5293,31 @@ pub mod args {
53015293 slippage,
53025294 local_recovery_addr,
53035295 route,
5304- osmosis_rest_rpc,
5296+ osmosis_lcd_rpc,
5297+ osmosis_sqs_rpc,
53055298 }
53065299 }
53075300
53085301 fn def ( app : App ) -> App {
53095302 app. add_args :: < TxIbcTransfer < CliTypes > > ( )
53105303 . arg (
5311- OSMOSIS_REST_RPC
5304+ OSMOSIS_LCD_RPC
53125305 . def ( )
5313- . help ( wrap ! ( "A url pointing to an Osmosis REST rpc." ) ) ,
5306+ . help ( wrap ! ( "URL pointing to an Osmosis lcd rpc." ) ) ,
53145307 )
5315- . arg ( OSMOSIS_POOL_HOP . def ( ) . help ( wrap ! (
5316- "Individual hop of the route to take through Osmosis \
5317- pools. This value takes the form \
5318- <osmosis-pool-id>:<pool-output-denom>. When unspecified, \
5319- the optimal route is queried on the fly."
5320- ) ) )
5308+ . arg (
5309+ OSMOSIS_SQS_RPC
5310+ . def ( )
5311+ . help ( wrap ! ( "URL pointing to an Osmosis sqs rpc." ) ) ,
5312+ )
5313+ . arg ( OSMOSIS_POOL_HOP . def ( ) . conflicts_with ( SLIPPAGE . name ) . help (
5314+ wrap ! (
5315+ "Individual hop of the route to take through Osmosis \
5316+ pools. This value takes the form \
5317+ <osmosis-pool-id>:<pool-output-denom>. When \
5318+ unspecified, the optimal route is queried on the fly."
5319+ ) ,
5320+ ) )
53215321 . arg ( OUTPUT_DENOM . def ( ) . help ( wrap ! (
53225322 "IBC trace path (on Namada) of the desired asset. This is \
53235323 a string of the form \
@@ -5353,34 +5353,21 @@ pub mod args {
53535353 of the trade. If unspecified, a disposable address is \
53545354 generated."
53555355 ) ) )
5356- . arg ( SLIPPAGE . def ( ) . requires ( WINDOW_SECONDS . name ) . help ( wrap ! (
5356+ . arg ( SLIPPAGE . def ( ) . help ( wrap ! (
53575357 "Slippage percentage, as a number between 0 and 100. \
53585358 Represents the maximum acceptable deviation from the \
53595359 expected price during a trade."
53605360 ) ) )
5361- . arg ( WINDOW_SECONDS . def ( ) . requires ( SLIPPAGE . name ) . help ( wrap ! (
5362- "Time period (in seconds) over which the average price is \
5363- calculated."
5364- ) ) )
5365- . arg (
5366- MINIMUM_AMOUNT
5367- . def ( )
5368- . conflicts_with ( SLIPPAGE . name )
5369- . conflicts_with ( WINDOW_SECONDS . name )
5370- . help ( wrap ! (
5371- "Minimum amount of target asset that the trade \
5372- should produce."
5373- ) ) ,
5374- )
5361+ . arg ( MINIMUM_AMOUNT . def ( ) . conflicts_with ( SLIPPAGE . name ) . help (
5362+ wrap ! (
5363+ "Minimum amount of target asset that the trade should \
5364+ produce."
5365+ ) ,
5366+ ) )
53755367 . arg ( LOCAL_RECOVERY_ADDR . def ( ) . help ( wrap ! (
53765368 "Address on Osmosis from which to recover funds in case \
53775369 of failure."
53785370 ) ) )
5379- . group (
5380- ArgGroup :: new ( "slippage" )
5381- . args ( [ SLIPPAGE . name , MINIMUM_AMOUNT . name ] )
5382- . required ( true ) ,
5383- )
53845371 . group (
53855372 ArgGroup :: new ( "transfer-target" )
53865373 . args ( [
0 commit comments