diff --git a/lib/simple_swap.rb b/lib/simple_swap.rb index 6663afb3496472eb7c61c41e361cf149d6123dcc..11e852535f32878ccfbbbc458246705a4acfb2cd 100644 --- a/lib/simple_swap.rb +++ b/lib/simple_swap.rb @@ -39,7 +39,7 @@ class SimpleSwap fixed: false, currency_from: currency, currency_to: "btc", - amount: 10, + amount: currency == "xmr" ? 0.1 : 0.01, address_to: target }.to_json ).then(&method(:parse)) @@ -48,7 +48,11 @@ class SimpleSwap def parse(req) return req.response["address_from"] if req.response["address_from"] - raise req.response["message"] || "Error creating address" + if req.response["error"].to_s =~ /does not fall within the range/ + raise "Network fees are too high, try again later." + end + + raise req.response["message"] || req.response["error"] || "Error" end def req(m, path, query: {}, body: nil)