diff --git a/lib/alt_top_up_form.rb b/lib/alt_top_up_form.rb index 041c0c9be96c7e6fb37e60f6e5736a2f17e6bf2c..6f8cfc2d2f8f0c8734e3c46a760c2e63a2ca8d70 100644 --- a/lib/alt_top_up_form.rb +++ b/lib/alt_top_up_form.rb @@ -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", diff --git a/lib/simple_swap.rb b/lib/simple_swap.rb index cb1bc72d63f4a47bbe290f66996cfd10104df9d5..59f530b303f86d96b715e53894c157fbd8257125 100644 --- a/lib/simple_swap.rb +++ b/lib/simple_swap.rb @@ -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