stellar-base 0.22.0 → 0.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +0 -4
- data/generated/stellar-base-generated.rb +10 -1
- data/generated/stellar/allow_trust_op.rb +3 -2
- data/generated/stellar/authenticated_message.rb +4 -4
- data/generated/stellar/authenticated_message/v0.rb +4 -4
- data/generated/stellar/change_trust_result_code.rb +1 -1
- data/generated/stellar/crypto_key_type.rb +8 -4
- data/generated/stellar/curve25519_public.rb +1 -1
- data/generated/stellar/curve25519_secret.rb +1 -1
- data/generated/stellar/envelope_type.rb +9 -5
- data/generated/stellar/fee_bump_transaction.rb +39 -0
- data/generated/stellar/fee_bump_transaction/ext.rb +24 -0
- data/generated/stellar/fee_bump_transaction/inner_tx.rb +25 -0
- data/generated/stellar/fee_bump_transaction_envelope.rb +22 -0
- data/generated/stellar/hmac_sha256_key.rb +1 -1
- data/generated/stellar/hmac_sha256_mac.rb +1 -1
- data/generated/stellar/inner_transaction_result.rb +56 -0
- data/generated/stellar/inner_transaction_result/ext.rb +24 -0
- data/generated/stellar/inner_transaction_result/result.rb +52 -0
- data/generated/stellar/inner_transaction_result_pair.rb +20 -0
- data/generated/stellar/ledger_close_meta.rb +1 -1
- data/generated/stellar/manage_buy_offer_result_code.rb +5 -4
- data/generated/stellar/manage_sell_offer_result_code.rb +12 -8
- data/generated/stellar/muxed_account.rb +35 -0
- data/generated/stellar/muxed_account/med25519.rb +22 -0
- data/generated/stellar/operation.rb +3 -3
- data/generated/stellar/operation/body.rb +2 -2
- data/generated/stellar/operation_result.rb +1 -1
- data/generated/stellar/operation_result/tr.rb +1 -1
- data/generated/stellar/operation_result_code.rb +3 -3
- data/generated/stellar/path_payment_strict_receive_op.rb +4 -4
- data/generated/stellar/path_payment_strict_receive_result_code.rb +21 -12
- data/generated/stellar/path_payment_strict_send_op.rb +6 -6
- data/generated/stellar/path_payment_strict_send_result_code.rb +20 -12
- data/generated/stellar/payment_op.rb +4 -4
- data/generated/stellar/survey_response_body.rb +2 -2
- data/generated/stellar/transaction.rb +2 -2
- data/generated/stellar/transaction_envelope.rb +17 -8
- data/generated/stellar/transaction_result.rb +3 -0
- data/generated/stellar/transaction_result/result.rb +9 -3
- data/generated/stellar/transaction_result_code.rb +21 -14
- data/generated/stellar/transaction_signature_payload.rb +3 -1
- data/generated/stellar/transaction_signature_payload/tagged_transaction.rb +7 -3
- data/generated/stellar/transaction_v0.rb +39 -0
- data/generated/stellar/transaction_v0/ext.rb +24 -0
- data/generated/stellar/transaction_v0_envelope.rb +22 -0
- data/generated/stellar/transaction_v1_envelope.rb +22 -0
- data/generated/stellar/trust_line_flags.rb +6 -2
- data/lib/stellar-base.rb +27 -25
- data/lib/stellar/account_flags.rb +2 -4
- data/lib/stellar/asset.rb +6 -6
- data/lib/stellar/base.rb +1 -1
- data/lib/stellar/{base/compat.rb → compat.rb} +6 -7
- data/lib/stellar/concerns/transaction.rb +49 -0
- data/lib/stellar/convert.rb +2 -2
- data/lib/stellar/factories.rb +1 -3
- data/lib/stellar/fee_bump_transaction.rb +21 -0
- data/lib/stellar/key_pair.rb +9 -6
- data/lib/stellar/networks.rb +5 -7
- data/lib/stellar/operation.rb +421 -416
- data/lib/stellar/path_payment_strict_receive_result.rb +1 -2
- data/lib/stellar/price.rb +2 -4
- data/lib/stellar/signer_key.rb +4 -8
- data/lib/stellar/thresholds.rb +5 -7
- data/lib/stellar/transaction.rb +169 -195
- data/lib/stellar/transaction_builder.rb +59 -25
- data/lib/stellar/transaction_envelope.rb +40 -8
- data/lib/stellar/transaction_v0.rb +51 -0
- data/lib/stellar/util/continued_fraction.rb +19 -19
- data/lib/stellar/util/strkey.rb +39 -14
- data/lib/stellar/{base/version.rb → version.rb} +1 -1
- metadata +35 -204
- data/.gitignore +0 -17
- data/.travis.yml +0 -16
- data/.yardopts +0 -8
- data/CONTRIBUTING.md +0 -48
- data/Gemfile +0 -9
- data/Guardfile +0 -5
- data/Rakefile +0 -4
- data/examples/allow_trust.rb +0 -51
- data/examples/create_account.rb +0 -26
- data/examples/low_level_transaction_post.rb +0 -46
- data/examples/mid_level_transaction_post.rb +0 -33
- data/examples/non_native_payment.rb +0 -60
- data/examples/offer.rb +0 -75
- data/examples/transaction_merge.rb +0 -23
- data/ruby-stellar-base.gemspec +0 -34
- data/spec/lib/stellar/account_flags_spec.rb +0 -19
- data/spec/lib/stellar/asset_spec.rb +0 -45
- data/spec/lib/stellar/convert_spec.rb +0 -61
- data/spec/lib/stellar/key_pair_spec.rb +0 -251
- data/spec/lib/stellar/networks_spec.rb +0 -77
- data/spec/lib/stellar/operation_spec.rb +0 -131
- data/spec/lib/stellar/path_payment_strict_receive_result_spec.rb +0 -95
- data/spec/lib/stellar/price_spec.rb +0 -34
- data/spec/lib/stellar/signer_key_spec.rb +0 -26
- data/spec/lib/stellar/thresholds_spec.rb +0 -62
- data/spec/lib/stellar/transaction_builder_spec.rb +0 -263
- data/spec/lib/stellar/transaction_envelope_spec.rb +0 -93
- data/spec/lib/stellar/transaction_spec.rb +0 -132
- data/spec/lib/stellar/util/strkey_spec.rb +0 -54
- data/spec/spec_helper.rb +0 -16
- data/spec/support/matchers/be_strkey.rb +0 -9
- data/spec/support/matchers/eq_bytes.rb +0 -5
- data/spec/support/matchers/have_length.rb +0 -5
- data/tasks/rspec.rake +0 -6
- data/tasks/travis.rake +0 -1
- data/tasks/xdr.rake +0 -45
- data/xdr/Stellar-SCP.x +0 -86
- data/xdr/Stellar-ledger-entries.x +0 -295
- data/xdr/Stellar-ledger.x +0 -372
- data/xdr/Stellar-overlay.x +0 -229
- data/xdr/Stellar-transaction.x +0 -901
- data/xdr/Stellar-types.x +0 -81
data/.gitignore
DELETED
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
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=
|
data/.yardopts
DELETED
data/CONTRIBUTING.md
DELETED
@@ -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/bloom-solutions/ruby-stellar-base/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
data/Guardfile
DELETED
data/Rakefile
DELETED
data/examples/allow_trust.rb
DELETED
@@ -1,51 +0,0 @@
|
|
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)
|
data/examples/create_account.rb
DELETED
@@ -1,26 +0,0 @@
|
|
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
|
@@ -1,46 +0,0 @@
|
|
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
|
@@ -1,33 +0,0 @@
|
|
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
|
@@ -1,60 +0,0 @@
|
|
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
|
-
})
|
data/examples/offer.rb
DELETED
@@ -1,75 +0,0 @@
|
|
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
|
-
p response.body
|
28
|
-
end
|
29
|
-
|
30
|
-
master = Stellar::KeyPair.master
|
31
|
-
destination = Stellar::KeyPair.master
|
32
|
-
|
33
|
-
submit master, Stellar::Transaction.payment({
|
34
|
-
account: master,
|
35
|
-
destination: destination,
|
36
|
-
sequence: 1,
|
37
|
-
amount: [:native, 2000]
|
38
|
-
})
|
39
|
-
|
40
|
-
# NOTE: after this step, you need to get the sequence number for destination
|
41
|
-
# Which is based off of the ledger sequence number it was funded in.
|
42
|
-
gets # pause to get the account's sequence from the hayashi db
|
43
|
-
|
44
|
-
destination_sequence = FILL_ME_IN
|
45
|
-
# destination_sequence = 17179869185
|
46
|
-
|
47
|
-
submit destination, Stellar::Transaction.change_trust({
|
48
|
-
account: destination,
|
49
|
-
sequence: destination_sequence,
|
50
|
-
line: [:alphanum4, "USD\x00", master],
|
51
|
-
limit: 1000
|
52
|
-
})
|
53
|
-
|
54
|
-
submit destination, Stellar::Transaction.change_trust({
|
55
|
-
account: destination,
|
56
|
-
sequence: destination_sequence + 1,
|
57
|
-
line: [:alphanum4, "EUR\x00", master],
|
58
|
-
limit: 1000
|
59
|
-
})
|
60
|
-
|
61
|
-
submit master, Stellar::Transaction.payment({
|
62
|
-
account: master,
|
63
|
-
destination: destination,
|
64
|
-
sequence: destination_sequence + 2,
|
65
|
-
amount: [:alphanum4, "USD\x00", master, 1000]
|
66
|
-
})
|
67
|
-
|
68
|
-
submit master, Stellar::Transaction.manage_offer({
|
69
|
-
account: destination,
|
70
|
-
sequence: destination_sequence + 3,
|
71
|
-
selling: [:alphanum4, "USD\x00", usd_gateway],
|
72
|
-
buying: [:alphanum4, "EUR\x00", eur_gateway],
|
73
|
-
amount: 100,
|
74
|
-
price: 2.0,
|
75
|
-
})
|
@@ -1,23 +0,0 @@
|
|
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
|
data/ruby-stellar-base.gemspec
DELETED
@@ -1,34 +0,0 @@
|
|
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"
|
20
|
-
spec.add_dependency "base32"
|
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"
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.1"
|
28
|
-
spec.add_development_dependency "guard-rspec"
|
29
|
-
spec.add_development_dependency "simplecov"
|
30
|
-
spec.add_development_dependency "octokit"
|
31
|
-
spec.add_development_dependency "netrc"
|
32
|
-
spec.add_development_dependency "yard"
|
33
|
-
|
34
|
-
end
|