stellar-sdk 0.5.0 → 0.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -2
  3. data/{LICENSE.txt → LICENSE} +0 -0
  4. data/README.md +17 -11
  5. data/lib/stellar-sdk.rb +3 -4
  6. data/lib/stellar/account.rb +16 -18
  7. data/lib/stellar/amount.rb +9 -13
  8. data/lib/stellar/client.rb +217 -91
  9. data/lib/stellar/horizon/problem.rb +14 -16
  10. data/lib/stellar/sep10.rb +347 -0
  11. data/lib/stellar/transaction_page.rb +4 -6
  12. data/lib/stellar/version.rb +1 -1
  13. metadata +17 -207
  14. data/.gitignore +0 -16
  15. data/.travis.yml +0 -13
  16. data/.yardopts +0 -7
  17. data/CONTRIBUTING.md +0 -48
  18. data/Gemfile +0 -14
  19. data/Guardfile +0 -5
  20. data/Rakefile +0 -3
  21. data/examples/01_get_funded.rb +0 -37
  22. data/examples/02_payment.rb +0 -15
  23. data/examples/03_transaction_history.rb +0 -21
  24. data/examples/04_setting_trust.rb +0 -1
  25. data/examples/05_fiat_payment.rb +0 -13
  26. data/examples/06_fund_testnet_friendbot.rb +0 -15
  27. data/ruby-stellar-sdk.gemspec +0 -36
  28. data/spec/config.yml.sample +0 -7
  29. data/spec/fixtures/vcr_cassettes/Stellar_Account/_lookup/should_handle_404_request_when_performing_federation_lookup.yml +0 -133
  30. data/spec/fixtures/vcr_cassettes/Stellar_Account/_lookup/should_handle_domains_that_are_not_federation_servers.yml +0 -44
  31. data/spec/fixtures/vcr_cassettes/Stellar_Account/_lookup/should_peforms_federation_lookup.yml +0 -85
  32. data/spec/fixtures/vcr_cassettes/Stellar_Client/_account_info/returns_the_current_details_for_the_account.yml +0 -190
  33. data/spec/fixtures/vcr_cassettes/Stellar_Client/_account_merge/merges_source_account_into_destination.yml +0 -714
  34. data/spec/fixtures/vcr_cassettes/Stellar_Client/_change_trust/given_an_asset_described_as_an_array/creates_updates_or_deletes_a_trustline.yml +0 -1156
  35. data/spec/fixtures/vcr_cassettes/Stellar_Client/_create_account/creates_the_account.yml +0 -323
  36. data/spec/fixtures/vcr_cassettes/Stellar_Client/_send_payment/alphanum12_asset/sends_a_alphanum12_asset_to_the_destination.yml +0 -737
  37. data/spec/fixtures/vcr_cassettes/Stellar_Client/_send_payment/alphanum4_asset/sends_a_alphanum4_asset_to_the_destination.yml +0 -737
  38. data/spec/fixtures/vcr_cassettes/Stellar_Client/_send_payment/native_asset/sends_a_native_payment_to_the_account.yml +0 -469
  39. data/spec/fixtures/vcr_cassettes/Stellar_Client/_transactions/account_transactions/accepts_a_cursor_to_return_less_data.yml +0 -94
  40. data/spec/fixtures/vcr_cassettes/Stellar_Client/_transactions/account_transactions/returns_a_list_of_transaction_for_an_account.yml +0 -94
  41. data/spec/fixtures/vcr_cassettes/Stellar_Client/_transactions/all_transactions/accepts_a_cursor_to_return_less_data.yml +0 -94
  42. data/spec/fixtures/vcr_cassettes/Stellar_Client/_transactions/all_transactions/returns_a_list_of_transactions.yml +0 -94
  43. data/spec/lib/stellar/account_spec.rb +0 -59
  44. data/spec/lib/stellar/amount_spec.rb +0 -70
  45. data/spec/lib/stellar/client_spec.rb +0 -302
  46. data/spec/spec_helper.rb +0 -14
  47. data/spec/support/config.rb +0 -3
  48. data/spec/support/vcr.rb +0 -10
  49. data/tasks/rspec.rake +0 -6
  50. data/tasks/travis.rake +0 -1
data/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /.ruby-version
4
- /Gemfile.lock
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
11
- *.bundle
12
- *.so
13
- *.o
14
- *.a
15
- mkmf.log
16
- /spec/config.yml
@@ -1,13 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.1
4
- - 2.4.1
5
- - 2.5.1
6
- - jruby-9.1.6.0
7
- cache: bundler
8
- script: LD_LIBRARY_PATH=lib bundle exec rake travis
9
- before_script:
10
- - cp spec/config.yml.sample spec/config.yml
11
- notifications:
12
- slack:
13
- secure: D1gWWsjE9i9XLRM6Bfw2pu3tTPW025iqjhgwE3KNw1QwP2TrehbCwRpjVR4rrnaju9FhYqM0+eT4rFc9g6itBPf2pfN1WziVf/CVJORYTzR9HbLL1rMOaWhEv4x/+Uwu0kxQon9ThnM9w6XjjD1+NoBfGn4Lcgc/OgmUGw1jAvQ=
data/.yardopts DELETED
@@ -1,7 +0,0 @@
1
- --output-dir doc/generated
2
- --protected
3
- --no-private
4
- --embed-mixin ClassMethods
5
- lib/**/*.rb
6
- -
7
- doc/*.md
@@ -1,48 +0,0 @@
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
- * <a href="https://docs.google.com/forms/d/1g7EF6PERciwn7zfmfke5Sir2n10yddGGSXyZsq98tVY/viewform?usp=send_form">Sign the Contributor License Agreement</a>
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/stellar/ruby-stellar-lib/issues)
38
- * <a href="https://docs.google.com/forms/d/1g7EF6PERciwn7zfmfke5Sir2n10yddGGSXyZsq98tVY/viewform?usp=send_form">Contributor License Agreement</a>
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
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- # gem "xdr", git: "git@github.com:stellar/ruby-xdr.git"
6
- # gem "xdr", path: "../ruby-xdr"
7
-
8
- # gem "stellar-base", git: "git@github.com:stellar/ruby-stellar-base.git"
9
- # gem "stellar-base", path: "../ruby-stellar-base"
10
-
11
- group :development do
12
- gem "pry"
13
- end
14
-
data/Guardfile DELETED
@@ -1,5 +0,0 @@
1
- guard :rspec, cmd: '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
data/Rakefile DELETED
@@ -1,3 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- Dir["tasks/**/*.rake"].each{|f| load f}
@@ -1,37 +0,0 @@
1
- require 'stellar-sdk'
2
-
3
- # Reference an account from a secret seed
4
- account = Stellar::Account.from_seed("SBXH4SEH32PENMMB66P4TY6LXUIFMRVFUMX2LJC3P2STHICBJLNQJOH5")
5
-
6
- # Further options
7
- #
8
- # Make a random account
9
- #
10
- # account = Stellar::Account.random()
11
- #
12
- # Reference an account (unauthenticated) from an address
13
- #
14
- # account = Stellar::Account.from_address("gjgPNE2GpySt5iYZaFFo1svCJ4gbHwXxUy8DDqeYTDK6UzsPTs")
15
- #
16
- # Reference an account (unauthenticated) from a federation name
17
- #
18
- # account = Stellar::Account.lookup("nullstyle*stellarfed.org")
19
- # account = Stellar::Account.lookup("nullstyle@gmail.com*stellarfed.org")
20
- #
21
-
22
- # create a connection to the stellar network
23
- client = Stellar::Client.default_testnet()
24
-
25
- # Further options
26
- #
27
- # Connect to the live network (when it is created)
28
- #
29
- # client = Stellar::Client.default
30
- #
31
- # Connect to a specific horizon host
32
- #
33
- # client = Stellar::Client.new(host: "127.0.0.1")
34
-
35
- # Get our friendly friendbot to
36
- # fund your new account
37
- response = client.friendbot(account) # => #<OK>
@@ -1,15 +0,0 @@
1
- require 'stellar-sdk'
2
-
3
- account = Stellar::Account.from_seed("SBXH4SEH32PENMMB66P4TY6LXUIFMRVFUMX2LJC3P2STHICBJLNQJOH5")
4
- client = Stellar::Client.default_testnet()
5
-
6
- # create a random recipients
7
- recipient = Stellar::Account.random
8
-
9
- # make a payment
10
- client.send_payment({
11
- from: account,
12
- to: recipient,
13
- amount: Stellar::Amount.new(100_000_000)
14
- }) # => #<OK>
15
-
@@ -1,21 +0,0 @@
1
- require 'stellar-sdk'
2
-
3
- account = Stellar::Account.from_seed("SBXH4SEH32PENMMB66P4TY6LXUIFMRVFUMX2LJC3P2STHICBJLNQJOH5")
4
- client = Stellar::Client.default_testnet()
5
-
6
- # load the first page of transactions
7
- transactions = client.transactions({
8
- account: account,
9
- order: :chronological
10
- }) # => #<TransactionPage count=50 [...]>
11
-
12
- # TransactionPage implements Enumerable...
13
- transactions.first # => #<Stellar::Transaction ...>
14
- transactions.each{|tx| p tx}
15
- transactions.take(3) # => [...]
16
-
17
- # ...but also has methods to advance pages
18
- newer_transactions = transactions.next_page
19
-
20
- # we can also just advance the current page in place
21
- transactions.next_page!
@@ -1 +0,0 @@
1
- # See the spec for `#change_trust` in `spec/lib/stellar/client_spec.rb`
@@ -1,13 +0,0 @@
1
- require 'stellar-sdk'
2
-
3
- account = Stellar::Account.from_seed("SBXH4SEH32PENMMB66P4TY6LXUIFMRVFUMX2LJC3P2STHICBJLNQJOH5")
4
- client = Stellar::Client.default_testnet()
5
-
6
- issuer = Stellar::Account.lookup("tips*stellarid.io")
7
- asset = Stellar::Asset.alphanum4("USD", issuer)
8
-
9
- client.send({
10
- from: account,
11
- to: recipient,
12
- amount: Stellar::Amount.new(100, asset, issuer)
13
- }) # => #<OK>
@@ -1,15 +0,0 @@
1
- require 'stellar-sdk'
2
-
3
- client = Stellar::Client.default_testnet
4
-
5
- friendbot = Stellar::Account.from_seed("SBXH4SEH32PENMMB66P4TY6LXUIFMRVFUMX2LJC3P2STHICBJLNQJOH5")
6
-
7
- # Give 10 million lumens
8
- client.create_account({
9
- funder: Stellar::Account.master,
10
- account: friendbot,
11
- starting_balance: 10_000_000 * Stellar::ONE,
12
- sequence: 1,
13
- })
14
-
15
- puts friendbot.address
@@ -1,36 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'stellar/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "stellar-sdk"
8
- spec.version = Stellar::VERSION
9
- spec.authors = ["Scott Fleckenstein"]
10
- spec.email = ["scott@stellar.org"]
11
- spec.summary = %q{Stellar client library}
12
- spec.homepage = "http://github.com/stellar/ruby-stellar-sdk"
13
- spec.license = "Apache 2.0"
14
-
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_dependency "stellar-base", ">= 0.16.0"
21
- spec.add_dependency "hyperclient", "~> 0.7"
22
- spec.add_dependency "excon", "~> 0.44", ">= 0.44.4"
23
- spec.add_dependency "contracts", "~> 0.16"
24
- spec.add_dependency "activesupport", ">= 5.2.0"
25
- spec.add_dependency "toml-rb", "~> 1.1", ">= 1.1.1"
26
-
27
- spec.add_development_dependency "bundler", "~> 1.16"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.1"
30
- spec.add_development_dependency "guard-rspec"
31
- spec.add_development_dependency "simplecov"
32
- spec.add_development_dependency "yard"
33
- spec.add_development_dependency "vcr", "~> 3.0"
34
- spec.add_development_dependency "webmock", "~> 2.3"
35
-
36
- end
@@ -1,7 +0,0 @@
1
- ---
2
- # Source must be funded already
3
- # Use https://www.stellar.org/laboratory/#account-creator?network=test
4
- # These ones in the sample are just randomly generated ones; enough for tests
5
- # to pass (as long as we're not re-recording)
6
- source_seed: "SALQBNNRCXWD32E4QKIXKXCMXCPJKWUP34EAK53SP6PNGAUVWSAM5IUQ"
7
- source_address: "GCIDYJRG5HV4WEESRA4LEKIMXLCU46XIKXGZK4PWX5K23PJIATMWR3UE"
@@ -1,133 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://stellarfed.org/.well-known/stellar.toml
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.14.0
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Date:
22
- - Tue, 20 Feb 2018 18:58:58 GMT
23
- Content-Type:
24
- - text/plain; charset=utf-8
25
- Transfer-Encoding:
26
- - chunked
27
- Connection:
28
- - keep-alive
29
- Set-Cookie:
30
- - __cfduid=de30e4abf7a551661d3deb92e6e3716011519153138; expires=Wed, 20-Feb-19
31
- 18:58:58 GMT; path=/; domain=.stellarfed.org; HttpOnly; Secure
32
- X-Frame-Options:
33
- - SAMEORIGIN
34
- X-Xss-Protection:
35
- - 1; mode=block
36
- X-Content-Type-Options:
37
- - nosniff
38
- X-Download-Options:
39
- - noopen
40
- X-Permitted-Cross-Domain-Policies:
41
- - none
42
- Referrer-Policy:
43
- - strict-origin-when-cross-origin
44
- Access-Control-Allow-Origin:
45
- - "*"
46
- Etag:
47
- - W/"e00cc6ea5aab41de546253c69965d937"
48
- Cache-Control:
49
- - max-age=0, private, must-revalidate
50
- X-Request-Id:
51
- - 6a387582-adbe-4bfd-836b-eabf658fce22
52
- X-Runtime:
53
- - '0.002500'
54
- Strict-Transport-Security:
55
- - max-age=15552000; includeSubDomains
56
- Via:
57
- - 1.1 vegur
58
- Expect-Ct:
59
- - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
60
- Server:
61
- - cloudflare
62
- Cf-Ray:
63
- - 3f03b34b0e799266-EWR
64
- body:
65
- encoding: ASCII-8BIT
66
- string: FEDERATION_SERVER = "https://stellarfed.org/federation"
67
- http_version:
68
- recorded_at: Tue, 20 Feb 2018 18:58:58 GMT
69
- - request:
70
- method: get
71
- uri: https://stellarfed.org/federation?q=jane@email.com*stellarfed.org&type=name
72
- body:
73
- encoding: US-ASCII
74
- string: ''
75
- headers:
76
- User-Agent:
77
- - Faraday v0.14.0
78
- Accept-Encoding:
79
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
80
- Accept:
81
- - "*/*"
82
- response:
83
- status:
84
- code: 404
85
- message: Not Found
86
- headers:
87
- Date:
88
- - Tue, 20 Feb 2018 18:58:58 GMT
89
- Content-Type:
90
- - application/json; charset=utf-8
91
- Transfer-Encoding:
92
- - chunked
93
- Connection:
94
- - keep-alive
95
- Set-Cookie:
96
- - __cfduid=d164f4eba862038aaf9e96d9ac755d9471519153138; expires=Wed, 20-Feb-19
97
- 18:58:58 GMT; path=/; domain=.stellarfed.org; HttpOnly; Secure
98
- X-Frame-Options:
99
- - SAMEORIGIN
100
- X-Xss-Protection:
101
- - 1; mode=block
102
- X-Content-Type-Options:
103
- - nosniff
104
- X-Download-Options:
105
- - noopen
106
- X-Permitted-Cross-Domain-Policies:
107
- - none
108
- Referrer-Policy:
109
- - strict-origin-when-cross-origin
110
- Access-Control-Allow-Origin:
111
- - "*"
112
- Cache-Control:
113
- - no-cache
114
- X-Request-Id:
115
- - 2b9424e9-6cb3-4cdc-915e-469f8e2123e3
116
- X-Runtime:
117
- - '0.004981'
118
- Strict-Transport-Security:
119
- - max-age=15552000; includeSubDomains
120
- Via:
121
- - 1.1 vegur
122
- Expect-Ct:
123
- - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
124
- Server:
125
- - cloudflare
126
- Cf-Ray:
127
- - 3f03b34bbd5c91d0-EWR
128
- body:
129
- encoding: ASCII-8BIT
130
- string: '{"detail":"no record found"}'
131
- http_version:
132
- recorded_at: Tue, 20 Feb 2018 18:58:58 GMT
133
- recorded_with: VCR 3.0.3
@@ -1,44 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://stellar.org/.well-known/stellar.toml
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.14.0
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
- response:
17
- status:
18
- code: 301
19
- message: Moved Permanently
20
- headers:
21
- Date:
22
- - Tue, 20 Feb 2018 19:11:53 GMT
23
- Transfer-Encoding:
24
- - chunked
25
- Connection:
26
- - keep-alive
27
- Cache-Control:
28
- - max-age=3600
29
- Expires:
30
- - Tue, 20 Feb 2018 20:11:53 GMT
31
- Location:
32
- - https://www.stellar.org/.well-known/stellar.toml
33
- Expect-Ct:
34
- - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
35
- Server:
36
- - cloudflare
37
- Cf-Ray:
38
- - 3f03c6383855215c-EWR
39
- body:
40
- encoding: UTF-8
41
- string: ''
42
- http_version:
43
- recorded_at: Tue, 20 Feb 2018 19:11:53 GMT
44
- recorded_with: VCR 3.0.3