stellar-base 0.23.0 → 0.23.1
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 +12 -0
- data/README.md +0 -3
- data/lib/stellar/transaction.rb +18 -0
- data/lib/stellar/transaction_builder.rb +10 -19
- data/lib/stellar/transaction_v0.rb +12 -0
- data/lib/stellar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee7c9178d44b90ea76adef982ec44927775101498a500fa0a00c7ec628bbffa9
|
4
|
+
data.tar.gz: 8135ebe14a37dcb84ae903bd428b038037f1a9feb35460265fac86f3f6c489a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c4b5b21650d187486994c7e22db39b1a7812897e2872492b7955b77843783087adfc7440b18cbc58f00e1c569075a05f6fa8c2a1801789a240b6ef71f011819
|
7
|
+
data.tar.gz: 69a634ed5af1faaa4b81ed9bc07da4977618435f8f1ec4c42e39d039ab12362dd76f27bd00eaf1cdf5bda66d2fdabf172b81cba423e554bddea94d8eeb1bc2a7
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,18 @@ 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.23.1](https://github.com/stellar/ruby-stellar-sdk/compare/v0.23.1...v0.23.0) - 2020-06-18
|
10
|
+
### Added
|
11
|
+
- Transaction builder now builds V1 transactions
|
12
|
+
- FeeBumpTransaction can wrap V0 transaction
|
13
|
+
|
14
|
+
## [0.23.0](https://github.com/stellar/ruby-stellar-sdk/compare/v0.23.0...v0.22.0) - 2020-06-11
|
15
|
+
### Added
|
16
|
+
- Stellar Protocol 13 support
|
17
|
+
- Fee-Bump transactions ([CAP-0015](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0015.md))
|
18
|
+
- Multiplexed accounts ([CAP-0027](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0027.md))
|
19
|
+
- Fine-Grained control on trustline authorization ([CAP-0018](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0018.md))
|
20
|
+
|
9
21
|
## [0.22.0](https://github.com/stellar/ruby-stellar-base/compare/v0.21.0...v0.22.0) - 2020-03-26
|
10
22
|
### Added
|
11
23
|
- Add TransactionBuilder ([#54](https://github.com/stellar/ruby-stellar-base/issues/54))
|
data/README.md
CHANGED
@@ -12,15 +12,12 @@ Add this line to your application's Gemfile:
|
|
12
12
|
|
13
13
|
```ruby
|
14
14
|
gem 'stellar-base'
|
15
|
-
gem 'xdr', git: 'https://github.com/stellar/ruby-xdr.git', tag: 'v3.0.1'
|
16
15
|
```
|
17
16
|
|
18
17
|
And then execute:
|
19
18
|
|
20
19
|
$ bundle
|
21
20
|
|
22
|
-
**Note** we need to add such explicit xdr dependency, because version 3.0.1 is not on RubyGems yet. When it's published, you can remove this line
|
23
|
-
|
24
21
|
Also requires libsodium. Installable via `brew install libsodium` on OS X.
|
25
22
|
|
26
23
|
## Supported Ruby Versions
|
data/lib/stellar/transaction.rb
CHANGED
@@ -170,6 +170,24 @@ module Stellar
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
+
def to_v0
|
174
|
+
ed25519 = if source_account.switch == Stellar::CryptoKeyType.key_type_ed25519
|
175
|
+
source_account.ed25519!
|
176
|
+
else
|
177
|
+
source_account.med25519!.ed25519
|
178
|
+
end
|
179
|
+
|
180
|
+
TransactionV0.new(
|
181
|
+
source_account_ed25519: ed25519,
|
182
|
+
seq_num: seq_num,
|
183
|
+
operations: operations,
|
184
|
+
fee: fee,
|
185
|
+
memo: memo,
|
186
|
+
time_bounds: time_bounds,
|
187
|
+
ext: ext
|
188
|
+
)
|
189
|
+
end
|
190
|
+
|
173
191
|
def signature_base
|
174
192
|
tagged_tx = Stellar::TransactionSignaturePayload::TaggedTransaction.new(:envelope_type_tx, self)
|
175
193
|
Stellar::TransactionSignaturePayload.new(
|
@@ -7,8 +7,7 @@ module Stellar
|
|
7
7
|
sequence_number:,
|
8
8
|
base_fee: 100,
|
9
9
|
time_bounds: nil,
|
10
|
-
memo: nil
|
11
|
-
v1: false
|
10
|
+
memo: nil
|
12
11
|
)
|
13
12
|
raise ArgumentError, "Bad :source_account" unless source_account.is_a?(Stellar::KeyPair)
|
14
13
|
raise ArgumentError, "Bad :sequence_number" unless sequence_number.is_a?(Integer) && sequence_number >= 0
|
@@ -21,7 +20,6 @@ module Stellar
|
|
21
20
|
@time_bounds = time_bounds
|
22
21
|
@memo = make_memo(memo)
|
23
22
|
@operations = []
|
24
|
-
@v1 = v1
|
25
23
|
end
|
26
24
|
|
27
25
|
def build
|
@@ -34,6 +32,7 @@ module Stellar
|
|
34
32
|
end
|
35
33
|
|
36
34
|
attrs = {
|
35
|
+
source_account: @source_account.muxed_account,
|
37
36
|
fee: @base_fee * @operations.length,
|
38
37
|
seq_num: @sequence_number,
|
39
38
|
time_bounds: @time_bounds,
|
@@ -42,21 +41,17 @@ module Stellar
|
|
42
41
|
ext: Stellar::Transaction::Ext.new(0)
|
43
42
|
}
|
44
43
|
|
45
|
-
tx = if @v1
|
46
|
-
attrs[:source_account] = @source_account.muxed_account
|
47
|
-
Stellar::Transaction.new(attrs)
|
48
|
-
else
|
49
|
-
attrs[:source_account_ed25519] = @source_account.raw_public_key
|
50
|
-
Stellar::TransactionV0.new(attrs)
|
51
|
-
end
|
52
|
-
|
53
44
|
@sequence_number += 1
|
54
|
-
|
45
|
+
|
46
|
+
Stellar::Transaction.new(attrs)
|
55
47
|
end
|
56
48
|
|
57
49
|
def build_fee_bump(inner_txe:)
|
58
|
-
|
59
|
-
|
50
|
+
p inner_txe.switch
|
51
|
+
if inner_txe.switch == Stellar::EnvelopeType.envelope_type_tx_v0
|
52
|
+
inner_txe = Stellar::TransactionEnvelope.v1(tx: inner_txe.tx.to_v1, signatures: inner_txe.signatures)
|
53
|
+
elsif inner_txe.switch != Stellar::EnvelopeType.envelope_type_tx
|
54
|
+
raise ArgumentError, "Invalid inner transaction type #{inner_txe.switch}"
|
60
55
|
end
|
61
56
|
|
62
57
|
inner_tx = inner_txe.tx
|
@@ -108,11 +103,7 @@ module Stellar
|
|
108
103
|
@time_bounds = Stellar::TimeBounds.new(min_time: 0, max_time: nil)
|
109
104
|
end
|
110
105
|
|
111
|
-
@time_bounds.max_time =
|
112
|
-
timeout
|
113
|
-
else
|
114
|
-
Time.now.to_i + timeout
|
115
|
-
end
|
106
|
+
@time_bounds.max_time = timeout == 0 ? timeout : Time.now.to_i + timeout
|
116
107
|
|
117
108
|
self
|
118
109
|
end
|
@@ -2,6 +2,18 @@ module Stellar
|
|
2
2
|
class TransactionV0
|
3
3
|
include Stellar::Concerns::Transaction
|
4
4
|
|
5
|
+
def to_v1
|
6
|
+
Transaction.new(
|
7
|
+
source_account: Stellar::MuxedAccount.new(:key_type_ed25519, source_account),
|
8
|
+
seq_num: seq_num,
|
9
|
+
operations: operations,
|
10
|
+
fee: fee,
|
11
|
+
memo: memo,
|
12
|
+
time_bounds: time_bounds,
|
13
|
+
ext: ext
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
5
17
|
def to_envelope(*key_pairs)
|
6
18
|
signatures = (key_pairs || []).map(&method(:sign_decorated))
|
7
19
|
|
data/lib/stellar/version.rb
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.23.
|
4
|
+
version: 0.23.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdr
|