stellar-base 0.1.1 → 0.1.2
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/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/convert.rb +3 -1
- data/spec/lib/stellar/convert_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf6776556e7768bfa027ac24a2f5db5ab06cc2c5
|
4
|
+
data.tar.gz: 27742e565e992025460c86d1a85f95fccad3f238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e5322413bba96a461eb56e22203affb4b70fd1ac7cbca8db2dfafa9a61b143f90ce500ea282e2f77da8046bcf49b8d8094a3b5c4cc111ae64d5d2af0f4873bd
|
7
|
+
data.tar.gz: e55615e11ab0f4fc661a8887fae017f5822391b863d79aae8e3eb98275abbbed57029fbb788626434f8b651cc97b286d79e746318af6224dc77f6e9376cbf4bf
|
data/lib/stellar/base/version.rb
CHANGED
data/lib/stellar/convert.rb
CHANGED
@@ -21,8 +21,10 @@ module Stellar
|
|
21
21
|
Base64.strict_decode64(base64_string)
|
22
22
|
end
|
23
23
|
|
24
|
+
## Converts a Stellar::PublicKey instance (or any typedef of it such as
|
25
|
+
# Stellar::AccountID) to an address
|
24
26
|
def pk_to_address(pk)
|
25
|
-
Stellar::
|
27
|
+
Stellar::Util::StrKey.check_encode(:account_id, pk.ed25519!)
|
26
28
|
end
|
27
29
|
|
28
30
|
extend self
|
@@ -49,4 +49,13 @@ describe Stellar::Convert do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
|
52
|
+
describe "#pk_to_address" do
|
53
|
+
let(:pk_raw){ "\x00" * 32 }
|
54
|
+
let(:pk_account_id){ Stellar::AccountID.new(:key_type_ed25519, pk_raw)}
|
55
|
+
|
56
|
+
it "converts a Stellar::AccountID into an address using StrKey.check_encode(:account_id)" do
|
57
|
+
address = Stellar::Util::StrKey.check_encode(:account_id, pk_raw)
|
58
|
+
expect(subject.pk_to_address(pk_account_id)).to eql(address)
|
59
|
+
end
|
60
|
+
end
|
52
61
|
end
|
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.1.
|
4
|
+
version: 0.1.2
|
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-07-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdr
|