Skip to content

Commit

Permalink
Merge pull request #261 from kommitters/v0.10
Browse files Browse the repository at this point in the history
Release v0.10.1
  • Loading branch information
CristhianRodriguezMolina committed May 2, 2023
2 parents 8dc4d41 + 95cbc18 commit bd44e09
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.10.1 (02.05.2023)

* Add missing contract version_byte in StrKey.

## 0.10.0 (24.04.2023)

* Add [Soroban Preview 8](https://soroban.stellar.org/docs/reference/releases#preview-8-april-4th-2023) Support in the XDR version: [7356dc237ee0db5626561c129fb3fa4beaabbac6](https://github.com/stellar/stellar-xdr/commit/7356dc237ee0db5626561c129fb3fa4beaabbac6) with its respective [Preview 8 changes](https://github.com/stellar/stellar-xdr/compare/df18148747e807618acf4639db41c4fd6f0be9fc...7356dc237ee0db5626561c129fb3fa4beaabbac6#diff-891b3a6e0eb8f9ac887a8129e2c821931837fb42224200ee78cce639eeb61c15).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You should only use **`stellar_base`** if you are planning to build on top of it
```elixir
def deps do
[
{:stellar_base, "~> 0.10.0"}
{:stellar_base, "~> 0.10.1"}
]
end
```
Expand Down
4 changes: 3 additions & 1 deletion lib/strkey/strkey.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ defmodule StellarBase.StrKey do
# Base32-encodes to 'M...'
muxed_account: 12 <<< 3,
# Base32-encodes to 'P...'
signed_payload: 15 <<< 3
signed_payload: 15 <<< 3,
# Base32-encodes to 'C...'
contract: 2 <<< 3
]

@spec encode(data :: binary_data(), version :: version()) ::
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule StellarBase.MixProject do
use Mix.Project

@github_url "https://github.com/kommitters/stellar_base"
@version "0.10.0"
@version "0.10.1"

def project do
[
Expand Down
22 changes: 21 additions & 1 deletion test/strkey/strkey_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule StellarBase.StrKeyTest do
pre_auth_tx: "TBAUEQ2EIVDEOSCJJJFUYTKOJ5IFCUSTKRAUEQ2EIVDEOSCJJJAUCYSF",
signed_payload:
"PA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAQACAQDAQCQMBYIBEFAWDANBYHRAEISCMKBKFQXDAMRUGY4DUPB6IBZGM",
contract: "CCEMOFO5TE7FGOAJOA3RDHPC6RW3CFXRVIGOFQPFE4ZGOKA2QEA636SN",
ed25519_public_key_binary:
<<140, 41, 54, 138, 42, 205, 199, 107, 245, 247, 190, 85, 36, 15, 30, 168, 67, 63, 52,
183, 198, 97, 56, 146, 34, 127, 90, 21, 230, 0, 172, 89>>,
Expand All @@ -27,7 +28,10 @@ defmodule StellarBase.StrKeyTest do
<<63, 12, 52, 191, 147, 173, 13, 153, 113, 208, 76, 204, 144, 247, 5, 81, 28, 131, 138,
173, 151, 52, 164, 162, 251, 13, 122, 3, 252, 127, 232, 154, 0, 0, 0, 32, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32>>
29, 30, 31, 32>>,
contract_binary:
<<136, 199, 21, 221, 153, 62, 83, 56, 9, 112, 55, 17, 157, 226, 244, 109, 177, 22, 241,
170, 12, 226, 193, 229, 39, 50, 103, 40, 26, 129, 1, 237>>
}
end

Expand Down Expand Up @@ -55,6 +59,10 @@ defmodule StellarBase.StrKeyTest do
test "signed_payload", %{signed_payload: signed_payload, signed_payload_binary: binary} do
{:ok, ^signed_payload} = StrKey.encode(binary, :signed_payload)
end

test "contract", %{contract: contract, contract_binary: binary} do
{:ok, ^contract} = StrKey.encode(binary, :contract)
end
end

describe "encode!/2" do
Expand Down Expand Up @@ -83,6 +91,10 @@ defmodule StellarBase.StrKeyTest do
test "signed_payload", %{signed_payload: signed_payload, signed_payload_binary: binary} do
^signed_payload = StrKey.encode!(binary, :signed_payload)
end

test "contract", %{contract: contract, contract_binary: binary} do
^contract = StrKey.encode!(binary, :contract)
end
end

describe "decode/2" do
Expand Down Expand Up @@ -110,6 +122,10 @@ defmodule StellarBase.StrKeyTest do
{:ok, ^binary} = StrKey.decode(signed_payload, :signed_payload)
end

test "contract", %{contract: contract, contract_binary: binary} do
{:ok, ^binary} = StrKey.decode(contract, :contract)
end

test "invalid version byte", %{muxed_account: muxed_account} do
{:error, :unmatched_version_bytes} = StrKey.decode(muxed_account, :ed25519_public_key)
end
Expand Down Expand Up @@ -150,6 +166,10 @@ defmodule StellarBase.StrKeyTest do
^binary = StrKey.decode!(signed_payload, :signed_payload)
end

test "contract", %{contract: contract, contract_binary: binary} do
^binary = StrKey.decode!(contract, :contract)
end

test "invalid version byte", %{muxed_account: muxed_account} do
assert_raise StrKeyError, "version bytes does not match", fn ->
StrKey.decode!(muxed_account, :ed25519_public_key)
Expand Down

0 comments on commit bd44e09

Please sign in to comment.