@@ -2033,35 +2033,37 @@ impl LiquidSdk {
2033
2033
self . receive_onchain ( amount_sat, * fees_sat) . await
2034
2034
}
2035
2035
PaymentMethod :: LiquidAddress => {
2036
+ let lbtc_asset_id = self . config . lbtc_asset_id ( ) ;
2036
2037
let ( asset_id, amount, amount_sat) = match amount. clone ( ) {
2037
2038
Some ( ReceiveAmount :: Asset {
2038
2039
asset_id,
2039
2040
payer_amount,
2040
2041
} ) => ( asset_id, payer_amount, None ) ,
2041
2042
Some ( ReceiveAmount :: Bitcoin { payer_amount_sat } ) => {
2042
- ( self . config . lbtc_asset_id ( ) , None , Some ( payer_amount_sat) )
2043
+ ( lbtc_asset_id. clone ( ) , None , Some ( payer_amount_sat) )
2043
2044
}
2044
- None => ( self . config . lbtc_asset_id ( ) , None , None ) ,
2045
+ None => ( lbtc_asset_id. clone ( ) , None , None ) ,
2045
2046
} ;
2046
2047
2047
2048
let address = self . onchain_wallet . next_unused_address ( ) . await ?. to_string ( ) ;
2048
- let receive_destination = if amount. is_some ( ) || amount_sat. is_some ( ) {
2049
- LiquidAddressData {
2050
- address : address. to_string ( ) ,
2051
- network : self . config . network . into ( ) ,
2052
- amount,
2053
- amount_sat,
2054
- asset_id : Some ( asset_id. clone ( ) ) ,
2055
- label : None ,
2056
- message : req. description . clone ( ) ,
2057
- }
2058
- . to_uri ( )
2059
- . map_err ( |e| PaymentError :: Generic {
2060
- err : format ! ( "Could not build BIP21 URI: {e:?}" ) ,
2061
- } ) ?
2062
- } else {
2063
- address
2064
- } ;
2049
+ let receive_destination =
2050
+ if asset_id. ne ( & lbtc_asset_id) || amount. is_some ( ) || amount_sat. is_some ( ) {
2051
+ LiquidAddressData {
2052
+ address : address. to_string ( ) ,
2053
+ network : self . config . network . into ( ) ,
2054
+ amount,
2055
+ amount_sat,
2056
+ asset_id : Some ( asset_id) ,
2057
+ label : None ,
2058
+ message : req. description . clone ( ) ,
2059
+ }
2060
+ . to_uri ( )
2061
+ . map_err ( |e| PaymentError :: Generic {
2062
+ err : format ! ( "Could not build BIP21 URI: {e:?}" ) ,
2063
+ } ) ?
2064
+ } else {
2065
+ address
2066
+ } ;
2065
2067
2066
2068
Ok ( ReceivePaymentResponse {
2067
2069
destination : receive_destination,
@@ -3287,7 +3289,7 @@ impl LiquidSdk {
3287
3289
3288
3290
let res = match input_type {
3289
3291
InputType :: LiquidAddress { ref address } => match & address. asset_id {
3290
- Some ( asset_id) if asset_id. eq ( & self . config . lbtc_asset_id ( ) ) . not ( ) => {
3292
+ Some ( asset_id) if asset_id. ne ( & self . config . lbtc_asset_id ( ) ) => {
3291
3293
let asset_metadata = self . persister . get_asset_metadata ( asset_id) ?. ok_or (
3292
3294
PaymentError :: AssetError {
3293
3295
err : format ! ( "Asset {asset_id} is not supported" ) ,
0 commit comments