class MastercoinWallet::SimpleSendWindow
Public Class Methods
new(parent=nil)
click to toggle source
TODO: TRY TO REDEEM MULTISIGS
Calls superclass method
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 12 def initialize(parent=nil) super(parent) @ui = Ui_SimpleSend.new @ui.setupUi(self) @amount_input = findChild(Qt::LineEdit, "amount_input") @address_input = findChild(Qt::LineEdit, "address_input") @submit = findChild(Qt::PushButton, "submit_button") @amount_input.validator = Qt::DoubleValidator.new(0.00000001, 10000,8, @amount_input) @currency_select = findChild(Qt::ComboBox, "currency_box") @currency_select.addItem(tr("Mastercoin")) @currency_select.addItem(tr("Test Mastercoin")) connect(@submit, SIGNAL('clicked()'), self, SLOT('send_payment()')) end
Public Instance Methods
check_valid()
click to toggle source
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 63 def check_valid unless Bitcoin::valid_address?(@receiving_address) invalid! return end if @amount.nil? invalid! return end if @password.nil? || (@password && @password.length < 7) invalid! return end valid! end
invalid!()
click to toggle source
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 82 def invalid! @submit.enabled = false end
on_address_input_textChanged(address)
click to toggle source
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 39 def on_address_input_textChanged(address) @receiving_address = address check_valid end
on_amount_input_textChanged(amount)
click to toggle source
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 34 def on_amount_input_textChanged(amount) @amount = amount check_valid end
on_password_input_textChanged(password)
click to toggle source
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 44 def on_password_input_textChanged(password) @password = password check_valid end
send_payment()
click to toggle source
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 49 def send_payment if @currency_select.currentText() == "Mastercoin" currency_id = 1 elsif @currency_select.currentText() == "Test Mastercoin" currency_id = 2 else raise "How did you get here? ^_^" end data_key = Mastercoin::SimpleSend.new(currency_id: currency_id, amount: (BigDecimal.new(@amount.to_s)* 1e8).to_i).encode_to_compressed_public_key(MastercoinWallet.config.address) create_transaction_with_keys(data_key) close() end
valid!()
click to toggle source
# File lib/mastercoin-wallet/gui/simple_send_window.rb, line 86 def valid! @submit.enabled = true end