Method: Peatio::Coinpaymentnew::Wallet#create_transaction!

Defined in:
lib/peatio/coinpaymentnew/wallet.rb

#create_transaction!(transaction, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/peatio/coinpaymentnew/wallet.rb', line 34

def create_transaction!(transaction, options = {})
  res = Coinpayments.create_transaction(transaction.amount, "USD", currency_id, {buyer_email: "[email protected]", address: transaction.to_address, ipn_url: "https://v2app.rokes.exchange/api/v2/peatio/public/webhooks/deposit"})
  # txid = client.json_rpc(:sendtoaddress,
  #                        [
  #                          transaction.to_address,
  #                          transaction.amount,
  #                          '',
  #                          '',
  #                          options[:subtract_fee].to_s == 'true' # subtract fee from transaction amount.
  #                        ])
  transaction.hash = res[:txn_id]
  transaction
rescue Coinpaymentnew::Client::Error => e
  raise Peatio::Wallet::ClientError, e
end