#!/usr/bin/env ruby $:.unshift( File.expand_path("../../lib", __FILE__) ) require 'mastercoin-ruby' require 'thor' module Mastercoin module Cli class SimpleSend < Thor desc "decode_from_public_key ", "Decodes a simple send based on a given public key" def decode_from_public_key(public_key) puts Mastercoin::SimpleSend.decode_from_compressed_public_key(public_key).to_s end desc "decode_from_address
", "Decodes a simple send based on a address" def decode_from_address(address) puts Mastercoin::SimpleSend.decode_from_address(address).to_s end desc "encode_to_public_key ", "Encodes the parameters into a public key" option :amount, required: true option :currency_id, required: true, type: :numeric def encode_to_public_key simple_send = Mastercoin::SimpleSend.new(currency_id: options[:currency_id], amount: options[:amount]) puts simple_send.encode_to_compressed_public_key end desc "encode_to_address ", "Encodes the parameters into a bitcoin address" option :amount, required: true option :currency_id, required: true, type: :numeric option :receiving_address, required: true def encode_to_address simple_send = Mastercoin::SimpleSend.new(currency_id: options[:currency_id], amount: options[:amount], receiving_address: options[:receiving_address]) puts simple_send.encode_to_address end desc "advise ", "Gives advice on how to create a simple send Mastercoin address transaction" option :amount, required: true option :currency_id, required: true, type: :numeric option :receiving_address, required: true def advise simple_send = Mastercoin::SimpleSend.new(currency_id: options[:currency_id], amount: options[:amount], receiving_address: options[:receiving_address]) puts "Step 1: Send all funds in your wallet to the address which owns the MasterCoins (the following sends must come from that address) Step 2: Send exactly 0.00006 BTC from your address to each of the following 3 addresses in one transaction: The Exodus Address: 1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P The recipient address: #{options[:receiving_address]} The data address: #{simple_send.encode_to_address}" end end end end Mastercoin::Cli::SimpleSend.start(ARGV)