stellar-base 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/generated/stellar-base-generated.rb +6 -0
- data/generated/stellar/data_entry.rb +35 -0
- data/generated/stellar/data_entry/ext.rb +24 -0
- data/generated/stellar/ledger_entry.rb +2 -0
- data/generated/stellar/ledger_entry/data.rb +4 -0
- data/generated/stellar/ledger_entry_type.rb +3 -1
- data/generated/stellar/ledger_key.rb +10 -0
- data/generated/stellar/ledger_key/data.rb +22 -0
- data/generated/stellar/manage_data_op.rb +20 -0
- data/generated/stellar/manage_data_result.rb +25 -0
- data/generated/stellar/manage_data_result_code.rb +30 -0
- data/generated/stellar/operation.rb +2 -0
- data/generated/stellar/operation/body.rb +4 -0
- data/generated/stellar/operation_result.rb +2 -0
- data/generated/stellar/operation_result/tr.rb +4 -0
- data/generated/stellar/operation_type.rb +3 -1
- data/lib/stellar-base.rb +1 -0
- data/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/operation.rb +29 -1
- data/lib/stellar/transaction.rb +8 -2
- data/spec/lib/stellar/operation_spec.rb +19 -2
- data/spec/lib/stellar/transaction_spec.rb +25 -8
- data/xdr/Stellar-ledger-entries.x +25 -1
- data/xdr/Stellar-ledger.x +7 -0
- data/xdr/Stellar-transaction.x +42 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efd6646cf6f9777ca99a367c19d7c2fe5703b17a
|
4
|
+
data.tar.gz: 1d2615550df2380a7bca084d496eb8766d9517e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56bc04654fbff876daa63882fe92b58a50a45cc24221e7fb18eb95ca3cc7d07052b1b1dc3bd61d97d3a391edb482bb225055ce3cd2dddff248d0b0a274462850
|
7
|
+
data.tar.gz: a05f4a1019e6c137ce60af272e5a9b8a1bf19bd42dda65c87ea35c4973637aee8605b3721bc24489d4a304c92a66450885e26747837a678267beb58b7839b1fa
|
data/CHANGELOG.md
CHANGED
@@ -6,8 +6,17 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
As this project is pre 1.0, breaking changes may happen for minor version
|
7
7
|
bumps. A breaking change will get clearly notified in this log.
|
8
8
|
|
9
|
-
## [unreleased](https://github.com/stellar/ruby-stellar-base/compare/v0.
|
10
|
-
|
9
|
+
## [unreleased](https://github.com/stellar/ruby-stellar-base/compare/v0.11.0...master)
|
10
|
+
|
11
|
+
## [0.11.0](https://github.com/stellar/ruby-stellar-base/compare/v0.10.0...v0.11.0)
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Added support for `manage_data` operations
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
- `Stellar::Transaction#to_envelope` can now be used without arguments, returning a `Stellar::TransactionEnvelope` with zero signatures.
|
18
|
+
|
19
|
+
## [0.10.0](https://github.com/stellar/ruby-stellar-base/compare/v0.9.0...v0.10.0)
|
11
20
|
|
12
21
|
- Added memo helpers to `Stellar::Transaction.for_account`, allowing any operation builder (such as `Stellar::Transaction.payment) to provide a custom memo using the `:memo` attribute.
|
13
22
|
|
@@ -28,7 +28,9 @@ module Stellar
|
|
28
28
|
AccountID = PublicKey
|
29
29
|
Thresholds = XDR::Opaque[4]
|
30
30
|
String32 = XDR::String[32]
|
31
|
+
String64 = XDR::String[64]
|
31
32
|
SequenceNumber = Uint64
|
33
|
+
DataValue = XDR::VarOpaque[64]
|
32
34
|
autoload :AssetType
|
33
35
|
autoload :Asset
|
34
36
|
autoload :Price
|
@@ -41,6 +43,7 @@ module Stellar
|
|
41
43
|
autoload :TrustLineEntry
|
42
44
|
autoload :OfferEntryFlags
|
43
45
|
autoload :OfferEntry
|
46
|
+
autoload :DataEntry
|
44
47
|
autoload :LedgerEntry
|
45
48
|
autoload :EnvelopeType
|
46
49
|
end
|
@@ -57,6 +60,7 @@ module Stellar
|
|
57
60
|
autoload :SetOptionsOp
|
58
61
|
autoload :ChangeTrustOp
|
59
62
|
autoload :AllowTrustOp
|
63
|
+
autoload :ManageDataOp
|
60
64
|
autoload :Operation
|
61
65
|
autoload :MemoType
|
62
66
|
autoload :Memo
|
@@ -86,6 +90,8 @@ module Stellar
|
|
86
90
|
autoload :InflationResultCode
|
87
91
|
autoload :InflationPayout
|
88
92
|
autoload :InflationResult
|
93
|
+
autoload :ManageDataResultCode
|
94
|
+
autoload :ManageDataResult
|
89
95
|
autoload :OperationResultCode
|
90
96
|
autoload :OperationResult
|
91
97
|
autoload :TransactionResultCode
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This code was automatically generated using xdrgen
|
2
|
+
# DO NOT EDIT or your changes may be overwritten
|
3
|
+
|
4
|
+
require 'xdr'
|
5
|
+
|
6
|
+
# === xdr source ============================================================
|
7
|
+
#
|
8
|
+
# struct DataEntry
|
9
|
+
# {
|
10
|
+
# AccountID accountID; // account this data belongs to
|
11
|
+
# string64 dataName;
|
12
|
+
# DataValue dataValue;
|
13
|
+
#
|
14
|
+
# // reserved for future use
|
15
|
+
# union switch (int v)
|
16
|
+
# {
|
17
|
+
# case 0:
|
18
|
+
# void;
|
19
|
+
# }
|
20
|
+
# ext;
|
21
|
+
# };
|
22
|
+
#
|
23
|
+
# ===========================================================================
|
24
|
+
module Stellar
|
25
|
+
class DataEntry < XDR::Struct
|
26
|
+
include XDR::Namespace
|
27
|
+
|
28
|
+
autoload :Ext
|
29
|
+
|
30
|
+
attribute :account_id, AccountID
|
31
|
+
attribute :data_name, String64
|
32
|
+
attribute :data_value, DataValue
|
33
|
+
attribute :ext, Ext
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This code was automatically generated using xdrgen
|
2
|
+
# DO NOT EDIT or your changes may be overwritten
|
3
|
+
|
4
|
+
require 'xdr'
|
5
|
+
|
6
|
+
# === xdr source ============================================================
|
7
|
+
#
|
8
|
+
# union switch (int v)
|
9
|
+
# {
|
10
|
+
# case 0:
|
11
|
+
# void;
|
12
|
+
# }
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class DataEntry
|
17
|
+
class Ext < XDR::Union
|
18
|
+
switch_on XDR::Int, :v
|
19
|
+
|
20
|
+
switch 0
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -13,6 +13,8 @@ require 'xdr'
|
|
13
13
|
# TrustLineEntry trustLine;
|
14
14
|
# case OFFER:
|
15
15
|
# OfferEntry offer;
|
16
|
+
# case DATA:
|
17
|
+
# DataEntry data;
|
16
18
|
# }
|
17
19
|
#
|
18
20
|
# ===========================================================================
|
@@ -24,10 +26,12 @@ module Stellar
|
|
24
26
|
switch :account, :account
|
25
27
|
switch :trustline, :trust_line
|
26
28
|
switch :offer, :offer
|
29
|
+
switch :data, :data
|
27
30
|
|
28
31
|
attribute :account, AccountEntry
|
29
32
|
attribute :trust_line, TrustLineEntry
|
30
33
|
attribute :offer, OfferEntry
|
34
|
+
attribute :data, DataEntry
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -9,7 +9,8 @@ require 'xdr'
|
|
9
9
|
# {
|
10
10
|
# ACCOUNT = 0,
|
11
11
|
# TRUSTLINE = 1,
|
12
|
-
# OFFER = 2
|
12
|
+
# OFFER = 2,
|
13
|
+
# DATA = 3
|
13
14
|
# };
|
14
15
|
#
|
15
16
|
# ===========================================================================
|
@@ -18,6 +19,7 @@ module Stellar
|
|
18
19
|
member :account, 0
|
19
20
|
member :trustline, 1
|
20
21
|
member :offer, 2
|
22
|
+
member :data, 3
|
21
23
|
|
22
24
|
seal
|
23
25
|
end
|
@@ -26,6 +26,13 @@ require 'xdr'
|
|
26
26
|
# AccountID sellerID;
|
27
27
|
# uint64 offerID;
|
28
28
|
# } offer;
|
29
|
+
#
|
30
|
+
# case DATA:
|
31
|
+
# struct
|
32
|
+
# {
|
33
|
+
# AccountID accountID;
|
34
|
+
# string64 dataName;
|
35
|
+
# } data;
|
29
36
|
# };
|
30
37
|
#
|
31
38
|
# ===========================================================================
|
@@ -36,15 +43,18 @@ module Stellar
|
|
36
43
|
autoload :Account
|
37
44
|
autoload :TrustLine
|
38
45
|
autoload :Offer
|
46
|
+
autoload :Data
|
39
47
|
|
40
48
|
switch_on LedgerEntryType, :type
|
41
49
|
|
42
50
|
switch :account, :account
|
43
51
|
switch :trustline, :trust_line
|
44
52
|
switch :offer, :offer
|
53
|
+
switch :data, :data
|
45
54
|
|
46
55
|
attribute :account, Account
|
47
56
|
attribute :trust_line, TrustLine
|
48
57
|
attribute :offer, Offer
|
58
|
+
attribute :data, Data
|
49
59
|
end
|
50
60
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This code was automatically generated using xdrgen
|
2
|
+
# DO NOT EDIT or your changes may be overwritten
|
3
|
+
|
4
|
+
require 'xdr'
|
5
|
+
|
6
|
+
# === xdr source ============================================================
|
7
|
+
#
|
8
|
+
# struct
|
9
|
+
# {
|
10
|
+
# AccountID accountID;
|
11
|
+
# string64 dataName;
|
12
|
+
# }
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class LedgerKey
|
17
|
+
class Data < XDR::Struct
|
18
|
+
attribute :account_id, AccountID
|
19
|
+
attribute :data_name, String64
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This code was automatically generated using xdrgen
|
2
|
+
# DO NOT EDIT or your changes may be overwritten
|
3
|
+
|
4
|
+
require 'xdr'
|
5
|
+
|
6
|
+
# === xdr source ============================================================
|
7
|
+
#
|
8
|
+
# struct ManageDataOp
|
9
|
+
# {
|
10
|
+
# string64 dataName;
|
11
|
+
# DataValue* dataValue; // set to null to clear
|
12
|
+
# };
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class ManageDataOp < XDR::Struct
|
17
|
+
attribute :data_name, String64
|
18
|
+
attribute :data_value, XDR::Option[DataValue]
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# This code was automatically generated using xdrgen
|
2
|
+
# DO NOT EDIT or your changes may be overwritten
|
3
|
+
|
4
|
+
require 'xdr'
|
5
|
+
|
6
|
+
# === xdr source ============================================================
|
7
|
+
#
|
8
|
+
# union ManageDataResult switch (ManageDataResultCode code)
|
9
|
+
# {
|
10
|
+
# case MANAGE_DATA_SUCCESS:
|
11
|
+
# void;
|
12
|
+
# default:
|
13
|
+
# void;
|
14
|
+
# };
|
15
|
+
#
|
16
|
+
# ===========================================================================
|
17
|
+
module Stellar
|
18
|
+
class ManageDataResult < XDR::Union
|
19
|
+
switch_on ManageDataResultCode, :code
|
20
|
+
|
21
|
+
switch :manage_data_success
|
22
|
+
switch :default
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# This code was automatically generated using xdrgen
|
2
|
+
# DO NOT EDIT or your changes may be overwritten
|
3
|
+
|
4
|
+
require 'xdr'
|
5
|
+
|
6
|
+
# === xdr source ============================================================
|
7
|
+
#
|
8
|
+
# enum ManageDataResultCode
|
9
|
+
# {
|
10
|
+
# // codes considered as "success" for the operation
|
11
|
+
# MANAGE_DATA_SUCCESS = 0,
|
12
|
+
# // codes considered as "failure" for the operation
|
13
|
+
# MANAGE_DATA_NOT_SUPPORTED_YET = -1, // The network hasn't moved to this protocol change yet
|
14
|
+
# MANAGE_DATA_NAME_NOT_FOUND = -2, // Trying to remove a Data Entry that isn't there
|
15
|
+
# MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry
|
16
|
+
# MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string
|
17
|
+
# };
|
18
|
+
#
|
19
|
+
# ===========================================================================
|
20
|
+
module Stellar
|
21
|
+
class ManageDataResultCode < XDR::Enum
|
22
|
+
member :manage_data_success, 0
|
23
|
+
member :manage_data_not_supported_yet, -1
|
24
|
+
member :manage_data_name_not_found, -2
|
25
|
+
member :manage_data_low_reserve, -3
|
26
|
+
member :manage_data_invalid_name, -4
|
27
|
+
|
28
|
+
seal
|
29
|
+
end
|
30
|
+
end
|
@@ -27,6 +27,8 @@ require 'xdr'
|
|
27
27
|
# AccountID destination;
|
28
28
|
# case INFLATION:
|
29
29
|
# void;
|
30
|
+
# case MANAGE_DATA:
|
31
|
+
# ManageDataOp manageDataOp;
|
30
32
|
# }
|
31
33
|
#
|
32
34
|
# ===========================================================================
|
@@ -45,6 +47,7 @@ module Stellar
|
|
45
47
|
switch :allow_trust, :allow_trust_op
|
46
48
|
switch :account_merge, :destination
|
47
49
|
switch :inflation
|
50
|
+
switch :manage_data, :manage_data_op
|
48
51
|
|
49
52
|
attribute :create_account_op, CreateAccountOp
|
50
53
|
attribute :payment_op, PaymentOp
|
@@ -55,6 +58,7 @@ module Stellar
|
|
55
58
|
attribute :change_trust_op, ChangeTrustOp
|
56
59
|
attribute :allow_trust_op, AllowTrustOp
|
57
60
|
attribute :destination, AccountID
|
61
|
+
attribute :manage_data_op, ManageDataOp
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
@@ -27,6 +27,8 @@ require 'xdr'
|
|
27
27
|
# AccountMergeResult accountMergeResult;
|
28
28
|
# case INFLATION:
|
29
29
|
# InflationResult inflationResult;
|
30
|
+
# case MANAGE_DATA:
|
31
|
+
# ManageDataResult manageDataResult;
|
30
32
|
# }
|
31
33
|
#
|
32
34
|
# ===========================================================================
|
@@ -45,6 +47,7 @@ module Stellar
|
|
45
47
|
switch :allow_trust, :allow_trust_result
|
46
48
|
switch :account_merge, :account_merge_result
|
47
49
|
switch :inflation, :inflation_result
|
50
|
+
switch :manage_data, :manage_data_result
|
48
51
|
|
49
52
|
attribute :create_account_result, CreateAccountResult
|
50
53
|
attribute :payment_result, PaymentResult
|
@@ -56,6 +59,7 @@ module Stellar
|
|
56
59
|
attribute :allow_trust_result, AllowTrustResult
|
57
60
|
attribute :account_merge_result, AccountMergeResult
|
58
61
|
attribute :inflation_result, InflationResult
|
62
|
+
attribute :manage_data_result, ManageDataResult
|
59
63
|
end
|
60
64
|
end
|
61
65
|
end
|
@@ -16,7 +16,8 @@ require 'xdr'
|
|
16
16
|
# CHANGE_TRUST = 6,
|
17
17
|
# ALLOW_TRUST = 7,
|
18
18
|
# ACCOUNT_MERGE = 8,
|
19
|
-
# INFLATION = 9
|
19
|
+
# INFLATION = 9,
|
20
|
+
# MANAGE_DATA = 10
|
20
21
|
# };
|
21
22
|
#
|
22
23
|
# ===========================================================================
|
@@ -32,6 +33,7 @@ module Stellar
|
|
32
33
|
member :allow_trust, 7
|
33
34
|
member :account_merge, 8
|
34
35
|
member :inflation, 9
|
36
|
+
member :manage_data, 10
|
35
37
|
|
36
38
|
seal
|
37
39
|
end
|
data/lib/stellar-base.rb
CHANGED
data/lib/stellar/base/version.rb
CHANGED
data/lib/stellar/operation.rb
CHANGED
@@ -121,7 +121,7 @@ module Stellar
|
|
121
121
|
# Stellar::ChangeTrustOp body
|
122
122
|
def self.change_trust(attributes={})
|
123
123
|
line = Asset.send(*attributes[:line])
|
124
|
-
limit =interpret_amount(attributes[:limit])
|
124
|
+
limit =interpret_amount(attributes[:limit])
|
125
125
|
|
126
126
|
raise ArgumentError, "Bad :limit #{limit}" unless limit.is_a?(Integer)
|
127
127
|
|
@@ -278,6 +278,34 @@ module Stellar
|
|
278
278
|
}))
|
279
279
|
end
|
280
280
|
|
281
|
+
#
|
282
|
+
# Helper method to create an manage data operation
|
283
|
+
#
|
284
|
+
# @param [Hash] attributes the attributes to create the operation with
|
285
|
+
# @option attributes [Integer] :sequence
|
286
|
+
#
|
287
|
+
# @return [Stellar::Operation] the built operation
|
288
|
+
def self.manage_data(attributes={})
|
289
|
+
op = ManageDataOp.new()
|
290
|
+
|
291
|
+
name = attributes[:name]
|
292
|
+
value = attributes[:value]
|
293
|
+
|
294
|
+
raise ArgumentError, "Invalid :name" unless name.is_a?(String)
|
295
|
+
raise ArgumentError, ":name too long" unless name.bytesize <= 64
|
296
|
+
|
297
|
+
if value.present?
|
298
|
+
raise ArgumentError, ":value too long" unless value.bytesize <= 64
|
299
|
+
end
|
300
|
+
|
301
|
+
op.data_name = name
|
302
|
+
op.data_value = value
|
303
|
+
|
304
|
+
return make(attributes.merge({
|
305
|
+
body:[:manage_data, op]
|
306
|
+
}))
|
307
|
+
end
|
308
|
+
|
281
309
|
private
|
282
310
|
def self.extract_amount(a)
|
283
311
|
amount = interpret_amount(a.last)
|
data/lib/stellar/transaction.rb
CHANGED
@@ -61,6 +61,12 @@ module Stellar
|
|
61
61
|
make :inflation, attributes
|
62
62
|
end
|
63
63
|
|
64
|
+
#
|
65
|
+
# @see Stellar::Operation.manage_data
|
66
|
+
def self.manage_data(attributes={})
|
67
|
+
make :manage_data, attributes
|
68
|
+
end
|
69
|
+
|
64
70
|
#
|
65
71
|
# Helper method to create a transaction with a single
|
66
72
|
# operation of the provided type. See class methods
|
@@ -94,7 +100,7 @@ module Stellar
|
|
94
100
|
sequence = attributes[:sequence]
|
95
101
|
fee = attributes[:fee]
|
96
102
|
|
97
|
-
raise ArgumentError, "Bad :account" unless account.is_a?(KeyPair)
|
103
|
+
raise ArgumentError, "Bad :account" unless account.is_a?(KeyPair)
|
98
104
|
raise ArgumentError, "Bad :sequence #{sequence}" unless sequence.is_a?(Integer)
|
99
105
|
raise ArgumentError, "Bad :fee #{sequence}" if fee.present? && !fee.is_a?(Integer)
|
100
106
|
|
@@ -132,7 +138,7 @@ module Stellar
|
|
132
138
|
end
|
133
139
|
|
134
140
|
def to_envelope(*key_pairs)
|
135
|
-
signatures = key_pairs.map(&method(:sign_decorated))
|
141
|
+
signatures = (key_pairs || []).map(&method(:sign_decorated))
|
136
142
|
|
137
143
|
TransactionEnvelope.new({
|
138
144
|
:signatures => signatures,
|
@@ -5,9 +5,26 @@ describe Stellar::Operation, ".payment" do
|
|
5
5
|
|
6
6
|
it "correctly translates the provided amount to the native representation" do
|
7
7
|
op = Stellar::Operation.payment(destination: Stellar::KeyPair.random, amount: [:native, 20])
|
8
|
-
expect(op.body.value.amount).to eql(20_0000000)
|
8
|
+
expect(op.body.value.amount).to eql(20_0000000)
|
9
9
|
op = Stellar::Operation.payment(destination: Stellar::KeyPair.random, amount: [:native, "20"])
|
10
|
-
expect(op.body.value.amount).to eql(20_0000000)
|
10
|
+
expect(op.body.value.amount).to eql(20_0000000)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
describe Stellar::Operation, ".manage_data" do
|
17
|
+
|
18
|
+
it "works" do
|
19
|
+
op = Stellar::Operation.manage_data(name: "my name", value: "hello")
|
20
|
+
expect(op.body.manage_data_op!.data_name).to eql("my name")
|
21
|
+
expect(op.body.manage_data_op!.data_value).to eql("hello")
|
22
|
+
expect{ op.to_xdr }.to_not raise_error
|
23
|
+
|
24
|
+
op = Stellar::Operation.manage_data(name: "my name")
|
25
|
+
expect(op.body.manage_data_op!.data_name).to eql("my name")
|
26
|
+
expect(op.body.manage_data_op!.data_value).to be_nil
|
27
|
+
expect{ op.to_xdr }.to_not raise_error
|
11
28
|
end
|
12
29
|
|
13
30
|
end
|
@@ -26,17 +26,34 @@ describe Stellar::Transaction do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "#to_envelope" do
|
29
|
-
let(:result){ subject.to_envelope(
|
29
|
+
let(:result){ subject.to_envelope(*key_pairs) }
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
|
32
|
+
context "with a single key pair as a parameter" do
|
33
|
+
let(:key_pairs){ [key_pair] }
|
34
|
+
|
35
|
+
it "return a Stellar::TransactionEnvelope" do
|
36
|
+
expect(result).to be_a(Stellar::TransactionEnvelope)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "correctly signs the transaction" do
|
40
|
+
expect(result.signatures.length).to eq(1)
|
41
|
+
expect(result.signatures.first).to be_a(Stellar::DecoratedSignature)
|
42
|
+
expect(result.signatures.first.hint).to eq(key_pair.signature_hint)
|
43
|
+
expect(result.signatures.first.signature).to eq(subject.sign(key_pair))
|
44
|
+
end
|
33
45
|
end
|
34
46
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
47
|
+
context "with no keypairs provided as parameters" do
|
48
|
+
let(:key_pairs){ [] }
|
49
|
+
|
50
|
+
it "return a Stellar::TransactionEnvelope" do
|
51
|
+
expect(result).to be_a(Stellar::TransactionEnvelope)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "adds no signatures" do
|
55
|
+
expect(result.signatures.length).to eq(0)
|
56
|
+
end
|
40
57
|
end
|
41
58
|
end
|
42
59
|
|
@@ -10,7 +10,9 @@ namespace stellar
|
|
10
10
|
typedef PublicKey AccountID;
|
11
11
|
typedef opaque Thresholds[4];
|
12
12
|
typedef string string32<32>;
|
13
|
+
typedef string string64<64>;
|
13
14
|
typedef uint64 SequenceNumber;
|
15
|
+
typedef opaque DataValue<64>;
|
14
16
|
|
15
17
|
enum AssetType
|
16
18
|
{
|
@@ -62,7 +64,8 @@ enum LedgerEntryType
|
|
62
64
|
{
|
63
65
|
ACCOUNT = 0,
|
64
66
|
TRUSTLINE = 1,
|
65
|
-
OFFER = 2
|
67
|
+
OFFER = 2,
|
68
|
+
DATA = 3
|
66
69
|
};
|
67
70
|
|
68
71
|
struct Signer
|
@@ -190,6 +193,25 @@ struct OfferEntry
|
|
190
193
|
ext;
|
191
194
|
};
|
192
195
|
|
196
|
+
/* DataEntry
|
197
|
+
Data can be attached to accounts.
|
198
|
+
*/
|
199
|
+
struct DataEntry
|
200
|
+
{
|
201
|
+
AccountID accountID; // account this data belongs to
|
202
|
+
string64 dataName;
|
203
|
+
DataValue dataValue;
|
204
|
+
|
205
|
+
// reserved for future use
|
206
|
+
union switch (int v)
|
207
|
+
{
|
208
|
+
case 0:
|
209
|
+
void;
|
210
|
+
}
|
211
|
+
ext;
|
212
|
+
};
|
213
|
+
|
214
|
+
|
193
215
|
struct LedgerEntry
|
194
216
|
{
|
195
217
|
uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
|
@@ -202,6 +224,8 @@ struct LedgerEntry
|
|
202
224
|
TrustLineEntry trustLine;
|
203
225
|
case OFFER:
|
204
226
|
OfferEntry offer;
|
227
|
+
case DATA:
|
228
|
+
DataEntry data;
|
205
229
|
}
|
206
230
|
data;
|
207
231
|
|
data/xdr/Stellar-ledger.x
CHANGED
data/xdr/Stellar-transaction.x
CHANGED
@@ -24,7 +24,8 @@ enum OperationType
|
|
24
24
|
CHANGE_TRUST = 6,
|
25
25
|
ALLOW_TRUST = 7,
|
26
26
|
ACCOUNT_MERGE = 8,
|
27
|
-
INFLATION = 9
|
27
|
+
INFLATION = 9,
|
28
|
+
MANAGE_DATA = 10
|
28
29
|
};
|
29
30
|
|
30
31
|
/* CreateAccount
|
@@ -205,6 +206,21 @@ Result: InflationResult
|
|
205
206
|
Result : AccountMergeResult
|
206
207
|
*/
|
207
208
|
|
209
|
+
/* ManageData
|
210
|
+
Adds, Updates, or Deletes a key value pair associated with a particular
|
211
|
+
account.
|
212
|
+
|
213
|
+
Threshold: med
|
214
|
+
|
215
|
+
Result: ManageDataResult
|
216
|
+
*/
|
217
|
+
|
218
|
+
struct ManageDataOp
|
219
|
+
{
|
220
|
+
string64 dataName;
|
221
|
+
DataValue* dataValue; // set to null to clear
|
222
|
+
};
|
223
|
+
|
208
224
|
/* An operation is the lowest unit of work that a transaction does */
|
209
225
|
struct Operation
|
210
226
|
{
|
@@ -235,6 +251,8 @@ struct Operation
|
|
235
251
|
AccountID destination;
|
236
252
|
case INFLATION:
|
237
253
|
void;
|
254
|
+
case MANAGE_DATA:
|
255
|
+
ManageDataOp manageDataOp;
|
238
256
|
}
|
239
257
|
body;
|
240
258
|
};
|
@@ -592,6 +610,27 @@ default:
|
|
592
610
|
void;
|
593
611
|
};
|
594
612
|
|
613
|
+
/******* ManageData Result ********/
|
614
|
+
|
615
|
+
enum ManageDataResultCode
|
616
|
+
{
|
617
|
+
// codes considered as "success" for the operation
|
618
|
+
MANAGE_DATA_SUCCESS = 0,
|
619
|
+
// codes considered as "failure" for the operation
|
620
|
+
MANAGE_DATA_NOT_SUPPORTED_YET = -1, // The network hasn't moved to this protocol change yet
|
621
|
+
MANAGE_DATA_NAME_NOT_FOUND = -2, // Trying to remove a Data Entry that isn't there
|
622
|
+
MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry
|
623
|
+
MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string
|
624
|
+
};
|
625
|
+
|
626
|
+
union ManageDataResult switch (ManageDataResultCode code)
|
627
|
+
{
|
628
|
+
case MANAGE_DATA_SUCCESS:
|
629
|
+
void;
|
630
|
+
default:
|
631
|
+
void;
|
632
|
+
};
|
633
|
+
|
595
634
|
/* High level Operation Result */
|
596
635
|
|
597
636
|
enum OperationResultCode
|
@@ -627,6 +666,8 @@ case opINNER:
|
|
627
666
|
AccountMergeResult accountMergeResult;
|
628
667
|
case INFLATION:
|
629
668
|
InflationResult inflationResult;
|
669
|
+
case MANAGE_DATA:
|
670
|
+
ManageDataResult manageDataResult;
|
630
671
|
}
|
631
672
|
tr;
|
632
673
|
default:
|
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.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdr
|
@@ -274,6 +274,8 @@ files:
|
|
274
274
|
- generated/stellar/crypto_key_type.rb
|
275
275
|
- generated/stellar/curve25519_public.rb
|
276
276
|
- generated/stellar/curve25519_secret.rb
|
277
|
+
- generated/stellar/data_entry.rb
|
278
|
+
- generated/stellar/data_entry/ext.rb
|
277
279
|
- generated/stellar/decorated_signature.rb
|
278
280
|
- generated/stellar/dont_have.rb
|
279
281
|
- generated/stellar/envelope_type.rb
|
@@ -298,11 +300,15 @@ files:
|
|
298
300
|
- generated/stellar/ledger_header_history_entry/ext.rb
|
299
301
|
- generated/stellar/ledger_key.rb
|
300
302
|
- generated/stellar/ledger_key/account.rb
|
303
|
+
- generated/stellar/ledger_key/data.rb
|
301
304
|
- generated/stellar/ledger_key/offer.rb
|
302
305
|
- generated/stellar/ledger_key/trust_line.rb
|
303
306
|
- generated/stellar/ledger_scp_messages.rb
|
304
307
|
- generated/stellar/ledger_upgrade.rb
|
305
308
|
- generated/stellar/ledger_upgrade_type.rb
|
309
|
+
- generated/stellar/manage_data_op.rb
|
310
|
+
- generated/stellar/manage_data_result.rb
|
311
|
+
- generated/stellar/manage_data_result_code.rb
|
306
312
|
- generated/stellar/manage_offer_effect.rb
|
307
313
|
- generated/stellar/manage_offer_op.rb
|
308
314
|
- generated/stellar/manage_offer_result.rb
|