stellar-base 0.21.0 → 0.22.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 +10 -2
- data/Gemfile +0 -6
- data/README.md +1 -1
- data/generated/stellar-base-generated.rb +15 -0
- data/generated/stellar/ledger_close_meta.rb +23 -0
- data/generated/stellar/ledger_close_meta_v0.rb +35 -0
- data/generated/stellar/message_type.rb +6 -1
- data/generated/stellar/peer_stats.rb +48 -0
- data/generated/stellar/signed_survey_request_message.rb +20 -0
- data/generated/stellar/signed_survey_response_message.rb +20 -0
- data/generated/stellar/stellar_message.rb +22 -12
- data/generated/stellar/survey_message_command_type.rb +20 -0
- data/generated/stellar/survey_request_message.rb +26 -0
- data/generated/stellar/survey_response_body.rb +23 -0
- data/generated/stellar/survey_response_message.rb +26 -0
- data/generated/stellar/topology_response_body.rb +25 -0
- data/generated/stellar/transaction_meta.rb +4 -0
- data/generated/stellar/transaction_meta_v2.rb +24 -0
- data/generated/stellar/transaction_result_meta.rb +22 -0
- data/generated/stellar/upgrade_entry_meta.rb +20 -0
- data/lib/stellar-base.rb +1 -0
- data/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/operation.rb +55 -26
- data/lib/stellar/transaction.rb +11 -0
- data/lib/stellar/transaction_builder.rb +106 -0
- data/ruby-stellar-base.gemspec +1 -1
- data/spec/lib/stellar/operation_spec.rb +7 -9
- data/spec/lib/stellar/transaction_builder_spec.rb +263 -0
- data/xdr/Stellar-ledger.x +54 -0
- data/xdr/Stellar-overlay.x +84 -1
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2080b6de9bcd681d6ac2cba2e1975df3eec7ec7ccbb84f0c8a1afae1d753b6
|
4
|
+
data.tar.gz: 0c98b537b5abd5f1dc470cdc8c09de9571c28c9a7f15642e57ba082fe5292e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a3559f81a2713b23f819739f7517ddf26be6308d213fadc10f16acd021f761464509e362cd02649623406281164d4dcf28c40495a3b7e793d0fb0b93112d33a
|
7
|
+
data.tar.gz: 205f9e4bad48033adb6cfd6afc444af939990bc14a8e22ca15c2c389170e9fa70a333077a403afa45dc909c9812a0508db5a07a004f99d3bd358ca0e69966785
|
data/CHANGELOG.md
CHANGED
@@ -6,13 +6,21 @@ 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
|
-
## [0.
|
9
|
+
## [0.22.0](https://github.com/stellar/ruby-stellar-base/compare/v0.21.0...v0.22.0) - 2020-03-26
|
10
|
+
### Added
|
11
|
+
- Add TransactionBuilder ([#54](https://github.com/stellar/ruby-stellar-base/issues/54))
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Regenerate XDR files ([#57](https://github.com/stellar/ruby-stellar-base/issues/57))
|
15
|
+
- Allow asset objects to be passed instead of list of parameters ([#59](https://github.com/stellar/ruby-stellar-base/issues/59))
|
16
|
+
|
17
|
+
## [0.21.0](https://github.com/bloom-solutions/ruby-stellar-base/compare/v0.20.0...v0.21.0) - 2019-10-04
|
10
18
|
### Changed
|
11
19
|
- [Stellar Protocol 12 compatibility](https://github.com/bloom-solutions/ruby-stellar-base/pull/51).
|
12
20
|
- XDR changes for path payment
|
13
21
|
- constant renames, which may cause breaking changes if referred to directly
|
14
22
|
|
15
|
-
## [0.20.0](https://github.com/bloom-solutions/ruby-stellar-base/compare/v0.
|
23
|
+
## [0.20.0](https://github.com/bloom-solutions/ruby-stellar-base/compare/v0.19.0...v0.20.0) - 2019-05-22
|
16
24
|
### Added
|
17
25
|
- Stellar Protocol 11 compatibility (#48)
|
18
26
|
- XDR changes for [CAP-0006 Buy Offers](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0006.md)
|
data/Gemfile
CHANGED
@@ -2,14 +2,8 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
# gem "xdr", git: "https://github.com/stellar/ruby-xdr.git"
|
6
|
-
# gem "xdr", path: "../ruby-xdr"
|
7
|
-
|
8
5
|
group :development do
|
9
|
-
gem "xdrgen", git: "https://github.com/stellar/xdrgen.git"
|
10
|
-
# gem "xdrgen", path: "../xdrgen"
|
11
6
|
gem "pry"
|
12
7
|
gem "faraday"
|
13
8
|
gem "faraday_middleware"
|
14
9
|
end
|
15
|
-
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Stellar::Base
|
2
2
|
|
3
|
-
[](https://travis-ci.org/stellar/ruby-stellar-base)
|
4
4
|
[](https://codeclimate.com/github/stellar/ruby-stellar-base)
|
5
5
|
|
6
6
|
The stellar-base library is the lowest-level stellar helper library. It consists of classes
|
@@ -146,7 +146,12 @@ module Stellar
|
|
146
146
|
LedgerEntryChanges = XDR::VarArray[LedgerEntryChange]
|
147
147
|
autoload :OperationMeta
|
148
148
|
autoload :TransactionMetaV1
|
149
|
+
autoload :TransactionMetaV2
|
149
150
|
autoload :TransactionMeta
|
151
|
+
autoload :TransactionResultMeta
|
152
|
+
autoload :UpgradeEntryMeta
|
153
|
+
autoload :LedgerCloseMetaV0
|
154
|
+
autoload :LedgerCloseMeta
|
150
155
|
end
|
151
156
|
module Stellar
|
152
157
|
include XDR::Namespace
|
@@ -160,6 +165,16 @@ module Stellar
|
|
160
165
|
autoload :PeerAddress
|
161
166
|
autoload :MessageType
|
162
167
|
autoload :DontHave
|
168
|
+
autoload :SurveyMessageCommandType
|
169
|
+
autoload :SurveyRequestMessage
|
170
|
+
autoload :SignedSurveyRequestMessage
|
171
|
+
EncryptedBody = XDR::VarOpaque[64000]
|
172
|
+
autoload :SurveyResponseMessage
|
173
|
+
autoload :SignedSurveyResponseMessage
|
174
|
+
autoload :PeerStats
|
175
|
+
PeerStatList = XDR::VarArray[PeerStats, 25]
|
176
|
+
autoload :TopologyResponseBody
|
177
|
+
autoload :SurveyResponseBody
|
163
178
|
autoload :StellarMessage
|
164
179
|
autoload :AuthenticatedMessage
|
165
180
|
end
|
@@ -0,0 +1,23 @@
|
|
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 LedgerCloseMeta switch (int v)
|
9
|
+
# {
|
10
|
+
# case 0:
|
11
|
+
# LedgerCloseMetaV0 v0;
|
12
|
+
# };
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class LedgerCloseMeta < XDR::Union
|
17
|
+
switch_on XDR::Int, :v
|
18
|
+
|
19
|
+
switch 0, :v0
|
20
|
+
|
21
|
+
attribute :v0, LedgerCloseMetaV0
|
22
|
+
end
|
23
|
+
end
|
@@ -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 LedgerCloseMetaV0
|
9
|
+
# {
|
10
|
+
# LedgerHeaderHistoryEntry ledgerHeader;
|
11
|
+
# // NB: txSet is sorted in "Hash order"
|
12
|
+
# TransactionSet txSet;
|
13
|
+
#
|
14
|
+
# // NB: transactions are sorted in apply order here
|
15
|
+
# // fees for all transactions are processed first
|
16
|
+
# // followed by applying transactions
|
17
|
+
# TransactionResultMeta txProcessing<>;
|
18
|
+
#
|
19
|
+
# // upgrades are applied last
|
20
|
+
# UpgradeEntryMeta upgradesProcessing<>;
|
21
|
+
#
|
22
|
+
# // other misc information attached to the ledger close
|
23
|
+
# SCPHistoryEntry scpInfo<>;
|
24
|
+
# };
|
25
|
+
#
|
26
|
+
# ===========================================================================
|
27
|
+
module Stellar
|
28
|
+
class LedgerCloseMetaV0 < XDR::Struct
|
29
|
+
attribute :ledger_header, LedgerHeaderHistoryEntry
|
30
|
+
attribute :tx_set, TransactionSet
|
31
|
+
attribute :tx_processing, XDR::VarArray[TransactionResultMeta]
|
32
|
+
attribute :upgrades_processing, XDR::VarArray[UpgradeEntryMeta]
|
33
|
+
attribute :scp_info, XDR::VarArray[SCPHistoryEntry]
|
34
|
+
end
|
35
|
+
end
|
@@ -26,7 +26,10 @@ require 'xdr'
|
|
26
26
|
# GET_SCP_STATE = 12,
|
27
27
|
#
|
28
28
|
# // new messages
|
29
|
-
# HELLO = 13
|
29
|
+
# HELLO = 13,
|
30
|
+
#
|
31
|
+
# SURVEY_REQUEST = 14,
|
32
|
+
# SURVEY_RESPONSE = 15
|
30
33
|
# };
|
31
34
|
#
|
32
35
|
# ===========================================================================
|
@@ -45,6 +48,8 @@ module Stellar
|
|
45
48
|
member :scp_message, 11
|
46
49
|
member :get_scp_state, 12
|
47
50
|
member :hello, 13
|
51
|
+
member :survey_request, 14
|
52
|
+
member :survey_response, 15
|
48
53
|
|
49
54
|
seal
|
50
55
|
end
|
@@ -0,0 +1,48 @@
|
|
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 PeerStats
|
9
|
+
# {
|
10
|
+
# NodeID id;
|
11
|
+
# string versionStr<100>;
|
12
|
+
# uint64 messagesRead;
|
13
|
+
# uint64 messagesWritten;
|
14
|
+
# uint64 bytesRead;
|
15
|
+
# uint64 bytesWritten;
|
16
|
+
# uint64 secondsConnected;
|
17
|
+
#
|
18
|
+
# uint64 uniqueFloodBytesRecv;
|
19
|
+
# uint64 duplicateFloodBytesRecv;
|
20
|
+
# uint64 uniqueFetchBytesRecv;
|
21
|
+
# uint64 duplicateFetchBytesRecv;
|
22
|
+
#
|
23
|
+
# uint64 uniqueFloodMessageRecv;
|
24
|
+
# uint64 duplicateFloodMessageRecv;
|
25
|
+
# uint64 uniqueFetchMessageRecv;
|
26
|
+
# uint64 duplicateFetchMessageRecv;
|
27
|
+
# };
|
28
|
+
#
|
29
|
+
# ===========================================================================
|
30
|
+
module Stellar
|
31
|
+
class PeerStats < XDR::Struct
|
32
|
+
attribute :id, NodeID
|
33
|
+
attribute :version_str, XDR::String[100]
|
34
|
+
attribute :messages_read, Uint64
|
35
|
+
attribute :messages_written, Uint64
|
36
|
+
attribute :bytes_read, Uint64
|
37
|
+
attribute :bytes_written, Uint64
|
38
|
+
attribute :seconds_connected, Uint64
|
39
|
+
attribute :unique_flood_bytes_recv, Uint64
|
40
|
+
attribute :duplicate_flood_bytes_recv, Uint64
|
41
|
+
attribute :unique_fetch_bytes_recv, Uint64
|
42
|
+
attribute :duplicate_fetch_bytes_recv, Uint64
|
43
|
+
attribute :unique_flood_message_recv, Uint64
|
44
|
+
attribute :duplicate_flood_message_recv, Uint64
|
45
|
+
attribute :unique_fetch_message_recv, Uint64
|
46
|
+
attribute :duplicate_fetch_message_recv, Uint64
|
47
|
+
end
|
48
|
+
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 SignedSurveyRequestMessage
|
9
|
+
# {
|
10
|
+
# Signature requestSignature;
|
11
|
+
# SurveyRequestMessage request;
|
12
|
+
# };
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class SignedSurveyRequestMessage < XDR::Struct
|
17
|
+
attribute :request_signature, Signature
|
18
|
+
attribute :request, SurveyRequestMessage
|
19
|
+
end
|
20
|
+
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 SignedSurveyResponseMessage
|
9
|
+
# {
|
10
|
+
# Signature responseSignature;
|
11
|
+
# SurveyResponseMessage response;
|
12
|
+
# };
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class SignedSurveyResponseMessage < XDR::Struct
|
17
|
+
attribute :response_signature, Signature
|
18
|
+
attribute :response, SurveyResponseMessage
|
19
|
+
end
|
20
|
+
end
|
@@ -28,6 +28,12 @@ require 'xdr'
|
|
28
28
|
# case TRANSACTION:
|
29
29
|
# TransactionEnvelope transaction;
|
30
30
|
#
|
31
|
+
# case SURVEY_REQUEST:
|
32
|
+
# SignedSurveyRequestMessage signedSurveyRequestMessage;
|
33
|
+
#
|
34
|
+
# case SURVEY_RESPONSE:
|
35
|
+
# SignedSurveyResponseMessage signedSurveyResponseMessage;
|
36
|
+
#
|
31
37
|
# // SCP
|
32
38
|
# case GET_SCP_QUORUMSET:
|
33
39
|
# uint256 qSetHash;
|
@@ -53,22 +59,26 @@ module Stellar
|
|
53
59
|
switch :get_tx_set, :tx_set_hash
|
54
60
|
switch :tx_set, :tx_set
|
55
61
|
switch :transaction, :transaction
|
62
|
+
switch :survey_request, :signed_survey_request_message
|
63
|
+
switch :survey_response, :signed_survey_response_message
|
56
64
|
switch :get_scp_quorumset, :q_set_hash
|
57
65
|
switch :scp_quorumset, :q_set
|
58
66
|
switch :scp_message, :envelope
|
59
67
|
switch :get_scp_state, :get_scp_ledger_seq
|
60
68
|
|
61
|
-
attribute :error,
|
62
|
-
attribute :hello,
|
63
|
-
attribute :auth,
|
64
|
-
attribute :dont_have,
|
65
|
-
attribute :peers,
|
66
|
-
attribute :tx_set_hash,
|
67
|
-
attribute :tx_set,
|
68
|
-
attribute :transaction,
|
69
|
-
attribute :
|
70
|
-
attribute :
|
71
|
-
attribute :
|
72
|
-
attribute :
|
69
|
+
attribute :error, Error
|
70
|
+
attribute :hello, Hello
|
71
|
+
attribute :auth, Auth
|
72
|
+
attribute :dont_have, DontHave
|
73
|
+
attribute :peers, XDR::VarArray[PeerAddress, 100]
|
74
|
+
attribute :tx_set_hash, Uint256
|
75
|
+
attribute :tx_set, TransactionSet
|
76
|
+
attribute :transaction, TransactionEnvelope
|
77
|
+
attribute :signed_survey_request_message, SignedSurveyRequestMessage
|
78
|
+
attribute :signed_survey_response_message, SignedSurveyResponseMessage
|
79
|
+
attribute :q_set_hash, Uint256
|
80
|
+
attribute :q_set, SCPQuorumSet
|
81
|
+
attribute :envelope, SCPEnvelope
|
82
|
+
attribute :get_scp_ledger_seq, Uint32
|
73
83
|
end
|
74
84
|
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
|
+
# enum SurveyMessageCommandType
|
9
|
+
# {
|
10
|
+
# SURVEY_TOPOLOGY = 0
|
11
|
+
# };
|
12
|
+
#
|
13
|
+
# ===========================================================================
|
14
|
+
module Stellar
|
15
|
+
class SurveyMessageCommandType < XDR::Enum
|
16
|
+
member :survey_topology, 0
|
17
|
+
|
18
|
+
seal
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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 SurveyRequestMessage
|
9
|
+
# {
|
10
|
+
# NodeID surveyorPeerID;
|
11
|
+
# NodeID surveyedPeerID;
|
12
|
+
# uint32 ledgerNum;
|
13
|
+
# Curve25519Public encryptionKey;
|
14
|
+
# SurveyMessageCommandType commandType;
|
15
|
+
# };
|
16
|
+
#
|
17
|
+
# ===========================================================================
|
18
|
+
module Stellar
|
19
|
+
class SurveyRequestMessage < XDR::Struct
|
20
|
+
attribute :surveyor_peer_id, NodeID
|
21
|
+
attribute :surveyed_peer_id, NodeID
|
22
|
+
attribute :ledger_num, Uint32
|
23
|
+
attribute :encryption_key, Curve25519Public
|
24
|
+
attribute :command_type, SurveyMessageCommandType
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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 SurveyResponseBody switch (SurveyMessageCommandType type)
|
9
|
+
# {
|
10
|
+
# case SURVEY_TOPOLOGY:
|
11
|
+
# TopologyResponseBody topologyResponseBody;
|
12
|
+
# };
|
13
|
+
#
|
14
|
+
# ===========================================================================
|
15
|
+
module Stellar
|
16
|
+
class SurveyResponseBody < XDR::Union
|
17
|
+
switch_on SurveyMessageCommandType, :type
|
18
|
+
|
19
|
+
switch :survey_topology, :topology_response_body
|
20
|
+
|
21
|
+
attribute :topology_response_body, TopologyResponseBody
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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 SurveyResponseMessage
|
9
|
+
# {
|
10
|
+
# NodeID surveyorPeerID;
|
11
|
+
# NodeID surveyedPeerID;
|
12
|
+
# uint32 ledgerNum;
|
13
|
+
# SurveyMessageCommandType commandType;
|
14
|
+
# EncryptedBody encryptedBody;
|
15
|
+
# };
|
16
|
+
#
|
17
|
+
# ===========================================================================
|
18
|
+
module Stellar
|
19
|
+
class SurveyResponseMessage < XDR::Struct
|
20
|
+
attribute :surveyor_peer_id, NodeID
|
21
|
+
attribute :surveyed_peer_id, NodeID
|
22
|
+
attribute :ledger_num, Uint32
|
23
|
+
attribute :command_type, SurveyMessageCommandType
|
24
|
+
attribute :encrypted_body, EncryptedBody
|
25
|
+
end
|
26
|
+
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
|
+
# struct TopologyResponseBody
|
9
|
+
# {
|
10
|
+
# PeerStatList inboundPeers;
|
11
|
+
# PeerStatList outboundPeers;
|
12
|
+
#
|
13
|
+
# uint32 totalInboundPeerCount;
|
14
|
+
# uint32 totalOutboundPeerCount;
|
15
|
+
# };
|
16
|
+
#
|
17
|
+
# ===========================================================================
|
18
|
+
module Stellar
|
19
|
+
class TopologyResponseBody < XDR::Struct
|
20
|
+
attribute :inbound_peers, PeerStatList
|
21
|
+
attribute :outbound_peers, PeerStatList
|
22
|
+
attribute :total_inbound_peer_count, Uint32
|
23
|
+
attribute :total_outbound_peer_count, Uint32
|
24
|
+
end
|
25
|
+
end
|