@@ -37,7 +37,7 @@ class AltTopUpForm
when "BTC", "BCH"
ADD_ADDR.fetch(action).new(@customer)
when /\A[A-Z]{3}\Z/
- SimpleSwapAddress.new(@customer, action, @btc_addresses.first)
+ SimpleSwapAddress.new(@customer, action, @bch_addresses.first)
else
NoOp.new
end
@@ -78,20 +78,20 @@ class AltTopUpForm
end
class SimpleSwapAddress
- def initialize(customer, currency, btc_address, simple_swap: SimpleSwap.new)
+ def initialize(customer, currency, bch_address, simple_swap: SimpleSwap.new)
@customer = customer
@currency = currency.downcase
- @btc_address = btc_address
+ @bch_address = bch_address
@simple_swap = simple_swap
end
- def btc_address
- @btc_address || @customer.add_btc_address
+ def bch_address
+ @bch_address || @customer.add_bch_address
end
def action(reply)
- EMPromise.resolve(btc_address).then { |btc|
- @simple_swap.fetch_addr(@currency, btc)
+ EMPromise.resolve(btc_address).then { |bch|
+ @simple_swap.fetch_addr(@currency, bch)
}.then do |addr|
reply.command << FormTemplate.render(
"alt_top_up/simpleswap",
@@ -13,7 +13,7 @@ class SimpleSwap
query: {
fixed: "false",
currency_from: currency,
- currency_to: "btc"
+ currency_to: "bch"
}
).then { |req|
{ min: req.response["min"]&.to_d || 0, max: req.response["max"]&.to_d }
@@ -26,7 +26,7 @@ class SimpleSwap
query: {
fixed: "false",
currency_from: currency,
- currency_to: "btc",
+ currency_to: "bch",
amount: 1
}
).then { |req| req.response.to_d }
@@ -38,7 +38,7 @@ class SimpleSwap
body: {
fixed: false,
currency_from: currency,
- currency_to: "btc",
+ currency_to: "bch",
amount: currency.downcase == "xmr" ? 0.1 : 0.01,
address_to: target
}.to_json