Skip to content

Commit d9243bc

Browse files
authored
Merge pull request #166 from kommitters/v0.6
Release v0.6.1
2 parents 2d10c5f + 153bde7 commit d9243bc

File tree

8 files changed

+49
-18
lines changed

8 files changed

+49
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.6.1 (21.07.2022)
4+
* Add the flags property to the OfferEntry.
5+
* Add security policy to repository.
6+
37
## 0.6.0 (21.03.2022)
48
* XDR types for LedgerEntryExtension, ClaimableBalanceEntry, ClaimableBalanceFlags, DataEntry, TrustLineEntry and OfferEntryFlags.
59

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You should only use **`stellar_base`** if you are planning to build on top of it
2222
```elixir
2323
def deps do
2424
[
25-
{:stellar_base, "~> 0.6.0"}
25+
{:stellar_base, "~> 0.6.1"}
2626
]
2727
end
2828
```

SECURITY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Reporting Security Issues
2+
3+
To report a security issue, please email [oss@kommit.co](mailto:oss@kommit.co) with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue.
4+
5+
If the issue is confirmed as a vulnerability, we will open a Security Advisory and acknowledge your contributions as part of it.

lib/xdr/ledger_entries/offer_entry.ex

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ defmodule StellarBase.XDR.OfferEntry do
77
88
For example an Offer is selling 10A where 1A is priced at 1.5B
99
"""
10-
alias StellarBase.XDR.{AccountID, Asset, Int64, Price}
11-
alias StellarBase.XDR.Ext
10+
alias StellarBase.XDR.{AccountID, Asset, Int64, Price, UInt32, Ext}
1211

1312
@behaviour XDR.Declaration
1413

@@ -19,6 +18,7 @@ defmodule StellarBase.XDR.OfferEntry do
1918
buying: Asset,
2019
amount: Int64,
2120
price: Price,
21+
flags: UInt32,
2222
ext: Ext
2323
)
2424

@@ -29,10 +29,11 @@ defmodule StellarBase.XDR.OfferEntry do
2929
buying: Asset.t(),
3030
amount: Int64.t(),
3131
price: Price.t(),
32+
flags: UInt32.t(),
3233
ext: Ext.t()
3334
}
3435

35-
defstruct [:seller_id, :offer_id, :selling, :buying, :amount, :price, :ext]
36+
defstruct [:seller_id, :offer_id, :selling, :buying, :amount, :price, :flags, :ext]
3637

3738
@spec new(
3839
seller_id :: AccountID.t(),
@@ -41,6 +42,7 @@ defmodule StellarBase.XDR.OfferEntry do
4142
buying :: Asset.t(),
4243
amount :: Int64.t(),
4344
price :: Price.t(),
45+
flags :: UInt32.t(),
4446
ext :: Ext.t()
4547
) ::
4648
t()
@@ -51,6 +53,7 @@ defmodule StellarBase.XDR.OfferEntry do
5153
%Asset{} = buying,
5254
%Int64{} = amount,
5355
%Price{} = price,
56+
%UInt32{} = flags,
5457
%Ext{} = ext
5558
),
5659
do: %__MODULE__{
@@ -60,6 +63,7 @@ defmodule StellarBase.XDR.OfferEntry do
6063
buying: buying,
6164
amount: amount,
6265
price: price,
66+
flags: flags,
6367
ext: ext
6468
}
6569

@@ -71,6 +75,7 @@ defmodule StellarBase.XDR.OfferEntry do
7175
buying: buying,
7276
amount: amount,
7377
price: price,
78+
flags: flags,
7479
ext: ext
7580
}) do
7681
[
@@ -80,6 +85,7 @@ defmodule StellarBase.XDR.OfferEntry do
8085
buying: buying,
8186
amount: amount,
8287
price: price,
88+
flags: flags,
8389
ext: ext
8490
]
8591
|> XDR.Struct.new()
@@ -94,6 +100,7 @@ defmodule StellarBase.XDR.OfferEntry do
94100
buying: buying,
95101
amount: amount,
96102
price: price,
103+
flags: flags,
97104
ext: ext
98105
}) do
99106
[
@@ -103,6 +110,7 @@ defmodule StellarBase.XDR.OfferEntry do
103110
buying: buying,
104111
amount: amount,
105112
price: price,
113+
flags: flags,
106114
ext: ext
107115
]
108116
|> XDR.Struct.new()
@@ -123,10 +131,11 @@ defmodule StellarBase.XDR.OfferEntry do
123131
buying: buying,
124132
amount: amount,
125133
price: price,
134+
flags: flags,
126135
ext: ext
127136
]
128137
}, rest}} ->
129-
{:ok, {new(seller_id, offer_id, selling, buying, amount, price, ext), rest}}
138+
{:ok, {new(seller_id, offer_id, selling, buying, amount, price, flags, ext), rest}}
130139

131140
error ->
132141
error
@@ -145,10 +154,11 @@ defmodule StellarBase.XDR.OfferEntry do
145154
buying: buying,
146155
amount: amount,
147156
price: price,
157+
flags: flags,
148158
ext: ext
149159
]
150160
}, rest} = XDR.Struct.decode_xdr!(bytes, struct)
151161

152-
{new(seller_id, offer_id, selling, buying, amount, price, ext), rest}
162+
{new(seller_id, offer_id, selling, buying, amount, price, flags, ext), rest}
153163
end
154164
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule StellarBase.MixProject do
22
use Mix.Project
33

44
@github_url "https://github.com/kommitters/stellar_base"
5-
@version "0.6.0"
5+
@version "0.6.1"
66

77
def project do
88
[

test/xdr/ledger_entries/offer_entry_test.exs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule StellarBase.XDR.OfferEntryTest do
33

44
import StellarBase.Test.Utils, only: [create_account_id: 1, create_asset: 2]
55

6-
alias StellarBase.XDR.{Ext, Int32, Int64, OfferEntry, Price}
6+
alias StellarBase.XDR.{Ext, Int32, Int64, OfferEntry, Price, UInt32}
77

88
describe "OfferEntry Operation" do
99
setup do
@@ -27,6 +27,8 @@ defmodule StellarBase.XDR.OfferEntryTest do
2727

2828
price = Price.new(Int32.new(1), Int32.new(10))
2929

30+
flags = UInt32.new(1)
31+
3032
ext = Ext.new()
3133

3234
%{
@@ -36,8 +38,10 @@ defmodule StellarBase.XDR.OfferEntryTest do
3638
buying: buying,
3739
amount: amount,
3840
price: price,
41+
flags: flags,
3942
ext: ext,
40-
offer_entry: OfferEntry.new(seller_id, offer_id, selling, buying, amount, price, ext),
43+
offer_entry:
44+
OfferEntry.new(seller_id, offer_id, selling, buying, amount, price, flags, ext),
4145
binary:
4246
<<0, 0, 0, 0, 155, 142, 186, 248, 150, 56, 85, 29, 207, 158, 164, 247, 67, 32, 113, 16,
4347
107, 135, 171, 14, 45, 179, 214, 155, 117, 165, 56, 34, 114, 247, 89, 216, 0, 0, 0, 0,
@@ -46,7 +50,7 @@ defmodule StellarBase.XDR.OfferEntryTest do
4650
25, 212, 179, 73, 138, 2, 227, 119, 0, 0, 0, 2, 66, 84, 67, 78, 69, 87, 50, 48, 50,
4751
49, 0, 0, 0, 0, 0, 0, 114, 213, 178, 144, 98, 27, 186, 154, 137, 68, 149, 154, 124,
4852
205, 198, 221, 187, 173, 152, 33, 210, 37, 10, 76, 25, 212, 179, 73, 138, 2, 227, 119,
49-
0, 0, 0, 0, 0, 76, 75, 64, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 0>>
53+
0, 0, 0, 0, 0, 76, 75, 64, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 0>>
5054
}
5155
end
5256

@@ -57,15 +61,19 @@ defmodule StellarBase.XDR.OfferEntryTest do
5761
buying: buying,
5862
amount: amount,
5963
price: price,
64+
flags: flags,
6065
ext: ext
6166
} do
6267
%OfferEntry{
6368
seller_id: ^seller_id,
6469
offer_id: ^offer_id,
6570
selling: ^selling,
6671
buying: ^buying,
67-
amount: ^amount
68-
} = OfferEntry.new(seller_id, offer_id, selling, buying, amount, price, ext)
72+
amount: ^amount,
73+
price: ^price,
74+
flags: ^flags,
75+
ext: ^ext
76+
} = OfferEntry.new(seller_id, offer_id, selling, buying, amount, price, flags, ext)
6977
end
7078

7179
test "encode_xdr/1", %{offer_entry: offer_entry, binary: binary} do

test/xdr/transactions/operations/manage_offer_success_result_test.exs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ defmodule StellarBase.XDR.Operations.ManageOfferSuccessResultTest do
1212
Int32,
1313
Int64,
1414
OfferEntry,
15-
Price
15+
Price,
16+
UInt32
1617
}
1718

1819
alias StellarBase.XDR.Operations.{ManageOffer, ManageOfferEffect, ManageOfferSuccessResult}
@@ -76,7 +77,7 @@ defmodule StellarBase.XDR.Operations.ManageOfferSuccessResultTest do
7677
10, 76, 25, 212, 179, 73, 138, 2, 227, 119, 0, 0, 0, 2, 66, 84, 67, 78, 69, 87, 50,
7778
48, 50, 49, 0, 0, 0, 0, 0, 0, 114, 213, 178, 144, 98, 27, 186, 154, 137, 68, 149, 154,
7879
124, 205, 198, 221, 187, 173, 152, 33, 210, 37, 10, 76, 25, 212, 179, 73, 138, 2, 227,
79-
119, 0, 0, 0, 0, 0, 76, 75, 64, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 0>>
80+
119, 0, 0, 0, 0, 0, 76, 75, 64, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 0>>
8081
}
8182
end
8283

@@ -112,6 +113,7 @@ defmodule StellarBase.XDR.Operations.ManageOfferSuccessResultTest do
112113
offer_id = Int64.new(123_456)
113114
amount = Int64.new(5_000_000)
114115
price = Price.new(Int32.new(1), Int32.new(10))
116+
flags = UInt32.new(1)
115117
ext = Ext.new()
116118

117119
selling =
@@ -127,7 +129,7 @@ defmodule StellarBase.XDR.Operations.ManageOfferSuccessResultTest do
127129
)
128130

129131
seller_id
130-
|> OfferEntry.new(offer_id, selling, buying, amount, price, ext)
132+
|> OfferEntry.new(offer_id, selling, buying, amount, price, flags, ext)
131133
|> ManageOffer.new(ManageOfferEffect.new(:MANAGE_OFFER_CREATED))
132134
end
133135
end

test/xdr/transactions/operations/manage_offer_test.exs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule StellarBase.XDR.Operations.ManageOfferTest do
33

44
import StellarBase.Test.Utils
55

6-
alias StellarBase.XDR.{Ext, Int32, Int64, OfferEntry, Price}
6+
alias StellarBase.XDR.{Ext, Int32, Int64, OfferEntry, Price, UInt32}
77
alias StellarBase.XDR.Operations.{ManageOffer, ManageOfferEffect}
88

99
describe "ManageOffer" do
@@ -28,11 +28,13 @@ defmodule StellarBase.XDR.Operations.ManageOfferTest do
2828

2929
price = Price.new(Int32.new(1), Int32.new(10))
3030

31+
flags = UInt32.new(1)
32+
3133
ext = Ext.new()
3234

3335
effect = ManageOfferEffect.new(:MANAGE_OFFER_CREATED)
3436

35-
offer = OfferEntry.new(seller_id, offer_id, selling, buying, amount, price, ext)
37+
offer = OfferEntry.new(seller_id, offer_id, selling, buying, amount, price, flags, ext)
3638

3739
%{
3840
effect: effect,
@@ -46,7 +48,7 @@ defmodule StellarBase.XDR.Operations.ManageOfferTest do
4648
37, 10, 76, 25, 212, 179, 73, 138, 2, 227, 119, 0, 0, 0, 2, 66, 84, 67, 78, 69, 87,
4749
50, 48, 50, 49, 0, 0, 0, 0, 0, 0, 114, 213, 178, 144, 98, 27, 186, 154, 137, 68, 149,
4850
154, 124, 205, 198, 221, 187, 173, 152, 33, 210, 37, 10, 76, 25, 212, 179, 73, 138, 2,
49-
227, 119, 0, 0, 0, 0, 0, 76, 75, 64, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 0>>
51+
227, 119, 0, 0, 0, 0, 0, 76, 75, 64, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 0>>
5052
}
5153
end
5254

0 commit comments

Comments
 (0)