stellar-base 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/create_account.rb +28 -0
- data/examples/low_level_transaction_post.rb +0 -6
- data/generated/stellar-base-generated.rb +13 -3
- data/generated/stellar/account_entry.rb +1 -1
- data/generated/stellar/account_flags.rb +1 -1
- data/generated/stellar/account_merge_result.rb +1 -1
- data/generated/stellar/account_merge_result_code.rb +1 -1
- data/generated/stellar/allow_trust_op.rb +1 -1
- data/generated/stellar/allow_trust_op/currency.rb +1 -1
- data/generated/stellar/allow_trust_result.rb +1 -1
- data/generated/stellar/allow_trust_result_code.rb +1 -1
- data/generated/stellar/bucket_entry.rb +1 -1
- data/generated/stellar/bucket_entry_type.rb +1 -1
- data/generated/stellar/change_trust_op.rb +1 -1
- data/generated/stellar/change_trust_result.rb +1 -1
- data/generated/stellar/change_trust_result_code.rb +1 -1
- data/generated/stellar/claim_offer_atom.rb +1 -1
- data/generated/stellar/create_account_op.rb +20 -0
- data/generated/stellar/create_account_result.rb +25 -0
- data/generated/stellar/create_account_result_code.rb +32 -0
- data/generated/stellar/create_offer_effect.rb +1 -1
- data/generated/stellar/create_offer_op.rb +1 -1
- data/generated/stellar/create_offer_result.rb +1 -1
- data/generated/stellar/create_offer_result_code.rb +1 -1
- data/generated/stellar/create_offer_success_result.rb +1 -1
- data/generated/stellar/create_offer_success_result/offer.rb +1 -1
- data/generated/stellar/currency.rb +1 -1
- data/generated/stellar/currency/alpha_num.rb +1 -1
- data/generated/stellar/currency_type.rb +1 -1
- data/generated/stellar/decorated_signature.rb +1 -1
- data/generated/stellar/dont_have.rb +1 -1
- data/generated/stellar/error.rb +1 -1
- data/generated/stellar/hello.rb +1 -1
- data/generated/stellar/inflation_payout.rb +1 -1
- data/generated/stellar/inflation_result.rb +1 -1
- data/generated/stellar/inflation_result_code.rb +1 -1
- data/generated/stellar/ledger_entry.rb +1 -1
- data/generated/stellar/ledger_entry_type.rb +1 -1
- data/generated/stellar/ledger_header.rb +1 -1
- data/generated/stellar/ledger_header_history_entry.rb +1 -1
- data/generated/stellar/ledger_key.rb +1 -1
- data/generated/stellar/ledger_key/account.rb +1 -1
- data/generated/stellar/ledger_key/offer.rb +1 -1
- data/generated/stellar/ledger_key/trust_line.rb +1 -1
- data/generated/stellar/memo.rb +11 -11
- data/generated/stellar/memo_type.rb +11 -11
- data/generated/stellar/message_type.rb +1 -1
- data/generated/stellar/offer_entry.rb +1 -1
- data/generated/stellar/operation.rb +5 -1
- data/generated/stellar/operation/body.rb +21 -13
- data/generated/stellar/operation_result.rb +5 -1
- data/generated/stellar/operation_result/tr.rb +23 -15
- data/generated/stellar/operation_result_code.rb +1 -1
- data/generated/stellar/operation_type.rb +19 -15
- data/generated/stellar/path_payment_op.rb +32 -0
- data/generated/stellar/path_payment_result.rb +34 -0
- data/generated/stellar/path_payment_result/success.rb +22 -0
- data/generated/stellar/path_payment_result_code.rb +40 -0
- data/generated/stellar/payment_op.rb +1 -9
- data/generated/stellar/payment_result.rb +1 -5
- data/generated/stellar/payment_result_code.rb +3 -11
- data/generated/stellar/peer_address.rb +1 -1
- data/generated/stellar/price.rb +1 -1
- data/generated/stellar/scp_ballot.rb +1 -1
- data/generated/stellar/scp_envelope.rb +1 -1
- data/generated/stellar/scp_quorum_set.rb +1 -1
- data/generated/stellar/scp_statement.rb +1 -1
- data/generated/stellar/scp_statement/pledges.rb +1 -1
- data/generated/stellar/scp_statement/pledges/prepare.rb +1 -1
- data/generated/stellar/scp_statement_type.rb +1 -1
- data/generated/stellar/set_options_op.rb +1 -1
- data/generated/stellar/set_options_result.rb +1 -1
- data/generated/stellar/set_options_result_code.rb +1 -1
- data/generated/stellar/signer.rb +1 -1
- data/generated/stellar/simple_payment_result.rb +1 -1
- data/generated/stellar/stellar_ballot.rb +1 -1
- data/generated/stellar/stellar_ballot_value.rb +1 -1
- data/generated/stellar/stellar_message.rb +1 -1
- data/generated/stellar/time_bounds.rb +20 -0
- data/generated/stellar/transaction.rb +5 -7
- data/generated/stellar/transaction_envelope.rb +1 -1
- data/generated/stellar/transaction_history_entry.rb +1 -1
- data/generated/stellar/transaction_history_result_entry.rb +1 -1
- data/generated/stellar/transaction_meta.rb +1 -1
- data/generated/stellar/transaction_result.rb +1 -1
- data/generated/stellar/transaction_result/result.rb +1 -1
- data/generated/stellar/transaction_result_code.rb +21 -19
- data/generated/stellar/transaction_result_pair.rb +1 -1
- data/generated/stellar/transaction_result_set.rb +1 -1
- data/generated/stellar/transaction_set.rb +1 -1
- data/generated/stellar/trust_line_entry.rb +1 -1
- data/generated/stellar/trust_line_flags.rb +1 -1
- data/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/operation.rb +18 -3
- data/lib/stellar/payment_op.rb +0 -3
- data/lib/stellar/transaction.rb +7 -3
- data/spec/lib/stellar/transaction_spec.rb +1 -3
- data/xdr/Stellar-transaction.x +146 -55
- metadata +11 -3
- data/generated/stellar/payment_success_multi_result.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46e9e6e60114b13a5fde708b6b16b05d35b9aebc
|
4
|
+
data.tar.gz: bd33e089624225c22e273a4d7dd267df587a5458
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22ada832e205789d620e3b51ce90606bdfeca6c4cb8a685e8a052f4dc22031c3365a233586dade3d5db03b94f7261f890d9f1eac86dc5ff133492ff324c85030
|
7
|
+
data.tar.gz: d5000f7798add3bd7fa7ae66f29472321ac37c2b60a37689f581252ffbae314d2e7a14d6e37778c9ba3fd984752c083dfaeacacf409623d3fcd24f5efa6a519f
|
@@ -0,0 +1,28 @@
|
|
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.from_raw_seed("allmylifemyhearthasbeensearching")
|
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_0000000
|
21
|
+
})
|
22
|
+
|
23
|
+
hex = tx.to_envelope(master).to_xdr(:hex)
|
24
|
+
|
25
|
+
result = $server.get('tx', blob: hex)
|
26
|
+
p result.body
|
27
|
+
raw = [result.body["result"]].pack("H*")
|
28
|
+
p Stellar::TransactionResult.from_xdr(raw)
|
@@ -18,17 +18,11 @@ tx = Stellar::Transaction.new
|
|
18
18
|
tx.account = master.verify_key.to_bytes
|
19
19
|
tx.fee = 1000
|
20
20
|
tx.seq_num = 1
|
21
|
-
tx.max_ledger = 1000
|
22
|
-
tx.min_ledger = 0
|
23
21
|
|
24
22
|
payment = Stellar::PaymentOp.new
|
25
23
|
payment.destination = destination.verify_key.to_bytes
|
26
24
|
payment.currency = Stellar::Currency.new(:native)
|
27
|
-
payment.path = []
|
28
25
|
payment.amount = 200_000000
|
29
|
-
payment.send_max = 200_000000
|
30
|
-
payment.source_memo = ""
|
31
|
-
payment.memo = ""
|
32
26
|
|
33
27
|
op = Stellar::Operation.new
|
34
28
|
op.body = Stellar::Operation::Body.new(:payment, payment)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-05-
|
1
|
+
# Automatically generated on 2015-05-13T15:00:04-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -81,7 +81,9 @@ module Stellar
|
|
81
81
|
|
82
82
|
autoload :OperationType
|
83
83
|
|
84
|
+
autoload :CreateAccountOp
|
84
85
|
autoload :PaymentOp
|
86
|
+
autoload :PathPaymentOp
|
85
87
|
autoload :CreateOfferOp
|
86
88
|
autoload :SetOptionsOp
|
87
89
|
autoload :ChangeTrustOp
|
@@ -92,16 +94,24 @@ module Stellar
|
|
92
94
|
|
93
95
|
autoload :Memo
|
94
96
|
|
97
|
+
autoload :TimeBounds
|
95
98
|
autoload :Transaction
|
96
99
|
autoload :TransactionEnvelope
|
97
100
|
autoload :ClaimOfferAtom
|
98
101
|
|
102
|
+
autoload :CreateAccountResultCode
|
103
|
+
|
104
|
+
autoload :CreateAccountResult
|
105
|
+
|
99
106
|
autoload :PaymentResultCode
|
100
107
|
|
108
|
+
autoload :PaymentResult
|
109
|
+
|
110
|
+
autoload :PathPaymentResultCode
|
111
|
+
|
101
112
|
autoload :SimplePaymentResult
|
102
|
-
autoload :PaymentSuccessMultiResult
|
103
113
|
|
104
|
-
autoload :
|
114
|
+
autoload :PathPaymentResult
|
105
115
|
|
106
116
|
autoload :CreateOfferResultCode
|
107
117
|
autoload :CreateOfferEffect
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Automatically generated on 2015-05-13T15:00:04-07:00
|
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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Automatically generated on 2015-05-13T15:00:04-07:00
|
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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Automatically generated on 2015-05-13T15:00:04-07:00
|
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
|
data/generated/stellar/error.rb
CHANGED
data/generated/stellar/hello.rb
CHANGED