@@ -11,6 +11,7 @@ defmodule StellarBase.StrKeyTest do
11
11
pre_auth_tx: "TBAUEQ2EIVDEOSCJJJFUYTKOJ5IFCUSTKRAUEQ2EIVDEOSCJJJAUCYSF" ,
12
12
signed_payload:
13
13
"PA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAQACAQDAQCQMBYIBEFAWDANBYHRAEISCMKBKFQXDAMRUGY4DUPB6IBZGM" ,
14
+ contract: "CCEMOFO5TE7FGOAJOA3RDHPC6RW3CFXRVIGOFQPFE4ZGOKA2QEA636SN" ,
14
15
ed25519_public_key_binary:
15
16
<< 140 , 41 , 54 , 138 , 42 , 205 , 199 , 107 , 245 , 247 , 190 , 85 , 36 , 15 , 30 , 168 , 67 , 63 , 52 ,
16
17
183 , 198 , 97 , 56 , 146 , 34 , 127 , 90 , 21 , 230 , 0 , 172 , 89 >> ,
@@ -27,7 +28,10 @@ defmodule StellarBase.StrKeyTest do
27
28
<< 63 , 12 , 52 , 191 , 147 , 173 , 13 , 153 , 113 , 208 , 76 , 204 , 144 , 247 , 5 , 81 , 28 , 131 , 138 ,
28
29
173 , 151 , 52 , 164 , 162 , 251 , 13 , 122 , 3 , 252 , 127 , 232 , 154 , 0 , 0 , 0 , 32 , 1 , 2 , 3 , 4 , 5 ,
29
30
6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 ,
30
- 29 , 30 , 31 , 32 >>
31
+ 29 , 30 , 31 , 32 >> ,
32
+ contract_binary:
33
+ << 136 , 199 , 21 , 221 , 153 , 62 , 83 , 56 , 9 , 112 , 55 , 17 , 157 , 226 , 244 , 109 , 177 , 22 , 241 ,
34
+ 170 , 12 , 226 , 193 , 229 , 39 , 50 , 103 , 40 , 26 , 129 , 1 , 237 >>
31
35
}
32
36
end
33
37
@@ -55,6 +59,10 @@ defmodule StellarBase.StrKeyTest do
55
59
test "signed_payload" , % { signed_payload: signed_payload , signed_payload_binary: binary } do
56
60
{ :ok , ^ signed_payload } = StrKey . encode ( binary , :signed_payload )
57
61
end
62
+
63
+ test "contract" , % { contract: contract , contract_binary: binary } do
64
+ { :ok , ^ contract } = StrKey . encode ( binary , :contract )
65
+ end
58
66
end
59
67
60
68
describe "encode!/2" do
@@ -83,6 +91,10 @@ defmodule StellarBase.StrKeyTest do
83
91
test "signed_payload" , % { signed_payload: signed_payload , signed_payload_binary: binary } do
84
92
^ signed_payload = StrKey . encode! ( binary , :signed_payload )
85
93
end
94
+
95
+ test "contract" , % { contract: contract , contract_binary: binary } do
96
+ ^ contract = StrKey . encode! ( binary , :contract )
97
+ end
86
98
end
87
99
88
100
describe "decode/2" do
@@ -110,6 +122,10 @@ defmodule StellarBase.StrKeyTest do
110
122
{ :ok , ^ binary } = StrKey . decode ( signed_payload , :signed_payload )
111
123
end
112
124
125
+ test "contract" , % { contract: contract , contract_binary: binary } do
126
+ { :ok , ^ binary } = StrKey . decode ( contract , :contract )
127
+ end
128
+
113
129
test "invalid version byte" , % { muxed_account: muxed_account } do
114
130
{ :error , :unmatched_version_bytes } = StrKey . decode ( muxed_account , :ed25519_public_key )
115
131
end
@@ -150,6 +166,10 @@ defmodule StellarBase.StrKeyTest do
150
166
^ binary = StrKey . decode! ( signed_payload , :signed_payload )
151
167
end
152
168
169
+ test "contract" , % { contract: contract , contract_binary: binary } do
170
+ ^ binary = StrKey . decode! ( contract , :contract )
171
+ end
172
+
153
173
test "invalid version byte" , % { muxed_account: muxed_account } do
154
174
assert_raise StrKeyError , "version bytes does not match" , fn ->
155
175
StrKey . decode! ( muxed_account , :ed25519_public_key )
0 commit comments