stellar-base 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/transaction_merge.rb +23 -0
- data/generated/stellar-base-generated.rb +7 -1
- data/generated/stellar/account_entry.rb +4 -1
- data/generated/stellar/account_flags.rb +5 -3
- 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 +4 -2
- 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_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_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/iso_currency_issuer.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 +38 -0
- data/generated/stellar/memo_type.rb +28 -0
- data/generated/stellar/message_type.rb +1 -1
- data/generated/stellar/offer_entry.rb +1 -1
- data/generated/stellar/operation.rb +2 -2
- data/generated/stellar/operation/body.rb +3 -4
- data/generated/stellar/operation_result.rb +1 -1
- data/generated/stellar/operation_result/tr.rb +1 -1
- data/generated/stellar/operation_result_code.rb +1 -1
- data/generated/stellar/operation_type.rb +1 -1
- data/generated/stellar/payment_op.rb +1 -1
- data/generated/stellar/payment_result.rb +1 -1
- data/generated/stellar/payment_result_code.rb +1 -1
- data/generated/stellar/payment_success_multi_result.rb +1 -1
- 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 +4 -1
- data/generated/stellar/set_options_result.rb +1 -1
- data/generated/stellar/set_options_result_code.rb +4 -2
- 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/transaction.rb +4 -1
- 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 +1 -1
- 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/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/currency.rb +5 -1
- data/lib/stellar/operation.rb +3 -1
- data/lib/stellar/price.rb +11 -0
- data/lib/stellar/transaction.rb +24 -2
- data/lib/stellar/transaction_envelope.rb +1 -1
- data/xdr/Stellar-ledger-entries.x +4 -1
- data/xdr/Stellar-transaction.x +32 -3
- data/xdr/Stellar-types.x +1 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff65f9f8fcef2a4977a4847eba678cc79d374d7
|
4
|
+
data.tar.gz: 25efb272ccdc9e83515affccac55d664e33a8d14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ac437395b58e410313634a9789597aac1eaf7167a793365f3ceafedc9faf5bca278d7c6678495f2e66ffd4cb5023895e7872025e23f27d77e5678b99043f39
|
7
|
+
data.tar.gz: ca03a0ddceca57d5f4d6bffcb13fd245b9cdee84868e35afe7b04b944f3091bd57fff3087ea08071e620eb7c905afa3d8a59e0a69e05747cc65d9dc7cf870736
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'stellar-base'
|
4
|
+
|
5
|
+
master = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
|
6
|
+
destination = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
|
7
|
+
|
8
|
+
tx1 = Stellar::Transaction.payment({
|
9
|
+
account: master,
|
10
|
+
destination: destination,
|
11
|
+
sequence: 1,
|
12
|
+
amount: [:native, 20_000000]
|
13
|
+
})
|
14
|
+
|
15
|
+
tx2 = Stellar::Transaction.payment({
|
16
|
+
account: master,
|
17
|
+
destination: destination,
|
18
|
+
sequence: 2,
|
19
|
+
amount: [:native, 20_000000]
|
20
|
+
})
|
21
|
+
|
22
|
+
hex = tx1.merge(tx2).to_envelope(master).to_xdr(:hex)
|
23
|
+
puts hex
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -84,6 +84,11 @@ module Stellar
|
|
84
84
|
autoload :ChangeTrustOp
|
85
85
|
autoload :AllowTrustOp
|
86
86
|
autoload :Operation
|
87
|
+
|
88
|
+
autoload :MemoType
|
89
|
+
|
90
|
+
autoload :Memo
|
91
|
+
|
87
92
|
autoload :Transaction
|
88
93
|
autoload :TransactionEnvelope
|
89
94
|
autoload :ClaimOfferAtom
|
@@ -145,6 +150,7 @@ module Stellar
|
|
145
150
|
Signature = XDR::Opaque[64]
|
146
151
|
Hash = XDR::Opaque[32]
|
147
152
|
Thresholds = XDR::Opaque[4]
|
153
|
+
String32 = XDR::String[32]
|
148
154
|
SequenceNumber = Uint64
|
149
155
|
|
150
156
|
autoload :CurrencyType
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -19,6 +19,8 @@ require 'xdr'
|
|
19
19
|
# // thresholds stores unsigned bytes: [weight of master|low|medium|high]
|
20
20
|
# Thresholds thresholds;
|
21
21
|
#
|
22
|
+
# string32 homeDomain; // can be used for reverse federation and memo lookup
|
23
|
+
#
|
22
24
|
# Signer signers<20>; // possible signers for this account
|
23
25
|
# };
|
24
26
|
#
|
@@ -32,6 +34,7 @@ module Stellar
|
|
32
34
|
attribute :inflation_dest, XDR::Option[AccountID]
|
33
35
|
attribute :flags, Uint32
|
34
36
|
attribute :thresholds, Thresholds
|
37
|
+
attribute :home_domain, String32
|
35
38
|
attribute :signers, XDR::VarArray[Signer, 20]
|
36
39
|
end
|
37
40
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -7,13 +7,15 @@ require 'xdr'
|
|
7
7
|
#
|
8
8
|
# enum AccountFlags
|
9
9
|
# { // masks for each flag
|
10
|
-
# AUTH_REQUIRED_FLAG = 0x1
|
10
|
+
# AUTH_REQUIRED_FLAG = 0x1,
|
11
|
+
# AUTH_REVOCABLE_FLAG = 0x2
|
11
12
|
# };
|
12
13
|
#
|
13
14
|
# ===========================================================================
|
14
15
|
module Stellar
|
15
16
|
class AccountFlags < XDR::Enum
|
16
|
-
member :auth_required_flag,
|
17
|
+
member :auth_required_flag, 1
|
18
|
+
member :auth_revocable_flag, 2
|
17
19
|
|
18
20
|
seal
|
19
21
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -12,7 +12,8 @@ require 'xdr'
|
|
12
12
|
# // codes considered as "failure" for the operation
|
13
13
|
# ALLOW_TRUST_MALFORMED = -1, // currency is not ISO4217
|
14
14
|
# ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
|
15
|
-
# ALLOW_TRUST_TRUST_NOT_REQUIRED = -3 // source account does not require trust
|
15
|
+
# ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, // source account does not require trust
|
16
|
+
# ALLOW_TRUST_CANT_REVOKE = -4 // source account can't revoke trust
|
16
17
|
# };
|
17
18
|
#
|
18
19
|
# ===========================================================================
|
@@ -22,6 +23,7 @@ module Stellar
|
|
22
23
|
member :allow_trust_malformed, -1
|
23
24
|
member :allow_trust_no_trust_line, -2
|
24
25
|
member :allow_trust_trust_not_required, -3
|
26
|
+
member :allow_trust_cant_revoke, -4
|
25
27
|
|
26
28
|
seal
|
27
29
|
end
|
data/generated/stellar/error.rb
CHANGED
data/generated/stellar/hello.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
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_TYPE_NONE:
|
11
|
+
# void;
|
12
|
+
# case MEMO_TYPE_TEXT:
|
13
|
+
# string text<28>;
|
14
|
+
# case MEMO_TYPE_ID:
|
15
|
+
# uint64 id;
|
16
|
+
# case MEMO_TYPE_HASH:
|
17
|
+
# Hash hash; // the hash of what to pull from the content server
|
18
|
+
# case MEMO_TYPE_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_type_none
|
28
|
+
switch :memo_type_text, :text
|
29
|
+
switch :memo_type_id, :id
|
30
|
+
switch :memo_type_hash, :hash
|
31
|
+
switch :memo_type_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
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
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_TYPE_NONE = 0,
|
11
|
+
# MEMO_TYPE_TEXT = 1,
|
12
|
+
# MEMO_TYPE_ID = 2,
|
13
|
+
# MEMO_TYPE_HASH = 3,
|
14
|
+
# MEMO_TYPE_RETURN =4
|
15
|
+
# };
|
16
|
+
#
|
17
|
+
# ===========================================================================
|
18
|
+
module Stellar
|
19
|
+
class MemoType < XDR::Enum
|
20
|
+
member :memo_type_none, 0
|
21
|
+
member :memo_type_text, 1
|
22
|
+
member :memo_type_id, 2
|
23
|
+
member :memo_type_hash, 3
|
24
|
+
member :memo_type_return, 4
|
25
|
+
|
26
|
+
seal
|
27
|
+
end
|
28
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -27,7 +27,7 @@ require 'xdr'
|
|
27
27
|
# case ACCOUNT_MERGE:
|
28
28
|
# uint256 destination;
|
29
29
|
# case INFLATION:
|
30
|
-
#
|
30
|
+
# void;
|
31
31
|
# }
|
32
32
|
# body;
|
33
33
|
# };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -20,7 +20,7 @@ require 'xdr'
|
|
20
20
|
# case ACCOUNT_MERGE:
|
21
21
|
# uint256 destination;
|
22
22
|
# case INFLATION:
|
23
|
-
#
|
23
|
+
# void;
|
24
24
|
# }
|
25
25
|
#
|
26
26
|
# ===========================================================================
|
@@ -35,7 +35,7 @@ module Stellar
|
|
35
35
|
switch :change_trust, :change_trust_op
|
36
36
|
switch :allow_trust, :allow_trust_op
|
37
37
|
switch :account_merge, :destination
|
38
|
-
switch :inflation
|
38
|
+
switch :inflation
|
39
39
|
|
40
40
|
attribute :payment_op, PaymentOp
|
41
41
|
attribute :create_offer_op, CreateOfferOp
|
@@ -43,7 +43,6 @@ module Stellar
|
|
43
43
|
attribute :change_trust_op, ChangeTrustOp
|
44
44
|
attribute :allow_trust_op, AllowTrustOp
|
45
45
|
attribute :destination, Uint256
|
46
|
-
attribute :inflation_seq, Uint32
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
data/generated/stellar/price.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -14,6 +14,8 @@ require 'xdr'
|
|
14
14
|
#
|
15
15
|
# Thresholds* thresholds; // update the thresholds for the account
|
16
16
|
#
|
17
|
+
# string32* homeDomain; // sets the home domain
|
18
|
+
#
|
17
19
|
# // Add, update or remove a signer for the account
|
18
20
|
# // signer is deleted if the weight is 0
|
19
21
|
# Signer* signer;
|
@@ -26,6 +28,7 @@ module Stellar
|
|
26
28
|
attribute :clear_flags, XDR::Option[Uint32]
|
27
29
|
attribute :set_flags, XDR::Option[Uint32]
|
28
30
|
attribute :thresholds, XDR::Option[Thresholds]
|
31
|
+
attribute :home_domain, XDR::Option[String32]
|
29
32
|
attribute :signer, XDR::Option[Signer]
|
30
33
|
end
|
31
34
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -13,7 +13,8 @@ require 'xdr'
|
|
13
13
|
# SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer
|
14
14
|
# SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
|
15
15
|
# SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags
|
16
|
-
# SET_OPTIONS_INVALID_INFLATION = -4
|
16
|
+
# SET_OPTIONS_INVALID_INFLATION = -4,// inflation account does not exist
|
17
|
+
# SET_OPTIONS_CANT_CHANGE = -5 // can no longer change this option
|
17
18
|
# };
|
18
19
|
#
|
19
20
|
# ===========================================================================
|
@@ -24,6 +25,7 @@ module Stellar
|
|
24
25
|
member :set_options_too_many_signers, -2
|
25
26
|
member :set_options_bad_flags, -3
|
26
27
|
member :set_options_invalid_inflation, -4
|
28
|
+
member :set_options_cant_change, -5
|
27
29
|
|
28
30
|
seal
|
29
31
|
end
|
data/generated/stellar/signer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Automatically generated on 2015-
|
1
|
+
# Automatically generated on 2015-05-07T07:56:23-07:00
|
2
2
|
# DO NOT EDIT or your changes may be overwritten
|
3
3
|
|
4
4
|
require 'xdr'
|
@@ -21,6 +21,8 @@ require 'xdr'
|
|
21
21
|
# uint32 minLedger;
|
22
22
|
# uint32 maxLedger;
|
23
23
|
#
|
24
|
+
# Memo memo;
|
25
|
+
#
|
24
26
|
# Operation operations<100>;
|
25
27
|
# };
|
26
28
|
#
|
@@ -32,6 +34,7 @@ module Stellar
|
|
32
34
|
attribute :seq_num, SequenceNumber
|
33
35
|
attribute :min_ledger, Uint32
|
34
36
|
attribute :max_ledger, Uint32
|
37
|
+
attribute :memo, Memo
|
35
38
|
attribute :operations, XDR::VarArray[Operation, 100]
|
36
39
|
end
|
37
40
|
end
|
data/lib/stellar/base/version.rb
CHANGED
data/lib/stellar/currency.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Stellar
|
2
|
-
Currency
|
2
|
+
class Currency
|
3
3
|
def self.native
|
4
4
|
new(:native)
|
5
5
|
end
|
@@ -24,5 +24,9 @@ module Stellar
|
|
24
24
|
label = switch.to_s
|
25
25
|
"#<Stellar::Currency #{to_s}>"
|
26
26
|
end
|
27
|
+
|
28
|
+
def code
|
29
|
+
self.iso_ci!.currency_code
|
30
|
+
end
|
27
31
|
end
|
28
32
|
end
|
data/lib/stellar/operation.rb
CHANGED
@@ -158,9 +158,11 @@ module Stellar
|
|
158
158
|
raise ArgumentError, "Bad :authorize" unless authorize == !!authorize # check boolean
|
159
159
|
raise ArgumentError, "Bad :currency" unless currency.type == Stellar::CurrencyType.iso4217
|
160
160
|
|
161
|
+
atc = AllowTrustOp::Currency.new(:iso4217, currency.code)
|
162
|
+
|
161
163
|
op.trustor = trustor.public_key
|
162
164
|
op.authorize = authorize
|
163
|
-
op.currency =
|
165
|
+
op.currency = atc
|
164
166
|
|
165
167
|
return make(attributes.merge({
|
166
168
|
body:[:allow_trust, op]
|
data/lib/stellar/price.rb
CHANGED
data/lib/stellar/transaction.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Stellar
|
2
|
-
Transaction
|
2
|
+
class Transaction
|
3
3
|
|
4
4
|
#
|
5
5
|
# @see Stellar::Operation.payment
|
@@ -57,7 +57,7 @@ module Stellar
|
|
57
57
|
# @return [Stellar::Transaction] the resulting transaction
|
58
58
|
def self.make(operation_type, attributes={})
|
59
59
|
for_account(attributes).tap do |result|
|
60
|
-
result.operations
|
60
|
+
result.operations << Operation.send(operation_type, attributes)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -109,7 +109,29 @@ module Stellar
|
|
109
109
|
})
|
110
110
|
end
|
111
111
|
|
112
|
+
def merge(other)
|
113
|
+
cloned = Marshal.load Marshal.dump(self)
|
114
|
+
cloned.operations += other.to_operations
|
115
|
+
cloned
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
#
|
120
|
+
# Extracts the operations from this single transaction,
|
121
|
+
# setting the source account on the extracted operations.
|
122
|
+
#
|
123
|
+
# Useful for merging transactions.
|
124
|
+
#
|
125
|
+
# @return [Array<Operation>] the operations
|
126
|
+
def to_operations
|
127
|
+
cloned = Marshal.load Marshal.dump(operations)
|
128
|
+
operations.each do |op|
|
129
|
+
op.source_account = self.source_account
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
112
133
|
def apply_defaults
|
134
|
+
self.operations ||= []
|
113
135
|
self.max_fee ||= 10
|
114
136
|
self.min_ledger ||= 0
|
115
137
|
self.max_ledger ||= 2**32 - 1
|
@@ -22,7 +22,8 @@ struct Signer
|
|
22
22
|
|
23
23
|
enum AccountFlags
|
24
24
|
{ // masks for each flag
|
25
|
-
AUTH_REQUIRED_FLAG = 0x1
|
25
|
+
AUTH_REQUIRED_FLAG = 0x1,
|
26
|
+
AUTH_REVOCABLE_FLAG = 0x2
|
26
27
|
};
|
27
28
|
|
28
29
|
/* AccountEntry
|
@@ -48,6 +49,8 @@ struct AccountEntry
|
|
48
49
|
// thresholds stores unsigned bytes: [weight of master|low|medium|high]
|
49
50
|
Thresholds thresholds;
|
50
51
|
|
52
|
+
string32 homeDomain; // can be used for reverse federation and memo lookup
|
53
|
+
|
51
54
|
Signer signers<20>; // possible signers for this account
|
52
55
|
};
|
53
56
|
|
data/xdr/Stellar-transaction.x
CHANGED
@@ -86,6 +86,8 @@ struct SetOptionsOp
|
|
86
86
|
|
87
87
|
Thresholds* thresholds; // update the thresholds for the account
|
88
88
|
|
89
|
+
string32* homeDomain; // sets the home domain
|
90
|
+
|
89
91
|
// Add, update or remove a signer for the account
|
90
92
|
// signer is deleted if the weight is 0
|
91
93
|
Signer* signer;
|
@@ -169,11 +171,34 @@ struct Operation
|
|
169
171
|
case ACCOUNT_MERGE:
|
170
172
|
uint256 destination;
|
171
173
|
case INFLATION:
|
172
|
-
|
174
|
+
void;
|
173
175
|
}
|
174
176
|
body;
|
175
177
|
};
|
176
178
|
|
179
|
+
enum MemoType
|
180
|
+
{
|
181
|
+
MEMO_TYPE_NONE = 0,
|
182
|
+
MEMO_TYPE_TEXT = 1,
|
183
|
+
MEMO_TYPE_ID = 2,
|
184
|
+
MEMO_TYPE_HASH = 3,
|
185
|
+
MEMO_TYPE_RETURN =4
|
186
|
+
};
|
187
|
+
|
188
|
+
union Memo switch (MemoType type)
|
189
|
+
{
|
190
|
+
case MEMO_TYPE_NONE:
|
191
|
+
void;
|
192
|
+
case MEMO_TYPE_TEXT:
|
193
|
+
string text<28>;
|
194
|
+
case MEMO_TYPE_ID:
|
195
|
+
uint64 id;
|
196
|
+
case MEMO_TYPE_HASH:
|
197
|
+
Hash hash; // the hash of what to pull from the content server
|
198
|
+
case MEMO_TYPE_RETURN:
|
199
|
+
Hash retHash; // the hash of the tx you are rejecting
|
200
|
+
};
|
201
|
+
|
177
202
|
/* a transaction is a container for a set of operations
|
178
203
|
- is executed by an account
|
179
204
|
- fees are collected from the account
|
@@ -198,6 +223,8 @@ struct Transaction
|
|
198
223
|
uint32 minLedger;
|
199
224
|
uint32 maxLedger;
|
200
225
|
|
226
|
+
Memo memo;
|
227
|
+
|
201
228
|
Operation operations<100>;
|
202
229
|
};
|
203
230
|
|
@@ -330,7 +357,8 @@ enum SetOptionsResultCode
|
|
330
357
|
SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer
|
331
358
|
SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
|
332
359
|
SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags
|
333
|
-
SET_OPTIONS_INVALID_INFLATION = -4
|
360
|
+
SET_OPTIONS_INVALID_INFLATION = -4,// inflation account does not exist
|
361
|
+
SET_OPTIONS_CANT_CHANGE = -5 // can no longer change this option
|
334
362
|
};
|
335
363
|
|
336
364
|
union SetOptionsResult switch (SetOptionsResultCode code)
|
@@ -371,7 +399,8 @@ enum AllowTrustResultCode
|
|
371
399
|
// codes considered as "failure" for the operation
|
372
400
|
ALLOW_TRUST_MALFORMED = -1, // currency is not ISO4217
|
373
401
|
ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
|
374
|
-
ALLOW_TRUST_TRUST_NOT_REQUIRED = -3 // source account does not require trust
|
402
|
+
ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, // source account does not require trust
|
403
|
+
ALLOW_TRUST_CANT_REVOKE = -4 // source account can't revoke trust
|
375
404
|
};
|
376
405
|
|
377
406
|
union AllowTrustResult switch (AllowTrustResultCode code)
|
data/xdr/Stellar-types.x
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellar-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdr
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- examples/mid_level_transaction_post.rb
|
199
199
|
- examples/non_native_payment.rb
|
200
200
|
- examples/offer.rb
|
201
|
+
- examples/transaction_merge.rb
|
201
202
|
- generated/stellar-base-generated.rb
|
202
203
|
- generated/stellar/account_entry.rb
|
203
204
|
- generated/stellar/account_flags.rb
|
@@ -237,6 +238,8 @@ files:
|
|
237
238
|
- generated/stellar/ledger_key/account.rb
|
238
239
|
- generated/stellar/ledger_key/offer.rb
|
239
240
|
- generated/stellar/ledger_key/trust_line.rb
|
241
|
+
- generated/stellar/memo.rb
|
242
|
+
- generated/stellar/memo_type.rb
|
240
243
|
- generated/stellar/message_type.rb
|
241
244
|
- generated/stellar/offer_entry.rb
|
242
245
|
- generated/stellar/operation.rb
|