Sha256: 51d8ec5c834bf0c19921e0f89fc941cfe3695cc001108cbc9bdf5fdb11831361

Contents?: true

Size: 998 Bytes

Versions: 21

Compression:

Stored size: 998 Bytes

Contents

#!/usr/bin/env ruby

# This is an example of using the higher level "payment" wrapper. Notice
# that we are using KeyPair instead of the raw rbnacl keys and that we need
# not build the entire heirarchy of xdr object manually.
#
# You can see where these helpers are defined in the files underneath /lib,
# which is where we extend the xdrgen generated source files with our higher
# level api.

require 'stellar-base'
require 'faraday'
require 'faraday_middleware'

$server = Faraday.new(url: "http://localhost:39132") do |conn|
  conn.response :json
  conn.adapter Faraday.default_adapter
end

master      = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
destination = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")

tx = Stellar::Transaction.payment({
  account:     master,
  destination: destination,
  sequence:    1,
  amount:      [:native, 20]
})

b64    = tx.to_envelope(master).to_xdr(:base64)

result = $server.get('tx', blob: b64)
p result.body

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
stellar-base-0.22.0 examples/mid_level_transaction_post.rb
stellar-base-0.21.0 examples/mid_level_transaction_post.rb
stellar-base-0.20.0 examples/mid_level_transaction_post.rb
stellar-base-0.19.0 examples/mid_level_transaction_post.rb
stellar-base-0.18.0 examples/mid_level_transaction_post.rb
stellar-base-0.17.0 examples/mid_level_transaction_post.rb
stellar-base-0.16.0 examples/mid_level_transaction_post.rb
stellar-base-0.15.0 examples/mid_level_transaction_post.rb
stellar-base-0.14.0 examples/mid_level_transaction_post.rb
stellar-base-0.13.0 examples/mid_level_transaction_post.rb
stellar-base-0.12.0 examples/mid_level_transaction_post.rb
stellar-base-0.11.0 examples/mid_level_transaction_post.rb
auction-ruby-base-0.1.1 examples/mid_level_transaction_post.rb
stellar-base-0.10.0 examples/mid_level_transaction_post.rb
stellar-base-0.9.0 examples/mid_level_transaction_post.rb
stellar-base-0.8.0 examples/mid_level_transaction_post.rb
stellar-base-0.7.0 examples/mid_level_transaction_post.rb
stellar-base-0.6.1 examples/mid_level_transaction_post.rb
stellar-base-0.6.0 examples/mid_level_transaction_post.rb
stellar-base-0.5.0 examples/mid_level_transaction_post.rb