Skip to content

Commit

Permalink
feat: add support for horizon-v2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Jan 28, 2022
1 parent c38a0be commit 3781cfc
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 7 deletions.
4 changes: 4 additions & 0 deletions stellar_model/model/horizon/claimable_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class ClaimPredicate(BaseModel):
"balance can be claimed. If the balance is claimed before the "
"date then this clause of the condition is satisfied."
)
abs_before_epoch: Optional[int] = Field(
"The Unix Epoch value represented by the same custom extended "
"ISO date value in the abs_before field."
)
rel_before: Optional[int] = Field(
description="A relative deadline for when the claimable balance can be "
"claimed. The value represents the number of seconds since the "
Expand Down
8 changes: 7 additions & 1 deletion tests/model/horizon/test_claimable_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def test_conditional_valid(self):
parsed_data.claimants[0].predicate.abs_before,
datetime.datetime(2021, 4, 21, 19, 3, 6, tzinfo=datetime.timezone.utc),
)

self.assertEqual(
parsed_data.claimants[0].predicate.abs_before_epoch, 1619031786
)
self.assertEqual(
parsed_data.claimants[1].destination,
"GDDAESY7RTZAZNWZLZD5RIKP2TWEAVISKQJZ43ZZ2YTMCNICRVW7OJP3",
Expand All @@ -62,3 +64,7 @@ def test_conditional_valid(self):
parsed_data.claimants[1].predicate.not_predicate.abs_before,
datetime.datetime(2021, 4, 21, 19, 3, 1, tzinfo=datetime.timezone.utc),
)
self.assertEqual(
parsed_data.claimants[1].predicate.not_predicate.abs_before_epoch,
1619031781,
)
3 changes: 3 additions & 0 deletions tests/model/horizon/test_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ def test_valid_claimable_balance_claimant_created(self):
parsed_data.predicate.not_predicate.abs_before,
datetime.datetime(2021, 4, 26, 4, 0, tzinfo=datetime.timezone.utc),
)
self.assertEqual(
parsed_data.predicate.not_predicate.abs_before_epoch, 1619409600
)

def test_valid_claimable_balance_claimed(self):
raw_data = load_horizon_file("effects/claimable_balance_claimed.json")
Expand Down
4 changes: 4 additions & 0 deletions tests/model/horizon/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ def test_valid_create_claimable_balance_operation(self):
parsed_data.claimants[1].predicate.not_predicate.abs_before,
datetime.datetime(2021, 4, 26, 4, 0, tzinfo=datetime.timezone.utc),
)
self.assertEqual(
parsed_data.claimants[1].predicate.not_predicate.abs_before_epoch,
1619409600,
)

def test_valid_claim_claimable_balance_operation(self):
raw_data = load_horizon_file("operations/claim_claimable_balance.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
{
"destination": "GCYTED6QWSGDNLQ2RBXDVYSKCOUB2BC6DLKGAU5QPNONMVN47ABUN6WE",
"predicate": {
"abs_before": "2021-04-21T19:03:06Z"
"abs_before": "2021-04-21T19:03:06Z",
"abs_before_epoch": 1619031786
}
},
{
"destination": "GDDAESY7RTZAZNWZLZD5RIKP2TWEAVISKQJZ43ZZ2YTMCNICRVW7OJP3",
"predicate": {
"not": {
"abs_before": "2021-04-21T19:03:01Z"
"abs_before": "2021-04-21T19:03:01Z",
"abs_before_epoch": 1619031781
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"amount": "900.0000000",
"predicate": {
"not": {
"abs_before": "2021-04-26T04:00:00Z"
"abs_before": "2021-04-26T04:00:00Z",
"abs_before_epoch": 1619409600
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"destination": "GCBMP2WKIAX7KVDRCSFXJWFM5P7HDCGTCC76U5XR52OYII6AOWS7G3DT",
"predicate": {
"not": {
"abs_before": "2021-04-26T04:00:00Z"
"abs_before": "2021-04-26T04:00:00Z",
"abs_before_epoch": 1619409600
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion tests/resources/response/claimable_balances_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"destination": "GCBMP2WKIAX7KVDRCSFXJWFM5P7HDCGTCC76U5XR52OYII6AOWS7G3DT",
"predicate": {
"not": {
"abs_before": "2021-04-26T04:00:00Z"
"abs_before": "2021-04-26T04:00:00Z",
"abs_before_epoch": 1619409600
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion tests/resources/response/operations_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@
"destination": "GCBMP2WKIAX7KVDRCSFXJWFM5P7HDCGTCC76U5XR52OYII6AOWS7G3DT",
"predicate": {
"not": {
"abs_before": "2021-04-26T04:00:00Z"
"abs_before": "2021-04-26T04:00:00Z",
"abs_before_epoch": 1619409600
}
}
}
Expand Down

0 comments on commit 3781cfc

Please sign in to comment.