@@ -2042,35 +2042,37 @@ impl LiquidSdk {
2042
2042
self . receive_onchain ( amount_sat, * fees_sat) . await
2043
2043
}
2044
2044
PaymentMethod :: LiquidAddress => {
2045
+ let lbtc_asset_id = self . config . lbtc_asset_id ( ) ;
2045
2046
let ( asset_id, amount, amount_sat) = match amount. clone ( ) {
2046
2047
Some ( ReceiveAmount :: Asset {
2047
2048
asset_id,
2048
2049
payer_amount,
2049
2050
} ) => ( asset_id, payer_amount, None ) ,
2050
2051
Some ( ReceiveAmount :: Bitcoin { payer_amount_sat } ) => {
2051
- ( self . config . lbtc_asset_id ( ) , None , Some ( payer_amount_sat) )
2052
+ ( lbtc_asset_id. clone ( ) , None , Some ( payer_amount_sat) )
2052
2053
}
2053
- None => ( self . config . lbtc_asset_id ( ) , None , None ) ,
2054
+ None => ( lbtc_asset_id. clone ( ) , None , None ) ,
2054
2055
} ;
2055
2056
2056
2057
let address = self . onchain_wallet . next_unused_address ( ) . await ?. to_string ( ) ;
2057
- let receive_destination = if amount. is_some ( ) || amount_sat. is_some ( ) {
2058
- LiquidAddressData {
2059
- address : address. to_string ( ) ,
2060
- network : self . config . network . into ( ) ,
2061
- amount,
2062
- amount_sat,
2063
- asset_id : Some ( asset_id. clone ( ) ) ,
2064
- label : None ,
2065
- message : req. description . clone ( ) ,
2066
- }
2067
- . to_uri ( )
2068
- . map_err ( |e| PaymentError :: Generic {
2069
- err : format ! ( "Could not build BIP21 URI: {e:?}" ) ,
2070
- } ) ?
2071
- } else {
2072
- address
2073
- } ;
2058
+ let receive_destination =
2059
+ if asset_id. ne ( & lbtc_asset_id) || amount. is_some ( ) || amount_sat. is_some ( ) {
2060
+ LiquidAddressData {
2061
+ address : address. to_string ( ) ,
2062
+ network : self . config . network . into ( ) ,
2063
+ amount,
2064
+ amount_sat,
2065
+ asset_id : Some ( asset_id) ,
2066
+ label : None ,
2067
+ message : req. description . clone ( ) ,
2068
+ }
2069
+ . to_uri ( )
2070
+ . map_err ( |e| PaymentError :: Generic {
2071
+ err : format ! ( "Could not build BIP21 URI: {e:?}" ) ,
2072
+ } ) ?
2073
+ } else {
2074
+ address
2075
+ } ;
2074
2076
2075
2077
Ok ( ReceivePaymentResponse {
2076
2078
destination : receive_destination,
@@ -3303,7 +3305,7 @@ impl LiquidSdk {
3303
3305
3304
3306
let res = match input_type {
3305
3307
InputType :: LiquidAddress { ref address } => match & address. asset_id {
3306
- Some ( asset_id) if asset_id. eq ( & self . config . lbtc_asset_id ( ) ) . not ( ) => {
3308
+ Some ( asset_id) if asset_id. ne ( & self . config . lbtc_asset_id ( ) ) => {
3307
3309
let asset_metadata = self . persister . get_asset_metadata ( asset_id) ?. ok_or (
3308
3310
PaymentError :: AssetError {
3309
3311
err : format ! ( "Asset {asset_id} is not supported" ) ,
0 commit comments