├── .gitignore
├── .travis.yml
├── .yardopts
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Gemfile
├── Guardfile
├── LICENSE.txt
├── README.md
├── Rakefile
├── examples
├── allow_trust.rb
├── create_account.rb
├── low_level_transaction_post.rb
├── mid_level_transaction_post.rb
├── non_native_payment.rb
├── offer.rb
└── transaction_merge.rb
├── generated
├── stellar-base-generated.rb
└── stellar
│ ├── account_entry.rb
│ ├── account_entry
│ ├── ext.rb
│ └── ext
│ │ ├── v1.rb
│ │ └── v1
│ │ └── ext.rb
│ ├── account_flags.rb
│ ├── account_merge_result.rb
│ ├── account_merge_result_code.rb
│ ├── allow_trust_op.rb
│ ├── allow_trust_op
│ └── asset.rb
│ ├── allow_trust_result.rb
│ ├── allow_trust_result_code.rb
│ ├── asset.rb
│ ├── asset
│ ├── alpha_num12.rb
│ └── alpha_num4.rb
│ ├── asset_type.rb
│ ├── auth.rb
│ ├── auth_cert.rb
│ ├── authenticated_message.rb
│ ├── authenticated_message
│ └── v0.rb
│ ├── bucket_entry.rb
│ ├── bucket_entry_type.rb
│ ├── bucket_metadata.rb
│ ├── bucket_metadata
│ └── ext.rb
│ ├── bump_sequence_op.rb
│ ├── bump_sequence_result.rb
│ ├── bump_sequence_result_code.rb
│ ├── change_trust_op.rb
│ ├── change_trust_result.rb
│ ├── change_trust_result_code.rb
│ ├── claim_offer_atom.rb
│ ├── create_account_op.rb
│ ├── create_account_result.rb
│ ├── create_account_result_code.rb
│ ├── create_passive_sell_offer_op.rb
│ ├── crypto_key_type.rb
│ ├── curve25519_public.rb
│ ├── curve25519_secret.rb
│ ├── data_entry.rb
│ ├── data_entry
│ └── ext.rb
│ ├── decorated_signature.rb
│ ├── dont_have.rb
│ ├── envelope_type.rb
│ ├── error.rb
│ ├── error_code.rb
│ ├── hello.rb
│ ├── hmac_sha256_key.rb
│ ├── hmac_sha256_mac.rb
│ ├── inflation_payout.rb
│ ├── inflation_result.rb
│ ├── inflation_result_code.rb
│ ├── ip_addr_type.rb
│ ├── ledger_close_meta.rb
│ ├── ledger_close_meta_v0.rb
│ ├── ledger_close_value_signature.rb
│ ├── ledger_entry.rb
│ ├── ledger_entry
│ ├── data.rb
│ └── ext.rb
│ ├── ledger_entry_change.rb
│ ├── ledger_entry_change_type.rb
│ ├── ledger_entry_type.rb
│ ├── ledger_header.rb
│ ├── ledger_header
│ └── ext.rb
│ ├── ledger_header_history_entry.rb
│ ├── ledger_header_history_entry
│ └── ext.rb
│ ├── ledger_key.rb
│ ├── ledger_key
│ ├── account.rb
│ ├── data.rb
│ ├── offer.rb
│ └── trust_line.rb
│ ├── ledger_scp_messages.rb
│ ├── ledger_upgrade.rb
│ ├── ledger_upgrade_type.rb
│ ├── liabilities.rb
│ ├── manage_buy_offer_op.rb
│ ├── manage_buy_offer_result.rb
│ ├── manage_buy_offer_result_code.rb
│ ├── manage_data_op.rb
│ ├── manage_data_result.rb
│ ├── manage_data_result_code.rb
│ ├── manage_offer_effect.rb
│ ├── manage_offer_success_result.rb
│ ├── manage_offer_success_result
│ └── offer.rb
│ ├── manage_sell_offer_op.rb
│ ├── manage_sell_offer_result.rb
│ ├── manage_sell_offer_result_code.rb
│ ├── memo.rb
│ ├── memo_type.rb
│ ├── message_type.rb
│ ├── offer_entry.rb
│ ├── offer_entry
│ └── ext.rb
│ ├── offer_entry_flags.rb
│ ├── operation.rb
│ ├── operation
│ └── body.rb
│ ├── operation_meta.rb
│ ├── operation_result.rb
│ ├── operation_result
│ └── tr.rb
│ ├── operation_result_code.rb
│ ├── operation_type.rb
│ ├── path_payment_strict_receive_op.rb
│ ├── path_payment_strict_receive_result.rb
│ ├── path_payment_strict_receive_result
│ └── success.rb
│ ├── path_payment_strict_receive_result_code.rb
│ ├── path_payment_strict_send_op.rb
│ ├── path_payment_strict_send_result.rb
│ ├── path_payment_strict_send_result
│ └── success.rb
│ ├── path_payment_strict_send_result_code.rb
│ ├── payment_op.rb
│ ├── payment_result.rb
│ ├── payment_result_code.rb
│ ├── peer_address.rb
│ ├── peer_address
│ └── ip.rb
│ ├── peer_stats.rb
│ ├── price.rb
│ ├── public_key.rb
│ ├── public_key_type.rb
│ ├── scp_ballot.rb
│ ├── scp_envelope.rb
│ ├── scp_history_entry.rb
│ ├── scp_history_entry_v0.rb
│ ├── scp_nomination.rb
│ ├── scp_quorum_set.rb
│ ├── scp_statement.rb
│ ├── scp_statement
│ ├── pledges.rb
│ └── pledges
│ │ ├── confirm.rb
│ │ ├── externalize.rb
│ │ └── prepare.rb
│ ├── scp_statement_type.rb
│ ├── set_options_op.rb
│ ├── set_options_result.rb
│ ├── set_options_result_code.rb
│ ├── signed_survey_request_message.rb
│ ├── signed_survey_response_message.rb
│ ├── signer.rb
│ ├── signer_key.rb
│ ├── signer_key_type.rb
│ ├── simple_payment_result.rb
│ ├── stellar_message.rb
│ ├── stellar_value.rb
│ ├── stellar_value
│ └── ext.rb
│ ├── stellar_value_type.rb
│ ├── survey_message_command_type.rb
│ ├── survey_request_message.rb
│ ├── survey_response_body.rb
│ ├── survey_response_message.rb
│ ├── threshold_indexes.rb
│ ├── time_bounds.rb
│ ├── topology_response_body.rb
│ ├── transaction.rb
│ ├── transaction
│ └── ext.rb
│ ├── transaction_envelope.rb
│ ├── transaction_history_entry.rb
│ ├── transaction_history_entry
│ └── ext.rb
│ ├── transaction_history_result_entry.rb
│ ├── transaction_history_result_entry
│ └── ext.rb
│ ├── transaction_meta.rb
│ ├── transaction_meta_v1.rb
│ ├── transaction_meta_v2.rb
│ ├── transaction_result.rb
│ ├── transaction_result
│ ├── ext.rb
│ └── result.rb
│ ├── transaction_result_code.rb
│ ├── transaction_result_meta.rb
│ ├── transaction_result_pair.rb
│ ├── transaction_result_set.rb
│ ├── transaction_set.rb
│ ├── transaction_signature_payload.rb
│ ├── transaction_signature_payload
│ └── tagged_transaction.rb
│ ├── trust_line_entry.rb
│ ├── trust_line_entry
│ ├── ext.rb
│ └── ext
│ │ ├── v1.rb
│ │ └── v1
│ │ └── ext.rb
│ ├── trust_line_flags.rb
│ └── upgrade_entry_meta.rb
├── lib
├── stellar-base.rb
└── stellar
│ ├── account_flags.rb
│ ├── asset.rb
│ ├── base.rb
│ ├── base
│ ├── compat.rb
│ └── version.rb
│ ├── convert.rb
│ ├── factories.rb
│ ├── key_pair.rb
│ ├── networks.rb
│ ├── operation.rb
│ ├── path_payment_strict_receive_result.rb
│ ├── price.rb
│ ├── signer_key.rb
│ ├── thresholds.rb
│ ├── transaction.rb
│ ├── transaction_builder.rb
│ ├── transaction_envelope.rb
│ └── util
│ ├── continued_fraction.rb
│ └── strkey.rb
├── ruby-stellar-base.gemspec
├── spec
├── lib
│ └── stellar
│ │ ├── account_flags_spec.rb
│ │ ├── asset_spec.rb
│ │ ├── convert_spec.rb
│ │ ├── key_pair_spec.rb
│ │ ├── networks_spec.rb
│ │ ├── operation_spec.rb
│ │ ├── path_payment_strict_receive_result_spec.rb
│ │ ├── price_spec.rb
│ │ ├── signer_key_spec.rb
│ │ ├── thresholds_spec.rb
│ │ ├── transaction_builder_spec.rb
│ │ ├── transaction_envelope_spec.rb
│ │ ├── transaction_spec.rb
│ │ └── util
│ │ └── strkey_spec.rb
├── spec_helper.rb
└── support
│ └── matchers
│ ├── be_strkey.rb
│ ├── eq_bytes.rb
│ └── have_length.rb
├── tasks
├── rspec.rake
├── travis.rake
└── xdr.rake
└── xdr
├── Stellar-SCP.x
├── Stellar-ledger-entries.x
├── Stellar-ledger.x
├── Stellar-overlay.x
├── Stellar-transaction.x
└── Stellar-types.x
/.gitignore:
--------------------------------------------------------------------------------
1 | /.bundle/
2 | /.yardoc
3 | /Gemfile.lock
4 | /_yardoc/
5 | /coverage/
6 | /doc/
7 | /pkg/
8 | /spec/reports/
9 | /tmp/
10 | *.bundle
11 | *.so
12 | *.o
13 | *.a
14 | /.vscode
15 | mkmf.log
16 | .DS_Store
17 | .idea
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | dist: xenial
2 | language: ruby
3 | rvm:
4 | - 2.5
5 | - 2.6
6 | cache: bundler
7 | addons:
8 | apt:
9 | packages:
10 | - libsodium-dev
11 | before_install:
12 | - gem update --system && gem install --no-document bundler
13 | script: bundle exec rake travis
14 | notifications:
15 | slack:
16 | secure: V/6a8KFe067uukrbCJA2R1HPO4xy0YSQ1pwmHVRi5StX+yl+lYsWWJdjdBdT0j3iJBYyPRqU4bQYck+OloxtELnrHCX+OkodxcxW8W/ACc914iIf0FyY9pnusK7ck2awmt4Iuf94YPgi0XTm1aCcm+f0yU7wiIVFpftoXSk1EDY=
17 |
--------------------------------------------------------------------------------
/.yardopts:
--------------------------------------------------------------------------------
1 | --output-dir doc/generated
2 | --protected
3 | --no-private
4 | --embed-mixin ClassMethods
5 | lib/**/*.rb
6 | generated/**/*.rb
7 | -
8 | doc/*.md
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute
2 |
3 | Your contributions to the Stellar network will help improve the world’s financial
4 | infrastructure, faster.
5 |
6 | We want to make it as easy as possible to contribute changes that
7 | help the Stellar network grow and thrive. There are a few guidelines that we
8 | ask contributors to follow so that we can merge your changes quickly.
9 |
10 | ## Getting Started
11 |
12 | * Create a GitHub issue for your contribution, assuming one does not already exist.
13 | * Clearly describe the issue including steps to reproduce if it is a bug.
14 | * Fork the repository on GitHub
15 |
16 | ## Making Changes
17 |
18 | * Create a topic branch from where you want to base your work.
19 | * This is usually the master branch.
20 | * Please avoid working directly on the `master` branch.
21 | * Make sure you have added the necessary tests for your changes, and make sure all tests pass.
22 |
23 | ## Submitting Changes
24 |
25 | * Sign the Contributor License Agreement
26 | * Push your changes to a topic branch in your fork of the repository.
27 | * Submit a pull request to the corresponding repository in the Stellar organization.
28 | * Include a descriptive [commit message](https://github.com/erlang/otp/wiki/Writing-good-commit-messages).
29 | * Changes contributed via pull request should focus on a single issue at a time.
30 | * Rebase your local changes against the master branch. Resolve any conflicts that arise.
31 |
32 | At this point you're waiting on us. We like to at least comment on pull requests within three
33 | business days. We may suggest some changes or improvements or alternatives.
34 |
35 | # Additional Resources
36 |
37 | * [Bug tracker (Github)](https://github.com/bloom-solutions/ruby-stellar-base/issues)
38 | * Contributor License Agreement
39 | * #stellar-dev IRC channel on freenode.org and Slack chat on stellar-public.slack.com
40 |
41 |
42 | This document is inspired by:
43 |
44 | https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md
45 |
46 | https://github.com/thoughtbot/factory_girl_rails/blob/master/CONTRIBUTING.md
47 |
48 | https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | gemspec
4 |
5 | group :development do
6 | gem "pry"
7 | gem "faraday"
8 | gem "faraday_middleware"
9 | end
10 |
--------------------------------------------------------------------------------
/Guardfile:
--------------------------------------------------------------------------------
1 | guard :rspec, cmd: 'bundle exec rspec' do
2 | watch(%r{^spec/.+_spec\.rb$})
3 | watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4 | watch('spec/spec_helper.rb') { "spec" }
5 | end
6 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require "bundler/gem_tasks"
2 | Bundler.setup
3 |
4 | Dir["tasks/**/*.rake"].each{|f| load f}
5 |
--------------------------------------------------------------------------------
/examples/allow_trust.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'rest-client'
4 | require 'stellar-base'
5 |
6 | # This is an example of using a higher level allow_trust operation.
7 | # This assumes that a stellar account is already created and a trustline
8 | # to an anchor's asset has been established.
9 |
10 | HUG_ASSET_CODE = 'HUG'
11 |
12 | def sequence_from_account(account)
13 | data = get_account_data(account)
14 | data['sequence'].to_i
15 | end
16 |
17 | def get_account_data(keypair, network_url)
18 | response = RestClient.get "#{network_url}/accounts/#{keypair.address}"
19 | JSON.parse(response.body)
20 | end
21 |
22 | def submit_transaction_operation(xdr_envelope, network_url)
23 | begin
24 | response = RestClient.post "#{network_url}/transactions", { tx: xdr_envelope }
25 | JSON.parse(response.body)
26 |
27 | rescue RestClient::ExceptionWithResponse => e
28 | # handle exceptions here
29 | end
30 | end
31 |
32 | def allow_trust(address, issuer_keypair)
33 | account = Stellar::KeyPair.from_address(address)
34 | current_sequence = sequence_from_account(issuer_keypair)
35 |
36 | tx = Stellar::Transaction.allow_trust({
37 | trustor: account,
38 | account: issuer_keypair,
39 | asset: [:alphanum4, HUG_ASSET_CODE, issuer_keypair],
40 | authorize: true,
41 | sequence: current_sequence + 1,
42 | })
43 |
44 | xdr_envelope = tx.to_envelope(issuer_keypair).to_xdr(:base64)
45 | submit_transaction_operation(xdr_envelope)
46 | end
47 |
48 | # Usage:
49 | # issuer_keypair must be a keypair from an anchor with both the public and
50 | # private key i.e type Stellar::KeyPair
51 | allow_trust("GCHOWITWOUNRUXGJWYUB4IMICZKROLHDRC2TJH5W324LBJVM4JUVXOZL", issuer_keypair)
--------------------------------------------------------------------------------
/examples/create_account.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 |
4 | require 'stellar-base'
5 | require 'faraday'
6 | require 'faraday_middleware'
7 |
8 | $server = Faraday.new(url: "http://localhost:39132") do |conn|
9 | conn.response :json
10 | conn.adapter Faraday.default_adapter
11 | end
12 |
13 | master = Stellar::KeyPair.master
14 | destination = Stellar::KeyPair.random
15 |
16 | tx = Stellar::Transaction.create_account({
17 | account: master,
18 | destination: destination,
19 | sequence: 1,
20 | starting_balance: 50
21 | })
22 |
23 | b64 = tx.to_envelope(master).to_xdr(:base64)
24 | p b64
25 | result = $server.get('tx', blob: b64)
26 | p result.body
27 |
--------------------------------------------------------------------------------
/examples/low_level_transaction_post.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This is an example of using the raw xdr objects to post a transaction
4 | # notice that we must manually hash/sign the structures and we must manually
5 | # fill out all the fields.
6 | #
7 | # Look at mid_level_transaction_post.rb to see a friendlier form
8 |
9 | require 'rbnacl'
10 | require 'stellar-base'
11 | require 'faraday'
12 | require 'digest/sha2'
13 |
14 | master = RbNaCl::SigningKey.new("allmylifemyhearthasbeensearching")
15 | destination = RbNaCl::SigningKey.new("allmylifemyhearthasbeensearching")
16 |
17 | tx = Stellar::Transaction.new
18 | tx.account = master.verify_key.to_bytes
19 | tx.fee = 1000
20 | tx.seq_num = 1
21 |
22 | payment = Stellar::PaymentOp.new
23 | payment.destination = destination.verify_key.to_bytes
24 | payment.asset = Stellar::Asset.new(:native)
25 | payment.amount = 200 * Stellar::ONE
26 |
27 | op = Stellar::Operation.new
28 | op.body = Stellar::Operation::Body.new(:payment, payment)
29 |
30 | tx.operations = [op]
31 |
32 | raw = tx.to_xdr
33 | tx_hash = Digest::SHA256.digest raw
34 | signature = master.sign(tx_hash)
35 |
36 | env = Stellar::TransactionEnvelope.new
37 | env.tx = tx
38 | env.signatures = [Stellar::DecoratedSignature.new({
39 | hint:master.verify_key.to_bytes[0...4],
40 | signature:signature
41 | })]
42 |
43 | env_hex = env.to_xdr.unpack("H*").first
44 |
45 | result = Faraday.get('http://localhost:39132/tx', blob: env_hex)
46 | puts result.body
47 |
--------------------------------------------------------------------------------
/examples/mid_level_transaction_post.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This is an example of using the higher level "payment" wrapper. Notice
4 | # that we are using KeyPair instead of the raw rbnacl keys and that we need
5 | # not build the entire heirarchy of xdr object manually.
6 | #
7 | # You can see where these helpers are defined in the files underneath /lib,
8 | # which is where we extend the xdrgen generated source files with our higher
9 | # level api.
10 |
11 | require 'stellar-base'
12 | require 'faraday'
13 | require 'faraday_middleware'
14 |
15 | $server = Faraday.new(url: "http://localhost:39132") do |conn|
16 | conn.response :json
17 | conn.adapter Faraday.default_adapter
18 | end
19 |
20 | master = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
21 | destination = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
22 |
23 | tx = Stellar::Transaction.payment({
24 | account: master,
25 | destination: destination,
26 | sequence: 1,
27 | amount: [:native, 20]
28 | })
29 |
30 | b64 = tx.to_envelope(master).to_xdr(:base64)
31 |
32 | result = $server.get('tx', blob: b64)
33 | p result.body
34 |
--------------------------------------------------------------------------------
/examples/non_native_payment.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This is an example of using the higher level "payment" wrapper. Notice
4 | # that we are using KeyPair instead of the raw rbnacl keys and that we need
5 | # not build the entire heirarchy of xdr object manually.
6 | #
7 | # You can see where these helpers are defined in the files underneath /lib,
8 | # which is where we extend the xdrgen generated source files with our higher
9 | # level api.
10 | #
11 | # NOTE: due to the way that sequence number for a new account are set, this
12 | # example is pretty cumbersome to run. It is only used for illustrative purposes
13 | # of the flow
14 |
15 | require 'stellar-base'
16 | require 'faraday'
17 | require 'faraday_middleware'
18 |
19 | $server = Faraday.new(url: "http://localhost:39132") do |conn|
20 | conn.response :json
21 | conn.adapter Faraday.default_adapter
22 | end
23 |
24 | def submit(key, tx)
25 | b64 = tx.to_envelope(key).to_xdr(:base64)
26 | response = $server.get('tx', blob: b64)
27 | raw = [response.body["result"]].pack("H*")
28 | p response.body
29 | end
30 |
31 | master = Stellar::KeyPair.master
32 | destination = Stellar::KeyPair.master
33 |
34 | submit master, Stellar::Transaction.payment({
35 | account: master,
36 | destination: destination,
37 | sequence: 1,
38 | amount: [:native, 2000]
39 | })
40 |
41 | # NOTE: after this step, you need to get the sequence number for destination
42 | # Which is based off of the ledger sequence number it was funded in.
43 | gets # pause to get the account's sequence from the hayashi db
44 |
45 | destination_sequence = FILL_ME_IN
46 | # destination_sequence = 17179869185
47 |
48 | submit destination, Stellar::Transaction.change_trust({
49 | account: destination,
50 | sequence: destination_sequence,
51 | line: [:alphanum4, "USD\x00", master],
52 | limit: 1000
53 | })
54 |
55 | submit master, Stellar::Transaction.payment({
56 | account: master,
57 | destination: destination,
58 | sequence: 3,
59 | amount: [:alphanum4, "USD\x00", master, 100]
60 | })
61 |
--------------------------------------------------------------------------------
/examples/transaction_merge.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'stellar-base'
4 |
5 | master = Stellar::KeyPair.master
6 | destination = Stellar::KeyPair.master
7 |
8 | tx1 = Stellar::Transaction.payment({
9 | account: master,
10 | destination: destination,
11 | sequence: 1,
12 | amount: [:native, 20]
13 | })
14 |
15 | tx2 = Stellar::Transaction.payment({
16 | account: master,
17 | destination: destination,
18 | sequence: 2,
19 | amount: [:native, 20]
20 | })
21 |
22 | hex = tx1.merge(tx2).to_envelope(master).to_xdr(:base64)
23 | puts hex
24 |
--------------------------------------------------------------------------------
/generated/stellar/account_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct AccountEntry
9 | # {
10 | # AccountID accountID; // master public key for this account
11 | # int64 balance; // in stroops
12 | # SequenceNumber seqNum; // last sequence number used for this account
13 | # uint32 numSubEntries; // number of sub-entries this account has
14 | # // drives the reserve
15 | # AccountID* inflationDest; // Account to vote for during inflation
16 | # uint32 flags; // see AccountFlags
17 | #
18 | # string32 homeDomain; // can be used for reverse federation and memo lookup
19 | #
20 | # // fields used for signatures
21 | # // thresholds stores unsigned bytes: [weight of master|low|medium|high]
22 | # Thresholds thresholds;
23 | #
24 | # Signer signers<20>; // possible signers for this account
25 | #
26 | # // reserved for future use
27 | # union switch (int v)
28 | # {
29 | # case 0:
30 | # void;
31 | # case 1:
32 | # struct
33 | # {
34 | # Liabilities liabilities;
35 | #
36 | # union switch (int v)
37 | # {
38 | # case 0:
39 | # void;
40 | # }
41 | # ext;
42 | # } v1;
43 | # }
44 | # ext;
45 | # };
46 | #
47 | # ===========================================================================
48 | module Stellar
49 | class AccountEntry < XDR::Struct
50 | include XDR::Namespace
51 |
52 | autoload :Ext
53 |
54 | attribute :account_id, AccountID
55 | attribute :balance, Int64
56 | attribute :seq_num, SequenceNumber
57 | attribute :num_sub_entries, Uint32
58 | attribute :inflation_dest, XDR::Option[AccountID]
59 | attribute :flags, Uint32
60 | attribute :home_domain, String32
61 | attribute :thresholds, Thresholds
62 | attribute :signers, XDR::VarArray[Signer, 20]
63 | attribute :ext, Ext
64 | end
65 | end
66 |
--------------------------------------------------------------------------------
/generated/stellar/account_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # case 1:
13 | # struct
14 | # {
15 | # Liabilities liabilities;
16 | #
17 | # union switch (int v)
18 | # {
19 | # case 0:
20 | # void;
21 | # }
22 | # ext;
23 | # } v1;
24 | # }
25 | #
26 | # ===========================================================================
27 | module Stellar
28 | class AccountEntry
29 | class Ext < XDR::Union
30 | include XDR::Namespace
31 |
32 | autoload :V1
33 |
34 | switch_on XDR::Int, :v
35 |
36 | switch 0
37 | switch 1, :v1
38 |
39 | attribute :v1, V1
40 | end
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/generated/stellar/account_entry/ext/v1.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # Liabilities liabilities;
11 | #
12 | # union switch (int v)
13 | # {
14 | # case 0:
15 | # void;
16 | # }
17 | # ext;
18 | # }
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class AccountEntry
23 | class Ext
24 | class V1 < XDR::Struct
25 | include XDR::Namespace
26 |
27 | autoload :Ext
28 |
29 | attribute :liabilities, Liabilities
30 | attribute :ext, Ext
31 | end
32 | end
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/generated/stellar/account_entry/ext/v1/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class AccountEntry
17 | class Ext
18 | class V1
19 | class Ext < XDR::Union
20 | switch_on XDR::Int, :v
21 |
22 | switch 0
23 |
24 | end
25 | end
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/generated/stellar/account_flags.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum AccountFlags
9 | # { // masks for each flag
10 | #
11 | # // Flags set on issuer accounts
12 | # // TrustLines are created with authorized set to "false" requiring
13 | # // the issuer to set it for each TrustLine
14 | # AUTH_REQUIRED_FLAG = 0x1,
15 | # // If set, the authorized flag in TrustLines can be cleared
16 | # // otherwise, authorization cannot be revoked
17 | # AUTH_REVOCABLE_FLAG = 0x2,
18 | # // Once set, causes all AUTH_* flags to be read-only
19 | # AUTH_IMMUTABLE_FLAG = 0x4
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class AccountFlags < XDR::Enum
25 | member :auth_required_flag, 1
26 | member :auth_revocable_flag, 2
27 | member :auth_immutable_flag, 4
28 |
29 | seal
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/generated/stellar/account_merge_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union AccountMergeResult switch (AccountMergeResultCode code)
9 | # {
10 | # case ACCOUNT_MERGE_SUCCESS:
11 | # int64 sourceAccountBalance; // how much got transfered from source account
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class AccountMergeResult < XDR::Union
19 | switch_on AccountMergeResultCode, :code
20 |
21 | switch :account_merge_success, :source_account_balance
22 | switch :default
23 |
24 | attribute :source_account_balance, Int64
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/account_merge_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum AccountMergeResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # ACCOUNT_MERGE_SUCCESS = 0,
12 | # // codes considered as "failure" for the operation
13 | # ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself
14 | # ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist
15 | # ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set
16 | # ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers
17 | # ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, // sequence number is over max allowed
18 | # ACCOUNT_MERGE_DEST_FULL = -6 // can't add source balance to
19 | # // destination balance
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class AccountMergeResultCode < XDR::Enum
25 | member :account_merge_success, 0
26 | member :account_merge_malformed, -1
27 | member :account_merge_no_account, -2
28 | member :account_merge_immutable_set, -3
29 | member :account_merge_has_sub_entries, -4
30 | member :account_merge_seqnum_too_far, -5
31 | member :account_merge_dest_full, -6
32 |
33 | seal
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/generated/stellar/allow_trust_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct AllowTrustOp
9 | # {
10 | # AccountID trustor;
11 | # union switch (AssetType type)
12 | # {
13 | # // ASSET_TYPE_NATIVE is not allowed
14 | # case ASSET_TYPE_CREDIT_ALPHANUM4:
15 | # AssetCode4 assetCode4;
16 | #
17 | # case ASSET_TYPE_CREDIT_ALPHANUM12:
18 | # AssetCode12 assetCode12;
19 | #
20 | # // add other asset types here in the future
21 | # }
22 | # asset;
23 | #
24 | # bool authorize;
25 | # };
26 | #
27 | # ===========================================================================
28 | module Stellar
29 | class AllowTrustOp < XDR::Struct
30 | include XDR::Namespace
31 |
32 | autoload :Asset
33 |
34 | attribute :trustor, AccountID
35 | attribute :asset, Asset
36 | attribute :authorize, XDR::Bool
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/generated/stellar/allow_trust_op/asset.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (AssetType type)
9 | # {
10 | # // ASSET_TYPE_NATIVE is not allowed
11 | # case ASSET_TYPE_CREDIT_ALPHANUM4:
12 | # AssetCode4 assetCode4;
13 | #
14 | # case ASSET_TYPE_CREDIT_ALPHANUM12:
15 | # AssetCode12 assetCode12;
16 | #
17 | # // add other asset types here in the future
18 | # }
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class AllowTrustOp
23 | class Asset < XDR::Union
24 | switch_on AssetType, :type
25 |
26 | switch :asset_type_credit_alphanum4, :asset_code4
27 | switch :asset_type_credit_alphanum12, :asset_code12
28 |
29 | attribute :asset_code4, AssetCode4
30 | attribute :asset_code12, AssetCode12
31 | end
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/allow_trust_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union AllowTrustResult switch (AllowTrustResultCode code)
9 | # {
10 | # case ALLOW_TRUST_SUCCESS:
11 | # void;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class AllowTrustResult < XDR::Union
19 | switch_on AllowTrustResultCode, :code
20 |
21 | switch :allow_trust_success
22 | switch :default
23 |
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/allow_trust_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum AllowTrustResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # ALLOW_TRUST_SUCCESS = 0,
12 | # // codes considered as "failure" for the operation
13 | # ALLOW_TRUST_MALFORMED = -1, // asset is not ASSET_TYPE_ALPHANUM
14 | # ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
15 | # // source account does not require trust
16 | # ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
17 | # ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust,
18 | # ALLOW_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed
19 | # };
20 | #
21 | # ===========================================================================
22 | module Stellar
23 | class AllowTrustResultCode < XDR::Enum
24 | member :allow_trust_success, 0
25 | member :allow_trust_malformed, -1
26 | member :allow_trust_no_trust_line, -2
27 | member :allow_trust_trust_not_required, -3
28 | member :allow_trust_cant_revoke, -4
29 | member :allow_trust_self_not_allowed, -5
30 |
31 | seal
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/asset.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union Asset switch (AssetType type)
9 | # {
10 | # case ASSET_TYPE_NATIVE: // Not credit
11 | # void;
12 | #
13 | # case ASSET_TYPE_CREDIT_ALPHANUM4:
14 | # struct
15 | # {
16 | # AssetCode4 assetCode;
17 | # AccountID issuer;
18 | # } alphaNum4;
19 | #
20 | # case ASSET_TYPE_CREDIT_ALPHANUM12:
21 | # struct
22 | # {
23 | # AssetCode12 assetCode;
24 | # AccountID issuer;
25 | # } alphaNum12;
26 | #
27 | # // add other asset types here in the future
28 | # };
29 | #
30 | # ===========================================================================
31 | module Stellar
32 | class Asset < XDR::Union
33 | include XDR::Namespace
34 |
35 | autoload :AlphaNum4
36 | autoload :AlphaNum12
37 |
38 | switch_on AssetType, :type
39 |
40 | switch :asset_type_native
41 | switch :asset_type_credit_alphanum4, :alpha_num4
42 | switch :asset_type_credit_alphanum12, :alpha_num12
43 |
44 | attribute :alpha_num4, AlphaNum4
45 | attribute :alpha_num12, AlphaNum12
46 | end
47 | end
48 |
--------------------------------------------------------------------------------
/generated/stellar/asset/alpha_num12.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # AssetCode12 assetCode;
11 | # AccountID issuer;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class Asset
17 | class AlphaNum12 < XDR::Struct
18 | attribute :asset_code, AssetCode12
19 | attribute :issuer, AccountID
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/asset/alpha_num4.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # AssetCode4 assetCode;
11 | # AccountID issuer;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class Asset
17 | class AlphaNum4 < XDR::Struct
18 | attribute :asset_code, AssetCode4
19 | attribute :issuer, AccountID
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/asset_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum AssetType
9 | # {
10 | # ASSET_TYPE_NATIVE = 0,
11 | # ASSET_TYPE_CREDIT_ALPHANUM4 = 1,
12 | # ASSET_TYPE_CREDIT_ALPHANUM12 = 2
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class AssetType < XDR::Enum
18 | member :asset_type_native, 0
19 | member :asset_type_credit_alphanum4, 1
20 | member :asset_type_credit_alphanum12, 2
21 |
22 | seal
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/auth.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Auth
9 | # {
10 | # // Empty message, just to confirm
11 | # // establishment of MAC keys.
12 | # int unused;
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class Auth < XDR::Struct
18 | attribute :unused, XDR::Int
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/auth_cert.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct AuthCert
9 | # {
10 | # Curve25519Public pubkey;
11 | # uint64 expiration;
12 | # Signature sig;
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class AuthCert < XDR::Struct
18 | attribute :pubkey, Curve25519Public
19 | attribute :expiration, Uint64
20 | attribute :sig, Signature
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/authenticated_message.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union AuthenticatedMessage switch (uint32 v)
9 | # {
10 | # case 0:
11 | # struct
12 | # {
13 | # uint64 sequence;
14 | # StellarMessage message;
15 | # HmacSha256Mac mac;
16 | # } v0;
17 | # };
18 | #
19 | # ===========================================================================
20 | module Stellar
21 | class AuthenticatedMessage < XDR::Union
22 | include XDR::Namespace
23 |
24 | autoload :V0
25 |
26 | switch_on Uint32, :v
27 |
28 | switch 0, :v0
29 |
30 | attribute :v0, V0
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/generated/stellar/authenticated_message/v0.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # uint64 sequence;
11 | # StellarMessage message;
12 | # HmacSha256Mac mac;
13 | # }
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class AuthenticatedMessage
18 | class V0 < XDR::Struct
19 | attribute :sequence, Uint64
20 | attribute :message, StellarMessage
21 | attribute :mac, HmacSha256Mac
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/bucket_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union BucketEntry switch (BucketEntryType type)
9 | # {
10 | # case LIVEENTRY:
11 | # case INITENTRY:
12 | # LedgerEntry liveEntry;
13 | #
14 | # case DEADENTRY:
15 | # LedgerKey deadEntry;
16 | # case METAENTRY:
17 | # BucketMetadata metaEntry;
18 | # };
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class BucketEntry < XDR::Union
23 | switch_on BucketEntryType, :type
24 |
25 | switch :liveentry, :live_entry
26 | switch :initentry, :live_entry
27 | switch :deadentry, :dead_entry
28 | switch :metaentry, :meta_entry
29 |
30 | attribute :live_entry, LedgerEntry
31 | attribute :dead_entry, LedgerKey
32 | attribute :meta_entry, BucketMetadata
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/generated/stellar/bucket_entry_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum BucketEntryType
9 | # {
10 | # METAENTRY =
11 | # -1, // At-and-after protocol 11: bucket metadata, should come first.
12 | # LIVEENTRY = 0, // Before protocol 11: created-or-updated;
13 | # // At-and-after protocol 11: only updated.
14 | # DEADENTRY = 1,
15 | # INITENTRY = 2 // At-and-after protocol 11: only created.
16 | # };
17 | #
18 | # ===========================================================================
19 | module Stellar
20 | class BucketEntryType < XDR::Enum
21 | member :metaentry, -1
22 | member :liveentry, 0
23 | member :deadentry, 1
24 | member :initentry, 2
25 |
26 | seal
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/generated/stellar/bucket_metadata.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct BucketMetadata
9 | # {
10 | # // Indicates the protocol version used to create / merge this bucket.
11 | # uint32 ledgerVersion;
12 | #
13 | # // reserved for future use
14 | # union switch (int v)
15 | # {
16 | # case 0:
17 | # void;
18 | # }
19 | # ext;
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class BucketMetadata < XDR::Struct
25 | include XDR::Namespace
26 |
27 | autoload :Ext
28 |
29 | attribute :ledger_version, Uint32
30 | attribute :ext, Ext
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/generated/stellar/bucket_metadata/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class BucketMetadata
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/bump_sequence_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct BumpSequenceOp
9 | # {
10 | # SequenceNumber bumpTo;
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class BumpSequenceOp < XDR::Struct
16 | attribute :bump_to, SequenceNumber
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/generated/stellar/bump_sequence_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union BumpSequenceResult switch (BumpSequenceResultCode code)
9 | # {
10 | # case BUMP_SEQUENCE_SUCCESS:
11 | # void;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class BumpSequenceResult < XDR::Union
19 | switch_on BumpSequenceResultCode, :code
20 |
21 | switch :bump_sequence_success
22 | switch :default
23 |
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/bump_sequence_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum BumpSequenceResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # BUMP_SEQUENCE_SUCCESS = 0,
12 | # // codes considered as "failure" for the operation
13 | # BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class BumpSequenceResultCode < XDR::Enum
19 | member :bump_sequence_success, 0
20 | member :bump_sequence_bad_seq, -1
21 |
22 | seal
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/change_trust_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct ChangeTrustOp
9 | # {
10 | # Asset line;
11 | #
12 | # // if limit is set to 0, deletes the trust line
13 | # int64 limit;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class ChangeTrustOp < XDR::Struct
19 | attribute :line, Asset
20 | attribute :limit, Int64
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/change_trust_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union ChangeTrustResult switch (ChangeTrustResultCode code)
9 | # {
10 | # case CHANGE_TRUST_SUCCESS:
11 | # void;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class ChangeTrustResult < XDR::Union
19 | switch_on ChangeTrustResultCode, :code
20 |
21 | switch :change_trust_success
22 | switch :default
23 |
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/change_trust_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum ChangeTrustResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # CHANGE_TRUST_SUCCESS = 0,
12 | # // codes considered as "failure" for the operation
13 | # CHANGE_TRUST_MALFORMED = -1, // bad input
14 | # CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer
15 | # CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance
16 | # // cannot create with a limit of 0
17 | # CHANGE_TRUST_LOW_RESERVE =
18 | # -4, // not enough funds to create a new trust line,
19 | # CHANGE_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class ChangeTrustResultCode < XDR::Enum
25 | member :change_trust_success, 0
26 | member :change_trust_malformed, -1
27 | member :change_trust_no_issuer, -2
28 | member :change_trust_invalid_limit, -3
29 | member :change_trust_low_reserve, -4
30 | member :change_trust_self_not_allowed, -5
31 |
32 | seal
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/generated/stellar/claim_offer_atom.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct ClaimOfferAtom
9 | # {
10 | # // emitted to identify the offer
11 | # AccountID sellerID; // Account that owns the offer
12 | # int64 offerID;
13 | #
14 | # // amount and asset taken from the owner
15 | # Asset assetSold;
16 | # int64 amountSold;
17 | #
18 | # // amount and asset sent to the owner
19 | # Asset assetBought;
20 | # int64 amountBought;
21 | # };
22 | #
23 | # ===========================================================================
24 | module Stellar
25 | class ClaimOfferAtom < XDR::Struct
26 | attribute :seller_id, AccountID
27 | attribute :offer_id, Int64
28 | attribute :asset_sold, Asset
29 | attribute :amount_sold, Int64
30 | attribute :asset_bought, Asset
31 | attribute :amount_bought, Int64
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/create_account_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct CreateAccountOp
9 | # {
10 | # AccountID destination; // account to create
11 | # int64 startingBalance; // amount they end up with
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class CreateAccountOp < XDR::Struct
17 | attribute :destination, AccountID
18 | attribute :starting_balance, Int64
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/create_account_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union CreateAccountResult switch (CreateAccountResultCode code)
9 | # {
10 | # case CREATE_ACCOUNT_SUCCESS:
11 | # void;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class CreateAccountResult < XDR::Union
19 | switch_on CreateAccountResultCode, :code
20 |
21 | switch :create_account_success
22 | switch :default
23 |
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/create_account_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum CreateAccountResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # CREATE_ACCOUNT_SUCCESS = 0, // account was created
12 | #
13 | # // codes considered as "failure" for the operation
14 | # CREATE_ACCOUNT_MALFORMED = -1, // invalid destination
15 | # CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account
16 | # CREATE_ACCOUNT_LOW_RESERVE =
17 | # -3, // would create an account below the min reserve
18 | # CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists
19 | # };
20 | #
21 | # ===========================================================================
22 | module Stellar
23 | class CreateAccountResultCode < XDR::Enum
24 | member :create_account_success, 0
25 | member :create_account_malformed, -1
26 | member :create_account_underfunded, -2
27 | member :create_account_low_reserve, -3
28 | member :create_account_already_exist, -4
29 |
30 | seal
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/generated/stellar/create_passive_sell_offer_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct CreatePassiveSellOfferOp
9 | # {
10 | # Asset selling; // A
11 | # Asset buying; // B
12 | # int64 amount; // amount taker gets. if set to 0, delete the offer
13 | # Price price; // cost of A in terms of B
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class CreatePassiveSellOfferOp < XDR::Struct
19 | attribute :selling, Asset
20 | attribute :buying, Asset
21 | attribute :amount, Int64
22 | attribute :price, Price
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/crypto_key_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum CryptoKeyType
9 | # {
10 | # KEY_TYPE_ED25519 = 0,
11 | # KEY_TYPE_PRE_AUTH_TX = 1,
12 | # KEY_TYPE_HASH_X = 2
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class CryptoKeyType < XDR::Enum
18 | member :key_type_ed25519, 0
19 | member :key_type_pre_auth_tx, 1
20 | member :key_type_hash_x, 2
21 |
22 | seal
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/curve25519_public.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Curve25519Public
9 | # {
10 | # opaque key[32];
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class Curve25519Public < XDR::Struct
16 | attribute :key, XDR::Opaque[32]
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/generated/stellar/curve25519_secret.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Curve25519Secret
9 | # {
10 | # opaque key[32];
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class Curve25519Secret < XDR::Struct
16 | attribute :key, XDR::Opaque[32]
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/generated/stellar/data_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct DataEntry
9 | # {
10 | # AccountID accountID; // account this data belongs to
11 | # string64 dataName;
12 | # DataValue dataValue;
13 | #
14 | # // reserved for future use
15 | # union switch (int v)
16 | # {
17 | # case 0:
18 | # void;
19 | # }
20 | # ext;
21 | # };
22 | #
23 | # ===========================================================================
24 | module Stellar
25 | class DataEntry < XDR::Struct
26 | include XDR::Namespace
27 |
28 | autoload :Ext
29 |
30 | attribute :account_id, AccountID
31 | attribute :data_name, String64
32 | attribute :data_value, DataValue
33 | attribute :ext, Ext
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/generated/stellar/data_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class DataEntry
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/decorated_signature.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct DecoratedSignature
9 | # {
10 | # SignatureHint hint; // last 4 bytes of the public key, used as a hint
11 | # Signature signature; // actual signature
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class DecoratedSignature < XDR::Struct
17 | attribute :hint, SignatureHint
18 | attribute :signature, Signature
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/dont_have.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct DontHave
9 | # {
10 | # MessageType type;
11 | # uint256 reqHash;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class DontHave < XDR::Struct
17 | attribute :type, MessageType
18 | attribute :req_hash, Uint256
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/envelope_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum EnvelopeType
9 | # {
10 | # ENVELOPE_TYPE_SCP = 1,
11 | # ENVELOPE_TYPE_TX = 2,
12 | # ENVELOPE_TYPE_AUTH = 3,
13 | # ENVELOPE_TYPE_SCPVALUE = 4
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class EnvelopeType < XDR::Enum
19 | member :envelope_type_scp, 1
20 | member :envelope_type_tx, 2
21 | member :envelope_type_auth, 3
22 | member :envelope_type_scpvalue, 4
23 |
24 | seal
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/error.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Error
9 | # {
10 | # ErrorCode code;
11 | # string msg<100>;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class Error < XDR::Struct
17 | attribute :code, ErrorCode
18 | attribute :msg, XDR::String[100]
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/error_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum ErrorCode
9 | # {
10 | # ERR_MISC = 0, // Unspecific error
11 | # ERR_DATA = 1, // Malformed data
12 | # ERR_CONF = 2, // Misconfiguration error
13 | # ERR_AUTH = 3, // Authentication failure
14 | # ERR_LOAD = 4 // System overloaded
15 | # };
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class ErrorCode < XDR::Enum
20 | member :err_misc, 0
21 | member :err_data, 1
22 | member :err_conf, 2
23 | member :err_auth, 3
24 | member :err_load, 4
25 |
26 | seal
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/generated/stellar/hello.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Hello
9 | # {
10 | # uint32 ledgerVersion;
11 | # uint32 overlayVersion;
12 | # uint32 overlayMinVersion;
13 | # Hash networkID;
14 | # string versionStr<100>;
15 | # int listeningPort;
16 | # NodeID peerID;
17 | # AuthCert cert;
18 | # uint256 nonce;
19 | # };
20 | #
21 | # ===========================================================================
22 | module Stellar
23 | class Hello < XDR::Struct
24 | attribute :ledger_version, Uint32
25 | attribute :overlay_version, Uint32
26 | attribute :overlay_min_version, Uint32
27 | attribute :network_id, Hash
28 | attribute :version_str, XDR::String[100]
29 | attribute :listening_port, XDR::Int
30 | attribute :peer_id, NodeID
31 | attribute :cert, AuthCert
32 | attribute :nonce, Uint256
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/generated/stellar/hmac_sha256_key.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct HmacSha256Key
9 | # {
10 | # opaque key[32];
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class HmacSha256Key < XDR::Struct
16 | attribute :key, XDR::Opaque[32]
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/generated/stellar/hmac_sha256_mac.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct HmacSha256Mac
9 | # {
10 | # opaque mac[32];
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class HmacSha256Mac < XDR::Struct
16 | attribute :mac, XDR::Opaque[32]
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/generated/stellar/inflation_payout.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct InflationPayout // or use PaymentResultAtom to limit types?
9 | # {
10 | # AccountID destination;
11 | # int64 amount;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class InflationPayout < XDR::Struct
17 | attribute :destination, AccountID
18 | attribute :amount, Int64
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/inflation_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union InflationResult switch (InflationResultCode code)
9 | # {
10 | # case INFLATION_SUCCESS:
11 | # InflationPayout payouts<>;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class InflationResult < XDR::Union
19 | switch_on InflationResultCode, :code
20 |
21 | switch :inflation_success, :payouts
22 | switch :default
23 |
24 | attribute :payouts, XDR::VarArray[InflationPayout]
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/inflation_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum InflationResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # INFLATION_SUCCESS = 0,
12 | # // codes considered as "failure" for the operation
13 | # INFLATION_NOT_TIME = -1
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class InflationResultCode < XDR::Enum
19 | member :inflation_success, 0
20 | member :inflation_not_time, -1
21 |
22 | seal
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/ip_addr_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum IPAddrType
9 | # {
10 | # IPv4 = 0,
11 | # IPv6 = 1
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class IPAddrType < XDR::Enum
17 | member :i_pv4, 0
18 | member :i_pv6, 1
19 |
20 | seal
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_close_meta.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union LedgerCloseMeta switch (int v)
9 | # {
10 | # case 0:
11 | # LedgerCloseMetaV0 v0;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerCloseMeta < XDR::Union
17 | switch_on XDR::Int, :v
18 |
19 | switch 0, :v0
20 |
21 | attribute :v0, LedgerCloseMetaV0
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_close_meta_v0.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct LedgerCloseMetaV0
9 | # {
10 | # LedgerHeaderHistoryEntry ledgerHeader;
11 | # // NB: txSet is sorted in "Hash order"
12 | # TransactionSet txSet;
13 | #
14 | # // NB: transactions are sorted in apply order here
15 | # // fees for all transactions are processed first
16 | # // followed by applying transactions
17 | # TransactionResultMeta txProcessing<>;
18 | #
19 | # // upgrades are applied last
20 | # UpgradeEntryMeta upgradesProcessing<>;
21 | #
22 | # // other misc information attached to the ledger close
23 | # SCPHistoryEntry scpInfo<>;
24 | # };
25 | #
26 | # ===========================================================================
27 | module Stellar
28 | class LedgerCloseMetaV0 < XDR::Struct
29 | attribute :ledger_header, LedgerHeaderHistoryEntry
30 | attribute :tx_set, TransactionSet
31 | attribute :tx_processing, XDR::VarArray[TransactionResultMeta]
32 | attribute :upgrades_processing, XDR::VarArray[UpgradeEntryMeta]
33 | attribute :scp_info, XDR::VarArray[SCPHistoryEntry]
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_close_value_signature.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct LedgerCloseValueSignature
9 | # {
10 | # NodeID nodeID; // which node introduced the value
11 | # Signature signature; // nodeID's signature
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerCloseValueSignature < XDR::Struct
17 | attribute :node_id, NodeID
18 | attribute :signature, Signature
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct LedgerEntry
9 | # {
10 | # uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
11 | #
12 | # union switch (LedgerEntryType type)
13 | # {
14 | # case ACCOUNT:
15 | # AccountEntry account;
16 | # case TRUSTLINE:
17 | # TrustLineEntry trustLine;
18 | # case OFFER:
19 | # OfferEntry offer;
20 | # case DATA:
21 | # DataEntry data;
22 | # }
23 | # data;
24 | #
25 | # // reserved for future use
26 | # union switch (int v)
27 | # {
28 | # case 0:
29 | # void;
30 | # }
31 | # ext;
32 | # };
33 | #
34 | # ===========================================================================
35 | module Stellar
36 | class LedgerEntry < XDR::Struct
37 | include XDR::Namespace
38 |
39 | autoload :Data
40 | autoload :Ext
41 |
42 | attribute :last_modified_ledger_seq, Uint32
43 | attribute :data, Data
44 | attribute :ext, Ext
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_entry/data.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (LedgerEntryType type)
9 | # {
10 | # case ACCOUNT:
11 | # AccountEntry account;
12 | # case TRUSTLINE:
13 | # TrustLineEntry trustLine;
14 | # case OFFER:
15 | # OfferEntry offer;
16 | # case DATA:
17 | # DataEntry data;
18 | # }
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class LedgerEntry
23 | class Data < XDR::Union
24 | switch_on LedgerEntryType, :type
25 |
26 | switch :account, :account
27 | switch :trustline, :trust_line
28 | switch :offer, :offer
29 | switch :data, :data
30 |
31 | attribute :account, AccountEntry
32 | attribute :trust_line, TrustLineEntry
33 | attribute :offer, OfferEntry
34 | attribute :data, DataEntry
35 | end
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerEntry
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_entry_change.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union LedgerEntryChange switch (LedgerEntryChangeType type)
9 | # {
10 | # case LEDGER_ENTRY_CREATED:
11 | # LedgerEntry created;
12 | # case LEDGER_ENTRY_UPDATED:
13 | # LedgerEntry updated;
14 | # case LEDGER_ENTRY_REMOVED:
15 | # LedgerKey removed;
16 | # case LEDGER_ENTRY_STATE:
17 | # LedgerEntry state;
18 | # };
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class LedgerEntryChange < XDR::Union
23 | switch_on LedgerEntryChangeType, :type
24 |
25 | switch :ledger_entry_created, :created
26 | switch :ledger_entry_updated, :updated
27 | switch :ledger_entry_removed, :removed
28 | switch :ledger_entry_state, :state
29 |
30 | attribute :created, LedgerEntry
31 | attribute :updated, LedgerEntry
32 | attribute :removed, LedgerKey
33 | attribute :state, LedgerEntry
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_entry_change_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum LedgerEntryChangeType
9 | # {
10 | # LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
11 | # LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
12 | # LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger
13 | # LEDGER_ENTRY_STATE = 3 // value of the entry
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class LedgerEntryChangeType < XDR::Enum
19 | member :ledger_entry_created, 0
20 | member :ledger_entry_updated, 1
21 | member :ledger_entry_removed, 2
22 | member :ledger_entry_state, 3
23 |
24 | seal
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_entry_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum LedgerEntryType
9 | # {
10 | # ACCOUNT = 0,
11 | # TRUSTLINE = 1,
12 | # OFFER = 2,
13 | # DATA = 3
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class LedgerEntryType < XDR::Enum
19 | member :account, 0
20 | member :trustline, 1
21 | member :offer, 2
22 | member :data, 3
23 |
24 | seal
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_header/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerHeader
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_header_history_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct LedgerHeaderHistoryEntry
9 | # {
10 | # Hash hash;
11 | # LedgerHeader header;
12 | #
13 | # // reserved for future use
14 | # union switch (int v)
15 | # {
16 | # case 0:
17 | # void;
18 | # }
19 | # ext;
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class LedgerHeaderHistoryEntry < XDR::Struct
25 | include XDR::Namespace
26 |
27 | autoload :Ext
28 |
29 | attribute :hash, Hash
30 | attribute :header, LedgerHeader
31 | attribute :ext, Ext
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_header_history_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerHeaderHistoryEntry
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_key.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union LedgerKey switch (LedgerEntryType type)
9 | # {
10 | # case ACCOUNT:
11 | # struct
12 | # {
13 | # AccountID accountID;
14 | # } account;
15 | #
16 | # case TRUSTLINE:
17 | # struct
18 | # {
19 | # AccountID accountID;
20 | # Asset asset;
21 | # } trustLine;
22 | #
23 | # case OFFER:
24 | # struct
25 | # {
26 | # AccountID sellerID;
27 | # int64 offerID;
28 | # } offer;
29 | #
30 | # case DATA:
31 | # struct
32 | # {
33 | # AccountID accountID;
34 | # string64 dataName;
35 | # } data;
36 | # };
37 | #
38 | # ===========================================================================
39 | module Stellar
40 | class LedgerKey < XDR::Union
41 | include XDR::Namespace
42 |
43 | autoload :Account
44 | autoload :TrustLine
45 | autoload :Offer
46 | autoload :Data
47 |
48 | switch_on LedgerEntryType, :type
49 |
50 | switch :account, :account
51 | switch :trustline, :trust_line
52 | switch :offer, :offer
53 | switch :data, :data
54 |
55 | attribute :account, Account
56 | attribute :trust_line, TrustLine
57 | attribute :offer, Offer
58 | attribute :data, Data
59 | end
60 | end
61 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_key/account.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # AccountID accountID;
11 | # }
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class LedgerKey
16 | class Account < XDR::Struct
17 | attribute :account_id, AccountID
18 | end
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_key/data.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # AccountID accountID;
11 | # string64 dataName;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerKey
17 | class Data < XDR::Struct
18 | attribute :account_id, AccountID
19 | attribute :data_name, String64
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_key/offer.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # AccountID sellerID;
11 | # int64 offerID;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerKey
17 | class Offer < XDR::Struct
18 | attribute :seller_id, AccountID
19 | attribute :offer_id, Int64
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_key/trust_line.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # AccountID accountID;
11 | # Asset asset;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerKey
17 | class TrustLine < XDR::Struct
18 | attribute :account_id, AccountID
19 | attribute :asset, Asset
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_scp_messages.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct LedgerSCPMessages
9 | # {
10 | # uint32 ledgerSeq;
11 | # SCPEnvelope messages<>;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class LedgerSCPMessages < XDR::Struct
17 | attribute :ledger_seq, Uint32
18 | attribute :messages, XDR::VarArray[SCPEnvelope]
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_upgrade.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union LedgerUpgrade switch (LedgerUpgradeType type)
9 | # {
10 | # case LEDGER_UPGRADE_VERSION:
11 | # uint32 newLedgerVersion; // update ledgerVersion
12 | # case LEDGER_UPGRADE_BASE_FEE:
13 | # uint32 newBaseFee; // update baseFee
14 | # case LEDGER_UPGRADE_MAX_TX_SET_SIZE:
15 | # uint32 newMaxTxSetSize; // update maxTxSetSize
16 | # case LEDGER_UPGRADE_BASE_RESERVE:
17 | # uint32 newBaseReserve; // update baseReserve
18 | # };
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class LedgerUpgrade < XDR::Union
23 | switch_on LedgerUpgradeType, :type
24 |
25 | switch :ledger_upgrade_version, :new_ledger_version
26 | switch :ledger_upgrade_base_fee, :new_base_fee
27 | switch :ledger_upgrade_max_tx_set_size, :new_max_tx_set_size
28 | switch :ledger_upgrade_base_reserve, :new_base_reserve
29 |
30 | attribute :new_ledger_version, Uint32
31 | attribute :new_base_fee, Uint32
32 | attribute :new_max_tx_set_size, Uint32
33 | attribute :new_base_reserve, Uint32
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/generated/stellar/ledger_upgrade_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum LedgerUpgradeType
9 | # {
10 | # LEDGER_UPGRADE_VERSION = 1,
11 | # LEDGER_UPGRADE_BASE_FEE = 2,
12 | # LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
13 | # LEDGER_UPGRADE_BASE_RESERVE = 4
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class LedgerUpgradeType < XDR::Enum
19 | member :ledger_upgrade_version, 1
20 | member :ledger_upgrade_base_fee, 2
21 | member :ledger_upgrade_max_tx_set_size, 3
22 | member :ledger_upgrade_base_reserve, 4
23 |
24 | seal
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/liabilities.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Liabilities
9 | # {
10 | # int64 buying;
11 | # int64 selling;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class Liabilities < XDR::Struct
17 | attribute :buying, Int64
18 | attribute :selling, Int64
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/manage_buy_offer_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct ManageBuyOfferOp
9 | # {
10 | # Asset selling;
11 | # Asset buying;
12 | # int64 buyAmount; // amount being bought. if set to 0, delete the offer
13 | # Price price; // price of thing being bought in terms of what you are
14 | # // selling
15 | #
16 | # // 0=create a new offer, otherwise edit an existing offer
17 | # int64 offerID;
18 | # };
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class ManageBuyOfferOp < XDR::Struct
23 | attribute :selling, Asset
24 | attribute :buying, Asset
25 | attribute :buy_amount, Int64
26 | attribute :price, Price
27 | attribute :offer_id, Int64
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/generated/stellar/manage_buy_offer_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union ManageBuyOfferResult switch (ManageBuyOfferResultCode code)
9 | # {
10 | # case MANAGE_BUY_OFFER_SUCCESS:
11 | # ManageOfferSuccessResult success;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class ManageBuyOfferResult < XDR::Union
19 | switch_on ManageBuyOfferResultCode, :code
20 |
21 | switch :manage_buy_offer_success, :success
22 | switch :default
23 |
24 | attribute :success, ManageOfferSuccessResult
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/manage_buy_offer_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum ManageBuyOfferResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # MANAGE_BUY_OFFER_SUCCESS = 0,
12 | #
13 | # // codes considered as "failure" for the operation
14 | # MANAGE_BUY_OFFER_MALFORMED = -1, // generated offer would be invalid
15 | # MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling
16 | # MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying
17 | # MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
18 | # MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy
19 | # MANAGE_BUY_OFFER_LINE_FULL = -6, // can't receive more of what it's buying
20 | # MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
21 | # MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user
22 | # MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
23 | # MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
24 | #
25 | # // update errors
26 | # MANAGE_BUY_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer
27 | #
28 | # MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer
29 | # };
30 | #
31 | # ===========================================================================
32 | module Stellar
33 | class ManageBuyOfferResultCode < XDR::Enum
34 | member :manage_buy_offer_success, 0
35 | member :manage_buy_offer_malformed, -1
36 | member :manage_buy_offer_sell_no_trust, -2
37 | member :manage_buy_offer_buy_no_trust, -3
38 | member :manage_buy_offer_sell_not_authorized, -4
39 | member :manage_buy_offer_buy_not_authorized, -5
40 | member :manage_buy_offer_line_full, -6
41 | member :manage_buy_offer_underfunded, -7
42 | member :manage_buy_offer_cross_self, -8
43 | member :manage_buy_offer_sell_no_issuer, -9
44 | member :manage_buy_offer_buy_no_issuer, -10
45 | member :manage_buy_offer_not_found, -11
46 | member :manage_buy_offer_low_reserve, -12
47 |
48 | seal
49 | end
50 | end
51 |
--------------------------------------------------------------------------------
/generated/stellar/manage_data_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct ManageDataOp
9 | # {
10 | # string64 dataName;
11 | # DataValue* dataValue; // set to null to clear
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class ManageDataOp < XDR::Struct
17 | attribute :data_name, String64
18 | attribute :data_value, XDR::Option[DataValue]
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/manage_data_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union ManageDataResult switch (ManageDataResultCode code)
9 | # {
10 | # case MANAGE_DATA_SUCCESS:
11 | # void;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class ManageDataResult < XDR::Union
19 | switch_on ManageDataResultCode, :code
20 |
21 | switch :manage_data_success
22 | switch :default
23 |
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/manage_data_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum ManageDataResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # MANAGE_DATA_SUCCESS = 0,
12 | # // codes considered as "failure" for the operation
13 | # MANAGE_DATA_NOT_SUPPORTED_YET =
14 | # -1, // The network hasn't moved to this protocol change yet
15 | # MANAGE_DATA_NAME_NOT_FOUND =
16 | # -2, // Trying to remove a Data Entry that isn't there
17 | # MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry
18 | # MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string
19 | # };
20 | #
21 | # ===========================================================================
22 | module Stellar
23 | class ManageDataResultCode < XDR::Enum
24 | member :manage_data_success, 0
25 | member :manage_data_not_supported_yet, -1
26 | member :manage_data_name_not_found, -2
27 | member :manage_data_low_reserve, -3
28 | member :manage_data_invalid_name, -4
29 |
30 | seal
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/generated/stellar/manage_offer_effect.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum ManageOfferEffect
9 | # {
10 | # MANAGE_OFFER_CREATED = 0,
11 | # MANAGE_OFFER_UPDATED = 1,
12 | # MANAGE_OFFER_DELETED = 2
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class ManageOfferEffect < XDR::Enum
18 | member :manage_offer_created, 0
19 | member :manage_offer_updated, 1
20 | member :manage_offer_deleted, 2
21 |
22 | seal
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/manage_offer_success_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct ManageOfferSuccessResult
9 | # {
10 | # // offers that got claimed while creating this offer
11 | # ClaimOfferAtom offersClaimed<>;
12 | #
13 | # union switch (ManageOfferEffect effect)
14 | # {
15 | # case MANAGE_OFFER_CREATED:
16 | # case MANAGE_OFFER_UPDATED:
17 | # OfferEntry offer;
18 | # default:
19 | # void;
20 | # }
21 | # offer;
22 | # };
23 | #
24 | # ===========================================================================
25 | module Stellar
26 | class ManageOfferSuccessResult < XDR::Struct
27 | include XDR::Namespace
28 |
29 | autoload :Offer
30 |
31 | attribute :offers_claimed, XDR::VarArray[ClaimOfferAtom]
32 | attribute :offer, Offer
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/generated/stellar/manage_offer_success_result/offer.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (ManageOfferEffect effect)
9 | # {
10 | # case MANAGE_OFFER_CREATED:
11 | # case MANAGE_OFFER_UPDATED:
12 | # OfferEntry offer;
13 | # default:
14 | # void;
15 | # }
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class ManageOfferSuccessResult
20 | class Offer < XDR::Union
21 | switch_on ManageOfferEffect, :effect
22 |
23 | switch :manage_offer_created, :offer
24 | switch :manage_offer_updated, :offer
25 | switch :default
26 |
27 | attribute :offer, OfferEntry
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/generated/stellar/manage_sell_offer_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct ManageSellOfferOp
9 | # {
10 | # Asset selling;
11 | # Asset buying;
12 | # int64 amount; // amount being sold. if set to 0, delete the offer
13 | # Price price; // price of thing being sold in terms of what you are buying
14 | #
15 | # // 0=create a new offer, otherwise edit an existing offer
16 | # int64 offerID;
17 | # };
18 | #
19 | # ===========================================================================
20 | module Stellar
21 | class ManageSellOfferOp < XDR::Struct
22 | attribute :selling, Asset
23 | attribute :buying, Asset
24 | attribute :amount, Int64
25 | attribute :price, Price
26 | attribute :offer_id, Int64
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/generated/stellar/manage_sell_offer_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union ManageSellOfferResult switch (ManageSellOfferResultCode code)
9 | # {
10 | # case MANAGE_SELL_OFFER_SUCCESS:
11 | # ManageOfferSuccessResult success;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class ManageSellOfferResult < XDR::Union
19 | switch_on ManageSellOfferResultCode, :code
20 |
21 | switch :manage_sell_offer_success, :success
22 | switch :default
23 |
24 | attribute :success, ManageOfferSuccessResult
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/memo.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union Memo switch (MemoType type)
9 | # {
10 | # case MEMO_NONE:
11 | # void;
12 | # case MEMO_TEXT:
13 | # string text<28>;
14 | # case MEMO_ID:
15 | # uint64 id;
16 | # case MEMO_HASH:
17 | # Hash hash; // the hash of what to pull from the content server
18 | # case MEMO_RETURN:
19 | # Hash retHash; // the hash of the tx you are rejecting
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class Memo < XDR::Union
25 | switch_on MemoType, :type
26 |
27 | switch :memo_none
28 | switch :memo_text, :text
29 | switch :memo_id, :id
30 | switch :memo_hash, :hash
31 | switch :memo_return, :ret_hash
32 |
33 | attribute :text, XDR::String[28]
34 | attribute :id, Uint64
35 | attribute :hash, Hash
36 | attribute :ret_hash, Hash
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/generated/stellar/memo_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum MemoType
9 | # {
10 | # MEMO_NONE = 0,
11 | # MEMO_TEXT = 1,
12 | # MEMO_ID = 2,
13 | # MEMO_HASH = 3,
14 | # MEMO_RETURN = 4
15 | # };
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class MemoType < XDR::Enum
20 | member :memo_none, 0
21 | member :memo_text, 1
22 | member :memo_id, 2
23 | member :memo_hash, 3
24 | member :memo_return, 4
25 |
26 | seal
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/generated/stellar/message_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum MessageType
9 | # {
10 | # ERROR_MSG = 0,
11 | # AUTH = 2,
12 | # DONT_HAVE = 3,
13 | #
14 | # GET_PEERS = 4, // gets a list of peers this guy knows about
15 | # PEERS = 5,
16 | #
17 | # GET_TX_SET = 6, // gets a particular txset by hash
18 | # TX_SET = 7,
19 | #
20 | # TRANSACTION = 8, // pass on a tx you have heard about
21 | #
22 | # // SCP
23 | # GET_SCP_QUORUMSET = 9,
24 | # SCP_QUORUMSET = 10,
25 | # SCP_MESSAGE = 11,
26 | # GET_SCP_STATE = 12,
27 | #
28 | # // new messages
29 | # HELLO = 13,
30 | #
31 | # SURVEY_REQUEST = 14,
32 | # SURVEY_RESPONSE = 15
33 | # };
34 | #
35 | # ===========================================================================
36 | module Stellar
37 | class MessageType < XDR::Enum
38 | member :error_msg, 0
39 | member :auth, 2
40 | member :dont_have, 3
41 | member :get_peers, 4
42 | member :peers, 5
43 | member :get_tx_set, 6
44 | member :tx_set, 7
45 | member :transaction, 8
46 | member :get_scp_quorumset, 9
47 | member :scp_quorumset, 10
48 | member :scp_message, 11
49 | member :get_scp_state, 12
50 | member :hello, 13
51 | member :survey_request, 14
52 | member :survey_response, 15
53 |
54 | seal
55 | end
56 | end
57 |
--------------------------------------------------------------------------------
/generated/stellar/offer_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct OfferEntry
9 | # {
10 | # AccountID sellerID;
11 | # int64 offerID;
12 | # Asset selling; // A
13 | # Asset buying; // B
14 | # int64 amount; // amount of A
15 | #
16 | # /* price for this offer:
17 | # price of A in terms of B
18 | # price=AmountB/AmountA=priceNumerator/priceDenominator
19 | # price is after fees
20 | # */
21 | # Price price;
22 | # uint32 flags; // see OfferEntryFlags
23 | #
24 | # // reserved for future use
25 | # union switch (int v)
26 | # {
27 | # case 0:
28 | # void;
29 | # }
30 | # ext;
31 | # };
32 | #
33 | # ===========================================================================
34 | module Stellar
35 | class OfferEntry < XDR::Struct
36 | include XDR::Namespace
37 |
38 | autoload :Ext
39 |
40 | attribute :seller_id, AccountID
41 | attribute :offer_id, Int64
42 | attribute :selling, Asset
43 | attribute :buying, Asset
44 | attribute :amount, Int64
45 | attribute :price, Price
46 | attribute :flags, Uint32
47 | attribute :ext, Ext
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/generated/stellar/offer_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class OfferEntry
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/offer_entry_flags.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum OfferEntryFlags
9 | # {
10 | # // issuer has authorized account to perform transactions with its credit
11 | # PASSIVE_FLAG = 1
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class OfferEntryFlags < XDR::Enum
17 | member :passive_flag, 1
18 |
19 | seal
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/generated/stellar/operation.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Operation
9 | # {
10 | # // sourceAccount is the account used to run the operation
11 | # // if not set, the runtime defaults to "sourceAccount" specified at
12 | # // the transaction level
13 | # AccountID* sourceAccount;
14 | #
15 | # union switch (OperationType type)
16 | # {
17 | # case CREATE_ACCOUNT:
18 | # CreateAccountOp createAccountOp;
19 | # case PAYMENT:
20 | # PaymentOp paymentOp;
21 | # case PATH_PAYMENT_STRICT_RECEIVE:
22 | # PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp;
23 | # case MANAGE_SELL_OFFER:
24 | # ManageSellOfferOp manageSellOfferOp;
25 | # case CREATE_PASSIVE_SELL_OFFER:
26 | # CreatePassiveSellOfferOp createPassiveSellOfferOp;
27 | # case SET_OPTIONS:
28 | # SetOptionsOp setOptionsOp;
29 | # case CHANGE_TRUST:
30 | # ChangeTrustOp changeTrustOp;
31 | # case ALLOW_TRUST:
32 | # AllowTrustOp allowTrustOp;
33 | # case ACCOUNT_MERGE:
34 | # AccountID destination;
35 | # case INFLATION:
36 | # void;
37 | # case MANAGE_DATA:
38 | # ManageDataOp manageDataOp;
39 | # case BUMP_SEQUENCE:
40 | # BumpSequenceOp bumpSequenceOp;
41 | # case MANAGE_BUY_OFFER:
42 | # ManageBuyOfferOp manageBuyOfferOp;
43 | # case PATH_PAYMENT_STRICT_SEND:
44 | # PathPaymentStrictSendOp pathPaymentStrictSendOp;
45 | # }
46 | # body;
47 | # };
48 | #
49 | # ===========================================================================
50 | module Stellar
51 | class Operation < XDR::Struct
52 | include XDR::Namespace
53 |
54 | autoload :Body
55 |
56 | attribute :source_account, XDR::Option[AccountID]
57 | attribute :body, Body
58 | end
59 | end
60 |
--------------------------------------------------------------------------------
/generated/stellar/operation_meta.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct OperationMeta
9 | # {
10 | # LedgerEntryChanges changes;
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class OperationMeta < XDR::Struct
16 | attribute :changes, LedgerEntryChanges
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/generated/stellar/operation_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union OperationResult switch (OperationResultCode code)
9 | # {
10 | # case opINNER:
11 | # union switch (OperationType type)
12 | # {
13 | # case CREATE_ACCOUNT:
14 | # CreateAccountResult createAccountResult;
15 | # case PAYMENT:
16 | # PaymentResult paymentResult;
17 | # case PATH_PAYMENT_STRICT_RECEIVE:
18 | # PathPaymentStrictReceiveResult pathPaymentStrictReceiveResult;
19 | # case MANAGE_SELL_OFFER:
20 | # ManageSellOfferResult manageSellOfferResult;
21 | # case CREATE_PASSIVE_SELL_OFFER:
22 | # ManageSellOfferResult createPassiveSellOfferResult;
23 | # case SET_OPTIONS:
24 | # SetOptionsResult setOptionsResult;
25 | # case CHANGE_TRUST:
26 | # ChangeTrustResult changeTrustResult;
27 | # case ALLOW_TRUST:
28 | # AllowTrustResult allowTrustResult;
29 | # case ACCOUNT_MERGE:
30 | # AccountMergeResult accountMergeResult;
31 | # case INFLATION:
32 | # InflationResult inflationResult;
33 | # case MANAGE_DATA:
34 | # ManageDataResult manageDataResult;
35 | # case BUMP_SEQUENCE:
36 | # BumpSequenceResult bumpSeqResult;
37 | # case MANAGE_BUY_OFFER:
38 | # ManageBuyOfferResult manageBuyOfferResult;
39 | # case PATH_PAYMENT_STRICT_SEND:
40 | # PathPaymentStrictSendResult pathPaymentStrictSendResult;
41 | # }
42 | # tr;
43 | # default:
44 | # void;
45 | # };
46 | #
47 | # ===========================================================================
48 | module Stellar
49 | class OperationResult < XDR::Union
50 | include XDR::Namespace
51 |
52 | autoload :Tr
53 |
54 | switch_on OperationResultCode, :code
55 |
56 | switch :op_inner, :tr
57 | switch :default
58 |
59 | attribute :tr, Tr
60 | end
61 | end
62 |
--------------------------------------------------------------------------------
/generated/stellar/operation_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum OperationResultCode
9 | # {
10 | # opINNER = 0, // inner object result is valid
11 | #
12 | # opBAD_AUTH = -1, // too few valid signatures / wrong network
13 | # opNO_ACCOUNT = -2, // source account was not found
14 | # opNOT_SUPPORTED = -3, // operation not supported at this time
15 | # opTOO_MANY_SUBENTRIES = -4, // max number of subentries already reached
16 | # opEXCEEDED_WORK_LIMIT = -5 // operation did too much work
17 | # };
18 | #
19 | # ===========================================================================
20 | module Stellar
21 | class OperationResultCode < XDR::Enum
22 | member :op_inner, 0
23 | member :op_bad_auth, -1
24 | member :op_no_account, -2
25 | member :op_not_supported, -3
26 | member :op_too_many_subentries, -4
27 | member :op_exceeded_work_limit, -5
28 |
29 | seal
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/generated/stellar/operation_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum OperationType
9 | # {
10 | # CREATE_ACCOUNT = 0,
11 | # PAYMENT = 1,
12 | # PATH_PAYMENT_STRICT_RECEIVE = 2,
13 | # MANAGE_SELL_OFFER = 3,
14 | # CREATE_PASSIVE_SELL_OFFER = 4,
15 | # SET_OPTIONS = 5,
16 | # CHANGE_TRUST = 6,
17 | # ALLOW_TRUST = 7,
18 | # ACCOUNT_MERGE = 8,
19 | # INFLATION = 9,
20 | # MANAGE_DATA = 10,
21 | # BUMP_SEQUENCE = 11,
22 | # MANAGE_BUY_OFFER = 12,
23 | # PATH_PAYMENT_STRICT_SEND = 13
24 | # };
25 | #
26 | # ===========================================================================
27 | module Stellar
28 | class OperationType < XDR::Enum
29 | member :create_account, 0
30 | member :payment, 1
31 | member :path_payment_strict_receive, 2
32 | member :manage_sell_offer, 3
33 | member :create_passive_sell_offer, 4
34 | member :set_options, 5
35 | member :change_trust, 6
36 | member :allow_trust, 7
37 | member :account_merge, 8
38 | member :inflation, 9
39 | member :manage_data, 10
40 | member :bump_sequence, 11
41 | member :manage_buy_offer, 12
42 | member :path_payment_strict_send, 13
43 |
44 | seal
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/generated/stellar/path_payment_strict_receive_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct PathPaymentStrictReceiveOp
9 | # {
10 | # Asset sendAsset; // asset we pay with
11 | # int64 sendMax; // the maximum amount of sendAsset to
12 | # // send (excluding fees).
13 | # // The operation will fail if can't be met
14 | #
15 | # AccountID destination; // recipient of the payment
16 | # Asset destAsset; // what they end up with
17 | # int64 destAmount; // amount they end up with
18 | #
19 | # Asset path<5>; // additional hops it must go through to get there
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class PathPaymentStrictReceiveOp < XDR::Struct
25 | attribute :send_asset, Asset
26 | attribute :send_max, Int64
27 | attribute :destination, AccountID
28 | attribute :dest_asset, Asset
29 | attribute :dest_amount, Int64
30 | attribute :path, XDR::VarArray[Asset, 5]
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/generated/stellar/path_payment_strict_receive_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union PathPaymentStrictReceiveResult switch (PathPaymentStrictReceiveResultCode code)
9 | # {
10 | # case PATH_PAYMENT_STRICT_RECEIVE_SUCCESS:
11 | # struct
12 | # {
13 | # ClaimOfferAtom offers<>;
14 | # SimplePaymentResult last;
15 | # } success;
16 | # case PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER:
17 | # Asset noIssuer; // the asset that caused the error
18 | # default:
19 | # void;
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class PathPaymentStrictReceiveResult < XDR::Union
25 | include XDR::Namespace
26 |
27 | autoload :Success
28 |
29 | switch_on PathPaymentStrictReceiveResultCode, :code
30 |
31 | switch :path_payment_strict_receive_success, :success
32 | switch :path_payment_strict_receive_no_issuer, :no_issuer
33 | switch :default
34 |
35 | attribute :success, Success
36 | attribute :no_issuer, Asset
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/generated/stellar/path_payment_strict_receive_result/success.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # ClaimOfferAtom offers<>;
11 | # SimplePaymentResult last;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class PathPaymentStrictReceiveResult
17 | class Success < XDR::Struct
18 | attribute :offers, XDR::VarArray[ClaimOfferAtom]
19 | attribute :last, SimplePaymentResult
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/path_payment_strict_send_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct PathPaymentStrictSendOp
9 | # {
10 | # Asset sendAsset; // asset we pay with
11 | # int64 sendAmount; // amount of sendAsset to send (excluding fees)
12 | #
13 | # AccountID destination; // recipient of the payment
14 | # Asset destAsset; // what they end up with
15 | # int64 destMin; // the minimum amount of dest asset to
16 | # // be received
17 | # // The operation will fail if it can't be met
18 | #
19 | # Asset path<5>; // additional hops it must go through to get there
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class PathPaymentStrictSendOp < XDR::Struct
25 | attribute :send_asset, Asset
26 | attribute :send_amount, Int64
27 | attribute :destination, AccountID
28 | attribute :dest_asset, Asset
29 | attribute :dest_min, Int64
30 | attribute :path, XDR::VarArray[Asset, 5]
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/generated/stellar/path_payment_strict_send_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union PathPaymentStrictSendResult switch (PathPaymentStrictSendResultCode code)
9 | # {
10 | # case PATH_PAYMENT_STRICT_SEND_SUCCESS:
11 | # struct
12 | # {
13 | # ClaimOfferAtom offers<>;
14 | # SimplePaymentResult last;
15 | # } success;
16 | # case PATH_PAYMENT_STRICT_SEND_NO_ISSUER:
17 | # Asset noIssuer; // the asset that caused the error
18 | # default:
19 | # void;
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class PathPaymentStrictSendResult < XDR::Union
25 | include XDR::Namespace
26 |
27 | autoload :Success
28 |
29 | switch_on PathPaymentStrictSendResultCode, :code
30 |
31 | switch :path_payment_strict_send_success, :success
32 | switch :path_payment_strict_send_no_issuer, :no_issuer
33 | switch :default
34 |
35 | attribute :success, Success
36 | attribute :no_issuer, Asset
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/generated/stellar/path_payment_strict_send_result/success.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # ClaimOfferAtom offers<>;
11 | # SimplePaymentResult last;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class PathPaymentStrictSendResult
17 | class Success < XDR::Struct
18 | attribute :offers, XDR::VarArray[ClaimOfferAtom]
19 | attribute :last, SimplePaymentResult
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/payment_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct PaymentOp
9 | # {
10 | # AccountID destination; // recipient of the payment
11 | # Asset asset; // what they end up with
12 | # int64 amount; // amount they end up with
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class PaymentOp < XDR::Struct
18 | attribute :destination, AccountID
19 | attribute :asset, Asset
20 | attribute :amount, Int64
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/payment_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union PaymentResult switch (PaymentResultCode code)
9 | # {
10 | # case PAYMENT_SUCCESS:
11 | # void;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class PaymentResult < XDR::Union
19 | switch_on PaymentResultCode, :code
20 |
21 | switch :payment_success
22 | switch :default
23 |
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/payment_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum PaymentResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # PAYMENT_SUCCESS = 0, // payment successfuly completed
12 | #
13 | # // codes considered as "failure" for the operation
14 | # PAYMENT_MALFORMED = -1, // bad input
15 | # PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
16 | # PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
17 | # PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
18 | # PAYMENT_NO_DESTINATION = -5, // destination account does not exist
19 | # PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
20 | # PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
21 | # PAYMENT_LINE_FULL = -8, // destination would go above their limit
22 | # PAYMENT_NO_ISSUER = -9 // missing issuer on asset
23 | # };
24 | #
25 | # ===========================================================================
26 | module Stellar
27 | class PaymentResultCode < XDR::Enum
28 | member :payment_success, 0
29 | member :payment_malformed, -1
30 | member :payment_underfunded, -2
31 | member :payment_src_no_trust, -3
32 | member :payment_src_not_authorized, -4
33 | member :payment_no_destination, -5
34 | member :payment_no_trust, -6
35 | member :payment_not_authorized, -7
36 | member :payment_line_full, -8
37 | member :payment_no_issuer, -9
38 |
39 | seal
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/generated/stellar/peer_address.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct PeerAddress
9 | # {
10 | # union switch (IPAddrType type)
11 | # {
12 | # case IPv4:
13 | # opaque ipv4[4];
14 | # case IPv6:
15 | # opaque ipv6[16];
16 | # }
17 | # ip;
18 | # uint32 port;
19 | # uint32 numFailures;
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class PeerAddress < XDR::Struct
25 | include XDR::Namespace
26 |
27 | autoload :Ip
28 |
29 | attribute :ip, Ip
30 | attribute :port, Uint32
31 | attribute :num_failures, Uint32
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/peer_address/ip.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (IPAddrType type)
9 | # {
10 | # case IPv4:
11 | # opaque ipv4[4];
12 | # case IPv6:
13 | # opaque ipv6[16];
14 | # }
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class PeerAddress
19 | class Ip < XDR::Union
20 | switch_on IPAddrType, :type
21 |
22 | switch :i_pv4, :ipv4
23 | switch :i_pv6, :ipv6
24 |
25 | attribute :ipv4, XDR::Opaque[4]
26 | attribute :ipv6, XDR::Opaque[16]
27 | end
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/generated/stellar/peer_stats.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct PeerStats
9 | # {
10 | # NodeID id;
11 | # string versionStr<100>;
12 | # uint64 messagesRead;
13 | # uint64 messagesWritten;
14 | # uint64 bytesRead;
15 | # uint64 bytesWritten;
16 | # uint64 secondsConnected;
17 | #
18 | # uint64 uniqueFloodBytesRecv;
19 | # uint64 duplicateFloodBytesRecv;
20 | # uint64 uniqueFetchBytesRecv;
21 | # uint64 duplicateFetchBytesRecv;
22 | #
23 | # uint64 uniqueFloodMessageRecv;
24 | # uint64 duplicateFloodMessageRecv;
25 | # uint64 uniqueFetchMessageRecv;
26 | # uint64 duplicateFetchMessageRecv;
27 | # };
28 | #
29 | # ===========================================================================
30 | module Stellar
31 | class PeerStats < XDR::Struct
32 | attribute :id, NodeID
33 | attribute :version_str, XDR::String[100]
34 | attribute :messages_read, Uint64
35 | attribute :messages_written, Uint64
36 | attribute :bytes_read, Uint64
37 | attribute :bytes_written, Uint64
38 | attribute :seconds_connected, Uint64
39 | attribute :unique_flood_bytes_recv, Uint64
40 | attribute :duplicate_flood_bytes_recv, Uint64
41 | attribute :unique_fetch_bytes_recv, Uint64
42 | attribute :duplicate_fetch_bytes_recv, Uint64
43 | attribute :unique_flood_message_recv, Uint64
44 | attribute :duplicate_flood_message_recv, Uint64
45 | attribute :unique_fetch_message_recv, Uint64
46 | attribute :duplicate_fetch_message_recv, Uint64
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/generated/stellar/price.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Price
9 | # {
10 | # int32 n; // numerator
11 | # int32 d; // denominator
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class Price < XDR::Struct
17 | attribute :n, Int32
18 | attribute :d, Int32
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/public_key.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union PublicKey switch (PublicKeyType type)
9 | # {
10 | # case PUBLIC_KEY_TYPE_ED25519:
11 | # uint256 ed25519;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class PublicKey < XDR::Union
17 | switch_on PublicKeyType, :type
18 |
19 | switch :public_key_type_ed25519, :ed25519
20 |
21 | attribute :ed25519, Uint256
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/generated/stellar/public_key_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum PublicKeyType
9 | # {
10 | # PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class PublicKeyType < XDR::Enum
16 | member :public_key_type_ed25519, 0
17 |
18 | seal
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/scp_ballot.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SCPBallot
9 | # {
10 | # uint32 counter; // n
11 | # Value value; // x
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class SCPBallot < XDR::Struct
17 | attribute :counter, Uint32
18 | attribute :value, Value
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/scp_envelope.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SCPEnvelope
9 | # {
10 | # SCPStatement statement;
11 | # Signature signature;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class SCPEnvelope < XDR::Struct
17 | attribute :statement, SCPStatement
18 | attribute :signature, Signature
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/scp_history_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union SCPHistoryEntry switch (int v)
9 | # {
10 | # case 0:
11 | # SCPHistoryEntryV0 v0;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class SCPHistoryEntry < XDR::Union
17 | switch_on XDR::Int, :v
18 |
19 | switch 0, :v0
20 |
21 | attribute :v0, SCPHistoryEntryV0
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/generated/stellar/scp_history_entry_v0.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SCPHistoryEntryV0
9 | # {
10 | # SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages
11 | # LedgerSCPMessages ledgerMessages;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class SCPHistoryEntryV0 < XDR::Struct
17 | attribute :quorum_sets, XDR::VarArray[SCPQuorumSet]
18 | attribute :ledger_messages, LedgerSCPMessages
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/scp_nomination.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SCPNomination
9 | # {
10 | # Hash quorumSetHash; // D
11 | # Value votes<>; // X
12 | # Value accepted<>; // Y
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class SCPNomination < XDR::Struct
18 | attribute :quorum_set_hash, Hash
19 | attribute :votes, XDR::VarArray[Value]
20 | attribute :accepted, XDR::VarArray[Value]
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/scp_quorum_set.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SCPQuorumSet
9 | # {
10 | # uint32 threshold;
11 | # PublicKey validators<>;
12 | # SCPQuorumSet innerSets<>;
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class SCPQuorumSet < XDR::Struct
18 | attribute :threshold, Uint32
19 | attribute :validators, XDR::VarArray[PublicKey]
20 | attribute :inner_sets, XDR::VarArray[SCPQuorumSet]
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/scp_statement.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SCPStatement
9 | # {
10 | # NodeID nodeID; // v
11 | # uint64 slotIndex; // i
12 | #
13 | # union switch (SCPStatementType type)
14 | # {
15 | # case SCP_ST_PREPARE:
16 | # struct
17 | # {
18 | # Hash quorumSetHash; // D
19 | # SCPBallot ballot; // b
20 | # SCPBallot* prepared; // p
21 | # SCPBallot* preparedPrime; // p'
22 | # uint32 nC; // c.n
23 | # uint32 nH; // h.n
24 | # } prepare;
25 | # case SCP_ST_CONFIRM:
26 | # struct
27 | # {
28 | # SCPBallot ballot; // b
29 | # uint32 nPrepared; // p.n
30 | # uint32 nCommit; // c.n
31 | # uint32 nH; // h.n
32 | # Hash quorumSetHash; // D
33 | # } confirm;
34 | # case SCP_ST_EXTERNALIZE:
35 | # struct
36 | # {
37 | # SCPBallot commit; // c
38 | # uint32 nH; // h.n
39 | # Hash commitQuorumSetHash; // D used before EXTERNALIZE
40 | # } externalize;
41 | # case SCP_ST_NOMINATE:
42 | # SCPNomination nominate;
43 | # }
44 | # pledges;
45 | # };
46 | #
47 | # ===========================================================================
48 | module Stellar
49 | class SCPStatement < XDR::Struct
50 | include XDR::Namespace
51 |
52 | autoload :Pledges
53 |
54 | attribute :node_id, NodeID
55 | attribute :slot_index, Uint64
56 | attribute :pledges, Pledges
57 | end
58 | end
59 |
--------------------------------------------------------------------------------
/generated/stellar/scp_statement/pledges.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (SCPStatementType type)
9 | # {
10 | # case SCP_ST_PREPARE:
11 | # struct
12 | # {
13 | # Hash quorumSetHash; // D
14 | # SCPBallot ballot; // b
15 | # SCPBallot* prepared; // p
16 | # SCPBallot* preparedPrime; // p'
17 | # uint32 nC; // c.n
18 | # uint32 nH; // h.n
19 | # } prepare;
20 | # case SCP_ST_CONFIRM:
21 | # struct
22 | # {
23 | # SCPBallot ballot; // b
24 | # uint32 nPrepared; // p.n
25 | # uint32 nCommit; // c.n
26 | # uint32 nH; // h.n
27 | # Hash quorumSetHash; // D
28 | # } confirm;
29 | # case SCP_ST_EXTERNALIZE:
30 | # struct
31 | # {
32 | # SCPBallot commit; // c
33 | # uint32 nH; // h.n
34 | # Hash commitQuorumSetHash; // D used before EXTERNALIZE
35 | # } externalize;
36 | # case SCP_ST_NOMINATE:
37 | # SCPNomination nominate;
38 | # }
39 | #
40 | # ===========================================================================
41 | module Stellar
42 | class SCPStatement
43 | class Pledges < XDR::Union
44 | include XDR::Namespace
45 |
46 | autoload :Prepare
47 | autoload :Confirm
48 | autoload :Externalize
49 |
50 | switch_on SCPStatementType, :type
51 |
52 | switch :scp_st_prepare, :prepare
53 | switch :scp_st_confirm, :confirm
54 | switch :scp_st_externalize, :externalize
55 | switch :scp_st_nominate, :nominate
56 |
57 | attribute :prepare, Prepare
58 | attribute :confirm, Confirm
59 | attribute :externalize, Externalize
60 | attribute :nominate, SCPNomination
61 | end
62 | end
63 | end
64 |
--------------------------------------------------------------------------------
/generated/stellar/scp_statement/pledges/confirm.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # SCPBallot ballot; // b
11 | # uint32 nPrepared; // p.n
12 | # uint32 nCommit; // c.n
13 | # uint32 nH; // h.n
14 | # Hash quorumSetHash; // D
15 | # }
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class SCPStatement
20 | class Pledges
21 | class Confirm < XDR::Struct
22 | attribute :ballot, SCPBallot
23 | attribute :n_prepared, Uint32
24 | attribute :n_commit, Uint32
25 | attribute :n_h, Uint32
26 | attribute :quorum_set_hash, Hash
27 | end
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/generated/stellar/scp_statement/pledges/externalize.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # SCPBallot commit; // c
11 | # uint32 nH; // h.n
12 | # Hash commitQuorumSetHash; // D used before EXTERNALIZE
13 | # }
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class SCPStatement
18 | class Pledges
19 | class Externalize < XDR::Struct
20 | attribute :commit, SCPBallot
21 | attribute :n_h, Uint32
22 | attribute :commit_quorum_set_hash, Hash
23 | end
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/scp_statement/pledges/prepare.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # Hash quorumSetHash; // D
11 | # SCPBallot ballot; // b
12 | # SCPBallot* prepared; // p
13 | # SCPBallot* preparedPrime; // p'
14 | # uint32 nC; // c.n
15 | # uint32 nH; // h.n
16 | # }
17 | #
18 | # ===========================================================================
19 | module Stellar
20 | class SCPStatement
21 | class Pledges
22 | class Prepare < XDR::Struct
23 | attribute :quorum_set_hash, Hash
24 | attribute :ballot, SCPBallot
25 | attribute :prepared, XDR::Option[SCPBallot]
26 | attribute :prepared_prime, XDR::Option[SCPBallot]
27 | attribute :n_c, Uint32
28 | attribute :n_h, Uint32
29 | end
30 | end
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/generated/stellar/scp_statement_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum SCPStatementType
9 | # {
10 | # SCP_ST_PREPARE = 0,
11 | # SCP_ST_CONFIRM = 1,
12 | # SCP_ST_EXTERNALIZE = 2,
13 | # SCP_ST_NOMINATE = 3
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class SCPStatementType < XDR::Enum
19 | member :scp_st_prepare, 0
20 | member :scp_st_confirm, 1
21 | member :scp_st_externalize, 2
22 | member :scp_st_nominate, 3
23 |
24 | seal
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/set_options_op.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SetOptionsOp
9 | # {
10 | # AccountID* inflationDest; // sets the inflation destination
11 | #
12 | # uint32* clearFlags; // which flags to clear
13 | # uint32* setFlags; // which flags to set
14 | #
15 | # // account threshold manipulation
16 | # uint32* masterWeight; // weight of the master account
17 | # uint32* lowThreshold;
18 | # uint32* medThreshold;
19 | # uint32* highThreshold;
20 | #
21 | # string32* homeDomain; // sets the home domain
22 | #
23 | # // Add, update or remove a signer for the account
24 | # // signer is deleted if the weight is 0
25 | # Signer* signer;
26 | # };
27 | #
28 | # ===========================================================================
29 | module Stellar
30 | class SetOptionsOp < XDR::Struct
31 | attribute :inflation_dest, XDR::Option[AccountID]
32 | attribute :clear_flags, XDR::Option[Uint32]
33 | attribute :set_flags, XDR::Option[Uint32]
34 | attribute :master_weight, XDR::Option[Uint32]
35 | attribute :low_threshold, XDR::Option[Uint32]
36 | attribute :med_threshold, XDR::Option[Uint32]
37 | attribute :high_threshold, XDR::Option[Uint32]
38 | attribute :home_domain, XDR::Option[String32]
39 | attribute :signer, XDR::Option[Signer]
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/generated/stellar/set_options_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union SetOptionsResult switch (SetOptionsResultCode code)
9 | # {
10 | # case SET_OPTIONS_SUCCESS:
11 | # void;
12 | # default:
13 | # void;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class SetOptionsResult < XDR::Union
19 | switch_on SetOptionsResultCode, :code
20 |
21 | switch :set_options_success
22 | switch :default
23 |
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/set_options_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum SetOptionsResultCode
9 | # {
10 | # // codes considered as "success" for the operation
11 | # SET_OPTIONS_SUCCESS = 0,
12 | # // codes considered as "failure" for the operation
13 | # SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer
14 | # SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
15 | # SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags
16 | # SET_OPTIONS_INVALID_INFLATION = -4, // inflation account does not exist
17 | # SET_OPTIONS_CANT_CHANGE = -5, // can no longer change this option
18 | # SET_OPTIONS_UNKNOWN_FLAG = -6, // can't set an unknown flag
19 | # SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold
20 | # SET_OPTIONS_BAD_SIGNER = -8, // signer cannot be masterkey
21 | # SET_OPTIONS_INVALID_HOME_DOMAIN = -9 // malformed home domain
22 | # };
23 | #
24 | # ===========================================================================
25 | module Stellar
26 | class SetOptionsResultCode < XDR::Enum
27 | member :set_options_success, 0
28 | member :set_options_low_reserve, -1
29 | member :set_options_too_many_signers, -2
30 | member :set_options_bad_flags, -3
31 | member :set_options_invalid_inflation, -4
32 | member :set_options_cant_change, -5
33 | member :set_options_unknown_flag, -6
34 | member :set_options_threshold_out_of_range, -7
35 | member :set_options_bad_signer, -8
36 | member :set_options_invalid_home_domain, -9
37 |
38 | seal
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/generated/stellar/signed_survey_request_message.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SignedSurveyRequestMessage
9 | # {
10 | # Signature requestSignature;
11 | # SurveyRequestMessage request;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class SignedSurveyRequestMessage < XDR::Struct
17 | attribute :request_signature, Signature
18 | attribute :request, SurveyRequestMessage
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/signed_survey_response_message.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SignedSurveyResponseMessage
9 | # {
10 | # Signature responseSignature;
11 | # SurveyResponseMessage response;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class SignedSurveyResponseMessage < XDR::Struct
17 | attribute :response_signature, Signature
18 | attribute :response, SurveyResponseMessage
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/signer.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Signer
9 | # {
10 | # SignerKey key;
11 | # uint32 weight; // really only need 1 byte
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class Signer < XDR::Struct
17 | attribute :key, SignerKey
18 | attribute :weight, Uint32
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/signer_key.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union SignerKey switch (SignerKeyType type)
9 | # {
10 | # case SIGNER_KEY_TYPE_ED25519:
11 | # uint256 ed25519;
12 | # case SIGNER_KEY_TYPE_PRE_AUTH_TX:
13 | # /* SHA-256 Hash of TransactionSignaturePayload structure */
14 | # uint256 preAuthTx;
15 | # case SIGNER_KEY_TYPE_HASH_X:
16 | # /* Hash of random 256 bit preimage X */
17 | # uint256 hashX;
18 | # };
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class SignerKey < XDR::Union
23 | switch_on SignerKeyType, :type
24 |
25 | switch :signer_key_type_ed25519, :ed25519
26 | switch :signer_key_type_pre_auth_tx, :pre_auth_tx
27 | switch :signer_key_type_hash_x, :hash_x
28 |
29 | attribute :ed25519, Uint256
30 | attribute :pre_auth_tx, Uint256
31 | attribute :hash_x, Uint256
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/signer_key_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum SignerKeyType
9 | # {
10 | # SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519,
11 | # SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX,
12 | # SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class SignerKeyType < XDR::Enum
18 | member :signer_key_type_ed25519, 0
19 | member :signer_key_type_pre_auth_tx, 1
20 | member :signer_key_type_hash_x, 2
21 |
22 | seal
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/simple_payment_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SimplePaymentResult
9 | # {
10 | # AccountID destination;
11 | # Asset asset;
12 | # int64 amount;
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class SimplePaymentResult < XDR::Struct
18 | attribute :destination, AccountID
19 | attribute :asset, Asset
20 | attribute :amount, Int64
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/stellar_value.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct StellarValue
9 | # {
10 | # Hash txSetHash; // transaction set to apply to previous ledger
11 | # TimePoint closeTime; // network close time
12 | #
13 | # // upgrades to apply to the previous ledger (usually empty)
14 | # // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop
15 | # // unknown steps during consensus if needed.
16 | # // see notes below on 'LedgerUpgrade' for more detail
17 | # // max size is dictated by number of upgrade types (+ room for future)
18 | # UpgradeType upgrades<6>;
19 | #
20 | # // reserved for future use
21 | # union switch (StellarValueType v)
22 | # {
23 | # case STELLAR_VALUE_BASIC:
24 | # void;
25 | # case STELLAR_VALUE_SIGNED:
26 | # LedgerCloseValueSignature lcValueSignature;
27 | # }
28 | # ext;
29 | # };
30 | #
31 | # ===========================================================================
32 | module Stellar
33 | class StellarValue < XDR::Struct
34 | include XDR::Namespace
35 |
36 | autoload :Ext
37 |
38 | attribute :tx_set_hash, Hash
39 | attribute :close_time, TimePoint
40 | attribute :upgrades, XDR::VarArray[UpgradeType, 6]
41 | attribute :ext, Ext
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/generated/stellar/stellar_value/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (StellarValueType v)
9 | # {
10 | # case STELLAR_VALUE_BASIC:
11 | # void;
12 | # case STELLAR_VALUE_SIGNED:
13 | # LedgerCloseValueSignature lcValueSignature;
14 | # }
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class StellarValue
19 | class Ext < XDR::Union
20 | switch_on StellarValueType, :v
21 |
22 | switch :stellar_value_basic
23 | switch :stellar_value_signed, :lc_value_signature
24 |
25 | attribute :lc_value_signature, LedgerCloseValueSignature
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/generated/stellar/stellar_value_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum StellarValueType
9 | # {
10 | # STELLAR_VALUE_BASIC = 0,
11 | # STELLAR_VALUE_SIGNED = 1
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class StellarValueType < XDR::Enum
17 | member :stellar_value_basic, 0
18 | member :stellar_value_signed, 1
19 |
20 | seal
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/survey_message_command_type.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum SurveyMessageCommandType
9 | # {
10 | # SURVEY_TOPOLOGY = 0
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class SurveyMessageCommandType < XDR::Enum
16 | member :survey_topology, 0
17 |
18 | seal
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/survey_request_message.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SurveyRequestMessage
9 | # {
10 | # NodeID surveyorPeerID;
11 | # NodeID surveyedPeerID;
12 | # uint32 ledgerNum;
13 | # Curve25519Public encryptionKey;
14 | # SurveyMessageCommandType commandType;
15 | # };
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class SurveyRequestMessage < XDR::Struct
20 | attribute :surveyor_peer_id, NodeID
21 | attribute :surveyed_peer_id, NodeID
22 | attribute :ledger_num, Uint32
23 | attribute :encryption_key, Curve25519Public
24 | attribute :command_type, SurveyMessageCommandType
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/survey_response_body.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union SurveyResponseBody switch (SurveyMessageCommandType type)
9 | # {
10 | # case SURVEY_TOPOLOGY:
11 | # TopologyResponseBody topologyResponseBody;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class SurveyResponseBody < XDR::Union
17 | switch_on SurveyMessageCommandType, :type
18 |
19 | switch :survey_topology, :topology_response_body
20 |
21 | attribute :topology_response_body, TopologyResponseBody
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/generated/stellar/survey_response_message.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct SurveyResponseMessage
9 | # {
10 | # NodeID surveyorPeerID;
11 | # NodeID surveyedPeerID;
12 | # uint32 ledgerNum;
13 | # SurveyMessageCommandType commandType;
14 | # EncryptedBody encryptedBody;
15 | # };
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class SurveyResponseMessage < XDR::Struct
20 | attribute :surveyor_peer_id, NodeID
21 | attribute :surveyed_peer_id, NodeID
22 | attribute :ledger_num, Uint32
23 | attribute :command_type, SurveyMessageCommandType
24 | attribute :encrypted_body, EncryptedBody
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/threshold_indexes.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum ThresholdIndexes
9 | # {
10 | # THRESHOLD_MASTER_WEIGHT = 0,
11 | # THRESHOLD_LOW = 1,
12 | # THRESHOLD_MED = 2,
13 | # THRESHOLD_HIGH = 3
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class ThresholdIndexes < XDR::Enum
19 | member :threshold_master_weight, 0
20 | member :threshold_low, 1
21 | member :threshold_med, 2
22 | member :threshold_high, 3
23 |
24 | seal
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/time_bounds.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TimeBounds
9 | # {
10 | # TimePoint minTime;
11 | # TimePoint maxTime; // 0 here means no maxTime
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TimeBounds < XDR::Struct
17 | attribute :min_time, TimePoint
18 | attribute :max_time, TimePoint
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/topology_response_body.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TopologyResponseBody
9 | # {
10 | # PeerStatList inboundPeers;
11 | # PeerStatList outboundPeers;
12 | #
13 | # uint32 totalInboundPeerCount;
14 | # uint32 totalOutboundPeerCount;
15 | # };
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class TopologyResponseBody < XDR::Struct
20 | attribute :inbound_peers, PeerStatList
21 | attribute :outbound_peers, PeerStatList
22 | attribute :total_inbound_peer_count, Uint32
23 | attribute :total_outbound_peer_count, Uint32
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/generated/stellar/transaction.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct Transaction
9 | # {
10 | # // account used to run the transaction
11 | # AccountID sourceAccount;
12 | #
13 | # // the fee the sourceAccount will pay
14 | # uint32 fee;
15 | #
16 | # // sequence number to consume in the account
17 | # SequenceNumber seqNum;
18 | #
19 | # // validity range (inclusive) for the last ledger close time
20 | # TimeBounds* timeBounds;
21 | #
22 | # Memo memo;
23 | #
24 | # Operation operations;
25 | #
26 | # // reserved for future use
27 | # union switch (int v)
28 | # {
29 | # case 0:
30 | # void;
31 | # }
32 | # ext;
33 | # };
34 | #
35 | # ===========================================================================
36 | module Stellar
37 | class Transaction < XDR::Struct
38 | include XDR::Namespace
39 |
40 | autoload :Ext
41 |
42 | attribute :source_account, AccountID
43 | attribute :fee, Uint32
44 | attribute :seq_num, SequenceNumber
45 | attribute :time_bounds, XDR::Option[TimeBounds]
46 | attribute :memo, Memo
47 | attribute :operations, XDR::VarArray[Operation, MAX_OPS_PER_TX]
48 | attribute :ext, Ext
49 | end
50 | end
51 |
--------------------------------------------------------------------------------
/generated/stellar/transaction/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class Transaction
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_envelope.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionEnvelope
9 | # {
10 | # Transaction tx;
11 | # /* Each decorated signature is a signature over the SHA256 hash of
12 | # * a TransactionSignaturePayload */
13 | # DecoratedSignature signatures<20>;
14 | # };
15 | #
16 | # ===========================================================================
17 | module Stellar
18 | class TransactionEnvelope < XDR::Struct
19 | attribute :tx, Transaction
20 | attribute :signatures, XDR::VarArray[DecoratedSignature, 20]
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_history_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionHistoryEntry
9 | # {
10 | # uint32 ledgerSeq;
11 | # TransactionSet txSet;
12 | #
13 | # // reserved for future use
14 | # union switch (int v)
15 | # {
16 | # case 0:
17 | # void;
18 | # }
19 | # ext;
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class TransactionHistoryEntry < XDR::Struct
25 | include XDR::Namespace
26 |
27 | autoload :Ext
28 |
29 | attribute :ledger_seq, Uint32
30 | attribute :tx_set, TransactionSet
31 | attribute :ext, Ext
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_history_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TransactionHistoryEntry
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_history_result_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionHistoryResultEntry
9 | # {
10 | # uint32 ledgerSeq;
11 | # TransactionResultSet txResultSet;
12 | #
13 | # // reserved for future use
14 | # union switch (int v)
15 | # {
16 | # case 0:
17 | # void;
18 | # }
19 | # ext;
20 | # };
21 | #
22 | # ===========================================================================
23 | module Stellar
24 | class TransactionHistoryResultEntry < XDR::Struct
25 | include XDR::Namespace
26 |
27 | autoload :Ext
28 |
29 | attribute :ledger_seq, Uint32
30 | attribute :tx_result_set, TransactionResultSet
31 | attribute :ext, Ext
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_history_result_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TransactionHistoryResultEntry
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_meta.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union TransactionMeta switch (int v)
9 | # {
10 | # case 0:
11 | # OperationMeta operations<>;
12 | # case 1:
13 | # TransactionMetaV1 v1;
14 | # case 2:
15 | # TransactionMetaV2 v2;
16 | # };
17 | #
18 | # ===========================================================================
19 | module Stellar
20 | class TransactionMeta < XDR::Union
21 | switch_on XDR::Int, :v
22 |
23 | switch 0, :operations
24 | switch 1, :v1
25 | switch 2, :v2
26 |
27 | attribute :operations, XDR::VarArray[OperationMeta]
28 | attribute :v1, TransactionMetaV1
29 | attribute :v2, TransactionMetaV2
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_meta_v1.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionMetaV1
9 | # {
10 | # LedgerEntryChanges txChanges; // tx level changes if any
11 | # OperationMeta operations<>; // meta for each operation
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TransactionMetaV1 < XDR::Struct
17 | attribute :tx_changes, LedgerEntryChanges
18 | attribute :operations, XDR::VarArray[OperationMeta]
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_meta_v2.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionMetaV2
9 | # {
10 | # LedgerEntryChanges txChangesBefore; // tx level changes before operations
11 | # // are applied if any
12 | # OperationMeta operations<>; // meta for each operation
13 | # LedgerEntryChanges txChangesAfter; // tx level changes after operations are
14 | # // applied if any
15 | # };
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class TransactionMetaV2 < XDR::Struct
20 | attribute :tx_changes_before, LedgerEntryChanges
21 | attribute :operations, XDR::VarArray[OperationMeta]
22 | attribute :tx_changes_after, LedgerEntryChanges
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionResult
9 | # {
10 | # int64 feeCharged; // actual fee charged for the transaction
11 | #
12 | # union switch (TransactionResultCode code)
13 | # {
14 | # case txSUCCESS:
15 | # case txFAILED:
16 | # OperationResult results<>;
17 | # default:
18 | # void;
19 | # }
20 | # result;
21 | #
22 | # // reserved for future use
23 | # union switch (int v)
24 | # {
25 | # case 0:
26 | # void;
27 | # }
28 | # ext;
29 | # };
30 | #
31 | # ===========================================================================
32 | module Stellar
33 | class TransactionResult < XDR::Struct
34 | include XDR::Namespace
35 |
36 | autoload :Result
37 | autoload :Ext
38 |
39 | attribute :fee_charged, Int64
40 | attribute :result, Result
41 | attribute :ext, Ext
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_result/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TransactionResult
17 | class Ext < XDR::Union
18 | switch_on XDR::Int, :v
19 |
20 | switch 0
21 |
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_result/result.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (TransactionResultCode code)
9 | # {
10 | # case txSUCCESS:
11 | # case txFAILED:
12 | # OperationResult results<>;
13 | # default:
14 | # void;
15 | # }
16 | #
17 | # ===========================================================================
18 | module Stellar
19 | class TransactionResult
20 | class Result < XDR::Union
21 | switch_on TransactionResultCode, :code
22 |
23 | switch :tx_success, :results
24 | switch :tx_failed, :results
25 | switch :default
26 |
27 | attribute :results, XDR::VarArray[OperationResult]
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_result_code.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum TransactionResultCode
9 | # {
10 | # txSUCCESS = 0, // all operations succeeded
11 | #
12 | # txFAILED = -1, // one of the operations failed (none were applied)
13 | #
14 | # txTOO_EARLY = -2, // ledger closeTime before minTime
15 | # txTOO_LATE = -3, // ledger closeTime after maxTime
16 | # txMISSING_OPERATION = -4, // no operation was specified
17 | # txBAD_SEQ = -5, // sequence number does not match source account
18 | #
19 | # txBAD_AUTH = -6, // too few valid signatures / wrong network
20 | # txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
21 | # txNO_ACCOUNT = -8, // source account not found
22 | # txINSUFFICIENT_FEE = -9, // fee is too small
23 | # txBAD_AUTH_EXTRA = -10, // unused signatures attached to transaction
24 | # txINTERNAL_ERROR = -11 // an unknown error occured
25 | # };
26 | #
27 | # ===========================================================================
28 | module Stellar
29 | class TransactionResultCode < XDR::Enum
30 | member :tx_success, 0
31 | member :tx_failed, -1
32 | member :tx_too_early, -2
33 | member :tx_too_late, -3
34 | member :tx_missing_operation, -4
35 | member :tx_bad_seq, -5
36 | member :tx_bad_auth, -6
37 | member :tx_insufficient_balance, -7
38 | member :tx_no_account, -8
39 | member :tx_insufficient_fee, -9
40 | member :tx_bad_auth_extra, -10
41 | member :tx_internal_error, -11
42 |
43 | seal
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_result_meta.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionResultMeta
9 | # {
10 | # TransactionResultPair result;
11 | # LedgerEntryChanges feeProcessing;
12 | # TransactionMeta txApplyProcessing;
13 | # };
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class TransactionResultMeta < XDR::Struct
18 | attribute :result, TransactionResultPair
19 | attribute :fee_processing, LedgerEntryChanges
20 | attribute :tx_apply_processing, TransactionMeta
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_result_pair.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionResultPair
9 | # {
10 | # Hash transactionHash;
11 | # TransactionResult result; // result for the transaction
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TransactionResultPair < XDR::Struct
17 | attribute :transaction_hash, Hash
18 | attribute :result, TransactionResult
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_result_set.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionResultSet
9 | # {
10 | # TransactionResultPair results<>;
11 | # };
12 | #
13 | # ===========================================================================
14 | module Stellar
15 | class TransactionResultSet < XDR::Struct
16 | attribute :results, XDR::VarArray[TransactionResultPair]
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_set.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionSet
9 | # {
10 | # Hash previousLedgerHash;
11 | # TransactionEnvelope txs<>;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TransactionSet < XDR::Struct
17 | attribute :previous_ledger_hash, Hash
18 | attribute :txs, XDR::VarArray[TransactionEnvelope]
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_signature_payload.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TransactionSignaturePayload
9 | # {
10 | # Hash networkId;
11 | # union switch (EnvelopeType type)
12 | # {
13 | # case ENVELOPE_TYPE_TX:
14 | # Transaction tx;
15 | # /* All other values of type are invalid */
16 | # }
17 | # taggedTransaction;
18 | # };
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class TransactionSignaturePayload < XDR::Struct
23 | include XDR::Namespace
24 |
25 | autoload :TaggedTransaction
26 |
27 | attribute :network_id, Hash
28 | attribute :tagged_transaction, TaggedTransaction
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/generated/stellar/transaction_signature_payload/tagged_transaction.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (EnvelopeType type)
9 | # {
10 | # case ENVELOPE_TYPE_TX:
11 | # Transaction tx;
12 | # /* All other values of type are invalid */
13 | # }
14 | #
15 | # ===========================================================================
16 | module Stellar
17 | class TransactionSignaturePayload
18 | class TaggedTransaction < XDR::Union
19 | switch_on EnvelopeType, :type
20 |
21 | switch :envelope_type_tx, :tx
22 |
23 | attribute :tx, Transaction
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/generated/stellar/trust_line_entry.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct TrustLineEntry
9 | # {
10 | # AccountID accountID; // account this trustline belongs to
11 | # Asset asset; // type of asset (with issuer)
12 | # int64 balance; // how much of this asset the user has.
13 | # // Asset defines the unit for this;
14 | #
15 | # int64 limit; // balance cannot be above this
16 | # uint32 flags; // see TrustLineFlags
17 | #
18 | # // reserved for future use
19 | # union switch (int v)
20 | # {
21 | # case 0:
22 | # void;
23 | # case 1:
24 | # struct
25 | # {
26 | # Liabilities liabilities;
27 | #
28 | # union switch (int v)
29 | # {
30 | # case 0:
31 | # void;
32 | # }
33 | # ext;
34 | # } v1;
35 | # }
36 | # ext;
37 | # };
38 | #
39 | # ===========================================================================
40 | module Stellar
41 | class TrustLineEntry < XDR::Struct
42 | include XDR::Namespace
43 |
44 | autoload :Ext
45 |
46 | attribute :account_id, AccountID
47 | attribute :asset, Asset
48 | attribute :balance, Int64
49 | attribute :limit, Int64
50 | attribute :flags, Uint32
51 | attribute :ext, Ext
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/generated/stellar/trust_line_entry/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # case 1:
13 | # struct
14 | # {
15 | # Liabilities liabilities;
16 | #
17 | # union switch (int v)
18 | # {
19 | # case 0:
20 | # void;
21 | # }
22 | # ext;
23 | # } v1;
24 | # }
25 | #
26 | # ===========================================================================
27 | module Stellar
28 | class TrustLineEntry
29 | class Ext < XDR::Union
30 | include XDR::Namespace
31 |
32 | autoload :V1
33 |
34 | switch_on XDR::Int, :v
35 |
36 | switch 0
37 | switch 1, :v1
38 |
39 | attribute :v1, V1
40 | end
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/generated/stellar/trust_line_entry/ext/v1.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct
9 | # {
10 | # Liabilities liabilities;
11 | #
12 | # union switch (int v)
13 | # {
14 | # case 0:
15 | # void;
16 | # }
17 | # ext;
18 | # }
19 | #
20 | # ===========================================================================
21 | module Stellar
22 | class TrustLineEntry
23 | class Ext
24 | class V1 < XDR::Struct
25 | include XDR::Namespace
26 |
27 | autoload :Ext
28 |
29 | attribute :liabilities, Liabilities
30 | attribute :ext, Ext
31 | end
32 | end
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/generated/stellar/trust_line_entry/ext/v1/ext.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # union switch (int v)
9 | # {
10 | # case 0:
11 | # void;
12 | # }
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TrustLineEntry
17 | class Ext
18 | class V1
19 | class Ext < XDR::Union
20 | switch_on XDR::Int, :v
21 |
22 | switch 0
23 |
24 | end
25 | end
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/generated/stellar/trust_line_flags.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # enum TrustLineFlags
9 | # {
10 | # // issuer has authorized account to perform transactions with its credit
11 | # AUTHORIZED_FLAG = 1
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class TrustLineFlags < XDR::Enum
17 | member :authorized_flag, 1
18 |
19 | seal
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/generated/stellar/upgrade_entry_meta.rb:
--------------------------------------------------------------------------------
1 | # This code was automatically generated using xdrgen
2 | # DO NOT EDIT or your changes may be overwritten
3 |
4 | require 'xdr'
5 |
6 | # === xdr source ============================================================
7 | #
8 | # struct UpgradeEntryMeta
9 | # {
10 | # LedgerUpgrade upgrade;
11 | # LedgerEntryChanges changes;
12 | # };
13 | #
14 | # ===========================================================================
15 | module Stellar
16 | class UpgradeEntryMeta < XDR::Struct
17 | attribute :upgrade, LedgerUpgrade
18 | attribute :changes, LedgerEntryChanges
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/lib/stellar-base.rb:
--------------------------------------------------------------------------------
1 | require 'xdr'
2 | require 'rbnacl'
3 | require 'digest/sha2'
4 | require 'active_support/core_ext/object/blank'
5 | require 'active_support/core_ext/enumerable'
6 | require 'active_support/core_ext/kernel/reporting'
7 |
8 | # See ../generated for code-gen'ed files
9 | silence_warnings do
10 | require 'stellar-base-generated'
11 | end
12 | Stellar.load_all!
13 |
14 | Stellar::ONE = 1_0000000
15 |
16 |
17 | # extensions onto the generated files must be loaded manually, below
18 |
19 | require_relative './stellar/account_flags'
20 | require_relative './stellar/asset'
21 | require_relative './stellar/key_pair'
22 | require_relative './stellar/operation'
23 | require_relative './stellar/path_payment_strict_receive_result'
24 | require_relative './stellar/price'
25 | require_relative './stellar/signer_key'
26 | require_relative './stellar/thresholds'
27 | require_relative './stellar/transaction'
28 | require_relative './stellar/transaction_builder'
29 | require_relative './stellar/transaction_envelope'
30 | require_relative './stellar/util/strkey'
31 | require_relative './stellar/util/continued_fraction'
32 | require_relative './stellar/convert'
33 | require_relative './stellar/networks'
34 | require_relative './stellar/base/version'
35 |
36 | require_relative './stellar/base/compat'
37 |
--------------------------------------------------------------------------------
/lib/stellar/account_flags.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | class AccountFlags
3 |
4 |
5 | #
6 | # Converts an array of Stellar::AccountFlags members into
7 | # an Integer suitable for use in a SetOptionsOp.
8 | #
9 | # @param flags=nil [Array] the flags to combine
10 | #
11 | # @return [Fixnum] the combined result
12 | def self.make_mask(flags=nil)
13 | flags ||= []
14 |
15 | flags.map(&:value).inject(&:|) || 0
16 | end
17 |
18 | #
19 | # Converts an integer used in SetOptionsOp on the set/clear flag options
20 | # into an array of Stellar::AccountFlags members
21 | #
22 | # @param combined [Fixnum]
23 | # @return [Array]
24 | def self.parse_mask(combined)
25 | members.values.select{|m| (m.value & combined) != 0}
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/lib/stellar/asset.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | class Asset
3 | TYPES = %i(native alphanum4 alphanum12)
4 |
5 | def self.native
6 | new(:asset_type_native)
7 | end
8 |
9 | def self.alphanum4(code, issuer)
10 | raise ArgumentError, "Bad :issuer" unless issuer.is_a?(KeyPair)
11 | code = normalize_code(code, 4)
12 | an = AlphaNum4.new({asset_code:code, issuer:issuer.account_id})
13 | new(:asset_type_credit_alphanum4, an)
14 | end
15 |
16 | def self.alphanum12(code, issuer)
17 | raise ArgumentError, "Bad :issuer" unless issuer.is_a?(KeyPair)
18 | code = normalize_code(code, 12)
19 | an = AlphaNum12.new({asset_code:code, issuer:issuer.account_id})
20 | new(:asset_type_credit_alphanum12, an)
21 | end
22 |
23 | def to_s
24 | case switch
25 | when AssetType.asset_type_native
26 | "native"
27 | when AssetType.asset_type_credit_alphanum4
28 | anum = alpha_num4!
29 | issuer_address = Stellar::Convert.pk_to_address(anum.issuer)
30 | "#{anum.asset_code}/#{issuer_address}"
31 | when AssetType.asset_type_credit_alphanum12
32 | anum = alpha_num12!
33 | issuer_address = Stellar::Convert.pk_to_address(anum.issuer)
34 | "#{anum.asset_code}/#{issuer_address}"
35 | end
36 | end
37 |
38 | def inspect
39 | label = switch.to_s
40 | "#"
41 | end
42 |
43 | def code
44 | case switch
45 | when AssetType.asset_type_credit_alphanum4
46 | alpha_num4!.asset_code
47 | when AssetType.asset_type_credit_alphanum12
48 | alpha_num12!.asset_code
49 | else
50 | raise "#{switch} assets do not have a code"
51 | end
52 | end
53 |
54 | def issuer
55 | case switch
56 | when AssetType.asset_type_credit_alphanum4
57 | alpha_num4!.issuer
58 | when AssetType.asset_type_credit_alphanum12
59 | alpha_num12!.issuer
60 | else
61 | raise "#{switch} assets do not have a isuuer"
62 | end
63 | end
64 |
65 | def self.normalize_code(code, length)
66 | raise ArgumentError, "Invalid asset code: #{code}, must be <= #{length} bytes" if code.length > length
67 |
68 | code.ljust(length, "\x00")
69 | end
70 | end
71 | end
72 |
--------------------------------------------------------------------------------
/lib/stellar/base.rb:
--------------------------------------------------------------------------------
1 | require "stellar-base"
--------------------------------------------------------------------------------
/lib/stellar/base/compat.rb:
--------------------------------------------------------------------------------
1 | require 'active_support/deprecation'
2 |
3 | Stellar::Deprecation ||= ActiveSupport::Deprecation.new('next release', 'stellar-base')
4 |
5 | class << Stellar::Operation
6 | alias_method :manage_offer, :manage_sell_offer
7 | alias_method :create_passive_offer, :create_passive_sell_offer
8 |
9 | deprecate deprecator: Stellar::Deprecation,
10 | manage_offer: :manage_sell_offer,
11 | create_passive_offer: :create_passive_sell_offer
12 | end
13 |
14 | class << Stellar::Transaction
15 | alias_method :manage_offer, :manage_sell_offer
16 | alias_method :create_passive_offer, :create_passive_sell_offer
17 |
18 | deprecate deprecator: Stellar::Deprecation,
19 | manage_offer: :manage_sell_offer,
20 | create_passive_offer: :create_passive_sell_offer
21 | end
22 |
23 |
--------------------------------------------------------------------------------
/lib/stellar/base/version.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | module Base
3 | VERSION = "0.22.0"
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/lib/stellar/convert.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | #
3 | # Generic format conversion module
4 | #
5 | module Convert
6 | require 'base64'
7 |
8 | def to_hex(string)
9 | string.unpack("H*").first
10 | end
11 |
12 | def from_hex(hex_string)
13 | [hex_string].pack("H*")
14 | end
15 |
16 | def to_base64(string)
17 | Base64.strict_encode64(string)
18 | end
19 |
20 | def from_base64(base64_string)
21 | Base64.strict_decode64(base64_string)
22 | end
23 |
24 | ## Converts a Stellar::PublicKey instance (or any typedef of it such as
25 | # Stellar::AccountID) to an address
26 | def pk_to_address(pk)
27 | Stellar::Util::StrKey.check_encode(:account_id, pk.ed25519!)
28 | end
29 |
30 | extend self
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/lib/stellar/networks.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | # Provides a container for well-known network passphrases, such as the main network and SDF test network
3 | module Networks
4 |
5 | PUBLIC = "Public Global Stellar Network ; September 2015"
6 | TESTNET = "Test SDF Network ; September 2015"
7 |
8 | end
9 |
10 | # Configures the default stellar network passphrase for the current process. Unless otherwise
11 | # specified in a method that needs the passphrase, this value will be used.
12 | #
13 | # NOTE: This method is not thread-safe. It's best to just call this at startup once and use the other
14 | # methods of specifying a network if you need two threads in the same process to communicate with
15 | # different networks
16 | #
17 | # @see Stellar.default_network
18 | # @see Stellar.on_network
19 | def self.default_network=(passphrase)
20 | @default_network = passphrase
21 | end
22 |
23 | # Returns the passphrase for the currently-configured network, as set by Stellar.default_network
24 | # or Stellar.on_network
25 | def self.current_network
26 | Thread.current["stellar_network_passphrase"] ||
27 | @default_network ||
28 | Stellar::Networks::TESTNET
29 | end
30 |
31 | # Returns the id for the currently configured network, suitable for use in generating
32 | # a signature base string or making the root account's keypair.
33 | def self.current_network_id
34 | Digest::SHA256.digest(self.current_network)
35 | end
36 |
37 | # Executes the provided block in the context of the provided network.
38 | def self.on_network(passphrase, &block)
39 | old = Thread.current["stellar_network_passphrase"]
40 | Thread.current["stellar_network_passphrase"] = passphrase
41 | block.call
42 | ensure
43 | Thread.current["stellar_network_passphrase"] = old
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/lib/stellar/path_payment_strict_receive_result.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | class PathPaymentStrictReceiveResult
3 | # send_amount returns the actual amount paid for the corresponding
4 | # PathPaymentOp to this result.
5 | #
6 | def send_amount
7 | s = success!
8 | return s.last.amount if s.offers.blank?
9 |
10 | source_asset = s.offers.first.asset_bought
11 | source_offers = s.offers.take_while{|o| o.asset_bought == source_asset}
12 |
13 | source_offers.map(&:amount_bought).sum
14 | end
15 |
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/lib/stellar/price.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 |
3 | # reopen class
4 | class Price
5 |
6 | MAX_PRECISION = (2**31) - 1
7 |
8 | def self.from_f(number)
9 | best_r = Util::ContinuedFraction.best_r(number, MAX_PRECISION)
10 | new({
11 | n: best_r.numerator,
12 | d: best_r.denominator
13 | })
14 | end
15 |
16 | def invert
17 | self.class.new(n:d,d:n)
18 | end
19 |
20 | def to_f
21 | n / d.to_f
22 | end
23 |
24 | def to_s
25 | "#{n} / #{d}"
26 | end
27 |
28 | def inspect
29 | "#"
30 | end
31 | end
32 | end
--------------------------------------------------------------------------------
/lib/stellar/signer_key.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | class SignerKey
3 |
4 | PREIMAGE_LENGTH = 32
5 |
6 | def self.ed25519(keypair)
7 | raise ArgumentError, "Bad keypair" unless keypair.is_a?(KeyPair)
8 | new(:signer_key_type_ed25519, keypair.raw_public_key)
9 | end
10 |
11 |
12 | def self.preauthorized_transaction(tx)
13 | new(:signer_key_type_pre_auth_tx, tx.hash)
14 | end
15 |
16 |
17 | def self.hash_x(preimage)
18 | raise ArgumentError, "Must be string" unless preimage.is_a?(String)
19 | raise ArgumentError, "Must be 32 bytes" unless preimage.bytesize == PREIMAGE_LENGTH
20 |
21 | hash_x = Digest::SHA256.digest(preimage)
22 | new(:signer_key_type_hash_x, hash_x)
23 | end
24 |
25 | def to_s
26 | case switch
27 | when SignerKeyType.signer_key_type_ed25519
28 | address = Stellar::Convert.pk_to_address(self)
29 | "ed25519: #{address}"
30 | when SignerKeyType.signer_key_type_pre_auth_tx
31 | tx = Stellar::Convert.to_hex(pre_auth_tx!)
32 | "pre_auth_tx: #{tx}"
33 | when SignerKeyType.signer_key_type_hash_x
34 | hx = Stellar::Convert.to_hex(hash_x!)
35 | "hash_x: #{hx}"
36 | end
37 | end
38 |
39 | def inspect
40 | label = switch.to_s
41 | "#"
42 | end
43 |
44 | def signature_hint
45 | # take last 4 bytes
46 | value.to_xdr.slice(-4, 4)
47 | end
48 |
49 | end
50 | end
51 |
--------------------------------------------------------------------------------
/lib/stellar/thresholds.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | class << Thresholds
3 | COMPONENTS = [:master_weight, :low, :medium, :high]
4 | VALID_RANGE = 0..255
5 |
6 | def make(thresholds={})
7 |
8 | # error if any of the needed components are not provided
9 | if COMPONENTS.any?{|c| thresholds[c].blank? }
10 | raise ArgumentError, "invalid thresholds hash, must have #{COMPONENTS.inspect} keys, had: #{thresholds.keys.inspect}"
11 | end
12 |
13 | # error if any of the needed components are not numbers 0 <= N <= 255
14 | COMPONENTS.each do |c|
15 | good = true
16 |
17 | good &&= thresholds[c].is_a?(Integer)
18 | good &&= VALID_RANGE.include? thresholds[c]
19 |
20 | unless good
21 | raise ArgumentError, "invalid #{c.inspect}, must be number in (0..255), got #{thresholds[c].inspect}"
22 | end
23 | end
24 |
25 |
26 | thresholds.values_at(*COMPONENTS).pack("C*")
27 | end
28 |
29 | def parse(combined)
30 | master_weight, low, medium, high = combined.unpack("C*")
31 | {
32 | master_weight: master_weight,
33 | low: low,
34 | medium: medium,
35 | high: high,
36 | }
37 | end
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/lib/stellar/transaction_envelope.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | class TransactionEnvelope
3 |
4 | #
5 | # Checks to ensure that every signature for the envelope is
6 | # a valid signature of one of the provided `key_pairs`
7 | #
8 | # NOTE: this does not do any authorization checks, which requires access to
9 | # the current ledger state.
10 | #
11 | # @param *key_pairs [Array] The key pairs to check the envelopes signatures against
12 | #
13 | # @return [Boolean] true if all signatures are from the provided key_pairs and validly sign the tx's hash
14 | def signed_correctly?(*key_pairs)
15 | hash = tx.hash
16 | return false if signatures.empty?
17 |
18 | key_index = key_pairs.index_by(&:signature_hint)
19 |
20 | signatures.all? do |sig|
21 | key_pair = key_index[sig.hint]
22 | break false if key_pair.nil?
23 |
24 | key_pair.verify(sig.signature, hash)
25 | end
26 | end
27 |
28 | def hash
29 | Digest::SHA256.digest(to_xdr)
30 | end
31 |
32 | def merge(other)
33 | merged_tx = tx.merge(other.tx)
34 | merged_tx.signatures = [signatures, other.signatures]
35 | merged_tx
36 | end
37 |
38 | end
39 | end
--------------------------------------------------------------------------------
/lib/stellar/util/continued_fraction.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | module Util
3 | class ContinuedFraction
4 | MAX_PRECISION = (2**32) - 1
5 | attr_reader :i
6 | attr_reader :f
7 |
8 | def self.best_r(number, max_precision=MAX_PRECISION)
9 | cur_cf = new(number)
10 |
11 | loop do
12 | next_cf = cur_cf.extend()
13 | cur_r = cur_cf.to_r(max_precision)
14 | next_r = next_cf.to_r(max_precision)
15 |
16 | break cur_r if cur_cf.done? || cur_r == next_r
17 |
18 | cur_cf = next_cf
19 | end
20 |
21 | cur_cf.to_r(max_precision)
22 | end
23 |
24 | def initialize(val, parents=[])
25 | @i = val.floor
26 | @f = val - @i
27 | @parents = parents
28 | end
29 |
30 | def to_a
31 | @parents + [i]
32 | end
33 |
34 | def error(actual)
35 | (actual - to_f).abs
36 | end
37 |
38 | def to_f
39 | convergent = convergents.last
40 | convergent.n / convergent.d.to_f
41 | end
42 |
43 | def convergents
44 | return @convergents if defined? @convergents
45 |
46 | c = [Fraction.new(0,1), Fraction.new(1,0)]
47 | to_a.each_with_index do |a, i|
48 | i = i + 2
49 |
50 | h = a * c[i-1].n + c[i-2].n
51 | k = a * c[i-1].d + c[i-2].d
52 | c << Fraction.new(h,k)
53 | end
54 |
55 | @converegents = c[2..-1]
56 | end
57 |
58 | def to_r(max_precision=MAX_PRECISION)
59 | fraction = convergents.take_while do |c|
60 | c.n <= max_precision && c.d <= max_precision
61 | end.last
62 |
63 | Rational(fraction.n, fraction.d)
64 | end
65 |
66 | def done?
67 | @f == 0
68 | end
69 |
70 | def extend(count=1)
71 | result = self
72 |
73 | count.times do
74 | break if result.done?
75 | result = ContinuedFraction.new(1 / result.f, result.to_a)
76 | end
77 |
78 | result
79 | end
80 |
81 | class Fraction
82 | attr_reader :n
83 | attr_reader :d
84 |
85 | def initialize(n,d)
86 | @n = n
87 | @d = d
88 | end
89 |
90 | def to_r
91 | Rational(@n, @d)
92 | end
93 | end
94 | end
95 | end
96 | end
--------------------------------------------------------------------------------
/lib/stellar/util/strkey.rb:
--------------------------------------------------------------------------------
1 | module Stellar
2 | module Util
3 |
4 | require 'base32'
5 | require 'digest/crc16_xmodem'
6 |
7 | class StrKey
8 |
9 | VERSION_BYTES = {
10 | account_id: [ 6 << 3].pack("C"), # Base32-encodes to 'G...'
11 | seed: [18 << 3].pack("C"), # Base32-encodes to 'S...'
12 | pre_auth_tx: [19 << 3].pack("C"), # Base32-encodes to 'T...'
13 | hash_x: [23 << 3].pack("C") # Base32-encodes to 'X...'
14 | }
15 |
16 | def self.check_encode(version, byte_str)
17 | version_byte = VERSION_BYTES[version]
18 | raise ArgumentError, "Invalid version: #{version}" if version_byte.blank?
19 | payload = version_byte + byte_str.dup.force_encoding("BINARY")
20 | check = checksum(payload)
21 | Base32.encode(payload + check)
22 | end
23 |
24 | def self.check_decode(expected_version, str)
25 | decoded = Base32.decode(str) rescue (raise ArgumentError, "Invalid base32 string")
26 | version_byte = decoded[0]
27 | payload = decoded[1...-2]
28 | check = decoded[-2..-1]
29 | version = VERSION_BYTES.key(version_byte)
30 |
31 | raise ArgumentError, "Unexpected version: #{version.inspect}" if version != expected_version
32 | raise ArgumentError, "Invalid checksum" if check != checksum(decoded[0...-2])
33 | payload
34 | end
35 |
36 | # return the "XModem CRC16" (CCITT-like, but with 0-init and MSB first)
37 | # packed into a string in little-endian order
38 | def self.checksum(bytes)
39 | crc = Digest::CRC16XModem.checksum(bytes)
40 | [crc].pack("S<")
41 | end
42 |
43 | end
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/ruby-stellar-base.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | require_relative './lib/stellar/base/version'
3 |
4 | Gem::Specification.new do |spec|
5 | spec.name = "stellar-base"
6 | spec.version = Stellar::Base::VERSION
7 | spec.authors = ["Scott Fleckenstein"]
8 | spec.email = ["scott@stellar.org"]
9 | spec.summary = %q{Stellar client library: XDR}
10 | spec.homepage = "https://github.com/stellar/ruby-stellar-base"
11 | spec.license = "Apache 2.0"
12 |
13 | spec.files = `git ls-files -z`.split("\x0")
14 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16 | spec.require_paths = ["generated", "lib"]
17 |
18 | spec.add_dependency "xdr", "~> 3.0.0"
19 | spec.add_dependency "digest-crc", ">= 0.5"
20 | spec.add_dependency "base32", ">= 0.3"
21 | spec.add_dependency "rbnacl", ">= 6.0"
22 | spec.add_dependency "activesupport", ">= 5.0.0"
23 |
24 | spec.add_development_dependency "bundler", "~> 2.0"
25 | spec.add_development_dependency "rake", "~> 12.0"
26 | spec.add_development_dependency "xdrgen", "~> 0.0"
27 | spec.add_development_dependency "rspec", "~> 3.1"
28 | spec.add_development_dependency "guard-rspec", "~> 4.7"
29 | spec.add_development_dependency "simplecov", "~> 0.18"
30 | spec.add_development_dependency "octokit", "~> 4.17"
31 | spec.add_development_dependency "netrc", "~> 0.11"
32 | spec.add_development_dependency "yard", "~> 0.9"
33 |
34 | end
35 |
--------------------------------------------------------------------------------
/spec/lib/stellar/account_flags_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Stellar::AccountFlags do
4 | subject{ Stellar::AccountFlags }
5 | let(:raw) { 3 }
6 | let(:result) { subject.parse_mask raw }
7 |
8 | it "parses correctly" do
9 | expect(subject.parse_mask(1)).to eq([Stellar::AccountFlags.auth_required_flag])
10 | expect(subject.parse_mask(2)).to eq([Stellar::AccountFlags.auth_revocable_flag])
11 | expect(subject.parse_mask(3)).to eq([Stellar::AccountFlags.auth_required_flag, Stellar::AccountFlags.auth_revocable_flag])
12 | end
13 |
14 | it "makes correctly" do
15 | expect(subject.make_mask([Stellar::AccountFlags.auth_required_flag])).to eq(1)
16 | expect(subject.make_mask([Stellar::AccountFlags.auth_revocable_flag])).to eq(2)
17 | expect(subject.make_mask([Stellar::AccountFlags.auth_required_flag, Stellar::AccountFlags.auth_revocable_flag])).to eq(3)
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/spec/lib/stellar/asset_spec.rb:
--------------------------------------------------------------------------------
1 | require "spec_helper"
2 |
3 | describe Stellar::Asset, ".native" do
4 | it "returns a asset instance whose type is 'AssetType.asset_type_native'" do
5 | expect(Stellar::Asset.native.type).to eq(Stellar::AssetType.asset_type_native)
6 | end
7 | end
8 |
9 | describe Stellar::Asset, ".alphanum4" do
10 | it "returns a asset instance whose type is 'AssetType.asset_type_credit_alphanum4'" do
11 | result = Stellar::Asset.alphanum4("USD", Stellar::KeyPair.master)
12 | expect(result.type).to eq(Stellar::AssetType.asset_type_credit_alphanum4)
13 | end
14 |
15 | it "pads the code to 4 bytes, padding on the right and with null bytes" do
16 | result = Stellar::Asset.alphanum4("USD", Stellar::KeyPair.master)
17 | expect(result.code).to eq("USD\x00")
18 | end
19 | end
20 |
21 | describe Stellar::Asset, ".alphanum12" do
22 | it "returns a asset instance whose type is 'AssetType.asset_type_credit_alphanum12'" do
23 | result = Stellar::Asset.alphanum12("USD", Stellar::KeyPair.master)
24 | expect(result.type).to eq(Stellar::AssetType.asset_type_credit_alphanum12)
25 | end
26 |
27 | it "pads the code to 12 bytes, padding on the right and with null bytes" do
28 | result = Stellar::Asset.alphanum12("USD", Stellar::KeyPair.master)
29 | expect(result.code).to eq("USD\x00\x00\x00\x00\x00\x00\x00\x00\x00")
30 | end
31 | end
32 |
33 | describe Stellar::Asset, "#code" do
34 | it "returns the asset_code for either alphanum4 or alphanum12 assets" do
35 | a4 = Stellar::Asset.alphanum4("USD", Stellar::KeyPair.master)
36 | a12 = Stellar::Asset.alphanum12("USD", Stellar::KeyPair.master)
37 |
38 | expect(a4.code.strip).to eq("USD")
39 | expect(a12.code.strip).to eq("USD")
40 | end
41 |
42 | it "raises an error when called on a native asset" do
43 | expect{ Stellar::Asset.native.code }.to raise_error(RuntimeError)
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/spec/lib/stellar/convert_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Stellar::Convert do
4 | subject{ Stellar::Convert }
5 | let(:raw) { "\x01\x02\x03\x04" }
6 | let(:hex) { "01020304" }
7 | let(:base64){ "AQIDBA==" }
8 |
9 | describe "hex encoding" do
10 | it "decodes" do
11 | expect(subject.from_hex(hex)).to eq(raw)
12 | end
13 |
14 | it "encodes" do
15 | expect(subject.to_hex(raw)).to eq(hex)
16 | end
17 |
18 | it "round trips" do
19 | raw1 = subject.from_hex(hex)
20 | hex1 = subject.to_hex(raw1)
21 | expect(hex1).to eq(hex)
22 |
23 |
24 | hex2 = subject.to_hex(raw)
25 | raw2 = subject.from_hex(hex2)
26 | expect(raw2).to eq(raw)
27 | end
28 | end
29 |
30 | describe "base64 encoding" do
31 | it "decodes" do
32 | expect(subject.from_base64(base64)).to eq(raw)
33 | end
34 |
35 | it "encodes" do
36 | expect(subject.to_base64(raw)).to eq(base64)
37 | end
38 |
39 | it "round trips" do
40 | raw1 = subject.from_base64(base64)
41 | base641 = subject.to_base64(raw1)
42 | expect(base641).to eq(base64)
43 |
44 |
45 | base642 = subject.to_base64(raw)
46 | raw2 = subject.from_base64(base642)
47 | expect(raw2).to eq(raw)
48 | end
49 | end
50 |
51 |
52 | describe "#pk_to_address" do
53 | let(:pk_raw){ "\x00" * 32 }
54 | let(:pk_account_id){ Stellar::AccountID.new(:public_key_type_ed25519, pk_raw)}
55 |
56 | it "converts a Stellar::AccountID into an address using StrKey.check_encode(:account_id)" do
57 | address = Stellar::Util::StrKey.check_encode(:account_id, pk_raw)
58 | expect(subject.pk_to_address(pk_account_id)).to eql(address)
59 | end
60 | end
61 | end
62 |
--------------------------------------------------------------------------------
/spec/lib/stellar/networks_spec.rb:
--------------------------------------------------------------------------------
1 | require "spec_helper"
2 |
3 | describe Stellar, ".default_network=" do
4 |
5 | before(:each){ Stellar.default_network = "foo" }
6 | after(:each){ Stellar.default_network = nil }
7 |
8 | it "sets the value returned by current_network " do
9 | expect(Stellar.current_network).to eql("foo")
10 | end
11 |
12 | end
13 |
14 | describe Stellar, ".current_network" do
15 |
16 | after(:each){ Stellar.default_network = nil }
17 |
18 | it "returns the public network absent any other configuration" do
19 | expect(Stellar.current_network).to eql(Stellar::Networks::TESTNET)
20 | end
21 |
22 | it "returns the default network if configured and not within a call to on_network" do
23 | Stellar.default_network = "foo"
24 | expect(Stellar.current_network).to eql("foo")
25 | end
26 |
27 | it "returns the network as specified by on_network, even when a default is set" do
28 | Stellar.default_network = "foo"
29 |
30 | Stellar.on_network "bar" do
31 | expect(Stellar.current_network).to eql("bar")
32 | end
33 |
34 | expect(Stellar.current_network).to eql("foo")
35 | end
36 | end
37 |
38 | describe Stellar, ".current_network_id" do
39 | it "returns the sha256 of the current_network" do
40 | expect(Stellar.current_network_id).to eql(Digest::SHA256.digest(Stellar.current_network))
41 | end
42 | end
43 |
44 | describe Stellar, ".on_network" do
45 |
46 | after(:each){ Thread.current["stellar_network_passphrase"] = nil }
47 |
48 |
49 | it "sets the current_network and a thread local" do
50 | Stellar.on_network "bar" do
51 | expect(Stellar.current_network).to eql("bar")
52 | expect(Thread.current["stellar_network_passphrase"]).to eql("bar")
53 | end
54 | end
55 |
56 |
57 | it "nests" do
58 | Stellar.on_network "foo" do
59 | expect(Stellar.current_network).to eql("foo")
60 | Stellar.on_network "bar" do
61 | expect(Stellar.current_network).to eql("bar")
62 | end
63 | expect(Stellar.current_network).to eql("foo")
64 | end
65 | end
66 |
67 |
68 | it "resets the network value when an error is raised" do
69 | begin
70 | Stellar.on_network "foo" do
71 | raise "kablow"
72 | end
73 | rescue
74 | expect(Stellar.current_network).to_not eql("foo")
75 | end
76 | end
77 | end
78 |
--------------------------------------------------------------------------------
/spec/lib/stellar/price_spec.rb:
--------------------------------------------------------------------------------
1 | require "spec_helper"
2 |
3 | describe Stellar::Price, "#from_f" do
4 | subject{ Stellar::Price }
5 | let(:seed){ 225571644875421139403973254661022579608 } #generated using Random.new
6 | let(:random){ Random.new(seed) }
7 | let(:iterations){ ENV["SMOKE_ITERATIONS"].present? ? ENV["SMOKE_ITERATIONS"].to_i : 2000}
8 |
9 | it "withstands a random smoke test" do
10 | iterations.times do |i|
11 | expected = random.rand
12 | actual_p = subject.from_f(expected)
13 | actual = actual_p.to_f
14 |
15 | expect(actual).to be_within(0.000000001).of(actual)
16 | expect(actual_p.n).to be <= Stellar::Price::MAX_PRECISION
17 | expect(actual_p.d).to be <= Stellar::Price::MAX_PRECISION
18 | end
19 | end
20 |
21 | it "works with bigdecimal" do
22 | whole = random.rand(1_000_000)
23 | fractional = random.rand(10_000_000) # seven significant digits available for fractional
24 |
25 | expected = BigDecimal("#{whole}.#{fractional}")
26 | actual_p = subject.from_f(expected)
27 | actual = BigDecimal(actual_p.n) / BigDecimal(actual_p.d)
28 |
29 | expect(actual).to be_within(BigDecimal("0.000000001")).of(actual)
30 | expect(actual_p.n).to be <= Stellar::Price::MAX_PRECISION
31 | expect(actual_p.d).to be <= Stellar::Price::MAX_PRECISION
32 | end
33 |
34 | end
35 |
--------------------------------------------------------------------------------
/spec/lib/stellar/signer_key_spec.rb:
--------------------------------------------------------------------------------
1 | require "spec_helper"
2 |
3 | describe Stellar::SignerKey, ".hash_x" do
4 |
5 | subject{ Stellar::SignerKey }
6 |
7 | let(:hash_preimage){ "a" * 32 }
8 | let(:hash){ Digest::SHA256.digest(hash_preimage) }
9 |
10 | it "raises an argument error when not provided a 32-byte string" do
11 | expect{subject.hash_x("hello world")}.to raise_error(ArgumentError)
12 | expect{subject.hash_x("")}.to raise_error(ArgumentError)
13 | expect{subject.hash_x("a" * 31)}.to raise_error(ArgumentError)
14 | expect{subject.hash_x("a" * 33)}.to raise_error(ArgumentError)
15 | expect{subject.hash_x([0] * 32)}.to raise_error(ArgumentError)
16 |
17 | end
18 |
19 | it "creates a HashX signer key" do
20 | sk = subject.hash_x(hash_preimage)
21 | expect(sk.switch).to eq(Stellar::SignerKeyType.signer_key_type_hash_x)
22 | expect(sk.value).to be_an_instance_of(String)
23 | expect(sk.value).to eq(hash)
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/spec/lib/stellar/util/strkey_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Stellar::Util::StrKey do
4 |
5 | subject{ Stellar::Util::StrKey }
6 |
7 | describe "#check_decode" do
8 | it "properly decodes" do
9 | expect(decode :seed, "SAAAAAAAAAADST3H").to eq_bytes("\x00\x00\x00\x00\x00\x00\x39")
10 | expect(decode :account_id, "GD777777777764TU").to eq_bytes("\xFF\xFF\xFF\xFF\xFF\xFF\xFF")
11 | expect(decode :account_id, "GBQWWBFLRP3BXZD5").to eq_bytes("\x61\x6b\x04\xab\x8b\xf6\x1b")
12 | expect(decode :pre_auth_tx, "TBU2RRGLXH3E4VON").to eq_bytes("\x69\xa8\xc4\xcb\xb9\xf6\x4e")
13 | expect(decode :hash_x, "XBU2RRGLXH3E4PNW").to eq_bytes("\x69\xa8\xc4\xcb\xb9\xf6\x4e")
14 | end
15 |
16 | it "raises an ArgumentError when an invalid version is provided" do
17 | expect{ decode :floob, "SAAAAAAAAAADST3M" }.to raise_error(ArgumentError)
18 | end
19 |
20 | it "raises an ArgumentError if the decoded version byte does not match the expected value" do
21 | expect{ decode :seed, "GD777777777764TU" }.to raise_error(ArgumentError)
22 | expect{ decode :account_id, "SAAAAAAAAAADST3M" }.to raise_error(ArgumentError)
23 | end
24 |
25 | it "raises an ArgumentError if the decoded value cannot be validated by the checksum" do
26 | expect{ decode :seed, "SAAAAAAAAAADST3M" }.to raise_error(ArgumentError)
27 | end
28 |
29 | def decode(version, bytes)
30 | subject.check_decode(version, bytes)
31 | end
32 | end
33 |
34 | describe "#check_encode" do
35 | it "properly encodes" do
36 | expect(encode :seed, "\x00\x00\x00\x00\x00\x00\x39").to eq("SAAAAAAAAAADST3H")
37 | expect(encode :account_id, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF").to eq("GD777777777764TU")
38 | expect(encode :account_id, "\x61\x6b\x04\xab\x8b\xf6\x1b").to eq("GBQWWBFLRP3BXZD5")
39 | expect(encode :pre_auth_tx, "\x69\xa8\xc4\xcb\xb9\xf6\x4e").to eq_bytes("TBU2RRGLXH3E4VON")
40 | expect(encode :hash_x, "\x69\xa8\xc4\xcb\xb9\xf6\x4e").to eq_bytes("XBU2RRGLXH3E4PNW")
41 | end
42 |
43 | it "raises an ArgumentError when an invalid version is provided" do
44 | expect{ encode :floob, "\x39" }.to raise_error(ArgumentError)
45 | end
46 |
47 | def encode(version, bytes)
48 | subject.check_encode(version, bytes)
49 | end
50 | end
51 |
52 | end
53 |
54 |
55 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'bundler/setup'
2 | Bundler.setup
3 |
4 | require 'simplecov'
5 | SimpleCov.start
6 |
7 | require 'pry'
8 | require 'stellar-base'
9 |
10 | SPEC_ROOT = File.dirname(__FILE__)
11 |
12 | Dir["#{SPEC_ROOT}/support/**/*.rb"].each { |f| require f }
13 |
14 | RSpec.configure do |config|
15 |
16 | end
17 |
--------------------------------------------------------------------------------
/spec/support/matchers/be_strkey.rb:
--------------------------------------------------------------------------------
1 | RSpec::Matchers.define :be_strkey do |version_byte|
2 | match do |actual|
3 | begin
4 | Stellar::Util::StrKey.check_decode(version_byte, actual)
5 | rescue ArgumentError
6 | false
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/spec/support/matchers/eq_bytes.rb:
--------------------------------------------------------------------------------
1 | RSpec::Matchers.define :eq_bytes do |expected|
2 | match do |actual|
3 | expected.force_encoding("ASCII-8BIT") == actual.force_encoding("ASCII-8BIT")
4 | end
5 | end
--------------------------------------------------------------------------------
/spec/support/matchers/have_length.rb:
--------------------------------------------------------------------------------
1 | RSpec::Matchers.define :have_length do |length|
2 | match do |actual|
3 | actual.length == length
4 | end
5 | end
--------------------------------------------------------------------------------
/tasks/rspec.rake:
--------------------------------------------------------------------------------
1 | begin
2 | require 'rspec/core/rake_task'
3 | RSpec::Core::RakeTask.new(:spec)
4 | task :default => :spec
5 | rescue LoadError
6 | end
7 |
--------------------------------------------------------------------------------
/tasks/travis.rake:
--------------------------------------------------------------------------------
1 | task :travis => %w(spec)
2 |
--------------------------------------------------------------------------------
/tasks/xdr.rake:
--------------------------------------------------------------------------------
1 | namespace :xdr do
2 | xdr_defs = FileList[
3 | 'xdr/Stellar-types.x',
4 | 'xdr/Stellar-ledger-entries.x',
5 | 'xdr/Stellar-transaction.x',
6 | 'xdr/Stellar-ledger.x',
7 | 'xdr/Stellar-overlay.x',
8 | 'xdr/Stellar-SCP.x',
9 | ]
10 |
11 | task :update, [:ref] => [:clean, :generate]
12 | task :generate => 'generated/stellar-base-generated.rb'
13 |
14 | directory 'xdr'
15 | directory 'generated'
16 |
17 | file 'generated/stellar-base-generated.rb' => xdr_defs do |t|
18 | require "xdrgen"
19 |
20 | compilation = Xdrgen::Compilation.new(
21 | t.sources,
22 | output_dir: "generated",
23 | namespace: "stellar-base-generated",
24 | language: :ruby
25 | )
26 | compilation.compile
27 | end
28 |
29 | rule '.x', [:ref] => ['xdr'] do |t, args|
30 | args.with_defaults(ref: :master)
31 | core_file = github_client.contents("stellar/stellar-core", path: "src/#{t.name}", ref: args.ref)
32 | IO.write(t.name, core_file.rels[:download].get.data)
33 | end
34 |
35 | task :clean do
36 | rm_rf 'xdr'
37 | rm_rf 'generated'
38 | end
39 |
40 | def github_client
41 | return @github_client if defined?(@github_client)
42 | require 'octokit'
43 | @github_client = Octokit::Client.new(netrc: true)
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/xdr/Stellar-SCP.x:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Stellar Development Foundation and contributors. Licensed
2 | // under the Apache License, Version 2.0. See the COPYING file at the root
3 | // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
4 |
5 | %#include "xdr/Stellar-types.h"
6 |
7 | namespace stellar
8 | {
9 |
10 | typedef opaque Value<>;
11 |
12 | struct SCPBallot
13 | {
14 | uint32 counter; // n
15 | Value value; // x
16 | };
17 |
18 | enum SCPStatementType
19 | {
20 | SCP_ST_PREPARE = 0,
21 | SCP_ST_CONFIRM = 1,
22 | SCP_ST_EXTERNALIZE = 2,
23 | SCP_ST_NOMINATE = 3
24 | };
25 |
26 | struct SCPNomination
27 | {
28 | Hash quorumSetHash; // D
29 | Value votes<>; // X
30 | Value accepted<>; // Y
31 | };
32 |
33 | struct SCPStatement
34 | {
35 | NodeID nodeID; // v
36 | uint64 slotIndex; // i
37 |
38 | union switch (SCPStatementType type)
39 | {
40 | case SCP_ST_PREPARE:
41 | struct
42 | {
43 | Hash quorumSetHash; // D
44 | SCPBallot ballot; // b
45 | SCPBallot* prepared; // p
46 | SCPBallot* preparedPrime; // p'
47 | uint32 nC; // c.n
48 | uint32 nH; // h.n
49 | } prepare;
50 | case SCP_ST_CONFIRM:
51 | struct
52 | {
53 | SCPBallot ballot; // b
54 | uint32 nPrepared; // p.n
55 | uint32 nCommit; // c.n
56 | uint32 nH; // h.n
57 | Hash quorumSetHash; // D
58 | } confirm;
59 | case SCP_ST_EXTERNALIZE:
60 | struct
61 | {
62 | SCPBallot commit; // c
63 | uint32 nH; // h.n
64 | Hash commitQuorumSetHash; // D used before EXTERNALIZE
65 | } externalize;
66 | case SCP_ST_NOMINATE:
67 | SCPNomination nominate;
68 | }
69 | pledges;
70 | };
71 |
72 | struct SCPEnvelope
73 | {
74 | SCPStatement statement;
75 | Signature signature;
76 | };
77 |
78 | // supports things like: A,B,C,(D,E,F),(G,H,(I,J,K,L))
79 | // only allows 2 levels of nesting
80 | struct SCPQuorumSet
81 | {
82 | uint32 threshold;
83 | PublicKey validators<>;
84 | SCPQuorumSet innerSets<>;
85 | };
86 | }
87 |
--------------------------------------------------------------------------------
/xdr/Stellar-types.x:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Stellar Development Foundation and contributors. Licensed
2 | // under the Apache License, Version 2.0. See the COPYING file at the root
3 | // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
4 |
5 | namespace stellar
6 | {
7 |
8 | typedef opaque Hash[32];
9 | typedef opaque uint256[32];
10 |
11 | typedef unsigned int uint32;
12 | typedef int int32;
13 |
14 | typedef unsigned hyper uint64;
15 | typedef hyper int64;
16 |
17 | enum CryptoKeyType
18 | {
19 | KEY_TYPE_ED25519 = 0,
20 | KEY_TYPE_PRE_AUTH_TX = 1,
21 | KEY_TYPE_HASH_X = 2
22 | };
23 |
24 | enum PublicKeyType
25 | {
26 | PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519
27 | };
28 |
29 | enum SignerKeyType
30 | {
31 | SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519,
32 | SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX,
33 | SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X
34 | };
35 |
36 | union PublicKey switch (PublicKeyType type)
37 | {
38 | case PUBLIC_KEY_TYPE_ED25519:
39 | uint256 ed25519;
40 | };
41 |
42 | union SignerKey switch (SignerKeyType type)
43 | {
44 | case SIGNER_KEY_TYPE_ED25519:
45 | uint256 ed25519;
46 | case SIGNER_KEY_TYPE_PRE_AUTH_TX:
47 | /* SHA-256 Hash of TransactionSignaturePayload structure */
48 | uint256 preAuthTx;
49 | case SIGNER_KEY_TYPE_HASH_X:
50 | /* Hash of random 256 bit preimage X */
51 | uint256 hashX;
52 | };
53 |
54 | // variable size as the size depends on the signature scheme used
55 | typedef opaque Signature<64>;
56 |
57 | typedef opaque SignatureHint[4];
58 |
59 | typedef PublicKey NodeID;
60 |
61 | struct Curve25519Secret
62 | {
63 | opaque key[32];
64 | };
65 |
66 | struct Curve25519Public
67 | {
68 | opaque key[32];
69 | };
70 |
71 | struct HmacSha256Key
72 | {
73 | opaque key[32];
74 | };
75 |
76 | struct HmacSha256Mac
77 | {
78 | opaque mac[32];
79 | };
80 |
81 | }
82 |
--------------------------------------------------------------------------------