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
@@ -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'
|
@@ -9,8 +9,6 @@ require 'xdr'
|
|
9
9
|
# {
|
10
10
|
# case PAYMENT_SUCCESS:
|
11
11
|
# void;
|
12
|
-
# case PAYMENT_SUCCESS_MULTI:
|
13
|
-
# PaymentSuccessMultiResult multi;
|
14
12
|
# default:
|
15
13
|
# void;
|
16
14
|
# };
|
@@ -21,9 +19,7 @@ module Stellar
|
|
21
19
|
switch_on PaymentResultCode, :code
|
22
20
|
|
23
21
|
switch :payment_success
|
24
|
-
switch :payment_success_multi, :multi
|
25
22
|
switch :default
|
26
23
|
|
27
|
-
attribute :multi, PaymentSuccessMultiResult
|
28
24
|
end
|
29
25
|
end
|
@@ -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'
|
@@ -8,8 +8,7 @@ require 'xdr'
|
|
8
8
|
# enum PaymentResultCode
|
9
9
|
# {
|
10
10
|
# // codes considered as "success" for the operation
|
11
|
-
# PAYMENT_SUCCESS = 0,
|
12
|
-
# PAYMENT_SUCCESS_MULTI = 1, // multi-path payment success
|
11
|
+
# PAYMENT_SUCCESS = 0, // payment successfuly completed
|
13
12
|
#
|
14
13
|
# // codes considered as "failure" for the operation
|
15
14
|
# PAYMENT_MALFORMED = -1, // bad input
|
@@ -17,26 +16,19 @@ require 'xdr'
|
|
17
16
|
# PAYMENT_NO_DESTINATION = -3, // destination account does not exist
|
18
17
|
# PAYMENT_NO_TRUST = -4, // destination missing a trust line for currency
|
19
18
|
# PAYMENT_NOT_AUTHORIZED = -5, // destination not authorized to hold currency
|
20
|
-
# PAYMENT_LINE_FULL = -6
|
21
|
-
# PAYMENT_TOO_FEW_OFFERS = -7, // not enough offers to satisfy path payment
|
22
|
-
# PAYMENT_OVER_SENDMAX = -8, // multi-path payment could not satisfy sendmax
|
23
|
-
# PAYMENT_LOW_RESERVE = -9 // would create an account below the min reserve
|
19
|
+
# PAYMENT_LINE_FULL = -6 // destination would go above their limit
|
24
20
|
# };
|
25
21
|
#
|
26
22
|
# ===========================================================================
|
27
23
|
module Stellar
|
28
24
|
class PaymentResultCode < XDR::Enum
|
29
25
|
member :payment_success, 0
|
30
|
-
member :payment_success_multi, 1
|
31
26
|
member :payment_malformed, -1
|
32
27
|
member :payment_underfunded, -2
|
33
28
|
member :payment_no_destination, -3
|
34
29
|
member :payment_no_trust, -4
|
35
30
|
member :payment_not_authorized, -5
|
36
31
|
member :payment_line_full, -6
|
37
|
-
member :payment_too_few_offers, -7
|
38
|
-
member :payment_over_sendmax, -8
|
39
|
-
member :payment_low_reserve, -9
|
40
32
|
|
41
33
|
seal
|
42
34
|
end
|
data/generated/stellar/price.rb
CHANGED
data/generated/stellar/signer.rb
CHANGED
@@ -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 TimeBounds
|
9
|
+
# {
|
10
|
+
# uint64 minTime;
|
11
|
+
# uint64 maxTime;
|
12
|
+
# };
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class TimeBounds < XDR::Struct
|
17
|
+
attribute :min_time, Uint64
|
18
|
+
attribute :max_time, Uint64
|
19
|
+
end
|
20
|
+
end
|
@@ -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'
|
@@ -10,15 +10,14 @@ require 'xdr'
|
|
10
10
|
# // account used to run the transaction
|
11
11
|
# AccountID sourceAccount;
|
12
12
|
#
|
13
|
-
# // the fee the sourceAccount will pay
|
13
|
+
# // the fee the sourceAccount will pay
|
14
14
|
# int32 fee;
|
15
15
|
#
|
16
16
|
# // sequence number to consume in the account
|
17
17
|
# SequenceNumber seqNum;
|
18
18
|
#
|
19
|
-
# // validity range (inclusive) for the ledger
|
20
|
-
#
|
21
|
-
# uint32 maxLedger;
|
19
|
+
# // validity range (inclusive) for the last ledger close time
|
20
|
+
# TimeBounds* timeBounds;
|
22
21
|
#
|
23
22
|
# Memo memo;
|
24
23
|
#
|
@@ -31,8 +30,7 @@ module Stellar
|
|
31
30
|
attribute :source_account, AccountID
|
32
31
|
attribute :fee, Int32
|
33
32
|
attribute :seq_num, SequenceNumber
|
34
|
-
attribute :
|
35
|
-
attribute :max_ledger, Uint32
|
33
|
+
attribute :time_bounds, XDR::Option[TimeBounds]
|
36
34
|
attribute :memo, Memo
|
37
35
|
attribute :operations, XDR::VarArray[Operation, 100]
|
38
36
|
end
|
@@ -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'
|
@@ -13,16 +13,17 @@ require 'xdr'
|
|
13
13
|
#
|
14
14
|
# txFAILED = -2, // one of the operations failed (but none were applied)
|
15
15
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
16
|
+
# txTOO_EARLY = -3, // ledger closeTime before minTime
|
17
|
+
# txTOO_LATE = -4, // ledger closeTime after maxTime
|
18
|
+
# txMISSING_OPERATION = -5, // no operation was specified
|
19
|
+
# txBAD_SEQ = -6, // sequence number does not match source account
|
19
20
|
#
|
20
|
-
# txBAD_AUTH = -
|
21
|
-
# txINSUFFICIENT_BALANCE = -
|
22
|
-
# txNO_ACCOUNT = -
|
23
|
-
# txINSUFFICIENT_FEE = -
|
24
|
-
# txBAD_AUTH_EXTRA = -
|
25
|
-
# txINTERNAL_ERROR = -
|
21
|
+
# txBAD_AUTH = -7, // not enough signatures to perform transaction
|
22
|
+
# txINSUFFICIENT_BALANCE = -8, // fee would bring account below reserve
|
23
|
+
# txNO_ACCOUNT = -9, // source account not found
|
24
|
+
# txINSUFFICIENT_FEE = -10, // fee is too small
|
25
|
+
# txBAD_AUTH_EXTRA = -11, // too many signatures on transaction
|
26
|
+
# txINTERNAL_ERROR = -12 // an unknown error occured
|
26
27
|
# };
|
27
28
|
#
|
28
29
|
# ===========================================================================
|
@@ -31,15 +32,16 @@ module Stellar
|
|
31
32
|
member :tx_success, 0
|
32
33
|
member :tx_duplicate, -1
|
33
34
|
member :tx_failed, -2
|
34
|
-
member :
|
35
|
-
member :
|
36
|
-
member :
|
37
|
-
member :
|
38
|
-
member :
|
39
|
-
member :
|
40
|
-
member :
|
41
|
-
member :
|
42
|
-
member :
|
35
|
+
member :tx_too_early, -3
|
36
|
+
member :tx_too_late, -4
|
37
|
+
member :tx_missing_operation, -5
|
38
|
+
member :tx_bad_seq, -6
|
39
|
+
member :tx_bad_auth, -7
|
40
|
+
member :tx_insufficient_balance, -8
|
41
|
+
member :tx_no_account, -9
|
42
|
+
member :tx_insufficient_fee, -10
|
43
|
+
member :tx_bad_auth_extra, -11
|
44
|
+
member :tx_internal_error, -12
|
43
45
|
|
44
46
|
seal
|
45
47
|
end
|
data/lib/stellar/base/version.rb
CHANGED
data/lib/stellar/operation.rb
CHANGED
@@ -43,14 +43,13 @@ module Stellar
|
|
43
43
|
def self.payment(attributes={})
|
44
44
|
destination = attributes[:destination]
|
45
45
|
amount = attributes[:amount]
|
46
|
-
path = attributes[:path] || []
|
47
|
-
path = path.map{|p| Stellar::Currency.send(*p)}
|
46
|
+
# path = attributes[:path] || []
|
47
|
+
# path = path.map{|p| Stellar::Currency.send(*p)}
|
48
48
|
|
49
49
|
raise ArgumentError unless destination.is_a?(KeyPair)
|
50
50
|
|
51
51
|
op = PaymentOp.send(*amount)
|
52
52
|
op.destination = destination.public_key
|
53
|
-
op.path = path
|
54
53
|
op.apply_defaults
|
55
54
|
|
56
55
|
return make(attributes.merge({
|
@@ -58,6 +57,22 @@ module Stellar
|
|
58
57
|
}))
|
59
58
|
end
|
60
59
|
|
60
|
+
|
61
|
+
def self.create_account(attributes={})
|
62
|
+
destination = attributes[:destination]
|
63
|
+
starting_balance = attributes[:starting_balance]
|
64
|
+
|
65
|
+
raise ArgumentError unless destination.is_a?(KeyPair)
|
66
|
+
|
67
|
+
op = CreateAccountOp.new()
|
68
|
+
op.destination = destination.public_key
|
69
|
+
op.starting_balance = starting_balance
|
70
|
+
|
71
|
+
return make(attributes.merge({
|
72
|
+
body:[:create_account, op]
|
73
|
+
}))
|
74
|
+
end
|
75
|
+
|
61
76
|
#
|
62
77
|
# Helper method to create a valid ChangeTrustOp, wrapped
|
63
78
|
# in the necessary XDR structs to be included within a
|
data/lib/stellar/payment_op.rb
CHANGED
@@ -5,7 +5,6 @@ module Stellar
|
|
5
5
|
currency = Stellar::Currency.native
|
6
6
|
with_currency(currency).tap do |result|
|
7
7
|
result.amount = amount
|
8
|
-
result.send_max = amount
|
9
8
|
end
|
10
9
|
end
|
11
10
|
|
@@ -13,14 +12,12 @@ module Stellar
|
|
13
12
|
currency = Stellar::Currency.iso4217(code, issuer)
|
14
13
|
with_currency(currency).tap do |result|
|
15
14
|
result.amount = amount
|
16
|
-
result.send_max = amount
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
18
|
def self.with_currency(currency)
|
21
19
|
new.tap do |result|
|
22
20
|
result.currency = currency
|
23
|
-
result.path = []
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|