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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ea78340f6994e3e65e1ff94c06da49d4c7443ec
4
- data.tar.gz: c7e8b4bec536d169cda2728b576d837cf26fc049
3
+ metadata.gz: cf6776556e7768bfa027ac24a2f5db5ab06cc2c5
4
+ data.tar.gz: 27742e565e992025460c86d1a85f95fccad3f238
5
5
  SHA512:
6
- metadata.gz: 1df05ce3d1bf317582b8d83b15e0416d3dba1bd90a99293f21c9a86c67f2c477778d5ae9c7d53beca95bebe42ea6d54c1a00eb7bea5ea1fcad13d2e78fdd5b4d
7
- data.tar.gz: 11258c89a6dede4947fb70809a365b4840495d3a15e60d998a0a53c38bf831b756259ee9bced4bb85767f4e5f26bc613d3ff2b1ac353b7f3ca7e19ee71a3bc40
6
+ metadata.gz: 1e5322413bba96a461eb56e22203affb4b70fd1ac7cbca8db2dfafa9a61b143f90ce500ea282e2f77da8046bcf49b8d8094a3b5c4cc111ae64d5d2af0f4873bd
7
+ data.tar.gz: e55615e11ab0f4fc661a8887fae017f5822391b863d79aae8e3eb98275abbbed57029fbb788626434f8b651cc97b286d79e746318af6224dc77f6e9376cbf4bf
@@ -1,5 +1,5 @@
1
1
  module Stellar
2
2
  module Base
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -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::util::StrKey.check_encode(:account_id, pk)
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.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-21 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xdr