def run(args = [])
      opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
        o.banner = "Usage: zold pay wallet target amount [details] [options]
Where:
    'wallet' is the sender's wallet ID
    'target' is the beneficiary (either wallet ID or invoice number)'
    'amount' is the amount to pay, for example: '14.95Z' (in ZLD) or '12345z' (in zents)
    'details' is the optional text to attach to the payment
Available options:"
        o.string '--private-key',
          'The location of RSA private key (default: ~/.ssh/id_rsa)',
          require: true,
          default: File.expand_path('~/.ssh/id_rsa')
        o.string '--network',
          'The name of the network we work in',
          default: 'test'
        o.bool '--force',
          'Ignore all validations',
          default: false
        o.string '--time',
          "Time of transaction (default: #{Time.now.utc.iso8601})",
          default: Time.now.utc.iso8601
        o.string '--keygap',
          'Keygap, if the private RSA key is not complete',
          default: ''
        o.bool '--tolerate-edges',
          'Don\'t fail if only "edge" (not "master" ones) nodes have the wallet',
          default: false
        o.integer '--tolerate-quorum',
          'The minimum number of nodes required for a successful fetch (default: 4)',
          default: 4
        o.bool '--dont-pay-taxes',
          'Don\'t pay taxes even if the wallet is in debt',
          default: false
        o.bool '--skip-propagate',
          'Don\'t propagate the paying wallet after successful pay',
          default: false
        o.bool '--help', 'Print instructions'
      end
      mine = Args.new(opts, @log).take || return
      raise 'Payer wallet ID is required as the first argument' if mine[0].nil?
      id = Id.new(mine[0])
      raise 'Recepient\'s invoice or wallet ID is required as the second argument' if mine[1].nil?
      invoice = mine[1]
      unless invoice.include?('@')
        require_relative 'invoice'
        invoice = Invoice.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
          ['invoice', invoice, "--tolerate-quorum=#{Shellwords.escape(opts['tolerate-quorum'])}"] +
          ["--network=#{Shellwords.escape(opts['network'])}"] +
          (opts['tolerate-edges'] ? ['--tolerate-edges'] : [])
        )
      end
      raise 'Amount is required (in ZLD) as the third argument' if mine[2].nil?
      amount = amount(mine[2].strip)
      details = mine[3] || '-'
      taxes(id, opts)
      txn = @wallets.acq(id, exclusive: true) do |from|
        pay(from, invoice, amount, details, opts)
      end
      return if opts['skip-propagate']
      require_relative 'propagate'
      Propagate.new(wallets: @wallets, log: @log).run(['propagate', id.to_s])
      txn
    end
def run(args = [])
      opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
        o.banner = "Usage: zold pay wallet target amount [details] [options]
Where:
    'wallet' is the sender's wallet ID
    'target' is the beneficiary (either wallet ID or invoice number)'
    'amount' is the amount to pay, for example: '14.95Z' (in ZLD) or '12345z' (in zents)
    'details' is the optional text to attach to the payment
Available options:"
        o.string '--private-key',
          'The location of RSA private key (default: ~/.ssh/id_rsa)',
          require: true,
          default: File.expand_path('~/.ssh/id_rsa')
        o.string '--network',
          'The name of the network we work in',
          default: 'test'
        o.bool '--force',
          'Ignore all validations',
          default: false
        o.string '--time',
          "Time of transaction (default: 
          default: Time.now.utc.iso8601
        o.string '--keygap',
          'Keygap, if the private RSA key is not complete',
          default: ''
        o.bool '--tolerate-edges',
          'Don\'t fail if only "edge" (not "master" ones) nodes have the wallet',
          default: false
        o.integer '--tolerate-quorum',
          'The minimum number of nodes required for a successful fetch (default: 4)',
          default: 4
        o.bool '--dont-pay-taxes',
          'Don\'t pay taxes even if the wallet is in debt',
          default: false
        o.bool '--skip-propagate',
          'Don\'t propagate the paying wallet after successful pay',
          default: false
        o.bool '--help', 'Print instructions'
      end
      mine = Args.new(opts, @log).take || return
      raise 'Payer wallet ID is required as the first argument' if mine[0].nil?
      id = Id.new(mine[0])
      raise 'Recepient\'s invoice or wallet ID is required as the second argument' if mine[1].nil?
      invoice = mine[1]
      unless invoice.include?('@')
        require_relative 'invoice'
        invoice = Invoice.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
          ['invoice', invoice, "--tolerate-quorum=
          ["--network=
          (opts['tolerate-edges'] ? ['--tolerate-edges'] : [])
        )
      end
      raise 'Amount is required (in ZLD) as the third argument' if mine[2].nil?
      amount = amount(mine[2].strip)
      details = mine[3] || '-'
      taxes(id, opts)
      txn = @wallets.acq(id, exclusive: true) do |from|
        pay(from, invoice, amount, details, opts)
      end
      return if opts['skip-propagate']
      require_relative 'propagate'
      Propagate.new(wallets: @wallets, log: @log).run(['propagate', id.to_s])
      txn
    end
def run ( args = [ ] ) opts = Slop . parse ( args , help : true , suppress_errors : true ) do | o | o . banner = "Usage: zold pay wallet target amount [details] [options]
Where:
    'wallet' is the sender's wallet ID
    'target' is the beneficiary (either wallet ID or invoice number)'
    'amount' is the amount to pay, for example: '14.95Z' (in ZLD) or '12345z' (in zents)
    'details' is the optional text to attach to the payment
Available options:" o . string '--private-key' , 'The location of RSA private key (default: ~/.ssh/id_rsa)' , require : true , default : File . expand_path ( '~/.ssh/id_rsa' ) o . string '--network' , 'The name of the network we work in' , default : 'test' o . bool '--force' , 'Ignore all validations' , default : false o . string '--time' , "Time of transaction (default: #{Time.now.utc.iso8601})" , default : Time . now . utc . iso8601 o . string '--keygap' , 'Keygap, if the private RSA key is not complete' , default : '' o . bool '--tolerate-edges' , 'Don\'t fail if only "edge" (not "master" ones) nodes have the wallet' , default : false o . integer '--tolerate-quorum' , 'The minimum number of nodes required for a successful fetch (default: 4)' , default : 4 o . bool '--dont-pay-taxes' , 'Don\'t pay taxes even if the wallet is in debt' , default : false o . bool '--skip-propagate' , 'Don\'t propagate the paying wallet after successful pay' , default : false o . bool '--help' , 'Print instructions' end mine = Args . new ( opts , @log ) . take || return raise 'Payer wallet ID is required as the first argument' if mine [ 0 ] . nil? id = Id . new ( mine [ 0 ] ) raise 'Recepient\'s invoice or wallet ID is required as the second argument' if mine [ 1 ] . nil? invoice = mine [ 1 ] unless invoice . include? ( '@' ) require_relative 'invoice' invoice = Invoice . new ( wallets : @wallets , remotes : @remotes , copies : @copies , log : @log ) . run ( [ 'invoice' , invoice , "--tolerate-quorum=#{Shellwords.escape(opts['tolerate-quorum'])}" ] + [ "--network=#{Shellwords.escape(opts['network'])}" ] + ( opts [ 'tolerate-edges' ] ? [ '--tolerate-edges' ] : [ ] ) ) end raise 'Amount is required (in ZLD) as the third argument' if mine [ 2 ] . nil? amount = amount ( mine [ 2 ] . strip ) details = mine [ 3 ] || '-' taxes ( id , opts ) txn = @wallets . acq ( id , exclusive : true ) do | from | pay ( from , invoice , amount , details , opts ) end return if opts [ 'skip-propagate' ] require_relative 'propagate' Propagate . new ( wallets : @wallets , log : @log ) . run ( [ 'propagate' , id . to_s ] ) txn end
Sends a payment and returns the transaction just created in the
 paying wallet, an instance of Zold::Txn
Sends a payment and returns the transaction just created in the paying wallet an instance of Zold :: Txn