@@ -3693,15 +3693,18 @@ pub mod args {
36933693 pub const TARGET : Arg < WalletAddress > = arg ( "target" ) ;
36943694 pub const TARGET_OPT : ArgOpt < WalletAddress > = arg_opt ( "target" ) ;
36953695 pub const TEMPLATES_PATH : Arg < PathBuf > = arg ( "templates-path" ) ;
3696- // FIXME: add the test prelude in the cli args too
36973696 // WARNING: use only for testing purposes, MASP frontend fees don't make
36983697 // sense when operating from the CLI
3699- pub const __TEST_FRONTEND_SUS_FEE: ArgOpt < WalletTransferTarget > =
3700- arg_opt ( "frontend-sus-fee" ) ;
3698+ pub const __TEST_FRONTEND_SUS_FEE: ArgOpt < WalletAddress > =
3699+ arg_opt ( "test-frontend-sus-fee" ) ;
3700+ // WARNING: use only for testing purposes, MASP frontend fees don't make
3701+ // sense when operating from the CLI
3702+ pub const __TEST_FRONTEND_SUS_FEE_SHIELDED: ArgOpt < WalletPaymentAddr > =
3703+ arg_opt ( "test-frontend-sus-fee-shielded" ) ;
37013704 // WARNING: use only for testing purposes, MASP frontend fees don't make
37023705 // sense when operating from the CLI
37033706 pub const __TEST_FRONTEND_SUS_FEE_IBC: ArgOpt < WalletPaymentAddr > =
3704- arg_opt ( "frontend-sus-fee-ibc" ) ;
3707+ arg_opt ( "test- frontend-sus-fee-ibc" ) ;
37053708 pub const TIMEOUT_HEIGHT : ArgOpt < u64 > = arg_opt ( "timeout-height" ) ;
37063709 pub const TIMEOUT_SEC_OFFSET : ArgOpt < u64 > = arg_opt ( "timeout-sec-offset" ) ;
37073710 pub const TM_ADDRESS_OPT : ArgOpt < String > = arg_opt ( "tm-address" ) ;
@@ -5012,9 +5015,9 @@ pub mod args {
50125015 token: token. clone( ) ,
50135016 amount,
50145017 } ] ;
5015- let frontend_sus_fee = __TEST_FRONTEND_SUS_FEE
5016- . parse ( matches )
5017- . map_or ( Default :: default ( ) , |fee_target| {
5018+ let frontend_sus_fee = match __TEST_FRONTEND_SUS_FEE. parse ( matches )
5019+ {
5020+ Some ( address ) => {
50185021 // Take a constant fee of 1 on top of the input amount
50195022 let amount = InputAmount :: Unvalidated (
50205023 token:: DenominatedAmount :: new (
@@ -5023,19 +5026,33 @@ pub mod args {
50235026 ) ,
50245027 ) ;
50255028
5026- vec ! [ match PaymentAddress :: from_str( & fee_target. raw) {
5027- Ok ( _) => Either :: Right ( TxShieldedTarget {
5028- target: fee_target. to_payment_address( ) ,
5029- token: token. clone( ) ,
5030- amount,
5031- } ) ,
5032- Err ( _) => Either :: Left ( TxTransparentTarget {
5033- target: fee_target. to_address( ) ,
5034- token,
5035- amount,
5036- } ) ,
5037- } ]
5038- } ) ;
5029+ vec ! [ Either :: Left ( TxTransparentTarget {
5030+ target: address,
5031+ token,
5032+ amount,
5033+ } ) ]
5034+ }
5035+ None => {
5036+ __TEST_FRONTEND_SUS_FEE_SHIELDED. parse ( matches) . map_or (
5037+ Default :: default ( ) ,
5038+ |payment_address| {
5039+ // Take a constant fee of 1 on top of the input
5040+ // amount
5041+ let amount = InputAmount :: Unvalidated (
5042+ token:: DenominatedAmount :: new (
5043+ 1 . into ( ) ,
5044+ raw_amount. denom ( ) ,
5045+ ) ,
5046+ ) ;
5047+ vec ! [ Either :: Right ( TxShieldedTarget {
5048+ target: payment_address,
5049+ token: token. clone( ) ,
5050+ amount,
5051+ } ) ]
5052+ } ,
5053+ )
5054+ }
5055+ } ;
50395056
50405057 Self {
50415058 tx,
@@ -5063,10 +5080,26 @@ pub mod args {
50635080 . def ( )
50645081 . help ( wrap ! ( "The amount to transfer in decimal." ) ) ,
50655082 )
5066- . arg ( __TEST_FRONTEND_SUS_FEE. def ( ) . help ( wrap ! (
5067- "The optional address of the frontend provider that will \
5068- take the masp sustainability fee."
5069- ) ) )
5083+ . arg (
5084+ __TEST_FRONTEND_SUS_FEE
5085+ . def ( )
5086+ . help ( wrap ! (
5087+ "The optional transparent address of the frontend \
5088+ provider that will take the masp sustainability \
5089+ fee."
5090+ ) )
5091+ . conflicts_with ( __TEST_FRONTEND_SUS_FEE_SHIELDED. name ) ,
5092+ )
5093+ . arg (
5094+ __TEST_FRONTEND_SUS_FEE_SHIELDED
5095+ . def ( )
5096+ . help ( wrap ! (
5097+ "The optional payment address of the frontend \
5098+ provider that will take the masp sustainability \
5099+ fee."
5100+ ) )
5101+ . conflicts_with ( __TEST_FRONTEND_SUS_FEE. name ) ,
5102+ )
50705103 }
50715104 }
50725105
@@ -5159,9 +5192,9 @@ pub mod args {
51595192 } ] ;
51605193 let gas_spending_key = GAS_SPENDING_KEY . parse ( matches) ;
51615194
5162- let frontend_sus_fee = __TEST_FRONTEND_SUS_FEE
5163- . parse ( matches )
5164- . map_or ( Default :: default ( ) , |fee_target| {
5195+ let frontend_sus_fee = match __TEST_FRONTEND_SUS_FEE. parse ( matches )
5196+ {
5197+ Some ( address ) => {
51655198 // Take a constant fee of 1 on top of the input amount
51665199 let amount = InputAmount :: Unvalidated (
51675200 token:: DenominatedAmount :: new (
@@ -5170,19 +5203,33 @@ pub mod args {
51705203 ) ,
51715204 ) ;
51725205
5173- vec ! [ match PaymentAddress :: from_str( & fee_target. raw) {
5174- Ok ( _) => Either :: Right ( TxShieldedTarget {
5175- target: fee_target. to_payment_address( ) ,
5176- token: token. clone( ) ,
5177- amount,
5178- } ) ,
5179- Err ( _) => Either :: Left ( TxTransparentTarget {
5180- target: fee_target. to_address( ) ,
5181- token,
5182- amount,
5183- } ) ,
5184- } ]
5185- } ) ;
5206+ vec ! [ Either :: Left ( TxTransparentTarget {
5207+ target: address,
5208+ token,
5209+ amount,
5210+ } ) ]
5211+ }
5212+ None => {
5213+ __TEST_FRONTEND_SUS_FEE_SHIELDED. parse ( matches) . map_or (
5214+ Default :: default ( ) ,
5215+ |payment_address| {
5216+ // Take a constant fee of 1 on top of the input
5217+ // amount
5218+ let amount = InputAmount :: Unvalidated (
5219+ token:: DenominatedAmount :: new (
5220+ 1 . into ( ) ,
5221+ raw_amount. denom ( ) ,
5222+ ) ,
5223+ ) ;
5224+ vec ! [ Either :: Right ( TxShieldedTarget {
5225+ target: payment_address,
5226+ token: token. clone( ) ,
5227+ amount,
5228+ } ) ]
5229+ } ,
5230+ )
5231+ }
5232+ } ;
51865233
51875234 Self {
51885235 tx,
@@ -5217,10 +5264,26 @@ pub mod args {
52175264 payment. When not provided the source spending key will \
52185265 be used."
52195266 ) ) )
5220- . arg ( __TEST_FRONTEND_SUS_FEE. def ( ) . help ( wrap ! (
5221- "The optional address of the frontend provider that will \
5222- take the masp sustainability fee."
5223- ) ) )
5267+ . arg (
5268+ __TEST_FRONTEND_SUS_FEE
5269+ . def ( )
5270+ . help ( wrap ! (
5271+ "The optional transparent address of the frontend \
5272+ provider that will take the masp sustainability \
5273+ fee."
5274+ ) )
5275+ . conflicts_with ( __TEST_FRONTEND_SUS_FEE_SHIELDED. name ) ,
5276+ )
5277+ . arg (
5278+ __TEST_FRONTEND_SUS_FEE_SHIELDED
5279+ . def ( )
5280+ . help ( wrap ! (
5281+ "The optional payment address of the frontend \
5282+ provider that will take the masp sustainability \
5283+ fee."
5284+ ) )
5285+ . conflicts_with ( __TEST_FRONTEND_SUS_FEE. name ) ,
5286+ )
52245287 }
52255288 }
52265289
@@ -5296,28 +5359,43 @@ pub mod args {
52965359 let ibc_memo = IBC_MEMO . parse ( matches) ;
52975360 let gas_spending_key = GAS_SPENDING_KEY . parse ( matches) ;
52985361 let tx_code_path = PathBuf :: from ( TX_IBC_WASM ) ;
5299- let frontend_sus_fee =
5300- __TEST_FRONTEND_SUS_FEE. parse ( matches) . map ( |fee_target| {
5362+ let frontend_sus_fee = match __TEST_FRONTEND_SUS_FEE. parse ( matches)
5363+ {
5364+ Some ( address) => {
53015365 // Take a constant fee of 1 on top of the input amount
53025366 let amount = InputAmount :: Unvalidated (
53035367 token:: DenominatedAmount :: new (
53045368 1 . into ( ) ,
53055369 raw_amount. denom ( ) ,
53065370 ) ,
53075371 ) ;
5308- match PaymentAddress :: from_str ( & fee_target. raw ) {
5309- Ok ( _) => Either :: Right ( TxShieldedTarget {
5310- target : fee_target. to_payment_address ( ) ,
5311- token : token. clone ( ) ,
5312- amount,
5313- } ) ,
5314- Err ( _) => Either :: Left ( TxTransparentTarget {
5315- target : fee_target. to_address ( ) ,
5316- token : token. clone ( ) ,
5317- amount,
5318- } ) ,
5319- }
5320- } ) ;
5372+
5373+ Some ( Either :: Left ( TxTransparentTarget {
5374+ target : address,
5375+ token : token. clone ( ) ,
5376+ amount,
5377+ } ) )
5378+ }
5379+ None => {
5380+ __TEST_FRONTEND_SUS_FEE_SHIELDED. parse ( matches) . map (
5381+ |payment_address| {
5382+ // Take a constant fee of 1 on top of the input
5383+ // amount
5384+ let amount = InputAmount :: Unvalidated (
5385+ token:: DenominatedAmount :: new (
5386+ 1 . into ( ) ,
5387+ raw_amount. denom ( ) ,
5388+ ) ,
5389+ ) ;
5390+ Either :: Right ( TxShieldedTarget {
5391+ target : payment_address,
5392+ token : token. clone ( ) ,
5393+ amount,
5394+ } )
5395+ } ,
5396+ )
5397+ }
5398+ } ;
53215399
53225400 Self {
53235401 tx,
@@ -5387,11 +5465,22 @@ pub mod args {
53875465 . arg (
53885466 __TEST_FRONTEND_SUS_FEE
53895467 . def ( )
5390- . conflicts_with ( IBC_SHIELDING_DATA_PATH . name )
53915468 . help ( wrap ! (
5392- "The optional address of the frontend provider \
5393- that will take the masp sustainability fee."
5394- ) ) ,
5469+ "The optional transparent address of the frontend \
5470+ provider that will take the masp sustainability \
5471+ fee."
5472+ ) )
5473+ . conflicts_with ( __TEST_FRONTEND_SUS_FEE_SHIELDED. name ) ,
5474+ )
5475+ . arg (
5476+ __TEST_FRONTEND_SUS_FEE_SHIELDED
5477+ . def ( )
5478+ . help ( wrap ! (
5479+ "The optional payment address of the frontend \
5480+ provider that will take the masp sustainability \
5481+ fee."
5482+ ) )
5483+ . conflicts_with ( __TEST_FRONTEND_SUS_FEE. name ) ,
53955484 )
53965485 }
53975486 }
0 commit comments